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());
41 setDescription("3D modelling preferences");
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
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();
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()));
68 // new BooleanFieldEditor(
69 // PreferenceConstants.P_BOOLEAN,
70 // "&An example of a boolean preference",
71 // getFieldEditorParent()));
73 // addField(new RadioGroupFieldEditor(
74 // PreferenceConstants.P_CHOICE,
75 // "An example of a multiple-choice preference",
77 // new String[][] { { "&Choice 1", "choice1" }, {
78 // "C&hoice 2", "choice2" }
79 // }, getFieldEditorParent()));
81 // new StringFieldEditor(PreferenceConstants.P_STRING, "A &text preference:", getFieldEditorParent()));
85 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
87 public void init(IWorkbench workbench) {