svn commit: r15974 - branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior: common_behavior state_machines

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: penyaskito
Date: 2008-11-07 01:53:50-0800
New Revision: 15974

Modified:
   branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/common_behavior/PopupMenuNewAction.java
   branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PopupMenuNewEvent.java
   branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionEffectListModel.java
   branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionGuardListModel.java

Log:
Issue 5462: Guard/Effect popup menus missing from transition proppanel

Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/common_behavior/PopupMenuNewAction.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/common_behavior/PopupMenuNewAction.java?view=diff&rev=15974&p1=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/common_behavior/PopupMenuNewAction.java&p2=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/common_behavior/PopupMenuNewAction.java&r1=15973&r2=15974
==============================================================================
--- branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/common_behavior/PopupMenuNewAction.java	(original)
+++ branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/common_behavior/PopupMenuNewAction.java	2008-11-07 01:53:50-0800
@@ -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
@@ -24,6 +24,7 @@
 
 package org.argouml.uml.ui.behavior.common_behavior;
 
+import javax.swing.Action;
 import javax.swing.JMenu;
 import javax.swing.JPopupMenu;
 
@@ -51,55 +52,63 @@
     public PopupMenuNewAction(String role, UMLMutableLinkedList list) {
         super();
 
+        buildMenu(this, role, list.getTarget());
+    }
+    
+    public static void buildMenu(JPopupMenu pmenu, 
+            String role, Object target) {
+      
         JMenu newMenu = new JMenu();
         newMenu.setText(Translator.localize("action.new"));
 
         newMenu.add(ActionNewCallAction.getInstance());
-        ActionNewCallAction.getInstance().setTarget(list.getTarget());
+        ActionNewCallAction.getInstance().setTarget(target);
         ActionNewCallAction.getInstance().putValue(ActionNewAction.ROLE, role);
 
         newMenu.add(ActionNewCreateAction.getInstance());
-        ActionNewCreateAction.getInstance().setTarget(list.getTarget());
+        ActionNewCreateAction.getInstance().setTarget(target);
         ActionNewCreateAction.getInstance()
             .putValue(ActionNewAction.ROLE, role);
 
         newMenu.add(ActionNewDestroyAction.getInstance());
-        ActionNewDestroyAction.getInstance().setTarget(list.getTarget());
+        ActionNewDestroyAction.getInstance().setTarget(target);
         ActionNewDestroyAction.getInstance()
             .putValue(ActionNewAction.ROLE, role);
 
         newMenu.add(ActionNewReturnAction.getInstance());
-        ActionNewReturnAction.getInstance().setTarget(list.getTarget());
+        ActionNewReturnAction.getInstance().setTarget(target);
         ActionNewReturnAction.getInstance()
             .putValue(ActionNewAction.ROLE, role);
 
         newMenu.add(ActionNewSendAction.getInstance());
-        ActionNewSendAction.getInstance().setTarget(list.getTarget());
+        ActionNewSendAction.getInstance().setTarget(target);
         ActionNewSendAction.getInstance().putValue(ActionNewAction.ROLE, role);
 
         newMenu.add(ActionNewTerminateAction.getInstance());
-        ActionNewTerminateAction.getInstance().setTarget(list.getTarget());
+        ActionNewTerminateAction.getInstance().setTarget(target);
         ActionNewTerminateAction.getInstance()
             .putValue(ActionNewAction.ROLE, role);
 
         newMenu.add(ActionNewUninterpretedAction.getInstance());
-        ActionNewUninterpretedAction.getInstance().setTarget(list.getTarget());
+        ActionNewUninterpretedAction.getInstance().setTarget(target);
         ActionNewUninterpretedAction.getInstance()
             .putValue(ActionNewAction.ROLE, role);
 
 
         newMenu.add(ActionNewActionSequence.getInstance());
-        ActionNewActionSequence.getInstance().setTarget(list.getTarget());
+        ActionNewActionSequence.getInstance().setTarget(target);
         ActionNewActionSequence.getInstance()
             .putValue(ActionNewAction.ROLE, role);
 
-        add(newMenu);
+        pmenu.add(newMenu);
 
-        addSeparator();
+        pmenu.addSeparator();
 
         // TODO: This needs to be fixed to work for ActionSequences - tfm
         ActionRemoveModelElement.SINGLETON.setObjectToRemove(ActionNewAction
-             .getAction(role, list.getTarget()));
-        add(ActionRemoveModelElement.SINGLETON);
+             .getAction(role, target));
+        ActionRemoveModelElement.SINGLETON.putValue(Action.NAME, 
+                Translator.localize("action.delete-from-model"));
+        pmenu.add(ActionRemoveModelElement.SINGLETON);
     }
 }

Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PopupMenuNewEvent.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PopupMenuNewEvent.java?view=diff&rev=15974&p1=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PopupMenuNewEvent.java&p2=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PopupMenuNewEvent.java&r1=15973&r2=15974
==============================================================================
--- branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PopupMenuNewEvent.java	(original)
+++ branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PopupMenuNewEvent.java	2008-11-07 01:53:50-0800
@@ -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
@@ -24,6 +24,7 @@
 
 package org.argouml.uml.ui.behavior.state_machines;
 
