Author: tfmorris
Date: 2008-10-14 11:03:33-0700
New Revision: 15920

Modified:
   trunk/src/argouml-app/src/org/argouml/i18n/label.properties
   
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/ActionSetAssociationEndTargetScope.java
   
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/ActionSetStructuralFeatureTargetScope.java
   
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelAssociationEnd.java
   
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelStructuralFeature.java
   
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/UMLAssociationEndTargetScopeCheckbox.java
   
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTargetScopeCheckBox.java
   trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java
   trunk/src/argouml-core-model/src/org/argouml/model/CoreHelper.java
   trunk/src/argouml-core-model/src/org/argouml/model/Facade.java

Log:
Issue 5458: migrate getTargetScope/setTargetScope to UML 2.x isStatic/setStatic 
 
http://argouml.tigris.org/issues/show_bug.cgi?id=5458

Modified: trunk/src/argouml-app/src/org/argouml/i18n/label.properties
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/i18n/label.properties?view=diff&rev=15920&p1=trunk/src/argouml-app/src/org/argouml/i18n/label.properties&p2=trunk/src/argouml-app/src/org/argouml/i18n/label.properties&r1=15919&r2=15920
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/i18n/label.properties (original)
+++ trunk/src/argouml-app/src/org/argouml/i18n/label.properties 2008-10-14 
11:03:33-0700
@@ -374,7 +374,7 @@
 label.state = State:
 label.state-chart-diagram = Statechart Diagram
 label.statemachine = Statemachine:
-label.static = Static
+label.static = static
 label.stereotype-title = Stereotype
 label.stereotype = Stereotype:
 label.stereotype.navigate.tooltip = Go to selected stereotype

Modified: 
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/ActionSetAssociationEndTargetScope.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/ActionSetAssociationEndTargetScope.java?view=diff&rev=15920&p1=trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/ActionSetAssociationEndTargetScope.java&p2=trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/ActionSetAssociationEndTargetScope.java&r1=15919&r2=15920
==============================================================================
--- 
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/ActionSetAssociationEndTargetScope.java
        (original)
+++ 
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/ActionSetAssociationEndTargetScope.java
        2008-10-14 11:03:33-0700
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Copyright (c) 1996-2008 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
@@ -63,13 +63,7 @@
             Object target = source.getTarget();
             if (Model.getFacade().isAAssociationEnd(target)) {
                 Object m = target;
-                if (source.isSelected()) {
-                    Model.getCoreHelper().setTargetScope(m,
-                            Model.getScopeKind().getClassifier());
-                } else {
-                    Model.getCoreHelper().setTargetScope(m,
-                            Model.getScopeKind().getInstance());
-                }
+                Model.getCoreHelper().setStatic(m, source.isSelected());
             }
         }
     }

Modified: 
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/ActionSetStructuralFeatureTargetScope.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/ActionSetStructuralFeatureTargetScope.java?view=diff&rev=15920&p1=trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/ActionSetStructuralFeatureTargetScope.java&p2=trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/ActionSetStructuralFeatureTargetScope.java&r1=15919&r2=15920
==============================================================================
--- 
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/ActionSetStructuralFeatureTargetScope.java
     (original)
+++ 
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/ActionSetStructuralFeatureTargetScope.java
     2008-10-14 11:03:33-0700
