Merge lp:~jonathan-r-beaumont/workcraft/trunk-bug-1537854 into lp:workcraft
- trunk-bug-1537854
- Merge into trunk
Proposed by
Jonny Beaumont
Status: | Merged |
---|---|
Merged at revision: | 728 |
Proposed branch: | lp:~jonathan-r-beaumont/workcraft/trunk-bug-1537854 |
Merge into: | lp:workcraft |
Diff against target: |
355 lines (+119/-59) 6 files modified
CpogsPlugin/src/org/workcraft/plugins/cpog/CustomToolsProvider.java (+1/-1) CpogsPlugin/src/org/workcraft/plugins/cpog/VisualCPOG.java (+21/-0) CpogsPlugin/src/org/workcraft/plugins/cpog/tools/CpogParsingTool.java (+2/-1) CpogsPlugin/src/org/workcraft/plugins/cpog/tools/CpogSelectionTool.java (+53/-13) CpogsPlugin/src/org/workcraft/plugins/cpog/tools/PGMinerImportTool.java (+25/-26) CpogsPlugin/src/org/workcraft/plugins/cpog/tools/PGMinerSelectedGraphsExtractionTool.java (+17/-18) |
To merge this branch: | bzr merge lp:~jonathan-r-beaumont/workcraft/trunk-bug-1537854 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Danil Sokolov | Approve | ||
Review via email: mp+284005@code.launchpad.net |
Commit message
Description of the change
Fixed bug 1537854. This includes a clear message when a user attempts to extract concurrency of a selected graph not grouped as a scenario, and some code refinements for when trimming whitespace from strings.
To post a comment you must log in.
Revision history for this message
Danil Sokolov (danilovesky) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/CustomToolsProvider.java' | |||
2 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/CustomToolsProvider.java 2015-02-05 21:35:30 +0000 | |||
3 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/CustomToolsProvider.java 2016-01-26 16:51:52 +0000 | |||
4 | @@ -17,7 +17,7 @@ | |||
5 | 17 | { | 17 | { |
6 | 18 | ArrayList<GraphEditorTool> result = new ArrayList<GraphEditorTool>(); | 18 | ArrayList<GraphEditorTool> result = new ArrayList<GraphEditorTool>(); |
7 | 19 | 19 | ||
9 | 20 | result.add(new CpogSelectionTool(true)); | 20 | result.add(new CpogSelectionTool()); |
10 | 21 | result.add(new CommentGeneratorTool()); | 21 | result.add(new CommentGeneratorTool()); |
11 | 22 | result.add(new ConnectionTool()); | 22 | result.add(new ConnectionTool()); |
12 | 23 | 23 | ||
13 | 24 | 24 | ||
14 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/VisualCPOG.java' | |||
15 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/VisualCPOG.java 2015-08-04 18:28:42 +0000 | |||
16 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/VisualCPOG.java 2016-01-26 16:51:52 +0000 | |||
17 | @@ -31,6 +31,7 @@ | |||
18 | 31 | import org.workcraft.dom.Container; | 31 | import org.workcraft.dom.Container; |
19 | 32 | import org.workcraft.dom.Node; | 32 | import org.workcraft.dom.Node; |
20 | 33 | import org.workcraft.dom.math.MathConnection; | 33 | import org.workcraft.dom.math.MathConnection; |
21 | 34 | import org.workcraft.dom.math.PageNode; | ||
22 | 34 | import org.workcraft.dom.visual.AbstractVisualModel; | 35 | import org.workcraft.dom.visual.AbstractVisualModel; |
23 | 35 | import org.workcraft.dom.visual.SelectionHelper; | 36 | import org.workcraft.dom.visual.SelectionHelper; |
24 | 36 | import org.workcraft.dom.visual.TransformHelper; | 37 | import org.workcraft.dom.visual.TransformHelper; |
25 | @@ -289,5 +290,25 @@ | |||
26 | 289 | ((VisualGroup) node.getParent()).removeWithoutNotify(node); | 290 | ((VisualGroup) node.getParent()).removeWithoutNotify(node); |
27 | 290 | } | 291 | } |
28 | 291 | } | 292 | } |
29 | 293 | |||
30 | 294 | public VisualScenarioPage groupScenarioPageSelection(String graphName) { | ||
31 | 295 | VisualScenarioPage scenario = null; | ||
32 | 296 | PageNode pageNode = new PageNode(); | ||
33 | 297 | Collection<Node> nodes = SelectionHelper.getGroupableCurrentLevelSelection(this); | ||
34 | 298 | if (nodes.size() >= 1) { | ||
35 | 299 | scenario = new VisualScenarioPage(pageNode); | ||
36 | 300 | if (graphName != null) { | ||
37 | 301 | scenario.setLabel(graphName); | ||
38 | 302 | } | ||
39 | 303 | getCurrentLevel().add(scenario); | ||
40 | 304 | getCurrentLevel().reparent(nodes, scenario); | ||
41 | 305 | Point2D centre = TransformHelper.getSnappedCentre(nodes); | ||
42 | 306 | VisualModelTransformer.translateNodes(nodes, -centre.getX(), -centre.getY()); | ||
43 | 307 | scenario.setPosition(centre); | ||
44 | 308 | select(scenario); | ||
45 | 309 | } | ||
46 | 310 | return scenario; | ||
47 | 311 | |||
48 | 312 | } | ||
49 | 292 | 313 | ||
50 | 293 | } | 314 | } |
51 | 294 | 315 | ||
52 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/tools/CpogParsingTool.java' | |||
53 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/tools/CpogParsingTool.java 2015-11-09 11:00:13 +0000 | |||
54 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/tools/CpogParsingTool.java 2016-01-26 16:51:52 +0000 | |||
55 | @@ -365,7 +365,8 @@ | |||
56 | 365 | } | 365 | } |
57 | 366 | } | 366 | } |
58 | 367 | 367 | ||
60 | 368 | 368 | if (total.endsWith("+")) total = total.substring(0, total.length() - 1); | |
61 | 369 | total = total.trim(); | ||
62 | 369 | 370 | ||
63 | 370 | 371 | ||
64 | 371 | return total; | 372 | return total; |
65 | 372 | 373 | ||
66 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/tools/CpogSelectionTool.java' | |||
67 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/tools/CpogSelectionTool.java 2016-01-18 13:36:55 +0000 | |||
68 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/tools/CpogSelectionTool.java 2016-01-26 16:51:52 +0000 | |||
69 | @@ -2,6 +2,7 @@ | |||
70 | 2 | 2 | ||
71 | 3 | import java.awt.BorderLayout; | 3 | import java.awt.BorderLayout; |
72 | 4 | import java.awt.Checkbox; | 4 | import java.awt.Checkbox; |
73 | 5 | import java.awt.Component; | ||
74 | 5 | import java.awt.Font; | 6 | import java.awt.Font; |
75 | 6 | import java.awt.Rectangle; | 7 | import java.awt.Rectangle; |
76 | 7 | import java.awt.event.ActionEvent; | 8 | import java.awt.event.ActionEvent; |
77 | @@ -78,6 +79,7 @@ | |||
78 | 78 | import org.workcraft.plugins.cpog.optimisation.BooleanFormula; | 79 | import org.workcraft.plugins.cpog.optimisation.BooleanFormula; |
79 | 79 | import org.workcraft.plugins.cpog.optimisation.booleanvisitors.FormulaToString; | 80 | import org.workcraft.plugins.cpog.optimisation.booleanvisitors.FormulaToString; |
80 | 80 | import org.workcraft.plugins.stg.VisualNamedTransition; | 81 | import org.workcraft.plugins.stg.VisualNamedTransition; |
81 | 82 | import org.workcraft.util.GUI; | ||
82 | 81 | import org.workcraft.workspace.WorkspaceEntry; | 83 | import org.workcraft.workspace.WorkspaceEntry; |
83 | 82 | 84 | ||
84 | 83 | 85 | ||
85 | @@ -106,14 +108,13 @@ | |||
86 | 106 | 108 | ||
87 | 107 | private GraphEditor editor; | 109 | private GraphEditor editor; |
88 | 108 | protected boolean cancelInPlaceEdit; | 110 | protected boolean cancelInPlaceEdit; |
89 | 111 | |||
90 | 112 | int scenarioNo = 0; | ||
91 | 109 | 113 | ||
92 | 110 | public CpogSelectionTool() { | 114 | public CpogSelectionTool() { |
94 | 111 | super(); | 115 | super(false); |
95 | 112 | } | 116 | } |
96 | 113 | 117 | ||
97 | 114 | public CpogSelectionTool(boolean enablePages) { | ||
98 | 115 | super(enablePages); | ||
99 | 116 | } | ||
100 | 117 | 118 | ||
101 | 118 | @Override | 119 | @Override |
102 | 119 | public void createInterfacePanel(final GraphEditor editor) { | 120 | public void createInterfacePanel(final GraphEditor editor) { |
103 | @@ -270,8 +271,53 @@ | |||
104 | 270 | interfacePanel.add(expressionScroll, BorderLayout.CENTER); | 271 | interfacePanel.add(expressionScroll, BorderLayout.CENTER); |
105 | 271 | interfacePanel.add(buttonPanel, BorderLayout.SOUTH); | 272 | interfacePanel.add(buttonPanel, BorderLayout.SOUTH); |
106 | 272 | 273 | ||
107 | 274 | scenarioPageGroupButton(getGroupPanel()); | ||
108 | 275 | |||
109 | 276 | |||
110 | 273 | renderTypeChangeHandler(); | 277 | renderTypeChangeHandler(); |
111 | 274 | } | 278 | } |
112 | 279 | |||
113 | 280 | public void scenarioPageGroupButton(JPanel groupPanel) { | ||
114 | 281 | JButton groupPageButton = GUI.createIconButton(GUI.createIconFromSVG( | ||
115 | 282 | "images/icons/svg/selection-page.svg"), "Combine selection as a scenario (Alt+G)"); | ||
116 | 283 | groupPageButton.addActionListener(new ActionListener(){ | ||
117 | 284 | @Override | ||
118 | 285 | public void actionPerformed(ActionEvent e) { | ||
119 | 286 | VisualCPOG visualCpog = (VisualCPOG)editor.getWorkspaceEntry().getModelEntry().getVisualModel(); | ||
120 | 287 | visualCpog.groupScenarioPageSelection("scenario" + scenarioNo); | ||
121 | 288 | scenarioNo++; | ||
122 | 289 | editor.requestFocus(); | ||
123 | 290 | } | ||
124 | 291 | }); | ||
125 | 292 | groupPanel.add(groupPageButton, 1); | ||
126 | 293 | } | ||
127 | 294 | |||
128 | 295 | public JPanel getGroupPanel() { | ||
129 | 296 | Component[] comps = interfacePanel.getComponents(); | ||
130 | 297 | JPanel groupPanel = null; | ||
131 | 298 | for (int i = 0; i < comps.length; i++) { | ||
132 | 299 | if (comps[i] instanceof JPanel) { | ||
133 | 300 | JPanel panel = (JPanel) comps[i]; | ||
134 | 301 | Component[] cmp = panel.getComponents(); | ||
135 | 302 | for (int j = 0; j < cmp.length; j++) { | ||
136 | 303 | if (cmp[j] instanceof JPanel) { | ||
137 | 304 | JPanel pan = (JPanel) cmp[j]; | ||
138 | 305 | Component[] c = pan.getComponents(); | ||
139 | 306 | for (int k = 0; k < c.length; k++) { | ||
140 | 307 | if (c[k] instanceof JButton) { | ||
141 | 308 | JButton b = (JButton) c[k]; | ||
142 | 309 | System.out.println(b.getText()); | ||
143 | 310 | if (b.getToolTipText() != null && b.getToolTipText() == "Group selection (Ctrl+G)") { | ||
144 | 311 | groupPanel = pan; | ||
145 | 312 | } | ||
146 | 313 | } | ||
147 | 314 | } | ||
148 | 315 | } | ||
149 | 316 | } | ||
150 | 317 | } | ||
151 | 318 | } | ||
152 | 319 | return groupPanel; | ||
153 | 320 | } | ||
154 | 275 | 321 | ||
155 | 276 | public HashMap<String, VisualVertex> insertExpression(String text, final VisualCPOG visualCpog, | 322 | public HashMap<String, VisualVertex> insertExpression(String text, final VisualCPOG visualCpog, |
156 | 277 | final boolean createDuplicates, boolean getVertList, boolean zoomFit, boolean blockTransitiveRemoval) { | 323 | final boolean createDuplicates, boolean getVertList, boolean zoomFit, boolean blockTransitiveRemoval) { |
157 | @@ -289,9 +335,9 @@ | |||
158 | 289 | 335 | ||
159 | 290 | if (text.contains("=")) { | 336 | if (text.contains("=")) { |
160 | 291 | name = text.substring(0, text.indexOf("=")); | 337 | name = text.substring(0, text.indexOf("=")); |
162 | 292 | while (name.endsWith(" ")) name = name.substring(0, name.length() - 1); | 338 | name = name.trim(); |
163 | 293 | text = text.substring(text.indexOf("=") + 1); | 339 | text = text.substring(text.indexOf("=") + 1); |
165 | 294 | while (text.startsWith(" ")) text = text.substring(1); | 340 | text = text.trim(); |
166 | 295 | } | 341 | } |
167 | 296 | 342 | ||
168 | 297 | CpogFormula f = null; | 343 | CpogFormula f = null; |
169 | @@ -914,13 +960,7 @@ | |||
170 | 914 | 960 | ||
171 | 915 | String newExpression = parsingTool.getExpressionFromGraph(visualCpog); | 961 | String newExpression = parsingTool.getExpressionFromGraph(visualCpog); |
172 | 916 | newExpression = newExpression.replace("\n", ""); | 962 | newExpression = newExpression.replace("\n", ""); |
180 | 917 | while (newExpression.startsWith(" ")) { | 963 | newExpression = newExpression.trim(); |
174 | 918 | newExpression = newExpression.substring(1); | ||
175 | 919 | } | ||
176 | 920 | while (newExpression.endsWith(" ")) { | ||
177 | 921 | newExpression = newExpression.substring(0, newExpression.length() - 1); | ||
178 | 922 | } | ||
179 | 923 | |||
181 | 924 | GraphReference g = referenceMap.get(page.getLabel()); | 964 | GraphReference g = referenceMap.get(page.getLabel()); |
182 | 925 | 965 | ||
183 | 926 | int eqLocation; | 966 | int eqLocation; |
184 | 927 | 967 | ||
185 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/tools/PGMinerImportTool.java' | |||
186 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/tools/PGMinerImportTool.java 2015-11-01 11:50:12 +0000 | |||
187 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/tools/PGMinerImportTool.java 2016-01-26 16:51:52 +0000 | |||
188 | @@ -53,7 +53,6 @@ | |||
189 | 53 | } | 53 | } |
190 | 54 | 54 | ||
191 | 55 | try { | 55 | try { |
192 | 56 | |||
193 | 57 | File inputFile = File.createTempFile("input", ".tr"); | 56 | File inputFile = File.createTempFile("input", ".tr"); |
194 | 58 | int c = 0; | 57 | int c = 0; |
195 | 59 | File originalFile = new File(dialog.getFilePath()); | 58 | File originalFile = new File(dialog.getFilePath()); |
196 | @@ -73,6 +72,7 @@ | |||
197 | 73 | c++; | 72 | c++; |
198 | 74 | } | 73 | } |
199 | 75 | k.close(); | 74 | k.close(); |
200 | 75 | |||
201 | 76 | HashSet<String> visitedEvents; | 76 | HashSet<String> visitedEvents; |
202 | 77 | int i = 0; | 77 | int i = 0; |
203 | 78 | String[] newLines = new String[lines.length]; | 78 | String[] newLines = new String[lines.length]; |
204 | @@ -116,45 +116,44 @@ | |||
205 | 116 | @Override | 116 | @Override |
206 | 117 | public void run(WorkspaceEntry we) { | 117 | public void run(WorkspaceEntry we) { |
207 | 118 | 118 | ||
208 | 119 | |||
209 | 120 | File inputFile; | 119 | File inputFile; |
210 | 121 | inputFile = getInputFile(we); | 120 | inputFile = getInputFile(we); |
211 | 121 | |||
212 | 122 | final Framework framework = Framework.getInstance(); | ||
213 | 123 | final GraphEditorPanel editor = framework.getMainWindow().getCurrentEditor(); | ||
214 | 124 | final ToolboxPanel toolbox = editor.getToolBox(); | ||
215 | 125 | final CpogSelectionTool tool = toolbox.getToolInstance(CpogSelectionTool.class); | ||
216 | 126 | |||
217 | 127 | |||
218 | 122 | try { | 128 | try { |
219 | 123 | if (inputFile != null) { | 129 | if (inputFile != null) { |
220 | 124 | 130 | ||
221 | 125 | if (dialog.getExtractConcurrency()) { | 131 | if (dialog.getExtractConcurrency()) { |
222 | 126 | PGMinerTask task = new PGMinerTask(inputFile, dialog.getSplit()); | 132 | PGMinerTask task = new PGMinerTask(inputFile, dialog.getSplit()); |
223 | 127 | 133 | ||
225 | 128 | final Framework framework = Framework.getInstance(); | 134 | |
226 | 129 | PGMinerResultHandler result = new PGMinerResultHandler((VisualCPOG) we.getModelEntry().getVisualModel(), we, false); | 135 | PGMinerResultHandler result = new PGMinerResultHandler((VisualCPOG) we.getModelEntry().getVisualModel(), we, false); |
227 | 130 | framework.getTaskManager().queue(task, "PGMiner", result); | 136 | framework.getTaskManager().queue(task, "PGMiner", result); |
228 | 131 | } else { | 137 | } else { |
251 | 132 | 138 | Scanner k; | |
252 | 133 | final Framework framework = Framework.getInstance(); | 139 | |
253 | 134 | final GraphEditorPanel editor = framework.getMainWindow().getCurrentEditor(); | 140 | k = new Scanner(inputFile); |
254 | 135 | final ToolboxPanel toolbox = editor.getToolBox(); | 141 | int i = 0; |
255 | 136 | final CpogSelectionTool tool = toolbox.getToolInstance(CpogSelectionTool.class); | 142 | double yPos = tool.getLowestVertex((VisualCPOG) editor.getWorkspaceEntry().getModelEntry().getVisualModel()).getY() + 3; |
256 | 137 | 143 | editor.getWorkspaceEntry().captureMemento(); | |
257 | 138 | Scanner k; | 144 | while (k.hasNext()) { |
258 | 139 | 145 | String line = k.nextLine(); | |
259 | 140 | k = new Scanner(inputFile); | 146 | |
260 | 141 | int i = 0; | 147 | tool.insertEventLog((VisualCPOG) editor.getWorkspaceEntry().getModelEntry().getVisualModel(), i++, line.split(" "), yPos); |
261 | 142 | double yPos = tool.getLowestVertex((VisualCPOG) editor.getWorkspaceEntry().getModelEntry().getVisualModel()).getY() + 3; | 148 | |
262 | 143 | editor.getWorkspaceEntry().captureMemento(); | 149 | yPos = yPos + 5; |
263 | 144 | while (k.hasNext()) { | 150 | } |
264 | 145 | String line = k.nextLine(); | 151 | k.close(); |
265 | 146 | 152 | editor.getWorkspaceEntry().saveMemento(); | |
244 | 147 | tool.insertEventLog((VisualCPOG) editor.getWorkspaceEntry().getModelEntry().getVisualModel(), i++, line.split(" "), yPos); | ||
245 | 148 | |||
246 | 149 | yPos = yPos + 5; | ||
247 | 150 | |||
248 | 151 | } | ||
249 | 152 | k.close(); | ||
250 | 153 | editor.getWorkspaceEntry().saveMemento(); | ||
266 | 154 | } | 153 | } |
267 | 155 | } | 154 | } |
268 | 156 | } catch (Exception e) { | 155 | } catch (Exception e) { |
270 | 157 | 156 | editor.getWorkspaceEntry().cancelMemento(); | |
271 | 158 | } | 157 | } |
272 | 159 | } | 158 | } |
273 | 160 | 159 | ||
274 | 161 | 160 | ||
275 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/tools/PGMinerSelectedGraphsExtractionTool.java' | |||
276 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/tools/PGMinerSelectedGraphsExtractionTool.java 2015-11-01 11:50:12 +0000 | |||
277 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/tools/PGMinerSelectedGraphsExtractionTool.java 2016-01-26 16:51:52 +0000 | |||
278 | @@ -41,53 +41,51 @@ | |||
279 | 41 | String allGraphs = CpogParsingTool.getExpressionFromGraph(visualCpog); | 41 | String allGraphs = CpogParsingTool.getExpressionFromGraph(visualCpog); |
280 | 42 | ArrayList<String> tempGraphs = new ArrayList<>(); | 42 | ArrayList<String> tempGraphs = new ArrayList<>(); |
281 | 43 | ArrayList<String> graphs = new ArrayList<>(); | 43 | ArrayList<String> graphs = new ArrayList<>(); |
282 | 44 | String prefix = "input", suffix = ".tr"; | ||
283 | 45 | inputFile = File.createTempFile("input", ".tr"); | 44 | inputFile = File.createTempFile("input", ".tr"); |
284 | 46 | 45 | ||
286 | 47 | PrintStream expressions = new PrintStream(inputFile); | 46 | |
287 | 48 | 47 | ||
288 | 49 | int i = allGraphs.indexOf(" + "); | 48 | int i = allGraphs.indexOf(" + "); |
289 | 50 | while (i > -1) { | 49 | while (i > -1) { |
290 | 51 | allGraphs = allGraphs.substring(0, i) + "\n" + allGraphs.substring(i + 2); | 50 | allGraphs = allGraphs.substring(0, i) + "\n" + allGraphs.substring(i + 2); |
291 | 52 | i = allGraphs.indexOf(" + "); | 51 | i = allGraphs.indexOf(" + "); |
292 | 53 | } | 52 | } |
293 | 53 | allGraphs = allGraphs + "\n"; | ||
294 | 54 | allGraphs = allGraphs.replaceAll(" -> ", " "); | 54 | allGraphs = allGraphs.replaceAll(" -> ", " "); |
295 | 55 | 55 | ||
302 | 56 | while (allGraphs.contains("\n")) { | 56 | String[] graphList = allGraphs.split("\n"); |
297 | 57 | int index = allGraphs.indexOf("\n"); | ||
298 | 58 | String graph = (allGraphs.substring(0, index)); | ||
299 | 59 | allGraphs = allGraphs.substring(index + 1); | ||
300 | 60 | tempGraphs.add(graph); | ||
301 | 61 | } | ||
303 | 62 | 57 | ||
305 | 63 | //tempGraphs.add(allGraphs); | 58 | for (String g : graphList) tempGraphs.add(g); |
306 | 64 | 59 | ||
307 | 65 | for (String graph : tempGraphs) { | 60 | for (String graph : tempGraphs) { |
308 | 66 | int index = graph.indexOf("= "); | 61 | int index = graph.indexOf("= "); |
309 | 67 | if (index >= 0) { | 62 | if (index >= 0) { |
310 | 68 | graph = graph.substring(index + 2); | 63 | graph = graph.substring(index + 2); |
318 | 69 | } | 64 | } else { |
319 | 70 | while (graph.startsWith(" ")) { | 65 | JOptionPane.showMessageDialog(null, |
320 | 71 | graph = graph.substring(1); | 66 | "Error: A graph which is not a scenario has been selected.\n" |
321 | 72 | } | 67 | + "Please remove this from the selection, or group this as a page to continue", |
322 | 73 | while (graph.endsWith(" ")) { | 68 | "Error", |
323 | 74 | graph = graph.substring(0, graph.length() - 1); | 69 | JOptionPane.ERROR_MESSAGE); |
324 | 75 | } | 70 | return null; |
325 | 71 | } | ||
326 | 72 | graph = graph.trim(); | ||
327 | 76 | graphs.add(graph); | 73 | graphs.add(graph); |
328 | 77 | } | 74 | } |
329 | 78 | 75 | ||
330 | 76 | PrintStream expressions = new PrintStream(inputFile); | ||
331 | 77 | |||
332 | 79 | for (String graph : graphs) { | 78 | for (String graph : graphs) { |
333 | 80 | expressions.println(graph); | 79 | expressions.println(graph); |
334 | 81 | } | 80 | } |
335 | 82 | 81 | ||
336 | 83 | expressions.close(); | 82 | expressions.close(); |
337 | 84 | 83 | ||
338 | 85 | |||
339 | 86 | } catch (IOException exception) { | 84 | } catch (IOException exception) { |
340 | 87 | exception.printStackTrace(); | 85 | exception.printStackTrace(); |
341 | 88 | } catch (ArrayIndexOutOfBoundsException e2) { | 86 | } catch (ArrayIndexOutOfBoundsException e2) { |
342 | 89 | JOptionPane.showMessageDialog(null, | 87 | JOptionPane.showMessageDialog(null, |
344 | 90 | "Error: No graphs have been selected", | 88 | "Error: No scenarios have been selected", |
345 | 91 | "Error", | 89 | "Error", |
346 | 92 | JOptionPane.ERROR_MESSAGE); | 90 | JOptionPane.ERROR_MESSAGE); |
347 | 93 | throw e2; | 91 | throw e2; |
348 | @@ -102,6 +100,7 @@ | |||
349 | 102 | try { | 100 | try { |
350 | 103 | 101 | ||
351 | 104 | File inputFile = getInputFile(we); | 102 | File inputFile = getInputFile(we); |
352 | 103 | if (inputFile == null) return; | ||
353 | 105 | PGMinerTask task = new PGMinerTask(inputFile, false); | 104 | PGMinerTask task = new PGMinerTask(inputFile, false); |
354 | 106 | 105 | ||
355 | 107 | final Framework framework = Framework.getInstance(); | 106 | final Framework framework = Framework.getInstance(); |