Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSopot Cela2017-07-20 07:47:37 -0400
committerSopot Cela2017-07-20 07:47:37 -0400
commitf695e1ed80c0c833bdddaf677fb63a7c2eedf781 (patch)
tree3576f51debb0da9938cd8e9835ab850bbbfeface
parentcb2e9717627671c82a6b03a9099b89b3f1846298 (diff)
downloadeclipse.platform.team-f695e1ed80c0c833bdddaf677fb63a7c2eedf781.tar.gz
eclipse.platform.team-f695e1ed80c0c833bdddaf677fb63a7c2eedf781.tar.xz
eclipse.platform.team-f695e1ed80c0c833bdddaf677fb63a7c2eedf781.zip
Bug 513143 - Opening patch file creates warning entry in error log viewY20170721-0700M20170721-0410M20170721-0250
Define all partitioning id and use IDocumentExtension3 to register the partitioner. Change-Id: Ia366a5b81a44393060486585e16c95db6d682ba8 Signed-off-by: Sopot Cela <scela@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