Search in sources :

Example 1 with ComboFieldEditor

use of org.python.pydev.shared_ui.field_editors.ComboFieldEditor in project Pydev by fabioz.

the class CommentBlocksPreferences method createFieldEditors.

@Override
protected void createFieldEditors() {
    final Composite p = getFieldEditorParent();
    addField(new ComboFieldEditor(ADD_COMMENTS_OPTION, "Comment location", ENTRIES_AND_VALUES_FOR_ADD_COMMENTS_OPTION, p));
    labelSep0 = new Label(p, SWT.NONE);
    labelSep0.setText("       (otherwise, add '#' to the start of the line)");
    labelSep1 = new Label(p, SWT.NONE);
    multiBlock = new StringFieldEditor(MULTI_BLOCK_COMMENT_CHAR, "Multi-block char (ctrl+4):", 2, p);
    multiBlock.getTextControl(p).setTextLimit(1);
    multiBlock.setEmptyStringAllowed(false);
    addField(multiBlock);
    addField(new BooleanFieldEditor(MULTI_BLOCK_COMMENT_SHOW_ONLY_CLASS_NAME, "In a class name, create block only with class name above of class?", p));
    addField(new BooleanFieldEditor(MULTI_BLOCK_COMMENT_SHOW_ONLY_FUNCTION_NAME, "In a function name, create block only with function name above of function?", p));
    labelMulti = new Label(p, SWT.NONE);
    singleBlock = new StringFieldEditor(SINGLE_BLOCK_COMMENT_CHAR, "Single-block char (ctrl+shift+4):", 2, p);
    singleBlock.setEmptyStringAllowed(false);
    singleBlock.getTextControl(p).setTextLimit(1);
    addField(singleBlock);
    alignSingle = new BooleanFieldEditor(SINGLE_BLOCK_COMMENT_ALIGN_RIGHT, "Align text in single-block to the right?", p);
    addField(alignSingle);
    labelSingle = new Label(p, SWT.NONE);
    setLabelFont(p, labelSingle, true);
    setLabelFont(p, labelMulti, true);
    updateMulti(PyScopedPreferences.getString(MULTI_BLOCK_COMMENT_CHAR, null));
    updateSingle(PyScopedPreferences.getString(SINGLE_BLOCK_COMMENT_CHAR, null), PyScopedPreferences.getBoolean(SINGLE_BLOCK_COMMENT_ALIGN_RIGHT, null));
    addField(new ScopedPreferencesFieldEditor(p, SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE, this));
}
Also used : StringFieldEditor(org.eclipse.jface.preference.StringFieldEditor) ScopedPreferencesFieldEditor(org.python.pydev.shared_ui.field_editors.ScopedPreferencesFieldEditor) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) ComboFieldEditor(org.python.pydev.shared_ui.field_editors.ComboFieldEditor)

Example 2 with ComboFieldEditor

use of org.python.pydev.shared_ui.field_editors.ComboFieldEditor in project Pydev by fabioz.

the class DebugPreferencesPageExt method createFieldEditors.

@Override
public void createFieldEditors(DebugPrefsPage page, Composite parent) {
    page.addField(new IntegerFieldEditor(DebugPluginPrefsInitializer.PYDEV_REMOTE_DEBUGGER_PORT, "Port for remote debugger:", parent, 10));
    ComboFieldEditor editor = new ComboFieldEditor(DebugPluginPrefsInitializer.DEBUG_SERVER_STARTUP, "Remote debugger server activation: ", ENTRIES_AND_VALUES_DEBUGGER_STARTUP, parent);
    page.addField(editor);
    editor.getLabelControl(parent).setToolTipText("This option marks if the remote debugger should be auto-activated in some situation.");
    ComboFieldEditor comboEditor = new ComboFieldEditor(DebugPluginPrefsInitializer.FORCE_SHOW_SHELL_ON_BREAKPOINT, "On breakpoint hit: ", ENTRIES_AND_VALUES, parent);
    page.addField(comboEditor);
    comboEditor.getLabelControl(parent).setToolTipText("Checking this option will force Eclipse to have focus when a PyDev breakpoint is hit.");
}
Also used : IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) ComboFieldEditor(org.python.pydev.shared_ui.field_editors.ComboFieldEditor)

Example 3 with ComboFieldEditor

use of org.python.pydev.shared_ui.field_editors.ComboFieldEditor in project Pydev by fabioz.

the class ProfileView method createPartControl.

