Class 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.
    • Constructor Detail

      • PlatformServicesUiPlugin

        public PlatformServicesUiPlugin()
    • Method Detail

      • 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
      • 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
      • getShell

        public static org.eclipse.swt.widgets.Shell getShell()
        Gets current active shell. Can return null.
        Returns:
        active shell, can be null
      • 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
      • 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