Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Maetzel2004-03-25 18:54:03 +0000
committerKai Maetzel2004-03-25 18:54:03 +0000
commit86448de41d6c6bc1d2a36771a3ef50a6c1833531 (patch)
tree78f19926d48c5b5d18e925dd5874f05a7cb15295 /org.eclipse.ui.editors
parentb5cb3413107078b9fe8db8dc17842a985a529bea (diff)
downloadeclipse.platform.text-86448de41d6c6bc1d2a36771a3ef50a6c1833531.tar.gz
eclipse.platform.text-86448de41d6c6bc1d2a36771a3ef50a6c1833531.tar.xz
eclipse.platform.text-86448de41d6c6bc1d2a36771a3ef50a6c1833531.zip
#55615
Diffstat (limited to 'org.eclipse.ui.editors')
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java61
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ISchedulingRuleProvider.java16
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextFileDocumentProvider.java1
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/WorkspaceOperationRunner.java1
4 files changed, 65 insertions, 14 deletions
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java
index 2baa9d1c2..bac32e016 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java
@@ -22,6 +22,7 @@ import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.IResourceRuleFactory;
import org.eclipse.core.resources.IResourceStatus;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -33,6 +34,7 @@ import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.swt.widgets.Display;
@@ -71,6 +73,12 @@ public class FileDocumentProvider extends StorageDocumentProvider {
* @since 3.0
*/
private WorkspaceOperationRunner fOperationRunner;
+ /**
+ * The scheduling rule factory.
+ * @since 3.0
+ */
+ private IResourceRuleFactory fResourceRuleFactory;
+
/**
* Runnable encapsulating an element state change. This runnable ensures
@@ -295,6 +303,7 @@ public class FileDocumentProvider extends StorageDocumentProvider {
*/
public FileDocumentProvider() {
super();
+ fResourceRuleFactory= ResourcesPlugin.getWorkspace().getRuleFactory();
}
/**
@@ -820,4 +829,56 @@ public class FileDocumentProvider extends StorageDocumentProvider {
fOperationRunner.setProgressMonitor(monitor);
return fOperationRunner;
}
+
+ /*
+ * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#getResetRule(java.lang.Object)
+ */
+ protected ISchedulingRule getResetRule(Object element) {
+ if (element instanceof IFileEditorInput) {
+ IFileEditorInput input= (IFileEditorInput) element;
+ return fResourceRuleFactory.modifyRule(input.getFile());
+ } else {
+ return null;
+ }
+ }
+
+ /*
+ * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#getSaveRule(java.lang.Object)
+ */
+ protected ISchedulingRule getSaveRule(Object element) {
+ if (element instanceof IFileEditorInput) {
+ IFileEditorInput input= (IFileEditorInput) element;
+ IFile file= input.getFile();
+ if (file.exists())
+ return fResourceRuleFactory.modifyRule(input.getFile());
+ else
+ return fResourceRuleFactory.createRule(input.getFile());
+ } else {
+ return null;
+ }
+ }
+
+ /*
+ * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#getSynchronizeRule(java.lang.Object)
+ */
+ protected ISchedulingRule getSynchronizeRule(Object element) {
+ if (element instanceof IFileEditorInput) {
+ IFileEditorInput input= (IFileEditorInput) element;
+ return fResourceRuleFactory.refreshRule(input.getFile());
+ } else {
+ return null;
+ }
+ }
+
+ /*
+ * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#getValidateStateRule(java.lang.Object)
+ */
+ protected ISchedulingRule getValidateStateRule(Object element) {
+ if (element instanceof IFileEditorInput) {
+ IFileEditorInput input= (IFileEditorInput) element;
+ return fResourceRuleFactory.validateEditRule(new IResource[] { input.getFile() });
+ } else {
+ return null;
+ }
+ }
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ISchedulingRuleProvider.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ISchedulingRuleProvider.java
index 871a4b9d5..314c0d3fa 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ISchedulingRuleProvider.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/ISchedulingRuleProvider.java
@@ -11,20 +11,8 @@
package org.eclipse.ui.editors.text;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-
/**
- * A scheduling rule provider provides a scheduling rule which
- * can be used when running operations.
- *
- * @since 3.0
+ * @deprecated use <code>org.eclipse.ui.texteditor.ISchedulingRuleProvider</code> instead
*/
-public interface ISchedulingRuleProvider {
-
- /**
- * Returns the scheduling rule.
- *
- * @return a scheduling rule or <code>null</code> if none
- */
- ISchedulingRule getSchedulingRule();
+public interface ISchedulingRuleProvider extends org.eclipse.ui.texteditor.ISchedulingRuleProvider {
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextFileDocumentProvider.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextFileDocumentProvider.java
index 565642573..bfb691867 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextFileDocumentProvider.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextFileDocumentProvider.java
@@ -66,6 +66,7 @@ import org.eclipse.ui.texteditor.IDocumentProviderExtension2;
import org.eclipse.ui.texteditor.IDocumentProviderExtension3;
import org.eclipse.ui.texteditor.IElementStateListener;
import org.eclipse.ui.texteditor.IElementStateListenerExtension;
+import org.eclipse.ui.texteditor.ISchedulingRuleProvider;
import org.eclipse.ui.texteditor.ResourceMarkerAnnotationModel;
/**
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/WorkspaceOperationRunner.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/WorkspaceOperationRunner.java
index f10622124..467aa5196 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/WorkspaceOperationRunner.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/WorkspaceOperationRunner.java
@@ -22,6 +22,7 @@ import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
+import org.eclipse.ui.texteditor.ISchedulingRuleProvider;
/**
* @since 3.0

Back to the top