Skip to content
Browse files

Use correct background colour in formatter preference page preview (c…

…loses #1000358)

(cherry picked from commit a40a4c7)
  • Loading branch information...
1 parent f3ed38b commit 5260ad1eb09fd417bcbaa1946545d55a04845a7b @mdr mdr committed
View
9 org.scala-ide.sdt.core/src/scala/tools/eclipse/ScalaPreviewerFactory.scala
@@ -1,5 +1,8 @@
package scala.tools.eclipse
+import org.eclipse.jface.text.source.SourceViewer
+import org.eclipse.ui.editors.text.EditorsUI
+import org.eclipse.ui.texteditor.ChainedPreferenceStore
import org.eclipse.jface.util.{ IPropertyChangeListener, PropertyChangeEvent }
import org.eclipse.jface.text.IDocument
import org.eclipse.jface.text.Document
@@ -19,8 +22,8 @@ import org.eclipse.swt.widgets.Composite
object ScalaPreviewerFactory {
- def createPreviewer(parent: Composite, preferenceStore: IPreferenceStore, initialText: String): (Control, IDocument) = {
-
+ def createPreviewer(parent: Composite, scalaPreferenceStore: IPreferenceStore, initialText: String): SourceViewer = {
+ val preferenceStore = new ChainedPreferenceStore(Array(scalaPreferenceStore, EditorsUI.getPreferenceStore))
val previewViewer = new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, preferenceStore)
val font = JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)
previewViewer.getTextWidget.setFont(font)
@@ -43,7 +46,7 @@ object ScalaPreviewerFactory {
previewViewer.invalidateTextPresentation()
}
})
- (previewViewer.getControl, document)
+ previewViewer
}
}
View
5 org.scala-ide.sdt.core/src/scala/tools/eclipse/formatter/FormatterPreferencePage.scala
@@ -158,8 +158,9 @@ class FormatterPreferencePage extends PropertyPage with IWorkbenchPreferencePage
}
protected def createPreviewer(parent: Composite): Control = {
- val (control, document) = ScalaPreviewerFactory.createPreviewer(parent, getPreferenceStore, formatPreviewText)
- previewDocument = document
+ val previewer = ScalaPreviewerFactory.createPreviewer(parent, getPreferenceStore, formatPreviewText)
+ previewDocument = previewer.getDocument
+ val control = previewer.getControl
allEnableDisableControls += control
control
}
View
7 ...scala-ide.sdt.core/src/scala/tools/eclipse/properties/SyntaxColouringPreferencePage.scala
@@ -330,11 +330,8 @@ class SyntaxColouringPreferencePage extends PreferencePage with IWorkbenchPrefer
outerComposite
}
- private def createPreviewer(parent: Composite): Control = {
- val store = new ChainedPreferenceStore(Array(overlayStore, EditorsUI.getPreferenceStore))
- val (control, document) = ScalaPreviewerFactory.createPreviewer(parent, store, previewText)
- control
- }
+ private def createPreviewer(parent: Composite): Control =
+ ScalaPreviewerFactory.createPreviewer(parent, overlayStore, previewText).getControl
private def selectedSyntaxClass: Option[ScalaSyntaxClass] =
condOpt(treeViewer.getSelection.asInstanceOf[IStructuredSelection].getFirstElement) {

0 comments on commit 5260ad1

Please sign in to comment.
Something went wrong with that request. Please try again.