@Override
public void createPartControl(Composite parent) {
    Composite checkParent = new Composite(parent, SWT.NONE);
    checkParent.setLayoutData(GridDataFactory.fillDefaults().create());
    checkParent.setLayout(new GridLayout(2, false));
    profileForNewLaunches = new BooleanFieldEditorCustom(PyProfilePreferences.ENABLE_PROFILING_FOR_NEW_LAUNCHES, "Enable profiling for new launches?", BooleanFieldEditorCustom.SEPARATE_LABEL, checkParent);
    addField(profileForNewLaunches, checkParent);
    String[][] ENTRIES_AND_VALUES = new String[][] { { "Deterministic (profile)", Integer.toString(PyProfilePreferences.PROFILE_MODE_LSPROF) }, { "Sampling (yappi)", Integer.toString(PyProfilePreferences.PROFILE_MODE_YAPPI) }, { "Don't start profiling", Integer.toString(PyProfilePreferences.PROFILE_MODE_NONE) } };
    ComboFieldEditor editor = new ComboFieldEditor(PyProfilePreferences.PROFILE_MODE, "Initial profile mode: ", ENTRIES_AND_VALUES, parent);
    addField(editor, parent, PyProfilePreferences.getPermanentPreferenceStore());
    Composite composite = new Composite(parent, SWT.NONE);
    GridData spacingLayoutData = new GridData();
    spacingLayoutData.heightHint = 8;
    composite.setLayoutData(spacingLayoutData);
    pyvmmonitorUiLocation = new FileFieldEditorCustom(PyProfilePreferences.PYVMMONITOR_UI_LOCATION, "pyvmmonitor-ui (executable) location", parent);
    addField(pyvmmonitorUiLocation, parent, PyProfilePreferences.getPermanentPreferenceStore());
    GridLayout layout = GridLayoutFactory.swtDefaults().create();
    layout.numColumns = 1;
    parent.setLayout(layout);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) FileFieldEditorCustom(org.python.pydev.shared_ui.field_editors.FileFieldEditorCustom) BooleanFieldEditorCustom(org.python.pydev.shared_ui.field_editors.BooleanFieldEditorCustom) GridData(org.eclipse.swt.layout.GridData) ComboFieldEditor(org.python.pydev.shared_ui.field_editors.ComboFieldEditor)

Example 4 with ComboFieldEditor

use of org.python.pydev.shared_ui.field_editors.ComboFieldEditor in project Pydev by fabioz.

the class PyDevBuilderPrefPage method createFieldEditors.

/**
 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
 */
@Override
protected void createFieldEditors() {
    Composite p = getFieldEditorParent();
    String s = "WARNING: \n\n" + "PyDev builders are required for many features \n" + "provided by Pydev such as:\n" + "\n" + "- Code completion\n" + "- PyLint\n" + "- TODO tasks\n" + "\n" + "So, if you choose to disable it, note that the features \n" + "mentioned above may not work as expected or may even not \n" + "work at all (use at your own risk).\n";
    addField(new LabelFieldEditor("LabelFieldEditor", s, p));
    addField(new BooleanFieldEditor(PyDevBuilderPreferences.USE_PYDEV_BUILDERS, "Use builders?", p));
    // Analysis only on save means that we'll not have parse notifications (so, things will be analyzed only on save)
    addField(new BooleanFieldEditor(PyParserManager.USE_PYDEV_ANALYSIS_ONLY_ON_DOC_SAVE, "Disable parser notifications?", p));
    addField(new IntegerFieldEditor(PyParserManager.PYDEV_ELAPSE_BEFORE_ANALYSIS, "Time to elapse before reparsing changed file (millis)", p));
    s = "If only open editors are analyzed, markers will only be added\n" + "to the opened PyDev editors.\n";
    addField(new LabelFieldEditor("ActiveBufferLabelFieldEditor", s, p));
    BooleanFieldEditorWithPublicGetControl onlyAnalyzeOpen = new BooleanFieldEditorWithPublicGetControl(PyDevBuilderPreferences.ANALYZE_ONLY_ACTIVE_EDITOR, "Only analyze open editors?", p);
    addField(onlyAnalyzeOpen);
    BooleanFieldEditorWithPublicGetControl removeErrors = new BooleanFieldEditorWithPublicGetControl(PyDevBuilderPreferences.REMOVE_ERRORS_WHEN_EDITOR_IS_CLOSED, "Remove errors when editor is closed?", p);
    addField(removeErrors);
    removeErrorsCheckBox = removeErrors.getChangeControl(p);
    onlyAnalyzeOpenCheckBox = onlyAnalyzeOpen.getChangeControl(p);
    onlyAnalyzeOpenCheckBox.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            updateCheckEnabledState();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    addField(new ComboFieldEditor(PyDevBuilderPreferences.PYC_DELETE_HANDLING, "How to handle .pyc/$py.class deletion?", ENTRIES_AND_VALUES, p));
}
Also used : LabelFieldEditor(org.python.pydev.shared_ui.field_editors.LabelFieldEditor) Composite(org.eclipse.swt.widgets.Composite) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) ComboFieldEditor(org.python.pydev.shared_ui.field_editors.ComboFieldEditor) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 5 with ComboFieldEditor

use of org.python.pydev.shared_ui.field_editors.ComboFieldEditor in project Pydev by fabioz.

the class ImportsPreferencesPage method createFieldEditors.

