/** * Get the singleton WorkflowChanges instance. * * @return The WorkflowChanges instance. */ public static WorkflowChanges getInstance() { if (instance == null) { instance = new WorkflowChanges(); } return instance; }
/** * Mark the workflow as synchronized by saving to given file. * Concurrent calls to hasChanged() will return false until * the workflow model is changed. Calls to lastFilename() will * return the given file unless the workflow is later syncedWithFile() * with some other file. * * @param workflow ScuflModel that has been synchronized * @param file File where the workflow has been stored */ public void syncedWithFile(ScuflModel workflow, File file) { filenames.put(workflow, file); synced(workflow); }
if (urlConnection.getURL().getProtocol().equals("file")) { File file = new File(urlConnection.getURL().getPath()); WorkflowChanges.getInstance().syncedWithFile(model, file); } else { WorkflowChanges.getInstance().synced(model);
if (!workflowChanges.hasChanged(model)) { return true;
/** * Unregister as listener with ScuflModelSet and known ScuflModels */ public void destroy() { ScuflModelSet.getInstance().removeListener(registerListener); reset(); }
workflowChanges.syncedWithFile(model, file);
fc.resetChoosableFileFilters(); fc.setFileFilter(new ExtensionFileFilter(new String[] { extension })); File lastSavedAs = workflowChanges.lastFilename(model); if (lastSavedAs != null) {
if (workflowChanges.hasChanged(model)) {
public void modelAdded(final ScuflModel workflow) { ChangedModelListener listener = new ChangedModelListener(workflow); listeners.put(workflow, listener); workflow.addListener(listener); synced(workflow); // initially unchanged }