Made preference page a bit easier to use
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Thu, 26 Sep 2019 17:28:28 +0000 (19:28 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Thu, 26 Sep 2019 17:28:28 +0000 (19:28 +0200)
plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/MainPreferencePage.java

index 7bac991..f06f5ac 100644 (file)
@@ -1,6 +1,7 @@
 package net.mograsim.plugin;
 
 import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.ComboFieldEditor;
 import org.eclipse.jface.preference.FieldEditorPreferencePage;
 import org.eclipse.jface.preference.IntegerFieldEditor;
 import org.eclipse.swt.widgets.Composite;
@@ -9,6 +10,9 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
 
 public class MainPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage
 {
+       private static final String[][] MOUSE_BUTTONS = { { "left", "1" }, { "middle", "2" }, { "right", "3" }, { "4th", "4" },
+                       { "5th", "5" } };
+
        public MainPreferencePage()
        {
                super(GRID);
@@ -26,17 +30,10 @@ public class MainPreferencePage extends FieldEditorPreferencePage implements IWo
                Composite parent = getFieldEditorParent();
                addField(new BooleanFieldEditor("net.mograsim.logic.model.debug.openhlsshell", "Open the debug HLS shell", parent));
                addField(new IntegerFieldEditor("net.mograsim.logic.model.debug.hlsshelldepth",
-                               "Depth of components to list in the debug HLS shell", parent));
-               IntegerFieldEditor editor;
-               editor = new IntegerFieldEditor("net.mograsim.logic.model.button.action", "Mouse button for actions", parent);
-               editor.setValidRange(1, 5);
-               addField(editor);
-               editor = new IntegerFieldEditor("net.mograsim.logic.model.button.drag", "Mouse button for dragging", parent);
-               editor.setValidRange(1, 5);
-               addField(editor);
-               editor = new IntegerFieldEditor("net.mograsim.logic.model.button.zoom", "Mouse button for zooming", parent);
-               editor.setValidRange(1, 5);
-               addField(editor);
+                               "Depth of components to list in the debug HLS shell (0: unbounded)", parent));
+               addField(new ComboFieldEditor("net.mograsim.logic.model.button.action", "Mouse button for actions", MOUSE_BUTTONS, parent));
+               addField(new ComboFieldEditor("net.mograsim.logic.model.button.drag", "Mouse button for dragging", MOUSE_BUTTONS, parent));
+               addField(new ComboFieldEditor("net.mograsim.logic.model.button.zoom", "Mouse button for zooming", MOUSE_BUTTONS, parent));
                // TODO add other preferences
        }
 }
\ No newline at end of file