Merge lp:~tapaal-contributor/tapaal/pnml-disable-buttons-1868535 into lp:tapaal

Proposed by Peter Haahr Taankvist
Status: Merged
Approved by: Jiri Srba
Approved revision: 1042
Merged at revision: 1043
Proposed branch: lp:~tapaal-contributor/tapaal/pnml-disable-buttons-1868535
Merge into: lp:tapaal
Diff against target: 42 lines (+8/-1)
2 files modified
src/pipe/gui/CreateGui.java (+4/-0)
src/pipe/gui/GuiFrame.java (+4/-1)
To merge this branch: bzr merge lp:~tapaal-contributor/tapaal/pnml-disable-buttons-1868535
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Review via email: mp+381064@code.launchpad.net

Commit message

When import PNML fails and there are no other tabs open buttons are correctly disabled (as when closing a last tab).

SmartDrawDialog also does not appear if import PNML fails.

To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/pipe/gui/CreateGui.java'
--- src/pipe/gui/CreateGui.java 2018-10-19 14:18:17 +0000
+++ src/pipe/gui/CreateGui.java 2020-03-23 20:00:20 +0000
@@ -97,4 +97,8 @@
97 public static GuiFrame getAppGui() {97 public static GuiFrame getAppGui() {
98 return appGui;98 return appGui;
99 }99 }
100
101 public static int getTabsSize(){
102 return tabs.size();
103 }
100}104}
101105
=== modified file 'src/pipe/gui/GuiFrame.java'
--- src/pipe/gui/GuiFrame.java 2020-03-18 19:23:12 +0000
+++ src/pipe/gui/GuiFrame.java 2020-03-23 20:00:20 +0000
@@ -1492,6 +1492,7 @@
14921492
1493 //XXX 2018-05-23 kyrke, implementation close to closeTab, needs refactoring1493 //XXX 2018-05-23 kyrke, implementation close to closeTab, needs refactoring
1494 private void undoAddTab(int currentlySelected) {1494 private void undoAddTab(int currentlySelected) {
1495 if(appTab.getTabCount() == 1) { CreateGui.getApp().setGUIMode(GUIMode.noNet); }
1495 CreateGui.removeTab(appTab.getSelectedIndex() );1496 CreateGui.removeTab(appTab.getSelectedIndex() );
1496 appTab.removeTabAt(appTab.getSelectedIndex());1497 appTab.removeTabAt(appTab.getSelectedIndex());
1497 appTab.setSelectedIndex(currentlySelected);1498 appTab.setSelectedIndex(currentlySelected);
@@ -2558,6 +2559,7 @@
2558 2559
2559 importMenu.add(importPNMLAction = new GuiAction("PNML untimed net", "Import an untimed net in the PNML format", KeyStroke.getKeyStroke('X', shortcutkey)) {2560 importMenu.add(importPNMLAction = new GuiAction("PNML untimed net", "Import an untimed net in the PNML format", KeyStroke.getKeyStroke('X', shortcutkey)) {
2560 public void actionPerformed(ActionEvent arg0) {2561 public void actionPerformed(ActionEvent arg0) {
2562 int currNumTabs = CreateGui.getTabsSize();
2561 final File[] files = FileBrowser.constructor("Import PNML", "pnml", FileBrowser.userPath).openFiles();2563 final File[] files = FileBrowser.constructor("Import PNML", "pnml", FileBrowser.userPath).openFiles();
2562 2564
2563 //Show loading cursor2565 //Show loading cursor
@@ -2600,7 +2602,8 @@
2600 e.printStackTrace();2602 e.printStackTrace();
2601 }2603 }
2602 }2604 }
2603 if(files.length != 0 && !CreateGui.getCurrentTab().currentTemplate().getHasPositionalInfo()) {2605 //files.length != 0 makes sure a file has been selected, CreateGui.getTabsSize() > currNumTabs makes sure the new tab was added
2606 if(files.length != 0 && CreateGui.getTabsSize() > currNumTabs && !CreateGui.getCurrentTab().currentTemplate().getHasPositionalInfo()) {
2604 int dialogResult = JOptionPane.showConfirmDialog (null, "The net does not have any layout information. Would you like to do automatic layout?","Automatic Layout?", JOptionPane.YES_NO_OPTION);2607 int dialogResult = JOptionPane.showConfirmDialog (null, "The net does not have any layout information. Would you like to do automatic layout?","Automatic Layout?", JOptionPane.YES_NO_OPTION);
2605 if(dialogResult == JOptionPane.YES_OPTION) {2608 if(dialogResult == JOptionPane.YES_OPTION) {
2606 SmartDrawDialog.showSmartDrawDialog();2609 SmartDrawDialog.showSmartDrawDialog();

Subscribers

People subscribed via source and target branches