Merge lp:~tapaal-contributor/tapaal/fix-934132-cmdvsctrl-redone into lp:tapaal

Proposed by Jiri Srba
Status: Merged
Approved by: Kenneth Yrke Jørgensen
Approved revision: 664
Merged at revision: 663
Proposed branch: lp:~tapaal-contributor/tapaal/fix-934132-cmdvsctrl-redone
Merge into: lp:tapaal
Diff against target: 283 lines (+105/-33)
2 files modified
src/pipe/gui/GuiFrame.java (+101/-31)
src/pipe/gui/widgets/EngineDialogPanel.java (+4/-2)
To merge this branch: bzr merge lp:~tapaal-contributor/tapaal/fix-934132-cmdvsctrl-redone
Reviewer Review Type Date Requested Status
Kenneth Yrke Jørgensen code review Approve
Jiri Srba Approve
Review via email: mp+94456@code.launchpad.net

Commit message

Redone the assignment of hotkeys, for win+linux using crtl for mac using cmd.

Description of the change

Redone the assignment of hotkeys, for win+linux using crtl for mac using cmd.

To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) :
review: Approve
Revision history for this message
Kenneth Yrke Jørgensen (yrke) :
review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/pipe/gui/GuiFrame.java'
2--- src/pipe/gui/GuiFrame.java 2012-02-20 10:20:43 +0000
3+++ src/pipe/gui/GuiFrame.java 2012-02-23 21:26:18 +0000
4@@ -8,6 +8,7 @@
5 import java.awt.Toolkit;
6 import java.awt.event.ActionEvent;
7 import java.awt.event.ActionListener;
8+import java.awt.event.InputEvent;
9 import java.awt.event.WindowAdapter;
10 import java.awt.event.WindowEvent;
11 import java.beans.PropertyChangeEvent;
12@@ -83,8 +84,7 @@
13 import dk.aau.cs.model.tapn.NetworkMarking;
14 import dk.aau.cs.model.tapn.TimedArcPetriNet;
15 import dk.aau.cs.model.tapn.TimedPlace;
16-import dk.aau.cs.verification.UPPAAL.Verifyta;
17-import dk.aau.cs.verification.VerifyTAPN.VerifyTAPN;
18+
19
20 public class GuiFrame extends JFrame implements Observer {
21
22@@ -111,6 +111,7 @@
23
24 private EditAction /* copyAction, cutAction, pasteAction, */undoAction, redoAction;
25 private GridAction toggleGrid;
26+ private ToolAction netStatisticsAction, batchProcessingAction, engineSelectionAction;
27 private ZoomAction zoomOutAction, zoomInAction;
28 private DeleteAction deleteAction;
29 private TypeAction annotationAction, arcAction, inhibarcAction,
30@@ -246,18 +247,27 @@
31 JMenu fileMenu = new JMenu("File");
32 fileMenu.setMnemonic('F');
33
34+ int shortcutkey = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
35+
36 addMenuItem(fileMenu, createAction = new FileAction("New",
37 "Create a new Petri net", "ctrl N"));
38+ createAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('N', shortcutkey));
39+
40 addMenuItem(fileMenu, openAction = new FileAction("Open", "Open",
41 "ctrl O"));
42+ openAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('O', shortcutkey));
43+
44 addMenuItem(fileMenu, closeAction = new FileAction("Close",
45 "Close the current tab", "ctrl W"));
46+ closeAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('W', shortcutkey));
47 fileMenu.addSeparator();
48
49 addMenuItem(fileMenu, saveAction = new FileAction("Save", "Save",
50 "ctrl S"));
51+ saveAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('S', shortcutkey));
52 addMenuItem(fileMenu, saveAsAction = new FileAction("Save as",
53- "Save as...", "shift ctrl S"));
54+ "Save as...", null));
55+ saveAsAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('S', (shortcutkey + InputEvent.SHIFT_MASK)));
56
57 // Export menu
58 exportMenu = new JMenu("Export");
59@@ -267,16 +277,20 @@
60 CreateGui.imgPath + "Export.png")));
61 addMenuItem(exportMenu, exportPNGAction = new FileAction("PNG",
62 "Export the net to PNG format", "ctrl G"));
63+ exportPNGAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('G', shortcutkey));
64 addMenuItem(exportMenu, exportPSAction = new FileAction("PostScript",
65 "Export the net to PostScript format", "ctrl T"));
66+ exportPSAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('T', shortcutkey));
67 addMenuItem(exportMenu, exportToTikZAction = new FileAction("TikZ",
68 "Export the net to PNG format", "ctrl L"));
69+ exportToTikZAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('L', shortcutkey));
70
71 fileMenu.add(exportMenu);
72
73 fileMenu.addSeparator();
74 addMenuItem(fileMenu, printAction = new FileAction("Print", "Print",
75 "ctrl P"));
76+ printAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('P', shortcutkey));
77 fileMenu.addSeparator();
78
79 // Example files menu
80@@ -356,7 +370,14 @@
81 if (nets[i].toLowerCase().endsWith(".xml")) {
82 //addMenuItem(exampleMenu, new ExampleFileAction(nets[i], (k < 10) ? "ctrl " + (k++) : null));
83
84- ExampleFileAction tmp = new ExampleFileAction(nets[i], nets[i].replace(".xml", ""), (k < 10) ? "ctrl " + (k++) : null);
85+ ExampleFileAction tmp = new ExampleFileAction(nets[i], nets[i].replace(".xml", ""), null);
86+ if (k < 10) {
87+
88+ //tmp.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyStroke.getKeyStroke(""+k).getKeyCode(), shortcutkey));
89+
90+ }
91+ k++;
92+
93 addMenuItem(exampleMenu, tmp);
94 }
95 }
96@@ -369,14 +390,17 @@
97 }
98 addMenuItem(fileMenu, exitAction = new FileAction("Exit",
99 "Close the program", "ctrl Q"));
100+ exitAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('Q', shortcutkey));
101
102 /* Edit Menu */
103 JMenu editMenu = new JMenu("Edit");
104 editMenu.setMnemonic('E');
105 addMenuItem(editMenu, undoAction = new EditAction("Undo",
106- "Undo (Ctrl-Z)", "ctrl Z"));
107+ "Undo", "ctrl Z"));
108+ undoAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('Z', shortcutkey));
109 addMenuItem(editMenu, redoAction = new EditAction("Redo",
110- "Redo (Ctrl-Y)", "ctrl Y"));
111+ "Redo", "ctrl Y"));
112+ redoAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('Y', shortcutkey));
113 editMenu.addSeparator();
114
115 addMenuItem(editMenu, deleteAction = new DeleteAction("Delete",
116@@ -432,10 +456,13 @@
117 CreateGui.imgPath + "Zoom.png")));
118 addZoomMenuItems(zoomMenu);
119
120+ addMenuItem(viewMenu, zoomInAction = new ZoomAction("Zoom in",
121+ "Zoom in by 10% ", "ctrl J"));
122+ zoomInAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyStroke.getKeyStroke("J").getKeyCode(), shortcutkey));
123+
124 addMenuItem(viewMenu, zoomOutAction = new ZoomAction("Zoom out",
125- "Zoom out by 10% ", "ctrl MINUS"));
126- addMenuItem(viewMenu, zoomInAction = new ZoomAction("Zoom in",
127- "Zoom in by 10% ", "ctrl PLUS"));
128+ "Zoom out by 10% ", "ctrl K"));
129+ zoomOutAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyStroke.getKeyStroke("K").getKeyCode(), shortcutkey));
130 viewMenu.add(zoomMenu);
131
132 viewMenu.addSeparator();
133@@ -446,16 +473,26 @@
134
135 viewMenu.addSeparator();
136
137- addCheckboxMenuItem(viewMenu, showComponentsAction = new ViewAction("Display components",
138- 453243, "Show/hide the list of components.", "C", true));
139- addCheckboxMenuItem(viewMenu, showConstantsAction = new ViewAction("Display constants",
140- 453245, "Show/hide global constants.", "O", true));
141- addCheckboxMenuItem(viewMenu, showQueriesAction = new ViewAction("Display queries",
142- 453244, "Show/hide verification queries.", "Q", true));
143- addCheckboxMenuItem(viewMenu, showZeroToInfinityIntervalsAction = new ViewAction("Display intervals [0,inf)",
144- 453246, "Show/hide intervals [0,inf) that do not restrict transition firing in any way.","F",true));
145- addCheckboxMenuItem(viewMenu, showEnabledTransitionsAction = new ViewAction("Display Enabled transitions",
146- 453247, "Show/hide the list of enabled transitions","E",true));
147+ addCheckboxMenuItem(viewMenu, showComponentsAction = new ViewAction("Display components",
148+ 453243, "Show/hide the list of components.", "ctrl 1", true));
149+ showComponentsAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('1', shortcutkey));
150+
151+ addCheckboxMenuItem(viewMenu, showQueriesAction = new ViewAction("Display queries",
152+ 453244, "Show/hide verification queries.", "ctrl 2", true));
153+ showQueriesAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('2', shortcutkey));
154+
155+ addCheckboxMenuItem(viewMenu, showConstantsAction = new ViewAction("Display constants",
156+ 453245, "Show/hide global constants.", "ctrl 3", true));
157+ showConstantsAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('3', shortcutkey));
158+
159+ addCheckboxMenuItem(viewMenu, showEnabledTransitionsAction = new ViewAction("Display enabled transitions",
160+ 453247, "Show/hide the list of enabled transitions","ctrl 4",true));
161+ showEnabledTransitionsAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('4', shortcutkey));
162+
163+ addCheckboxMenuItem(viewMenu, showZeroToInfinityIntervalsAction = new ViewAction("Display intervals [0,inf)",
164+ 453246, "Show/hide intervals [0,inf) that do not restrict transition firing in any way.","ctrl 5",true));
165+ showZeroToInfinityIntervalsAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('5', shortcutkey));
166+
167
168 /* Simulator */
169 JMenu animateMenu = new JMenu("Simulator");
170@@ -523,7 +560,25 @@
171 JMenu toolsMenu = new JMenu("Tools");
172 toolsMenu.setMnemonic('t');
173
174- JMenuItem batchProcessing = new JMenuItem("Batch processing");
175+ int shortcutkey = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
176+
177+
178+ //statistics = new JMenuItem("Net statistics");
179+ statistics = new JMenuItem(netStatisticsAction = new ToolAction("Net statistics", "Shows information about the number of transitions, places, arcs, etc.","ctrl I"));
180+ netStatisticsAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('I', shortcutkey));
181+ statistics.setMnemonic('n');
182+ statistics.addActionListener(new ActionListener() {
183+ public void actionPerformed(ActionEvent arg0) {
184+ StatisticsPanel.showStatisticsPanel();
185+ }
186+ });
187+ toolsMenu.add(statistics);
188+
189+
190+ //JMenuItem batchProcessing = new JMenuItem("Batch processing");
191+ JMenuItem batchProcessing = new JMenuItem(batchProcessingAction = new ToolAction("Batch processing", "Batch verification of multiple nets and queries","ctrl B"));
192+ batchProcessingAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('B', shortcutkey));
193+
194 batchProcessing.setMnemonic('b');
195 batchProcessing.addActionListener(new ActionListener() {
196 public void actionPerformed(ActionEvent arg0) {
197@@ -540,18 +595,13 @@
198 });
199 toolsMenu.add(batchProcessing);
200
201- statistics = new JMenuItem("Net statistics");
202- statistics.setMnemonic('n');
203- statistics.addActionListener(new ActionListener() {
204- public void actionPerformed(ActionEvent arg0) {
205- StatisticsPanel.showStatisticsPanel();
206- }
207- });
208- toolsMenu.add(statistics);
209
210 toolsMenu.addSeparator();
211
212- JMenuItem engineSelection = new JMenuItem("Verification engines");
213+ //JMenuItem engineSelection = new JMenuItem("Verification engines");
214+ JMenuItem engineSelection = new JMenuItem(engineSelectionAction = new ToolAction("Engine selection", "View and modify the location of verification engines","ctrl E"));
215+ engineSelectionAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('E', shortcutkey));
216+
217 engineSelection.setMnemonic('v');
218 engineSelection.addActionListener(new ActionListener() {
219 public void actionPerformed(ActionEvent arg0) {
220@@ -659,8 +709,10 @@
221 */
222 private void addZoomMenuItems(JMenu zoomMenu) {
223 for (int i = 0; i <= zoomExamples.length - 1; i++) {
224- JMenuItem newItem = new JMenuItem(new ZoomAction(zoomExamples[i],
225- "Select zoom percentage", i < 10 ? "ctrl shift " + i : ""));
226+ ZoomAction a = new ZoomAction(zoomExamples[i], "Select zoom percentage", "");
227+
228+ JMenuItem newItem = new JMenuItem(a);
229+
230 zoomMenu.add(newItem);
231 }
232 }
233@@ -1767,6 +1819,24 @@
234 }
235
236 }
237+
238+ class ToolAction extends GuiAction {
239+
240+ /**
241+ *
242+ */
243+ private static final long serialVersionUID = 8910743226610517225L;
244+
245+ ToolAction(String name, String tooltip, String keystroke) {
246+ super(name, tooltip, keystroke);
247+ }
248+
249+
250+ public void actionPerformed(ActionEvent e) {
251+ // TODO Auto-generated method stub
252+
253+ }
254+ }
255
256 class ZoomAction extends GuiAction {
257
258
259=== modified file 'src/pipe/gui/widgets/EngineDialogPanel.java'
260--- src/pipe/gui/widgets/EngineDialogPanel.java 2012-02-14 18:20:28 +0000
261+++ src/pipe/gui/widgets/EngineDialogPanel.java 2012-02-23 21:26:18 +0000
262@@ -354,17 +354,19 @@
263 gbc.gridy = 2;
264 gbc.anchor = GridBagConstraints.EAST;
265 gbc.insets = new Insets(0,5,2,5);
266- enginePanel.add(closeButtonPanel,gbc);
267+ enginePanel.add(closeButtonPanel,gbc);
268+
269 }
270
271 public void showDialog() {
272 dialog = new EscapableDialog(CreateGui.getApp(),
273- "Select verification engines", true);
274+ "Selection of Verification Engines", true);
275 dialog.add(enginePanel);
276 dialog.setResizable(false);
277 dialog.setMinimumSize(minimumSize);
278 dialog.pack();
279 dialog.setLocationRelativeTo(null);
280 dialog.setVisible(true);
281+
282 }
283 }

Subscribers

People subscribed via source and target branches