]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.client.ui.dist/src/org/argeo/slc/client/ui/dist/editors/DistWkspEditorInput.java
Add cglib back
[gpl/argeo-slc.git] / org.argeo.slc.client.ui.dist / src / org / argeo / slc / client / ui / dist / editors / DistWkspEditorInput.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
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 org.argeo.slc.SlcException;
19 import org.argeo.slc.jcr.SlcNames;
20 import org.eclipse.jface.resource.ImageDescriptor;
21 import org.eclipse.ui.IEditorInput;
22 import org.eclipse.ui.IPersistableElement;
23
24 /**
25 * An editor input pointing to a distribution workspace
26 */
27 public class DistWkspEditorInput implements IEditorInput, SlcNames {
28
29 // Injected
30 // private RepositoryFactory repositoryFactory;
31 // private Keyring keyring;
32 // private Node repoNode;
33 private String repoNodePath;
34 private String uri;
35
36 // Local variables
37 private String workspaceName;
38
39 // public WorkspaceEditorInput(RepositoryFactory repositoryFactory,
40 // Keyring keyring, Repository localRepository, Node repoNode,
41 // String uri) {
42 // // this.repositoryFactory = repositoryFactory;
43 // // this.keyring = keyring;
44 // this.localRepository = localRepository;
45 // // this.repoNode= repoNode;
46 // this.uri = uri;
47 //
48 // }
49
50 /** uri and workspace name cannot be null */
51 public DistWkspEditorInput(String repoNodePath, String uri,
52 String workspaceName) {
53 if (workspaceName == null)
54 throw new SlcException("Workspace name cannot be null");
55 if (uri == null)
56 throw new SlcException("URI for repository cannot be null");
57 this.repoNodePath = repoNodePath;
58 this.workspaceName = workspaceName;
59 this.uri = uri;
60 }
61
62 public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
63 return null;
64 }
65
66 public boolean exists() {
67 return true;
68 }
69
70 public ImageDescriptor getImageDescriptor() {
71 return null;
72 }
73
74 // Dummy compulsory methods
75 public String getToolTipText() {
76 return "Editor for workspace " + workspaceName
77 + " in repository of URI " + uri;
78 }
79
80 public String getName() {
81 return workspaceName + "@" + uri;
82 }
83
84 public IPersistableElement getPersistable() {
85 return null;
86 }
87
88 public boolean equals(Object obj) {
89 if (this == obj)
90 return true;
91 if (obj == null)
92 return false;
93 if (!(obj instanceof DistWkspEditorInput))
94 return false;
95
96 DistWkspEditorInput other = (DistWkspEditorInput) obj;
97
98 if (!workspaceName.equals(other.getWorkspaceName()))
99 return false;
100 if (!uri.equals(other.getUri()))
101 return false;
102
103 if (repoNodePath == null)
104 return other.getRepoNodePath() == null;
105 else
106 return repoNodePath.equals(other.getRepoNodePath());
107 }
108
109 public String getUri() {
110 return uri;
111 }
112
113 public String getWorkspaceName() {
114 return workspaceName;
115 }
116
117 public String getRepoNodePath() {
118 return repoNodePath;
119 }
120 }