Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'issue/optional-surround-braces-1001034'

  • Loading branch information...
commit f46a95145564ee830be82deef0bf10ab78b88af4 2 parents e0a8877 + 6abeb25
Iulian Dragos authored June 18, 2012
41  org.scala-ide.sdt.core/src/scala/tools/eclipse/properties/EditorPreferencePage.scala
... ...
@@ -0,0 +1,41 @@
  1
+package scala.tools.eclipse
  2
+package properties
  3
+
  4
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer
  5
+import org.eclipse.jface.preference.{ FieldEditorPreferencePage, BooleanFieldEditor }
  6
+import org.eclipse.ui.{ IWorkbenchPreferencePage, IWorkbench }
  7
+import EditorPreferencePage._
  8
+
  9
+class EditorPreferencePage extends FieldEditorPreferencePage with IWorkbenchPreferencePage {
  10
+
  11
+  setPreferenceStore(ScalaPlugin.plugin.getPreferenceStore)
  12
+
  13
+  override def createFieldEditors() {
  14
+    addField(new BooleanFieldEditor(P_ENABLE_SMART_BRACKETS, "Automatically surround selection with [brackets]", getFieldEditorParent))
  15
+    addField(new BooleanFieldEditor(P_ENABLE_SMART_BRACES, "Automatically surround selection with {braces}", getFieldEditorParent))
  16
+    addField(new BooleanFieldEditor(P_ENABLE_SMART_PARENS, "Automatically surround selection with (parenthesis)", getFieldEditorParent))
  17
+    addField(new BooleanFieldEditor(P_ENABLE_SMART_QUOTES, "Automatically surround selection with \"quotes\"", getFieldEditorParent))
  18
+  }
  19
+
  20
+  def init(workbench: IWorkbench) {}
  21
+
  22
+}
  23
+
  24
+object EditorPreferencePage {
  25
+  final val BASE = "scala.tools.eclipse.editor."
  26
+  final val P_ENABLE_SMART_BRACKETS = BASE + "smartBrackets"
  27
+  final val P_ENABLE_SMART_BRACES = BASE + "smartBraces"
  28
+  final val P_ENABLE_SMART_PARENS = BASE + "smartParens"
  29
+  final val P_ENABLE_SMART_QUOTES = BASE + "smartQuotes"
  30
+}
  31
+
  32
+class DebugPreferenceInitializer extends AbstractPreferenceInitializer {
  33
+
  34
+  override def initializeDefaultPreferences() {
  35
+    val store = ScalaPlugin.plugin.getPreferenceStore
  36
+    store.setDefault(P_ENABLE_SMART_BRACKETS, false)
  37
+    store.setDefault(P_ENABLE_SMART_BRACES, false)
  38
+    store.setDefault(P_ENABLE_SMART_PARENS, false)
  39
+    store.setDefault(P_ENABLE_SMART_QUOTES, false)
  40
+  }
  41
+}

0 notes on commit f46a951

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