org.eclipse.ice.client.widgets.moose.MoosePreferencePage.java Source code

Java tutorial

Introduction

Here is the source code for org.eclipse.ice.client.widgets.moose.MoosePreferencePage.java

Source

/*******************************************************************************
 * Copyright (c) 2015 UT-Battelle, LLC.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Alex McCaskey (UT-Battelle, LLC.) - initial API and implementation and/or initial documentation
 *    
 *******************************************************************************/
package org.eclipse.ice.client.widgets.moose;

import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.DirectoryFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

public class MoosePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {

    @Override
    public void init(IWorkbench workbench) {
        //      Preferences preferences = InstanceScope.INSTANCE.
        //              .getNode("com.vogella.eclipse.preferences.test");
        this.setPreferenceStore(null);
        setDescription("A demonstration of a preference page implementation");
    }

    @Override
    protected void createFieldEditors() {
        addField(new DirectoryFieldEditor("PATH", "&Directory preference:", getFieldEditorParent()));
        addField(new BooleanFieldEditor("BOOLEAN_VALUE", "&An example of a boolean preference",
                getFieldEditorParent()));

        addField(new RadioGroupFieldEditor("CHOICE", "An example of a multiple-choice preference", 1,
                new String[][] { { "&Choice 1", "choice1" }, { "C&hoice 2", "choice2" } }, getFieldEditorParent()));
        addField(new StringFieldEditor("MySTRING1", "A &text preference:", getFieldEditorParent()));
        addField(new StringFieldEditor("MySTRING2", "A &text preference:", getFieldEditorParent()));
    }

}