Java tutorial
/******************************************************************************* * Copyright (c) 2017 Lablicate GmbH. * * 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: * * Hitesh Gaur - initial API and implementation *******************************************************************************/ package net.openchrom.xxd.processor.supplier.rscripting.ui.preferences; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import org.eclipse.jface.preference.BooleanFieldEditor; import org.eclipse.jface.preference.FieldEditorPreferencePage; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; import net.openchrom.xxd.processor.supplier.rscripting.ui.Activator; public class RCodePreferences extends FieldEditorPreferencePage implements IWorkbenchPreferencePage, PropertyChangeListener { public RCodePreferences() { super(GRID); setPreferenceStore(Activator.getDefault().getPreferenceStore()); // setDescription("R Code Preferences"); } public void createFieldEditors() { addField(new LabelFieldEditor("Code Folding:", getFieldEditorParent())); addField(new BooleanFieldEditor("FUNCTIONS_FOLDING", "Functions", getFieldEditorParent())); addField(new BooleanFieldEditor("FOR_LOOP_FOLDING", "For loop", getFieldEditorParent())); addField(new BooleanFieldEditor("WHILE_LOOP_FOLDING", "While loop", getFieldEditorParent())); addField(new BooleanFieldEditor("REPEAT_LOOP_FOLDING", "Repeat loop", getFieldEditorParent())); addField(new BooleanFieldEditor("IF_CONDITION_FOLDING", "If condition", getFieldEditorParent())); addField(new LabelFieldEditor("Code context:", getFieldEditorParent())); addField(new BooleanFieldEditor("SHOW_INFOPOPUP", "Show Infopopup", getFieldEditorParent())); addField(new BooleanFieldEditor("MARK_WORDS", "Mark selected words", getFieldEditorParent())); addField(new LabelFieldEditor("Code completion/templates:", getFieldEditorParent())); addField(new BooleanFieldEditor("TYPED_CODE_COMPLETION", "Open code completion/templates when typing", getFieldEditorParent())); addField(new LabelFieldEditor("Editor performance:", getFieldEditorParent())); addField(new BooleanFieldEditor("EDITOR_TO_OUTLINE", "Show editor position in 'Outline' view", getFieldEditorParent())); } public void init(IWorkbench workbench) { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); store.setDefault("FUNCTIONS_FOLDING", true); store.setDefault("FOR_LOOP_FOLDING", true); store.setDefault("WHILE_LOOP_FOLDING", true); store.setDefault("REPEAT_LOOP_FOLDING", true); store.setDefault("IF_CONDITION_FOLDING", true); store.setDefault("SHOW_INFOPOPUP", true); store.setDefault("MARK_WORDS", true); store.setDefault("TYPED_CODE_COMPLETION", false); store.setDefault("EDITOR_TO_OUTLINE", true); } public boolean performOk() { return super.performOk(); } public void propertyChange(PropertyChangeEvent evt) { } }