public static PluginDependenciesConsole 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 PluginDependenciesConsole("Plug-in Dependencies", null, true); } if (!exists) { manager.addConsoles(new IConsole[] { console }); } ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); theme.addPropertyChangeListener(console); console.setConsoleFont(); manager.showConsoleView(console); return console; }
@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); } }
@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; }
@Override public void partOpened(IWorkbenchPart part) { super.partOpened(part); if (getComponentCanvas() != null) { ConsolePlugin plugin = ConsolePlugin.getDefault(); IConsoleManager conMan = plugin.getConsoleManager(); String consoleName = getComponentCanvas().getActiveProject() + "." + getComponentCanvas().getJobName(); IConsole consoleToShow = getConsole(consoleName, conMan); if (consoleToShow != null) { // Fix for : Console window is getting displayed if user maximize canvas window and then try to create new job (Ctrl+J) // conMan.showConsoleView(consoleToShow); } else { addDummyConsole(); } } }
/** * Get the console with the given name. If the console does not exist, then * a new one is created. * * @param name * @return */ public static MessageConsole getConsole(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())) { return (MessageConsole) existing[i]; } } // no console found, so create a new one MessageConsole console = new MessageConsole(name, null); conMan.addConsoles(new IConsole[] { console }); // create a new logger handler Logger.addHandler(new EclipseConsoleHandler(console)); return console; }
@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); } }
/** * Fins the console with a given name * @param name, name of the console * @return */ private static MessageConsole findConsole(String name) { if (name == null) { throw new IllegalArgumentException("Console name must be not null"); } IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager(); IConsole[] existing = consoleManager.getConsoles(); // try to find existing for (int i = 0; i < existing.length; i++) { if (name.equals(existing[i].getName())) { return (MessageConsole) existing[i]; } } // no console found, create a new one MessageConsole myConsole = new MessageConsole(name, null); consoleManager.addConsoles(new IConsole[] { myConsole }); return myConsole; }
/** * Finds the console with a given name. * * @param name, name of the console * @return */ private static MessageConsole findConsole(String name) { if (name == null) { throw new IllegalArgumentException("Console name must be not null"); } IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager(); IConsole[] existing = consoleManager.getConsoles(); // try to find existing for (int i = 0; i < existing.length; i++) { if (name.equals(existing[i].getName())) { return (MessageConsole) existing[i]; } } // no console found, create a new one MessageConsole myConsole = new MessageConsole(name, null); consoleManager.addConsoles(new IConsole[] { myConsole }); return myConsole; }
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); } }
private MessageConsole findConsole(String name) { ConsolePlugin plugin = ConsolePlugin.getDefault(); IConsoleManager conMan = plugin.getConsoleManager(); // search existing consoles IConsole[] existing = conMan.getConsoles(); for (int i = 0; i < existing.length; i++) { if (name.equals(existing[i].getName())){ return (MessageConsole) existing[i]; } } // no console found, so create a new one MessageConsole myConsole = new MessageConsole(name, null); conMan.addConsoles(new IConsole[]{myConsole}); conMan.showConsoleView(myConsole); return myConsole; }
private void showConsole() { ChangeOutPutConsole console = VariantSyncPlugin.getDefault().getConsole(); if (console != null) { IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); IConsole[] existing = manager.getConsoles(); boolean exist = false; for (int i = 0; i < existing.length; i++) { if (console == existing[i]) { exist = true; } } if (!exist) { manager.addConsoles(new IConsole[] { console }); } manager.showConsoleView(console); } }
/** * Shows a console for the given job. * * @param job a build that needs a console to be shown */ static public void show(BuildJob job) { // Retrieves the active workbench window and console manager. IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager(); Console console = null; if (consoles.containsKey(job)) { console = (Console) consoles.get(job); } else { console = new Console(job); consoleManager.addConsoles(new IConsole[] { console }); } // anb0s: refresh the name console.setName(job.getName()); // Shows the console view. console.activate(); }
/** * Returns a {@link CustomMessageConsole} with the given * <code>consoleName</code>. If no console by that name exists then one is * created. The returned console is cleared; callers of this method can decide * when to activate it. * * @param consoleName name of the console * @param imageDescriptor image descriptor to use * @return {@link CustomMessageConsole} with the given * <code>consoleName</code> */ public static CustomMessageConsole getMessageConsole(String consoleName, ImageDescriptor imageDescriptor) { CustomMessageConsole messageConsole = null; IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager(); for (IConsole console : consoleManager.getConsoles()) { if (console.getName().equals(consoleName) && console instanceof CustomMessageConsole) { messageConsole = (CustomMessageConsole) console; break; } } if (messageConsole == null) { messageConsole = new CustomMessageConsole(consoleName, imageDescriptor); consoleManager.addConsoles(new IConsole[] {messageConsole}); } else { messageConsole.clearConsole(); } return messageConsole; }
public static CustomMessageConsole getMessageConsoleKeepLog(String consoleName, ImageDescriptor imageDescriptor) { CustomMessageConsole messageConsole = null; IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager(); for (IConsole console : consoleManager.getConsoles()) { if (console.getName().equals(consoleName) && console instanceof CustomMessageConsole) { messageConsole = (CustomMessageConsole) console; break; } } if (messageConsole == null) { messageConsole = new CustomMessageConsole(consoleName, imageDescriptor); consoleManager.addConsoles(new IConsole[] {messageConsole}); } else { //messageConsole.clearConsole(); } return messageConsole; }
public static JDependConsole 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 JDependConsole("JDepend", null, true); } if (!exists) { manager.addConsoles(new IConsole[] { console }); } manager.showConsoleView(console); return console; }
protected void createConsole() { Display.getDefault().syncExec(new Runnable() { public void run() { IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); console = new MessageConsole(consoleName, null); manager.addConsoles(new IConsole[] { console }); try { Font font = new Font(Display.getCurrent(), "simsun", 9, SWT.NORMAL); console.setFont(font); } catch (SWTError error) { error.printStackTrace(); } mcs = console.newMessageStream(); black = Display.getCurrent().getSystemColor(SWT.COLOR_BLACK); red = Display.getCurrent().getSystemColor(SWT.COLOR_RED); mcs.setColor(black); manager.showConsoleView(console); } }); }
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; }
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; }
/** * Show the application console. If the given console is null, attempt * to find an existing console and use it. If the given console is null * and no existing consoles exist, exit without doing anything. * * @param myConsole An existing console. */ public static void displayConsole (IConsole myConsole) { // try to grab any old console and display it if given null if (myConsole == null) { final ConsolePlugin plugin = ConsolePlugin.getDefault(); final IConsoleManager conMan = plugin.getConsoleManager(); final IConsole[] existing = conMan.getConsoles(); if (existing.length == 0) return; for (final IConsole element : existing) myConsole = element; } ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] {myConsole}); ConsolePlugin.getDefault().getConsoleManager().showConsoleView(myConsole); }
public static void showConsole() { IvyConsole console = IvyPlugin.getDefault().getConsole(); if (console != null) { IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); boolean exists = false; for (IConsole existing : manager.getConsoles()) { if (console == existing) { exists = true; } } if (!exists) { manager.addConsoles(new IConsole[] {console}); } manager.showConsoleView(console); } }
/** * Get the MessageConsole for the plugin * * @return a MessageConsole (will create if it doesn't exist) */ public static MessageConsole findConsole() { ConsolePlugin plugin = ConsolePlugin.getDefault(); IConsoleManager conMan = plugin.getConsoleManager(); IConsole[] existing = conMan.getConsoles(); for (IConsole element : existing) { if (consoleName.equals(element.getName())) { return (MessageConsole) element; } } // no console found, so create a new one MessageConsole myConsole = new MessageConsole(consoleName, null); conMan.addConsoles(new IConsole[] { myConsole }); return myConsole; }
public static CppStyleMessageConsole buildConsole() { CppStyleMessageConsole console = null; ConsolePlugin plugin = ConsolePlugin.getDefault(); IConsoleManager conMan = plugin.getConsoleManager(); IConsole[] existing = conMan.getConsoles(); for (int i = 0; i < existing.length; i++) { if (CppStyleConstants.CONSOLE_NAME.equals(existing[i].getName())) { console = (CppStyleMessageConsole) existing[i]; } } if (console == null) { // no console found, so create a new one CppStyleConsolePatternMatchListener listener = new CppStyleConsolePatternMatchListener(); console = new CppStyleMessageConsole(listener); conMan.addConsoles(new IConsole[] { console }); } console.clear(); return console; }
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("FindBugs", null, true); } if (!exists) { manager.addConsoles(new IConsole[] { console }); } ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); theme.addPropertyChangeListener(console); console.setConsoleFont(); manager.showConsoleView(console); return console; }
public IOConsole getConsole() { if (console == null) { // create console IOConsole newConsole = new IOConsole("leJOS EV3", null, getImageDescriptor("icons/ev3.jpg"), LeJOSEV3Plugin.CONSOLE_CHARSET, false); // add to console manager ConsolePlugin cplugin = ConsolePlugin.getDefault(); IConsoleManager conMan = cplugin.getConsoleManager(); try { consoleWriter = new PrintWriter(new OutputStreamWriter(newConsole.newOutputStream(), CONSOLE_CHARSET), true); consoleReader = new BufferedReader(new InputStreamReader(newConsole.getInputStream(), CONSOLE_CHARSET)); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } conMan.addConsoles(new IConsole[] { newConsole }); this.console = newConsole; } return console; }
private MessageConsole getConsole(String name) { Activator plugin = Activator.getDefault(); IConsoleManager consoleManager = plugin.getConsoleManager(); IConsole[] existing = consoleManager.getConsoles(); LoggerUtil.logDebug("Consoles returned from ConsoleManager: " + existing.length); for (int i = 0; i < existing.length; i++) { if (name.equals(existing[i].getName())) { LoggerUtil.logDebug("Found console with name: " + name); MessageConsole messageConsole = (MessageConsole) existing[i]; messageConsole.clearConsole(); return messageConsole; } } LoggerUtil.logDebug("No console with name " + name + " was found, creating such.."); MessageConsole decompilerConsole = new MessageConsole(name, null); consoleManager.addConsoles(new IConsole[] { decompilerConsole }); return decompilerConsole; }
public MessageConsole minifierConsole() { IConsoleManager conMan = ConsolePlugin.getDefault().getConsoleManager(); IConsole[] existing = conMan.getConsoles(); for (int i = 0; i < existing.length; i++) if ("Minifier".equals(existing[i].getName())) return (MessageConsole) existing[i]; //no console found, so create a new one MessageConsole myConsole = new MessageConsole("Minifier", null); conMan.addConsoles(new IConsole[] { myConsole }); return myConsole; }
private ConsoleContext createOrGetConsole () { if ( this.parentController != null && this.parentController.getConsole () != null ) { return this.parentController.getConsole (); } final IConsoleManager manager = ConsolePlugin.getDefault ().getConsoleManager (); final MessageConsole messageConsole = new MessageConsole ( String.format ( "Symbol Debug Console: %s", this.symbolInfoName ), null, null, true ); manager.addConsoles ( new IConsole[] { messageConsole } ); this.createdConsole = messageConsole; return new ConsoleContext ( messageConsole ); }
private void createConsoles() { ConsolePlugin consolePlugin = ConsolePlugin.getDefault(); IConsoleManager consoleManager = consolePlugin.getConsoleManager(); stdoutConsole = new MessageConsole("Stdout", ImageDescriptor.createFromFile(getClass(), "/consoles/stdout.gif")); stdoutConsole.setTabWidth(TAB_WIDTH); stdoutConsoleStream = stdoutConsole.newMessageStream(); stderrConsoleStream = stdoutConsole.newMessageStream(); stderrConsoleStream.setColor(stderrConsoleStreamColor); engineConsole = new MessageConsole("Engine", ImageDescriptor.createFromFile(getClass(), "/consoles/engine.gif")); engineConsole.setTabWidth(TAB_WIDTH); engineConsoleStream = engineConsole.newMessageStream(); consoleManager.addConsoles(new IConsole[] { engineConsole, stdoutConsole }); consolePipes = new ConsolePipes(); debugConsoleStream = new MessageConsoleStream(engineConsole) { @Override public void write(String str) throws IOException { if (str.endsWith("\n")) { str = str.substring(0, str.length() - 1); } Engine.logStudio.info("[debug] " + str); } }; }
private static CodekeeperConsole findConsole() { CodekeeperConsole myConsole = null; IConsoleManager conMan = ConsolePlugin.getDefault().getConsoleManager(); for (IConsole c : conMan.getConsoles()) { if (c instanceof CodekeeperConsole) { myConsole = (CodekeeperConsole) c; } } if (myConsole == null) { myConsole = new CodekeeperConsole(); } conMan.addConsoles(new IConsole[] { myConsole }); return myConsole; }
/** * get message console object * * @param messageConsole * @return */ private MessageConsole getMessageConsole() { IConsoleManager conMan = getConsoleManager(); MessageConsole messageConsole = getConsoleFromExistingConsoles(conMan); if(messageConsole == null){ messageConsole = createNewMessageConsole(conMan); logger.debug("No existing console found, created new one"); } int lowWaterMark = getConsoleBufferSize(); messageConsole.setWaterMarks(lowWaterMark, lowWaterMark + DEFAULT_CONSOLE_HIGH_WATER_MARK_OFFSET); return messageConsole; }
/** * * get default console manager * * @return ConsoleManager */ private IConsoleManager getConsoleManager() { ConsolePlugin plugin = ConsolePlugin.getDefault(); logger.debug("Retrieved Console plugin object"); IConsoleManager conMan = plugin.getConsoleManager(); logger.debug("Retrieved Console manager"); return conMan; }
private void addDummyConsole() { ConsolePlugin plugin = ConsolePlugin.getDefault(); IConsoleManager conMan = plugin.getConsoleManager(); IConsole consoleToShow = getConsole(DEFAULT_CONSOLE, conMan); if (consoleToShow == null) { consoleToShow = createNewMessageConsole(DEFAULT_CONSOLE, conMan); } // Fix for : Console window is getting displayed if user maximize canvas window and then try to create new job (Ctrl+J) // conMan.showConsoleView(consoleToShow); }