1 11 package org.eclipse.team.internal.ccvs.ui.model; 12 13 14 import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation; 15 import org.eclipse.team.internal.ccvs.ui.CVSUIMessages; 16 import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants; 17 import org.eclipse.ui.views.properties.IPropertyDescriptor; 18 import org.eclipse.ui.views.properties.IPropertySource; 19 import org.eclipse.ui.views.properties.PropertyDescriptor; 20 21 public class CVSRepositoryLocationPropertySource implements IPropertySource { 22 ICVSRepositoryLocation location; 23 24 static protected IPropertyDescriptor[] propertyDescriptors = new IPropertyDescriptor[5]; 26 { 27 PropertyDescriptor descriptor; 28 String category = CVSUIMessages.cvs; 29 30 descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_HOST, CVSUIMessages.CVSRepositoryLocationPropertySource_host); 32 descriptor.setAlwaysIncompatible(true); 33 descriptor.setCategory(category); 34 propertyDescriptors[0] = descriptor; 35 descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_USER, CVSUIMessages.CVSRepositoryLocationPropertySource_user); 37 descriptor.setAlwaysIncompatible(true); 38 descriptor.setCategory(category); 39 propertyDescriptors[1] = descriptor; 40 descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_PORT, CVSUIMessages.CVSRepositoryLocationPropertySource_port); 42 descriptor.setAlwaysIncompatible(true); 43 descriptor.setCategory(category); 44 propertyDescriptors[2] = descriptor; 45 descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_ROOT, CVSUIMessages.CVSRepositoryLocationPropertySource_root); 47 descriptor.setAlwaysIncompatible(true); 48 descriptor.setCategory(category); 49 propertyDescriptors[3] = descriptor; 50 descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_METHOD, CVSUIMessages.CVSRepositoryLocationPropertySource_method); 52 descriptor.setAlwaysIncompatible(true); 53 descriptor.setCategory(category); 54 propertyDescriptors[4] = descriptor; 55 } 56 57 60 public CVSRepositoryLocationPropertySource(ICVSRepositoryLocation location) { 61 this.location = location; 62 } 63 64 67 public Object getEditableValue() { 68 return this; 69 } 70 71 74 public IPropertyDescriptor[] getPropertyDescriptors() { 75 return propertyDescriptors; 76 } 77 78 81 public Object getPropertyValue(Object id) { 82 if (id.equals(ICVSUIConstants.PROP_HOST)) { 83 return location.getHost(); 84 } 85 if (id.equals(ICVSUIConstants.PROP_USER)) { 86 return location.getUsername(); 87 } 88 if (id.equals(ICVSUIConstants.PROP_METHOD)) { 89 return location.getMethod().getName(); 90 } 91 if (id.equals(ICVSUIConstants.PROP_ROOT)) { 92 return location.getRootDirectory(); 93 } 94 if (id.equals(ICVSUIConstants.PROP_PORT)) { 95 int port = location.getPort(); 96 if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) { 97 return CVSUIMessages.CVSRepositoryLocationPropertySource_default; 98 } 99 return "" + port; } 101 return ""; } 103 104 108 public boolean isPropertySet(Object property) { 109 return false; 110 } 111 117 public void resetPropertyValue(Object property) { 118 } 119 122 public void setPropertyValue(Object name, Object value) { 123 } 124 } 125 | Popular Tags |