本文整理汇总了Java中org.eclipse.ui.console.MessageConsole.activate方法的典型用法代码示例。如果您正苦于以下问题:Java MessageConsole.activate方法的具体用法?Java MessageConsole.activate怎么用?Java MessageConsole.activate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.console.MessageConsole
的用法示例。
在下文中一共展示了MessageConsole.activate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOutputStream
import org.eclipse.ui.console.MessageConsole; //导入方法依赖的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;
}
示例2: runFile
import org.eclipse.ui.console.MessageConsole; //导入方法依赖的package包/类
@Override
protected void runFile ( final IFile file, final IProgressMonitor monitor ) throws Exception
{
final MessageConsole mc = new MessageConsole ( String.format ( "OSCAR Validation: %s", file ), "org.eclipse.scada.configuration.oscar.validation", null, true );
ConsolePlugin.getDefault ().getConsoleManager ().addConsoles ( new IConsole[] { mc } );
mc.activate ();
final File dataFile = file.getLocation ().toFile ();
Map<String, Map<String, Map<String, String>>> data;
if ( OscarLoader.isOscar ( dataFile ) )
{
data = new OscarLoader ( dataFile ).getData ();
}
else
{
try (FileInputStream stream = new FileInputStream ( dataFile ))
{
data = OscarLoader.loadJsonData ( stream );
}
}
final PrintStream consoleStream = new PrintStream ( mc.newOutputStream () );
try
{
new LoopValidator ( data, consoleStream ).validate ();
}
finally
{
consoleStream.close ();
}
}
示例3: findConsole
import org.eclipse.ui.console.MessageConsole; //导入方法依赖的package包/类
public static MessageConsole findConsole(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 myConsole = new MessageConsole(name, null);
conMan.addConsoles(new IConsole[] { myConsole });
myConsole.activate();
return myConsole;
}
示例4: maybeGetDevJarPath
import org.eclipse.ui.console.MessageConsole; //导入方法依赖的package包/类
/**
* Returns the path to the gwt-dev-xxx.jar in the event that the launch configuration depends on a
* GWT Contributor Runtime. Otherwise, returns the empty string.
*/
private static String maybeGetDevJarPath(IJavaProject project) {
/*
* In order to figure out whether or not to add the -Dgwt.devjar argument to the list of VM
* args, we have to figure out the runtime that this launch configuration depends on. If the
* project is one of the GWT Runtime projects, then we'll definitely have to add the
* -Dgwt.devjar argument to the launch configuration.
*/
try {
if (GWTProjectsRuntime.isGWTRuntimeProject(project)) {
// Synthesize a temporary contributor SDK so that we can use it
// to compute the devjar path
GwtSdk tempContribSDK = GWTProjectsRuntime.syntheziseContributorRuntime();
if (tempContribSDK.validate().isOK()) {
return tempContribSDK.getDevJar().getAbsolutePath();
} else {
return "";
}
}
GwtSdk sdk = GwtSdk.findSdkFor(project);
if (sdk == null) {
MessageConsole messageConsole =
MessageConsoleUtilities.getMessageConsole(project.getProject().getName() + "-GWT", null);
messageConsole.activate();
ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] {messageConsole});
final ConsoleColorProvider consoleColorProvider = new ConsoleColorProvider();
final MessageConsoleStream console = messageConsole.newMessageStream();
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
console.setColor(consoleColorProvider.getColor(IDebugUIConstants.ID_STANDARD_ERROR_STREAM));
}
});
console.println("GWT SDK not installed.");
try {
console.close();
} catch (IOException e) {
GWTPluginLog.logError(e, "Unable to close output stream to console");
}
return "";
} else if (sdk.usesGwtDevProject()) {
File gwtDevJarFile = sdk.getDevJar();
return gwtDevJarFile.getAbsolutePath();
}
} catch (SdkException sdke) {
GWTPluginLog.logError(sdke, "Unable to extract gwt dev jar argument from GWTProjectsRuntime");
} catch (JavaModelException jme) {
GWTPluginLog.logError(jme, "Unable to extract gwt dev jar argument from GWTProjectsRuntime");
}
return "";
}