Class UIHelper


  • public final class UIHelper
    extends java.lang.Object
    This class has been created to hold methods that provide specific functionality or services.
    • Constructor Summary

      Constructors 
      Constructor Description
      UIHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void centerOnMonitor​(org.eclipse.swt.widgets.Monitor monitor, org.eclipse.swt.widgets.Shell shell)
      Center shell on specified monitor.
      static void centerOnScreen​(org.eclipse.swt.widgets.Shell shell)
      This is a helper method created to center a shell on the screen.
      static org.eclipse.swt.graphics.Image getImage​(java.lang.String sPluginRelativePath)
      This is a convenience method to get an imgIcon from a URL.
      static org.eclipse.swt.graphics.Point getScreenLocation​(org.eclipse.swt.widgets.Composite cmpTarget)
      This is a helper method created to get the location on screen of a composite.
      static java.net.URL getURL​(java.lang.String sPluginRelativePath)
      This method returns an URL for a resource given its plugin relative path.
      static boolean isEclipseMode()
      Returns if running in eclipse mode or stand-alone mode currently.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • IMAGE_NAV_FORWARD

        public static final java.lang.String IMAGE_NAV_FORWARD
        See Also:
        Constant Field Values
      • IMAGE_NAV_FORWARD_DIS

        public static final java.lang.String IMAGE_NAV_FORWARD_DIS
        See Also:
        Constant Field Values
      • IMAGE_NAV_BACKWARD

        public static final java.lang.String IMAGE_NAV_BACKWARD
        See Also:
        Constant Field Values
      • IMAGE_NAV_BACKWARD_DIS

        public static final java.lang.String IMAGE_NAV_BACKWARD_DIS
        See Also:
        Constant Field Values
    • Constructor Detail

      • UIHelper

        public UIHelper()
    • Method Detail

      • getScreenLocation

        public static org.eclipse.swt.graphics.Point getScreenLocation​(org.eclipse.swt.widgets.Composite cmpTarget)
        This is a helper method created to get the location on screen of a composite. It does not take into account multiple monitors.
        Parameters:
        cmpTarget - The composite whose location on screen is required
        Returns:
        The location of the composite on screen.
      • centerOnScreen

        public static void centerOnScreen​(org.eclipse.swt.widgets.Shell shell)
        This is a helper method created to center a shell on the screen. It centers the shell on the primary monitor in a multi-monitor configuration.
        Parameters:
        shell - The shell to be centered on screen
      • centerOnMonitor

        public static void centerOnMonitor​(org.eclipse.swt.widgets.Monitor monitor,
                                           org.eclipse.swt.widgets.Shell shell)
        Center shell on specified monitor.
        Parameters:
        monitor - specified monitor will display shell.
        shell - the shell to be centered on monitor.
      • getURL

        public static java.net.URL getURL​(java.lang.String sPluginRelativePath)
        This method returns an URL for a resource given its plugin relative path. It is intended to be used to abstract out the usage of the UI as a plugin or standalone component when it comes to accessing resources.
        Parameters:
        sPluginRelativePath - The path to the resource relative to the plugin location.
        Returns:
        URL representing the location of the resource.
      • getImage

        public static org.eclipse.swt.graphics.Image getImage​(java.lang.String sPluginRelativePath)
        This is a convenience method to get an imgIcon from a URL.
        Parameters:
        sPluginRelativePath - The URL for the imgIcon.
        Returns:
        The imgIcon represented by the given URL.
        See Also:
        #setImageCached( boolean )
      • isEclipseMode

        public static boolean isEclipseMode()
        Returns if running in eclipse mode or stand-alone mode currently.