Class UnifiedDiffManager
java.lang.Object
org.eclipse.compare.unifieddiff.internal.UnifiedDiffManager
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic IAnnotationModelannotationModelOf(ITextEditor editor) Returns the annotation model the diffs of the given editor live in, ornullwhen it has none.static voiddispose(ITextEditor editor) static voidstatic voidfoldUnchangedRegions(ProjectionViewer viewer, IDocument document, List<UnifiedDiffManager.UnifiedDiff> unifiedDiffs, UnifiedDiffMode mode, int contextLines) Collapses the unchanged regions between the displayed diffs, keepingcontextLinesvisible next to each change.static List<UnifiedDiffManager.UnifiedDiff> get(ITextViewer viewer) static booleanstatic booleanstatic booleanstatic booleanisShadowedByCollapsedRegion(Position fold, Collection<Position> collapsedRegions) Whether a fold starting at the given position is swallowed by one of the collapsed regions.static IStatusopen(ITextViewer viewer, IDocument leftDocument, IAnnotationModel model, IFile file, String source, UnifiedDiffMode mode, List<Action> additionalActions, UnifiedDiff.TokenComparatorFactory tokenComparatorFactory, UnifiedDiff.IgnoreWhitespaceContributorFactory ignoreWhitespaceContributorFactory, ICompareFilter[] compareFilters, char leftContributor, char rightContributor, boolean ignoreWhiteSpace, int foldContextLines) Shows the diff between the document of the viewer and the source in the viewer, replacing a diff shown there before.static IStatusopen(ITextViewer viewer, IDocument leftDocument, IAnnotationModel model, IFile file, String source, UnifiedDiffMode mode, List<Action> additionalActions, UnifiedDiff.TokenComparatorFactory tokenComparatorFactory, UnifiedDiff.IgnoreWhitespaceContributorFactory ignoreWhitespaceContributorFactory, ICompareFilter[] compareFilters, char leftContributor, char rightContributor, boolean ignoreWhiteSpace, int foldContextLines, ToolbarActionPresentations toolbarActionPresentations) static IStatusopen(ITextEditor editor, String source, UnifiedDiffMode mode, List<Action> additionalActions, UnifiedDiff.TokenComparatorFactory tokenComparatorFactory, UnifiedDiff.IgnoreWhitespaceContributorFactory ignoreWhitespaceContributorFactory, ICompareFilter[] compareFilters, char leftContributor, char rightContributor, boolean ignoreWhiteSpace, int foldContextLines) static IStatusopen(ITextEditor editor, String source, UnifiedDiffMode mode, List<Action> additionalActions, UnifiedDiff.TokenComparatorFactory tokenComparatorFactory, UnifiedDiff.IgnoreWhitespaceContributorFactory ignoreWhitespaceContributorFactory, ICompareFilter[] compareFilters, char leftContributor, char rightContributor, boolean ignoreWhiteSpace, int foldContextLines, ToolbarActionPresentations toolbarActionPresentations) static IStatusopen(ITextEditor editor, String source, UnifiedDiffMode mode, List<Action> additionalActions, UnifiedDiff.TokenComparatorFactory tokenComparatorFactory, UnifiedDiff.IgnoreWhitespaceContributorFactory ignoreWhitespaceContributorFactory, ICompareFilter[] compareFilters, char leftContributor, char rightContributor, boolean ignoreWhiteSpace, int foldContextLines, ToolbarActionPresentations toolbarActionPresentations, UnifiedDiffEventListener eventListener) static voidput(ITextViewer viewer, List<UnifiedDiffManager.UnifiedDiff> diffs) static voidremoveAnnotations(IAnnotationModel model, List<? extends Annotation> annotations) Removes temporary unified-diff annotations after marking them deleted so that line-header code minings reset their vertical indent.unchangedFoldRegions(IDocument document, List<UnifiedDiffManager.UnifiedDiff> unifiedDiffs, UnifiedDiffMode mode, int contextLines) Returns the regions to collapse: the unchanged gaps before, between and after the given diffs, each shortened bycontextLinestowards a neighboring change.
-
Field Details
-
CANCELED_BY_USER
The user canceled the computation. The text editor is already open, so the caller must not fall back to the classic compare editor. Compared by identity, because a status code would clash withStatus.CANCEL_STATUS, which this class returns when it cannot show a unified diff at all.
-
-
Constructor Details
-
UnifiedDiffManager
public UnifiedDiffManager()
-
-
Method Details
-
put
-
get
-
annotationModelOf
Returns the annotation model the diffs of the given editor live in, ornullwhen it has none. The document provider of an editor on something other than a workspace file, a revision for example, supplies no model, so the one installed on the viewer is used. -
dispose
-
open
public static IStatus open(ITextEditor editor, String source, UnifiedDiffMode mode, List<Action> additionalActions, UnifiedDiff.TokenComparatorFactory tokenComparatorFactory, UnifiedDiff.IgnoreWhitespaceContributorFactory ignoreWhitespaceContributorFactory, ICompareFilter[] compareFilters, char leftContributor, char rightContributor, boolean ignoreWhiteSpace, int foldContextLines) -
open
public static IStatus open(ITextEditor editor, String source, UnifiedDiffMode mode, List<Action> additionalActions, UnifiedDiff.TokenComparatorFactory tokenComparatorFactory, UnifiedDiff.IgnoreWhitespaceContributorFactory ignoreWhitespaceContributorFactory, ICompareFilter[] compareFilters, char leftContributor, char rightContributor, boolean ignoreWhiteSpace, int foldContextLines, ToolbarActionPresentations toolbarActionPresentations) -
open
public static IStatus open(ITextEditor editor, String source, UnifiedDiffMode mode, List<Action> additionalActions, UnifiedDiff.TokenComparatorFactory tokenComparatorFactory, UnifiedDiff.IgnoreWhitespaceContributorFactory ignoreWhitespaceContributorFactory, ICompareFilter[] compareFilters, char leftContributor, char rightContributor, boolean ignoreWhiteSpace, int foldContextLines, ToolbarActionPresentations toolbarActionPresentations, UnifiedDiffEventListener eventListener) -
open
public static IStatus open(ITextViewer viewer, IDocument leftDocument, IAnnotationModel model, IFile file, String source, UnifiedDiffMode mode, List<Action> additionalActions, UnifiedDiff.TokenComparatorFactory tokenComparatorFactory, UnifiedDiff.IgnoreWhitespaceContributorFactory ignoreWhitespaceContributorFactory, ICompareFilter[] compareFilters, char leftContributor, char rightContributor, boolean ignoreWhiteSpace, int foldContextLines) Shows the diff between the document of the viewer and the source in the viewer, replacing a diff shown there before. The file is the one the document belongs to, if any; it is checked for being editable before it is modified. -
open
public static IStatus open(ITextViewer viewer, IDocument leftDocument, IAnnotationModel model, IFile file, String source, UnifiedDiffMode mode, List<Action> additionalActions, UnifiedDiff.TokenComparatorFactory tokenComparatorFactory, UnifiedDiff.IgnoreWhitespaceContributorFactory ignoreWhitespaceContributorFactory, ICompareFilter[] compareFilters, char leftContributor, char rightContributor, boolean ignoreWhiteSpace, int foldContextLines, ToolbarActionPresentations toolbarActionPresentations) -
foldUnchangedRegions
public static void foldUnchangedRegions(ProjectionViewer viewer, IDocument document, List<UnifiedDiffManager.UnifiedDiff> unifiedDiffs, UnifiedDiffMode mode, int contextLines) Collapses the unchanged regions between the displayed diffs, keepingcontextLinesvisible next to each change. Reuses the editor's projection (folding) model, so this is a no-op when folding is disabled for the editor. Folds of the editor that a collapsed region would swallow are taken out of the model until that region is expanded again. -
unchangedFoldRegions
public static List<Position> unchangedFoldRegions(IDocument document, List<UnifiedDiffManager.UnifiedDiff> unifiedDiffs, UnifiedDiffMode mode, int contextLines) Returns the regions to collapse: the unchanged gaps before, between and after the given diffs, each shortened bycontextLinestowards a neighboring change. A gap that would not hide a line below its caption is left out. -
isShadowedByCollapsedRegion
public static boolean isShadowedByCollapsedRegion(Position fold, Collection<Position> collapsedRegions) Whether a fold starting at the given position is swallowed by one of the collapsed regions. The folding ruler paints such a fold on the first line of it that is still visible but toggles it by its start line, so its indicator either sits on a foreign line where clicking it does nothing, or shares the caption line of the collapsed region and competes with it. -
error
-
isOverlay
-
isRevert
-
isReadOnly
-
removeAnnotations
public static void removeAnnotations(IAnnotationModel model, List<? extends Annotation> annotations) Removes temporary unified-diff annotations after marking them deleted so that line-header code minings reset their vertical indent.
-