Class ModelOperation

    • Constructor Detail

      • ModelOperation

        protected ModelOperation​(IWorkbenchPart part,
                                 ISynchronizationScopeManager manager)
        Create a model operation that operates on the given scope.
        Parameters:
        part - the workbench part from which the merge was launched or null
        manager - the scope manager for this operation
    • Method Detail

      • sortByExtension

        public static ModelProvider[] sortByExtension​(ModelProvider[] providers)
        Return the list of provides sorted by their extends relationship. Extended model providers will appear later in the list then those that extends them. The order of model providers that independant (i.e. no extends relationship between them) will be indeterminate.
        Parameters:
        providers - the model providers
        Returns:
        the list of provides sorted by their extends relationship
      • initializeScope

        protected final void initializeScope​(IProgressMonitor monitor)
                                      throws InvocationTargetException
        Adjust the input of the operation according to the selected resource mappings and the set of interested participants. This method will prompt the user in the following cases:
        1. The scope contains additional resources than those in the input.
        2. The scope has additional mappings from a model in the input
        3. The input contains elements from multiple models

        The scope of this operation will only be prepared once. Subsequent calls to this method will do nothing. Also, if the scope was provided as an argument to a constructor, this method will do nothing (i.e. the scope will not be prepared again and no prompting will occur).

        Subclasses can customize how the scope is generated by overriding the getScopeManager() to return a custom scope manager.

        Parameters:
        monitor - a progress monitor
        Throws:
        InvocationTargetException
      • getPreviewRequestMessage

        protected String getPreviewRequestMessage()
        Return a string to be used in the preview request on the scope prompt or null if a preview of the operation results is not possible. By default, null is returned but subclasses may override.
        Returns:
        a string to be used in the preview request on the scope prompt or null if a preview of the operation results is not possible
      • promptForInputChange

        protected boolean promptForInputChange​(String requestPreviewMessage,
                                               IProgressMonitor monitor)
        Prompt the user to inform them that additional resource mappings have been included in the operations.
        Parameters:
        requestPreviewMessage - message to be displayed for the option to force a preview (or null if the preview option should not be presented
        monitor - a progress monitor
        Returns:
        whether a preview of the operation results was requested
        Throws:
        OperationCanceledException - if the user choose to cancel
      • getContext

        protected ISynchronizationContext getContext()
        Return the synchronization context for the operation or null if the operation doesn't have one or if it has not yet been created. By default, the method always returns null. Subclasses may override.
        Returns:
        the synchronization context for the operation or null
      • getScope

        public ISynchronizationScope getScope()
        Return the scope of this operation.
        Returns:
        the scope of this operation
      • isPreviewRequested

        public boolean isPreviewRequested()
        Return whether a preview of the operation before it is performed is desired.
        Returns:
        whether a preview of the operation before it is performed is desired
      • getScopeManager

        protected ISynchronizationScopeManager getScopeManager()
        Return the scope manager for this operation.
        Returns:
        the scope manager for this operation.