Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjames2002-03-04 14:03:13 -0500
committerjames2002-03-04 14:03:13 -0500
commite2ea534d83afefb4dae225cf0b738f4b4aae1b7d (patch)
tree475b3edaa141d8791e3f4fb29813a594525ae6b2
parent4c2891a56cd4052994bb07dffa7971703116ca4f (diff)
downloadeclipse.platform.team-e2ea534d83afefb4dae225cf0b738f4b4aae1b7d.tar.gz
eclipse.platform.team-e2ea534d83afefb4dae225cf0b738f4b4aae1b7d.tar.xz
eclipse.platform.team-e2ea534d83afefb4dae225cf0b738f4b4aae1b7d.zip
10617: Missing properties sheet contribution for remote resources
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java17
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties19
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java34
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java146
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFolderPropertySource.java95
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryLocationPropertySource.java120
6 files changed, 429 insertions, 2 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
index 7f286b5a0..871f0b60e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
@@ -60,5 +60,22 @@ public interface ICVSUIConstants {
public final String IMG_WIZBAN_SHARE = "wizban/newconnect_wizban.gif";
public final String IMG_WIZBAN_BRANCH = "wizban/newstream_wizban.gif";
public final String IMG_WIZBAN_MERGE = "wizban/mergestream_wizban.gif";
+
+ // Properties
+ public final String PROP_NAME = "cvs.name";
+ public final String PROP_REVISION = "cvs.revision";
+ public final String PROP_AUTHOR = "cvs.author";
+ public final String PROP_COMMENT = "cvs.comment";
+ public final String PROP_DATE = "cvs.date";
+ public final String PROP_DIRTY = "cvs.dirty";
+ public final String PROP_MODIFIED = "cvs.modified";
+ public final String PROP_KEYWORD = "cvs.date";
+ public final String PROP_TAG = "cvs.tag";
+ public final String PROP_PERMISSIONS = "cvs.permissions";
+ public final String PROP_HOST = "cvs.host";
+ public final String PROP_USER = "cvs.user";
+ public final String PROP_METHOD = "cvs.method";
+ public final String PROP_PORT = "cvs.port";
+ public final String PROP_ROOT = "cvs.root";
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
index 6dd19eee1..793c32d43 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -10,6 +10,7 @@ confirmOverwrite=The project already exists in the workspace. Its contents will
question=Question
localChanges=You have local changes which you are about to overwrite. Do you wish to continue?
error=Error
+cvs=CVS
AddAction.add=Add
AddAction.adding=Adding...
@@ -110,6 +111,24 @@ CVSPreferencePage.reallyquiet=Very quiet
CVSPreferencePage.showModules=&Show modules from CVSROOT/modules in repository view
CVSPreferencePage.historyTracksSelection=Link &History view to current selection
+CVSRemoteFilePropertySource.name=Name
+CVSRemoteFilePropertySource.revision=Revision
+CVSRemoteFilePropertySource.date=Date
+CVSRemoteFilePropertySource.author=Author
+CVSRemoteFilePropertySource.comment=Comment
+CVSRemoteFilePropertySource.tag=Tag
+
+CVSRemoteFolderPropertySource.name=Name
+CVSRemoteFolderPropertySource.tag=Tag
+CVSRemoteFolderPropertySource.none=(none)
+
+CVSRepositoryLocationPropertySource.default=Default
+CVSRepositoryLocationPropertySource.host=Host
+CVSRepositoryLocationPropertySource.user=User
+CVSRepositoryLocationPropertySource.port=Port
+CVSRepositoryLocationPropertySource.root=Root
+CVSRepositoryLocationPropertySource.method=Connection Method
+
CheckoutAsAction.checkout=Checkout
CheckoutAsAction.enterProjectTitle=Enter Project Name
CheckoutAsAction.enterProject=Enter the name of the project to checkout as:
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java
index 07af074db..7f772b2b6 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java
@@ -1,21 +1,27 @@
package org.eclipse.team.internal.ccvs.ui.model;
/*
- * (c) Copyright IBM Corp. 2000, 2001.
+ * (c) Copyright IBM Corp. 2000, 2002.
* All Rights Reserved.
*/
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.team.ccvs.core.ICVSRemoteFile;
import org.eclipse.team.ccvs.core.ICVSRemoteFolder;
import org.eclipse.team.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.ui.model.IWorkbenchAdapter;
+import org.eclipse.ui.views.properties.IPropertySource;
public class CVSAdapterFactory implements IAdapterFactory {
private Object fileAdapter = new RemoteFileElement();
private Object folderAdapter = new RemoteFolderElement();
private Object rootAdapter = new CVSRepositoryRootElement();
+ // Property cache
+ private Object cachedPropertyObject = null;
+ private Object cachedPropertyValue = null;
+
/** (Non-javadoc)
* Method declared on IAdapterFactory.
*/
@@ -30,12 +36,36 @@ public class CVSAdapterFactory implements IAdapterFactory {
}
return null;
}
+ if (IPropertySource.class == adapterType) {
+ return getPropertySource(adaptableObject);
+ }
return null;
}
/** (Non-javadoc)
* Method declared on IAdapterFactory.
*/
public Class[] getAdapterList() {
- return new Class[] {IWorkbenchAdapter.class};
+ return new Class[] {IWorkbenchAdapter.class, IPropertySource.class};
+ }
+ /**
+ * Returns the property source for the given object. Caches
+ * the result because the property sheet is extremely inefficient,
+ * it asks for the source seven times in a row.
+ */
+ public Object getPropertySource(Object adaptableObject) {
+ if (adaptableObject == cachedPropertyObject) {
+ return cachedPropertyValue;
+ }
+ cachedPropertyObject = adaptableObject;
+ if (adaptableObject instanceof ICVSRemoteFile) {
+ cachedPropertyValue = new CVSRemoteFilePropertySource((ICVSRemoteFile)adaptableObject);
+ } else if (adaptableObject instanceof ICVSRemoteFolder) {
+ cachedPropertyValue = new CVSRemoteFolderPropertySource((ICVSRemoteFolder)adaptableObject);
+ } else if (adaptableObject instanceof ICVSRepositoryLocation) {
+ cachedPropertyValue = new CVSRepositoryLocationPropertySource((ICVSRepositoryLocation)adaptableObject);
+ } else {
+ cachedPropertyValue = null;
+ }
+ return cachedPropertyValue;
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java
new file mode 100644
index 000000000..228365ec9
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java
@@ -0,0 +1,146 @@
+package org.eclipse.team.internal.ccvs.ui.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.team.ccvs.core.CVSTag;
+import org.eclipse.team.ccvs.core.ICVSRemoteFile;
+import org.eclipse.team.ccvs.core.ILogEntry;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
+import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
+import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+public class CVSRemoteFilePropertySource implements IPropertySource {
+ ICVSRemoteFile file;
+ ILogEntry entry;
+ boolean initialized;
+
+ // Property Descriptors
+ static protected IPropertyDescriptor[] propertyDescriptors = new IPropertyDescriptor[5];
+ {
+ PropertyDescriptor descriptor;
+ String category = Policy.bind("cvs");
+
+ // resource name
+ descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_NAME, Policy.bind("CVSRemoteFilePropertySource.name"));
+ descriptor.setAlwaysIncompatible(true);
+ descriptor.setCategory(category);
+ propertyDescriptors[0] = descriptor;
+ // revision
+ descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_REVISION, Policy.bind("CVSRemoteFilePropertySource.revision"));
+ descriptor.setAlwaysIncompatible(true);
+ descriptor.setCategory(category);
+ propertyDescriptors[1] = descriptor;
+ // date
+ descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_DATE, Policy.bind("CVSRemoteFilePropertySource.date"));
+ descriptor.setAlwaysIncompatible(true);
+ descriptor.setCategory(category);
+ propertyDescriptors[2] = descriptor;
+ // author
+ descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_AUTHOR, Policy.bind("CVSRemoteFilePropertySource.author"));
+ descriptor.setAlwaysIncompatible(true);
+ descriptor.setCategory(category);
+ propertyDescriptors[3] = descriptor;
+ // comment
+ descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_COMMENT, Policy.bind("CVSRemoteFilePropertySource.comment"));
+ descriptor.setAlwaysIncompatible(true);
+ descriptor.setCategory(category);
+ propertyDescriptors[4] = descriptor;
+ }
+
+ /**
+ * Create a PropertySource and store its file
+ */
+ public CVSRemoteFilePropertySource(ICVSRemoteFile file) {
+ this.file = file;
+ }
+
+ /**
+ * Do nothing because properties are read only.
+ */
+ public Object getEditableValue() {
+ return this;
+ }
+
+ /**
+ * Return the Property Descriptors for the receiver.
+ */
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ return propertyDescriptors;
+ }
+
+ /*
+ * @see IPropertySource#getPropertyValue(Object)
+ */
+ public Object getPropertyValue(Object id) {
+ if (!initialized) {
+ initialize();
+ initialized = true;
+ }
+ if (id.equals(ICVSUIConstants.PROP_NAME)) {
+ return file.getName();
+ }
+ if (id.equals(ICVSUIConstants.PROP_REVISION)) {
+ return entry.getRevision();
+ }
+ if (id.equals(ICVSUIConstants.PROP_DATE)) {
+ return entry.getDate();
+ }
+ if (id.equals(ICVSUIConstants.PROP_AUTHOR)) {
+ return entry.getAuthor();
+ }
+ if (id.equals(ICVSUIConstants.PROP_COMMENT)) {
+ return entry.getComment();
+ }
+ return "";
+ }
+
+ /**
+ * Answer true if the value of the specified property
+ * for this object has been changed from the default.
+ */
+ public boolean isPropertySet(Object property) {
+ return false;
+ }
+ /**
+ * Reset the specified property's value to its default value.
+ * Do nothing because properties are read only.
+ *
+ * @param property The property to reset.
+ */
+ public void resetPropertyValue(Object property) {
+ }
+ /**
+ * Do nothing because properties are read only.
+ */
+ public void setPropertyValue(Object name, Object value) {
+ }
+
+ private void initialize() {
+ BusyIndicator.showWhile(Display.getDefault(), new Runnable() {
+ public void run() {
+ try {
+ ILogEntry[] entries = file.getLogEntries(new NullProgressMonitor());
+ String revision = file.getRevision();
+ for (int i = 0; i < entries.length; i++) {
+ if (entries[i].getRevision().equals(revision)) {
+ entry = entries[i];
+ return;
+ }
+ }
+ } catch (TeamException e) {
+ CVSUIPlugin.log(e.getStatus());
+ }
+ }
+ });
+ }
+}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFolderPropertySource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFolderPropertySource.java
new file mode 100644
index 000000000..549fe4233
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFolderPropertySource.java
@@ -0,0 +1,95 @@
+package org.eclipse.team.internal.ccvs.ui.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.team.ccvs.core.CVSTag;
+import org.eclipse.team.ccvs.core.ICVSRemoteFolder;
+import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
+import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+public class CVSRemoteFolderPropertySource implements IPropertySource {
+ ICVSRemoteFolder folder;
+
+ // Property Descriptors
+ static protected IPropertyDescriptor[] propertyDescriptors = new IPropertyDescriptor[2];
+ {
+ PropertyDescriptor descriptor;
+ String category = Policy.bind("cvs");
+
+ // resource name
+ descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_NAME, Policy.bind("CVSRemoteFolderPropertySource.name"));
+ descriptor.setAlwaysIncompatible(true);
+ descriptor.setCategory(category);
+ propertyDescriptors[0] = descriptor;
+ // tag
+ descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_TAG, Policy.bind("CVSRemoteFolderPropertySource.tag"));
+ descriptor.setAlwaysIncompatible(true);
+ descriptor.setCategory(category);
+ propertyDescriptors[1] = descriptor;
+ }
+
+ /**
+ * Create a PropertySource and store its file
+ */
+ public CVSRemoteFolderPropertySource(ICVSRemoteFolder folder) {
+ this.folder = folder;
+ }
+
+ /**
+ * Do nothing because properties are read only.
+ */
+ public Object getEditableValue() {
+ return this;
+ }
+
+ /**
+ * Return the Property Descriptors for the receiver.
+ */
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ return propertyDescriptors;
+ }
+
+ /*
+ * @see IPropertySource#getPropertyValue(Object)
+ */
+ public Object getPropertyValue(Object id) {
+ if (id.equals(ICVSUIConstants.PROP_NAME)) {
+ return folder.getName();
+ }
+ if (id.equals(ICVSUIConstants.PROP_TAG)) {
+ CVSTag tag = folder.getTag();
+ if (tag == null) {
+ return Policy.bind("CVSRemoteFolderPropertySource.none");
+ }
+ return tag.getName();
+ }
+ return "";
+ }
+
+ /**
+ * Answer true if the value of the specified property
+ * for this object has been changed from the default.
+ */
+ public boolean isPropertySet(Object property) {
+ return false;
+ }
+ /**
+ * Reset the specified property's value to its default value.
+ * Do nothing because properties are read only.
+ *
+ * @param property The property to reset.
+ */
+ public void resetPropertyValue(Object property) {
+ }
+ /**
+ * Do nothing because properties are read only.
+ */
+ public void setPropertyValue(Object name, Object value) {
+ }
+}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryLocationPropertySource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryLocationPropertySource.java
new file mode 100644
index 000000000..47269a3c3
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryLocationPropertySource.java
@@ -0,0 +1,120 @@
+package org.eclipse.team.internal.ccvs.ui.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.team.ccvs.core.CVSTag;
+import org.eclipse.team.ccvs.core.ICVSRemoteFolder;
+import org.eclipse.team.ccvs.core.ICVSRepositoryLocation;
+import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
+import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+public class CVSRepositoryLocationPropertySource implements IPropertySource {
+ ICVSRepositoryLocation location;
+
+ // Property Descriptors
+ static protected IPropertyDescriptor[] propertyDescriptors = new IPropertyDescriptor[5];
+ {
+ PropertyDescriptor descriptor;
+ String category = Policy.bind("cvs");
+
+ // host
+ descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_HOST, Policy.bind("CVSRepositoryLocationPropertySource.host"));
+ descriptor.setAlwaysIncompatible(true);
+ descriptor.setCategory(category);
+ propertyDescriptors[0] = descriptor;
+ // user
+ descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_USER, Policy.bind("CVSRepositoryLocationPropertySource.user"));
+ descriptor.setAlwaysIncompatible(true);
+ descriptor.setCategory(category);
+ propertyDescriptors[1] = descriptor;
+ // port
+ descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_PORT, Policy.bind("CVSRepositoryLocationPropertySource.port"));
+ descriptor.setAlwaysIncompatible(true);
+ descriptor.setCategory(category);
+ propertyDescriptors[2] = descriptor;
+ // root
+ descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_ROOT, Policy.bind("CVSRepositoryLocationPropertySource.root"));
+ descriptor.setAlwaysIncompatible(true);
+ descriptor.setCategory(category);
+ propertyDescriptors[3] = descriptor;
+ // method
+ descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_METHOD, Policy.bind("CVSRepositoryLocationPropertySource.method"));
+ descriptor.setAlwaysIncompatible(true);
+ descriptor.setCategory(category);
+ propertyDescriptors[4] = descriptor;
+ }
+
+ /**
+ * Create a PropertySource and store its file
+ */
+ public CVSRepositoryLocationPropertySource(ICVSRepositoryLocation location) {
+ this.location = location;
+ }
+
+ /**
+ * Do nothing because properties are read only.
+ */
+ public Object getEditableValue() {
+ return this;
+ }
+
+ /**
+ * Return the Property Descriptors for the receiver.
+ */
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ return propertyDescriptors;
+ }
+
+ /*
+ * @see IPropertySource#getPropertyValue(Object)
+ */
+ public Object getPropertyValue(Object id) {
+ if (id.equals(ICVSUIConstants.PROP_HOST)) {
+ return location.getHost();
+ }
+ if (id.equals(ICVSUIConstants.PROP_USER)) {
+ return location.getUsername();
+ }
+ if (id.equals(ICVSUIConstants.PROP_METHOD)) {
+ return location.getMethod().getName();
+ }
+ if (id.equals(ICVSUIConstants.PROP_ROOT)) {
+ return location.getRootDirectory();
+ }
+ if (id.equals(ICVSUIConstants.PROP_PORT)) {
+ int port = location.getPort();
+ if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) {
+ return Policy.bind("CVSRepositoryLocationPropertySource.default");
+ }
+ return "" + port;
+ }
+ return "";
+ }
+
+ /**
+ * Answer true if the value of the specified property
+ * for this object has been changed from the default.
+ */
+ public boolean isPropertySet(Object property) {
+ return false;
+ }
+ /**
+ * Reset the specified property's value to its default value.
+ * Do nothing because properties are read only.
+ *
+ * @param property The property to reset.
+ */
+ public void resetPropertyValue(Object property) {
+ }
+ /**
+ * Do nothing because properties are read only.
+ */
+ public void setPropertyValue(Object name, Object value) {
+ }
+}

Back to the top