Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-08-25 15:35:51 -0400
committerMichael Valenta2004-08-25 15:35:51 -0400
commitd2f99f0815fd811e165eefb897244ae4f901a4a2 (patch)
tree6ba0cf22aa5be3e81e617b9a2d0a19f860c9d57b
parentf7e2f5b01607768c56b73edd96a514955e2e83ef (diff)
downloadeclipse.platform.team-d2f99f0815fd811e165eefb897244ae4f901a4a2.tar.gz
eclipse.platform.team-d2f99f0815fd811e165eefb897244ae4f901a4a2.tar.xz
eclipse.platform.team-d2f99f0815fd811e165eefb897244ae4f901a4a2.zip
Bug 72304 Add to .cvsignore does not scale well
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java77
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties2
2 files changed, 63 insertions, 16 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java
index b149d8b0f..80dbe9fdc 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java
@@ -14,36 +14,81 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.IgnoreResourcesDialog;
import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation;
+import org.eclipse.ui.IWorkbenchPart;
public class IgnoreAction extends WorkspaceAction {
+
+ /**
+ * Define an operation that can be run in the background.
+ * We divide the ignores by provider to obtain project
+ * locks while modifying the .cvsignore files
+ */
+ class IgnoreOperation extends RepositoryProviderOperation {
+
+ private final IgnoreResourcesDialog dialog;
+
+ public IgnoreOperation(IWorkbenchPart part, IResource[] resources, IgnoreResourcesDialog dialog) {
+ super(part, resources);
+ this.dialog = dialog;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
+ */
+ protected String getTaskName(CVSTeamProvider provider) {
+ return Policy.bind("IgnoreAction.0", provider.getProject().getName()); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected void execute(CVSTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws CVSException, InterruptedException {
+ try {
+ monitor.beginTask(null, resources.length);
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ String pattern = dialog.getIgnorePatternFor(resource);
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ cvsResource.setIgnoredAs(pattern);
+ monitor.worked(1);
+ }
+ } catch (TeamException e) {
+ collectStatus(e.getStatus());
+ return;
+ } finally {
+ monitor.done();
+ }
+ collectStatus(Status.OK_STATUS);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
+ */
+ protected String getTaskName() {
+ return Policy.bind("IgnoreAction.1"); //$NON-NLS-1$
+ }
+
+ }
protected void execute(final IAction action) throws InvocationTargetException, InterruptedException {
- run(new WorkspaceModifyOperation(null) {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
+ run(new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
IResource[] resources = getSelectedResources();
IgnoreResourcesDialog dialog = new IgnoreResourcesDialog(getShell(), resources);
if (dialog.open() != IgnoreResourcesDialog.OK) return;
+ new IgnoreOperation(getTargetPart(), resources, dialog).run();
- try {
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- String pattern = dialog.getIgnorePatternFor(resource);
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- cvsResource.setIgnoredAs(pattern);
- }
- // fix the action enablement
- if (action != null) action.setEnabled(isEnabled());
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
+ //if (action != null) action.setEnabled(isEnabled());
}
}, false /* cancelable */, PROGRESS_BUSYCURSOR);
}
@@ -73,7 +118,7 @@ public class IgnoreAction extends WorkspaceAction {
*/
protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
if (super.isEnabledForCVSResource(cvsResource)) {
- // Perform an extra check against the subscriberto ensue there is no conflict
+ // Perform an extra check against the subscriber to ensure there is no conflict
CVSWorkspaceSubscriber subscriber = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
IResource resource = cvsResource.getIResource();
if (resource == null) return false;
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 4eec1dedd..a559896fa 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
@@ -1124,6 +1124,8 @@ BranchAction.label=&Branch...
BranchAction.tooltip=Branch
IgnoreAction.label=A&dd to .cvsignore...
+IgnoreAction.0=Ignoring selected resources for project {0}
+IgnoreAction.1=Ignoring Resources
IgnoreAction.tooltip=Ignore the Selected Resources when Synchronizing
ShowResourceInHistoryAction.label=Show in Resource &History

Back to the top