Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-07-19 02:34:26 -0400
committerAlexander Kurtakov2017-07-19 02:34:26 -0400
commit39d6760d33c8eecafd04de3c321729daee7acddf (patch)
tree88e6562073c65fa59aea6ed553aa6d1de8767b76
parent311592cf94bd143b3136bfa41da28d0cd5725571 (diff)
downloadeclipse.platform.team-39d6760d33c8eecafd04de3c321729daee7acddf.tar.gz
eclipse.platform.team-39d6760d33c8eecafd04de3c321729daee7acddf.tar.xz
eclipse.platform.team-39d6760d33c8eecafd04de3c321729daee7acddf.zip
Bug 513143 - Opening patch file creates warning entry in error log view
Define all partitioning id and use IDocumentExtension3 to register the partitioner. Change-Id: I28b66c51ec95a96c83853e203fdc432a2c9b52ca Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/DiffPartitioner.java10
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/IDiffPartitioning.java1
-rw-r--r--bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/presentation/DiffPresentationReconciler.java1
3 files changed, 10 insertions, 2 deletions
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/DiffPartitioner.java b/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/DiffPartitioner.java
index 1caf63515..eb52620dc 100644
--- a/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/DiffPartitioner.java
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/DiffPartitioner.java
@@ -12,6 +12,7 @@ package org.eclipse.team.internal.genericeditor.diff.extension.partitioner;
import org.eclipse.core.filebuffers.IDocumentSetupParticipant;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentExtension3;
import org.eclipse.jface.text.rules.FastPartitioner;
import org.eclipse.jface.text.rules.IPartitionTokenScanner;
@@ -20,7 +21,12 @@ public class DiffPartitioner implements IDocumentSetupParticipant{
public void setup(IDocument document) {
IPartitionTokenScanner scanner = new DiffPartitionScanner();
FastPartitioner partitioner = new FastPartitioner(scanner, IDiffPartitioning.LEGAL_PARTITION_TYPES);
- document.setDocumentPartitioner(partitioner);
- partitioner.connect(document);
+ if (document instanceof IDocumentExtension3) {
+ final IDocumentExtension3 extension3 = (IDocumentExtension3) document;
+ extension3.setDocumentPartitioner(IDiffPartitioning.DIFF_PARTITIONINING, partitioner);
+ } else {
+ document.setDocumentPartitioner(partitioner);
+ }
+ partitioner.connect(document);
}
}
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/IDiffPartitioning.java b/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/IDiffPartitioning.java
index a85e77b36..24533bb4c 100644
--- a/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/IDiffPartitioning.java
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/partitioner/IDiffPartitioning.java
@@ -13,6 +13,7 @@ package org.eclipse.team.internal.genericeditor.diff.extension.partitioner;
import org.eclipse.jface.text.IDocument;
public interface IDiffPartitioning {
+ public static final String DIFF_PARTITIONINING = "__DIFF_PARTITIONING"; //$NON-NLS-1$
public static final String PARTITION_BODY = "__PARTITION_BODY"; //$NON-NLS-1$
public static final String PARTITION_HEADER = "__PARTITION_HEADER"; //$NON-NLS-1$
public static final String[] LEGAL_PARTITION_TYPES = new String[] {PARTITION_HEADER,PARTITION_BODY, IDocument.DEFAULT_CONTENT_TYPE };
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/presentation/DiffPresentationReconciler.java b/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/presentation/DiffPresentationReconciler.java
index f6e74dcd9..9c5b12e3e 100644
--- a/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/presentation/DiffPresentationReconciler.java
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/presentation/DiffPresentationReconciler.java
@@ -63,6 +63,7 @@ public class DiffPresentationReconciler extends PresentationReconciler {
DefaultDamagerRepairer dr = new DefaultDamagerRepairer(scanner);
this.setDamager(dr, IDiffPartitioning.PARTITION_BODY);
this.setRepairer(dr, IDiffPartitioning.PARTITION_BODY);
+ this.setDocumentPartitioning(IDiffPartitioning.DIFF_PARTITIONINING);
}
}

Back to the top