diff options
author | Michael Valenta | 2004-04-28 02:19:51 +0000 |
---|---|---|
committer | Michael Valenta | 2004-04-28 02:19:51 +0000 |
commit | eed3c421d43827454a4404862471945bfa27b214 (patch) | |
tree | 8c91bcbb8f7e4bfd3c40dad2960db4ae6379e25a | |
parent | 395f7f435b95423bef4770b3c53f08e6c1546994 (diff) | |
download | eclipse.platform.team-eed3c421d43827454a4404862471945bfa27b214.tar.gz eclipse.platform.team-eed3c421d43827454a4404862471945bfa27b214.tar.xz eclipse.platform.team-eed3c421d43827454a4404862471945bfa27b214.zip |
*** empty log message ***
4 files changed, 118 insertions, 0 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.properties b/bundles/org.eclipse.team.cvs.ui/plugin.properties index e6e5b2fcc..b91404c95 100644 --- a/bundles/org.eclipse.team.cvs.ui/plugin.properties +++ b/bundles/org.eclipse.team.cvs.ui/plugin.properties @@ -196,6 +196,9 @@ CVSWorkspaceSubscriber.confirmMerged.tooltip=Mark the conflict as merged by upgr CVSWorkspaceSubscriber.merge.label=&Update CVSWorkspaceSubscriber.merge.tooltip=Perform an update merge on the visible resources +RefreshDirtyStateAction.label=Update C&lean +RefreshDirtyStateAction.tooltip=Reset the dirty state of out-of-sync files whose contents match the server contents + CVSCompareSubscriber.revert.label=&Override and Update CVSCompareSubscriber.revert.tooltip=Revert the local file contents to match that of their corresponding remotes diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml index 67efd50db..41c01f221 100644 --- a/bundles/org.eclipse.team.cvs.ui/plugin.xml +++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml @@ -698,6 +698,14 @@ menubarPath="SubscriberActionsGroup3" id="org.eclipse.team.ccvs.ui.ignore"> </action> + <action + label="%RefreshDirtyStateAction.label" + helpContextId="org.eclipse.team.cvs.ui.workspace_subscriber_refresh_dirty_state_action_context" + tooltip="%RefreshDirtyStateAction.tooltip" + class="org.eclipse.team.internal.ccvs.ui.subscriber.RefreshDirtyStateAction" + menubarPath="SubscriberActionsGroup4" + id="org.eclipse.team.ccvs.ui.ignore"> + </action> </viewerContribution> <viewerContribution targetID="org.eclipse.team.cvs.ui.cvsmerge-participant" diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateAction.java new file mode 100644 index 000000000..74b6effef --- /dev/null +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateAction.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.team.internal.ccvs.ui.subscriber; + +import org.eclipse.compare.structuremergeviewer.IDiffElement; +import org.eclipse.team.core.synchronize.FastSyncInfoFilter; +import org.eclipse.team.core.synchronize.SyncInfo; +import org.eclipse.team.core.synchronize.FastSyncInfoFilter.*; +import org.eclipse.team.ui.synchronize.SynchronizeModelAction; +import org.eclipse.team.ui.synchronize.SynchronizeModelOperation; +import org.eclipse.ui.IWorkbenchPart; + +/** + * Resets the dirty state of files whose contents match their base. + */ +public class RefreshDirtyStateAction extends SynchronizeModelAction { + + /* (non-Javadoc) + * @see org.eclipse.team.ui.sync.SubscriberAction#getSyncInfoFilter() + */ + protected FastSyncInfoFilter getSyncInfoFilter() { + // Only interested in outgoing changes + return new AndSyncInfoFilter(new FastSyncInfoFilter[] { + new SyncInfoDirectionFilter(new int[] {SyncInfo.OUTGOING, SyncInfo.CONFLICTING }), + new SyncInfoChangeTypeFilter(SyncInfo.CHANGE) + }); + } + + /* (non-Javadoc) + * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSubscriberOperation(org.eclipse.ui.IWorkbenchPart, org.eclipse.compare.structuremergeviewer.IDiffElement[]) + */ + protected SynchronizeModelOperation getSubscriberOperation( + IWorkbenchPart part, IDiffElement[] elements) { + return new RefreshDirtyStateOperation(part, elements); + } +} diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateOperation.java new file mode 100644 index 000000000..90c971875 --- /dev/null +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateOperation.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.team.internal.ccvs.ui.subscriber; + +import org.eclipse.compare.structuremergeviewer.IDiffElement; +import org.eclipse.core.resources.*; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.team.core.TeamException; +import org.eclipse.team.core.synchronize.*; +import org.eclipse.team.core.synchronize.SyncInfoFilter.ContentComparisonSyncInfoFilter; +import org.eclipse.team.internal.ccvs.core.*; +import org.eclipse.team.internal.ccvs.core.ICVSFile; +import org.eclipse.team.internal.ccvs.core.ICVSFolder; +import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; +import org.eclipse.team.internal.ccvs.ui.Policy; +import org.eclipse.ui.IWorkbenchPart; + +/** + * Resets the dirty state of files whose contents match their base. + */ +public class RefreshDirtyStateOperation extends CVSSubscriberOperation { + + protected RefreshDirtyStateOperation(IWorkbenchPart part, IDiffElement[] elements) { + super(part, elements); + } + + /* (non-Javadoc) + * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#run(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor) + */ + protected void run(SyncInfoSet set, IProgressMonitor monitor) throws TeamException { + // TODO Fetch the contents in a single connection + final ContentComparisonSyncInfoFilter comparator = new SyncInfoFilter.ContentComparisonSyncInfoFilter(false); + final SyncInfo[] infos = set.getSyncInfos(); + if (infos.length == 0) return; + IProject project = infos[0].getLocal().getProject(); + ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project); + folder.run(new ICVSRunnable() { + public void run(IProgressMonitor monitor) throws CVSException { + monitor.beginTask(null, infos.length * 100); + for (int i = 0; i < infos.length; i++) { + SyncInfo info = infos[i]; + IResource resource = info.getLocal(); + if (resource.getType() == IResource.FILE) { + if (comparator.compareContents((IFile)resource, info.getBase(), Policy.subMonitorFor(monitor, 100))) { + ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)resource); + cvsFile.checkedIn(null); + } + } + } + monitor.done(); + } + }, monitor); + + } +} |