|
From: <caw...@us...> - 2007-05-02 13:35:02
|
Revision: 2417
http://svn.sourceforge.net/rubyeclipse/?rev=2417&view=rev
Author: cawilliams
Date: 2007-05-02 06:35:00 -0700 (Wed, 02 May 2007)
Log Message:
-----------
make the source hover do syntax coloring and use the editor's font
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/SourceViewerInformationControl.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/SourceViewerInformationControl.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/SourceViewerInformationControl.java 2007-05-02 13:17:38 UTC (rev 2416)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/SourceViewerInformationControl.java 2007-05-02 13:35:00 UTC (rev 2417)
@@ -11,6 +11,7 @@
package org.rubypeople.rdt.internal.ui.text.ruby.hover;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IInformationControl;
@@ -37,6 +38,7 @@
import org.eclipse.swt.widgets.Shell;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
import org.rubypeople.rdt.internal.ui.rubyeditor.RubySourceViewer;
+import org.rubypeople.rdt.internal.ui.text.IRubyPartitions;
import org.rubypeople.rdt.internal.ui.text.SimpleRubySourceViewerConfiguration;
/**
@@ -131,7 +133,7 @@
// Source viewer
IPreferenceStore store= RubyPlugin.getDefault().getCombinedPreferenceStore();
fViewer= new RubySourceViewer(composite, null, null, false, style, store);
- fViewer.configure(new SimpleRubySourceViewerConfiguration(RubyPlugin.getDefault().getRubyTextTools().getColorManager(), store, null, null, false));
+ fViewer.configure(new SimpleRubySourceViewerConfiguration(RubyPlugin.getDefault().getRubyTextTools().getColorManager(), store, null, IRubyPartitions.RUBY_PARTITIONING, false));
fViewer.setEditable(false);
fText= fViewer.getTextWidget();
@@ -140,6 +142,8 @@
fText.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
fText.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+ initializeFont();
+
fText.addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent e) {
@@ -229,6 +233,17 @@
public SourceViewerInformationControl(Shell parent, String statusFieldText) {
this(parent, SWT.NONE, statusFieldText);
}
+
+ /**
+ * Initialize the font to the Ruby editor font.
+ *
+ * @since 1.0
+ */
+ private void initializeFont() {
+ Font font= JFaceResources.getFont("org.rubypeople.rdt.ui.editors.textfont"); //$NON-NLS-1$
+ StyledText styledText= getViewer().getTextWidget();
+ styledText.setFont(font);
+ }
/*
* @see org.eclipse.jface.text.IInformationControlExtension2#setInput(java.lang.Object)
@@ -250,7 +265,7 @@
}
IDocument doc= new Document(content);
- RubyPlugin.getDefault().getRubyTextTools().setupRubyDocumentPartitioner(doc);
+ RubyPlugin.getDefault().getRubyTextTools().setupRubyDocumentPartitioner(doc, IRubyPartitions.RUBY_PARTITIONING);
fViewer.setInput(doc);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|