Author: maurelio1234
Date: 2007-08-12 12:40:57-0700
New Revision: 13298
Modified:
branches/gsoc2007/maurelio1234/src_new/build.bat
branches/gsoc2007/maurelio1234/src_new/ext/javabeans.jar
branches/gsoc2007/maurelio1234/src_new/org/argouml/kernel/ProjectImpl.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/ProfileSelectionTab.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/ProjectSettingsTabProfile.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/SettingsTabProfile.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/explorer/ActionExportProfileXMI.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/cognitive/critics/WizAddConstructor.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/diagram/ui/StereotypeUtility.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/Profile.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileConfiguration.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileCpp.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileJava.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManagerImpl.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/reveng/java/Modeller.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java
branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLTagDefinitionComboBoxModel.java
Log:
implementing profile dependencies
solving bugs
Modified: branches/gsoc2007/maurelio1234/src_new/build.bat
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/build.bat?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/build.bat&p2=branches/gsoc2007/maurelio1234/src_new/build.bat&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/build.bat (original)
+++ branches/gsoc2007/maurelio1234/src_new/build.bat 2007-08-12 12:40:57-0700
@@ -8,10 +8,10 @@
set ANT_HOME=..\tools\apache-ant-1.7.0
:: Convert relative path to absolute
-pushd %ANT_HOME%
+pushd "%ANT_HOME%"
set ANT_HOME=%CD%
popd
-call %ANT_HOME%\bin\ant %1 %2 %3 %4 %5 %6 %7 %8 %9
+call "%ANT_HOME%\bin\ant" %1 %2 %3 %4 %5 %6 %7 %8 %9
endlocal
\ No newline at end of file
Modified: branches/gsoc2007/maurelio1234/src_new/ext/javabeans.jar
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/ext/javabeans.jar?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/ext/javabeans.jar&p2=branches/gsoc2007/maurelio1234/src_new/ext/javabeans.jar&r1=13297&r2=13298
==============================================================================
Binary files. No diff available.
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/kernel/ProjectImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/kernel/ProjectImpl.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/kernel/ProjectImpl.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/kernel/ProjectImpl.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/kernel/ProjectImpl.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/kernel/ProjectImpl.java 2007-08-12 12:40:57-0700
@@ -163,11 +163,6 @@
*/
public ProjectImpl() {
setProfileConfiguration(new ProfileConfiguration(this));
- Iterator it = ProfileManagerImpl.getInstance().getDefaultProfiles().iterator();
-
- while (it.hasNext()) {
- getProfileConfiguration().addProfile((Profile) it.next());
- }
projectSettings = new ProjectSettings();
@@ -523,7 +518,8 @@
public Collection getModels() {
Set ret = new HashSet();
ret.addAll(models);
- ret.addAll(profileConfiguration.getProfileModels());
+ // TODO are the profiles part of the getModels()???
+// ret.addAll(profileConfiguration.getProfileModels());
return ret;
}
@@ -942,11 +938,7 @@
return defaultModelTypeCache.get(name);
}
- Object result = null;
- Iterator it = profileConfiguration.getProfileModels().iterator();
- while (result == null && it.hasNext()) {
- result = findTypeInModel(name, it.next());
- }
+ Object result = profileConfiguration.findType(name);
defaultModelTypeCache.put(name, result);
return result;
@@ -1093,7 +1085,7 @@
public Profile getProfile() {
- return profileConfiguration.getDefaultProfile();
+ throw new UnsupportedOperationException();
}
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java 2007-08-12 12:40:57-0700
@@ -188,25 +188,26 @@
Iterator it = pc.getProfiles().iterator();
while (it.hasNext()) {
- Profile profile = (Profile) it.next();
+ Profile profile = (Profile) it.next();
- if (!pc.getDefaultProfile().equals(profile)) {
- if (profile instanceof UserDefinedProfile) {
- w.println("\t\t<userDefined>");
- w.println("\t\t\t<filename>"+((UserDefinedProfile)profile).getModelFile().getName()+"</filename>");
- w.println("\t\t\t<model>");
-
- printModelXMI(w, profile.getModel());
-
- w.println("\t\t\t</model>");
- w.println("\t\t</userDefined>");
- } else {
- w.println("\t\t<plugin>");
- w.println("\t\t\t" + profile.getClass().getName());
- w.println("\t\t</plugin>");
- }
- }
- }
+ if (profile instanceof UserDefinedProfile) {
+ UserDefinedProfile uprofile = (UserDefinedProfile) profile;
+ w.println("\t\t<userDefined>");
+ w.println("\t\t\t<filename>"
+ + uprofile.getModelFile().getName()
+ + "</filename>");
+ w.println("\t\t\t<model>");
+
+ printModelXMI(w, uprofile.getModel());
+
+ w.println("\t\t\t</model>");
+ w.println("\t\t</userDefined>");
+ } else {
+ w.println("\t\t<plugin>");
+ w.println("\t\t\t" + profile.getClass().getName());
+ w.println("\t\t</plugin>");
+ }
+ }
w.println("</profile>");
}
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/ProfileSelectionTab.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/ProfileSelectionTab.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/ProfileSelectionTab.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/ProfileSelectionTab.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/ProfileSelectionTab.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/ProfileSelectionTab.java 2007-08-12 12:40:57-0700
@@ -342,28 +342,28 @@
"Only user defined profiles can be removed");
}
}
- } else if (arg0.getSource() == loadFromFile) {
- JFileChooser fileChooser = new JFileChooser();
- fileChooser.setFileFilter(new FileFilter() {
-
- public boolean accept(File file) {
- return file.isDirectory()
- || (file.isFile()
- && (file.getName().endsWith(".xml")
- || file.getName().endsWith(".xmi")));
- }
+ } else if (arg0.getSource() == loadFromFile) {
+ JFileChooser fileChooser = new JFileChooser();
+ fileChooser.setFileFilter(new FileFilter() {
+
+ public boolean accept(File file) {
+ return file.isDirectory()
+ || (file.isFile()
+ && (file.getName().toLowerCase().endsWith(".xml")
+ || file.getName().toLowerCase().endsWith(".xmi")));
+ }
- public String getDescription() {
- return "XMI Files";
- }
+ public String getDescription() {
+ return "*.XMI";
+ }
- });
+ });
int ret = fileChooser.showOpenDialog(this);
if (ret == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
- Profile profile = new UserDefinedProfile(file);
+ UserDefinedProfile profile = new UserDefinedProfile(file);
if (profile.getModel() != null) {
ProfileManagerImpl.getInstance().registerProfile(profile);
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/ProjectSettingsTabProfile.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/ProjectSettingsTabProfile.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/ProjectSettingsTabProfile.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/ProjectSettingsTabProfile.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/ProjectSettingsTabProfile.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/ProjectSettingsTabProfile.java 2007-08-12 12:40:57-0700
@@ -389,7 +389,9 @@
boolean remove = true;
if (!ProfileManagerImpl.getInstance().getRegisteredProfiles()
- .contains(selected)) {
+ .contains(selected)
+ && !ProfileManagerImpl.getInstance()
+ .getDefaultProfiles().contains(selected)) {
remove = (JOptionPane
.showConfirmDialog(
this,
@@ -442,7 +444,7 @@
if (ret == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
- Profile profile = new UserDefinedProfile(file);
+ UserDefinedProfile profile = new UserDefinedProfile(file);
if (profile.getModel() != null) {
ProfileManagerImpl.getInstance().registerProfile(profile);
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/SettingsTabProfile.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/SettingsTabProfile.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/SettingsTabProfile.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/SettingsTabProfile.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/SettingsTabProfile.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/SettingsTabProfile.java 2007-08-12 12:40:57-0700
@@ -478,12 +478,12 @@
public boolean accept(File file) {
return file.isDirectory()
|| (file.isFile()
- && (file.getName().endsWith(".xml")
- || file.getName().endsWith(".xmi")));
+ && (file.getName().toLowerCase().endsWith(".xml")
+ || file.getName().toLowerCase().endsWith(".xmi")));
}
public String getDescription() {
- return "XMI Files";
+ return "*.XMI";
}
});
@@ -492,7 +492,7 @@
if (ret == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
- Profile profile = new UserDefinedProfile(file);
+ UserDefinedProfile profile = new UserDefinedProfile(file);
if (profile.getModel() != null) {
ProfileManagerImpl.getInstance().registerProfile(profile);
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/explorer/ActionExportProfileXMI.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/explorer/ActionExportProfileXMI.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/explorer/ActionExportProfileXMI.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/explorer/ActionExportProfileXMI.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/explorer/ActionExportProfileXMI.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/ui/explorer/ActionExportProfileXMI.java 2007-08-12 12:40:57-0700
@@ -31,6 +31,7 @@
import javax.swing.AbstractAction;
import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileFilter;
import org.apache.log4j.Logger;
import org.argouml.application.helpers.ApplicationVersion;
@@ -90,6 +91,7 @@
}
}
+ @SuppressWarnings("deprecation")
private void saveModel(File destiny, Object model) throws IOException,
UmlException {
FileWriter w = new FileWriter(destiny);
@@ -101,7 +103,6 @@
}
private File getTargetFile() {
- PersistenceManager pm = PersistenceManager.getInstance();
// show a chooser dialog for the file name, only xmi is allowed
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle(Translator.localize(
@@ -110,6 +111,20 @@
chooser.setApproveButtonText(Translator.localize(
"filechooser.export"));
chooser.setAcceptAllFileFilterUsed(true);
+ chooser.setFileFilter(new FileFilter() {
+
+ public boolean accept(File file) {
+ return file.isDirectory()
+ || (file.isFile()
+ && (file.getName().toLowerCase().endsWith(".xml")
+ || file.getName().toLowerCase().endsWith(".xmi")));
+ }
+
+ public String getDescription() {
+ return "*.XMI";
+ }
+
+ });
String fn =
Configuration.getString(
@@ -123,6 +138,9 @@
if (result == JFileChooser.APPROVE_OPTION) {
File theFile = chooser.getSelectedFile();
if (theFile != null) {
+ if (!theFile.getName().toUpperCase().endsWith(".XMI")) {
+ theFile = new File(theFile.getAbsolutePath() + ".XMI");
+ }
return theFile;
}
}
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/cognitive/critics/WizAddConstructor.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/cognitive/critics/WizAddConstructor.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/cognitive/critics/WizAddConstructor.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/cognitive/critics/WizAddConstructor.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/cognitive/critics/WizAddConstructor.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/cognitive/critics/WizAddConstructor.java 2007-08-12 12:40:57-0700
@@ -91,35 +91,14 @@
}
/**
- * Finds the create stereotype for an object. It is assumed to be
- * available from the default profile.
+ * Finds the create stereotype for an object.
*
* @param obj is the object the stereotype should be applicable to.
* @return a suitable stereotype, or null.
*/
private Object getCreateStereotype(Object obj) {
- Iterator iter = null;
- Project project = ProjectManager.getManager().getCurrentProject();
- Object profileModel = project.getProfileConfiguration()
- .getDefaultProfile().getModel();
- iter = Model.getFacade().getOwnedElements(profileModel).iterator();
-
- while (iter.hasNext()) {
- Object stereo = iter.next();
- if (!Model.getFacade().isAStereotype(stereo)
- || !"create".equals(Model.getFacade().getName(stereo))) {
- continue;
- }
-
- if (Model.getExtensionMechanismsHelper()
- .isValidStereoType(obj, stereo)) {
- return Model.getModelManagementHelper()
- .getCorrespondingElement(stereo,
- Model.getFacade().getModel(obj));
- }
- }
-
- return null;
+ return ProjectManager.getManager().getCurrentProject()
+ .getProfileConfiguration().findStereotypeForObject("create", obj);
}
/**
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java 2007-08-12 12:40:57-0700
@@ -2034,7 +2034,6 @@
try {
renderingChanged();
} catch (Exception e) {
- e.printStackTrace();
}
}
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/diagram/ui/StereotypeUtility.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/diagram/ui/StereotypeUtility.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/diagram/ui/StereotypeUtility.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/diagram/ui/StereotypeUtility.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/diagram/ui/StereotypeUtility.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/diagram/ui/StereotypeUtility.java 2007-08-12 12:40:57-0700
@@ -89,15 +89,18 @@
}
}
});
+
Collection models =
ProjectManager.getManager().getCurrentProject().getModels();
-
- models.addAll(ProjectManager.getManager().getCurrentProject()
- .getProfileConfiguration().getProfileModels());
addAllUniqueModelElementsFrom(availableStereotypes, paths, Model
.getExtensionMechanismsHelper().getAllPossibleStereotypes(
models, modelElement));
+ addAllUniqueModelElementsFrom(availableStereotypes, paths,
+ ProjectManager.getManager().getCurrentProject()
+ .getProfileConfiguration()
+ .findAllStereotypesForModelElement(modelElement));
+
return availableStereotypes;
}
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/Profile.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/Profile.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/Profile.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/Profile.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/Profile.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/Profile.java 2007-08-12 12:40:57-0700
@@ -24,6 +24,9 @@
package org.argouml.uml.profile;
+import java.util.HashSet;
+import java.util.Set;
+
/**
@@ -33,6 +36,40 @@
*/
public abstract class Profile {
+ private Set<Profile> importedProfiles = new HashSet<Profile>();
+ private Set<Profile> importingProfiles = new HashSet<Profile>();
+
+ /**
+ * A profile should call this method to state that it depends of <code>p</code>
+ *
+ * @param p the profile
+ * @throws IllegalArgumentException if there is some cycle on the dependency graph
+ */
+ protected final void addProfileDependency(Profile p) throws IllegalArgumentException {
+ System.out.println(this + " ## ADDING PROFILE DEPENDENCY TO " + p);
+
+ if (importingProfiles.contains(p)) {
+ throw new IllegalArgumentException();
+ } else {
+ importedProfiles.add(p);
+ importedProfiles.addAll(p.importedProfiles);
+
+ for (Profile importedProfile : importedProfiles) {
+ importedProfile.importingProfiles.add(this);
+ }
+ }
+
+ System.out.println("IMPORTED PROFILES: " + importedProfiles);
+ System.out.println("IMPORTING PROFILES: " + importingProfiles);
+ }
+
+ /**
+ * @return the dependencies
+ */
+ public final Set<Profile> getDependencies() {
+ return importedProfiles;
+ }
+
/**
* @return the name for this profile
*/
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileConfiguration.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileConfiguration.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileConfiguration.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileConfiguration.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileConfiguration.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileConfiguration.java 2007-08-12 12:40:57-0700
@@ -26,11 +26,15 @@
package org.argouml.uml.profile;
import java.awt.Image;
+import java.util.Collection;
+import java.util.HashSet;
import java.util.Iterator;
+import java.util.Set;
import java.util.Vector;
import org.argouml.kernel.AbstractProjectMember;
import org.argouml.kernel.Project;
+import org.argouml.model.Model;
import org.argouml.ui.explorer.ExplorerEventAdaptor;
/**
* This class captures represents the unique access point for the
@@ -43,9 +47,8 @@
private FormatingStrategy formatingStrategy;
private Vector figNodeStrategies = new Vector();
- private Profile defaultProfile;
- private Vector profiles = new Vector();
- private Vector profileModels = new Vector();
+ private Vector<Profile> profiles = new Vector<Profile>();
+ private Vector<Object> profileModels = new Vector<Object>();
/**
* The extension used in serialization and returned by {@link #getType()}
@@ -61,11 +64,14 @@
public ProfileConfiguration(Project project) {
super(EXTENSION, project);
- defaultProfile = ProfileUML.getInstance();
+ Iterator it = ProfileManagerImpl.getInstance().getDefaultProfiles().iterator();
+
+ while (it.hasNext()) {
+ Profile p = (Profile) it.next();
+ addProfile(p);
+ activateFormatingStrategy(p);
+ }
- addProfile(defaultProfile);
-
- activateFormatingStrategy(defaultProfile);
}
/**
@@ -94,13 +100,6 @@
public Vector getProfiles() {
return profiles;
}
-
- /**
- * @return the default profile
- */
- public Profile getDefaultProfile() {
- return defaultProfile;
- }
/**
* Applies a new profile to this configuration
@@ -111,26 +110,20 @@
if (!profiles.contains(p)) {
profiles.add(p);
profileModels.add(p.getModel());
-
+
FigNodeStrategy fns = p.getFigureStrategy();
if (fns != null) {
figNodeStrategies.add(fns);
}
+
+ for (Profile dependency : p.getDependencies()) {
+ addProfile(dependency);
+ }
ExplorerEventAdaptor.getInstance().structureChanged();
}
}
-
- /**
- * Sets the default profile.
- *
- * @param profile the default profile to be set
- */
- public void setDefaultProfile(Profile profile) {
- this.defaultProfile = profile;
- ExplorerEventAdaptor.getInstance().structureChanged();
- }
-
+
/**
* @return the list of models of the currently applied profile.
*/
@@ -139,27 +132,35 @@
}
/**
- * Removes the passed profile from the configuration. The default cannot be
- * removed. Use {@link #setDefaultProfile(Profile)} instead.
+ * Removes the passed profile from the configuration.
*
* @param p the profile to be removed
*/
public void removeProfile(Profile p) {
- if (p != defaultProfile) {
- profiles.remove(p);
- profileModels.remove(p.getModel());
-
- FigNodeStrategy fns = p.getFigureStrategy();
- if (fns != null) {
- figNodeStrategies.remove(fns);
- }
+ profiles.remove(p);
+ profileModels.remove(p.getModel());
- if (formatingStrategy == p.getFormatingStrategy()) {
- formatingStrategy = null;
- }
-
- ExplorerEventAdaptor.getInstance().structureChanged();
- }
+ FigNodeStrategy fns = p.getFigureStrategy();
+ if (fns != null) {
+ figNodeStrategies.remove(fns);
+ }
+
+ if (formatingStrategy == p.getFormatingStrategy()) {
+ formatingStrategy = null;
+ }
+
+ Vector<Profile> markForRemoval = new Vector<Profile>();
+ for (Profile profile : profiles) {
+ if (profile.getDependencies().contains(p)) {
+ markForRemoval.add(profile);
+ }
+ }
+
+ for (Profile profile : markForRemoval) {
+ removeProfile(profile);
+ }
+
+ ExplorerEventAdaptor.getInstance().structureChanged();
}
private FigNodeStrategy compositeFigNodeStrategy = new FigNodeStrategy() {
@@ -213,4 +214,104 @@
public String toString() {
return "Profile Configuration";
}
+
+ /**
+ * @param string
+ * @param obj
+ * @return
+ */
+ @SuppressWarnings("deprecation")
+ public Object findStereotypeForObject(String string, Object obj) {
+ Iterator iter = null;
+
+ for (Object model : profileModels) {
+ iter = Model.getFacade().getOwnedElements(model).iterator();
+
+ while (iter.hasNext()) {
+ Object stereo = iter.next();
+ if (!Model.getFacade().isAStereotype(stereo)
+ || !string.equals(Model.getFacade().getName(stereo))) {
+ continue;
+ }
+
+ if (Model.getExtensionMechanismsHelper().isValidStereoType(obj,
+ stereo)) {
+ return Model.getModelManagementHelper()
+ .getCorrespondingElement(stereo,
+ Model.getFacade().getModel(obj));
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @param name
+ * @return
+ */
+ public Object findType(String name) {
+ Object result = null;
+ Iterator it = getProfileModels().iterator();
+ while (result == null && it.hasNext()) {
+ result = findTypeInModel(name, it.next());
+ }
+
+ return result;
+ }
+
+ private Object findTypeInModel(String s, Object model) {
+
+ if (!Model.getFacade().isANamespace(model)) {
+ throw new IllegalArgumentException(
+ "Looking for the classifier " + s
+ + " in a non-namespace object of " + model
+ + ". A namespace was expected.");
+ }
+
+ Collection allClassifiers =
+ Model.getModelManagementHelper()
+ .getAllModelElementsOfKind(model,
+ Model.getMetaTypes().getClassifier());
+
+ Object[] classifiers = allClassifiers.toArray();
+ Object classifier = null;
+
+ for (int i = 0; i < classifiers.length; i++) {
+
+ classifier = classifiers[i];
+ if (Model.getFacade().getName(classifier) != null
+ && Model.getFacade().getName(classifier).equals(s)) {
+ return classifier;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @param metaType
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ public Collection findByMetaType(Object metaType) {
+ Set elements = new HashSet();
+
+ Iterator it = getProfileModels().iterator();
+ while (it.hasNext()) {
+ Object model = it.next();
+ elements.addAll(Model.getModelManagementHelper()
+ .getAllModelElementsOfKind(model, metaType));
+ }
+ return elements;
+ }
+
+ /**
+ * @param modelElement
+ * @return
+ */
+ public Collection findAllStereotypesForModelElement(Object modelElement) {
+ return Model.getExtensionMechanismsHelper().getAllPossibleStereotypes(
+ getProfileModels(), modelElement);
+ }
}
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileCpp.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileCpp.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileCpp.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileCpp.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileCpp.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileCpp.java 2007-08-12 12:40:57-0700
@@ -60,6 +60,8 @@
if (model == null) {
model = Model.getModelManagementFactory().createModel();
}
+
+ addProfileDependency(ProfileUML.getInstance());
}
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileJava.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileJava.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileJava.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileJava.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileJava.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileJava.java 2007-08-12 12:40:57-0700
@@ -59,6 +59,8 @@
if (model == null) {
model = Model.getModelManagementFactory().createModel();
}
+
+ addProfileDependency(ProfileUML.getInstance());
}
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManagerImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManagerImpl.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManagerImpl.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManagerImpl.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManagerImpl.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/profile/ProfileManagerImpl.java 2007-08-12 12:40:57-0700
@@ -65,6 +65,9 @@
private Vector searchDirectories = new Vector();
private ProfileManagerImpl() {
+ defaultProfiles.add(ProfileUML.getInstance());
+
+ registerProfile(ProfileUML.getInstance());
registerProfile(ProfileJava.getInstance());
registerProfile(ProfileCpp.getInstance());
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/reveng/java/Modeller.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/reveng/java/Modeller.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/reveng/java/Modeller.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/reveng/java/Modeller.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/reveng/java/Modeller.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/reveng/java/Modeller.java 2007-08-12 12:40:57-0700
@@ -1676,6 +1676,11 @@
Collection stereos =
Model.getExtensionMechanismsHelper().getAllPossibleStereotypes(
models, me);
+
+ stereos.addAll(ProjectManager.getManager().getCurrentProject()
+ .getProfileConfiguration()
+ .findAllStereotypesForModelElement(me));
+
Object stereotype = null;
if (stereos != null && stereos.size() > 0) {
Iterator iter = stereos.iterator();
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java 2007-08-12 12:40:57-0700
@@ -67,18 +67,13 @@
Set elements = new HashSet();
Project p = ProjectManager.getManager().getCurrentProject();
for (Object model : p.getUserDefinedModelList()) {
- elements.addAll(Model.getModelManagementHelper()
- .getAllModelElementsOfKind(model,
- Model.getMetaTypes().getClassifier()));
+ elements.addAll(Model.getModelManagementHelper()
+ .getAllModelElementsOfKind(model,
+ Model.getMetaTypes().getClassifier()));
}
-
- Iterator it = p.getProfileConfiguration().getProfileModels().iterator();
- while (it.hasNext()) {
- Object model = it.next();
- elements.addAll(Model.getModelManagementHelper()
- .getAllModelElementsOfKind(model,
- Model.getMetaTypes().getClassifier()));
- }
+
+ elements.addAll(p.getProfileConfiguration().findByMetaType(
+ Model.getMetaTypes().getClassifier()));
setElements(elements);
}
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java 2007-08-12 12:40:57-0700
@@ -96,14 +96,8 @@
model, Model.getMetaTypes().getDataType()));
}
- Iterator it = p.getProfileConfiguration().getProfileModels().iterator();
-
- while (it.hasNext()) {
- Object model = it.next();
- elements.addAll(Model.getModelManagementHelper()
- .getAllModelElementsOfKind(model,
- Model.getMetaTypes().getClassifier()));
- }
+ elements.addAll(p.getProfileConfiguration().findByMetaType(
+ Model.getMetaTypes().getClassifier()));
// Our comparator will throw an InvalidElementException if the old
// list contains deleted elements (eg after a new project is loaded)
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java 2007-08-12 12:40:57-0700
@@ -28,7 +28,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
-import java.util.List;
+import java.util.Vector;
import org.argouml.model.Model;
import org.argouml.uml.ui.UMLComboBoxModel2;
@@ -50,9 +50,10 @@
/**
* Constructor.
*/
+ @SuppressWarnings("unchecked")
public UMLMetaClassComboBoxModel() {
super("baseClass", true);
- Collections.sort((List) metaClasses);
+ Collections.sort(new Vector(metaClasses));
}
/*
Modified: branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLTagDefinitionComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLTagDefinitionComboBoxModel.java?view=diff&rev=13298&p1=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLTagDefinitionComboBoxModel.java&p2=branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLTagDefinitionComboBoxModel.java&r1=13297&r2=13298
==============================================================================
--- branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLTagDefinitionComboBoxModel.java (original)
+++ branches/gsoc2007/maurelio1234/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLTagDefinitionComboBoxModel.java 2007-08-12 12:40:57-0700
@@ -116,14 +116,10 @@
Model.getMetaTypes().getTagDefinition()));
}
- it = project.getProfileConfiguration().getProfileModels().iterator();
- while (it.hasNext()) {
- Object model = it.next();
- addAllUniqueModelElementsFrom(availableTagDefs, paths, Model
- .getModelManagementHelper().getAllModelElementsOfKind(
- model, Model.getMetaTypes().getTagDefinition()));
- }
-
+ addAllUniqueModelElementsFrom(availableTagDefs, paths, project
+ .getProfileConfiguration().findByMetaType(
+ Model.getMetaTypes().getTagDefinition()));
+
ArrayList notValids = new ArrayList();
it = availableTagDefs.iterator();
while (it.hasNext()) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.