+import javax.swing.Action;
 import javax.swing.JMenu;
 import javax.swing.JMenuItem;
 import javax.swing.JPopupMenu;
@@ -97,6 +98,8 @@
 
         ActionRemoveModelElement.SINGLETON.setObjectToRemove(
                 ActionNewEvent.getAction(role, target));
+        ActionRemoveModelElement.SINGLETON.putValue(Action.NAME, 
+                Translator.localize("action.delete-from-model"));
         pmenu.add(ActionRemoveModelElement.SINGLETON);
     }
 

Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionEffectListModel.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionEffectListModel.java?view=diff&rev=15974&p1=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionEffectListModel.java&p2=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionEffectListModel.java&r1=15973&r2=15974
==============================================================================
--- branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionEffectListModel.java	(original)
+++ branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionEffectListModel.java	2008-11-07 01:53:50-0800
@@ -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
@@ -24,8 +24,12 @@
 
 package org.argouml.uml.ui.behavior.state_machines;
 
+import javax.swing.JPopupMenu;
+
 import org.argouml.model.Model;
 import org.argouml.uml.ui.UMLModelElementListModel2;
+import org.argouml.uml.ui.behavior.common_behavior.ActionNewAction;
+import org.argouml.uml.ui.behavior.common_behavior.PopupMenuNewAction;
 
 /**
  * @since Dec 15, 2002
@@ -55,4 +59,11 @@
         return element == Model.getFacade().getEffect(getTarget());
     }
 
+    @Override
+    public boolean buildPopup(JPopupMenu popup, int index) {
+        PopupMenuNewAction.buildMenu(popup, 
+                ActionNewAction.Roles.EFFECT, getTarget());
+        return true;
+    }
+
 }

Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionGuardListModel.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionGuardListModel.java?view=diff&rev=15974&p1=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionGuardListModel.java&p2=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionGuardListModel.java&r1=15973&r2=15974
==============================================================================
--- branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionGuardListModel.java	(original)
+++ branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionGuardListModel.java	2008-11-07 01:53:50-0800
@@ -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
@@ -24,7 +24,11 @@
 
 package org.argouml.uml.ui.behavior.state_machines;
 
+import javax.swing.JPopupMenu;
+
 import org.argouml.model.Model;
+import org.argouml.ui.targetmanager.TargetManager;
+import org.argouml.uml.ui.AbstractActionNewModelElement;
 import org.argouml.uml.ui.UMLModelElementListModel2;
 
 /**
@@ -55,4 +59,12 @@
         return element == Model.getFacade().getGuard(getTarget());
     }
 
+    @Override
+    public boolean buildPopup(JPopupMenu popup, int index) {
+        AbstractActionNewModelElement a = ActionNewGuard.getSingleton();
+        a.setTarget(TargetManager.getInstance().getTarget());
+        popup.add(a);
+        return true;
+    }
+
 }
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.