org.eclipse.core.runtime.Platform.getLog()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(169)

本文整理了Java中org.eclipse.core.runtime.Platform.getLog()方法的一些代码示例,展示了Platform.getLog()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Platform.getLog()方法的具体详情如下:
包路径:org.eclipse.core.runtime.Platform
类名称:Platform
方法名:getLog

Platform.getLog介绍

[英]Returns the log for the given bundle. If no such log exists, one is created.
[中]返回给定捆绑包的日志。如果不存在这样的日志,则创建一个日志。

代码示例

代码示例来源:origin: eclipse/eclipse.jdt.ls

public static void log(IStatus status) {
  if (context != null) {
    Platform.getLog(JavaLanguageServerPlugin.context.getBundle()).log(status);
  }
}

代码示例来源:origin: com.b2international.snowowl/com.b2international.snowowl.core

/**
 * Method for log warning. 
 * @param bundle required for the bundle ID.
 * @param warningMessage the message to log.
 */
public static void logWarning(final Bundle bundle, final String warningMessage) {
  Platform.getLog(bundle).log(new Status(IStatus.WARNING, bundle.getSymbolicName(), warningMessage));
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.core.resources

public static void log(IStatus status) {
  final Bundle bundle = Platform.getBundle(ResourcesPlugin.PI_RESOURCES);
  if (bundle == null)
    return;
  Platform.getLog(bundle).log(status);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.core.resources

public static void log(IStatus status) {
  final Bundle bundle = Platform.getBundle(ResourcesPlugin.PI_RESOURCES);
  if (bundle == null)
    return;
  Platform.getLog(bundle).log(status);
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.core.resources

public static void log(IStatus status) {
  final Bundle bundle = Platform.getBundle(ResourcesPlugin.PI_RESOURCES);
  if (bundle == null)
    return;
  Platform.getLog(bundle).log(status);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.editors

/**
 * Log status.
 *
 * @param status the status to log
 * @since 3.4
 */
private void logException(IStatus status) {
  Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
  ILog log= Platform.getLog(bundle);
  log.log(status);
}

代码示例来源:origin: org.eclipse/org.eclipse.ui.editors

/**
 * Handles a core exception which occurs when accessing marker attributes.
 *
 * @param e the core exception
 */
private static void handleCoreException(CoreException e) {
  Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
  ILog log= Platform.getLog(bundle);
  log.log(e.getStatus());
}

代码示例来源:origin: org.eclipse/org.eclipse.ui.editors

/**
 * Defines the standard procedure to handle <code>CoreExceptions</code>. Exceptions
 * are written to the plug-in log.
 *
 * @param exception the exception to be logged
 * @param message the message to be logged
 */
protected void handleCoreException(CoreException exception, String message) {
  Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
  ILog log= Platform.getLog(bundle);
  IStatus status= message != null ? new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, message, exception) : exception.getStatus();
  log.log(status);
}

代码示例来源:origin: org.eclipse.epp.mpc/core

public static ILog getLog() {
  return Platform.getLog(MarketplaceClientCorePlugin.getBundle());
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.editors

/**
 * Defines the standard procedure to handle <code>CoreExceptions</code>. Exceptions
 * are written to the plug-in log.
 *
 * @param exception the exception to be logged
 * @param message the message to be logged
 */
protected void handleCoreException(CoreException exception, String message) {
  Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
  ILog log= Platform.getLog(bundle);
  IStatus status= message != null ? new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, message, exception) : exception.getStatus();
  log.log(status);
}

代码示例来源:origin: com.b2international.snowowl/com.b2international.snowowl.core

/**
 * Convenience method for handling generic exceptions. 
 * 
 * @param exception
 * @param errorMessage
 */
public static void handleException(final Bundle bundle, final Exception exception, final String errorMessage) {
  final MultiStatus errorStatus = getServiceInfo(bundle, exception);
  final IStatus status = new Status(IStatus.ERROR, bundle.getSymbolicName(), IStatus.ERROR, errorMessage, exception);
  errorStatus.add(status);
  Platform.getLog(bundle).log(status);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

@Override
  public void handleException(Throwable exception) {
    String message= JFaceTextMessages.getString(fMessageKey);
    IStatus status= new Status(IStatus.ERROR, PLUGIN_ID, message, exception);
    Platform.getLog(Platform.getBundle(PLUGIN_ID)).log(status);
    fLastErrorMessage= message;
  }
}

代码示例来源:origin: trustin/os-maven-plugin

@Override
public void earlyStartup() {
  final Bundle bundle = Platform.getBundle(ID);
  logger = Platform.getLog(bundle);
  detect(new Properties(), Collections.<String>emptyList());
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

@Override
  public void handleException(Throwable exception) {
    String message= JFaceTextMessages.getString(fMessageKey);
    IStatus status= new Status(IStatus.ERROR, PLUGIN_ID, message, exception);
    Platform.getLog(Platform.getBundle(PLUGIN_ID)).log(status);
    fLastErrorMessage= message;
  }
}

代码示例来源:origin: kr.motd.maven/os-maven-plugin

@Override
public void earlyStartup() {
  final Bundle bundle = Platform.getBundle(ID);
  logger = Platform.getLog(bundle);
  detect(new Properties(), Collections.<String>emptyList());
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.html.core

/**
 * Prints message to log if category matches /debug/tracefilter option.
 * @param message text to print
 * @param category category of the message, to be compared with /debug/tracefilter
 */
protected static void _trace(String category, String message, Throwable exception) {
  if (isTracing(category)) {
    message = (message != null) ? message : "null"; //$NON-NLS-1$
    Status statusObj = new Status(IStatus.OK, PLUGIN_ID, IStatus.OK, message, exception);
    Bundle bundle = Platform.getBundle(PLUGIN_ID);
    if (bundle != null) 
      Platform.getLog(bundle).log(statusObj);
  }
}

代码示例来源:origin: piece/makegood

private void log(Exception e, AspectManifest manifest) {
    Platform.getLog(Platform.getBundle(manifest.pluginId()))
        .log(new Status(IStatus.ERROR, manifest.pluginId(), 0, e.getMessage(), e));
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.jsf.core

private void updateMap(ISymbol symbol, String  scopeName)
{
  final Map<Object, ISymbol> map = getMapForScopeInternal(scopeName);
  if (map != null)
  {
    map.put(symbol.getName(), symbol);
  }
  else
  {
    Platform.getLog(JSFCorePlugin.getDefault().getBundle()).log(new Status(IStatus.ERROR, JSFCorePlugin.PLUGIN_ID, 0, "Scope not found: "+scopeName, new Throwable())); //$NON-NLS-1$
  }
}

代码示例来源:origin: org.eclipse.net4j/util

public void logged(OMLogger logger, Level level, String msg, Throwable t)
{
 try
 {
  OSGiBundle bundle = (OSGiBundle)logger.getBundle();
  ILog log = Platform.getLog(bundle.getBundleContext().getBundle());
  log.log(new Status(toEclipse(level), bundle.getBundleID(), IStatus.OK, msg, t));
 }
 catch (RuntimeException ignore)
 {
 }
}

代码示例来源:origin: com.b2international.snowowl/com.b2international.snowowl.core

/**
 * Convenience method for handling generic exceptions. 
 * 
 * @param exception
 * @param errorMessage
 */
public static void handleErrorStatus(final Bundle bundle, final IStatus status) {
  final MultiStatus multiStatus = getServiceInfo(bundle, status.getException());
  multiStatus.add(status);
  Platform.getLog(bundle).log(status);
}

相关文章