本文整理汇总了Java中org.eclipse.ui.console.ConsolePlugin类的典型用法代码示例。如果您正苦于以下问题:Java ConsolePlugin类的具体用法?Java ConsolePlugin怎么用?Java ConsolePlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConsolePlugin类属于org.eclipse.ui.console包,在下文中一共展示了ConsolePlugin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showConsole
import org.eclipse.ui.console.ConsolePlugin; //导入依赖的package包/类
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;
}
示例2: getOutputStream
import org.eclipse.ui.console.ConsolePlugin; //导入依赖的package包/类
@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;
}
示例3: log
import org.eclipse.ui.console.ConsolePlugin; //导入依赖的package包/类
@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);
}
}
示例4: execute
import org.eclipse.ui.console.ConsolePlugin; //导入依赖的package包/类
@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;
}
示例5: getConsoleIO
import org.eclipse.ui.console.ConsolePlugin; //导入依赖的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;
}
示例6: println
import org.eclipse.ui.console.ConsolePlugin; //导入依赖的package包/类
public void println(final ConsoleMessage message) {
// use normal print for the message itself
print(message);
// add the carriage return
Runnable r = new Runnable() {
public void run() {
changeStyle(message.getColor(), message.getStyle());
if(!((IOConsoleOutputStream)getOutputStream()).isClosed()){
try {
((IOConsoleOutputStream)getOutputStream()).write("\n");
} catch (IOException e) {
}
}
}
};
ConsolePlugin.getStandardDisplay().asyncExec(r);
}
示例7: partOpened
import org.eclipse.ui.console.ConsolePlugin; //导入依赖的package包/类
@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();
}
}
}
示例8: AndroidConsole
import org.eclipse.ui.console.ConsolePlugin; //导入依赖的package包/类
public AndroidConsole() {
console = new MessageConsole("Android", null);
ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { console });
out = console.newMessageStream();
err = console.newMessageStream();
// set the colors
final Display display = Display.getDefault();
display.syncExec(new Runnable() {
@Override
public void run() {
out.setColor(display.getSystemColor(SWT.COLOR_BLACK));
err.setColor(display.getSystemColor(SWT.COLOR_RED));
}
});
}
示例9: getConsole
import org.eclipse.ui.console.ConsolePlugin; //导入依赖的package包/类
/**
* 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;
}
示例10: openConsole
import org.eclipse.ui.console.ConsolePlugin; //导入依赖的package包/类
@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);
}
}
示例11: findConsole
import org.eclipse.ui.console.ConsolePlugin; //导入依赖的package包/类
/**
* 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;
}
示例12: findConsole
import org.eclipse.ui.console.ConsolePlugin; //导入依赖的package包/类
/**
* 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;
}
示例13: showConsole
import org.eclipse.ui.console.ConsolePlugin; //导入依赖的package包/类
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);
}
}
示例14: findConsole
import org.eclipse.ui.console.ConsolePlugin; //导入依赖的package包/类
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;
}
示例15: findConsole
import org.eclipse.ui.console.ConsolePlugin; //导入依赖的package包/类
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;
}