Example usage for org.eclipse.jface.preference RadioGroupFieldEditor setPreferenceStore

List of usage examples for org.eclipse.jface.preference RadioGroupFieldEditor setPreferenceStore

Introduction

In this page you can find the example usage for org.eclipse.jface.preference RadioGroupFieldEditor setPreferenceStore.

Prototype

public void setPreferenceStore(IPreferenceStore store) 

Source Link

Document

Sets the preference store used by this field editor.

Usage

From source file:eclox.ui.PreferencePage.java

License:Open Source License

/**
 * Creates the preference page fields.//from w w w  .  jav  a 2s .c  om
 */
protected void createFieldEditors() {
    Composite rootControl = getFieldEditorParent();

    // Create the controls.

    BooleanFieldEditor escapeValueStrings = new BooleanFieldEditor(IPreferences.HANDLE_ESCAPED_VALUES,
            "Handle escapes for \" and \\ in value strings", rootControl);
    escapeValueStrings.setPreferenceStore(getPreferenceStore());
    addField(escapeValueStrings);

    IntegerFieldEditor historySize = new IntegerFieldEditor(IPreferences.BUILD_HISTORY_SIZE,
            "Build history size:", rootControl);
    historySize.setPreferenceStore(getPreferenceStore());
    historySize.setValidRange(1, 100);
    addField(historySize);

    RadioGroupFieldEditor autoSave = new RadioGroupFieldEditor(IPreferences.AUTO_SAVE,
            "Save all modified files before building", 1,
            new String[][] { { IPreferences.AUTO_SAVE_NEVER, IPreferences.AUTO_SAVE_NEVER },
                    { IPreferences.AUTO_SAVE_ALWAYS, IPreferences.AUTO_SAVE_ALWAYS },
                    { IPreferences.AUTO_SAVE_ASK, IPreferences.AUTO_SAVE_ASK }, },
            rootControl, true);
    autoSave.setPreferenceStore(getPreferenceStore());
    addField(autoSave);
}

From source file:org.eclipse.epf.authoring.ui.preferences.LibraryViewPrefPage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    // TODO Auto-generated method stub
    Composite parent = getFieldEditorParent();
    RadioGroupFieldEditor defaultLinkTypeEditor = new RadioGroupFieldEditor(
            ApplicationPreferenceConstants.PREF_LIB_VIEW_DND_DEFAULT_LINKTYPE,
            AuthoringUIResources.defaultLinkTypePrefLabel, 1,
            new String[][] {
                    { LibraryUIResources.elementLink_name, ResourceHelper.ELEMENT_LINK_CLASS_elementLink },
                    { LibraryUIResources.elementLinkWithType_name,
                            ResourceHelper.ELEMENT_LINK_CLASS_elementLinkWithType },
                    { LibraryUIResources.elementLinkWithUserText_name,
                            ResourceHelper.ELEMENT_LINK_CLASS_elementLinkWithUserText } },
            parent, true);/*from w w  w  .j  av  a  2s .co  m*/
    defaultLinkTypeEditor.setPreferenceStore(doGetPreferenceStore());
    addField(defaultLinkTypeEditor);
}

From source file:org.eclipse.linuxtools.internal.profiling.launch.provider.AbstractProviderPreferencesPage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    String providerId = ProviderFramework.getHighestProviderId(type);

    if (providerId != null) {
        getPreferenceStore().setDefault(ProviderProfileConstants.PREFS_KEY + type, providerId);
    }/*from  w  w w.  j  av a 2 s. c o m*/

    HashMap<String, String> map = ProviderFramework.getProviderNamesForType(type);
    // 2d array containing launch provider names on the first column and
    // corresponding id's on the second.
    String[][] providerList = new String[map.size()][2];
    int i = 0;
    for (Entry<String, String> entry : map.entrySet()) {
        String toolId = entry.getValue();
        String toolDescription = ProviderFramework.getToolInformationFromId(toolId, PROVIDER_ATT_DESC);
        String toolName = entry.getKey();

        // Append tool description to tool name if available.
        if (toolDescription != null && !toolDescription.equals("")) { //$NON-NLS-1$
            toolName = toolName + " " + "[" + toolDescription + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        }

        providerList[i][0] = toolName;
        providerList[i][1] = toolId;
        i++;
    }

    // Create basic field editor.
    RadioGroupFieldEditor editor = new RadioGroupFieldEditor(ProviderProfileConstants.PREFS_KEY + type,
            Messages.ProviderPreferencesPage_1, 1, providerList, getFieldEditorParent(), true);
    editor.setPreferenceStore(getPreferenceStore());
    addField(editor);

    Composite radioBoxControl = editor.getRadioBoxControl(getFieldEditorParent());
    Control[] providerOptions = radioBoxControl.getChildren();

    // Set tool tip text on field editors.
    for (Control control : providerOptions) {
        // Get tool specific information from provider id.
        String curProviderId = (String) control.getData();
        // Set tool tip description text.
        String toolDescription = ProviderFramework.getToolInformationFromId(curProviderId, PROVIDER_ATT_INFO);
        if (toolDescription != null && !toolDescription.equals("")) { //$NON-NLS-1$
            control.setToolTipText(toolDescription);
        }
    }
}

