svn commit: r19072 - trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: thn
Date: 2011-02-24 01:15:35-0800
New Revision: 19072

Modified:
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java

Log:
added TagDefinitionGetterSetter for the list box in property panels

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java?view=diff&pathrev=19072&r1=19071&r2=19072
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java	2011-02-24 01:15:35-0800
@@ -8,6 +8,7 @@
  *
  * Contributors:
  *    Bob Tarling - Original implementation
+ *    Thomas Neustupny
  *******************************************************************************
  */
 
@@ -22,7 +23,6 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
-import java.util.StringTokenizer;
 
 import javax.swing.Icon;
 import javax.swing.JOptionPane;
@@ -34,13 +34,13 @@
 import org.argouml.kernel.NonUndoableCommand;
 import org.argouml.kernel.Project;
 import org.argouml.kernel.ProjectManager;
-import org.argouml.model.MetaTypes;
 import org.argouml.model.Model;
 import org.argouml.profile.Profile;
 import org.argouml.profile.ProfileException;
 import org.argouml.ui.targetmanager.TargetManager;
 import org.argouml.uml.ui.UMLAddDialog;
 import org.argouml.util.ArgoFrame;
+import org.eclipse.uml2.uml.Property;
 
 /**
  * Property getters and setters for UML1.4
@@ -71,6 +71,7 @@
         addGetterSetter("classifier", new ClassifierGetterSetter());
         addGetterSetter("concurrency", new ConcurrencyGetterSetter());
         addGetterSetter("deferrableEvent", new DeferrableEventGetterSetter());
+        addGetterSetter("definedTag", new TagDefinitionGetterSetter());
         addGetterSetter("derived", new DerivedGetterSetter());
         addGetterSetter("doActivity", new DoActivityActionGetterSetter());
         addGetterSetter("entry", new EntryActionGetterSetter());
@@ -296,7 +297,34 @@
             Model.getCoreHelper().setStatic(modelElement, (Boolean) value);
         }
     }
-    
+
+    private class TagDefinitionGetterSetter extends ListGetterSetter {
+        
+        public Collection getOptions(Object modelElement, Collection<Class<?>> types) {
+            LinkedList<String> list = new LinkedList<String>(
+                    Model.getFacade().getTagDefinitions(modelElement));
+            Collections.sort(list);
+            return list;
+        }
+      
+        public Object get(Object modelElement, Class<?> type) {
+            // not needed
+            return null;
+        }
+      
+        public void set(Object element, Object x) {
+            // not needed
+        }
+
+        public boolean isValidElement(Object element, Collection<Class<?>> types) {
+            return getOptions(element, types).contains(element);
+        }
+        
+        public Object getMetaType() {
+            return Property.class;
+        }
+    }
+
     private class TargetScopeGetterSetter extends BaseGetterSetter {
         // Have we handled UML2 here?
         public Object get(Object modelElement, Class<?> type) {

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

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.