/** * Enabled the remove action if an item is selected in anything other then the activity or state * diagrams. */ private void determineRemoveEnabled() { Editor editor = Globals.curEditor(); Collection figs = editor.getSelectionManager().getFigs(); boolean removeEnabled = !figs.isEmpty(); GraphModel gm = editor.getGraphModel(); if (gm instanceof UMLMutableGraphSupport) { removeEnabled = ((UMLMutableGraphSupport) gm).isRemoveFromDiagramAllowed(figs); } removeFromDiagram.setEnabled(removeEnabled); }
/* * @see org.tigris.gef.graph.GraphFactory#makeNode() */ public Object makeNode() { Object node = null; Editor ce = Globals.curEditor(); GraphModel gm = ce.getGraphModel(); if (gm instanceof CollabDiagramGraphModel) { Object collaboration = ((CollabDiagramGraphModel) gm).getHomeModel(); node = Model.getCollaborationsFactory().buildClassifierRole(collaboration); } else { throw new IllegalStateException("Graphmodel is not a " + "collaboration diagram graph model"); } return node; }
@Override public void actionPerformed(ActionEvent ae) { super.actionPerformed(ae); Editor ce = Globals.curEditor(); GraphModel gm = ce.getGraphModel(); if (!(gm instanceof MutableGraphModel)) { return; } String instructions = Translator.localize("misc.message.click-on-diagram-to-add"); Globals.showStatus(instructions); final ModeAddToDiagram placeMode = new ModeAddToDiagram(objects, instructions); Globals.mode(placeMode, false); }
AddToDiagramMemento(final Editor ed, final List<FigNode> nodesPlaced) { this.nodesPlaced = nodesPlaced; this.editor = ed; this.mgm = (MutableGraphModel) editor.getGraphModel(); }