use of org.eclipse.ui.console.IConsole 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.IConsole 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.IConsole 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.IConsole in project linuxtools by eclipse.
the class RunConsole method findConsole.
/**
* Returns a reference to the console that is for the given container id. If
* such a console does not yet exist, it will be created.
*
* @param containerId
* The container this console will be for. Must not be
* <code>null</code>.
* @param id
* The secondary id used to identify consoles belonging to
* various owners.
* @param name
* the name of the console to create if it did not already exist
* @return A console instance.
*/
public static RunConsole findConsole(String containerId, String id, String name) {
RunConsole ret = null;
for (IConsole cons : ConsolePlugin.getDefault().getConsoleManager().getConsoles()) {
if (cons instanceof RunConsole && ((RunConsole) cons).containerId.equals(containerId) && ((RunConsole) cons).id.equals(id)) {
ret = (RunConsole) cons;
}
}
// no existing console, create new one
if (ret == null) {
ret = new RunConsole(containerId, id, name);
ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { ret });
}
return ret;
}
use of org.eclipse.ui.console.IConsole 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