]> git.argeo.org Git - gpl/argeo-slc.git/blob - eclipse/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/DistributionEditorInput.java
Clear workspace instead of deleting it
[gpl/argeo-slc.git] / eclipse / plugins / org.argeo.slc.client.ui.dist / src / main / java / org / argeo / slc / client / ui / dist / editors / DistributionEditorInput.java
1 /*
2 * Copyright (C) 2007-2012 Mathieu Baudier
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16 package org.argeo.slc.client.ui.dist.editors;
17
18 import javax.jcr.Repository;
19
20 import org.argeo.slc.jcr.SlcNames;
21 import org.eclipse.jface.resource.ImageDescriptor;
22 import org.eclipse.ui.IEditorInput;
23 import org.eclipse.ui.IPersistableElement;
24
25 /**
26 * An editor input pointing to a distribution
27 * */
28 public class DistributionEditorInput implements IEditorInput, SlcNames {
29
30 private Repository repository;
31 private String workspaceName;
32 private String artifactsBase = "/";
33
34 public DistributionEditorInput(Repository repository, String workspaceName,
35 String artifactsBase) {
36 super();
37 this.repository = repository;
38 this.workspaceName = workspaceName;
39 this.artifactsBase = artifactsBase;
40 }
41
42 public DistributionEditorInput(Repository repository, String workspaceName) {
43 this(repository, workspaceName, "/");
44 }
45
46 public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
47 return null;
48 }
49
50 public boolean exists() {
51 return true;
52 }
53
54 public ImageDescriptor getImageDescriptor() {
55 return null;
56 }
57
58 // Dummy compulsory methods
59 public String getToolTipText() {
60 return workspaceName;
61 }
62
63 public String getName() {
64 return workspaceName;
65 }
66
67 public IPersistableElement getPersistable() {
68 return null;
69 }
70
71 public boolean equals(Object obj) {
72 if (this == obj)
73 return true;
74 if (obj == null)
75 return false;
76 if (!(obj instanceof DistributionEditorInput))
77 return false;
78
79 DistributionEditorInput other = (DistributionEditorInput) obj;
80 return getRepository().equals(other.getRepository())
81 && getWorkspaceName().equals(other.getWorkspaceName());
82 }
83
84 public Repository getRepository() {
85 return repository;
86 }
87
88 public String getWorkspaceName() {
89 return workspaceName;
90 }
91
92 public String getArtifactsBase() {
93 return artifactsBase;
94 }
95
96 }