Java Code Examples for org.eclipse.ui.console.MessageConsole#newMessageStream()
The following examples show how to use
org.eclipse.ui.console.MessageConsole#newMessageStream() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConsoleOutputStreamProvider.java From n4js with Eclipse Public License 1.0 | 6 votes |
@Override public OutputStream getOutputStream(final OutputStreamType type, OutputRedirection redirect) { if (!PlatformUI.isWorkbenchRunning()) { return DEFAULT.getOutputStream(type, redirect); } final MessageConsole console = consoleSupplier.get(); boolean silent = redirect == OutputRedirection.SUPPRESS; if (!silent) { console.activate(); } ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { console }); final MessageConsoleStream stream = console.newMessageStream(); getDisplay().asyncExec(() -> { stream.setColor(toColor(type)); showConsoleView(silent); }); return stream; }
Example 2
Source File: ConsoleContext.java From neoscada with Eclipse Public License 1.0 | 5 votes |
public ConsoleContext ( final MessageConsole messageConsole ) { this.writerStream = messageConsole.newMessageStream (); final MessageConsoleStream errorStream = messageConsole.newMessageStream (); errorStream.setColor ( Display.getDefault ().getSystemColor ( SWT.COLOR_RED ) ); this.errorPrintWriter = new PrintWriter ( new OutputStreamWriter ( errorStream ) ); this.logStream = messageConsole.newMessageStream (); this.logStream.setColor ( Display.getDefault ().getSystemColor ( SWT.COLOR_GRAY ) ); }
Example 3
Source File: CommandConsoleFactoryImpl.java From eclipse with Apache License 2.0 | 5 votes |
@Override public CommandConsole get(String name, String title) throws IOException { MessageConsole console = findConsole(name); MessageConsoleStream stream = console.newMessageStream(); stream.setActivateOnWrite(true); stream.write("*** " + title + " ***\n"); return new CommandConsoleImpl(console); }
Example 4
Source File: CloudSdkModifyJob.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
@VisibleForTesting MessageConsoleStream createNewMessageConsole() { MessageConsole console = MessageConsoleUtilities.getMessageConsole( Messages.getString("configuring.cloud.sdk"), // $NON-NLS-1$ null /* imageDescriptor */); setProperty(IProgressConstants.ACTION_PROPERTY, new ShowConsoleViewAction(console)); return console.newMessageStream(); }
Example 5
Source File: ResourceLoadStatsHandler.java From n4js with Eclipse Public License 1.0 | 4 votes |
private PrintStream getConsolePrintStream() { final MessageConsole console = EclipseUtils.getOrCreateConsole("Resource Loading Statistics", true, true); final PrintStream out = new PrintStream(console.newMessageStream()); return out; }
Example 6
Source File: DockerClientMessageConsole.java From doclipser with Eclipse Public License 1.0 | 4 votes |
public DockerClientMessageConsole(String name) { ConsolePlugin plugin = ConsolePlugin.getDefault(); IConsoleManager conMan = plugin.getConsoleManager(); IConsole[] existing = conMan.getConsoles(); for (int i = 0; i < existing.length; i++) { if (name.equals(existing[i].getName())) { dockerMessageConsole = (MessageConsole) existing[i]; dockerConsoleOut = dockerMessageConsole.newMessageStream(); return; } } // no console found, so create a new one Bundle bundle = Platform.getBundle("com.zenika.doclipser.api"); ImageDescriptor imageDcr = ImageDescriptor.createFromURL( FileLocator.find(bundle, new Path("icons/docker-solo.gif"), null)); MessageConsole dockerConsole = new MessageConsole(name, imageDcr); conMan.addConsoles(new IConsole[] { dockerConsole }); dockerMessageConsole = dockerConsole; dockerConsoleOut = dockerMessageConsole.newMessageStream(); // Currently does not work: win is always null // (I guess because we are not in the main UI Thread) // // // get current active page // IWorkbench wb = PlatformUI.getWorkbench(); // IWorkbenchWindow win = wb.getActiveWorkbenchWindow(); // // // on new versions it may need to be changed to: // IWorkbenchPage page = win.getActivePage(); // // // Reveal the console view // String id = IConsoleConstants.ID_CONSOLE_VIEW; // IConsoleView view; // try { // view = (IConsoleView) page.showView(id); // view.display(dockerConsole); // } catch (PartInitException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } }
Example 7
Source File: DGwtDevJarArgumentProcessor.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 4 votes |
/** * Returns the path to the gwt-dev-xxx.jar in the event that the launch configuration depends on a * GWT Contributor Runtime. Otherwise, returns the empty string. */ private static String maybeGetDevJarPath(IJavaProject project) { /* * In order to figure out whether or not to add the -Dgwt.devjar argument to the list of VM * args, we have to figure out the runtime that this launch configuration depends on. If the * project is one of the GWT Runtime projects, then we'll definitely have to add the * -Dgwt.devjar argument to the launch configuration. */ try { if (GWTProjectsRuntime.isGWTRuntimeProject(project)) { // Synthesize a temporary contributor SDK so that we can use it // to compute the devjar path GwtSdk tempContribSDK = GWTProjectsRuntime.syntheziseContributorRuntime(); if (tempContribSDK.validate().isOK()) { return tempContribSDK.getDevJar().getAbsolutePath(); } else { return ""; } } GwtSdk sdk = GwtSdk.findSdkFor(project); if (sdk == null) { MessageConsole messageConsole = MessageConsoleUtilities.getMessageConsole(project.getProject().getName() + "-GWT", null); messageConsole.activate(); ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] {messageConsole}); final ConsoleColorProvider consoleColorProvider = new ConsoleColorProvider(); final MessageConsoleStream console = messageConsole.newMessageStream(); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { console.setColor(consoleColorProvider.getColor(IDebugUIConstants.ID_STANDARD_ERROR_STREAM)); } }); console.println("GWT SDK not installed."); try { console.close(); } catch (IOException e) { GWTPluginLog.logError(e, "Unable to close output stream to console"); } return ""; } else if (sdk.usesGwtDevProject()) { File gwtDevJarFile = sdk.getDevJar(); return gwtDevJarFile.getAbsolutePath(); } } catch (SdkException sdke) { GWTPluginLog.logError(sdke, "Unable to extract gwt dev jar argument from GWTProjectsRuntime"); } catch (JavaModelException jme) { GWTPluginLog.logError(jme, "Unable to extract gwt dev jar argument from GWTProjectsRuntime"); } return ""; }
Example 8
Source File: ConsoleUtils.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 2 votes |
/** * Returns {@link MessageConsoleStream} to the plugin console * * @return message console stream */ public static MessageConsoleStream getConsoleStream() { final MessageConsole pluginConsole = findConsole(PLUGIN); return pluginConsole.newMessageStream(); }