Class ResourceSelectionDialog

  • All Implemented Interfaces:
    IShellProvider

    public class ResourceSelectionDialog
    extends TitleAreaDialog
    A dialog to allow selecting OSLC resources within an OSLC delegated user interface.
    Since:
    1.1.0
    • Constructor Detail

      • ResourceSelectionDialog

        public ResourceSelectionDialog​(Shell parentShell)
        Instantiates a new dialog to select OSLC resources.
        Parameters:
        parentShell - the parent SWT shell.
    • Method Detail

      • forDialog

        public static ResourceSelectionDialog forDialog​(Shell parentShell,
                                                        Dialog dialog)
        Creates a dialog to select OSLC resources based on the specified OSLC dialog.
        Parameters:
        parentShell - the parent SWT shell.
        dialog - an OSLC dialog which defines a URL of a web page to display and the preferred size of the browser.
        Returns:
        a dialog allow selecting OSLC resources.
      • forDialogs

        public static ResourceSelectionDialog forDialogs​(Shell parentShell,
                                                         Collection<Dialog> dialogs)
        Creates a dialog to select OSLC resources based on one of the specified OSLC dialogs. The dialog displays an area above the browser for the user to select the OSLC dialog to use.
        Parameters:
        parentShell - the parent SWT shell.
        dialogs - OSLC dialogs which defines a URL of a web page to display and the preferred size of the browser.
        Returns:
        a dialog to allow selecting OSLC resources.
      • forService

        public static ResourceSelectionDialog forService​(Shell parentShell,
                                                         Service service)
        Creates a dialog to select OSLC resources based on one of the dialogs defined by the specified service. The dialog displays an area above the browser for the user to determine whether to create a new OSLC resource or select an existing one. The user must then select the actual OSLC dialog to use.
        Parameters:
        parentShell - the parent SWT shell.
        service - the service which defines OSLC creation and selection dialogs.
        Returns:
        a dialog to allow selecting OSLC resources.
      • forService

        public static ResourceSelectionDialog forService​(Shell parentShell,
                                                         Service service,
                                                         URI resourceType)
        Creates a dialog to select OSLC resources based on one of the dialogs defined by the specified service, a dialog which aims at handling the specified type of OSLC resource. The dialog displays an area above the browser for the user to determine whether to create a new OSLC resource or select an existing one. The user must then select the actual OSLC dialog to use.
        Parameters:
        parentShell - the parent SWT shell.
        service - the service which defines OSLC creation and selection dialogs.
        resourceType - the type of OSLC resource the dialog must define to be retained.
        Returns:
        a dialog to allow selecting OSLC resources.
      • forServiceProviders

        public static ResourceSelectionDialog forServiceProviders​(Shell parentShell,
                                                                  OslcClient client,
                                                                  Collection<Link> serviceProviders,
                                                                  URI domain)
        Creates a dialog to select OSLC resources based on one of the dialogs defined by the specified service providers. The dialog displays an area above the browser for the user to determine which service provider to use. The service providers are loaded using the specified OSLC client. The user then determines whether to create a new OSLC resource or select an existing one. The user must then select the actual OSLC dialog to use, a dialog which must match the specified OSLC domain.
        Parameters:
        parentShell - the parent SWT shell.
        client - an OSLC client to load service providers.
        serviceProviders - the service providers the user can select.
        domain - the OSLC domain which determines the OSLC dialogs to retain.
        Returns:
        a dialog to allow selecting OSLC resources.
      • forServiceProviders

        public static ResourceSelectionDialog forServiceProviders​(Shell parentShell,
                                                                  OslcClient client,
                                                                  Collection<Link> serviceProviders,
                                                                  URI domain,
                                                                  URI resourceType)
        Creates a dialog to select OSLC resources based on one of the dialogs defined by the specified service providers. The dialog displays an area above the browser for the user to determine which service provider to use. The service providers are loaded using the specified OSLC client. The user then determines whether to create a new OSLC resource or select an existing one. The user must then select the actual OSLC dialog to use, a dialog which must match the specified OSLC domain and OSLC resource type.
        Parameters:
        parentShell - the parent SWT shell.
        client - an OSLC client to load service providers.
        serviceProviders - the service providers the user can select.
        domain - the OSLC domain which determines the OSLC dialogs to retain.
        resourceType - the type of OSLC resource the dialog must define to be retained.
        Returns:
        a dialog to allow selecting OSLC resources.
      • forConfiguration

        public static ResourceSelectionDialog forConfiguration​(Shell parentShell,
                                                               Dialog globalConfigurationDialog,
                                                               Dialog localConfigurationDialog)
        Creates a dialog to select an OSLC Configuration based on the specified OSLC dialogs. The user first determines whether he wants to use global configuration of a local configuration, relative to a project.
        Parameters:
        parentShell - the parent SWT shell.
        globalConfigurationDialog - an OSLC global configuration dialog allowing the selection of a global configuration (might be null).
        localConfigurationDialog - an OSLC local configuration dialog allowing the selection of a local configuration, relative to a project.
        Returns:
        a dialog to allow selecting an OSLC configuration.
      • getResult

        public final List<Link> getResult()
        Returns the list of OSLC resources selected within the OSLC delegated user interface.
        Returns:
        the list of OSLC resources selected within the OSLC delegated user interface, an empty list if the dialog was canceled.
      • createDialogArea

        protected Control createDialogArea​(Composite parent)
        Creates and returns the contents of the upper part of this dialog (above the button bar). The dialog area contains a browser in which an OSLC delegated user interface is to display.
        Overrides:
        createDialogArea in class TitleAreaDialog
        Parameters:
        parent - The parent composite to contain the dialog area
        Returns:
        the dialog area control
      • createBrowser

        protected void createBrowser​(Composite parent)
        Creates a browser within the dialog.
        Parameters:
        parent - The parent composite to contain the browser.
        See Also:
        getBrowser()
      • createButtonsForButtonBar

        protected void createButtonsForButtonBar​(Composite parent)
        Creates just a Cancel button, as the OK response is expected to be sent from the OSLC delegated user interface displayed within the browser.
        Overrides:
        createButtonsForButtonBar in class Dialog
      • getBrowser

        public final Browser getBrowser()
        Returns the browser displayed within the dialog.
        Returns:
        the browser displayed within the dialog.