Author: penyaskito Date: 2008-10-18 16:16:22-0700 New Revision: 15934 Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/ui/explorer/ExplorerPopup.java
Log: Issue 5455: Add related node to diagram for assoc/gener. in explorer broken Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/ui/explorer/ExplorerPopup.java Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/ui/explorer/ExplorerPopup.java?view=diff&rev=15934&p1=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/ui/explorer/ExplorerPopup.java&p2=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/ui/explorer/ExplorerPopup.java&r1=15933&r2=15934 ============================================================================== --- branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/ui/explorer/ExplorerPopup.java (original) +++ branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/ui/explorer/ExplorerPopup.java 2008-10-18 16:16:22-0700 @@ -62,6 +62,7 @@ import org.argouml.uml.diagram.ui.ActionAddExistingNode; import org.argouml.uml.diagram.ui.ActionAddExistingNodes; import org.argouml.uml.diagram.ui.ActionSaveDiagramToClipboard; +import org.argouml.uml.diagram.ui.ModeAddToDiagram; import org.argouml.uml.ui.ActionActivityDiagram; import org.argouml.uml.ui.ActionClassDiagram; import org.argouml.uml.ui.ActionCollaborationDiagram; @@ -73,7 +74,11 @@ import org.argouml.uml.ui.ActionStateDiagram; import org.argouml.uml.ui.ActionUseCaseDiagram; import org.tigris.gef.base.Diagram; +import org.tigris.gef.base.Editor; +import org.tigris.gef.base.Globals; +import org.tigris.gef.graph.GraphModel; import org.tigris.gef.graph.MutableGraphModel; +import org.tigris.gef.undo.UndoableAction; /** * PopUp for extra functionality for the Explorer. @@ -596,7 +601,7 @@ private static final long serialVersionUID = -5663884871599931780L; - private class ActionAddExistingRelatedNode extends ActionAddExistingNode { + private class ActionAddExistingRelatedNode extends UndoableAction { /** * The UML object to be added to the diagram. @@ -610,7 +615,7 @@ * @param o the node UML object to be added */ public ActionAddExistingRelatedNode(String name, Object o) { - super(name, o); + super(name); object = o; } @@ -624,6 +629,33 @@ MutableGraphModel gm = (MutableGraphModel) dia.getGraphModel(); return gm.canAddNode(object); } + + public void actionPerformed(ActionEvent ae) { + super.actionPerformed(ae); + Editor ce = Globals.curEditor(); + GraphModel gm = ce.getGraphModel(); + if (!(gm instanceof MutableGraphModel)) { + return; + } + + String instructions = null; + if (object != null) { + instructions = + Translator.localize( + "misc.message.click-on-diagram-to-add", + new Object[] { + Model.getFacade().toString(object), + }); + Globals.showStatus(instructions); + } + + ArrayList<Object> elementsToAdd = new ArrayList<Object>(1); + elementsToAdd.add(object); + final ModeAddToDiagram placeMode = + new ModeAddToDiagram(elementsToAdd, instructions); + + Globals.mode(placeMode, false); + } } /* end class ActionAddExistingRelatedNode */ /** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
