本文整理汇总了Java中org.eclipse.ui.console.IOConsole类的典型用法代码示例。如果您正苦于以下问题:Java IOConsole类的具体用法?Java IOConsole怎么用?Java IOConsole使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IOConsole类属于org.eclipse.ui.console包,在下文中一共展示了IOConsole类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConsoleIO
import org.eclipse.ui.console.IOConsole; //导入依赖的package包/类
/**
* retrieve or create a ConsoleIO with the given UId
* the name is used only if the console is created
* @param name
* @return
*/
public EclipseConsoleIO getConsoleIO(String uid, String name){
EclipseConsoleIO consoleIo=consoleIOMap.get(uid);
if(consoleIo == null){
// create the eclipse console
IOConsole ioConsole = new IOConsole(name, null);
ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[]{ ioConsole });
// ConsolePlugin.getDefault().getConsoleManager().showConsoleView(ioConsole);
// ioConsole.activate(); // console will be displayed on first use
// create the IO with this console
consoleIo = new EclipseConsoleIO(ioConsole);
consoleIOMap.put(uid, consoleIo);
}
return consoleIo;
}
示例2: getConsole
import org.eclipse.ui.console.IOConsole; //导入依赖的package包/类
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;
}
示例3: addRef
import org.eclipse.ui.console.IOConsole; //导入依赖的package包/类
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: getCurrentRefs
import org.eclipse.ui.console.IOConsole; //导入依赖的package包/类
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: processIOConsole
import org.eclipse.ui.console.IOConsole; //导入依赖的package包/类
@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);
}
}
示例6: openConsole
import org.eclipse.ui.console.IOConsole; //导入依赖的package包/类
public void openConsole() {
IOConsole console = getConsole();
IConsole[] existing = consoleManager.getConsoles();
boolean exists = false;
for (int i = 0; i < existing.length; i++) {
if (console == existing[i]) {
exists = true;
}
}
if (!exists) {
consoleManager.addConsoles(new IConsole[] { console });
}
// console.clearConsole();
consoleManager.showConsoleView(console);
}
示例7: CloudSdkDebugTarget
import org.eclipse.ui.console.IOConsole; //导入依赖的package包/类
private CloudSdkDebugTarget(ILaunch launch, LocalAppEngineServerBehaviour serverBehaviour,
IOConsole console) {
super(null);
this.launch = launch;
this.serverBehaviour = serverBehaviour;
server = serverBehaviour.getServer();
this.console = console;
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:9,代码来源:LocalAppEngineServerLaunchConfigurationDelegate.java
示例8: EclipseConsoleHandler
import org.eclipse.ui.console.IOConsole; //导入依赖的package包/类
/**
* Build the Eclipse console handler
*
* @param currentConsole
* the current eclipse process console
*
*/
public EclipseConsoleHandler(IConsole console) {
super();
if (console instanceof IOConsole) {
this.console = (IOConsole) console;
this.console.activate();
} else {
throw new TurnusRuntimeException("Invalid console passed as parameter");
}
}
示例9: showConsole
import org.eclipse.ui.console.IOConsole; //导入依赖的package包/类
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);
}
}
}
}
示例10: createEngine
import org.eclipse.ui.console.IOConsole; //导入依赖的package包/类
/**
* Creates and configures a Creel engine using plugin preferences and
* folders.
*
* @param project
* The project
* @param folders
* Map of artifact types to folders
* @return A Creel engine
* @throws CoreException
* In case of an Eclipse error
*/
public static Engine createEngine( IProject project, Map<Artifact.Type, IContainer> folders ) throws CoreException
{
IPreferenceStore preferences = Plugin.instance.getPreferenceStore();
Engine engine = new Engine();
IOConsole console = EclipseUtil.getConsole( "Creel" );
IOConsoleOutputStream stream = console.newOutputStream();
if( !preferences.getBoolean( PreferencesPage.QUIET ) )
( (EventHandlers) engine.getEventHandler() ).add( new ConsoleEventHandler( stream, false, false ) );
engine.setVerbosity( preferences.getInt( PreferencesPage.VERBOSITY ) );
engine.getDirectories().set( toDirectories( folders ) );
return engine;
}
示例11: consume
import org.eclipse.ui.console.IOConsole; //导入依赖的package包/类
public void consume(InputStream outputStream)
{
IOConsole messageConsole = getMessageConsole(consoleName);
messageConsole.activate();
MessageConsoleWriter messageConsoleWriter = new MessageConsoleWriter(messageConsole, outputStream, isStdErr);
new Thread(messageConsoleWriter).start();
}
示例12: findConsole
import org.eclipse.ui.console.IOConsole; //导入依赖的package包/类
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;
}
示例13: clearConsole
import org.eclipse.ui.console.IOConsole; //导入依赖的package包/类
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] });
}
}
}
示例14: append
import org.eclipse.ui.console.IOConsole; //导入依赖的package包/类
@Override
protected void append(LoggingEvent logEvent) {
final String message = logEvent.getRenderedMessage();
final Level level = logEvent.getLevel();
final String streamId = getStreamId(level);
final Display display = Display.getDefault();
final Thread thread = display.getThread();
Thread _currentThread = Thread.currentThread();
final boolean uiThread = Objects.equal(thread, _currentThread);
final Runnable _function = new Runnable() {
@Override
public void run() {
try {
final IOConsole console = AntlrConsoleFactory.getConsole();
final IOConsoleOutputStream stream = console
.newOutputStream();
final ConsoleColorProvider colorProvider = new ConsoleColorProvider();
final Color color = colorProvider.getColor(streamId);
stream.setColor(color);
stream.setActivateOnWrite(true);
stream.write((message + "\n"));
stream.close();
} catch (Throwable ex) {
ex.printStackTrace();
}
}
};
final Runnable printTask = _function;
if (uiThread) {
printTask.run();
} else {
display.syncExec(printTask);
}
}
示例15: preferenceChange
import org.eclipse.ui.console.IOConsole; //导入依赖的package包/类
@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);
}
}
}
}