@Override
protected void createFieldEditors() {
    final Composite p = getFieldEditorParent();
    addField(new LabelFieldEditor("Label_Info_File_Preferences1", WrapAndCaseUtils.wrap("These setting are used whenever imports are managed in the application\n\n", 80), p));
    importEngineFieldEditor = new ComboFieldEditor(IMPORT_ENGINE, "Select import sort engine to be used", new String[][] { new String[] { "Pep 8", IMPORT_ENGINE_PEP_8 }, new String[] { "Regular sort", IMPORT_ENGINE_REGULAR_SORT }, new String[] { "isort", IMPORT_ENGINE_ISORT } }, p);
    addFieldWithToolTip(importEngineFieldEditor, p, "Select which import engine should be used to sort the imports when such an operation is requested.");
    deleteUnusedImportsField = new BooleanFieldEditor(DELETE_UNUSED_IMPORTS, WrapAndCaseUtils.wrap("Delete unused imports?", 80), p);
    addFieldWithToolTip(deleteUnusedImportsField, p, "Simple unused imports as reported by the code analysis are deleted. This can be configured to ignore certain files, and individual warnings can be surpressed.");
    groupImportsField = new BooleanFieldEditor(GROUP_IMPORTS, "Combine 'from' imports when possible?", p);
    addField(groupImportsField);
    fromImportsFirstBooleanEditor = new BooleanFieldEditor(FROM_IMPORTS_FIRST, "Sort 'from' imports before 'import' imports?", p);
    addField(fromImportsFirstBooleanEditor);
    multilineImportsField = new BooleanFieldEditor(MULTILINE_IMPORTS, WrapAndCaseUtils.wrap("Allow multiline imports when the import size would exceed the print margin?", 80), p);
    addField(multilineImportsField);
    sortIndiviualOnGroupedField = new BooleanFieldEditor(SORT_NAMES_GROUPED, WrapAndCaseUtils.wrap("Sort individual names on grouped imports?", 80), p);
    addField(sortIndiviualOnGroupedField);
    breakImportsInMultilineMode = new RadioGroupFieldEditor(BREAK_IMPORTS_MODE, "How to break imports in multiline?", 1, new String[][] { { "Use escape char", BREAK_IMPORTS_MODE_ESCAPE }, { "Use parenthesis", BREAK_IMPORTS_MODE_PARENTHESIS } }, p);
    addField(breakImportsInMultilineMode);
    updateEnablement(p, PyDevUiPrefs.getPreferenceStore().getString(IMPORT_ENGINE));
    Combo importEngineCombo = importEngineFieldEditor.getCombo();
    importEngineCombo.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            updateEnablement(p, importEngineFieldEditor.getComboValue());
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    addField(new LinkFieldEditor("link_saveactions", "\nNote: view <a>save actions</a> to automatically sort imports on save.", p, new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            String id = "org.python.pydev.editor.saveactions.PydevSaveActionsPrefPage";
            IWorkbenchPreferenceContainer workbenchPreferenceContainer = ((IWorkbenchPreferenceContainer) getContainer());
            workbenchPreferenceContainer.openPage(id, null);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    }));
    addField(new ScopedPreferencesFieldEditor(p, SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE, this));
}
Also used : LinkFieldEditor(org.python.pydev.shared_ui.field_editors.LinkFieldEditor) Composite(org.eclipse.swt.widgets.Composite) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) Combo(org.eclipse.swt.widgets.Combo) ComboFieldEditor(org.python.pydev.shared_ui.field_editors.ComboFieldEditor) ScopedPreferencesFieldEditor(org.python.pydev.shared_ui.field_editors.ScopedPreferencesFieldEditor) LabelFieldEditor(org.python.pydev.shared_ui.field_editors.LabelFieldEditor) RadioGroupFieldEditor(org.python.pydev.shared_ui.field_editors.RadioGroupFieldEditor) IWorkbenchPreferenceContainer(org.eclipse.ui.preferences.IWorkbenchPreferenceContainer) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

ComboFieldEditor (org.python.pydev.shared_ui.field_editors.ComboFieldEditor)7 Composite (org.eclipse.swt.widgets.Composite)6 IntegerFieldEditor (org.eclipse.jface.preference.IntegerFieldEditor)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 SelectionListener (org.eclipse.swt.events.SelectionListener)4 BooleanFieldEditor (org.eclipse.jface.preference.BooleanFieldEditor)3 GridData (org.eclipse.swt.layout.GridData)3 IWorkbenchPreferenceContainer (org.eclipse.ui.preferences.IWorkbenchPreferenceContainer)3 LinkFieldEditor (org.python.pydev.shared_ui.field_editors.LinkFieldEditor)3 ScopedPreferencesFieldEditor (org.python.pydev.shared_ui.field_editors.ScopedPreferencesFieldEditor)3 FileFieldEditorCustom (org.python.pydev.shared_ui.field_editors.FileFieldEditorCustom)2 LabelFieldEditor (org.python.pydev.shared_ui.field_editors.LabelFieldEditor)2 RadioGroupFieldEditor (org.python.pydev.shared_ui.field_editors.RadioGroupFieldEditor)2 List (java.util.List)1 IInputValidator (org.eclipse.jface.dialogs.IInputValidator)1 InputDialog (org.eclipse.jface.dialogs.InputDialog)1 StringFieldEditor (org.eclipse.jface.preference.StringFieldEditor)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1