Class Utils


  • public class Utils
    extends Object
    Utility class.
    • Constructor Detail

      • Utils

        public Utils()
    • Method Detail

      • setFont

        public static void setFont​(Composite composite,
                                   int height,
                                   int style)
        Sets the Font of the given Composite. The new Font has the same name as the Font used before. The style and the height is set to the given values. Uses LocalResourceManager to dispose the Font if it is no longer needed.
        Parameters:
        composite - the Composite the Font is set for
        height - the height of the Font
        style - the swt style of the Font
      • colorCompositeBackground

        public static void colorCompositeBackground​(Composite c,
                                                    int id)
        Colors the background of the given Composite with the Color specified by the given id.
        Parameters:
        c - the Composite to color
        id - the color constant
      • openReloadDialog

        public static boolean openReloadDialog​(Shell shell,
                                               String views,
                                               URI resourceURI)
        Shows a reload dialog asking the user whether a modied resource that is also modified by another party should be reloaded or not.
        Parameters:
        shell - the parent Shell
        views - a string representation of the affected views
        resourceURI - the URI of the resource
        Returns:
        true if the user presses the Yes button, false otherwise
      • openSaveDialog

        public static boolean openSaveDialog​(Shell shell,
                                             String views,
                                             URI resourceURI)
        Shows a save dialog asking the user whether a modified resource that is also modified by another party should be replaced or not.
        Parameters:
        shell - the parent Shell
        views - a string representation of the affected views
        resourceURI - the URI of the resource
        Returns:
        true if the user presses the Yes button, false otherwise
      • openSaveChangesDialog

        public static int openSaveChangesDialog​(Shell shell,
                                                String views,
                                                URI resourceURI)
        Shows a save dialog asking the user whether the changes made by the views represented by the given representation should be saved or not.
        Parameters:
        shell - the parent Shell
        views - a string representation of the affected views
        resourceURI - the URI of the resource
        Returns:
        a status code representing the users choice.