Java Code Examples for org.eclipse.ui.console.IConsoleManager#showConsoleView()

The following examples show how to use org.eclipse.ui.console.IConsoleManager#showConsoleView() . 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: StartItemTrace.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    final List<IConsole> consoles = new ArrayList<IConsole> ();

    for ( final Item item : SelectionHelper.iterable ( getSelection (), Item.class ) )
    {
        final IConsole console = createConsole ( item ).getConsole ();
        if ( console != null )
        {
            consoles.add ( console );
        }
    }

    final IConsoleManager cm = ConsolePlugin.getDefault ().getConsoleManager ();
    if ( !consoles.isEmpty () )
    {
        cm.addConsoles ( consoles.toArray ( new IConsole[consoles.size ()] ) );
        cm.showConsoleView ( consoles.get ( 0 ) );
    }

    return null;
}
 
Example 2
Source File: YangToYin.java    From yang-design-studio with Eclipse Public License 1.0 6 votes vote down vote up
private static MessageConsole findConsole(String name) {//Find and return console, otherwise make one

            			if (ConsolePlugin.getDefault() == null)
            				return null;
            			ConsolePlugin plugin = ConsolePlugin.getDefault();
            			IConsoleManager YangConsole = plugin.getConsoleManager();
            			IConsole[] existing = YangConsole.getConsoles();
            			for (int i = 0; i < existing.length; i++)
            				if (name.equals(existing[i].getName())) {
            					YangConsole.showConsoleView(existing[i]);
            					return (MessageConsole) existing[i];
            				}
            			MessageConsole myConsole = new MessageConsole(name, null);
            			YangConsole.addConsoles(new IConsole[] { myConsole });
            			return myConsole;
            		}
 
Example 3
Source File: YangToUML.java    From yang-design-studio with Eclipse Public License 1.0 6 votes vote down vote up
private static MessageConsole findConsole(String name) {//Find and return console, otherwise make one

          			if (ConsolePlugin.getDefault() == null)
          				return null;
          			ConsolePlugin plugin = ConsolePlugin.getDefault();
          			IConsoleManager YangConsole = plugin.getConsoleManager();
          			IConsole[] existing = YangConsole.getConsoles();
          			for (int i = 0; i < existing.length; i++)
          				if (name.equals(existing[i].getName())) {
          					YangConsole.showConsoleView(existing[i]);
          					return (MessageConsole) existing[i];
          				}
          			MessageConsole myConsole = new MessageConsole(name, null);
          			YangConsole.addConsoles(new IConsole[] { myConsole });
          			return myConsole;
          		}
 
Example 4
Source File: YangToJSTREE.java    From yang-design-studio with Eclipse Public License 1.0 6 votes vote down vote up
private static MessageConsole findConsole(String name) {//Find and return console, otherwise make one

   if (ConsolePlugin.getDefault() == null)
    	return null;
   ConsolePlugin plugin = ConsolePlugin.getDefault();
   IConsoleManager YangConsole = plugin.getConsoleManager();
   IConsole[] existing = YangConsole.getConsoles();
   for (int i = 0; i < existing.length; i++)
      if (name.equals(existing[i].getName())) {
      	YangConsole.showConsoleView(existing[i]);
      	return (MessageConsole) existing[i];
      }
   // no console found, so create a new one
   MessageConsole myConsole = new MessageConsole(name, null);
   YangConsole.addConsoles(new IConsole[] { myConsole });
   return myConsole;
}
 
Example 5
Source File: YangToXslt.java    From yang-design-studio with Eclipse Public License 1.0 6 votes vote down vote up
private static MessageConsole findConsole(String name) {//Find and return console, otherwise make one

   if (ConsolePlugin.getDefault() == null)
    	return null;
   ConsolePlugin plugin = ConsolePlugin.getDefault();
   IConsoleManager YangConsole = plugin.getConsoleManager();
   IConsole[] existing = YangConsole.getConsoles();
   for (int i = 0; i < existing.length; i++)
      if (name.equals(existing[i].getName())) {
      	YangConsole.showConsoleView(existing[i]);
      	return (MessageConsole) existing[i];
      }
   MessageConsole myConsole = new MessageConsole(name, null);
   YangConsole.addConsoles(new IConsole[] { myConsole });
   return myConsole;
}
 
Example 6
Source File: YangToXSD.java    From yang-design-studio with Eclipse Public License 1.0 6 votes vote down vote up
private static MessageConsole findConsole(String name) {//Find and return console, otherwise make one

   if (ConsolePlugin.getDefault() == null)
    	return null;
   ConsolePlugin plugin = ConsolePlugin.getDefault();
   IConsoleManager YangConsole = plugin.getConsoleManager();
   IConsole[] existing = YangConsole.getConsoles();
   for (int i = 0; i < existing.length; i++)
      if (name.equals(existing[i].getName())) {
      	YangConsole.showConsoleView(existing[i]);
      	return (MessageConsole) existing[i];
      }
   MessageConsole myConsole = new MessageConsole(name, null);
   YangConsole.addConsoles(new IConsole[] { myConsole });
   return myConsole;
}
 
