01: // This file is part of KeY - Integrated Deductive Software Design
02: // Copyright (C) 2001-2007 Universitaet Karlsruhe, Germany
03: // Universitaet Koblenz-Landau, Germany
04: // Chalmers University of Technology, Sweden
05: //
06: // The KeY system is protected by the GNU General Public License.
07: // See LICENSE.TXT for details.
08: //
09: //
10:
11: /* Generated by Together */
12:
13: // All implementing classes should have a name of
14: // "ClassMenu" + ...
15: package de.uka.ilkd.key.casetool.together.scripts.menuextension;
16:
17: import com.togethersoft.openapi.ide.IdeContext;
18: import com.togethersoft.openapi.ide.window.IdeDialogType;
19: import com.togethersoft.openapi.ide.window.IdeWindowManager;
20: import com.togethersoft.openapi.rwi.*;
21:
22: import de.uka.ilkd.key.casetool.UMLModelClass;
23: import de.uka.ilkd.key.casetool.together.TogetherModelClass;
24:
25: import javax.swing.ProgressMonitor;
26:
27: public abstract class ClassMenu {
28:
29: protected ProgressMonitor pm;
30:
31: public abstract String getMenuEntry();
32:
33: public void run(IdeWindowManager winMan, IdeContext context,
34: RwiModel rwiModel, RwiDiagram rwiDiagram) {
35: RwiElement[] selectedRwiElements = context.getRwiElements();
36: RwiElement selectedRwiElement = selectedRwiElements[0];
37: RwiReference selectedRef = rwiDiagram
38: .findReference(selectedRwiElement);
39: // if a class is selected it is always a node (so the cast
40: // shouldn't be dangerous
41: RwiNode selectedNode = ((RwiNodeReference) selectedRef)
42: .getNode();
43:
44: TogetherModelClass modelClass = new TogetherModelClass(
45: selectedNode, rwiModel, rwiDiagram);
46:
47: String result = runCore(modelClass);
48:
49: if (!result.equals("")) {
50: if (pm != null)
51: pm.close();
52: winMan.showMessageDialog("Result",
53: IdeDialogType.INFORMATION, result);
54: }
55: }
56:
57: protected abstract String runCore(UMLModelClass aReprModelClass);
58: }
|