• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ConsoleColorProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ScalarSynchronousObservable类代码示例发布时间:2022-05-22
下一篇:
Java ParentPathLabelGenerator类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap