2 * Copyright (C) 2007-2012 Mathieu Baudier
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 Repository repository
;
34 private String workspaceName
;
35 private String artifactsBase
= RepoConstants
.DEFAULT_ARTIFACTS_BASE_PATH
;
36 private Credentials credentials
;
38 public DistributionEditorInput(String repositoryName
,
39 Repository repository
, String workspaceName
, String artifactsBase
,
40 Credentials credentials
) {
42 this.repository
= repository
;
43 this.repositoryName
= repositoryName
;
44 this.workspaceName
= workspaceName
;
45 this.artifactsBase
= artifactsBase
;
46 this.credentials
= credentials
;
49 public DistributionEditorInput(String repositoryName
,
50 Repository repository
, String workspaceName
, Credentials credentials
) {
51 this(repositoryName
, repository
, workspaceName
,
52 RepoConstants
.DEFAULT_ARTIFACTS_BASE_PATH
, credentials
);
55 public Object
getAdapter(@SuppressWarnings("rawtypes") Class adapter
) {
59 public boolean exists() {
63 public ImageDescriptor
getImageDescriptor() {
67 // Dummy compulsory methods
68 public String
getToolTipText() {
72 public String
getName() {
76 public IPersistableElement
getPersistable() {
80 public boolean equals(Object obj
) {
85 if (!(obj
instanceof DistributionEditorInput
))
88 DistributionEditorInput other
= (DistributionEditorInput
) obj
;
89 return getRepository().equals(other
.getRepository())
90 && getWorkspaceName().equals(other
.getWorkspaceName());
93 public Repository
getRepository() {
97 public String
getWorkspaceName() {
101 public String
getArtifactsBase() {
102 return artifactsBase
;
105 public String
getRepositoryName() {
106 return repositoryName
;
109 public Credentials
getCredentials() {