svn commit: r18684 - trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTransitionTriggerComboBoxModel.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2010-08-26 01:59:17-0700
New Revision: 18684

Modified:
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTransitionTriggerComboBoxModel.java

Log:
Restrict the events shown in a trigger

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTransitionTriggerComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTransitionTriggerComboBoxModel.java?view=diff&pathrev=18684&r1=18683&r2=18684
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTransitionTriggerComboBoxModel.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTransitionTriggerComboBoxModel.java	2010-08-26 01:59:17-0700
@@ -53,13 +53,31 @@
         return true;
     }
     
+    /**
+     * For the list of possible items include all events under the first package
+     * above the target transition
+     * 
+     * @see org.argouml.core.propertypanels.ui.UMLComboBoxModel#buildModelList()
+     */
     protected void buildModelList() {
-        Object transition = getTarget();
+        final Object transition = getTarget();
         removeAllElements();
+        
+        Object parent = Model.getFacade().getModelElementContainer(transition);
+        if (!Model.getFacade().isAPackage(parent)) {
+            parent = Model.getFacade().getModelElementContainer(parent);
+        }
         final Collection list =
             Model.getModelManagementHelper().getAllModelElementsOfKind(
-                Model.getFacade().getRoot(getTarget()),
+                parent,
                 Model.getMetaTypes().getEvent());
+        
+        Object selectedElement = getSelectedModelElement();
+        if (selectedElement != null && !list.contains(selectedElement)) {
+            // Just in case the existing selected element is from elsewhere
+            // make sure it is in the list
+            list.add(selectedElement);
+        }
         setElements(list);
 
         setSelectedItem(Model.getFacade().getTrigger(transition));

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2651576

To unsubscribe from this discussion, e-mail: [[email protected]].
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.