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
.dist
.editors
;
18 import org
.argeo
.slc
.SlcException
;
19 import org
.argeo
.slc
.SlcNames
;
20 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
21 import org
.eclipse
.ui
.IEditorInput
;
22 import org
.eclipse
.ui
.IPersistableElement
;
24 /** An editor input pointing to a distribution workspace */
25 public class DistWkspEditorInput
implements IEditorInput
, SlcNames
{
28 // private RepositoryFactory repositoryFactory;
29 // private Keyring keyring;
30 // private Node repoNode;
31 private String repoNodePath
;
35 private String workspaceName
;
37 // public WorkspaceEditorInput(RepositoryFactory repositoryFactory,
38 // Keyring keyring, Repository localRepository, Node repoNode,
40 // // this.repositoryFactory = repositoryFactory;
41 // // this.keyring = keyring;
42 // this.localRepository = localRepository;
43 // // this.repoNode= repoNode;
48 /** uri and workspace name cannot be null */
49 public DistWkspEditorInput(String repoNodePath
, String uri
,
50 String workspaceName
) {
51 if (workspaceName
== null)
52 throw new SlcException("Workspace name cannot be null");
54 throw new SlcException("URI for repository cannot be null");
55 this.repoNodePath
= repoNodePath
;
56 this.workspaceName
= workspaceName
;
60 public Object
getAdapter(@SuppressWarnings("rawtypes") Class adapter
) {
64 public boolean exists() {
68 public ImageDescriptor
getImageDescriptor() {
72 // Dummy compulsory methods
73 public String
getToolTipText() {
74 return "Editor for workspace " + workspaceName
75 + " in repository of URI " + uri
;
78 public String
getName() {
79 return workspaceName
+ "@" + uri
;
82 public IPersistableElement
getPersistable() {
86 public boolean equals(Object obj
) {
91 if (!(obj
instanceof DistWkspEditorInput
))
94 DistWkspEditorInput other
= (DistWkspEditorInput
) obj
;
96 if (!workspaceName
.equals(other
.getWorkspaceName()))
98 if (!uri
.equals(other
.getUri()))
101 if (repoNodePath
== null)
102 return other
.getRepoNodePath() == null;
104 return repoNodePath
.equals(other
.getRepoNodePath());
107 public String
getUri() {
111 public String
getWorkspaceName() {
112 return workspaceName
;
115 public String
getRepoNodePath() {