svn commit: r17142 - trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementListModel.java

Bob Tarling <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2009-05-21 12:39:50-0700
New Revision: 17142

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

Log:
Provide a getter to fetch all the popup actions on this control.

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementListModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementListModel.java?view=diff&pathrev=17142&r1=17141&r2=17142
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementListModel.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementListModel.java	2009-05-21 12:39:50-0700
@@ -29,10 +29,13 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.List;
 
 import javax.swing.Action;
 import javax.swing.DefaultListModel;
+import javax.swing.JMenuItem;
 import javax.swing.JPopupMenu;
+import javax.swing.MenuElement;
 
 import org.apache.log4j.Logger;
 import org.argouml.model.AddAssociationEvent;
@@ -580,6 +583,19 @@
         return false;
     }
     
+    public List<Action> getActions() {
+        final List<Action> actions = new ArrayList<Action>();
+        final JPopupMenu popup = new JPopupMenu();
+        buildPopup(popup, 0);
+        final MenuElement[] elements = popup.getSubElements();
+        for (MenuElement element : elements) {
+            if (element instanceof JMenuItem) {
+                actions.add(((JMenuItem) element).getAction());
+            }
+        }
+        return actions;
+    }
+    
     /**
      * Get a toolbar containing all the actions available on this JList.
      * @return the toolbar.

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

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.