Hi! I'm trying to implement a merge view for RDT (the view that is shown to watch diffs, for example to synchronize with the repository or before applying a refactoring). I thought it shouldn't be too hard to da and would be nice to have, but I can't get it working. The font of the view changes but it isn't colored at all.. maybe I'm setting the SimpleRubySourceViewerConfiguration up wrong or miss something.
If someone wants to take a look at it, that would be very nice :) I've attached a patch with my changes, I haven't committed it to our repository yet, not if I can't get it working :) Thanks! Mirko
Index: org.rubypeople.rdt.ui/META-INF/MANIFEST.MF
===================================================================
--- org.rubypeople.rdt.ui/META-INF/MANIFEST.MF (revision 906)
+++ org.rubypeople.rdt.ui/META-INF/MANIFEST.MF (working copy)
@@ -51,5 +51,6 @@
org.eclipse.ui.forms,
org.rubypeople.rdt.launching,
org.eclipse.search,
- org.jruby
+ org.jruby,
+ org.eclipse.compare
Eclipse-LazyStart: true
Index: org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/merge/RubyMergeViewer.java
===================================================================
--- org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/merge/RubyMergeViewer.java (revision 0)
+++ org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/merge/RubyMergeViewer.java (revision 0)
@@ -0,0 +1,50 @@
+package org.rubypeople.rdt.internal.ui.merge;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.contentmergeviewer.TextMergeViewer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocumentPartitioner;
+import org.eclipse.jface.text.TextViewer;
+import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.texteditor.ChainedPreferenceStore;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.text.IRubyPartitions;
+import org.rubypeople.rdt.internal.ui.text.SimpleRubySourceViewerConfiguration;
+import org.rubypeople.rdt.ui.text.RubyTextTools;
+
+public class RubyMergeViewer extends TextMergeViewer {
+
+ public RubyMergeViewer(Composite parent, CompareConfiguration configuration) {
+ super(parent, configuration);
+ }
+
+ @Override
+ protected IDocumentPartitioner getDocumentPartitioner() {
+ return RubyPlugin.getDefault().getRubyTextTools().createDocumentPartitioner();
+ }
+
+ @Override
+ protected void configureTextViewer(TextViewer textViewer) {
+
+ if (textViewer instanceof SourceViewer) {
+
+ SourceViewer sourceViewer = ((SourceViewer) textViewer);
+
+ RubyTextTools tools = RubyPlugin.getDefault().getRubyTextTools();
+ Document doc = new Document();
+ tools.setupRubyDocumentPartitioner(doc, IRubyPartitions.RUBY_PARTITIONING);
+
+ IPreferenceStore[] chain = { RubyPlugin.getDefault().getCombinedPreferenceStore() };
+ ChainedPreferenceStore preferenceStore = new ChainedPreferenceStore(chain);
+
+ SimpleRubySourceViewerConfiguration viewerConfiguration = new SimpleRubySourceViewerConfiguration(tools
+ .getColorManager(), preferenceStore, null, IRubyPartitions.RUBY_PARTITIONING, true);
+ sourceViewer.configure(viewerConfiguration);
+
+ } else {
+ super.configureTextViewer(textViewer);
+ }
+ }
+}
Index: org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/merge/RubyMergeViewCreator.java
===================================================================
--- org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/merge/RubyMergeViewCreator.java (revision 0)
+++ org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/merge/RubyMergeViewCreator.java (revision 0)
@@ -0,0 +1,15 @@
+package org.rubypeople.rdt.internal.ui.merge;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.IViewerCreator;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Composite;
+
+public class RubyMergeViewCreator implements IViewerCreator {
+
+ public Viewer createViewer(Composite parent, CompareConfiguration config) {
+ return new RubyMergeViewer(parent, config);
+ }
+
+}
+
Index: org.rubypeople.rdt.ui/plugin.xml
===================================================================
--- org.rubypeople.rdt.ui/plugin.xml (revision 906)
+++ org.rubypeople.rdt.ui/plugin.xml (working copy)
@@ -930,5 +930,15 @@
</description>
</fontDefinition>
</extension>
-
+
+ <extension
+ point="org.eclipse.compare.contentMergeViewers">
+ <viewer
+ class="org.rubypeople.rdt.internal.ui.merge.RubyMergeViewCreator"
+ id="org.rubypeople.rdt.internal.ui.RubyMergeViewer"/>
+ <contentTypeBinding
+ contentMergeViewerId="org.rubypeople.rdt.internal.ui.RubyMergeViewer"
+ contentTypeId="org.rubypeople.rdt.core.rubySource"/>
+ </extension>
+
</plugin>
pgpn8mseQ4Gte.pgp
Description: PGP signature
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Rubyeclipse-development mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rubyeclipse-development
