Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-03-15 13:25:28 +0000
committerMichael Valenta2002-03-15 13:25:28 +0000
commita36b51b9b25e3b85107079b3ad4772e0a5c22f92 (patch)
tree385576c136cbaa75adde861b6509d69b8a32be5d
parent267c3100913b2755ac2bb8b9df9b8901f6965efa (diff)
downloadeclipse.platform.team-a36b51b9b25e3b85107079b3ad4772e0a5c22f92.tar.gz
eclipse.platform.team-a36b51b9b25e3b85107079b3ad4772e0a5c22f92.tar.xz
eclipse.platform.team-a36b51b9b25e3b85107079b3ad4772e0a5c22f92.zip
Move/Delete Hook
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/DefaultMoveDeleteHook.java14
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java19
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/MoveDeleteManager.java16
3 files changed, 32 insertions, 17 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/DefaultMoveDeleteHook.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/DefaultMoveDeleteHook.java
index 2e7032956..e7b615294 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/DefaultMoveDeleteHook.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/DefaultMoveDeleteHook.java
@@ -17,11 +17,13 @@ import org.eclipse.core.runtime.IProgressMonitor;
* A class which provides the default behavior for resource deletions and moves.
* This class can be overridden by providers to change some or all of the behavior
* related to resources deletions or moves.
+ *
+ * @see org.eclipse.team.core.ResourceProvider#getMoveDeleteHook()
*/
public class DefaultMoveDeleteHook implements IMoveDeleteHook {
- /*
+ /**
* @see IMoveDeleteHook#deleteFile(IResourceTree, IFile, int, IProgressMonitor)
*/
public boolean deleteFile(
@@ -32,7 +34,7 @@ public class DefaultMoveDeleteHook implements IMoveDeleteHook {
return false;
}
- /*
+ /**
* @see IMoveDeleteHook#deleteFolder(IResourceTree, IFolder, int, IProgressMonitor)
*/
public boolean deleteFolder(
@@ -43,7 +45,7 @@ public class DefaultMoveDeleteHook implements IMoveDeleteHook {
return false;
}
- /*
+ /**
* @see IMoveDeleteHook#deleteProject(IResourceTree, IProject, int, IProgressMonitor)
*/
public boolean deleteProject(
@@ -54,7 +56,7 @@ public class DefaultMoveDeleteHook implements IMoveDeleteHook {
return false;
}
- /*
+ /**
* @see IMoveDeleteHook#moveFile(IResourceTree, IFile, IFile, int, IProgressMonitor)
*/
public boolean moveFile(
@@ -66,7 +68,7 @@ public class DefaultMoveDeleteHook implements IMoveDeleteHook {
return false;
}
- /*
+ /**
* @see IMoveDeleteHook#moveFolder(IResourceTree, IFolder, IFolder, int, IProgressMonitor)
*/
public boolean moveFolder(
@@ -78,7 +80,7 @@ public class DefaultMoveDeleteHook implements IMoveDeleteHook {
return false;
}
- /*
+ /**
* @see IMoveDeleteHook#moveProject(IResourceTree, IProject, IProjectDescription, int, IProgressMonitor)
*/
public boolean moveProject(
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
index 6a49a3f8c..5b1e25de4 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
@@ -5,13 +5,13 @@ package org.eclipse.team.core;
* All Rights Reserved.
*/
-import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFileModificationValidator;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.resources.team.IMoveDeleteHook;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.resources.IFileModificationValidator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.team.core.*;
import org.eclipse.team.core.internal.Policy;
/**
@@ -129,6 +129,19 @@ public abstract class RepositoryProvider implements IProjectNature {
}
/**
+ * Returns an <code>IMoveDeleteHook</code> for handling moves and deletes
+ * that occur withing projects managed by the provider. This allows providers
+ * to control how moves and deletes occur and includes the ability to prevent them.
+ * <p>
+ * Returning <code>null</code> signals that the default move and delete behavior is desired.
+ *
+ * @see org.eclipse.core.resources.IMoveDeleteHook
+ */
+ public IMoveDeleteHook getMoveDeleteHook() {
+ return null;
+ }
+
+ /**
* Returns a brief description of this provider. The exact details of the
* representation are unspecified and subject to change, but the following
* may be regarded as typical:
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/MoveDeleteManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/MoveDeleteManager.java
index 961206021..85ffaf12c 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/MoveDeleteManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/MoveDeleteManager.java
@@ -14,19 +14,21 @@ import org.eclipse.core.resources.team.IMoveDeleteHook;
import org.eclipse.core.resources.team.IResourceTree;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.DefaultMoveDeleteHook;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
public class MoveDeleteManager implements IMoveDeleteHook {
private static final IMoveDeleteHook DEFAULT_HOOK = new DefaultMoveDeleteHook();
private IMoveDeleteHook getHookFor(IResource resource) {
-// IProject project = resource.getProject();
-// ITeamProvider provider = TeamPlugin.getManager().getProvider(project);
-// IMoveDeleteHook hook = provider.getMoveDeleteManager(project);
-// if (hook == null) {
+ IProject project = resource.getProject();
+ RepositoryProvider provider = RepositoryProviderType.getProvider(project);
+ IMoveDeleteHook hook = provider.getMoveDeleteHook();
+ if (hook == null) {
return DEFAULT_HOOK;
-// }
-// return hook;
+ }
+ return hook;
}
/*
@@ -75,8 +77,6 @@ public class MoveDeleteManager implements IMoveDeleteHook {
int updateFlags,
IProgressMonitor monitor) {
- // XXX need to check if source and target have same providers.
- // If not, make it a delete?
return getHookFor(source).moveFile(tree, source, destination, updateFlags, monitor);
}

Back to the top