build input 20011204
diff --git a/bundles/org.eclipse.ui/Eclipse JFace Text/org/eclipse/jface/text/TextViewer.java b/bundles/org.eclipse.ui/Eclipse JFace Text/org/eclipse/jface/text/TextViewer.java
index e3cfb95..a01aa91 100644
--- a/bundles/org.eclipse.ui/Eclipse JFace Text/org/eclipse/jface/text/TextViewer.java
+++ b/bundles/org.eclipse.ui/Eclipse JFace Text/org/eclipse/jface/text/TextViewer.java
@@ -333,11 +333,22 @@
* Internal verify listener.
*/
class TextVerifyListener implements VerifyListener {
+
+ private boolean fForward= true;
+
+ /**
+ * Tells the listener to forward received events.
+ */
+ public void forward(boolean forward) {
+ fForward= forward;
+ }
+
/*
* @see VerifyListener#verifyText(VerifyEvent)
*/
public void verifyText(VerifyEvent e) {
- handleVerifyEvent(e);
+ if (fForward)
+ handleVerifyEvent(e);
}
};
@@ -431,7 +442,7 @@
/** Document listener */
private DocumentListener fDocumentListener= new DocumentListener();
/** Verify listener */
- private VerifyListener fVerifyListener= new TextVerifyListener();
+ private TextVerifyListener fVerifyListener= new TextVerifyListener();
/** The most recent widget modification as document command */
private DocumentCommand fDocumentCommand= new DocumentCommand();
/** The viewer's find/replace target */
@@ -543,6 +554,7 @@
// where does the first line start
fTopInset= -fTextWidget.computeTrim(0, 0, 0, 0).y;
+ fVerifyListener.forward(true);
fTextWidget.addVerifyListener(fVerifyListener);
fTextWidget.addSelectionListener(new SelectionListener() {
@@ -1667,13 +1679,13 @@
customizeDocumentCommand(fDocumentCommand);
if (!fDocumentCommand.fillEvent(e, offset)) {
try {
- fTextWidget.removeVerifyListener(fVerifyListener);
+ fVerifyListener.forward(false);
getDocument().replace(fDocumentCommand.offset, fDocumentCommand.length, fDocumentCommand.text);
} catch (BadLocationException x) {
if (TRACE_ERRORS)
System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.verifyText")); //$NON-NLS-1$
} finally {
- fTextWidget.addVerifyListener(fVerifyListener);
+ fVerifyListener.forward(true);
}
}
}
diff --git a/bundles/org.eclipse.ui/Eclipse JFace Text/org/eclipse/jface/text/rules/WordRule.java b/bundles/org.eclipse.ui/Eclipse JFace Text/org/eclipse/jface/text/rules/WordRule.java
index 649b2a9..4f739ac 100644
--- a/bundles/org.eclipse.ui/Eclipse JFace Text/org/eclipse/jface/text/rules/WordRule.java
+++ b/bundles/org.eclipse.ui/Eclipse JFace Text/org/eclipse/jface/text/rules/WordRule.java
@@ -108,7 +108,7 @@
do {
fBuffer.append((char) c);
c= scanner.read();
- } while (fDetector.isWordPart((char) c));
+ } while (c != scanner.EOF && fDetector.isWordPart((char) c));
scanner.unread();
IToken token= (IToken) fWords.get(fBuffer.toString());
diff --git a/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/editors/text/FileDocumentProvider.java b/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/editors/text/FileDocumentProvider.java
index cb86a3a..c4397f2 100644
--- a/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/editors/text/FileDocumentProvider.java
+++ b/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/editors/text/FileDocumentProvider.java
Binary files differ
diff --git a/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/editors/text/StorageDocumentProvider.java b/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/editors/text/StorageDocumentProvider.java
index cfb19a0..5670894 100644
--- a/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/editors/text/StorageDocumentProvider.java
+++ b/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/editors/text/StorageDocumentProvider.java
@@ -14,6 +14,7 @@
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
+
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.core.resources.IStorage;
@@ -107,7 +108,7 @@
return null;
}
-
+
/*
* @see AbstractDocumentProvider#doSaveDocument(IProgressMonitor, Object, IDocument, boolean)
*/
@@ -115,23 +116,28 @@
}
/*
- * @see IDocumentProvider#getModificationStamp(Object)
+ * @see IDocumentProviderExtension#isReadOnly(Object)
*/
- public long getModificationStamp(Object element) {
- return 0;
+ public boolean isReadOnly(Object element) throws CoreException {
+ if (element instanceof IStorageEditorInput) {
+ IStorageEditorInput input= (IStorageEditorInput) element;
+ IStorage storage= input.getStorage();
+ if (storage != null)
+ return storage.isReadOnly();
+ }
+ return super.isReadOnly(element);
}
/*
- * @see IDocumentProvider#getSynchronizationStamp(Object)
+ * @see IDocumentProviderExtension#isModifiable(Object)
*/
- public long getSynchronizationStamp(Object element) {
- return 0;
- }
-
- /*
- * @see IDocumentProvider#isDeleted(Object)
- */
- public boolean isDeleted(Object element) {
- return false;
+ public boolean isModifiable(Object element) throws CoreException {
+ if (element instanceof IStorageEditorInput) {
+ IStorageEditorInput input= (IStorageEditorInput) element;
+ IStorage storage= input.getStorage();
+ if (storage != null)
+ return !storage.isReadOnly();
+ }
+ return super.isModifiable(element);
}
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/AbstractDocumentProvider.java b/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/AbstractDocumentProvider.java
index f892c01..482becf 100644
--- a/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/AbstractDocumentProvider.java
+++ b/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/AbstractDocumentProvider.java
@@ -17,6 +17,7 @@
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentListener;
+
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.util.Assert;
@@ -32,7 +33,7 @@
* <code>createAnnotationModel</code>, and <code>doSaveDocument</code>.
* </p>
*/
-public abstract class AbstractDocumentProvider implements IDocumentProvider {
+public abstract class AbstractDocumentProvider implements IDocumentProvider, IDocumentProviderExtension {
/**
@@ -472,4 +473,39 @@
l.elementMoved(originalElement, movedElement);
}
}
+
+ /*
+ * @see IDocumentProvider#getModificationStamp(Object)
+ */
+ public long getModificationStamp(Object element) {
+ return 0;
+ }
+
+ /*
+ * @see IDocumentProvider#getSynchronizationStamp(Object)
+ */
+ public long getSynchronizationStamp(Object element) {
+ return 0;
+ }
+
+ /*
+ * @see IDocumentProvider#isDeleted(Object)
+ */
+ public boolean isDeleted(Object element) {
+ return false;
+ }
+
+ /*
+ * @see IDocumentProviderExtension#isReadOnly(Object)
+ */
+ public boolean isReadOnly(Object element) throws CoreException {
+ return true;
+ }
+
+ /*
+ * @see IDocumentProviderExtension#isModifiable(Object)
+ */
+ public boolean isModifiable(Object element) throws CoreException {
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/AbstractTextEditor.java b/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/AbstractTextEditor.java
index 9f3acc6..59f9d12 100644
--- a/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/AbstractTextEditor.java
+++ b/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/AbstractTextEditor.java
Binary files differ
diff --git a/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/IDocumentProviderExtension.java b/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/IDocumentProviderExtension.java
new file mode 100644
index 0000000..de89799
--- /dev/null
+++ b/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/IDocumentProviderExtension.java
@@ -0,0 +1,42 @@
+package org.eclipse.ui.texteditor;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.runtime.CoreException;
+
+
+/**
+ * Extension to <code>IDocumentProvider</code>. Intention to be integrated with
+ * <code>IDocumentProvider</code>. Should not yet be considered API.
+ */
+public interface IDocumentProviderExtension {
+
+ /**
+ * Returns whether the given element is read-only. If this method returns
+ * <code>true</code>, <code>saveDocument</code> could fail. This method
+ * does not state anything about the document constructed from the given
+ * element. If the given element is not connected to this document provider,
+ * the return value is undefined.
+ *
+ * @param element the element
+ * @return <code>true</code> if the given element is read-only, <code>false</code> otherwise
+ * @exception CoreException if retrieving the information fails
+ */
+ boolean isReadOnly(Object element) throws CoreException;
+
+ /**
+ * Returns whether the given element can persistently be modified. This method is
+ * orthogonal to <code>isReadOnly</code>. Read-only elements could be modifiable,
+ * and writable elements may not be modified. If the given element is not connected to this
+ * document provider, the return value is undefined.
+ *
+ * @param element the element
+ * @return <code>true</code> if the given element is modifiable, <code>false</code> otherwise
+ * @exception CoreException if retrieving the information fails
+ */
+ boolean isModifiable(Object element) throws CoreException;
+}
+
diff --git a/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/ITextEditorExtension.java b/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/ITextEditorExtension.java
index 16b7c15..e6a4afb 100644
--- a/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/ITextEditorExtension.java
+++ b/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/ITextEditorExtension.java
@@ -18,5 +18,12 @@
* @see ITextEditorActionConstants
*/
void setStatusField(IStatusField field, String category);
+
+ /**
+ * Returns whether the editor's input is read-only. The semantics of this method is
+ * orthogonal to <code>isEditable</code> as it talks about the editor input and
+ * <b>not</b> about the editor document.
+ */
+ boolean isEditorInputReadOnly();
}
diff --git a/bundles/org.eclipse.ui/buildnotes_text.html b/bundles/org.eclipse.ui/buildnotes_text.html
index 1f17d09..c2860d6 100644
--- a/bundles/org.eclipse.ui/buildnotes_text.html
+++ b/bundles/org.eclipse.ui/buildnotes_text.html
@@ -13,8 +13,25 @@
<h1>
Text Editor Support (including JFace Text)</h1>
-
-<p>
+
+<p><br>Eclipse SDK Build 20011204
+<h2>
+Breaking API changes</h2>
+
+<h2>
+Other highlights</h2>
+Perparations for supporting the concept of read-only but modifiable resources
+in editors.
+<h2>
+Known deficiencies</h2>
+
+<h2>
+Problem reports closed</h2>
+#6203 SEVERE: typing in java editor causes OutOfMemoryError in JDK 1.4
+<br>#6263 Extra closing braces inserted
+<p>
+<hr WIDTH="100%">
+<br>
<p>Eclipse SDK Build 20011127
<h2>
Breaking API changes</h2>