Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java')
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java34
1 files changed, 32 insertions, 2 deletions
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;
}
}

Back to the top