Java Code Examples for org.eclipse.ui.console.MessageConsoleStream#println()

The following examples show how to use org.eclipse.ui.console.MessageConsoleStream#println() . 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: ConsoleUtils.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * Prints error message to the console.
 * 
 * @param message error message to print
 */
public static void printError(final String message) {
	final Display display = PlatformUI.getWorkbench().getDisplay();
	final MessageConsoleStream consoleStream = getConsoleStream();
	final Color color = new Color(display, new RGB(255, 0, 0));
	
	consoleStream.setColor(color);
	consoleStream.println(message);
}
 
Example 2
Source File: ConsoleFactory.java    From CodeCheckerEclipsePlugin with Eclipse Public License 1.0 4 votes vote down vote up
public static void consoleWrite(String msg) {
    console = getConsole();
    MessageConsoleStream out = console.newMessageStream();
    out.println(msg);
}
 
Example 3
Source File: Console.java    From cppcheclipse with Apache License 2.0 4 votes vote down vote up
public void println(String line) throws IOException {
	final MessageConsoleStream output = messageConsole.newMessageStream();
	output.println(line);
	output.close();
}
 
Example 4
Source File: DGwtDevJarArgumentProcessor.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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 "";
}