Example 7
Source File: YangToTree.java    From yang-design-studio with Eclipse Public License 1.0 6 votes vote down vote up
private static MessageConsole findConsole(String name) {//Find and return console, otherwise make one

          			if (ConsolePlugin.getDefault() == null)
          				return null;
          			ConsolePlugin plugin = ConsolePlugin.getDefault();
          			IConsoleManager YangConsole = plugin.getConsoleManager();
          			IConsole[] existing = YangConsole.getConsoles();
          			for (int i = 0; i < existing.length; i++)
          				if (name.equals(existing[i].getName())) {
          					YangConsole.showConsoleView(existing[i]);
          					return (MessageConsole) existing[i];
          				}
          			MessageConsole myConsole = new MessageConsole(name, null);
          			YangConsole.addConsoles(new IConsole[] { myConsole });
          			return myConsole;
          		}
 
Example 8
Source File: YangToDsdl.java    From yang-design-studio with Eclipse Public License 1.0 6 votes vote down vote up
private static MessageConsole findConsole(String name) {//Find and return console, otherwise make one

   if (ConsolePlugin.getDefault() == null)
    	return null;
   ConsolePlugin plugin = ConsolePlugin.getDefault();
   IConsoleManager YangConsole = plugin.getConsoleManager();
   IConsole[] existing = YangConsole.getConsoles();
   for (int i = 0; i < existing.length; i++)
      if (name.equals(existing[i].getName())) {
      	YangConsole.showConsoleView(existing[i]);
      	return (MessageConsole) existing[i];
      }
   // no console found, so create a new one
   MessageConsole myConsole = new MessageConsole(name, null);
   YangConsole.addConsoles(new IConsole[] { myConsole });
   return myConsole;
}
 
Example 9
Source File: YangToSkelxml.java    From yang-design-studio with Eclipse Public License 1.0 6 votes vote down vote up
private static MessageConsole findConsole(String name) {//Find and return console, otherwise make one

   if (ConsolePlugin.getDefault() == null)
    	return null;
   ConsolePlugin plugin = ConsolePlugin.getDefault();
   IConsoleManager YangConsole = plugin.getConsoleManager();
   IConsole[] existing = YangConsole.getConsoles();
   for (int i = 0; i < existing.length; i++)
      if (name.equals(existing[i].getName())) {
      	YangConsole.showConsoleView(existing[i]);
      	return (MessageConsole) existing[i];
      }
   MessageConsole myConsole = new MessageConsole(name, null);
   YangConsole.addConsoles(new IConsole[] { myConsole });
   return myConsole;
}
 
Example 10
Source File: YangToPNG.java    From yang-design-studio with Eclipse Public License 1.0 6 votes vote down vote up
private static MessageConsole findConsole(String name) {//Find and return console, otherwise make one

		if (ConsolePlugin.getDefault() == null)
			return null;
		ConsolePlugin plugin = ConsolePlugin.getDefault();
		IConsoleManager YangConsole = plugin.getConsoleManager();
		IConsole[] existing = YangConsole.getConsoles();
		for (int i = 0; i < existing.length; i++)
			if (name.equals(existing[i].getName())) {
				YangConsole.showConsoleView(existing[i]);
				return (MessageConsole) existing[i];
			}
		MessageConsole myConsole = new MessageConsole(name, null);
		YangConsole.addConsoles(new IConsole[] { myConsole });
		return myConsole;
	}
 
Example 11
Source File: TypeScriptConsoleHelper.java    From typescript.java with MIT License 6 votes vote down vote up
public static void showConsole(IConsole console) {
	if (console != null) {
		IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
		IConsole[] existing = manager.getConsoles();
		boolean exists = false;
		for (int i = 0; i < existing.length; i++) {
			if (console == existing[i]) {
				exists = true;
			}
		}
		if (!exists) {
			manager.addConsoles(new IConsole[] { console });
		}
		manager.showConsoleView(console);
	}
}
 
Example 12
Source File: ConsoleFactory.java    From CodeCheckerEclipsePlugin with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void openConsole() {
    console = getConsole();
    if (console != null) {
        IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
        IConsole[] existing = manager.getConsoles();
        boolean exists = false;
        for (int i = 0; i < existing.length; i++) {
            if(console == existing[i])
                exists = true;
        }
        if(!exists)
            manager.addConsoles(new IConsole[] {console});
        manager.showConsoleView(console);
    }
}
 
