]> gerrit.simantics Code Review - simantics/3d.git/blob - org.simantics.g3d/src/org/simantics/g3d/preferences/G3DPreferencePage.java
Merge "Removed 3D modelling preferences page description which is equals title"
[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         }
42         
43         /**
44          * Creates the field editors. Field editors are abstractions of
45          * the common GUI blocks needed to manipulate various types
46          * of preferences. Each field editor knows how to save and
47          * restore itself.
48          */
49         public void createFieldEditors() {
50                 addField(new RadioGroupFieldEditor(
51                                 PreferenceConstants.ORIENTATION_PRESENTATION,
52                                 "Orientation Presentation", 1,
53                                 new String[][] { { "&Quaternion", "quat" },
54                                                 { "&Axis-Angle", "aa" },{ "&Euler", "euler" } }, getFieldEditorParent()));
55                 String[][] eulerOrders = new String[Order.values().length][2];
56                 for (int i = 0; i < Order.values().length; i++) {
57                         eulerOrders[i][0] = Order.values()[i].toString();
58                         eulerOrders[i][1] = Order.values()[i].name();
59                 }
60                 addField(new RadioGroupFieldEditor(
61                                 PreferenceConstants.EULER_ANGLE_ORDER,
62                                 "Euler Angle Order", 1,
63                                 eulerOrders, getFieldEditorParent()));
64 //              addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH, 
65 //                              "&Directory preference:", getFieldEditorParent()));
66 //              addField(
67 //                      new BooleanFieldEditor(
68 //                              PreferenceConstants.P_BOOLEAN,
69 //                              "&An example of a boolean preference",
70 //                              getFieldEditorParent()));
71 //
72 //              addField(new RadioGroupFieldEditor(
73 //                              PreferenceConstants.P_CHOICE,
74 //                      "An example of a multiple-choice preference",
75 //                      1,
76 //                      new String[][] { { "&Choice 1", "choice1" }, {
77 //                              "C&hoice 2", "choice2" }
78 //              }, getFieldEditorParent()));
79 //              addField(
80 //                      new StringFieldEditor(PreferenceConstants.P_STRING, "A &text preference:", getFieldEditorParent()));
81         }
82
83         /* (non-Javadoc)
84          * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
85          */
86         public void init(IWorkbench workbench) {
87         }
88         
89 }