From source file:org.eclipse.stp.bpmn.preferences.BpmnConnectionsPreferencePage.java

License:Open Source License

/**
 * Preferences for the messaging connection.
 * @param parent/*www  . j a  v a2 s .c om*/
 */
protected void addConnectionFields(Composite parent, String groupTitle, String msgLineStylePref,
        String prefAvoidObstacles, String prefShortestPath, String prefSmoothness, String prefConnColor,
        String prefConnTransparency) {

    Group bpmnGlobalGroup = new Group(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(1, false);
    bpmnGlobalGroup.setLayout(gridLayout);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.grabExcessHorizontalSpace = true;
    //gridData.horizontalSpan = 2;
    bpmnGlobalGroup.setLayoutData(gridData);
    bpmnGlobalGroup.setText(groupTitle);

    Composite newParent = new Composite(bpmnGlobalGroup, SWT.NONE);
    GridLayout gridLayout2 = new GridLayout(2, false);
    newParent.setLayout(gridLayout2);
    GridData gridData2 = new GridData(GridData.FILL_HORIZONTAL);
    gridData2.grabExcessHorizontalSpace = true;

    ColorFieldEditor connColorField = new ColorFieldEditor(prefConnColor,
            BpmnDiagramMessages.BpmnConnectionsPreferencePage_color, newParent);
    connColorField.setPreferenceStore(super.getPreferenceStore());
    super.addField(connColorField);

    ScaleFieldEditor connTransparency = new ScaleFieldEditor(prefConnTransparency,
            BpmnDiagramMessages.BpmnConnectionsPreferencePage_transparency, newParent, 1, 255, 1, 5);
    connTransparency.setPreferenceStore(super.getPreferenceStore());
    super.addField(connTransparency);

    RadioGroupFieldEditor routerStyleEditor = new RadioGroupFieldEditor(msgLineStylePref,
            BpmnDiagramMessages.BpmnConnectionsPreferencePage_style, 2,
            new String[][] {
                    { Routing.RECTILINEAR_LITERAL.getLiteral(), Routing.RECTILINEAR_LITERAL.getName() },
                    { BpmnDiagramMessages.BpmnConnectionsPreferencePage_oblique/*Routing.MANUAL_LITERAL.getLiteral()*/,
                            Routing.MANUAL_LITERAL.getName() } },
            newParent, true);
    routerStyleEditor.setPreferenceStore(super.getPreferenceStore());
    super.addField(routerStyleEditor);

    BooleanFieldEditor avoidObstacles = new BooleanFieldEditor(prefAvoidObstacles,
            BpmnDiagramMessages.BpmnConnectionsPreferencePage_avoid_obstacles, newParent);
    super.addField(avoidObstacles);
    //        avoidObstacles.getLabelControl(newParent).setToolTipText(
    //                "Rounds around obstacles. When true shortest path setting" +
    //                "is not taken into account.");

    BooleanFieldEditor shortestPath = new BooleanFieldEditor(prefShortestPath,
            BpmnDiagramMessages.BpmnConnectionsPreferencePage_shortest_path, newParent);
    //        shortestPath.getLabelControl(newParent).setToolTipText(
    //                "Use the shortest path. Not taken into account" +
    //                " when avoid obstacles is in use.");
    super.addField(shortestPath);

    RadioGroupFieldEditor smoothnessEditor = new RadioGroupFieldEditor(prefSmoothness,
            BpmnDiagramMessages.BpmnConnectionsPreferencePage_smoothness, 2,
            new String[][] { { Smoothness.NORMAL_LITERAL.getLiteral(), Smoothness.NORMAL_LITERAL.getName() },
                    { Smoothness.NONE_LITERAL.getLiteral(), Smoothness.NONE_LITERAL.getName() },
                    { Smoothness.LESS_LITERAL.getLiteral(), Smoothness.LESS_LITERAL.getName() },
                    { Smoothness.MORE_LITERAL.getLiteral(), Smoothness.MORE_LITERAL.getName() } },
            newParent, true);
    smoothnessEditor.setPreferenceStore(super.getPreferenceStore());
    super.addField(smoothnessEditor);
}

From source file:org.osate.xtext.aadl2.agcl.analysis.config.AGCLPreferencesPage.java

License:Apache License

@Override
protected void createFieldEditors() {
    Composite parent = getFieldEditorParent();
    IPreferenceStore store = getPreferenceStore();
    StringFieldEditor modelCheckerName = new StringFieldEditor(
            IPreferenceConstants.MODEL_CHECKER_NAME_PREFERENCE, "Model-checker &Name", parent);
    addField(modelCheckerName);/*from  w  ww.ja  v  a  2s  .com*/
    modelCheckerName.setPreferenceStore(store);
    FileFieldEditor modelCheckerExecutable = new FileFieldEditor(
            IPreferenceConstants.MODEL_CHECKER_EXECUTABLE_PREFERENCE, "Model-checker &Executable", true,
            parent);
    addField(modelCheckerExecutable);
    modelCheckerExecutable.setPreferenceStore(store);
    IPropertyChangeListener modelCheckerListener = new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            String newActiveModelChecker = (String) event.getNewValue();
            // TODO: register new instance
            // TODO: change executable
            //               AGCLAnalysisPlugin.getDefault().activateModelChecker(newActiveModelChecker);
        }
    };
    store.addPropertyChangeListener(modelCheckerListener);
    StringFieldEditor flags = new StringFieldEditor(IPreferenceConstants.MODEL_CHECKER_FLAGS_PREFERENCE,
            "Model-checker &Flags", parent);
    addField(flags);
    flags.setPreferenceStore(store);
    //      FileFieldEditor modelCheckerScriptTemplate = new FileFieldEditor(
    //      IPreferenceConstants.MODEL_CHECKER_SCRIPT_TEMPLATE_PREFERENCE,
    //      "Model-checker &Script template",
    //      false,
    //      parent);
    StringFieldEditor modelCheckerScriptTemplate = new StringFieldEditor(
            IPreferenceConstants.MODEL_CHECKER_SCRIPT_TEMPLATE_PREFERENCE, "Model-checker &Script template",
            parent);
    addField(modelCheckerScriptTemplate);
    modelCheckerScriptTemplate.setPreferenceStore(store);
    //      FileFieldEditor modelCheckerModelTemplate = new FileFieldEditor(
    //            IPreferenceConstants.MODEL_CHECKER_MODEL_TEMPLATE_PREFERENCE,
    //            "Model-checker &Model template",
    //            false,
    //            parent);
    StringFieldEditor modelCheckerModelTemplate = new StringFieldEditor(
            IPreferenceConstants.MODEL_CHECKER_MODEL_TEMPLATE_PREFERENCE, "Model-checker &Model template",
            parent);
    addField(modelCheckerModelTemplate);
    modelCheckerModelTemplate.setPreferenceStore(store);
    StringFieldEditor modelCheckerInputDir = new StringFieldEditor(
            IPreferenceConstants.MODEL_CHECKER_INPUT_DIR_PREFERENCE, "Model-checker &Input directory", parent);
    addField(modelCheckerInputDir);
    modelCheckerInputDir.setPreferenceStore(store);
    StringFieldEditor modelCheckerOutputDir = new StringFieldEditor(
            IPreferenceConstants.MODEL_CHECKER_OUTPUT_DIR_PREFERENCE, "Model-checker &Output directory",
            parent);
    addField(modelCheckerOutputDir);
    modelCheckerOutputDir.setPreferenceStore(store);
    StringFieldEditor analysisResultsDir = new StringFieldEditor(
            IPreferenceConstants.ANALYSIS_RESULTS_DIR_PREFERENCE, "Analysis &Results directory", parent);
    addField(analysisResultsDir);
    analysisResultsDir.setPreferenceStore(store);
    RadioGroupFieldEditor analysisResultsOption = new RadioGroupFieldEditor(
            IPreferenceConstants.ANALYSIS_RESULTS_OPTION_PREFERENCE, "Analysis Results sorting option", 1,
            new String[][] { { "By viewpoint", AnalysisResults.BYVIEWPOINT },
                    { "By component", AnalysisResults.BYCOMPONENT } },
            parent);
    addField(analysisResultsOption);
    analysisResultsOption.setPreferenceStore(store);
}