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