use of org.eclipse.ui.console.IConsoleManager 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.IConsoleManager 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.IConsoleManager in project sling by apache.
the class SlingConsoleFactory method openConsole.
@Override
public void openConsole() {
IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
initConsole(consoleManager);
consoleManager.showConsoleView(console);
}
use of org.eclipse.ui.console.IConsoleManager in project sling by apache.
the class SlingConsoleEventListener method handleEvent.
@Override
public void handleEvent(Event event) {
synchronized (sync) {
initSlingConsole();
if (slingConsole != null) {
logEvent(event, slingConsole);
return;
}
delayedEvents.add(event);
final IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
if (listener == null) {
listener = new IConsoleListener() {
@Override
public void consolesRemoved(IConsole[] consoles) {
synchronized (sync) {
for (IConsole console : consoles) {
if (console.equals(slingConsole)) {
slingConsole = null;
}
}
}
}
@Override
public void consolesAdded(IConsole[] consoles) {
synchronized (sync) {
for (IConsole console : consoles) {
if (console.getType().equals(SlingConsoleFactory.CONSOLE_TYPE_SLING)) {
slingConsole = (MessageConsole) console;
synchronized (delayedEvents) {
for (Iterator<Event> it = delayedEvents.iterator(); it.hasNext(); ) {
logEvent(it.next(), slingConsole);
it.remove();
}
}
consoleManager.removeConsoleListener(listener);
listener = null;
break;
}
}
}
}
};
consoleManager.addConsoleListener(listener);
}
}
}
use of org.eclipse.ui.console.IConsoleManager in project linuxtools by eclipse.
the class SpecfileEditorPrepareSourcesActionDelegate method getConsole.
/**
* Get the console.
*
* @param packageName
* The name of the package(RPM) this console will be for.
* @return A console instance.
*/
public MessageConsole getConsole(String packageName) {
ConsolePlugin plugin = ConsolePlugin.getDefault();
IConsoleManager conMan = plugin.getConsoleManager();
String projectConsoleName = NLS.bind(Messages.PrepareSources_consoleName, packageName);
MessageConsole ret = null;
for (IConsole cons : ConsolePlugin.getDefault().getConsoleManager().getConsoles()) {
if (cons.getName().equals(projectConsoleName)) {
ret = (MessageConsole) cons;
}
}
// no existing console, create new one
if (ret == null) {
ret = new MessageConsole(projectConsoleName, null, null, true);
}
conMan.addConsoles(new IConsole[] { ret });
ret.clearConsole();
ret.activate();
return ret;
}
Aggregations