Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorteicher2004-01-06 11:08:38 +0000
committerteicher2004-01-06 11:08:38 +0000
commit48a9bdaa131e2df90a4265af4145c7b42906432e (patch)
tree9898e437ff8424e03db8a5e019f5fa61b9567f93
parent89f564dfaae99ef54af776225af1567a7185250e (diff)
downloadeclipse.platform.text-ITypingTarget.tar.gz
eclipse.platform.text-ITypingTarget.tar.xz
eclipse.platform.text-ITypingTarget.zip
javadoc typoITypingTarget
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java44
1 files changed, 43 insertions, 1 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java
index 7a17284ed..19113eb64 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/TextViewer.java
@@ -52,6 +52,7 @@ import org.eclipse.swt.printing.PrinterData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.jface.viewers.IPostSelectionProvider;
@@ -356,7 +357,7 @@ public class TextViewer extends Viewer implements
}
}
- /** List of registed verify key listeners. */
+ /** List of registered verify key listeners. */
private List fListeners= new ArrayList();
/** List of pending batches. */
private List fBatched= new ArrayList();
@@ -4733,4 +4734,45 @@ public class TextViewer extends Viewer implements
fTextPresentationListeners= null;
}
}
+
+ /*
+ * @see org.eclipse.jface.text.ITypingTarget#replace(int, int, java.lang.String)
+ */
+ public void replace(int offset, int length, String text) throws BadLocationException {
+ Event event2= new Event();
+ event2.widget= getTextWidget();
+ VerifyEvent event= new VerifyEvent(event2);
+ event.start= modelOffset2WidgetOffset(offset);
+ event.end= modelOffset2WidgetOffset(offset + length);
+ event.text= text;
+ event.character= '\0';
+ event.doit= true;
+ int textLen= text == null ? 0 : text.length();
+ handleVerifyEvent(event);
+ if (event.doit) {
+ getDocument().replace(offset, length, text);
+ getTextWidget().setSelection(event.start + textLen);
+ }
+ }
+
+ /*
+ * @see org.eclipse.jface.text.ITypingTarget#type(int, int, char, int)
+ */
+ public void type(int offset, int length, char ch, int statemask) throws BadLocationException {
+ Event event2= new Event();
+ event2.widget= getTextWidget();
+ VerifyEvent event= new VerifyEvent(event2);
+ event.start= modelOffset2WidgetOffset(offset);
+ event.end= modelOffset2WidgetOffset(offset + length);
+ event.character= ch;
+ event.text= String.valueOf(ch);
+ event.stateMask= statemask;
+ event.doit= true;
+ fVerifyKeyListenersManager.verifyKey(event);
+ handleVerifyEvent(event);
+ if (event.doit && statemask == 0) {
+ getDocument().replace(offset, length, event.text);
+ getTextWidget().setSelection(event.start + 1);
+ }
+ }
}

Back to the top