]> git.argeo.org Git - gpl/argeo-slc.git/blob - plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/DistributionEditorInput.java
+ Add repo informations
[gpl/argeo-slc.git] / plugins / org.argeo.slc.client.ui.dist / src / main / java / org / argeo / slc / client / ui / dist / editors / DistributionEditorInput.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16 package org.argeo.slc.client.ui.dist.editors;
17
18 import javax.jcr.Credentials;
19 import javax.jcr.Repository;
20
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;
26
27 /**
28 * An editor input pointing to a distribution
29 * */
30 public class DistributionEditorInput implements IEditorInput, SlcNames {
31
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;
38
39 public DistributionEditorInput(String repositoryName,
40 String repositoryDescription, Repository repository,
41 String workspaceName, String artifactsBase, Credentials credentials) {
42 super();
43 this.repository = repository;
44 this.repositoryName = repositoryName;
45 this.repositoryDescription = repositoryDescription;
46 this.workspaceName = workspaceName;
47 this.artifactsBase = artifactsBase;
48 this.credentials = credentials;
49 }
50
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);
56 }
57
58 public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
59 return null;
60 }
61
62 public boolean exists() {
63 return true;
64 }
65
66 public ImageDescriptor getImageDescriptor() {
67 return null;
68 }
69
70 // Dummy compulsory methods
71 public String getToolTipText() {
72 return workspaceName;
73 }
74
75 public String getName() {
76 return workspaceName;
77 }
78
79 public IPersistableElement getPersistable() {
80 return null;
81 }
82
83 public boolean equals(Object obj) {
84 if (this == obj)
85 return true;
86 if (obj == null)
87 return false;
88 if (!(obj instanceof DistributionEditorInput))
89 return false;
90
91 DistributionEditorInput other = (DistributionEditorInput) obj;
92 return getRepository().equals(other.getRepository())
93 && getWorkspaceName().equals(other.getWorkspaceName());
94 }
95
96 public Repository getRepository() {
97 return repository;
98 }
99
100 public String getWorkspaceName() {
101 return workspaceName;
102 }
103
104 public String getArtifactsBase() {
105 return artifactsBase;
106 }
107
108 public String getRepositoryName() {
109 return repositoryName;
110 }
111
112 public String getRepositoryDescription() {
113 return repositoryDescription;
114 }
115
116 public Credentials getCredentials() {
117 return credentials;
118 }
119 }