Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2005-05-16 13:20:51 +0000
committerMichael Valenta2005-05-16 13:20:51 +0000
commit9ff82cd3965f8c07cb4182b4a131fd21ed520d60 (patch)
tree238008c5b6ad79b8dbcc9c352054c7f1d185623d
parentd9f449af80f43e327999882a989e5af29c7f600c (diff)
downloadeclipse.platform.team-9ff82cd3965f8c07cb4182b4a131fd21ed520d60.tar.gz
eclipse.platform.team-9ff82cd3965f8c07cb4182b4a131fd21ed520d60.tar.xz
eclipse.platform.team-9ff82cd3965f8c07cb4182b4a131fd21ed520d60.zip
Bug 94812 CVS main menu items not enabled for working set
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java48
1 files changed, 30 insertions, 18 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
index 9ecbe99ec..55e87c9d8 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
@@ -406,26 +406,22 @@ public class Utils {
isResource = true;
}
} else if (element instanceof ResourceMapping) {
- try {
- ResourceTraversal[] traversals = ((ResourceMapping)element).getTraversals(ResourceMappingContext.LOCAL_CONTEXT, null);
- for (int k = 0; k < traversals.length; k++) {
- ResourceTraversal traversal = traversals[k];
- IResource[] resourceArray = traversal.getResources();
- for (int j = 0; j < resourceArray.length; j++) {
- IResource resource = resourceArray[j];
- resources.add(resource);
- isResource = true;
- }
- }
- } catch (CoreException e) {
- TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 0, "Error traversing resource mapping", e)); //$NON-NLS-1$
- }
+ isResource = true;
+ getResources((ResourceMapping)element, resources);
} else {
- IResource resource = (IResource)getAdapter(element, IResource.class);
- if(resource != null) {
- if (resource.getType() == IResource.ROOT) continue;
- resources.add(resource);
+ Object adapted = getAdapter(element, IResource.class);
+ if (adapted instanceof IResource) {
+ IResource resource = (IResource) adapted;
isResource = true;
+ if (resource.getType() != IResource.ROOT) {
+ resources.add(resource);
+ }
+ } else {
+ adapted = getAdapter(element, ResourceMapping.class);
+ if (adapted instanceof ResourceMapping) {
+ isResource = true;
+ getResources((ResourceMapping) adapted, resources);
+ }
}
}
if (!isResource) {
@@ -435,6 +431,22 @@ public class Utils {
}
return (IResource[]) resources.toArray(new IResource[resources.size()]);
}
+
+ private static void getResources(ResourceMapping element, List resources) {
+ try {
+ ResourceTraversal[] traversals = element.getTraversals(ResourceMappingContext.LOCAL_CONTEXT, null);
+ for (int k = 0; k < traversals.length; k++) {
+ ResourceTraversal traversal = traversals[k];
+ IResource[] resourceArray = traversal.getResources();
+ for (int j = 0; j < resourceArray.length; j++) {
+ IResource resource = resourceArray[j];
+ resources.add(resource);
+ }
+ }
+ } catch (CoreException e) {
+ TeamUIPlugin.log(new Status(IStatus.ERROR, TeamUIPlugin.ID, 0, "Error traversing resource mapping", e)); //$NON-NLS-1$
+ }
+ }
public static Object[] getNonResources(Object[] elements) {
List nonResources = new ArrayList();

Back to the top