2 * Copyright (C) 2007-2012 Argeo GmbH
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.slc
.client
.ui
.editors
;
18 import java
.util
.ArrayList
;
19 import java
.util
.List
;
21 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
22 import org
.eclipse
.ui
.IEditorInput
;
23 import org
.eclipse
.ui
.IMemento
;
24 import org
.eclipse
.ui
.IPersistableElement
;
26 public class ProcessEditorInput
implements IEditorInput
, IPersistableElement
{
27 private String processPath
;
28 private List
<String
> initialFlowPaths
= new ArrayList
<String
>();
29 private Boolean launchImmediately
= false;
31 /** New empty process */
32 public ProcessEditorInput() {
35 /** New process with some flows */
36 public ProcessEditorInput(List
<String
> initialFlowPaths
,
37 Boolean launchImmediately
) {
38 this.initialFlowPaths
= initialFlowPaths
;
39 this.launchImmediately
= launchImmediately
;
42 /** Existing process */
43 public ProcessEditorInput(String processPath
) {
44 this.processPath
= processPath
;
47 @SuppressWarnings("rawtypes")
48 public Object
getAdapter(Class arg0
) {
52 public boolean exists() {
53 return processPath
!= null;
56 public ImageDescriptor
getImageDescriptor() {
60 public String
getName() {
61 return processPath
!= null ? processPath
: "<new process>";
64 public IPersistableElement
getPersistable() {
68 public String
getToolTipText() {
72 public void saveState(IMemento memento
) {
73 memento
.putString("processPath", processPath
);
76 public String
getFactoryId() {
77 return ProcessEditorInputFactory
.ID
;
80 public String
getProcessPath() {
84 public List
<String
> getInitialFlowPaths() {
85 return initialFlowPaths
;
88 public Boolean
getLaunchImmediately() {
89 return launchImmediately
;
93 public boolean equals(Object obj
) {
94 if (!(obj
instanceof ProcessEditorInput
))
96 ProcessEditorInput pei
= (ProcessEditorInput
) obj
;
97 if (processPath
!= null && pei
.processPath
!= null)
98 return processPath
.equals(pei
.processPath
);