@@ -36,6 +36,8 @@
 /**
  * @author [EMAIL PROTECTED]
  * @since Jan 29, 2003
+ * @deprecated for 0.27.2 by tfmorris. The targetScope attribute is no longer
+ *             available for StructuralFeatures in UML 2.x.  No replacement.
  */
 public class ActionSetStructuralFeatureTargetScope extends UndoableAction {
 
@@ -55,6 +57,7 @@
     /*
      * @see 
java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
      */
+    @Override
     public void actionPerformed(ActionEvent e) {
        super.actionPerformed(e);
        if (e.getSource() instanceof UMLCheckBox2) {

Modified: 
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelAssociationEnd.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelAssociationEnd.java?view=diff&rev=15920&p1=trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelAssociationEnd.java&p2=trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelAssociationEnd.java&r1=15919&r2=15920
==============================================================================
--- 
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelAssociationEnd.java
   (original)
+++ 
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelAssociationEnd.java
   2008-10-14 11:03:33-0700
@@ -80,8 +80,8 @@
 
     /**
      * The checkbox that shows the scope of the associationend. Selected means
-     * that the scope is the classifier. Unselected means that the scope is the
-     * instance (the default).
+     * that the scope is the classifier (static). Unselected means that the 
+     * scope is the instance (the default).
      */
     private JCheckBox targetScopeCheckBox;
 

Modified: 
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelStructuralFeature.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelStructuralFeature.java?view=diff&rev=15920&p1=trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelStructuralFeature.java&p2=trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelStructuralFeature.java&r1=15919&r2=15920
==============================================================================
--- 
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelStructuralFeature.java
        (original)
+++ 
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelStructuralFeature.java
        2008-10-14 11:03:33-0700
@@ -116,7 +116,11 @@
 
     /**
      * Returns the targetScopeCheckBox.
+     * 
      * @return UMLCheckBox2
+     * @deprecated for 0.27.2 by tfmorris. StructuralFeatures no longer have a
+     *             targetScope in UML 2.x. No replacement. This appears unused,
+     *             so it can be scheduled for a speedy removal.
      */
     public UMLCheckBox2 getTargetScopeCheckBox() {
         if (targetScopeCheckBox == null) {

Modified: 
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/UMLAssociationEndTargetScopeCheckbox.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/UMLAssociationEndTargetScopeCheckbox.java?view=diff&rev=15920&p1=trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/UMLAssociationEndTargetScopeCheckbox.java&p2=trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/UMLAssociationEndTargetScopeCheckbox.java&r1=15919&r2=15920
==============================================================================
--- 
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/UMLAssociationEndTargetScopeCheckbox.java
      (original)
+++ 
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/UMLAssociationEndTargetScopeCheckbox.java
      2008-10-14 11:03:33-0700
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Copyright (c) 1996-2008 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
@@ -39,8 +39,11 @@
      * Constructor for UMLAssociationEndTargetScopeCheckbox.
      */
     public UMLAssociationEndTargetScopeCheckbox() {
-        super(Translator.localize("label.targetscope-classifier"),
-                ActionSetAssociationEndTargetScope.getInstance(), "ordering");
+        // TODO: property name will need to be updated for UML 2.x
+        // Unfortunately we can specify two property names here
+        super(Translator.localize("label.static"),
+                ActionSetAssociationEndTargetScope.getInstance(), 
+                "targetScope");
     }
 
     /*
@@ -49,8 +52,7 @@
     public void buildModel() {
         if (getTarget() != null) {
             Object associationEnd = getTarget();
-            setSelected(Model.getScopeKind().getClassifier().equals(
-                    Model.getFacade().getTargetScope(associationEnd)));
+            setSelected(Model.getFacade().isStatic(associationEnd));
         }
     }
 }

Modified: 
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTargetScopeCheckBox.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTargetScopeCheckBox.java?view=diff&rev=15920&p1=trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTargetScopeCheckBox.java&p2=trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTargetScopeCheckBox.java&r1=15919&r2=15920
==============================================================================
--- 
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTargetScopeCheckBox.java
   (original)
+++ 
trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTargetScopeCheckBox.java
   2008-10-14 11:03:33-0700
@@ -31,6 +31,9 @@
 /**
  * @author [EMAIL PROTECTED]
  * @since Jan 29, 2003
+ * @deprecated for 0.27.2 by tfmorris. The targetScope attribute is no longer
+ *             available for StructuralFeatures in UML 2.x. No replacement. 
This
+ *             appears unused, so it can be scheduled for a speedy removal.
  */
 public class UMLStructuralFeatureTargetScopeCheckBox extends UMLCheckBox2 {
 

Modified: 
trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java?view=diff&rev=15920&p1=trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java&p2=trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java&r1=15919&r2=15920
==============================================================================
--- 
trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java   
    (original)
+++ 
trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java   
    2008-10-14 11:03:33-0700
@@ -2983,10 +2983,15 @@
     
     public boolean isStatic(Object handle) {
         try {
-            return ScopeKindEnum.SK_CLASSIFIER.equals(((Feature) handle)
-                    .getOwnerScope());
-        } catch (ClassCastException e) {
-            throw new IllegalArgumentException(e);
+            if (handle instanceof Feature) {
+                return ScopeKindEnum.SK_CLASSIFIER.equals(((Feature) handle)
+                        .getOwnerScope());
+            }
+            if (handle instanceof AssociationEnd) {
+                return ScopeKindEnum.SK_CLASSIFIER
+                        .equals(((AssociationEnd) handle).getTargetScope());
+            }
+            throw new IllegalArgumentException();
         } catch (InvalidObjectException e) {
             throw new InvalidElementException(e);
         }

Modified: trunk/src/argouml-core-model/src/org/argouml/model/CoreHelper.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model/src/org/argouml/model/CoreHelper.java?view=diff&rev=15920&p1=trunk/src/argouml-core-model/src/org/argouml/model/CoreHelper.java&p2=trunk/src/argouml-core-model/src/org/argouml/model/CoreHelper.java&r1=15919&r2=15920
==============================================================================
--- trunk/src/argouml-core-model/src/org/argouml/model/CoreHelper.java  
(original)
+++ trunk/src/argouml-core-model/src/org/argouml/model/CoreHelper.java  
2008-10-14 11:03:33-0700
@@ -1178,7 +1178,9 @@
 
     /**
      * Set the isStatic (UML 2.x) or ownerScope (UML 1.x) attribute of a
-     * feature or association end.
+     * feature.  As a special backward compatibility bridge, if passed
+     * a UML 1.4 AssociationEnd, it will set the targetScope instead of 
+     * the ownerScope (since AssociationEnds don't have an ownerScope).
      * 
      * @param element
      *            feature or association end

Modified: trunk/src/argouml-core-model/src/org/argouml/model/Facade.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model/src/org/argouml/model/Facade.java?view=diff&rev=15920&p1=trunk/src/argouml-core-model/src/org/argouml/model/Facade.java&p2=trunk/src/argouml-core-model/src/org/argouml/model/Facade.java&r1=15919&r2=15920
==============================================================================
--- trunk/src/argouml-core-model/src/org/argouml/model/Facade.java      
(original)
+++ trunk/src/argouml-core-model/src/org/argouml/model/Facade.java      
2008-10-14 11:03:33-0700
@@ -2931,12 +2931,13 @@
     Object getTarget(Object handle);
 
     /**
-     * Return the target scope of a ModelElement.
+     * Return the target scope of a StructuralFeature or AssociationEnd.
      * 
-     * @param handle
-     *            the model element
+     * @param handle the model element
      * @return Object
-     * @deprecated for 0.25.4 by tmorris. This has been removed from UML 2.x 
and
+     * @deprecated for 0.25.4 by tmorris. If being used with an AssociationEnd
+     *             as an argument, [EMAIL PROTECTED] #isStatic(Object)} can be 
used. For
+     *             StructuralFeatures, this has been removed from UML 2.x and
      *             should no longer be used.
      */
     @Deprecated
@@ -3388,13 +3389,16 @@
      * @return true if this ObjectFlowState is a synch state.
      */
     boolean isSynch(Object handle);
-    
+
     /**
      * Return the value of the isStatic attribute. This replaces the ScopeKind
      * enumeration of UML 1.x and is equivalent to a ScopeKind of CLASSIFIER.
+     * <p>
+     * For UML 1.4 it fetches the ownerScope for StructuralFeatures and the
+     * targetScope for AssociationEnds. It returns <code>true</code> if the
+     * value is <code>ScopeKind.SK_CLASSIFIER</code>.
      * 
-     * @param handle
-     *            the Feature
+     * @param handle the Feature or AssociationEnd
      * @return true if the element is static
      * @since 0.25.4
      */

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to