Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-03-14 20:41:17 +0000
committerMichael Valenta2002-03-14 20:41:17 +0000
commitada2614d1a760d9a0cd34ad55e12ebb9f6e3cde8 (patch)
tree86fd0677cdcb94c58a51b0763addd64aa9021c21
parent00642f0d6834aaa2189622063f0809bf05e0f450 (diff)
downloadeclipse.platform.team-ada2614d1a760d9a0cd34ad55e12ebb9f6e3cde8.tar.gz
eclipse.platform.team-ada2614d1a760d9a0cd34ad55e12ebb9f6e3cde8.tar.xz
eclipse.platform.team-ada2614d1a760d9a0cd34ad55e12ebb9f6e3cde8.zip
Move/Delete Hook
-rw-r--r--bundles/org.eclipse.team.core/plugin.xml4
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/DefaultMoveDeleteHook.java93
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/MoveDeleteManager.java109
3 files changed, 206 insertions, 0 deletions
diff --git a/bundles/org.eclipse.team.core/plugin.xml b/bundles/org.eclipse.team.core/plugin.xml
index e3289af6f..7678eb2b5 100644
--- a/bundles/org.eclipse.team.core/plugin.xml
+++ b/bundles/org.eclipse.team.core/plugin.xml
@@ -25,4 +25,8 @@
<fileModificationValidator class="org.eclipse.team.core.internal.FileModificationValidator"/>
</extension>
+<extension point="org.eclipse.core.resources.moveDeleteHook">
+ <fileModificationValidator class="org.eclipse.team.core.internal.MoveDeleteManager"/>
+</extension>
+
</plugin>
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
new file mode 100644
index 000000000..2e7032956
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/DefaultMoveDeleteHook.java
@@ -0,0 +1,93 @@
+package org.eclipse.team.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.team.IMoveDeleteHook;
+import org.eclipse.core.resources.team.IResourceTree;
+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.
+ */
+
+public class DefaultMoveDeleteHook implements IMoveDeleteHook {
+
+ /*
+ * @see IMoveDeleteHook#deleteFile(IResourceTree, IFile, int, IProgressMonitor)
+ */
+ public boolean deleteFile(
+ IResourceTree tree,
+ IFile file,
+ int updateFlags,
+ IProgressMonitor monitor) {
+ return false;
+ }
+
+ /*
+ * @see IMoveDeleteHook#deleteFolder(IResourceTree, IFolder, int, IProgressMonitor)
+ */
+ public boolean deleteFolder(
+ IResourceTree tree,
+ IFolder folder,
+ int updateFlags,
+ IProgressMonitor monitor) {
+ return false;
+ }
+
+ /*
+ * @see IMoveDeleteHook#deleteProject(IResourceTree, IProject, int, IProgressMonitor)
+ */
+ public boolean deleteProject(
+ IResourceTree tree,
+ IProject project,
+ int updateFlags,
+ IProgressMonitor monitor) {
+ return false;
+ }
+
+ /*
+ * @see IMoveDeleteHook#moveFile(IResourceTree, IFile, IFile, int, IProgressMonitor)
+ */
+ public boolean moveFile(
+ IResourceTree tree,
+ IFile source,
+ IFile destination,
+ int updateFlags,
+ IProgressMonitor monitor) {
+ return false;
+ }
+
+ /*
+ * @see IMoveDeleteHook#moveFolder(IResourceTree, IFolder, IFolder, int, IProgressMonitor)
+ */
+ public boolean moveFolder(
+ IResourceTree tree,
+ IFolder source,
+ IFolder destination,
+ int updateFlags,
+ IProgressMonitor monitor) {
+ return false;
+ }
+
+ /*
+ * @see IMoveDeleteHook#moveProject(IResourceTree, IProject, IProjectDescription, int, IProgressMonitor)
+ */
+ public boolean moveProject(
+ IResourceTree tree,
+ IProject source,
+ IProjectDescription description,
+ int updateFlags,
+ IProgressMonitor monitor) {
+ return false;
+ }
+
+}
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
new file mode 100644
index 000000000..961206021
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/MoveDeleteManager.java
@@ -0,0 +1,109 @@
+package org.eclipse.team.core.internal;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+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;
+
+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) {
+ return DEFAULT_HOOK;
+// }
+// return hook;
+ }
+
+ /*
+ * @see IMoveDeleteHook#deleteFile(IResourceTree, IFile, int, IProgressMonitor)
+ */
+ public boolean deleteFile(
+ IResourceTree tree,
+ IFile file,
+ int updateFlags,
+ IProgressMonitor monitor) {
+
+ return getHookFor(file).deleteFile(tree, file, updateFlags, monitor);
+ }
+
+ /*
+ * @see IMoveDeleteHook#deleteFolder(IResourceTree, IFolder, int, IProgressMonitor)
+ */
+ public boolean deleteFolder(
+ IResourceTree tree,
+ IFolder folder,
+ int updateFlags,
+ IProgressMonitor monitor) {
+
+ return getHookFor(folder).deleteFolder(tree, folder, updateFlags, monitor);
+ }
+
+ /*
+ * @see IMoveDeleteHook#deleteProject(IResourceTree, IProject, int, IProgressMonitor)
+ */
+ public boolean deleteProject(
+ IResourceTree tree,
+ IProject project,
+ int updateFlags,
+ IProgressMonitor monitor) {
+
+ return getHookFor(project).deleteProject(tree, project, updateFlags, monitor);
+ }
+
+ /*
+ * @see IMoveDeleteHook#moveFile(IResourceTree, IFile, IFile, int, IProgressMonitor)
+ */
+ public boolean moveFile(
+ IResourceTree tree,
+ IFile source,
+ IFile destination,
+ 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);
+ }
+
+ /*
+ * @see IMoveDeleteHook#moveFolder(IResourceTree, IFolder, IFolder, int, IProgressMonitor)
+ */
+ public boolean moveFolder(
+ IResourceTree tree,
+ IFolder source,
+ IFolder destination,
+ int updateFlags,
+ IProgressMonitor monitor) {
+
+ return getHookFor(source).moveFolder(tree, source, destination, updateFlags, monitor);
+ }
+
+ /*
+ * @see IMoveDeleteHook#moveProject(IResourceTree, IProject, IProjectDescription, int, IProgressMonitor)
+ */
+ public boolean moveProject(
+ IResourceTree tree,
+ IProject source,
+ IProjectDescription description,
+ int updateFlags,
+ IProgressMonitor monitor) {
+
+ return getHookFor(source).moveProject(tree, source, description, updateFlags, monitor);
+ }
+
+}

Back to the top