diff options
author | Dani Megert | 2004-02-03 18:24:51 +0000 |
---|---|---|
committer | Dani Megert | 2004-02-03 18:24:51 +0000 |
commit | 629de2a5e669b3e6bc9d44dd35ceab649f4462f8 (patch) | |
tree | 9aabe6d8d9cb6c620ddbd1a2d648fabc1f6dd88e /org.eclipse.ui.editors | |
parent | 7babcb5ecf1bdd919d22c7a16ee7af2d01dd5726 (diff) | |
download | eclipse.platform.text-629de2a5e669b3e6bc9d44dd35ceab649f4462f8.tar.gz eclipse.platform.text-629de2a5e669b3e6bc9d44dd35ceab649f4462f8.tar.xz eclipse.platform.text-629de2a5e669b3e6bc9d44dd35ceab649f4462f8.zip |
Fixed bugs 46753 and 50756
Diffstat (limited to 'org.eclipse.ui.editors')
-rw-r--r-- | org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextFileDocumentProvider.java | 27 |
1 files changed, 14 insertions, 13 deletions
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 b5b1e815b1b..b644ab58321 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 @@ -26,6 +26,7 @@ import java.util.NoSuchElementException; import org.eclipse.core.internal.filebuffers.ContainerGenerator; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceRuleFactory; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; @@ -323,6 +324,8 @@ public class TextFileDocumentProvider implements IDocumentProvider, IDocumentPr private IProgressMonitor fProgressMonitor; /** The operation runner */ private WorkspaceOperationRunner fOperationRunner; + /** The rule factory */ + private IResourceRuleFactory fResourceRuleFactory; public TextFileDocumentProvider() { @@ -335,6 +338,8 @@ public class TextFileDocumentProvider implements IDocumentProvider, IDocumentPr manager.setSynchronizationContext(new UISynchronizationContext()); if (parentProvider != null) setParentDocumentProvider(parentProvider); + + fResourceRuleFactory= ResourcesPlugin.getWorkspace().getRuleFactory(); } final public void setParentDocumentProvider(IDocumentProvider parentProvider) { @@ -573,7 +578,7 @@ public class TextFileDocumentProvider implements IDocumentProvider, IDocumentPr */ public ISchedulingRule getSchedulingRule() { if (info.fElement instanceof IFileEditorInput) - return ((IFileEditorInput)info.fElement).getFile(); + return fResourceRuleFactory.modifyRule(((IFileEditorInput)info.fElement).getFile()); else return null; } @@ -617,7 +622,7 @@ public class TextFileDocumentProvider implements IDocumentProvider, IDocumentPr */ public ISchedulingRule getSchedulingRule() { if (info.fElement instanceof IFileEditorInput) - return ((IFileEditorInput)info.fElement).getFile().getParent(); + return fResourceRuleFactory.modifyRule(((IFileEditorInput)info.fElement).getFile()); else return null; } @@ -634,10 +639,7 @@ public class TextFileDocumentProvider implements IDocumentProvider, IDocumentPr * @see org.eclipse.ui.editors.text.TextFileDocumentProvider.DocumentProviderOperation#getSchedulingRule() */ public ISchedulingRule getSchedulingRule() { - IResource existingParent= file.getParent(); - while (!existingParent.exists()) - existingParent= existingParent.getParent(); - return existingParent; + return fResourceRuleFactory.createRule(file); } }; } @@ -803,12 +805,11 @@ public class TextFileDocumentProvider implements IDocumentProvider, IDocumentPr * @see org.eclipse.ui.editors.text.TextFileDocumentProvider.DocumentProviderOperation#getSchedulingRule() */ public ISchedulingRule getSchedulingRule() { - // XXX: waiting for clients (e.g. Team providers) to support scheduling rules (see bug 46753) - return ResourcesPlugin.getWorkspace().getRoot(); -// if (info.fElement instanceof IFileEditorInput) -// return ((IFileEditorInput)info.fElement).getFile().getParent(); -// else -// return null; + if (info.fElement instanceof IFileEditorInput) { + IResource resource= ((IFileEditorInput)info.fElement).getFile().getParent(); + return fResourceRuleFactory.validateEditRule(new IResource[] {resource}); + } else + return null; } }; executeOperation(operation, getProgressMonitor()); @@ -876,7 +877,7 @@ public class TextFileDocumentProvider implements IDocumentProvider, IDocumentPr */ public ISchedulingRule getSchedulingRule() { if (info.fElement instanceof IFileEditorInput) - return ((IFileEditorInput)info.fElement).getFile().getParent(); + return fResourceRuleFactory.refreshRule(((IFileEditorInput)info.fElement).getFile()); else return null; } |