Class PlatformServicesCore

java.lang.Object
org.eclipse.core.runtime.Plugin
com._1c.g5.v8.dt.internal.platform.services.core.PlatformServicesCore
All Implemented Interfaces:
EventListener, org.eclipse.osgi.service.debug.DebugOptionsListener, org.osgi.framework.BundleActivator

public class PlatformServicesCore extends org.eclipse.core.runtime.Plugin implements org.eclipse.osgi.service.debug.DebugOptionsListener
Platform services core plug-in activator. The activator class controls the plug-in life cycle.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Error status code indicating that requested operation requires project associated with infobase, but actual project is not associated with any infobase.
    static final String
    Platform services core plug-in identifier.
    static final String
     
    static final String
    Trace option to enable tracing.
    static final String
    Trace option to enable additional spammy debug traces.
    static final String
     
    static final String
     
    static final String
     
    static final String
    Trace option for performance statistics.
    static final String
     
    static final String
     

    Fields inherited from class org.eclipse.core.runtime.Plugin

    PLUGIN_PREFERENCE_SCOPE, PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME, PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.eclipse.core.runtime.IStatus
    Creates an error status by the provided message.
    static org.eclipse.core.runtime.IStatus
    createErrorStatus(String message, int code, Throwable throwable)
    Creates an error status by the provided message, the cause throwable and an error code.
    static org.eclipse.core.runtime.IStatus
    createErrorStatus(String message, Throwable throwable)
    Creates an error status by the provided message and the cause throwable.
    static org.eclipse.core.runtime.IStatus
    Creates an info status by the provided message.
    static org.eclipse.core.runtime.IStatus
    Creates a warning status by the provided message.
    static org.eclipse.core.runtime.IStatus
    createWarningStatus(String message, Throwable throwable)
    Creates a warning status by the provided message and cause throwable.
    Returns the shared platform services core plug-in instance.
    boolean
     
    static void
    log(org.eclipse.core.runtime.IStatus status)
    Writes the status to the plug-in log.
    static void
    logDebug(String message)
    Logs the provided message as INFO status if plug-in is in debug mode.
    static void
    logDebug(Supplier<String> lazyMessage)
    Logs a message as INFO status if plug-in is in debug mode.
    static void
    logError(String message)
    Creates and logs an error status by the provided message.
    static void
    logError(String message, Throwable throwable)
    Creates and logs an error status by the provided message and the cause throwable.
    static void
    logWarning(String message)
    Logs the provided message as WARNIG status.
    static void
    logWarning(String message, Throwable throwable)
    Logs the provided message as WARNIG status.
    static boolean
    needToDeleteTempFolder(Path tempDirectory, boolean operationFailed)
    Returns true if deleting temp files is needed.
    void
    optionsChanged(org.eclipse.osgi.service.debug.DebugOptions options)
     
    void
    start(org.osgi.framework.BundleContext bundleContext)
     
    void
    stop(org.osgi.framework.BundleContext bundleContext)
     
    static void
    trace(String message)
    Deprecated.
    use trace(String, String) instead, this method will be deleted soon
    static void
    trace(String option, String message)
    Prints the provided message to the OSGi tracing if started and plug-in is in debug mode.
    static void
    trace(String option, Supplier<String> messageSupplier)
    Lazily prints a message to the OSGi tracing if started and plug-in is in debug mode.
    static void
    trace(String traceOption, Supplier<String> messageSupplier, Throwable error)
    Lazily prints a message to the OSGi tracing if started and plug-in is in debug mode.
    static void
    tracePerformance(com.google.common.base.Stopwatch timer, Supplier<String> descriptionBuilder)
    Traces specified timer.

    Methods inherited from class org.eclipse.core.runtime.Plugin

    find, find, getBundle, getLog, getPluginPreferences, getStateLocation, initializeDefaultPluginPreferences, internalInitializeDefaultPluginPreferences, openStream, openStream, savePluginPreferences, setDebugging, shutdown, startup, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • PlatformServicesCore

      public PlatformServicesCore()
  • Method Details

    • getDefault

      public static PlatformServicesCore getDefault()
      Returns the shared platform services core plug-in instance.
      Returns:
      the shared platform services core plug-in instance, never null if plug-in is started
    • createInfoStatus

      public static org.eclipse.core.runtime.IStatus createInfoStatus(String message)
      Creates an info status by the provided message.
      Parameters:
      message - the status message, cannot be null
      Returns:
      the status created info status, never null
    • createErrorStatus

      public static org.eclipse.core.runtime.IStatus createErrorStatus(String message)
      Creates an error status by the provided message.
      Parameters:
      message - the status message, cannot be null
      Returns:
      the created error status, never null
    • createErrorStatus

      public static org.eclipse.core.runtime.IStatus createErrorStatus(String message, Throwable throwable)
      Creates an error status by the provided message and the cause throwable.
      Parameters:
      message - the status message, cannot be null
      throwable - the cause throwable, can be null if not applicable
      Returns:
      the created error status, never null
    • createErrorStatus

      public static org.eclipse.core.runtime.IStatus createErrorStatus(String message, int code, Throwable throwable)
      Creates an error status by the provided message, the cause throwable and an error code.
      Parameters:
      message - the status message, cannot be null
      throwable - the cause throwable, can be null if not applicable
      code - an error status code
      Returns:
      the created error status, never null
    • createWarningStatus

      public static org.eclipse.core.runtime.IStatus createWarningStatus(String message)
      Creates a warning status by the provided message.
      Parameters:
      message - the status message, cannot be null
      Returns:
      the status created warning status, never null
    • createWarningStatus

      public static org.eclipse.core.runtime.IStatus createWarningStatus(String message, Throwable throwable)
      Creates a warning status by the provided message and cause throwable.
      Parameters:
      message - the status message, cannot be null
      throwable - the throwable, can be null if not applicable
      Returns:
      the status created warning status, never null
    • trace

      @Deprecated public static void trace(String message)
      Deprecated.
      use trace(String, String) instead, this method will be deleted soon
      Prints the provided message to the OSGi tracing if started and plug-in is in debug mode.
      Parameters:
      message - the message to print or null if none
    • trace

      public static void trace(String option, String message)
      Prints the provided message to the OSGi tracing if started and plug-in is in debug mode.
      Parameters:
      option - the option that will control whether the trace statement is printed (e.g., "/debug/myComponent") or null if none
      message - the message to print or null if none
    • trace

      public static void trace(String option, Supplier<String> messageSupplier)
      Lazily prints a message to the OSGi tracing if started and plug-in is in debug mode.
      Parameters:
      option - the option that will control whether the trace statement is printed (e.g., "/debug/myComponent") or null if none
      messageSupplier - Supplier of lazy message that is to be printed. Must not be null.
    • trace

      public static void trace(String traceOption, Supplier<String> messageSupplier, Throwable error)
      Lazily prints a message to the OSGi tracing if started and plug-in is in debug mode.

      The message is evaluated and printed only in plugin is in debug mode and specified trace option is enabled.

      Parameters:
      traceOption - Option to be checked if tracing should be done or null if no option should be checked.
      messageSupplier - Supplier for the lazily evaluated message. Must not be null.
      error - Exception to be attached to the message or null if none.
    • tracePerformance

      public static void tracePerformance(com.google.common.base.Stopwatch timer, Supplier<String> descriptionBuilder)
      Traces specified timer.

      Description builder is called only if debugging is enabled via TRACE_DEBUG. Elapsed time from the specified timer is traced using TRACE_PERFORMANCE option. The message being traced consists of description created by description builder, delimiter and elapsed time.

      Parameters:
      timer - Timer whose elapsed time should be traced. Must not be null.
      descriptionBuilder - Supplier for the message prefix. Must not be null and must not return null.
    • log

      public static void log(org.eclipse.core.runtime.IStatus status)
      Writes the status to the plug-in log.
      Parameters:
      status - the status to write to the plug-in log, cannot be null
    • logDebug

      public static void logDebug(String message)
      Logs the provided message as INFO status if plug-in is in debug mode.
      Parameters:
      message - the message to log, cannot be null
    • logDebug

      public static void logDebug(Supplier<String> lazyMessage)
      Logs a message as INFO status if plug-in is in debug mode.

      Message is evaluated lazily. That is if plugin is not in debug mode then message is not evaluated to avoid logging overhead.

      Parameters:
      lazyMessage - Lazily evaluates message to be logged. Must not be null.
    • logWarning

      public static void logWarning(String message)
      Logs the provided message as WARNIG status.
      Parameters:
      message - the message to log, cannot be null
    • logWarning

      public static void logWarning(String message, Throwable throwable)
      Logs the provided message as WARNIG status.
      Parameters:
      message - the message to log, cannot be null
      throwable - the cause throwable, can be null if not applicable
    • logError

      public static void logError(String message)
      Creates and logs an error status by the provided message.
      Parameters:
      message - the status message, cannot be null
    • logError

      public static void logError(String message, Throwable throwable)
      Creates and logs an error status by the provided message and the cause throwable.
      Parameters:
      message - the status message, cannot be null
      throwable - the cause throwable, can be null if not applicable
    • needToDeleteTempFolder

      public static boolean needToDeleteTempFolder(Path tempDirectory, boolean operationFailed)
      Returns true if deleting temp files is needed.
      Parameters:
      tempDirectory - path to temp folder, cannot be null
      operationFailed - if operation failed
      Returns:
      true if deleting temp files is needed
    • isDebugging

      public boolean isDebugging()
      Overrides:
      isDebugging in class org.eclipse.core.runtime.Plugin
    • start

      public void start(org.osgi.framework.BundleContext bundleContext) throws Exception
      Specified by:
      start in interface org.osgi.framework.BundleActivator
      Overrides:
      start in class org.eclipse.core.runtime.Plugin
      Throws:
      Exception
    • stop

      public void stop(org.osgi.framework.BundleContext bundleContext) throws Exception
      Specified by:
      stop in interface org.osgi.framework.BundleActivator
      Overrides:
      stop in class org.eclipse.core.runtime.Plugin
      Throws:
      Exception
    • optionsChanged

      public void optionsChanged(org.eclipse.osgi.service.debug.DebugOptions options)
      Specified by:
      optionsChanged in interface org.eclipse.osgi.service.debug.DebugOptionsListener