本文整理汇总了Java中org.eclipse.ui.console.MessageConsoleStream.setColor方法的典型用法代码示例。如果您正苦于以下问题:Java MessageConsoleStream.setColor方法的具体用法?Java MessageConsoleStream.setColor怎么用?Java MessageConsoleStream.setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.console.MessageConsoleStream
的用法示例。
在下文中一共展示了MessageConsoleStream.setColor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConsoleOutputStream
import org.eclipse.ui.console.MessageConsoleStream; //导入方法依赖的package包/类
public OutputStream getConsoleOutputStream(boolean isError) {
final MessageConsoleStream output = messageConsole.newMessageStream();
output.setActivateOnWrite(false);
final int colorId;
if (!isError) {
colorId = SWT.COLOR_BLACK;
} else {
colorId = SWT.COLOR_RED;
}
/* we must set the color in the UI thread */
Runnable runnable = new Runnable() {
public void run() {
org.eclipse.swt.graphics.Color color = Display.getCurrent()
.getSystemColor(colorId);
output.setColor(color);
}
};
Display.getDefault().syncExec(runnable);
return output;
}
示例2: getNewMessageConsoleStream
import org.eclipse.ui.console.MessageConsoleStream; //导入方法依赖的package包/类
private MessageConsoleStream getNewMessageConsoleStream(int msgKind)
{
int swtColorId = SWT.COLOR_DARK_GREEN;
switch (msgKind) {
case MSG_INFORMATION:
swtColorId = SWT.COLOR_BLACK;
break;
case MSG_ERROR:
swtColorId = SWT.COLOR_RED;
break;
case MSG_WARNING:
swtColorId = SWT.COLOR_DARK_BLUE;
break;
default:
swtColorId = SWT.COLOR_DARK_MAGENTA;
}
MessageConsoleStream msgConsoleStream = getMessageConsole().newMessageStream();
msgConsoleStream.setColor(Display.getCurrent().getSystemColor(swtColorId));
return msgConsoleStream;
}
示例3: getNewMessageConsoleStream
import org.eclipse.ui.console.MessageConsoleStream; //导入方法依赖的package包/类
private MessageConsoleStream getNewMessageConsoleStream(int msgKind) {
int swtColorId = SWT.COLOR_BLACK;
switch (msgKind) {
case MSG_LOG:
swtColorId = SWT.COLOR_BLACK;
break;
case MSG_INFORMATION:
swtColorId = SWT.COLOR_DARK_GRAY;
break;
case MSG_ERROR:
swtColorId = SWT.COLOR_DARK_MAGENTA;
break;
case MSG_WARNING:
swtColorId = SWT.COLOR_DARK_YELLOW;
break;
case MSG_SUCCESS:
swtColorId = SWT.COLOR_DARK_GREEN;
break;
default:
swtColorId = SWT.COLOR_BLACK;
break;
}
MessageConsoleStream msgConsoleStream = messageConsole.newMessageStream();
msgConsoleStream.setColor(Display.getCurrent().getSystemColor(swtColorId));
return msgConsoleStream;
}
示例4: ConsoleContext
import org.eclipse.ui.console.MessageConsoleStream; //导入方法依赖的package包/类
public ConsoleContext ( final MessageConsole messageConsole )
{
this.writerStream = messageConsole.newMessageStream ();
final MessageConsoleStream errorStream = messageConsole.newMessageStream ();
errorStream.setColor ( Display.getDefault ().getSystemColor ( SWT.COLOR_RED ) );
this.errorPrintWriter = new PrintWriter ( new OutputStreamWriter ( errorStream ) );
this.logStream = messageConsole.newMessageStream ();
this.logStream.setColor ( Display.getDefault ().getSystemColor ( SWT.COLOR_GRAY ) );
}
示例5: launchDeployJob
import org.eclipse.ui.console.MessageConsoleStream; //导入方法依赖的package包/类
private void launchDeployJob(IProject project, Credential credential)
throws IOException, CoreException {
AnalyticsPingManager.getInstance().sendPing(AnalyticsEvents.APP_ENGINE_DEPLOY,
analyticsDeployEventMetadataKey);
IPath workDirectory = createWorkDirectory();
DeployPreferences deployPreferences = getDeployPreferences(project);
DeployConsole messageConsole =
MessageConsoleUtilities.createConsole(getConsoleName(deployPreferences.getProjectId()),
new DeployConsole.Factory());
IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
consoleManager.showConsoleView(messageConsole);
ConsoleColorProvider colorProvider = new ConsoleColorProvider();
MessageConsoleStream outputStream = messageConsole.newMessageStream();
MessageConsoleStream errorStream = messageConsole.newMessageStream();
outputStream.setActivateOnWrite(true);
errorStream.setActivateOnWrite(true);
outputStream.setColor(colorProvider.getColor(IDebugUIConstants.ID_STANDARD_OUTPUT_STREAM));
errorStream.setColor(colorProvider.getColor(IDebugUIConstants.ID_STANDARD_ERROR_STREAM));
StagingDelegate stagingDelegate = getStagingDelegate(project);
DeployJob deploy = new DeployJob(deployPreferences, credential, workDirectory,
outputStream, errorStream, stagingDelegate);
messageConsole.setJob(deploy);
deploy.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
if (event.getResult().isOK()) {
AnalyticsPingManager.getInstance().sendPing(AnalyticsEvents.APP_ENGINE_DEPLOY_SUCCESS,
analyticsDeployEventMetadataKey);
}
launchCleanupJob();
}
});
deploy.schedule();
}
示例6: printError
import org.eclipse.ui.console.MessageConsoleStream; //导入方法依赖的package包/类
/**
* Prints error message to the console.
*
* @param message error message to print
*/
public static void printError(final String message) {
final Display display = PlatformUI.getWorkbench().getDisplay();
final MessageConsoleStream consoleStream = getConsoleStream();
final Color color = new Color(display, new RGB(255, 0, 0));
consoleStream.setColor(color);
consoleStream.println(message);
}
示例7: showConsole
import org.eclipse.ui.console.MessageConsoleStream; //导入方法依赖的package包/类
public static void showConsole(String consoleName, String content) throws IOException, PartInitException{
IWorkbenchPage page = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
MessageConsole console = ConsoleHelper
.findConsole(consoleName);
MessageConsoleStream out = console.newMessageStream();
out.println(content);
out.setActivateOnWrite(true);
out.setColor(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
out.close();
IConsoleView view = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
view.display(console);
}