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 Repository repository
;
33 private Credentials credentials
;
34 private String repositoryName
;
35 private String repositoryDescription
;
36 private String workspaceName
;
38 private String artifactsBase
;
40 public DistributionEditorInput(Repository repository
,
41 Credentials credentials
, String repositoryName
,
42 String repositoryDescription
, String workspaceName
,
43 String artifactsBase
) {
45 this.repository
= repository
;
46 this.repositoryName
= repositoryName
;
47 this.repositoryDescription
= repositoryDescription
;
48 this.workspaceName
= workspaceName
;
49 this.artifactsBase
= artifactsBase
;
50 this.credentials
= credentials
;
53 public DistributionEditorInput(Repository repository
,
54 Credentials credentials
, String repositoryName
,
55 String repositoryDescription
, String workspaceName
) {
56 this(repository
, credentials
, repositoryName
, repositoryDescription
,
57 workspaceName
, RepoConstants
.DEFAULT_ARTIFACTS_BASE_PATH
);
60 public Object
getAdapter(@SuppressWarnings("rawtypes") Class adapter
) {
64 public boolean exists() {
68 public ImageDescriptor
getImageDescriptor() {
72 // Dummy compulsory methods
73 public String
getToolTipText() {
77 public String
getName() {
81 public IPersistableElement
getPersistable() {
85 public boolean equals(Object obj
) {
90 if (!(obj
instanceof DistributionEditorInput
))
93 DistributionEditorInput other
= (DistributionEditorInput
) obj
;
94 return getRepository().equals(other
.getRepository())
95 && getWorkspaceName().equals(other
.getWorkspaceName());
98 public Repository
getRepository() {
102 public String
getWorkspaceName() {
103 return workspaceName
;
106 public String
getArtifactsBase() {
107 return artifactsBase
;
110 public String
getRepositoryName() {
111 return repositoryName
;
114 public String
getRepositoryDescription() {
115 return repositoryDescription
;
118 public Credentials
getCredentials() {