Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Macguire2002-05-02 23:07:53 +0000
committerKevin Macguire2002-05-02 23:07:53 +0000
commitca68ae7749b0e1d1bc3dc0af56dceaa460b7fc0a (patch)
treeb0586eb0fe96a6caf3914b4323af791196c24693
parent89b15315791c3216d34f78ea0a3a86e9b0870cd8 (diff)
downloadeclipse.platform.team-ca68ae7749b0e1d1bc3dc0af56dceaa460b7fc0a.tar.gz
eclipse.platform.team-ca68ae7749b0e1d1bc3dc0af56dceaa460b7fc0a.tar.xz
eclipse.platform.team-ca68ae7749b0e1d1bc3dc0af56dceaa460b7fc0a.zip
14001: internal classes referenced from CVSDecorator
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java88
1 files changed, 41 insertions, 47 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java
index 21deb2627..e461ea8d9 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java
@@ -43,9 +43,9 @@ import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.ui.internal.DecoratorDefinition;
-import org.eclipse.ui.internal.DecoratorManager;
+
import org.eclipse.ui.internal.WorkbenchPlugin;
+import org.eclipse.ui.IDecoratorManager;
/**
* Classes registered with the workbench decoration extension point. The <code>CVSDecorationRunnable</code> class
@@ -74,7 +74,7 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
private Thread decoratorUpdateThread;
private boolean shutdown = false;
-
+
private OverlayIconCache iconCache = new OverlayIconCache();
// Keep track of deconfigured projects
@@ -94,6 +94,44 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
}
}
+ /*
+ * Return the CVSDecorator instance that is currently enabled.
+ * Return null if we don't have a decorator or its not enabled.
+ */
+ private static CVSDecorator getActiveCVSDecorator() {
+ IDecoratorManager manager = CVSUIPlugin.getPlugin().getWorkbench().getDecoratorManager();
+ if (manager.getEnabled(CVSUIPlugin.DECORATOR_ID))
+ return (CVSDecorator) manager.getLabelDecorator(CVSUIPlugin.DECORATOR_ID);
+ return null;
+ }
+
+ /*
+ * Blanket refresh the displaying of our decorator.
+ */
+ public static void refresh() {
+ CVSDecorator activeDecorator = getActiveCVSDecorator();
+
+ if(activeDecorator == null)
+ return; //nothing to do, our decorator isn't active
+ activeDecorator.clearCache(); //clear the cache of previous decorations so we can compute them anew
+
+ //update all displaying of our decorator;
+ activeDecorator.fireLabelProviderChanged(new LabelProviderChangedEvent(activeDecorator));
+ }
+
+ /*
+ * Answers null if a provider does not exist or the provider is not a CVS provider. These resources
+ * will be ignored by the decorator.
+ */
+ private static CVSTeamProvider getCVSProviderFor(IResource resource) {
+ RepositoryProvider p = RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
+ if (p == null) {
+ return null;
+ }
+ return (CVSTeamProvider) p;
+ }
+
+
public CVSDecorator() {
// thread that calculates the decoration for a resource
decoratorUpdateThread = new Thread(new CVSDecorationRunnable(this), "CVS"); //$NON-NLS-1$
@@ -278,42 +316,10 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
}
}
- /*
- * Return the ILabelDecorator for our CVS decorator, null if its not active.
- */
- private static ILabelDecorator findCVSDecorator() {
- DecoratorManager decoratorManager = WorkbenchPlugin.getDefault().getDecoratorManager();
- DecoratorDefinition[] definitions = decoratorManager.getDecoratorDefinitions();
- for (int i = 0; i < definitions.length; i++) {
- DecoratorDefinition decoratorDefinition = definitions[i];
- if(decoratorDefinition.getId().equals(CVSUIPlugin.DECORATOR_ID))
- try {
- return decoratorDefinition.getDecorator();
- } catch (CoreException e) {
- CVSUIPlugin.log(e.getStatus()); //todo: need to inform user too
- return null;
- }
- }
- return null;
- }
-
private void clearCache() {
cache.clear();
}
- /*
- * Blanket refresh the displaying of our decorator.
- */
-
- public static void refresh() {
- CVSDecorator cvsDecorator = (CVSDecorator) findCVSDecorator();
- if(cvsDecorator == null)
- return; //nothing to do, our decorator isn't active
- cvsDecorator.clearCache(); //clear the cache of previous decorations so we can compute them anew
-
- WorkbenchPlugin.getDefault().getDecoratorManager().reset();
- }
-
public void refresh(IProject project) {
final List resources = new ArrayList();
try {
@@ -352,18 +358,6 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
}
}
- /**
- * Answers null if a provider does not exist or the provider is not a CVS provider. These resources
- * will be ignored by the decorator.
- */
- private static CVSTeamProvider getCVSProviderFor(IResource resource) {
- RepositoryProvider p = RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
- if (p == null) {
- return null;
- }
- return (CVSTeamProvider) p;
- }
-
/**
* Returns the resource for the given input object, or
* null if there is no resource associated with it.

Back to the top