private void handleAction() { ScuflModel model = processor.getInternalModelForEditing(); ScuflModelSet.getInstance().addModel(model); }
/** * Private constructor, use singleton pattern getInstance() instead. * <p> * Register as a listener with the ScuflModelSet. * @param workbench TODO */ private WorkflowChanges() { ScuflModelSet.getInstance().addListener(registerListener); }
/** * Unregister as listener with ScuflModelSet and known ScuflModels */ public void destroy() { ScuflModelSet.getInstance().removeListener(registerListener); reset(); }
private void createWorkflow() { ScuflModel model = new ScuflModel(); workflowModels.addModel(model); }
private void setModelSetListener() { ScuflModelSetListener listener = new ScuflModelSetListener() { public void modelAdded(ScuflModel model) { modelmap.setModel(ModelMap.CURRENT_WORKFLOW, model); menuBar.refreshWorkflowsMenu(); } public void modelRemoved(ScuflModel model) { if (model == modelmap.getNamedModel(ModelMap.CURRENT_WORKFLOW)) { // Need to find some other current workflow modelmap.setModel(ModelMap.CURRENT_WORKFLOW, null); try { ScuflModel firstmodel = workflowModels.getModels() .iterator().next(); modelmap .setModel(ModelMap.CURRENT_WORKFLOW, firstmodel); } catch (NoSuchElementException ex) { // No more models, make a new empty one createWorkflow(); return; } } menuBar.refreshWorkflowsMenu(); } }; workflowModels.addListener(listener); }
public void modelRemoved(ScuflModel model) { if (model == modelmap.getNamedModel(ModelMap.CURRENT_WORKFLOW)) { // Need to find some other current workflow modelmap.setModel(ModelMap.CURRENT_WORKFLOW, null); try { ScuflModel firstmodel = workflowModels.getModels() .iterator().next(); modelmap .setModel(ModelMap.CURRENT_WORKFLOW, firstmodel); } catch (NoSuchElementException ex) { // No more models, make a new empty one createWorkflow(); return; } } menuBar.refreshWorkflowsMenu(); } };
/** * Close the given workflow. * * @param model * Workflow to close * @return true if the workflow was closed, false if anything went wrong or * the operation was cancelled. */ public boolean closeWorkflow(ScuflModel model) { if (safeToClose(model)) { workflowModels.removeModel(model); model.removeListeners(); return true; } return false; }
for (ScuflModel model : workflowModels.getModels()) {
ScuflModelSet.getInstance().addModel(model); if (urlConnection.getURL().getProtocol().equals("file")) { File file = new File(urlConnection.getURL().getPath());
private JMenu makeWorkflows() { JMenu menu = new JMenu("Workflows"); ButtonGroup group = new ButtonGroup(); for (final ScuflModel model : workflowModels.getModels()) { Action selectModel = new AbstractAction() { public void actionPerformed(ActionEvent e) {