org.eclipse.linuxtools.systemtap.ui.ide.preferences.CodeAssistPreferencePage.java Source code

Java tutorial

Introduction

Here is the source code for org.eclipse.linuxtools.systemtap.ui.ide.preferences.CodeAssistPreferencePage.java

Source

/*******************************************************************************
 * Copyright (c) 2006 IBM Corporation.
 * 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:
 *     IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse
 *******************************************************************************/

package org.eclipse.linuxtools.systemtap.ui.ide.preferences;

import org.eclipse.jface.preference.*;
import org.eclipse.linuxtools.systemtap.ui.ide.internal.IDEPlugin;
import org.eclipse.linuxtools.systemtap.ui.ide.internal.Localization;
import org.eclipse.linuxtools.systemtap.ui.logging.LogManager;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.IWorkbench;

public class CodeAssistPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
    public CodeAssistPreferencePage() {
        super(GRID);
        LogManager.logDebug("Start CodeAssistPreferencePage:", this);
        setPreferenceStore(IDEPlugin.getDefault().getPreferenceStore());
        setDescription(Localization.getString("CodeAssistPreferencePage.CodeAssistPreferenceDescription"));
        LogManager.logDebug("End CodeAssistPreferencePage:", this);
    }

    /**
     * Creates the field editors. Field editors are abstractions of
     * the common GUI blocks needed to manipulate various types
     * of preferences. Each field editor knows how to save and
     * restore itself.
     */
    public void createFieldEditors() {
        LogManager.logDebug("Start createFieldEditors:", this);
        addField(new BooleanFieldEditor(IDEPreferenceConstants.P_USE_CODE_ASSIST,
                Localization.getString("CodeAssistPreferencePage.UseCodeAssist"), getFieldEditorParent()));
        addField(new RadioGroupFieldEditor(IDEPreferenceConstants.P_COMPLETION,
                Localization.getString("CodeAssistPreferencePage.HowCodeAdded"), 1,
                new String[][] {
                        { Localization.getString("CodeAssistPreferencePage.Insert"),
                                IDEPreferenceConstants.P_COMPLETION_INSERT },
                        { Localization.getString("CodeAssistPreferencePage.Overwrite"),
                                IDEPreferenceConstants.P_COMPLETION_OVERWRITE } },
                getFieldEditorParent()));
        addField(new IntegerFieldEditor(IDEPreferenceConstants.P_ACTIVATION_DELAY,
                Localization.getString("CodeAssistPreferencePage.ActivationDelay"), getFieldEditorParent()));
        addField(new StringFieldEditor(IDEPreferenceConstants.P_ACTIVATION_TRIGGER,
                Localization.getString("CodeAssistPreferencePage.ActivationTrigger"), getFieldEditorParent()));
        LogManager.logDebug("End createFieldEditors", this);
    }

    public void init(IWorkbench workbench) {
        LogManager.logInfo("Initializing", this);
    }

    public void dispose() {
        LogManager.logInfo("Disposing", this);
        super.dispose();
    }
}