]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - cms/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/editors/ProcessEditorInput.java
Clarify SLC project structure.
[gpl/argeo-slc.git] / cms / org.argeo.slc.client.ui / src / org / argeo / slc / client / ui / editors / ProcessEditorInput.java
diff --git a/cms/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/editors/ProcessEditorInput.java b/cms/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/editors/ProcessEditorInput.java
new file mode 100644 (file)
index 0000000..f93af3f
--- /dev/null
@@ -0,0 +1,87 @@
+package org.argeo.slc.client.ui.editors;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IPersistableElement;
+
+public class ProcessEditorInput implements IEditorInput, IPersistableElement {
+       private String processPath;
+       private List<String> initialFlowPaths = new ArrayList<String>();
+       private Boolean launchImmediately = false;
+
+       /** New empty process */
+       public ProcessEditorInput() {
+       }
+
+       /** New process with some flows */
+       public ProcessEditorInput(List<String> initialFlowPaths,
+                       Boolean launchImmediately) {
+               this.initialFlowPaths = initialFlowPaths;
+               this.launchImmediately = launchImmediately;
+       }
+
+       /** Existing process */
+       public ProcessEditorInput(String processPath) {
+               this.processPath = processPath;
+       }
+
+       @SuppressWarnings("rawtypes")
+       public Object getAdapter(Class arg0) {
+               return null;
+       }
+
+       public boolean exists() {
+               return processPath != null;
+       }
+
+       public ImageDescriptor getImageDescriptor() {
+               return null;
+       }
+
+       public String getName() {
+               return processPath != null ? processPath : "<new process>";
+       }
+
+       public IPersistableElement getPersistable() {
+               return this;
+       }
+
+       public String getToolTipText() {
+               return "";
+       }
+
+       public void saveState(IMemento memento) {
+               memento.putString("processPath", processPath);
+       }
+
+       public String getFactoryId() {
+               return ProcessEditorInputFactory.ID;
+       }
+
+       public String getProcessPath() {
+               return processPath;
+       }
+
+       public List<String> getInitialFlowPaths() {
+               return initialFlowPaths;
+       }
+
+       public Boolean getLaunchImmediately() {
+               return launchImmediately;
+       }
+
+       @Override
+       public boolean equals(Object obj) {
+               if (!(obj instanceof ProcessEditorInput))
+                       return false;
+               ProcessEditorInput pei = (ProcessEditorInput) obj;
+               if (processPath != null && pei.processPath != null)
+                       return processPath.equals(pei.processPath);
+               return false;
+       }
+
+}