Class PartialModelController

  • All Implemented Interfaces:
    IManagedService

    public class PartialModelController
    extends Object
    implements IManagedService
    The partial model controller working with a specified comparison session and delegating operations to a collection of specific controllers defined in extensions.
    • Constructor Detail

      • PartialModelController

        public PartialModelController()
    • Method Detail

      • createDirectNodeChildren

        public void createDirectNodeChildren​(IPartialModel partialModel,
                                             IDirectPartialModelNode directNode,
                                             ILinkRepresentationSupport linkRepresentationSupport,
                                             IDtComparisonViewRefresher refresher,
                                             ComparisonContext comparisonContext)
        Creates child nodes for the specified direct node of a partial model.
        Parameters:
        partialModel - the partial model, can not be null
        directNode - the direct node, can not be null
        linkRepresentationSupport - the link representation support, can not be null
        refresher - the refresher, can not be null
        comparisonContext - the comparison context, not null
      • positionChildNode

        public boolean positionChildNode​(IPartialModel partialModel,
                                         IPartialModelNode parentNode,
                                         ComparisonNode modelNode,
                                         IComparisonSession comparisonSession)
        Positions the specified comparison model node in a subtree of the specified partial model node. This may involve creation of additional (intermediate) subparents for hosting the positioned node.
        Parameters:
        partialModel - the partial model, can not be null
        parentNode - the parent partial model node, can not be null
        modelNode - the comparison model node to be positioned, can not be null
        comparisonSession - the comparison session, can not be null
        Returns:
        true if the node was positioned successfully
      • getTopNodes

        public Object[] getTopNodes​(IPartialModel partialModel,
                                    ILinkRepresentationSupport linkRepresentationSupport,
                                    IDtComparisonViewRefresher refresher,
                                    ComparisonContext comparisonContext)
        Gets top nodes for the specified partial model.
        Parameters:
        partialModel - the partial model to get top nodes for, can not be null
        linkRepresentationSupport - the link representation support, can not be null
        refresher - the refresher, can not be null
        comparisonContext - the comparison context, not null
        Returns:
        an array of top nodes, may be null
      • editMergeSettings

        public void editMergeSettings​(IPartialModel partialModel,
                                      IPartialModelNode node,
                                      IComparisonSession comparisonSession,
                                      org.eclipse.swt.widgets.Shell shell,
                                      boolean readOnly,
                                      org.eclipse.swt.graphics.Color colorHasDiffs,
                                      org.eclipse.swt.graphics.Color colorOnlyMain,
                                      org.eclipse.swt.graphics.Color colorOnlyOther,
                                      String mainComparisonSideName,
                                      String otherComparisonSideName,
                                      DtComparisonView parentComparisonView,
                                      ISelectionProviderDelegate selectionProviderDelegate,
                                      org.eclipse.jface.resource.ResourceManager resourceManager)
        Edits merge settings of the specified partial model node in the UI.
        Parameters:
        partialModel - the partial model, can not be null
        node - the node with merge settings to be edited, can not be null
        comparisonSession - the comparison session, can not be null
        shell - the parent shell, can not be null
        readOnly - true if it is possible to set merge settings and false if it is only possible to view the difference in node
        colorHasDiffs - the color for 'node has diffs' case, cannot be null.
        colorOnlyMain - the color for 'node has only main object' case, cannot be null.
        colorOnlyOther - the color for 'node has only other object' case, cannot be null.
        mainComparisonSideName - the main comparison side name, cannot be null.
        otherComparisonSideName - the other comparison side name, cannot be null.
        parentComparisonView - the parent comparison view this dialog was called from, cannot be null
        selectionProviderDelegate - the selection provider delegate, cannot be null.
        resourceManager - the resource manager, cannot be null
      • refreshNodes

        public void refreshNodes​(IPartialModel partialModel,
                                 Collection<IPartialModelNode> nodes,
                                 IComparisonSession comparisonSession)
        Refreshes the properties of the specified nodes.
        Parameters:
        partialModel - the partial model, can not be null
        nodes - the partial nodes to refresh, can not be null
        comparisonSession - the comparison session, can not be null
      • refreshNodeWithChildren

        public void refreshNodeWithChildren​(IPartialModel partialModel,
                                            IPartialModelNode node,
                                            IComparisonSession comparisonSession)
        Refreshes the properties of the specified node and all its children.
        Parameters:
        partialModel - the partial model, can not be null
        node - the partial node to refresh, can not be null
        comparisonSession - the comparison session, can not be null
      • setMergeRule

        public void setMergeRule​(IPartialModel partialModel,
                                 IMergeRulePartialModelNode node,
                                 MergeRule rule,
                                 IComparisonSession comparisonSession)
        Sets the merge rule for the specified partial model node.
        Parameters:
        partialModel - the partial model, can not be null
        node - the node, can not be null
        rule - the merge rule, can not be null
        comparisonSession - the comparison session, can not be null
      • check

        public List<IPartialModelNode> check​(IPartialModel partialModel,
                                             IPartialModelNode node,
                                             boolean checked,
                                             IComparisonSession comparisonSession)
        Checks or unchecks a partial model node.
        Parameters:
        partialModel - the partial model, can not be null
        node - the node to modify the "Checked" flag, can not be null
        checked - the check value
        comparisonSession - the comparison session, can not be null
        Returns:
        list of nodes which state has been possibly updated, never null
      • getChildren

        public Object[] getChildren​(Object parentElement,
                                    IPartialModel partialModel,
                                    ILinkRepresentationSupport linkRepresentationSupport,
                                    IDtComparisonViewRefresher refresher,
                                    IComparisonSession comparisonSession)
        Returns the children of the specified parent element.
        Parameters:
        parentElement - the parent element to get children for, can not be null
        partialModel - the partial model, can not be null
        linkRepresentationSupport - the link representation support, can not be null'
        refresher - the refresher, can not be null
        comparisonSession - the comparison session, can not be null
        Returns:
        an array of children of the parent element or null if no children are available
      • getParent

        public Object getParent​(Object element)
        Returns the parent of the specified element.
        Parameters:
        element - the element to get parent for, can not be null
        Returns:
        parent or null
      • hasChildren

        public boolean hasChildren​(Object element)
        Checks whether the specified element has children.
        Parameters:
        element - the parent, can not be null
        Returns:
        true if the element has children
      • supportsComparisonUsingExternalTool

        public boolean supportsComparisonUsingExternalTool​(IPartialModelNode node)
        Tells whether the specified node supports comparison using external tool.
        Parameters:
        node - the partial model node, cannot be null
        Returns:
        true if the specified node supports comparison using external tool, false otherwise
      • compareUsingExternalTool

        public void compareUsingExternalTool​(IPartialModelNode node,
                                             org.eclipse.swt.widgets.Shell shell,
                                             String mainComparisonSideName,
                                             String otherComparisonSideName)
        Compares the specified node using external tool.
        Parameters:
        node - the partial node to compare using external tool, cannot be null
        shell - the parent shell, cannot be null
        mainComparisonSideName - the main comparison side name, cannot be null
        otherComparisonSideName - the other comparison side name, cannot be null
      • supportsMergingUsingExternalTool

        public boolean supportsMergingUsingExternalTool​(IPartialModelNode node)
        Tells whether the specified node supports merging using external tool.
        Parameters:
        node - the partial model node, cannot be null
        Returns:
        true if the specified node supports merging using external tool, false otherwise
      • mergeUsingExternalTool

        public void mergeUsingExternalTool​(IPartialModel partialModel,
                                           IPartialModelNode node,
                                           org.eclipse.swt.widgets.Shell shell,
                                           String mainComparisonSideName,
                                           String otherComparisonSideName)
        Merges the specified node using external tool.
        Parameters:
        partialModel - the partial model, cannot be null
        node - the partial node to merge using external tool, cannot be null
        shell - the parent shell, cannot be null
        mainComparisonSideName - the main comparison side name, cannot be null
        otherComparisonSideName - the other comparison side name, cannot be null
      • getAllChildren

        public List<IPartialModelNode> getAllChildren​(IPartialModelNode node)
        Gets list of all children together with sub-children of the specified node.
        Parameters:
        node - the node to collect children for, cannot be null
        Returns:
        the list of recursively collected children, never null