类org.eclipse.ui.console.IOConsole源码实例Demo

下面列出了怎么用org.eclipse.ui.console.IOConsole的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: codewind-eclipse   文件: CodewindConsoleFactory.java
private static void onNewConsole(IOConsole console) {
	IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();

	// See if a console exists matching this one and remove it if it does,
	// so that we don't have multiple of the same console (they would be identical anyway)
	IConsole[] existingMCConsoles = consoleManager.getConsoles();
	for (IConsole existingConsole : existingMCConsoles) {
		if (existingConsole.getName().equals(console.getName())) {
			consoleManager.removeConsoles(new IConsole[] { existingConsole } );
			break;
		}
	}
		
	Logger.log(String.format("Creating new application console: %s of type %s", 				//$NON-NLS-1$
			console.getName(), console.getClass().getSimpleName()));

	consoleManager.addConsoles(new IConsole[] { console });
}
 
源代码2 项目: tlaplus   文件: ConsoleFactory.java
/**
 * 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;
}
 
源代码3 项目: Pydev   文件: ConsoleColorCache.java
private void addRef(IOConsole console) {
    synchronized (referencesLock) {
        //We'll clear the current references and add the new one if it's not there already.
        int size = weakrefs.size();
        for (int i = 0; i < size; i++) {
            WeakReference<IOConsole> ref = weakrefs.get(i);
            Object object = ref.get();
            if (object == console) {
                return; //already there (nothing to add).
            }
            if (object == null) {
                weakrefs.remove(i);
                i--;
                size--;
            }
        }
        //Add the new reference.
        weakrefs.add(new WeakReference<IOConsole>(console));
    }
}
 
源代码4 项目: Pydev   文件: ConsoleColorCache.java
private ArrayList<IOConsole> getCurrentRefs() {
    int size = weakrefs.size();
    ArrayList<IOConsole> currentRefs = new ArrayList<IOConsole>(size);
    for (int i = 0; i < size; i++) {
        WeakReference<IOConsole> ref = weakrefs.get(i);
        IOConsole object = ref.get();
        if (object == null) {
            weakrefs.remove(i);
            i--;
            size--;
        } else {
            currentRefs.add(object);
        }
    }
    return currentRefs;
}
 
源代码5 项目: Pydev   文件: PyOpenLastConsoleHyperlink.java
@SuppressWarnings("restriction")
private void processIOConsole(IOConsole ioConsole) {
    IDocument document = ioConsole.getDocument();
    try {
        Position[] positions = document.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
        Arrays.sort(positions, new Comparator<Position>() {

            @Override
            public int compare(Position o1, Position o2) {
                return Integer.compare(o1.getOffset(), o2.getOffset());
            }
        });
        if (positions.length > 0) {
            Position p = positions[positions.length - 1];
            if (p instanceof ConsoleHyperlinkPosition) {
                ConsoleHyperlinkPosition consoleHyperlinkPosition = (ConsoleHyperlinkPosition) p;
                IHyperlink hyperLink = consoleHyperlinkPosition.getHyperLink();
                hyperLink.linkActivated();
            }
        }
    } catch (BadPositionCategoryException e) {
        Log.log(e);
    }
}
 
private CloudSdkDebugTarget(ILaunch launch, LocalAppEngineServerBehaviour serverBehaviour,
    IOConsole console) {
  super(null);
  this.launch = launch;
  this.serverBehaviour = serverBehaviour;
  server = serverBehaviour.getServer();
  this.console = console;
}
 
源代码7 项目: tlaplus   文件: TLCProcessJob.java
private static BufferedReader getConsoleReader() {
	final IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
	final List<IConsole> tlcConsole = Arrays.asList(consoleManager.getConsoles()).stream()
			.filter(c -> "TLC-Console".equals(c.getName())).collect(Collectors.toList());
	if (!tlcConsole.isEmpty()) {
		final IConsole iConsole = tlcConsole.get(0);
		if (iConsole instanceof IOConsole) {
			IOConsoleInputStream inputStream = ((IOConsole) iConsole).getInputStream();
			return new BufferedReader(new InputStreamReader(inputStream));
		}
	}
	return null;
}
 
源代码8 项目: statecharts   文件: StatechartLaunchShortcut.java
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);
			}
		}
	}
}
 
源代码9 项目: gama   文件: ConsoleView.java
@Override
public void ownCreatePartControl(final Composite parent) {
	msgConsole = new IOConsole("GAMA Console", null);
	setCharacterLimit(GamaPreferences.Interface.CORE_CONSOLE_SIZE.getValue());
	GamaPreferences.Interface.CORE_CONSOLE_SIZE.onChange(newValue -> setCharacterLimit(newValue));
	viewer = new IOConsoleViewer(parent, msgConsole);
	viewer.setWordWrap(GamaPreferences.Interface.CORE_CONSOLE_WRAP.getValue());
}
 
源代码10 项目: APICloud-Studio   文件: CommandExecutionUtils.java
public void consume(InputStream outputStream)
{
	IOConsole messageConsole = getMessageConsole(consoleName);
	messageConsole.activate();
	MessageConsoleWriter messageConsoleWriter = new MessageConsoleWriter(messageConsole, outputStream, isStdErr);
	new Thread(messageConsoleWriter).start();
}
 
源代码11 项目: tesb-studio-se   文件: RuntimeConsoleUtil.java
public static IOConsole findConsole() {
    ConsolePlugin plugin = ConsolePlugin.getDefault();
    IConsoleManager conMan = plugin.getConsoleManager();
    IConsole[] existing = conMan.getConsoles();
    for (int i = 0; i < existing.length; i++) {
        if (KARAF_CONSOLE.equals(existing[i].getName()))
            return (IOConsole) existing[i];
    }
    // no console found, so create a new one
    IOConsole myConsole = new IOConsole(KARAF_CONSOLE, null);
    conMan.addConsoles(new IConsole[] { myConsole });
    return myConsole;
}
 
源代码12 项目: tesb-studio-se   文件: RuntimeConsoleUtil.java
public static void clearConsole() {
    ConsolePlugin plugin = ConsolePlugin.getDefault();
    IConsoleManager conMan = plugin.getConsoleManager();
    IConsole[] existing = conMan.getConsoles();
    for (int i = 0; i < existing.length; i++) {
        if (KARAF_CONSOLE.equals(existing[i].getName())) {
            ((IOConsole) existing[i]).destroy();
            conMan.removeConsoles(new IConsole[] { existing[i] });
        }
    }
}
 
源代码13 项目: Pydev   文件: ConsoleColorCache.java
@Override
public void preferenceChange(PreferenceChangeEvent event) {
    String key = event.getKey();
    if ("org.eclipse.debug.ui.consoleBackground".equals(key) || "org.eclipse.debug.ui.outColor".equals(key)
            || "org.eclipse.debug.ui.errorColor".equals(key)) {
        synchronized (referencesLock) {
            ArrayList<IOConsole> currentRefs = getCurrentRefs();
            for (IOConsole console : currentRefs) {
                updateConsole(console);
            }
        }
    }
}
 
源代码14 项目: Pydev   文件: PyOpenLastConsoleHyperlink.java
@Override
public void run(IAction action) {
    for (IConsoleView c : ScriptConsole.iterConsoles()) {
        IConsole console = c.getConsole();
        if (console instanceof IOConsole) {
            IOConsole ioConsole = (IOConsole) console;
            processIOConsole(ioConsole);
            break;
        }
    }
}
 
protected void addProcessConsole(IOConsole c) {
    // What we'd like to do is not put in the input stream the contents we received
    // in the console UNLESS we're waiting for input (but unfortunately, it seems there's
    // no API for that).
    //
    // This means that if the user writes something (to do an evaluation) and later
    // does a raw_input('say something:\n'), the raw_input will get the contents that
    // the user wrote for the evaluation and not the contents it'd write now.
    // As we now have a separate input console, this shouldn't be so troublesome, as
    // we control things better when the user writes to the PromptOverlay console, but
    // if he writes to the other console, things may misbehave.
}
 
源代码16 项目: olca-app   文件: FormulaConsoleAction.java
private IOConsole findOrCreateConsole(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 (IOConsole) existing[i];
	IOConsole console = new IOConsole(name, null);
	conMan.addConsoles(new IConsole[] { console });
	return console;
}
 
源代码17 项目: tlaplus   文件: ConsoleFactory.java
public static IOConsole getTLCConsole()
{
	IOConsole console = findConsole(TLC_ID);

    return console;
}
 
源代码18 项目: LogViewer   文件: LogViewer.java
public IOConsole getConsole() {
    if (console == null)
        createConsole();
    return console;
}
 
源代码19 项目: APICloud-Studio   文件: CommandExecutionUtils.java
public InputStream getInputStream()
{
	IOConsole messageConsole = getMessageConsole(consoleName);
	messageConsole.activate();
	return messageConsole.getInputStream();
}
 
源代码20 项目: APICloud-Studio   文件: CommandExecutionUtils.java
private MessageConsoleWriter(IOConsole messageConsole, InputStream from, boolean isStdErr)
{
	this.messageConsole = messageConsole;
	this.from = from;
	this.isStdErr = isStdErr;
}
 
源代码21 项目: olca-app   文件: FormulaConsoleAction.java
@Override
public void run() {
	IOConsole console = findOrCreateConsole(M.FormulaInterpreter);
	ConsoleJob job = new ConsoleJob(console);
	job.schedule();
}
 
源代码22 项目: olca-app   文件: FormulaConsoleAction.java
public ConsoleJob(IOConsole console) {
	super(M.FormulaInterpreter);
	this.console = console;
}
 
源代码23 项目: Pydev   文件: ConsoleColorCache.java
/**
 * In this method we'll make sure a console will have its colors properly updated.
 * 
 * @param console This is the console to keep updated. 
 * 
 * The console should have a getAttribute("themeConsoleStreamToColor") which returns a Map<IOConsoleOutputStream, String>
 * where the values may be: 
 * 
 * "console.output" or "console.error"
 */
public void keepConsoleColorsSynched(IOConsole console) {
    updateConsole(console);
    addRef(console);
}
 
 类所在包
 同包方法