Author: koen.aers(a)jboss.com
Date: 2011-10-07 13:50:35 -0400 (Fri, 07 Oct 2011)
New Revision: 35472
Added:
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/AllCommandsInterceptor.java
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandProcessor.java
Modified:
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/EventHandler.java
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/part/ForgeView.java
Log:
- AllCommandsInterceptor will send the tools info about the current command that has been
sent to the runtime (before the command gets executed)
- EventHandler sends the tools info about the command that has been executed
- ForgeCommandProcessor will keep track of the currently executing command and do pre/post
processing if necessary
- ForgeTextViewer gets informed of the commands that are about to be executed or have been
executed
Added:
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/AllCommandsInterceptor.java
===================================================================
---
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/AllCommandsInterceptor.java
(rev 0)
+++
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/AllCommandsInterceptor.java 2011-10-07
17:50:35 UTC (rev 35472)
@@ -0,0 +1,25 @@
+package org.jboss.tools.forge.runtime.ext;
+
+import javax.inject.Inject;
+
+import org.jboss.forge.shell.Shell;
+import org.jboss.forge.shell.spi.CommandInterceptor;
+
+public class AllCommandsInterceptor implements CommandInterceptor {
+
+ private static final String ESCAPE = new String(new char[] { 27, '%'} );
+
+ @Inject
+ private Shell shell;
+
+ @Override
+ public String intercept(String line) {
+ sendEscaped("Intercepted Command: " + line);
+ return line;
+ }
+
+ private void sendEscaped(String str) {
+ shell.print(ESCAPE + str + ESCAPE);
+ }
+
+}
Modified:
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/EventHandler.java
===================================================================
---
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/EventHandler.java 2011-10-07
17:42:47 UTC (rev 35471)
+++
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/EventHandler.java 2011-10-07
17:50:35 UTC (rev 35472)
@@ -4,7 +4,7 @@
import javax.inject.Inject;
import org.jboss.forge.shell.Shell;
-import org.jboss.forge.shell.events.PostStartup;
+import org.jboss.forge.shell.events.CommandExecuted;
public class EventHandler {
@@ -13,8 +13,8 @@
@Inject
private Shell shell;
- public void startup(@Observes PostStartup event) {
- sendEscaped("PostStartup");
+ public void handleCommandExecuted(@Observes CommandExecuted event) {
+ sendEscaped("Executed Command: " + event.getCommand().getName());
}
private void sendEscaped(String str) {
Added:
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandProcessor.java
===================================================================
---
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandProcessor.java
(rev 0)
+++
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandProcessor.java 2011-10-07
17:50:35 UTC (rev 35472)
@@ -0,0 +1,5 @@
+package org.jboss.tools.forge.ui.console;
+
+public class ForgeCommandProcessor {
+
+}
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-07
17:42:47 UTC (rev 35471)
+++
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeTextViewer.java 2011-10-07
17:50:35 UTC (rev 35472)
@@ -176,7 +176,13 @@
outputListener = new ForgeHiddenOutputFilter(ansiCommandFilter) {
@Override
public void handleFilteredString(String str) {
- System.out.println("handleHiddenOutput : " + str);
+ if (str.startsWith("Intercepted Command: ")) {
+
+ } else if (str.startsWith("Executed Command: ")) {
+
+ } else {
+ System.out.println("unhandled hidden output: " + str);
+ }
}
};
runtime.addOutputListener(outputListener);
Modified:
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/ForgeView.java
===================================================================
---
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/ForgeView.java 2011-10-07
17:42:47 UTC (rev 35471)
+++
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/ForgeView.java 2011-10-07
17:50:35 UTC (rev 35472)
@@ -230,5 +230,5 @@
public ForgeRuntime getRuntime() {
return runtime;
}
-
+
}