本文整理汇总了Java中org.eclipse.debug.ui.console.ConsoleColorProvider类的典型用法代码示例。如果您正苦于以下问题:Java ConsoleColorProvider类的具体用法?Java ConsoleColorProvider怎么用?Java ConsoleColorProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConsoleColorProvider类属于org.eclipse.debug.ui.console包,在下文中一共展示了ConsoleColorProvider类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: launchDeployJob
import org.eclipse.debug.ui.console.ConsoleColorProvider; //导入依赖的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();
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:40,代码来源:DeployCommandHandler.java
示例2: append
import org.eclipse.debug.ui.console.ConsoleColorProvider; //导入依赖的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);
}
}
开发者ID:antlr4ide,项目名称:antlr4ide,代码行数:36,代码来源:DefaultConsole.java
示例3: maybeGetDevJarPath
import org.eclipse.debug.ui.console.ConsoleColorProvider; //导入依赖的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 "";
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:58,代码来源:DGwtDevJarArgumentProcessor.java
示例4: launchChanged
import org.eclipse.debug.ui.console.ConsoleColorProvider; //导入依赖的package包/类
@Override
public void launchChanged(final ILaunch launch) {
if (!isKarafLaunch(launch)) {
return;
}
for (final IProcess process : launch.getProcesses()) {
if (getConsoleDocument(process) != null) {
continue;
}
if (process.getStreamsProxy() == null) {
continue;
}
final String encoding = launch.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING);
final KarafPlatformModel karafPlatform =
(KarafPlatformModel) launch.getLaunchConfiguration().getAdapter(KarafPlatformModel.class);
final KarafSshConnectionUrl sshConnectionUrl =
(KarafSshConnectionUrl) karafPlatform.getAdapter(KarafSshConnectionUrl.class);
final KarafSshShellConnection.Credentials credentials;
try {
final String username =
launch.getLaunchConfiguration().getAttribute(KarafLaunchConfigurationConstants.KARAF_REMOTE_CONSOLE_USERNAME, "karaf");
final String password =
launch.getLaunchConfiguration().getAttribute(KarafLaunchConfigurationConstants.KARAF_REMOTE_CONSOLE_PASSWORD, "karaf");
credentials = new KarafSshShellConnection.Credentials(username, password);
} catch (final CoreException e) {
throw new AssertionError(e);
}
final KarafRemoteConsole remoteConsole = new KarafRemoteConsole(
process,
sshConnectionUrl,
credentials,
new ConsoleColorProvider(),
launch.getLaunchConfiguration().getName(),
encoding);
remoteConsole.setAttribute(IDebugUIConstants.ATTR_CONSOLE_PROCESS, process);
ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[]{remoteConsole});
}
}
开发者ID:apache,项目名称:karaf-eik,代码行数:50,代码来源:GenericKarafWorkbenchService.java
注:本文中的org.eclipse.debug.ui.console.ConsoleColorProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论