KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > ui > model > CVSRemoteFolderPropertySource


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.team.internal.ccvs.ui.model;
12
13
14 import org.eclipse.team.internal.ccvs.core.CVSTag;
15 import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
16 import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
17 import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
18 import org.eclipse.ui.views.properties.IPropertyDescriptor;
19 import org.eclipse.ui.views.properties.IPropertySource;
20 import org.eclipse.ui.views.properties.PropertyDescriptor;
21
22 public class CVSRemoteFolderPropertySource implements IPropertySource {
23     ICVSRemoteFolder folder;
24     
25     // Property Descriptors
26
static protected IPropertyDescriptor[] propertyDescriptors = new IPropertyDescriptor[2];
27     {
28         PropertyDescriptor descriptor;
29         String JavaDoc category = CVSUIMessages.cvs;
30         
31         // resource name
32
descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_NAME, CVSUIMessages.CVSRemoteFolderPropertySource_name);
33         descriptor.setAlwaysIncompatible(true);
34         descriptor.setCategory(category);
35         propertyDescriptors[0] = descriptor;
36         // tag
37
descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_TAG, CVSUIMessages.CVSRemoteFolderPropertySource_tag);
38         descriptor.setAlwaysIncompatible(true);
39         descriptor.setCategory(category);
40         propertyDescriptors[1] = descriptor;
41     }
42
43     /**
44      * Create a PropertySource and store its file
45      */

46     public CVSRemoteFolderPropertySource(ICVSRemoteFolder folder) {
47         this.folder = folder;
48     }
49     
50     /**
51      * Do nothing because properties are read only.
52      */

53     public Object JavaDoc getEditableValue() {
54         return this;
55     }
56
57     /**
58      * Return the Property Descriptors for the receiver.
59      */

60     public IPropertyDescriptor[] getPropertyDescriptors() {
61         return propertyDescriptors;
62     }
63
64     /*
65      * @see IPropertySource#getPropertyValue(Object)
66      */

67     public Object JavaDoc getPropertyValue(Object JavaDoc id) {
68         if (id.equals(ICVSUIConstants.PROP_NAME)) {
69             return folder.getName();
70         }
71         if (id.equals(ICVSUIConstants.PROP_TAG)) {
72             CVSTag tag = folder.getTag();
73             if (tag == null) {
74                 return CVSUIMessages.CVSRemoteFolderPropertySource_none;
75             }
76             return tag.getName();
77         }
78         return ""; //$NON-NLS-1$
79
}
80
81     /**
82      * Answer true if the value of the specified property
83      * for this object has been changed from the default.
84      */

85     public boolean isPropertySet(Object JavaDoc property) {
86         return false;
87     }
88     /**
89      * Reset the specified property's value to its default value.
90      * Do nothing because properties are read only.
91      *
92      * @param property The property to reset.
93      */

94     public void resetPropertyValue(Object JavaDoc property) {
95     }
96     /**
97      * Do nothing because properties are read only.
98      */

99     public void setPropertyValue(Object JavaDoc name, Object JavaDoc value) {
100     }
101 }
102
Popular Tags