1 package org.simantics.g3d.preferences;
3 import org.eclipse.jface.preference.*;
4 import org.eclipse.ui.IWorkbenchPreferencePage;
5 import org.eclipse.ui.IWorkbench;
6 import org.simantics.g3d.Activator;
7 import org.simantics.g3d.math.EulerTools.Order;
10 * This class represents a preference page that
11 * is contributed to the Preferences dialog. By
12 * subclassing <samp>FieldEditorPreferencePage</samp>, we
13 * can use the field support built into JFace that allows
14 * us to create a page that is small and knows how to
15 * save, restore and apply itself.
17 * This page is used to modify preferences only. They
18 * are stored in the preference store that belongs to
19 * the main plug-in class. That way, preferences can
20 * be accessed directly via the preference store.
23 public class G3DPreferencePage
24 extends FieldEditorPreferencePage
25 implements IWorkbenchPreferencePage {
27 public G3DPreferencePage() {
29 setPreferenceStore(Activator.getDefault().getPreferenceStore());
30 setDescription("3D modelling prederences");
34 * Creates the field editors. Field editors are abstractions of
35 * the common GUI blocks needed to manipulate various types
36 * of preferences. Each field editor knows how to save and
39 public void createFieldEditors() {
40 addField(new RadioGroupFieldEditor(
41 PreferenceConstants.ORIENTATION_PRESENTATION,
42 "OrientationPresentation", 1,
43 new String[][] { { "&Quaternion", "quat" },
44 { "&Axis-Angle", "aa" },{ "&Euler", "euler" } }, getFieldEditorParent()));
45 String[][] eulerOrders = new String[Order.values().length][2];
46 for (int i = 0; i < Order.values().length; i++) {
47 eulerOrders[i][0] = Order.values()[i].toString();
48 eulerOrders[i][1] = Order.values()[i].name();
50 addField(new RadioGroupFieldEditor(
51 PreferenceConstants.EULER_ANGLE_ORDER,
52 "Euler Angle Order", 1,
53 eulerOrders, getFieldEditorParent()));
54 // addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH,
55 // "&Directory preference:", getFieldEditorParent()));
57 // new BooleanFieldEditor(
58 // PreferenceConstants.P_BOOLEAN,
59 // "&An example of a boolean preference",
60 // getFieldEditorParent()));
62 // addField(new RadioGroupFieldEditor(
63 // PreferenceConstants.P_CHOICE,
64 // "An example of a multiple-choice preference",
66 // new String[][] { { "&Choice 1", "choice1" }, {
67 // "C&hoice 2", "choice2" }
68 // }, getFieldEditorParent()));
70 // new StringFieldEditor(PreferenceConstants.P_STRING, "A &text preference:", getFieldEditorParent()));
74 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
76 public void init(IWorkbench workbench) {