Author: koen.aers(a)jboss.com
Date: 2011-10-06 03:54:43 -0400 (Thu, 06 Oct 2011)
New Revision: 35413
Removed:
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeDocument.java
Modified:
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeTextViewer.java
Log:
Replace ForgeDocument by plain vanilla Document
Deleted:
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeDocument.java
===================================================================
---
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeDocument.java 2011-10-06
07:24:19 UTC (rev 35412)
+++
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeDocument.java 2011-10-06
07:54:43 UTC (rev 35413)
@@ -1,27 +0,0 @@
-package org.jboss.tools.forge.ui.console;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Document;
-
-public class ForgeDocument extends Document {
-
- public void appendString(final String str) {
-// Display.getDefault().asyncExec(new Runnable() {
-// @Override
-// public void run() {
- try {
- for (int i = 0; i < str.length(); i++) {
- char c = str.charAt(i);
- if (c == '\r') continue; //ignore
- if (str.charAt(i) == '\b') {
- replace(getLength() - 1, 1, "");
- } else {
- replace(getLength(), 0, str.substring(i, i + 1));
- }
- }
- } catch (BadLocationException e) {}
-// }
-// });
- }
-
-}
Modified:
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeTextViewer.java
===================================================================
---
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeTextViewer.java 2011-10-06
07:24:19 UTC (rev 35412)
+++
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeTextViewer.java 2011-10-06
07:54:43 UTC (rev 35413)
@@ -5,6 +5,7 @@
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocumentListener;
import org.eclipse.jface.text.TextViewer;
@@ -17,6 +18,8 @@
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
import org.jboss.tools.forge.core.io.ForgeAnsiCommandFilter;
import org.jboss.tools.forge.core.io.ForgeHiddenOutputFilter;
import org.jboss.tools.forge.core.io.ForgeOutputListener;
@@ -26,8 +29,8 @@
public class ForgeTextViewer extends TextViewer {
private static String PREV_CHAR = new Character((char)2).toString();
- private static String BLAH = new Character((char)3).toString();
- private static String EXIT = new Character((char)4).toString();
+ private static String CTRL_C = new Character((char)3).toString();
+ private static String CTRL_D = new Character((char)4).toString();
private static String NEXT_CHAR = new Character((char)6).toString();
private static String DELETE_PREV_CHAR = new Character((char)8).toString();
private static String PREV_HISTORY = new Character((char)16).toString();
@@ -66,11 +69,9 @@
private RuntimeStopListener stopListener;
private ForgeOutputListener outputListener;
private ForgeRuntime runtime;
- private ForgeDocument document;
- private StyleRange currentStyleRange = null;
+ private Document document;
+ private StyleRange currentStyleRange = null;
-
-
public ForgeTextViewer(Composite parent, ForgeRuntime runtime) {
super(parent, SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL);
this.runtime = runtime;
@@ -86,26 +87,31 @@
}
private void initDocument() {
- document = new ForgeDocument();
+ document = new Document();
document.addDocumentListener(new DocumentListener());
setDocument(document);
}
private void initViewer() {
getTextWidget().setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
- getTextWidget().addVerifyKeyListener(new VerifyKeyListener() {
-
+ getTextWidget().addVerifyKeyListener(new VerifyKeyListener() {
@Override
public void verifyKey(VerifyEvent event) {
if ((event.stateMask & SWT.CTRL) == SWT.CTRL ) {
if (event.keyCode == 'd') {
- runtime.sendInput(EXIT);
+ runtime.sendInput(CTRL_D);
} else if (event.keyCode == 'c') {
- runtime.sendInput(BLAH);
+ runtime.sendInput(CTRL_C);
}
}
}
});
+ getTextWidget().addListener(SWT.MouseDown, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ event.doit = false;
+ }
+ });
}
protected StyledText createTextWidget(Composite parent, int styles) {
Show replies by date