use of org.eclipse.ui.console.IOConsole in project tesb-studio-se by Talend.
the class RuntimeConsoleUtil method findConsole.
public static IOConsole findConsole() {
ConsolePlugin plugin = ConsolePlugin.getDefault();
IConsoleManager conMan = plugin.getConsoleManager();
IConsole[] existing = conMan.getConsoles();
for (int i = 0; i < existing.length; i++) {
if (KARAF_CONSOLE.equals(existing[i].getName()))
return (IOConsole) existing[i];
}
// no console found, so create a new one
IOConsole myConsole = new IOConsole(KARAF_CONSOLE, null);
conMan.addConsoles(new IConsole[] { myConsole });
return myConsole;
}
use of org.eclipse.ui.console.IOConsole in project tesb-studio-se by Talend.
the class RuntimeConsoleUtil method clearConsole.
public static void clearConsole() {
ConsolePlugin plugin = ConsolePlugin.getDefault();
IConsoleManager conMan = plugin.getConsoleManager();
IConsole[] existing = conMan.getConsoles();
for (int i = 0; i < existing.length; i++) {
if (KARAF_CONSOLE.equals(existing[i].getName())) {
((IOConsole) existing[i]).destroy();
conMan.removeConsoles(new IConsole[] { existing[i] });
}
}
}
use of org.eclipse.ui.console.IOConsole in project core by jcryptool.
the class CommandsUiStartup method earlyStartup.
public void earlyStartup() {
final IOConsole ioConsole = new IOConsole(Messages.CommandsUiStartup_consolename, null);
ioConsole.setConsoleWidth(0);
ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { ioConsole });
CommandsUIPlugin.getDefault().setIoConsole(ioConsole);
final CommandEvaluator evaluator = new CommandEvaluator();
final IOConsolePromptShell monitor = new IOConsolePromptShell(ioConsole) {
@Override
protected void sendPrompt(final IOConsoleOutputStream o) throws IOException {
Display.getDefault().syncExec(new Runnable() {
public void run() {
Color prevColor = o.getColor();
int prevStyle = o.getFontStyle();
o.setColor(Display.getDefault().getSystemColor(SWT.COLOR_RED));
try {
o.write(PROMPT);
} catch (IOException e) {
LogUtil.logError(CommandsUIPlugin.PLUGIN_ID, e);
}
o.setColor(prevColor);
o.setFontStyle(prevStyle);
}
});
}
@Override
protected void initializeConsole(IOConsoleOutputStream o) {
super.initializeConsole(o);
try {
o.write(Messages.CommandsUiStartup_welcome + Messages.CommandsUiStartup_welcome_tip);
} catch (IOException e) {
LogUtil.logError(CommandsUIPlugin.PLUGIN_ID, e);
}
}
};
Observer monitorObserver = new Observer() {
public void update(Observable o, Object arg) {
String line = monitor.getLine();
String result = Messages.CommandsUiStartup_eval_error;
try {
result = evaluator.evaluate(line).getResult();
} catch (ParseException e) {
LogUtil.logError(CommandsUIPlugin.PLUGIN_ID, e);
}
IOConsoleOutputStream outStream = ioConsole.newOutputStream();
try {
// $NON-NLS-1$
outStream.write(result + "\n\n");
} catch (IOException e) {
LogUtil.logError(CommandsUIPlugin.PLUGIN_ID, e);
}
try {
outStream.close();
} catch (IOException e) {
LogUtil.logError(CommandsUIPlugin.PLUGIN_ID, e);
}
}
};
monitor.addObserver(monitorObserver);
monitor.startMonitoring();
}
use of org.eclipse.ui.console.IOConsole in project statecharts by Yakindu.
the class StatechartLaunchShortcut method showConsole.
protected void showConsole() {
IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
IConsole[] consoles = consoleManager.getConsoles();
for (IConsole iConsole : consoles) {
if (TYPE.equals(iConsole.getType())) {
if (iConsole instanceof IOConsole) {
((IOConsole) iConsole).activate();
consoleManager.showConsoleView(iConsole);
}
}
}
}
use of org.eclipse.ui.console.IOConsole in project gemoc-studio by eclipse.
the class EclipseConsoleIOFactory method getConsoleIO.
/**
* retrieve or create a ConsoleIO with the given UId
* the name is used only if the console is created
* @param name
* @return
*/
public EclipseConsoleIO getConsoleIO(String uid, String name) {
EclipseConsoleIO consoleIo = consoleIOMap.get(uid);
if (consoleIo == null) {
// create the eclipse console
IOConsole ioConsole = new IOConsole(name, null);
ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { ioConsole });
// ConsolePlugin.getDefault().getConsoleManager().showConsoleView(ioConsole);
// ioConsole.activate(); // console will be displayed on first use
// create the IO with this console
consoleIo = new EclipseConsoleIO(ioConsole);
consoleIOMap.put(uid, consoleIo);
}
return consoleIo;
}
Aggregations