]> gerrit.simantics Code Review - simantics/3d.git/blob - org.simantics.g3d/src/org/simantics/g3d/preferences/G3DPreferencePage.java
Fix error in inserting dual inline components
[simantics/3d.git] / org.simantics.g3d / src / org / simantics / g3d / preferences / G3DPreferencePage.java
1 /*******************************************************************************
2  * Copyright (c) 2012, 2013 Association for Decentralized Information Management in
3  * Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.g3d.preferences;
13
14 import org.eclipse.jface.preference.*;
15 import org.eclipse.ui.IWorkbenchPreferencePage;
16 import org.eclipse.ui.IWorkbench;
17 import org.simantics.g3d.Activator;
18 import org.simantics.g3d.math.EulerTools.Order;
19
20 /**
21  * This class represents a preference page that
22  * is contributed to the Preferences dialog. By 
23  * subclassing <samp>FieldEditorPreferencePage</samp>, we
24  * can use the field support built into JFace that allows
25  * us to create a page that is small and knows how to 
26  * save, restore and apply itself.
27  * <p>
28  * This page is used to modify preferences only. They
29  * are stored in the preference store that belongs to
30  * the main plug-in class. That way, preferences can
31  * be accessed directly via the preference store.
32  */
33
34 public class G3DPreferencePage
35         extends FieldEditorPreferencePage
36         implements IWorkbenchPreferencePage {
37
38         public G3DPreferencePage() {
39                 super(GRID);
40                 setPreferenceStore(Activator.getDefault().getPreferenceStore());
41                 setDescription("3D modelling preferences");
42         }
43         
44         /**
45          * Creates the field editors. Field editors are abstractions of
46          * the common GUI blocks needed to manipulate various types
47          * of preferences. Each field editor knows how to save and
48          * restore itself.
49          */
50         public void createFieldEditors() {
51                 addField(new RadioGroupFieldEditor(
52                                 PreferenceConstants.ORIENTATION_PRESENTATION,
53                                 "Orientation Presentation", 1,
54                                 new String[][] { { "&Quaternion", "quat" },
55                                                 { "&Axis-Angle", "aa" },{ "&Euler", "euler" } }, getFieldEditorParent()));
56                 String[][] eulerOrders = new String[Order.values().length][2];
57                 for (int i = 0; i < Order.values().length; i++) {
58                         eulerOrders[i][0] = Order.values()[i].toString();
59                         eulerOrders[i][1] = Order.values()[i].name();
60                 }
61                 addField(new RadioGroupFieldEditor(
62                                 PreferenceConstants.EULER_ANGLE_ORDER,
63                                 "Euler Angle Order", 1,
64                                 eulerOrders, getFieldEditorParent()));
65 //              addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH, 
66 //                              "&Directory preference:", getFieldEditorParent()));
67 //              addField(
68 //                      new BooleanFieldEditor(
69 //                              PreferenceConstants.P_BOOLEAN,
70 //                              "&An example of a boolean preference",
71 //                              getFieldEditorParent()));
72 //
73 //              addField(new RadioGroupFieldEditor(
74 //                              PreferenceConstants.P_CHOICE,
75 //                      "An example of a multiple-choice preference",
76 //                      1,
77 //                      new String[][] { { "&Choice 1", "choice1" }, {
78 //                              "C&hoice 2", "choice2" }
79 //              }, getFieldEditorParent()));
80 //              addField(
81 //                      new StringFieldEditor(PreferenceConstants.P_STRING, "A &text preference:", getFieldEditorParent()));
82         }
83
84         /* (non-Javadoc)
85          * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
86          */
87         public void init(IWorkbench workbench) {
88         }
89         
90 }