@Override protected Boolean doInBackground() throws Exception { pm.beginTask("Processing Graph...", 100 * graphExecuterList.size()); try { executeStartTime = Calendar.getInstance().getTime(); isProcessing = true; for (GraphExecuter graphEx : graphExecuterList) { final String desc = graphEx.getGraphDescription(); if (desc != null && !desc.isEmpty()) statusLabel.setText("Processing " + graphEx.getGraphDescription()); graphEx.InitGraph(); graphEx.executeGraph(SubProgressMonitor.create(pm, 100)); graphEx.disposeGraphContext(); } } catch (Exception e) { System.out.print(e.getMessage()); if (e.getMessage() != null && !e.getMessage().isEmpty()) statusLabel.setText(e.getMessage()); else statusLabel.setText(e.toString()); errorOccured = true; } finally { isProcessing = false; pm.done(); if (SnapApp.getDefault().getPreferences().getBoolean(GPF.BEEP_AFTER_PROCESSING_PROPERTY, false)) { Toolkit.getDefaultToolkit().beep(); } } return true; }
/** * For running graphs in unit tests * * @throws Exception when failing validation */ public void testRunGraph() throws Exception { ioPanel.initProducts(); initGraphs(); if (ValidateAllNodes()) { for (GraphExecuter graphEx : graphExecuterList) { final String desc = graphEx.getGraphDescription(); if (desc != null && !desc.isEmpty()) System.out.println("Processing " + graphEx.getGraphDescription()); graphEx.InitGraph(); graphEx.executeGraph(ProgressMonitor.NULL); graphEx.disposeGraphContext(); } cleanUpTempFiles(); } else { throw new OperatorException(statusLabel.getText()); } }
/** * Call description dialog */ private void OnInfo() { final PromptDialog dlg = new PromptDialog("Graph Description", "Description", graphEx.getGraphDescription(), PromptDialog.TYPE.TEXTAREA); dlg.show(); if (dlg.IsOK()) { try { graphEx.setGraphDescription(dlg.getValue("Description")); } catch (Exception ex) { Dialogs.showError(ex.getMessage()); } } }