Author: bobtarling Date: 2010-11-06 10:34:40-0700 New Revision: 18839 Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java
Log: Provide create buttons for child and sibling items defined in the XML Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java?view=diff&pathrev=18839&r1=18838&r2=18839 ============================================================================== --- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java (original) +++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java 2010-11-06 10:34:40-0700 @@ -54,10 +54,10 @@ import org.argouml.core.propertypanels.model.CheckBoxData; import org.argouml.core.propertypanels.model.ControlData; import org.argouml.core.propertypanels.model.GetterSetterManager; -import org.argouml.core.propertypanels.model.MetaDataCache; import org.argouml.core.propertypanels.model.PanelData; import org.argouml.i18n.Translator; import org.argouml.model.Model; +import org.argouml.ui.ActionCreateContainedModelElement; import org.argouml.uml.ui.ActionDeleteModelElements; import org.argouml.uml.ui.foundation.extension_mechanisms.ActionNewStereotype; import org.tigris.toolbar.ToolBarFactory; @@ -70,7 +70,6 @@ private static final Logger LOG = Logger.getLogger(SwingUIFactory.class); public SwingUIFactory() { - } /** @@ -153,13 +152,16 @@ // list on property panel tb.add(new ActionNewStereotype()); - for (Class<?> newChildElement : panelData.getNewChildElements()) { - LOG.debug("Child = " + newChildElement); - // TODO: Create new child action here - } - for (Class<?> newSiblingElement : panelData.getNewSiblingElements()) { - LOG.debug("Sibling = " + newSiblingElement); - // TODO: Create new sibling action here + for (Class<?> metaType : panelData.getNewChildElements()) { + tb.add(new ActionCreateContainedModelElement(metaType, target)); + } + + final Object parent = Model.getFacade().getModelElementContainer(target); + + if (parent != null) { + for (Class<?> metaType : panelData.getNewSiblingElements()) { + tb.add(new ActionCreateContainedModelElement(metaType, parent)); + } } } panel.add(tb); ------------------------------------------------------ http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2679552 To unsubscribe from this discussion, e-mail: [[email protected]].
