Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2007-05-14 19:18:48 +0000
committerMichael Valenta2007-05-14 19:18:48 +0000
commit9e29625ed87099dfad2eb66f5a08ed1c95853cb5 (patch)
treec1dcd4fe19cc35f07bd10d7049cbd57ff9dfb94c /bundles/org.eclipse.team.cvs.ui
parentf3b4b57d4766eebbfd36e311f011b3113f5c8cdd (diff)
downloadeclipse.platform.team-9e29625ed87099dfad2eb66f5a08ed1c95853cb5.tar.gz
eclipse.platform.team-9e29625ed87099dfad2eb66f5a08ed1c95853cb5.tar.xz
eclipse.platform.team-9e29625ed87099dfad2eb66f5a08ed1c95853cb5.zip
Bug 139775 [Team Actions] Team actions are not available on a mixed mode working setI20070514
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui')
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java54
1 files changed, 52 insertions, 2 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
index f4aab0028..bd9d81622 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
@@ -15,8 +15,7 @@ import java.util.*;
import org.eclipse.core.resources.*;
import org.eclipse.core.resources.mapping.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.*;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
@@ -230,4 +229,55 @@ public class SyncAction extends WorkspaceTraversalAction {
public String getId() {
return ICVSUIConstants.CMD_SYNCHRONIZE;
}
+
+
+ public boolean isEnabled() {
+ if(super.isEnabled()){
+ return true;
+ }
+ IWorkingSet[] sets = getSelectedWorkingSets();
+ // empty selection will not be considered
+ if(sets == null || sets.length == 0){
+ return false;
+ }
+
+ Set projects = getProjects(sets);
+
+ boolean existsProjectToSynchronize = false;
+ for (Iterator it = projects.iterator(); it.hasNext();) {
+ IProject project = (IProject) it.next();
+ RepositoryProvider provider = RepositoryProvider.getProvider(project);
+ if(provider != null){
+ existsProjectToSynchronize = true;
+ //we handle only CVS repositories
+ if(!CVSProviderPlugin.getTypeId().equals(provider.getID())){
+ return false;
+ }
+ }
+ }
+
+ return existsProjectToSynchronize;
+ }
+
+ private Set getProjects(IWorkingSet[] sets) {
+ Set projects = new HashSet();
+
+ if(sets == null)
+ return projects;
+
+ for (int i = 0; i < sets.length; i++) {
+ IAdaptable ad[] = sets[i].getElements();
+ if (ad != null) {
+ for (int j = 0; j < ad.length; j++) {
+ IResource resource = (IResource) ad[j]
+ .getAdapter(IResource.class);
+ if (resource != null) {
+ projects.add(resource.getProject());
+ }
+ }
+ }
+ }
+
+ return projects;
+ }
}

Back to the top