Author: b00__1
Date: 2007-08-19 10:03:00-0700
New Revision: 13409
Modified:
branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CoreHelperEUMLImpl.java
branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/DataTypesFactoryEUMLImpl.java
branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java
Log:
Fix the attributes (Property) to work
Modified: branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CoreHelperEUMLImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CoreHelperEUMLImpl.java?view=diff&rev=13409&p1=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CoreHelperEUMLImpl.java&p2=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CoreHelperEUMLImpl.java&r1=13408&r2=13409
==============================================================================
--- branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CoreHelperEUMLImpl.java (original)
+++ branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CoreHelperEUMLImpl.java 2007-08-19 10:03:00-0700
@@ -58,6 +58,7 @@
import org.eclipse.uml2.uml.Feature;
import org.eclipse.uml2.uml.Generalization;
import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.MultiplicityElement;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.Node;
@@ -1380,7 +1381,35 @@
addOwnedElement(container, handle);
}
- public void setMultiplicity(Object handle, Object arg) {
+ public void setMultiplicity(final Object handle, Object arg) {
+ if (arg == null) {
+ return;
+ }
+ if (!(handle instanceof MultiplicityElement)) {
+ throw new IllegalArgumentException();
+ }
+ if (arg instanceof String) {
+ int lower = 1, upper = 1;
+ try {
+ int i = Integer.parseInt((String) arg);
+ lower = upper = i;
+ } catch (NumberFormatException e) {
+ // TODO: lower..upper
+ throw new NotYetImplementedException();
+ }
+ final int lower_ = lower, upper_ = upper;
+ RunnableClass run = new RunnableClass() {
+ public void run() {
+ ((MultiplicityElement) handle).setLower(lower_);
+ ((MultiplicityElement) handle).setUpper(upper_);
+ }
+ };
+ editingDomain.getCommandStack().execute(
+ new ChangeCommand(
+ modelImpl, run,
+ "Set the multiplicity # to the element #", arg,
+ handle));
+ }
throw new NotYetImplementedException();
}
Modified: branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/DataTypesFactoryEUMLImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/DataTypesFactoryEUMLImpl.java?view=diff&rev=13409&p1=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/DataTypesFactoryEUMLImpl.java&p2=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/DataTypesFactoryEUMLImpl.java&r1=13408&r2=13409
==============================================================================
--- branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/DataTypesFactoryEUMLImpl.java (original)
+++ branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/DataTypesFactoryEUMLImpl.java 2007-08-19 10:03:00-0700
@@ -99,7 +99,9 @@
}
public Object createMultiplicity(String str) {
- throw new NotImplementedException();
+ // This does not exist as a specific element in UML2
+ // As a workaround we return the string as the multiplicity
+ return str;
}
public Object createMultiplicityRange(String str) {
Modified: branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java?view=diff&rev=13409&p1=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java&p2=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java&r1=13408&r2=13409
==============================================================================
--- branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java (original)
+++ branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java 2007-08-19 10:03:00-0700
@@ -438,6 +438,11 @@
public Collection getConnections(Object handle) {
// Link does not exist in UML2
+ if (handle == null) {
+ // this is wrongly called with a null handle,
+ // as a workaround we return an empty collection
+ return Collections.EMPTY_LIST;
+ }
if (!(handle instanceof Association)) {
throw new IllegalArgumentException(
"handle must be instance of Association"); //$NON-NLS-1$
@@ -1160,7 +1165,9 @@
public Object getTargetScope(Object handle) {
// Removed from UML 2.x and deprecated in Model API
// so we won't implement it
- throw new NotImplementedException();
+// throw new NotImplementedException();
+ // we do not throw an exception because ArgoUML still uses this
+ return null;
}
public Object getTemplate(Object handle) {
@@ -1317,7 +1324,8 @@
}
public boolean isAAssociationEnd(Object handle) {
- return handle instanceof Property;
+ return handle instanceof Property
+ && ((Property) handle).getAssociation() != null;
}
public boolean isAAssociationEndRole(Object handle) {
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.