Author: tfmorris
Date: 2007-07-10 10:51:39-0700
New Revision: 13025
Modified:
trunk/src_new/org/argouml/kernel/ProjectImpl.java
trunk/src_new/org/argouml/ui/GotoDialog.java
trunk/src_new/org/argouml/ui/explorer/rules/GoModelToDiagrams.java
trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToDiagram.java
trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToModel.java
trunk/src_new/org/argouml/uml/cognitive/ChildGenFind.java
trunk/src_new/org/argouml/uml/ui/ActionAddTopLevelPackage.java
trunk/src_new/org/argouml/uml/ui/behavior/activity_graphs/UMLActivityGraphContextComboBoxModel.java
trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLCollaborationRepresentedClassifierComboBoxModel.java
trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLCollaborationRepresentedOperationComboBoxModel.java
trunk/src_new/org/argouml/uml/ui/behavior/state_machines/UMLStateMachineContextComboBoxModel.java
trunk/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java
trunk/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java
Log:
Update Project API to use Collections and deprecate Vector based methods
Modified: trunk/src_new/org/argouml/kernel/ProjectImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/kernel/ProjectImpl.java?view=diff&rev=13025&p1=trunk/src_new/org/argouml/kernel/ProjectImpl.java&p2=trunk/src_new/org/argouml/kernel/ProjectImpl.java&r1=13024&r2=13025
==============================================================================
--- trunk/src_new/org/argouml/kernel/ProjectImpl.java (original)
+++ trunk/src_new/org/argouml/kernel/ProjectImpl.java 2007-07-10 10:51:39-0700
@@ -34,6 +34,7 @@
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -48,7 +49,7 @@
import org.argouml.configuration.Configuration;
import org.argouml.i18n.Translator;
import org.argouml.model.Model;
-import org.argouml.persistence.PersistenceManager;
+import org.argouml.persistence.ExtensionManager;
import org.argouml.ui.explorer.ExplorerEventAdaptor;
import org.argouml.uml.CommentEdge;
import org.argouml.uml.Profile;
@@ -57,11 +58,8 @@
import org.argouml.uml.ProjectMemberModel;
import org.argouml.uml.cognitive.ProjectMemberTodoList;
import org.argouml.uml.diagram.ArgoDiagram;
-import org.argouml.uml.diagram.DiagramFactory;
import org.argouml.uml.diagram.ProjectMemberDiagram;
-import org.argouml.uml.diagram.static_structure.ui.UMLClassDiagram;
import org.argouml.uml.generator.GenerationPreferences;
-import org.tigris.gef.base.Diagram;
import org.tigris.gef.presentation.Fig;
import org.tigris.gef.undo.Memento;
import org.tigris.gef.undo.UndoManager;
@@ -105,7 +103,7 @@
private ProjectSettings projectSettings;
- private Vector searchpath;
+ private List<String> searchpath;
// TODO: break into 3 main member types
// model, diagram and other
@@ -122,15 +120,15 @@
/**
* Instances of the uml model.
*/
- private final Vector models = new Vector();
+ private final List models = new ArrayList();
/**
* Instances of the uml diagrams.
*/
- private final List diagrams = new ArrayList();
+ private final List<ArgoDiagram> diagrams = new ArrayList<ArgoDiagram>();
private Object defaultModel;
private Object currentNamespace;
- private Map uuidRefs;
+ private Map<String, Object> uuidRefs;
private GenerationPreferences cgPrefs;
private transient VetoableChangeSupport vetoSupport;
@@ -144,7 +142,7 @@
/**
* Cache for the default model.
*/
- private HashMap defaultModelTypeCache;
+ private HashMap<String, Object> defaultModelTypeCache;
private Collection trashcan = new ArrayList();
@@ -155,7 +153,8 @@
*/
public ProjectImpl(URI theProjectUri) {
this();
- uri = PersistenceManager.getInstance().fixUriExtension(theProjectUri);
+ uri = ExtensionManager.getInstance().fixUriExtension(theProjectUri);
+ uri = theProjectUri;
}
/**
@@ -173,10 +172,10 @@
// this should be moved to a ui action.
version = ApplicationVersion.getVersion();
- searchpath = new Vector();
+ searchpath = new ArrayList<String>();
historyFile = "";
cgPrefs = new GenerationPreferences();
- defaultModelTypeCache = new HashMap();
+ defaultModelTypeCache = new HashMap<String, Object>();
LOG.info("making empty project with empty model");
try {
@@ -196,7 +195,7 @@
public String getBaseName() {
String n = getName();
- n = PersistenceManager.getInstance().getBaseName(n);
+ n = ExtensionManager.getInstance().getBaseName(n);
return n;
}
@@ -221,14 +220,19 @@
}
- public URI getURI() {
+ public URI getUri() {
return uri;
}
+
+ public URI getURI() {
+ return uri;
+ }
+
public void setURI(URI theUri) {
if (theUri != null) {
- theUri = PersistenceManager.getInstance().fixUriExtension(theUri);
+ theUri = ExtensionManager.getInstance().fixUriExtension(theUri);
}
if (LOG.isDebugEnabled()) {
@@ -255,14 +259,20 @@
}
- public Vector getSearchPath() {
+ @SuppressWarnings("deprecation")
+ public Vector<String> getSearchPath() {
+ return new Vector<String>(searchpath);
+ }
+
+
+ public List<String> getSearchPathList() {
return searchpath;
}
public void addSearchPath(String searchPathElement) {
- if (!this.searchpath.contains(searchPathElement)) {
- searchpath.addElement(searchPathElement);
+ if (!searchpath.contains(searchPathElement)) {
+ searchpath.add(searchPathElement);
}
}
@@ -272,7 +282,9 @@
return members;
}
-
+ /**
+ * @param d the diagram
+ */
private void addDiagramMember(ArgoDiagram d) {
ProjectMember pm = new ProjectMemberDiagram(d, this);
addDiagram(d);
@@ -352,7 +364,7 @@
// fire indeterminate change to avoid copying vector
if (!models.contains(model)) {
- models.addElement(model);
+ models.add(model);
}
setCurrentNamespace(model);
setSaveEnabled(true);
@@ -370,18 +382,20 @@
// TODO: Once we go MDI we won't need this.
Object treeRoot =
Model.getModelManagementFactory().getRootModel();
- defaultDiagram =
- DiagramFactory.getInstance().createDiagram(
- UMLClassDiagram.class,
- treeRoot,
- null);
- addMember(defaultDiagram);
+ // TODO: This is the center of a very large dependency cycle
+ // Just refuse to delete the last diagram for now - tfm
+ LOG.error("Can't delete last diagram in the project");
+ return;
+// defaultDiagram =
+// DiagramFactory.getInstance().createDefaultDiagram(
+// treeRoot);
+// addMember(defaultDiagram);
} else {
// Make the topmost diagram (that is not the one being deleted)
// current.
- defaultDiagram = (ArgoDiagram) diagrams.get(0);
+ defaultDiagram = diagrams.get(0);
if (defaultDiagram == d) {
- defaultDiagram = (ArgoDiagram) diagrams.get(1);
+ defaultDiagram = diagrams.get(1);
}
}
activeDiagram = defaultDiagram;
@@ -400,7 +414,7 @@
private void setSaveEnabled(boolean enable) {
ProjectManager pm = ProjectManager.getManager();
if (pm.getCurrentProject() == this) {
- pm.setSaveEnabled(enable);
+ ProjectSaveAction.getInstance().setSaveEnabled(enable);
}
}
@@ -497,7 +511,13 @@
}
+ @SuppressWarnings("deprecation")
public Vector getUserDefinedModels() {
+ return new Vector(models);
+ }
+
+
+ public List getUserDefinedModelList() {
return models;
}
@@ -514,7 +534,7 @@
if (models.size() != 1) {
return null;
}
- return models.elementAt(0);
+ return models.get(0);
}
@@ -549,9 +569,8 @@
return null;
}
Object cls = null;
- int numModels = models.size();
- for (int i = 0; i < numModels; i++) {
- cls = findTypeInModel(s, models.elementAt(i));
+ for (Object model : models) {
+ cls = findTypeInModel(s, model);
if (cls != null) {
return cls;
}
@@ -573,12 +592,10 @@
}
- public Collection findFigsForMember(Object member) {
- Collection figs = new ArrayList();
- Iterator it = diagrams.iterator();
- while (it.hasNext()) {
- ArgoDiagram diagram = (ArgoDiagram) it.next();
- Object fig = diagram.getContainingFig(member);
+ public Collection<Fig> findFigsForMember(Object member) {
+ Collection<Fig> figs = new ArrayList<Fig>();
+ for (ArgoDiagram diagram : diagrams) {
+ Fig fig = diagram.getContainingFig(member);
if (fig != null) {
figs.add(fig);
}
@@ -589,9 +606,7 @@
public Collection findAllPresentationsFor(Object obj) {
Collection figs = new ArrayList();
- Iterator it = diagrams.iterator();
- while (it.hasNext()) {
- Diagram diagram = (Diagram) it.next();
+ for (ArgoDiagram diagram : diagrams) {
Fig aFig = diagram.presentationFor(obj);
if (aFig != null) {
figs.add(aFig);
@@ -646,8 +661,13 @@
}
- public Vector getDiagrams() {
- return new Vector(diagrams);
+ @SuppressWarnings("deprecation")
+ public Vector<ArgoDiagram> getDiagrams() {
+ return new Vector<ArgoDiagram>(diagrams);
+ }
+
+ public List<ArgoDiagram> getDiagramList() {
+ return Collections.unmodifiableList(diagrams);
}
@@ -657,9 +677,7 @@
public ArgoDiagram getDiagram(String name) {
- Iterator it = diagrams.iterator();
- while (it.hasNext()) {
- ArgoDiagram ad = (ArgoDiagram) it.next();
+ for (ArgoDiagram ad : diagrams) {
if (ad.getName() != null && ad.getName().equals(name)) {
return ad;
}
@@ -742,9 +760,7 @@
}
int presentations = 0;
- int size = diagrams.size();
- for (int i = 0; i < size; i++) {
- Diagram d = (Diagram) diagrams.get(i);
+ for (ArgoDiagram d : diagrams) {
presentations += d.getLayer().presentationCountFor(me);
}
return presentations;
@@ -756,7 +772,7 @@
return diagrams.get(0);
}
if (models.size() > 0) {
- return models.elementAt(0);
+ return models.get(0);
}
return null;
}
@@ -781,16 +797,16 @@
public void preSave() {
- for (int i = 0; i < diagrams.size(); i++) {
- ((Diagram) diagrams.get(i)).preSave();
+ for (ArgoDiagram diagram : diagrams) {
+ diagram.preSave();
}
// TODO: is preSave needed for models?
}
public void postSave() {
- for (int i = 0; i < diagrams.size(); i++) {
- ((Diagram) diagrams.get(i)).postSave();
+ for (ArgoDiagram diagram : diagrams) {
+ diagram.postSave();
}
// TODO: is postSave needed for models?
setSaveEnabled(true);
@@ -798,8 +814,8 @@
public void postLoad() {
- for (int i = 0; i < diagrams.size(); i++) {
- ((Diagram) diagrams.get(i)).postLoad();
+ for (ArgoDiagram diagram : diagrams) {
+ diagram.postLoad();
}
// issue 1725: the root is not set, which leads to problems
// with displaying prop panels
@@ -817,6 +833,14 @@
////////////////////////////////////////////////////////////////
// trash related methods
+ /**
+ * Empty the trash can and permanently delete all objects that it contains.
+ *
+ * @see org.argouml.kernel.Project#emptyTrashCan()
+ */
+ public void emptyTrashCan() {
+ trashcan.clear();
+ }
public void moveToTrash(Object obj) {
if (obj instanceof Collection) {
@@ -903,7 +927,7 @@
}
defaultModel = theDefaultModel;
- defaultModelTypeCache = new HashMap();
+ defaultModelTypeCache = new HashMap<String, Object>();
}
@@ -950,10 +974,8 @@
public boolean isValidDiagramName(String name) {
- Iterator it = diagrams.iterator();
boolean rv = true;
- while (it.hasNext()) {
- ArgoDiagram diagram = (ArgoDiagram) it.next();
+ for (ArgoDiagram diagram : diagrams) {
if (diagram.getName().equals(name)) {
rv = false;
break;
@@ -963,33 +985,34 @@
}
- public Vector getSearchpath() {
- return searchpath;
+ @SuppressWarnings("deprecation")
+ public Vector<String> getSearchpath() {
+ return new Vector(searchpath);
}
- public URI getUri() {
- return uri;
+ public Map<String, Object> getUUIDRefs() {
+ return uuidRefs;
}
- public Map getUUIDRefs() {
- return uuidRefs;
+ @SuppressWarnings("deprecation")
+ public void setSearchpath(Vector<String> theSearchpath) {
+ searchpath = theSearchpath;
}
- public void setSearchpath(Vector theSearchpath) {
- this.searchpath = theSearchpath;
+ public void setSearchPath(List<String> theSearchpath) {
+ searchpath = theSearchpath;
}
-
- public void setUUIDRefs(HashMap uUIDRefs) {
+ public void setUUIDRefs(Map<String, Object> uUIDRefs) {
uuidRefs = uUIDRefs;
}
public void setVetoSupport(VetoableChangeSupport theVetoSupport) {
- this.vetoSupport = theVetoSupport;
+ vetoSupport = theVetoSupport;
}
@@ -1004,16 +1027,13 @@
public void remove() {
-
- for (Iterator it = diagrams.iterator(); it.hasNext();) {
- Diagram diagram = (Diagram) it.next();
+ for (ArgoDiagram diagram : diagrams) {
diagram.remove();
}
members.clear();
- for (Iterator it = models.iterator(); it.hasNext();) {
- Object model = it.next();
+ for (Object model : models) {
LOG.debug("Deleting project model "
+ Model.getFacade().getName(model));
Model.getUmlFactory().delete(model);
@@ -1053,7 +1073,7 @@
vetoSupport = null;
activeDiagram = null;
- trashcan.clear();
+ emptyTrashCan();
}
Modified: trunk/src_new/org/argouml/ui/GotoDialog.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/GotoDialog.java?view=diff&rev=13025&p1=trunk/src_new/org/argouml/ui/GotoDialog.java&p2=trunk/src_new/org/argouml/ui/GotoDialog.java&r1=13024&r2=13025
==============================================================================
--- trunk/src_new/org/argouml/ui/GotoDialog.java (original)
+++ trunk/src_new/org/argouml/ui/GotoDialog.java 2007-07-10 10:51:39-0700
@@ -63,7 +63,7 @@
Project p = ProjectManager.getManager().getCurrentProject();
- allDiagrams.setResults(p.getDiagrams(), p.getDiagrams());
+ allDiagrams.setResults(p.getDiagramList(), p.getDiagramList());
// TabResults has really large preferred height, so divide in
// half to reduce size of dialog which will be sized based on
Modified: trunk/src_new/org/argouml/ui/explorer/rules/GoModelToDiagrams.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/rules/GoModelToDiagrams.java?view=diff&rev=13025&p1=trunk/src_new/org/argouml/ui/explorer/rules/GoModelToDiagrams.java&p2=trunk/src_new/org/argouml/ui/explorer/rules/GoModelToDiagrams.java&r1=13024&r2=13025
==============================================================================
--- trunk/src_new/org/argouml/ui/explorer/rules/GoModelToDiagrams.java (original)
+++ trunk/src_new/org/argouml/ui/explorer/rules/GoModelToDiagrams.java 2007-07-10 10:51:39-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Copyright (c) 1996-2007 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -52,7 +52,7 @@
public Collection getChildren(Object parent) {
if (Model.getFacade().isAModel(parent)) {
return ProjectManager.getManager()
- .getCurrentProject().getDiagrams();
+ .getCurrentProject().getDiagramList();
}
return null;
}
Modified: trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToDiagram.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToDiagram.java?view=diff&rev=13025&p1=trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToDiagram.java&p2=trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToDiagram.java&r1=13024&r2=13025
==============================================================================
--- trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToDiagram.java (original)
+++ trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToDiagram.java 2007-07-10 10:51:39-0700
@@ -48,7 +48,7 @@
*/
public Collection getChildren(Object parent) {
if (parent instanceof Project) {
- return ((Project) parent).getDiagrams();
+ return ((Project) parent).getDiagramList();
}
return null;
}
Modified: trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToModel.java?view=diff&rev=13025&p1=trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToModel.java&p2=trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToModel.java&r1=13024&r2=13025
==============================================================================
--- trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToModel.java (original)
+++ trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToModel.java 2007-07-10 10:51:39-0700
@@ -48,7 +48,7 @@
*/
public Collection getChildren(Object parent) {
if (parent instanceof Project) {
- return ((Project) parent).getUserDefinedModels();
+ return ((Project) parent).getUserDefinedModelList();
}
return null;
}
Modified: trunk/src_new/org/argouml/uml/cognitive/ChildGenFind.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/cognitive/ChildGenFind.java?view=diff&rev=13025&p1=trunk/src_new/org/argouml/uml/cognitive/ChildGenFind.java&p2=trunk/src_new/org/argouml/uml/cognitive/ChildGenFind.java&r1=13024&r2=13025
==============================================================================
--- trunk/src_new/org/argouml/uml/cognitive/ChildGenFind.java (original)
+++ trunk/src_new/org/argouml/uml/cognitive/ChildGenFind.java 2007-07-10 10:51:39-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Copyright (c) 1996-2007 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -58,8 +58,8 @@
if (o instanceof Project) {
Project p = (Project) o;
Vector res = new Vector();
- res.addAll(p.getUserDefinedModels());
- res.addAll(p.getDiagrams());
+ res.addAll(p.getUserDefinedModelList());
+ res.addAll(p.getDiagramList());
return res.elements();
}
@@ -86,4 +86,4 @@
public static ChildGenFind getSingleton() {
return SINGLETON;
}
-} /* end class ChildGenFind */
+}
Modified: trunk/src_new/org/argouml/uml/ui/ActionAddTopLevelPackage.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/ActionAddTopLevelPackage.java?view=diff&rev=13025&p1=trunk/src_new/org/argouml/uml/ui/ActionAddTopLevelPackage.java&p2=trunk/src_new/org/argouml/uml/ui/ActionAddTopLevelPackage.java&r1=13024&r2=13025
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/ActionAddTopLevelPackage.java (original)
+++ trunk/src_new/org/argouml/uml/ui/ActionAddTopLevelPackage.java 2007-07-10 10:51:39-0700
@@ -41,9 +41,6 @@
*/
public class ActionAddTopLevelPackage extends UndoableAction {
- ////////////////////////////////////////////////////////////////
- // constructors
-
/**
* The constructor.
*/
@@ -55,16 +52,13 @@
}
- ////////////////////////////////////////////////////////////////
- // main methods
-
/*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent ae) {
super.actionPerformed(ae);
Project p = ProjectManager.getManager().getCurrentProject();
- int numPacks = p.getUserDefinedModels().size();
+ int numPacks = p.getUserDefinedModelList().size();
String nameStr = "package_" + (numPacks + 1);
Object model = Model.getModelManagementFactory().createModel();
Model.getCoreHelper().setName(model, nameStr);
@@ -74,4 +68,4 @@
}
-} /* end class ActionAddTopLevelPackage */
+}
Modified: trunk/src_new/org/argouml/uml/ui/behavior/activity_graphs/UMLActivityGraphContextComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/behavior/activity_graphs/UMLActivityGraphContextComboBoxModel.java?view=diff&rev=13025&p1=trunk/src_new/org/argouml/uml/ui/behavior/activity_graphs/UMLActivityGraphContextComboBoxModel.java&p2=trunk/src_new/org/argouml/uml/ui/behavior/activity_graphs/UMLActivityGraphContextComboBoxModel.java&r1=13024&r2=13025
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/behavior/activity_graphs/UMLActivityGraphContextComboBoxModel.java (original)
+++ trunk/src_new/org/argouml/uml/ui/behavior/activity_graphs/UMLActivityGraphContextComboBoxModel.java 2007-07-10 10:51:39-0700
@@ -27,7 +27,6 @@
import java.beans.PropertyChangeEvent;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
import org.argouml.kernel.Project;
import org.argouml.kernel.ProjectManager;
@@ -55,11 +54,7 @@
protected void buildModelList() {
Collection elements = new ArrayList();
Project p = ProjectManager.getManager().getCurrentProject();
- Iterator it = p.getUserDefinedModels().iterator();
-
- while (it.hasNext()) {
- Object model = it.next();
-
+ for (Object model : p.getUserDefinedModelList()) {
elements.addAll(Model
.getModelManagementHelper().getAllModelElementsOfKind(
model, Model.getMetaTypes().getClassifier()));
Modified: trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLCollaborationRepresentedClassifierComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLCollaborationRepresentedClassifierComboBoxModel.java?view=diff&rev=13025&p1=trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLCollaborationRepresentedClassifierComboBoxModel.java&p2=trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLCollaborationRepresentedClassifierComboBoxModel.java&r1=13024&r2=13025
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLCollaborationRepresentedClassifierComboBoxModel.java (original)
+++ trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLCollaborationRepresentedClassifierComboBoxModel.java 2007-07-10 10:51:39-0700
@@ -27,7 +27,6 @@
import java.beans.PropertyChangeEvent;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
import org.argouml.kernel.Project;
import org.argouml.kernel.ProjectManager;
@@ -56,18 +55,16 @@
protected void buildModelList() {
Collection classifiers = new ArrayList();
Project p = ProjectManager.getManager().getCurrentProject();
- Iterator it = p.getUserDefinedModels().iterator();
- while (it.hasNext()) {
- Object model = it.next();
+ for (Object model : p.getUserDefinedModelList()) {
Collection c = Model.getModelManagementHelper()
.getAllModelElementsOfKind(model,
Model.getMetaTypes().getClassifier());
- Iterator ci = c.iterator();
- while (ci.hasNext()) {
- Object cls = ci.next();
+ for (Object cls : c) {
Collection s = Model.getModelManagementHelper()
.getAllSurroundingNamespaces(cls);
- if (!s.contains(getTarget())) classifiers.add(cls);
+ if (!s.contains(getTarget())) {
+ classifiers.add(cls);
+ }
}
}
setElements(classifiers);
Modified: trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLCollaborationRepresentedOperationComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLCollaborationRepresentedOperationComboBoxModel.java?view=diff&rev=13025&p1=trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLCollaborationRepresentedOperationComboBoxModel.java&p2=trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLCollaborationRepresentedOperationComboBoxModel.java&r1=13024&r2=13025
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLCollaborationRepresentedOperationComboBoxModel.java (original)
+++ trunk/src_new/org/argouml/uml/ui/behavior/collaborations/UMLCollaborationRepresentedOperationComboBoxModel.java 2007-07-10 10:51:39-0700
@@ -27,7 +27,6 @@
import java.beans.PropertyChangeEvent;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
import org.argouml.kernel.Project;
import org.argouml.kernel.ProjectManager;
@@ -56,15 +55,11 @@
protected void buildModelList() {
Collection operations = new ArrayList();
Project p = ProjectManager.getManager().getCurrentProject();
- Iterator it = p.getUserDefinedModels().iterator();
- while (it.hasNext()) {
- Object model = it.next();
+ for (Object model : p.getUserDefinedModelList()) {
Collection c = Model.getModelManagementHelper()
.getAllModelElementsOfKind(model,
Model.getMetaTypes().getOperation());
- Iterator ci = c.iterator();
- while (ci.hasNext()) {
- Object oper = ci.next();
+ for (Object oper : c) {
Object ns = Model.getFacade().getOwner(oper);
Collection s = Model.getModelManagementHelper()
.getAllSurroundingNamespaces(ns);
@@ -90,6 +85,7 @@
/*
* @see org.argouml.uml.ui.UMLComboBoxModel2#propertyChange(java.beans.PropertyChangeEvent)
*/
+ @Override
public void propertyChange(PropertyChangeEvent evt) {
/* Do nothing by design. */
}
Modified: trunk/src_new/org/argouml/uml/ui/behavior/state_machines/UMLStateMachineContextComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/behavior/state_machines/UMLStateMachineContextComboBoxModel.java?view=diff&rev=13025&p1=trunk/src_new/org/argouml/uml/ui/behavior/state_machines/UMLStateMachineContextComboBoxModel.java&p2=trunk/src_new/org/argouml/uml/ui/behavior/state_machines/UMLStateMachineContextComboBoxModel.java&r1=13024&r2=13025
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/behavior/state_machines/UMLStateMachineContextComboBoxModel.java (original)
+++ trunk/src_new/org/argouml/uml/ui/behavior/state_machines/UMLStateMachineContextComboBoxModel.java 2007-07-10 10:51:39-0700
@@ -27,7 +27,6 @@
import java.beans.PropertyChangeEvent;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
import org.argouml.kernel.Project;
import org.argouml.kernel.ProjectManager;
@@ -56,11 +55,7 @@
protected void buildModelList() {
Collection elements = new ArrayList();
Project p = ProjectManager.getManager().getCurrentProject();
- Iterator it = p.getUserDefinedModels().iterator();
-
- while (it.hasNext()) {
- Object model = it.next();
-
+ for (Object model : p.getUserDefinedModelList()) {
elements.addAll(Model
.getModelManagementHelper().getAllModelElementsOfKind(
model, Model.getMetaTypes().getClassifier()));
Modified: trunk/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java?view=diff&rev=13025&p1=trunk/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java&p2=trunk/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java&r1=13024&r2=13025
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java (original)
+++ trunk/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java 2007-07-10 10:51:39-0700
@@ -26,7 +26,6 @@
package org.argouml.uml.ui.foundation.core;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
import org.argouml.kernel.Project;
@@ -66,9 +65,7 @@
protected void buildModelList() {
Set elements = new HashSet();
Project p = ProjectManager.getManager().getCurrentProject();
- Iterator it = p.getUserDefinedModels().iterator();
- while (it.hasNext()) {
- Object model = it.next();
+ for (Object model : p.getUserDefinedModelList()) {
elements.addAll(Model.getModelManagementHelper()
.getAllModelElementsOfKind(model,
Model.getMetaTypes().getClassifier()));
Modified: trunk/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java?view=diff&rev=13025&p1=trunk/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java&p2=trunk/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java&r1=13024&r2=13025
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java (original)
+++ trunk/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java 2007-07-10 10:51:39-0700
@@ -84,11 +84,8 @@
if (p == null) {
return;
}
- Iterator it = (new ArrayList(p.getUserDefinedModels())).iterator();
-
- while (it.hasNext()) {
- Object model = it.next();
-
+
+ for (Object model : p.getUserDefinedModelList()) {
elements.addAll(Model.getModelManagementHelper()
.getAllModelElementsOfKind(
model, Model.getMetaTypes().getUMLClass()));
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.