org.eclipse.ui.console.ConsolePlugin Java Examples
The following examples show how to use
org.eclipse.ui.console.ConsolePlugin.
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: BuildConsoleManager.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
public IXdsConsole getAndConfigureConsole(String id) { final IXdsConsole console = consoleFactory.getXdsConsole(id); // default encoding required to print text with println(String) to ConsoleProxy.getInstance() console.setEncoding(null); if (XdsConsoleSettings.getShowOnBuild()) { ConsolePlugin.getDefault().getConsoleManager().showConsoleView((IConsole)console); } if (XdsConsoleSettings.getClearBeforeBuild()) { console.clearConsole(); } // Console.setBackground is ignored in console constructor (console has no view at that time) so set it here: Display.getDefault().asyncExec(new Runnable() { @Override public void run() { console.setBackground(ColorStreamType.BACKGROUND.getRgb()); } }); return console; }
Example #2
Source File: ConsoleUtils.java From goclipse with Eclipse Public License 1.0 | 6 votes |
public static <T extends IConsole> T getOrCreateToolsConsole(String name, boolean clearConsole, Class<T> klass, SimpleGetter<T> consoleCreator) { T console = findConsole(name, klass); if(console != null) { if(clearConsole) { // In order to clear a console, we recreate it. // This is to avoid using console.clearConsole() , because of poor concurrency behavior: // if more than one cleanConsole is requested per a console lifetime, // these aditional clears may appear out of order with regards // to input written to the console output streams. // since org.eclipse.ui.console_3.5.200.v20130514-0954 ConsolePlugin.getDefault().getConsoleManager().removeConsoles(array(console)); console = null; } else { return console; } } // create a new one console = consoleCreator.get(); ConsolePlugin.getDefault().getConsoleManager().addConsoles(array(console)); return console; }
Example #3
Source File: ConsoleFactory.java From CodeCheckerEclipsePlugin with Eclipse Public License 1.0 | 6 votes |
@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 #4
Source File: TLAPMConsoleFactory.java From tlaplus with MIT License | 6 votes |
/** * 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; }
Example #5
Source File: CppStyle.java From CppStyle with MIT License | 6 votes |
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; }
Example #6
Source File: FindBugsConsole.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
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 #7
Source File: ConsoleFactory.java From tlaplus with MIT License | 6 votes |
/** * Fins the console with a given name * @param name, name of the console * @return */ private static IOConsole 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 (IOConsole) existing[i]; } } // no console found, create a new one IOConsole myConsole = new IOConsole(name, null); consoleManager.addConsoles(new IConsole[] { myConsole }); return myConsole; }
Example #8
Source File: RunSelectedSequenceDiagramHandler.java From txtUML with Eclipse Public License 1.0 | 6 votes |
/** * Searches for a console with the name "Sequence Diagram Console" and * returns it if it was found. If the console was not found creates a new * one and returns it. */ private MessageConsole findConsole() { final String seqDiagConsoleName = "Sequence Diagram Console"; ConsolePlugin plugin = ConsolePlugin.getDefault(); IConsoleManager conMan = plugin.getConsoleManager(); IConsole[] existing = conMan.getConsoles(); Optional<IConsole> seqConsole = Stream.of(existing) .filter(console -> console.getName().equals(seqDiagConsoleName)).findFirst(); if (seqConsole.isPresent()) { return (MessageConsole) seqConsole.get(); } else { MessageConsole newSeqConsole = new MessageConsole(seqDiagConsoleName, null); conMan.addConsoles(new IConsole[] { newSeqConsole }); return newSeqConsole; } }
Example #9
Source File: YangToYin.java From yang-design-studio with Eclipse Public License 1.0 | 6 votes |
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: 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 #11
Source File: BuilderStateLogger.java From n4js with Eclipse Public License 1.0 | 6 votes |
@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 #12
Source File: StartItemTrace.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@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 #13
Source File: YangToUML.java From yang-design-studio with Eclipse Public License 1.0 | 6 votes |
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 #14
Source File: YangToJSTREE.java From yang-design-studio with Eclipse Public License 1.0 | 6 votes |
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 #15
Source File: YangToXslt.java From yang-design-studio with Eclipse Public License 1.0 | 6 votes |
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 #16
Source File: YangToTree.java From yang-design-studio with Eclipse Public License 1.0 | 6 votes |
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 #17
Source File: YangToDsdl.java From yang-design-studio with Eclipse Public License 1.0 | 6 votes |
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 #18
Source File: YangToSkelxml.java From yang-design-studio with Eclipse Public License 1.0 | 6 votes |
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 #19
Source File: YangToPNG.java From yang-design-studio with Eclipse Public License 1.0 | 6 votes |
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 #20
Source File: XdsConsolePreferencePage.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
private void doApply() { // TODO : these settings should be stored under com.excelsior.xds.ui preference store. XdsConsoleSettings.setShowOnBuild(cbShowWhenBuild.getSelection()); XdsConsoleSettings.setClearBeforeBuild(cbClearBeforeBuild.getSelection()); ColorStreamType.NORMAL.setRgb(csText.getColorValue()); ColorStreamType.SYSTEM.setRgb(csInfo.getColorValue()); ColorStreamType.ERROR.setRgb(csError.getColorValue()); ColorStreamType.XDS_LOG_ERROR.setRgb(csCompError.getColorValue()); ColorStreamType.XDS_LOG_WARNING.setRgb(csCompWarning.getColorValue()); ColorStreamType.USER_INPUT.setRgb(csUserInput.getColorValue()); ColorStreamType.BACKGROUND.setRgb(csBackground.getColorValue()); // Force background change: for (IConsole con : ConsolePlugin.getDefault().getConsoleManager().getConsoles()) { if (con instanceof TextConsole) { ((TextConsole) con).setBackground(new Color(Display.getDefault(), csBackground.getColorValue())); } } WorkspacePreferencesManager.getInstance().flush(); }
Example #21
Source File: MessageConsoleUtilities.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
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; }
Example #22
Source File: MessageConsoleUtilities.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
/** * 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; }
Example #23
Source File: ConsoleTail.java From LogViewer with Eclipse Public License 2.0 | 6 votes |
private IConsole findConsole() throws FileNotFoundException { ConsolePlugin conPlugin = ConsolePlugin.getDefault(); IConsoleManager conMan = conPlugin.getConsoleManager(); IConsole[] existing = conMan.getConsoles(); int nameFoundIndex = -1; for (int i = 0; i < existing.length; i++) { // check full name first if (getConsolePath(existing[i]).equals(getPath())) { return existing[i]; } // check short name if not already found int flags = 0; flags = java.util.regex.Pattern.CASE_INSENSITIVE | java.util.regex.Pattern.UNICODE_CASE; regexp = Pattern.compile(getNamePattern(), flags); if ((nameFoundIndex == -1) && regexp.matcher(existing[i].getName()).matches()) { nameFoundIndex = i; } } if (nameFoundIndex != -1) { return existing[nameFoundIndex]; } throw new FileNotFoundException("no console found"); }
Example #24
Source File: XtextBuildConsole.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@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 #25
Source File: LogFileTypeDialog.java From LogViewer with Eclipse Public License 2.0 | 6 votes |
protected Control createDialogArea(Composite parent) { String fileTypeName = "File"; // create composite Composite composite = (Composite) super.createDialogArea(parent); // create combo typeCombo = new Combo(composite,SWT.LEFT); GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); typeCombo.setLayoutData(data); // fill IConsole[] consoles = ConsolePlugin.getDefault().getConsoleManager().getConsoles(); typeCombo.add(fileTypeName); value = fileTypeName; for (int i=0;i<consoles.length;i++) { typeCombo.add("Console: " + consoles[i].getName()); } applyDialogFont(composite); return composite; }
Example #26
Source File: YangToXSD.java From yang-design-studio with Eclipse Public License 1.0 | 6 votes |
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 #27
Source File: DebugConsoleAction.java From Pydev with Eclipse Public License 1.0 | 5 votes |
@Override public void run(IAction action) { try { AnyPyStackFrameSelected anyPyStackFrameSelected = new AnyPyStackFrameSelected(); PyStackFrame suspendedFrame = anyPyStackFrameSelected.getLastSelectedFrame(); fFactory.createDebugConsole(suspendedFrame, null, true, true, anyPyStackFrameSelected); } catch (Exception e) { ConsolePlugin.log(e); } }
Example #28
Source File: SVNOutputConsole.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
private void bringConsoleToFront() { IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); if(! visible) { manager.addConsoles(new IConsole[] {this}); } manager.showConsoleView(this); }
Example #29
Source File: TypeScriptConsoleHelper.java From typescript.java with MIT License | 5 votes |
public static void closeConsole(IConsole console) { IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); if (console != null) { manager.removeConsoles(new IConsole[] { console }); // ConsolePlugin.getDefault().getConsoleManager() // .addConsoleListener(console.new MyLifecycle()); } }
Example #30
Source File: TLAPMConsoleFactory.java From tlaplus with MIT License | 5 votes |
/** * Opens a generic console view using {@link TLAPMConsoleFactory#TLAPM_CONSOLE_ID} as the * console name so that it can be found later. */ public void openConsole() { IWorkbenchPage activePage = UIHelper.getActivePage(); if (activePage != null) { try { activePage.showView(IConsoleConstants.ID_CONSOLE_VIEW, TLAPM_CONSOLE_ID, IWorkbenchPage.VIEW_ACTIVATE); } catch (PartInitException e) { ConsolePlugin.log(e); } } }