Class CompareUiUtils


  • public class CompareUiUtils
    extends Object
    Utility methods of Comparison UI.
    • Constructor Detail

      • CompareUiUtils

        public CompareUiUtils()
    • Method Detail

      • getComparisonSideTitle

        public static String getComparisonSideTitle​(ComparisonSide side)
        Returns the title of the specified comparison side.
        Parameters:
        side - the comparison side, not null
        Returns:
        the title of the side, never null
      • getParentSkippingVirtual

        public static IPartialModelNode getParentSkippingVirtual​(IPartialModelNode node)
        Returns partial node's parent skipping virtual ones if they are.
        Parameters:
        node - the node to get parent for, cannot be null
        Returns:
        the parent partial node found or null
      • syncExec

        public static void syncExec​(Runnable runnable)
        Synchronously executes given runnable.
        Parameters:
        runnable - the runnable, cannot be null.
      • createComparisonContext

        public static ComparisonContext createComparisonContext​(IComparisonSession session,
                                                                boolean writeEnabled)
        Creates instance of a comparison context.
        Parameters:
        session - the comparison session to create context for, cannot be null
        writeEnabled - indicates that writing to the comparison model will be allowed
        Returns:
        the comparison context instance, never null
      • findOtherObject

        public static org.eclipse.emf.ecore.EObject findOtherObject​(IPartialModelNode node,
                                                                    ComparisonContext comparisonContext)
        Gets OTHER-side model object for the specified partial node. This method can be used to obtain OTHER object even for equal nodes. It walks from the given node up to the parent that has non-null comparison node and then goes back by OTHER-side model using remembered path.
        Parameters:
        node - the node to get OTHER-side model object for, cannot be null
        comparisonContext - the comparison context, cannot be null
        Returns:
        the OTHER model object found or null if no such object
      • findComparisonNode

        public static ContainmentComparisonNode findComparisonNode​(ComparisonTreeNode parent,
                                                                   org.eclipse.emf.ecore.EStructuralFeature feature,
                                                                   IComparisonSession session)
        Finds child comparison node with the given feature. Searches only for containment child nodes skipping all top ones.
        Parameters:
        parent - the parent comparison node to search in, cannot be null
        feature - the feature to search the child for, cannot be null
        session - the comparison session, cannot be null
        Returns:
        the child comparison node found or null
      • getCommitShortMessage

        public static String getCommitShortMessage​(org.eclipse.jgit.revwalk.RevCommit commit)
        Gets shortened commit message.
        Parameters:
        commit - commit to get message for, cannot be null
        Returns:
        shortened commit message, never null