]> gerrit.simantics Code Review - simantics/3d.git/blob - org.simantics.g3d/src/org/simantics/g3d/preferences/G3DPreferencePage.java
7f90aebebbd74edd864d5753522760cb95f32f9b
[simantics/3d.git] / org.simantics.g3d / src / org / simantics / g3d / preferences / G3DPreferencePage.java
1 package org.simantics.g3d.preferences;
2
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;
8
9 /**
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.
16  * <p>
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.
21  */
22
23 public class G3DPreferencePage
24         extends FieldEditorPreferencePage
25         implements IWorkbenchPreferencePage {
26
27         public G3DPreferencePage() {
28                 super(GRID);
29                 setPreferenceStore(Activator.getDefault().getPreferenceStore());
30                 setDescription("3D modelling prederences");
31         }
32         
33         /**
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
37          * restore itself.
38          */
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();
49                 }
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()));
56 //              addField(
57 //                      new BooleanFieldEditor(
58 //                              PreferenceConstants.P_BOOLEAN,
59 //                              "&An example of a boolean preference",
60 //                              getFieldEditorParent()));
61 //
62 //              addField(new RadioGroupFieldEditor(
63 //                              PreferenceConstants.P_CHOICE,
64 //                      "An example of a multiple-choice preference",
65 //                      1,
66 //                      new String[][] { { "&Choice 1", "choice1" }, {
67 //                              "C&hoice 2", "choice2" }
68 //              }, getFieldEditorParent()));
69 //              addField(
70 //                      new StringFieldEditor(PreferenceConstants.P_STRING, "A &text preference:", getFieldEditorParent()));
71         }
72
73         /* (non-Javadoc)
74          * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
75          */
76         public void init(IWorkbench workbench) {
77         }
78         
79 }