Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjames2002-05-14 11:37:08 -0400
committerjames2002-05-14 11:37:08 -0400
commit99da372fbe98709694ec2d6b689b1efc72dfda69 (patch)
tree542018d48690605f95b203caccf7e2d6e795ca91 /bundles/org.eclipse.team.cvs.ui
parent02bd76fd9a0873761739f45d5161f39a3806983c (diff)
downloadeclipse.platform.team-99da372fbe98709694ec2d6b689b1efc72dfda69.tar.gz
eclipse.platform.team-99da372fbe98709694ec2d6b689b1efc72dfda69.tar.xz
eclipse.platform.team-99da372fbe98709694ec2d6b689b1efc72dfda69.zip
Fix enablement for sync actions
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.java9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncOutgoingAction.java42
2 files changed, 10 insertions, 41 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 23d44dbdc..1799c7864 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
@@ -12,6 +12,7 @@ import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
+import org.eclipse.team.internal.ui.sync.SyncCompareInput;
import org.eclipse.team.internal.ui.sync.SyncView;
import org.eclipse.ui.PartInitException;
@@ -31,8 +32,7 @@ public class SyncAction extends CVSAction {
} catch (PartInitException e) {
CVSUIPlugin.log(e.getStatus());
}
- // What happens when resources from the same project are selected?
- view.showSync(new CVSSyncCompareInput(resources));
+ view.showSync(getCompareInput(resources));
}
}
protected boolean isEnabled() throws TeamException {
@@ -45,9 +45,12 @@ public class SyncAction extends CVSAction {
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
if (!cvsResource.isManaged()) {
// The resource is not managed. See if its parent is managed.
- if (!cvsResource.getParent().isManaged()) return false;
+ if (!cvsResource.getParent().isCVSFolder()) return false;
}
}
return true;
}
+ protected SyncCompareInput getCompareInput(IResource[] resources) {
+ return new CVSSyncCompareInput(resources);
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncOutgoingAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncOutgoingAction.java
index 9a3bd0d1f..7e67071b0 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncOutgoingAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncOutgoingAction.java
@@ -6,48 +6,14 @@ package org.eclipse.team.internal.ccvs.ui.actions;
*/
import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
-import org.eclipse.team.internal.ui.sync.SyncView;
-import org.eclipse.ui.PartInitException;
+import org.eclipse.team.internal.ui.sync.SyncCompareInput;
/**
* Action for catchup/release in popup menus.
*/
-public class SyncOutgoingAction extends CVSAction {
- public void execute(IAction action) {
- IResource[] resources = getSelectedResources();
- SyncView view = (SyncView)CVSUIPlugin.getActivePage().findView(SyncView.VIEW_ID);
- if (view == null) {
- view = SyncView.findInActivePerspective();
- }
- if (view != null) {
- try {
- CVSUIPlugin.getActivePage().showView(SyncView.VIEW_ID);
- } catch (PartInitException e) {
- CVSUIPlugin.log(e.getStatus());
- }
- // What happens when resources from the same project are selected?
- view.showSync(new CVSSyncCompareInput(resources, true));
- }
- }
- protected boolean isEnabled() throws TeamException {
- IResource[] resources = getSelectedResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (!resource.isAccessible()) return false;
- if( resource.getType() == IResource.PROJECT) continue;
- // If the resource is not managed and its parent is not managed, disable.
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (!cvsResource.isManaged()) {
- // The resource is not managed. See if its parent is managed.
- if (!cvsResource.getParent().isManaged()) return false;
- }
- }
- return true;
+public class SyncOutgoingAction extends SyncAction {
+ protected SyncCompareInput getCompareInput(IResource[] resources) {
+ return new CVSSyncCompareInput(resources, true);
}
}

Back to the top