Example 13
Source File: FindBugsConsole.java    From spotbugs with GNU Lesser General Public License v2.1 6 votes vote down vote up
public static FindBugsConsole showConsole() {
    IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
    boolean exists = false;
    if (console != null) {
        IConsole[] existing = manager.getConsoles();
        for (int i = 0; i < existing.length; i++) {
            if (console == existing[i]) {
                exists = true;
            }
        }
    } else {
        console = new FindBugsConsole("SpotBugs",
                FindbugsPlugin.getDefault().getImageDescriptor(AbstractFindbugsView.PERSPECTIVE_IMG), true);
    }
    if (!exists) {
        manager.addConsoles(new IConsole[] { console });
    }
    ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
    theme.addPropertyChangeListener(console);
    console.setConsoleFont();
    manager.showConsoleView(console);
    return console;
}
 
Example 14
Source File: XtextBuildConsole.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void log(Object obj) {
	if (delegate != null) {
		delegate.log(obj);
	}

	IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
	XtextBuildConsole console = null;
	for (IConsole c : consoleManager.getConsoles()) {
		if (c instanceof XtextBuildConsole) {
			console = (XtextBuildConsole) c;
			break;
		}
	}
	if (console != null) {
		String str = null;
		if (obj instanceof Throwable) {
			str = Throwables.getStackTraceAsString((Throwable) obj);
		} else {
			str = obj.toString();
		}
		console.println("[" + Thread.currentThread().getName() + "] " + str);
		consoleManager.showConsoleView(console);
	}
}
 
Example 15
Source File: BuilderStateLogger.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void log(final Object o) {

	final IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
	final BuilderStateConsole console = from(asList(manager.getConsoles())).filter(BuilderStateConsole.class)
			.first()
			.orNull();

	if (console != null) {
		if (o instanceof Throwable) {
			console.println(getStackTraceAsString((Throwable) o));
		} else {
			console.println(String.valueOf(o));
		}
		manager.showConsoleView(console);
	}

}
 
Example 16
Source File: SVNOutputConsole.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void bringConsoleToFront() {
    IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
    if(! visible) {
        manager.addConsoles(new IConsole[] {this});
    }
    manager.showConsoleView(this);
}
 
Example 17
Source File: SVNOutputConsoleFactory.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public static void showConsole() {
	SVNOutputConsole console = SVNUIPlugin.getPlugin().getConsole();
	if (console != null) {
		IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
		IConsole[] existing = manager.getConsoles();
		boolean exists = false;
		for (int i = 0; i < existing.length; ++i) {
			if(console == existing[i])
				exists = true;
		}
		if(! exists)
			manager.addConsoles(new IConsole[] {console});
		manager.showConsoleView(console);
	}
}
 
Example 18
Source File: StatechartLaunchShortcut.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
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);
			}
		}
	}
}
 
Example 19
Source File: DeployCommandHandler.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private void launchDeployJob(IProject project, Credential credential)
    throws IOException, CoreException {
  sendAnalyticsPing(AnalyticsEvents.APP_ENGINE_DEPLOY);

  IPath workDirectory = createWorkDirectory();
  DeployPreferences deployPreferences = getDeployPreferences(project);

  DeployConsole messageConsole =
      MessageConsoleUtilities.createConsole(getConsoleName(deployPreferences.getProjectId()),
                                            new DeployConsole.Factory());
  IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
  consoleManager.showConsoleView(messageConsole);
  ConsoleColorProvider colorProvider = new ConsoleColorProvider();
  MessageConsoleStream outputStream = messageConsole.newMessageStream();
  MessageConsoleStream errorStream = messageConsole.newMessageStream();
  outputStream.setActivateOnWrite(true);
  errorStream.setActivateOnWrite(true);
  outputStream.setColor(colorProvider.getColor(IDebugUIConstants.ID_STANDARD_OUTPUT_STREAM));
  errorStream.setColor(colorProvider.getColor(IDebugUIConstants.ID_STANDARD_ERROR_STREAM));

  StagingDelegate stagingDelegate = getStagingDelegate(project);

  DeployJob deploy = new DeployJob(deployPreferences, credential, workDirectory,
      outputStream, errorStream, stagingDelegate);
  messageConsole.setJob(deploy);
  deploy.addJobChangeListener(new JobChangeAdapter() {

    @Override
    public void done(IJobChangeEvent event) {
      if (event.getResult().isOK()) {
        sendAnalyticsPing(AnalyticsEvents.APP_ENGINE_DEPLOY_SUCCESS);
      }
      launchCleanupJob();
    }
  });
  deploy.schedule();
}
 
Example 20
Source File: SootPlugin.java    From JAADAS with GNU General Public License v3.0 4 votes vote down vote up
public void showConsole() {
ConsolePlugin plugin = ConsolePlugin.getDefault();
IConsoleManager conMan = plugin.getConsoleManager();
conMan.showConsoleView(getConsole());
  }