]> 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
work on fetch and normalization.
[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 Repository repository;
33 private Credentials credentials;
34 private String repositoryName;
35 private String repositoryDescription;
36 private String workspaceName;
37
38 private String artifactsBase;
39
40 public DistributionEditorInput(Repository repository,
41 Credentials credentials, String repositoryName,
42 String repositoryDescription, String workspaceName,
43 String artifactsBase) {
44 super();
45 this.repository = repository;
46 this.repositoryName = repositoryName;
47 this.repositoryDescription = repositoryDescription;
48 this.workspaceName = workspaceName;
49 this.artifactsBase = artifactsBase;
50 this.credentials = credentials;
51 }
52
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);
58 }
59
60 public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
61 return null;
62 }
63
64 public boolean exists() {
65 return true;
66 }
67
68 public ImageDescriptor getImageDescriptor() {
69 return null;
70 }
71
72 // Dummy compulsory methods
73 public String getToolTipText() {
74 return workspaceName;
75 }
76
77 public String getName() {
78 return workspaceName;
79 }
80
81 public IPersistableElement getPersistable() {
82 return null;
83 }
84
85 public boolean equals(Object obj) {
86 if (this == obj)
87 return true;
88 if (obj == null)
89 return false;
90 if (!(obj instanceof DistributionEditorInput))
91 return false;
92
93 DistributionEditorInput other = (DistributionEditorInput) obj;
94 return getRepository().equals(other.getRepository())
95 && getWorkspaceName().equals(other.getWorkspaceName());
96 }
97
98 public Repository getRepository() {
99 return repository;
100 }
101
102 public String getWorkspaceName() {
103 return workspaceName;
104 }
105
106 public String getArtifactsBase() {
107 return artifactsBase;
108 }
109
110 public String getRepositoryName() {
111 return repositoryName;
112 }
113
114 public String getRepositoryDescription() {
115 return repositoryDescription;
116 }
117
118 public Credentials getCredentials() {
119 return credentials;
120 }
121 }