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
.jcr
.SlcNames
;
20 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
21 import org
.eclipse
.ui
.IEditorInput
;
22 import org
.eclipse
.ui
.IPersistableElement
;
25 * An editor input pointing to a distribution workspace
27 public class WorkspaceEditorInput
implements IEditorInput
, SlcNames
{
30 // private RepositoryFactory repositoryFactory;
31 // private Keyring keyring;
32 // private Node repoNode;
33 private String repoNodePath
;
37 private String workspaceName
;
39 // public WorkspaceEditorInput(RepositoryFactory repositoryFactory,
40 // Keyring keyring, Repository localRepository, Node repoNode,
42 // // this.repositoryFactory = repositoryFactory;
43 // // this.keyring = keyring;
44 // this.localRepository = localRepository;
45 // // this.repoNode= repoNode;
50 /** uri and workspace name cannot be null */
51 public WorkspaceEditorInput(String repoNodePath
, String uri
,
52 String workspaceName
) {
53 if (workspaceName
== null)
54 throw new SlcException("Workspace name cannot be null");
56 throw new SlcException("URI for repository cannot be null");
57 this.repoNodePath
= repoNodePath
;
58 this.workspaceName
= workspaceName
;
62 public Object
getAdapter(@SuppressWarnings("rawtypes") Class adapter
) {
66 public boolean exists() {
70 public ImageDescriptor
getImageDescriptor() {
74 // Dummy compulsory methods
75 public String
getToolTipText() {
76 return "Editor for workspace " + workspaceName
77 + " in repository of URI " + uri
;
80 public String
getName() {
81 return workspaceName
+ "@" + uri
;
84 public IPersistableElement
getPersistable() {
88 public boolean equals(Object obj
) {
93 if (!(obj
instanceof WorkspaceEditorInput
))
96 WorkspaceEditorInput other
= (WorkspaceEditorInput
) obj
;
98 if (!workspaceName
.equals(other
.getWorkspaceName()))
100 if (!uri
.equals(other
.getUri()))
103 if (repoNodePath
== null)
104 return other
.getRepoNodePath() == null;
106 return repoNodePath
.equals(other
.getRepoNodePath());
109 public String
getUri() {
113 public String
getWorkspaceName() {
114 return workspaceName
;
117 public String
getRepoNodePath() {