Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-03-04 12:30:37 -0500
committerMichael Valenta2004-03-04 12:30:37 -0500
commitd9269433d6e860d32de9befbef891b3b028a03f6 (patch)
treea35a46ad11419b33974d184ebe7cb785574608c9 /examples
parent8cfc475d0236c757df4d30d076813e3357a5b3c8 (diff)
downloadeclipse.platform.team-d9269433d6e860d32de9befbef891b3b028a03f6.tar.gz
eclipse.platform.team-d9269433d6e860d32de9befbef891b3b028a03f6.tar.xz
eclipse.platform.team-d9269433d6e860d32de9befbef891b3b028a03f6.zip
*** empty log message ***
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/PutAction.java4
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ReplaceAction.java66
2 files changed, 9 insertions, 61 deletions
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/PutAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/PutAction.java
index dde27b1a2..4c8c1577a 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/PutAction.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/PutAction.java
@@ -56,8 +56,8 @@ public class PutAction extends FileSystemAction {
}
/**
- * Indicate whether the put shoudl override incoming changes.
- * @return whether the put shoudl override incoming changes.
+ * Indicate whether the put should override incoming changes.
+ * @return whether the put should override incoming changes.
*/
protected boolean isOverrideIncoming() {
return false;
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ReplaceAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ReplaceAction.java
index b35b59eef..60a5620a5 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ReplaceAction.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ReplaceAction.java
@@ -10,68 +10,16 @@
*******************************************************************************/
package org.eclipse.team.examples.filesystem.ui;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.examples.filesystem.FileSystemProvider;
-import org.eclipse.team.examples.filesystem.FileSystemRemoteResource;
-import org.eclipse.team.examples.filesystem.Policy;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
/**
- * Action for replacing the contents of the selected resources with whatever is in the repository
+ * A replace is simply a get that overwrite local changes
*/
-public class ReplaceAction extends FileSystemAction {
+public class ReplaceAction extends GetAction {
- public void run(IAction action) {
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- Map table = getRepositoryProviderMapping();
- monitor.beginTask(null, table.size() * 1000);
- monitor.setTaskName(Policy.bind("ReplaceAction.working")); //$NON-NLS-1$
- for (Iterator iter = table.keySet().iterator(); iter.hasNext();) {
- IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
- FileSystemProvider provider = (FileSystemProvider) iter.next();
- List list = (List) table.get(provider);
- IResource[] providerResources = (IResource[]) list.toArray(new IResource[list.size()]);
- //Grab the remote counterparts of 'providerResources':
- FileSystemRemoteResource[] remote = new FileSystemRemoteResource[list.size()];
- for (int i = 0; i < remote.length; i++) {
- remote[i] = new FileSystemRemoteResource(provider.getRoot().append(providerResources[i].getProjectRelativePath()));
- }
- //copy the entire tree structure:
- IPath dropSpot = null;
- for (int i = 0; i < providerResources.length; i++) {
- if (providerResources[i].getType() == IResource.FILE) {
- IFile localFile = (IFile) providerResources[i];
- dropSpot = localFile.getLocation().removeLastSegments(1);
- } else if (providerResources[i].getType() == IResource.FOLDER||providerResources[i].getType() == IResource.PROJECT) {
- IContainer localDir = (IContainer) providerResources[i];
- dropSpot = localDir.getLocation().removeLastSegments(1);
- }
- if (remote[i].isContainer())
- remote[i].copyOver(dropSpot);
- else
- provider.getSimpleAccess().get(new IResource[] { providerResources[i] }, IResource.DEPTH_ONE, subMonitor);
- }
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- }, Policy.bind("ReplaceAction.problemMessage"), PROGRESS_DIALOG); //$NON-NLS-1$
+ /* (non-Javadoc)
+ * @see org.eclipse.team.examples.filesystem.ui.GetAction#isOverwriteOutgoing()
+ */
+ protected boolean isOverwriteOutgoing() {
+ return true;
}
}

Back to the top