Class ParticipantPageCompareEditorInput

    • Constructor Detail

      • ParticipantPageCompareEditorInput

        public ParticipantPageCompareEditorInput​(CompareConfiguration configuration,
                                                 ISynchronizePageConfiguration pageConfiguration,
                                                 ISynchronizeParticipant participant)
        Creates a part for the provided participant. The page configuration is used when creating the participant page and the resulting compare/merge panes will be configured with the provided compare configuration.

        For example, clients can decide if the user can edit the compare panes by calling CompareConfiguration.setLeftEditable(boolean) or CompareConfiguration.setRightEditable(boolean).

        Parameters:
        configuration - the compare configuration that will be used to create the compare panes
        pageConfiguration - the configuration that will be provided to the participant prior to creating the page
        participant - the participant whose page will be displayed in this part
    • Method Detail

      • prepareInput

        protected Object prepareInput​(IProgressMonitor monitor)
                               throws InvocationTargetException,
                                      InterruptedException
        Description copied from class: CompareEditorInput
        Runs the compare operation and returns the compare result. If null is returned no differences were found and no compare editor needs to be opened. Progress should be reported to the given progress monitor. A request to cancel the operation should be honored and acknowledged by throwing InterruptedException.

        Note: this method is typically called in a modal context thread which doesn't have a Display assigned. Implementors of this method shouldn't therefore allocated any SWT resources in this method.

        Specified by:
        prepareInput in class CompareEditorInput
        Parameters:
        monitor - the progress monitor to use to display progress and receive requests for cancellation
        Returns:
        the result of the compare operation, or null if there are no differences
        Throws:
        InvocationTargetException - if the prepareInput method must propagate a checked exception, it should wrap it inside an InvocationTargetException; runtime exceptions are automatically wrapped in an InvocationTargetException by the calling context
        InterruptedException - if the operation detects a request to cancel, using IProgressMonitor.isCanceled(), it should exit by throwing InterruptedException
      • getTitleImage

        public Image getTitleImage()
        Description copied from class: CompareEditorInput
        Returns the title image which will be used in the compare editor's title bar. Returns the title image which will be used when presenting the compare result. This implementation returns a generic compare icon. Subclasses can override.
        Overrides:
        getTitleImage in class CompareEditorInput
        Returns:
        the title image, or null if none
      • asCompareInput

        protected ICompareInput asCompareInput​(ISelection selection)
        Description copied from class: PageCompareEditorInput
        Return a compare input that represents the selection. This input is used to feed the structure and content viewers. By default, a compare input is returned if the selection is of size 1 and the selected element implements ICompareInput. Subclasses may override.
        Overrides:
        asCompareInput in class PageCompareEditorInput
        Parameters:
        selection - the selection
        Returns:
        a compare input representing the selection
      • isSaveNeeded

        public boolean isSaveNeeded()
        Description copied from class: CompareEditorInput
        Returns true if there are unsaved changes in either left or right side. The value returned is the value of the DIRTY_STATE property of this input object. Returns true if left or right side has unsaved changes Subclasses don't have to override if the functionality provided by setDirty is sufficient.
        Overrides:
        isSaveNeeded in class CompareEditorInput
        Returns:
        true if there are changes that need to be saved
      • saveChanges

        public void saveChanges​(IProgressMonitor monitor)
                         throws CoreException
        Description copied from class: CompareEditorInput
        Saves any unsaved changes. Subclasses must override to save any changes. This implementation tries to flush changes in all viewers by calling ISavable.save on them.
        Overrides:
        saveChanges in class CompareEditorInput
        Parameters:
        monitor - an IProgressMonitor that the implementation of save may use to show progress
        Throws:
        CoreException - If save fails.
      • getPageConfiguration

        public ISynchronizePageConfiguration getPageConfiguration()
        Return the synchronize page configuration for this part
        Returns:
        Returns the pageConfiguration.
      • getParticipant

        public ISynchronizeParticipant getParticipant()
        Return the Synchronize participant for this part
        Returns:
        Returns the participant.
      • createContents

        public Control createContents​(Composite parent)
        Description copied from class: CompareEditorInput
        Creates the SWT controls that are used to display the result of the compare operation. Creates the SWT Controls and sets up the wiring between the individual panes. This implementation creates all four panes but makes only the necessary ones visible. Finally it feeds the compare result into the top left structure viewer and the content viewer.

        Subclasses may override if they need to change the layout or wiring between panes.

        Overrides:
        createContents in class CompareEditorInput
        Parameters:
        parent - the parent control under which the control must be created
        Returns:
        the SWT control hierarchy for the compare editor
      • isOfferToRememberParticipant

        protected boolean isOfferToRememberParticipant()
        Return whether the ability to remember the participant in the synchronize view should be presented to the user. By default, true is returned. Subclasses may override.
        Returns:
        whether the ability to remember the participant in the synchronize view should be presented to the user
      • okPressed

        public boolean okPressed()
        Description copied from class: CompareEditorInput
        The OK button was pressed in a dialog. If one or both of the sides of the input is editable then any changes will be saved. If the input is for edition selection (see CompareEditorInput.isEditionSelectionDialog()), it is up to subclasses to override this method in order to perform the appropriate operation on the selected edition.
        Overrides:
        okPressed in class CompareEditorInput
        Returns:
        whether the dialog should be closed or not.
      • cancelPressed

        public void cancelPressed()
        Description copied from class: CompareEditorInput
        The CANCEL button was pressed in a dialog. By default, nothing is done. Subclasses may override.
        Overrides:
        cancelPressed in class CompareEditorInput