svn commit: r13245 - branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CoreFactoryEUMLImpl.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: b00__1
Date: 2007-08-05 05:20:59-0700
New Revision: 13245

Modified:
   branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CoreFactoryEUMLImpl.java

Log:
Refactoring the buildPackageAccess/Import() method and use the editing domain to support undo/redo.
org.eclipse.uml2.uml.PackageImport can use only VisibilityKind.PUBLIC_LITERAL or VisibilityKind.PRIVATE_LITERAL
(see the constraint on PackageImport, page 112 Superstructure)

Modified: branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CoreFactoryEUMLImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CoreFactoryEUMLImpl.java?view=diff&rev=13245&p1=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CoreFactoryEUMLImpl.java&p2=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CoreFactoryEUMLImpl.java&r1=13244&r2=13245
==============================================================================
--- branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CoreFactoryEUMLImpl.java	(original)
+++ branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CoreFactoryEUMLImpl.java	2007-08-05 05:20:59-0700
@@ -837,16 +837,17 @@
         return buildPackageImport(client, supplier);
     }
 
-    public PackageImport buildPackageAccess(final Object client,
-            final Object supplier) {
-        PackageImport packageImport = buildPackageImport(client, supplier);
-        // TODO: Do we care if this is undoable?
-        packageImport.setVisibility(VisibilityKind.PACKAGE_LITERAL);
-        return packageImport;
+    public PackageImport buildPackageAccess(Object client, Object supplier) {
+        return buildPackageImport(
+                client, supplier, VisibilityKind.PRIVATE_LITERAL);
+    }
+
+    public PackageImport buildPackageImport(Object client, Object supplier) {
+        return buildPackageImport(client, supplier, null);
     }
     
-    public PackageImport buildPackageImport(final Object client,
-            final Object supplier) {
+    private PackageImport buildPackageImport(final Object client,
+            final Object supplier, final VisibilityKind visibility) {
         if (!(client instanceof Namespace)) {
             throw new IllegalArgumentException(
                     "The client must be instance of Namespace."); //$NON-NLS-1$
@@ -860,6 +861,9 @@
                 PackageImport packageImport = createPackageImport();
                 packageImport.setImportedPackage((org.eclipse.uml2.uml.Package) supplier);
                 packageImport.setImportingNamespace((Namespace) client);
+                if (visibility != null) {
+                    packageImport.setVisibility(visibility);
+                }
                 getParams().add(packageImport);
             }
         };
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.