Class PlatformServicesUiPlugin

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

public class PlatformServicesUiPlugin extends org.eclipse.ui.plugin.AbstractUIPlugin implements org.eclipse.osgi.service.debug.DebugOptionsListener
The activator class controls the plug-in life cycle.
  • Field Details

  • Constructor Details

    • PlatformServicesUiPlugin

      public PlatformServicesUiPlugin()
  • Method Details

    • createErrorStatus

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

      public static org.eclipse.core.runtime.IStatus createErrorStatus(String message)
      Create error status by given message.
      Parameters:
      message - status message, cannot be null
      Returns:
      status created error status, never null
    • createWarningStatus

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

      public static org.eclipse.core.runtime.IStatus createWarningStatus(String message, Throwable throwable)
      Create warning status by given message and throwable.
      Parameters:
      message - status message, cannot be null
      throwable - throwable, can be null if not applicable
      Returns:
      status created warning status, never null
    • getDefault

      public static PlatformServicesUiPlugin getDefault()
      Returns the shared instance.
      Returns:
      the shared instance
    • getImage

      public static org.eclipse.swt.graphics.Image getImage(String symbolicName)
      Get image for given symbolic name.
      Parameters:
      symbolicName - image name, cannot be null
      Returns:
      image, or null if not found
    • getImageDescriptor

      public static org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(String symbolicName)
      Get image descriptor for given symbolic name.
      Parameters:
      symbolicName - image name, cannot be null
      Returns:
      image descriptor, or null if not found
    • log

      public static void log(org.eclipse.core.runtime.IStatus status)
      Write given status to log.
      Parameters:
      status - status to log, cannot be null
    • log

      public static void log(Throwable throwable)
      Logs the specified Throwable with this plug-in's log.
      Parameters:
      throwable - Throwable to log
    • 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
    • logInfo

      public static void logInfo(String message)
      Write given status to log.
      Parameters:
      message - message to log, cannot be null
    • 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.
    • getButtonWidthHint

      public static int getButtonWidthHint(org.eclipse.swt.widgets.Button button)
      Compute given button width.
      Parameters:
      button - button to compute width for, cannot be null
      Returns:
      button width
    • initializeImageRegistry

      protected void initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry registry)
      Overrides:
      initializeImageRegistry in class org.eclipse.ui.plugin.AbstractUIPlugin
    • isDebugging

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

      public void start(org.osgi.framework.BundleContext context) throws Exception
      Specified by:
      start in interface org.osgi.framework.BundleActivator
      Overrides:
      start in class org.eclipse.ui.plugin.AbstractUIPlugin
      Throws:
      Exception
    • stop

      public void stop(org.osgi.framework.BundleContext context) throws Exception
      Specified by:
      stop in interface org.osgi.framework.BundleActivator
      Overrides:
      stop in class org.eclipse.ui.plugin.AbstractUIPlugin
      Throws:
      Exception
    • optionsChanged

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

      public com.google.inject.Injector getInjector()
      Returns the plugin Guice-injector. Method is synchronized.
      Returns:
      plugin Guice-injector, never null
    • getColor

      public org.eclipse.swt.graphics.Color getColor(org.eclipse.swt.graphics.RGB rgb)
      Returns color for given rgb. User should not dispose returned color.
      Parameters:
      rgb - - rgb to get color, cannot be null.
      Returns:
      color for given rgb, never null.