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 javax
.jcr
.Credentials
;
19 import javax
.jcr
.Repository
;
21 import org
.argeo
.slc
.jcr
.SlcNames
;
22 import org
.argeo
.slc
.repo
.RepoConstants
;
23 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
24 import org
.eclipse
.ui
.IEditorInput
;
25 import org
.eclipse
.ui
.IPersistableElement
;
28 * An editor input pointing to a distribution
30 public class DistributionEditorInput
implements IEditorInput
, SlcNames
{
32 private String repositoryName
;
33 private String repositoryDescription
;
34 private Repository repository
;
35 private String workspaceName
;
36 private String artifactsBase
= RepoConstants
.DEFAULT_ARTIFACTS_BASE_PATH
;
37 private Credentials credentials
;
39 public DistributionEditorInput(String repositoryName
,
40 String repositoryDescription
, Repository repository
,
41 String workspaceName
, String artifactsBase
, Credentials credentials
) {
43 this.repository
= repository
;
44 this.repositoryName
= repositoryName
;
45 this.repositoryDescription
= repositoryDescription
;
46 this.workspaceName
= workspaceName
;
47 this.artifactsBase
= artifactsBase
;
48 this.credentials
= credentials
;
51 public DistributionEditorInput(String repositoryName
,
52 String repositoryDescription
, Repository repository
,
53 String workspaceName
, Credentials credentials
) {
54 this(repositoryName
, repositoryDescription
, repository
, workspaceName
,
55 RepoConstants
.DEFAULT_ARTIFACTS_BASE_PATH
, credentials
);
58 public Object
getAdapter(@SuppressWarnings("rawtypes") Class adapter
) {
62 public boolean exists() {
66 public ImageDescriptor
getImageDescriptor() {
70 // Dummy compulsory methods
71 public String
getToolTipText() {
75 public String
getName() {
79 public IPersistableElement
getPersistable() {
83 public boolean equals(Object obj
) {
88 if (!(obj
instanceof DistributionEditorInput
))
91 DistributionEditorInput other
= (DistributionEditorInput
) obj
;
92 return getRepository().equals(other
.getRepository())
93 && getWorkspaceName().equals(other
.getWorkspaceName());
96 public Repository
getRepository() {
100 public String
getWorkspaceName() {
101 return workspaceName
;
104 public String
getArtifactsBase() {
105 return artifactsBase
;
108 public String
getRepositoryName() {
109 return repositoryName
;
112 public String
getRepositoryDescription() {
113 return repositoryDescription
;
116 public Credentials
getCredentials() {