Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2005-05-17 17:41:48 +0000
committerMichael Valenta2005-05-17 17:41:48 +0000
commit6fe04041d8ff82d769cc9aab01aed12815cc9ecf (patch)
tree64f74d016af72bf442f2272fe975443dae6b841f
parentcf715431baa6a21c7d4e2c9376f144f82aeedf37 (diff)
downloadeclipse.platform.team-6fe04041d8ff82d769cc9aab01aed12815cc9ecf.tar.gz
eclipse.platform.team-6fe04041d8ff82d769cc9aab01aed12815cc9ecf.tar.xz
eclipse.platform.team-6fe04041d8ff82d769cc9aab01aed12815cc9ecf.zip
Bug 95568 M7: CVS commands in menu do not work but context menu does
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.properties3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml14
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSActionSelectionProperties.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java24
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java50
8 files changed, 62 insertions, 49 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.properties b/bundles/org.eclipse.team.cvs.ui/plugin.properties
index 4d388d4bb..4e41421a2 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.properties
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.properties
@@ -236,3 +236,6 @@ IgnoredResourceBackgroundColor.label=Ignored Resource (Background)
PreferenceKeywords.CVS=CVS Team
PreferenceKeywords.EXT=CVS Team ext connection method ssh
PreferenceKeywords.Console=CVS team console color
+
+RepoPreference.Name=CVS Repositories
+RepoPreference.Description=Preferences that contain the CVS repository connection information
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index 87917ec04..f16a69528 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -1332,5 +1332,19 @@
</wizard>
</extension>
+ <extension
+ point="org.eclipse.ui.preferenceTransfer">
+ <transfer
+ id="org.eclipse.cvs.ui.transfer.repos"
+ icon="\icons\full\obj16\repository_rep.gif"
+ name="%RepoPreference.Name">
+ <mapping scope="instance">
+ <entry node="org.eclipse.team.cvs.core/repositories"/>
+ </mapping>
+ <description>
+ %RepoPreference.Description
+ </description>
+ </transfer>
+ </extension>
</plugin>
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
index 8b7b2b6f8..fb16522be 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
@@ -581,7 +581,7 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
protected final IResource[] getSelectedResourcesWithOverlap() {
CVSActionSelectionProperties props = CVSActionSelectionProperties.getProperties(getSelection());
if (props == null) {
- return Utils.getResources(selection.toArray());
+ return Utils.getContributedResources(selection.toArray());
}
return props.getAllSelectedResources();
}
@@ -593,7 +593,7 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
if (selection == null) return new IResource[0];
CVSActionSelectionProperties props = CVSActionSelectionProperties.getProperties(getSelection());
if (props == null) {
- return CVSActionSelectionProperties.getNonOverlapping(Utils.getResources(selection.toArray()));
+ return CVSActionSelectionProperties.getNonOverlapping(Utils.getContributedResources(selection.toArray()));
}
return props.getNonoverlappingSelectedResources();
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSActionSelectionProperties.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSActionSelectionProperties.java
index b603df97f..5d3432e2e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSActionSelectionProperties.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSActionSelectionProperties.java
@@ -63,11 +63,21 @@ public class CVSActionSelectionProperties {
public IResource[] getAllSelectedResources() {
IResource[] resources = (IResource[])get(SELECTED_RESOURCES);
if (resources == null) {
- resources = Utils.getResources(selection.toArray());
+ resources = getResources(selection.toArray());
put(SELECTED_RESOURCES, resources);
}
return resources;
}
+
+ /*
+ * This method gets the resources from the given objects.
+ * It does so in a manner that is consistent with how the workbench does it.
+ * Tha is, it first uses IContributionResourceAdapter, then IResource,
+ * then ResourceMapping.
+ */
+ private IResource[] getResources(Object[] objects) {
+ return Utils.getContributedResources(objects);
+ }
public IResource[] getNonoverlappingSelectedResources() {
IResource[] resources = (IResource[])get(NONOVERLAPPING_SELECTED_RESOURCES);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java
index eccc81c3f..715d5303b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java
@@ -93,7 +93,7 @@ public class ShowAnnotationAction extends WorkspaceAction {
}
// Selected from a History Viewer
- final Object[] logEntries = getSelectedResources(LogEntry.class);
+ final Object[] logEntries = getAdaptedSelection(LogEntry.class);
if (logEntries.length == 1) {
final LogEntry aLogEntry = (LogEntry) logEntries[0];
final ICVSRemoteFile cvsRemoteFile = aLogEntry.getRemoteFile();
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 b09e8dcb1..d125bec80 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
@@ -958,7 +958,7 @@ SharingWizardSyncPage_8=Errors Occurred
SharingWizardSyncPage_9=The following errors occurred.
SharingWizardSyncPage_12=Launch the &Commit wizard
ShareProjectOperation_1=Calculating synchronization states
-ShareProjectOperation_1=Mapping project {0} to {1}
+ShareProjectOperation_3=Mapping project {0} to {1}
ShareProjectOperation_2=Preparing folder {0} for sharing
CVSProjectPropertiesPage_31=Show only compatible repository locations
CVSProjectPropertiesPage_32=Confirm
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 55e87c9d8..68d050d9e 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
@@ -41,6 +41,7 @@ import org.eclipse.team.ui.TeamImages;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.*;
+import org.eclipse.ui.internal.LegacyResourceSupport;
import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
public class Utils {
@@ -391,7 +392,7 @@ public class Utils {
* @param elements
* @return the list of resources contained in the given elements.
*/
- private static IResource[] getResources(Object[] elements, List nonResources) {
+ private static IResource[] getResources(Object[] elements, List nonResources, boolean isContributed) {
List resources = new ArrayList();
for (int i = 0; i < elements.length; i++) {
Object element = elements[i];
@@ -409,7 +410,12 @@ public class Utils {
isResource = true;
getResources((ResourceMapping)element, resources);
} else {
- Object adapted = getAdapter(element, IResource.class);
+ Object adapted;
+ if (isContributed) {
+ adapted = LegacyResourceSupport.getAdaptedResource(element);
+ } else {
+ adapted = getAdapter(element, IResource.class);
+ }
if (adapted instanceof IResource) {
IResource resource = (IResource) adapted;
isResource = true;
@@ -417,7 +423,11 @@ public class Utils {
resources.add(resource);
}
} else {
- adapted = getAdapter(element, ResourceMapping.class);
+ if (isContributed) {
+ adapted = LegacyResourceSupport.getAdaptedContributorResourceMapping(element);
+ } else {
+ adapted = getAdapter(element, ResourceMapping.class);
+ }
if (adapted instanceof ResourceMapping) {
isResource = true;
getResources((ResourceMapping) adapted, resources);
@@ -450,13 +460,17 @@ public class Utils {
public static Object[] getNonResources(Object[] elements) {
List nonResources = new ArrayList();
- getResources(elements, nonResources);
+ getResources(elements, nonResources, false);
return nonResources.toArray();
}
public static IResource[] getResources(Object[] element) {
- return getResources(element, null);
+ return getResources(element, null, false);
}
+
+ public static IResource[] getContributedResources(Object[] elements) {
+ return getResources(elements, null, true);
+ }
public static Object getAdapter(Object element, Class adapter) {
if (element instanceof IAdaptable) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
index 555b6a313..873d44c5d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
@@ -33,6 +33,7 @@ import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.ui.*;
import org.eclipse.ui.actions.ActionDelegate;
+import org.eclipse.ui.internal.LegacyResourceSupport;
/**
* The abstract superclass of all Team actions. This class contains some convenience
@@ -140,7 +141,7 @@ public abstract class TeamAction extends ActionDelegate implements IObjectAction
* @param c
* @return
*/
- protected Object[] getSelectedResources(Class c) {
+ protected Object[] getAdaptedSelection(Class c) {
return getSelectedAdaptables(selection, c);
}
@@ -150,7 +151,7 @@ public abstract class TeamAction extends ActionDelegate implements IObjectAction
* @return the selected resources
*/
protected IResource[] getSelectedResources() {
- return (IResource[])getSelectedResources(IResource.class);
+ return Utils.getContributedResources(selection.toArray());
}
protected IStructuredSelection getSelection() {
@@ -164,12 +165,16 @@ public abstract class TeamAction extends ActionDelegate implements IObjectAction
* @return the resource mappings that contain resources associated with the given provider
*/
protected ResourceMapping[] getSelectedResourceMappings(String providerId) {
- Object[] elements = getSelectedAdaptables(selection, ResourceMapping.class);
+ Object[] elements = selection.toArray();
ArrayList providerMappings = new ArrayList();
for (int i = 0; i < elements.length; i++) {
- ResourceMapping element = (ResourceMapping) elements[i];
- if (providerId == null || isMappedToProvider(element, providerId)) {
- providerMappings.add(element);
+ Object object = elements[i];
+ Object adapted = LegacyResourceSupport.getAdaptedContributorResourceMapping(object);
+ if (adapted instanceof ResourceMapping) {
+ ResourceMapping mapping = (ResourceMapping) adapted;
+ if (providerId == null || isMappedToProvider(mapping, providerId)) {
+ providerMappings.add(mapping);
+ }
}
}
return (ResourceMapping[]) providerMappings.toArray(new ResourceMapping[providerMappings.size()]);
@@ -186,39 +191,6 @@ public abstract class TeamAction extends ActionDelegate implements IObjectAction
}
return false;
}
-
- /**
- * Returns the selected resource based on the available traversals.
- *
- * @return the selected resources based on the available traversals.
- */
- public ResourceTraversal[] getSelectedTraversals(ResourceMappingContext context, String providerId) throws TeamException {
- try {
- Object[] elements = getSelectedAdaptables(selection, ResourceMapping.class);
- ArrayList providerTraversals = new ArrayList();
- if(elements.length > 0) {
- for (int i = 0; i < elements.length; i++) {
- ResourceMapping element = (ResourceMapping) elements[i];
- boolean addIt = true;
- if(providerId != null) {
- IProject[] projects = element.getProjects();
- for (int k = 0; k < projects.length; k++) {
- IProject project = projects[k];
- RepositoryProvider provider = RepositoryProvider.getProvider(project);
- addIt = (providerId != null && provider.getID().equals(providerId));
- }
- }
- if(addIt) {
- ResourceTraversal[] traversals = element.getTraversals(context, null);
- providerTraversals.addAll(Arrays.asList(traversals));
- }
- }
- }
- return (ResourceTraversal[]) providerTraversals.toArray(new ResourceTraversal[providerTraversals.size()]);
- } catch (CoreException e) {
- throw TeamException.asTeamException(e);
- }
- }
/**
* Convenience method for getting the current shell.

Back to the top