Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…loses #1000358)
  • Loading branch information...
commit a40a4c70587ff1c86c5dd9851d5bfeadc50c7505 1 parent b2c63a8
@mdr mdr authored
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 org.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) {
Please sign in to comment.
Something went wrong with that request. Please try again.