1 /*******************************************************************************
2 * Copyright (c) 2012, 2013 Association for Decentralized Information Management in
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
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.g3d.preferences;
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;
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.
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.
34 public class G3DPreferencePage
35 extends FieldEditorPreferencePage
36 implements IWorkbenchPreferencePage {
38 public G3DPreferencePage() {
40 setPreferenceStore(Activator.getDefault().getPreferenceStore());
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
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();
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()));
67 // new BooleanFieldEditor(
68 // PreferenceConstants.P_BOOLEAN,
69 // "&An example of a boolean preference",
70 // getFieldEditorParent()));
72 // addField(new RadioGroupFieldEditor(
73 // PreferenceConstants.P_CHOICE,
74 // "An example of a multiple-choice preference",
76 // new String[][] { { "&Choice 1", "choice1" }, {
77 // "C&hoice 2", "choice2" }
78 // }, getFieldEditorParent()));
80 // new StringFieldEditor(PreferenceConstants.P_STRING, "A &text preference:", getFieldEditorParent()));
84 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
86 public void init(IWorkbench workbench) {