Search in sources :

Example 1 with LinkFieldEditor

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

the class MarkOccurrencesPreferencesPage method createFieldEditors.

@Override
protected void createFieldEditors() {
    Composite p = getFieldEditorParent();
    addField(new BooleanFieldEditor(USE_MARK_OCCURRENCES, "Mark Occurrences?", p));
    addField(new BooleanFieldEditor(USE_MARK_OCCURRENCES_IN_STRINGS, "Mark Occurrences in strings and comments?", p));
    LinkFieldEditor colorsAndFontsLinkFieldEditor = new LinkFieldEditor("UNUSED", "Color of the occurences may be changed at\n" + "<a>Annotations</a>: Occurrences (Pydev)", p, new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            String id = "org.eclipse.ui.editors.preferencePages.Annotations";
            IWorkbenchPreferenceContainer workbenchPreferenceContainer = ((IWorkbenchPreferenceContainer) getContainer());
            workbenchPreferenceContainer.openPage(id, null);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    colorsAndFontsLinkFieldEditor.getLinkControl(p);
}
Also used : LinkFieldEditor(org.python.pydev.shared_ui.field_editors.LinkFieldEditor) Composite(org.eclipse.swt.widgets.Composite) IWorkbenchPreferenceContainer(org.eclipse.ui.preferences.IWorkbenchPreferenceContainer) SelectionEvent(org.eclipse.swt.events.SelectionEvent) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 2 with LinkFieldEditor

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

the class DjangoNotAvailableWizardPage method createControl.

@Override
public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parent.getFont());
    LinkFieldEditor colorsAndFontsLinkFieldEditor = new LinkFieldEditor("UNUSED", "To get started with Django in Pydev, a pre-requisite is that Django is \n" + "installed in the Python / Jython / IronPython interpreter you want to use \n" + "(so, \"import django\" must properly work). \n" + "\n" + "It seems that the selected interpreter does not have Django available, so, please\n" + "install Django, reconfigure the interpreter so that Django is recognized\n" + "and then come back to this wizard.\n" + "\n" + "An introduction on how to get started with Django in Pydev is available at:\n" + "<a>http://pydev.org/manual_adv_django.html</a>.\n", composite, new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Program.launch("http://pydev.org/manual_adv_django.html");
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    colorsAndFontsLinkFieldEditor.getLinkControl(composite);
    setErrorMessage("Django not found.");
    setControl(composite);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) LinkFieldEditor(org.python.pydev.shared_ui.field_editors.LinkFieldEditor) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 3 with LinkFieldEditor

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

the class MypyPrefPage method createFieldEditors.

@Override
protected void createFieldEditors() {
    parent = getFieldEditorParent();
    parent.setLayout(new GridLayout(1, false));
    addField(new BooleanFieldEditor(MypyPreferences.USE_MYPY, "Use Mypy?", parent));
    addField(new BooleanFieldEditor(MypyPreferences.MYPY_ADD_PROJECT_FOLDERS_TO_MYPYPATH, "Add project source folders to MYPYPATH?", parent));
    addField(new BooleanFieldEditor(MypyPreferences.MYPY_USE_CONSOLE, "Redirect Mypy output to console?", parent));
    searchMypyLocation = new RadioGroupFieldEditor(MypyPreferences.SEARCH_MYPY_LOCATION, "Mypy to use", 2, SEARCH_MYPY_LOCATION_OPTIONS, parent);
    for (Button b : searchMypyLocation.getRadioButtons()) {
        b.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                updateSelectFileEnablement(parent);
            }
        });
    }
    addField(searchMypyLocation);
    fileField = new FileFieldEditor(MypyPreferences.MYPY_FILE_LOCATION, "Location of the mypy executable:", true, parent);
    addField(fileField);
    CustomizableFieldEditor stringFieldEditor = new CustomizableFieldEditor(MypyPreferences.MYPY_ARGS, "Arguments to pass to the mypy command.", parent);
    addField(stringFieldEditor);
    addField(new LinkFieldEditor("MYPY_HELP", "View <a>http://www.pydev.org/manual_adv_mypy.html</a> for help.", parent, new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Program.launch("http://www.pydev.org/manual_adv_mypy.html");
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    }));
    addField(new ScopedPreferencesFieldEditor(parent, PyAnalysisScopedPreferences.ANALYSIS_SCOPE, this));
}
Also used : ScopedPreferencesFieldEditor(org.python.pydev.shared_ui.field_editors.ScopedPreferencesFieldEditor) FileFieldEditor(org.eclipse.jface.preference.FileFieldEditor) GridLayout(org.eclipse.swt.layout.GridLayout) RadioGroupFieldEditor(org.python.pydev.shared_ui.field_editors.RadioGroupFieldEditor) LinkFieldEditor(org.python.pydev.shared_ui.field_editors.LinkFieldEditor) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) CustomizableFieldEditor(org.python.pydev.utils.CustomizableFieldEditor) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 4 with LinkFieldEditor

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

the class PyLintPrefPage method createFieldEditors.

/*
     * (non-Javadoc)
     *
     * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
     */
@Override
protected void createFieldEditors() {
    parent = getFieldEditorParent();
    addField(new BooleanFieldEditor(PyLintPreferences.USE_PYLINT, "Use PyLint?", parent));
    addField(new BooleanFieldEditor(PyLintPreferences.USE_CONSOLE, "Redirect PyLint output to console?", parent));
    searchPyLintLocation = new RadioGroupFieldEditor(PyLintPreferences.SEARCH_PYLINT_LOCATION, "PyLint to use", 2, SEARCH_PYLINT_LOCATION_OPTIONS, parent);
    for (Button b : searchPyLintLocation.getRadioButtons()) {
        b.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                updateSelectFileEnablement(parent);
            }
        });
    }
    addField(searchPyLintLocation);
    fileField = new FileFieldEditor(PyLintPreferences.PYLINT_FILE_LOCATION, "Location of the pylint executable:", true, parent);
    addField(fileField);
    addField(new RadioGroupFieldEditor(PyLintPreferences.SEVERITY_FATAL, "FATAL Severity", COLS, LABEL_AND_VALUE, parent, true));
    addField(new RadioGroupFieldEditor(PyLintPreferences.SEVERITY_ERRORS, "ERRORS Severity", COLS, LABEL_AND_VALUE, parent, true));
    addField(new RadioGroupFieldEditor(PyLintPreferences.SEVERITY_WARNINGS, "WARNINGS Severity", COLS, LABEL_AND_VALUE, parent, true));
    addField(new RadioGroupFieldEditor(PyLintPreferences.SEVERITY_CODING_STANDARD, "CONVENTIONS Severity", COLS, LABEL_AND_VALUE, parent, true));
    addField(new RadioGroupFieldEditor(PyLintPreferences.SEVERITY_REFACTOR, "REFACTOR Severity", COLS, LABEL_AND_VALUE, parent, true));
    addField(new RadioGroupFieldEditor(PyLintPreferences.SEVERITY_INFO, "INFORMATIONAL Severity", COLS, LABEL_AND_VALUE, parent, true));
    CustomizableFieldEditor stringFieldEditor = new CustomizableFieldEditor(PyLintPreferences.PYLINT_ARGS, "Arguments to pass to the pylint command (customize its output):\n" + "Add --rcfile=.pylintrc to use an rcfile relative to the project directory.", parent);
    addField(stringFieldEditor);
    addField(new LinkFieldEditor("PYLINT_HELP", "View <a>http://www.pydev.org/manual_adv_pylint.html</a> for help.", parent, new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Program.launch("http://www.pydev.org/manual_adv_pylint.html");
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    }));
    addField(new ScopedPreferencesFieldEditor(parent, PyAnalysisScopedPreferences.ANALYSIS_SCOPE, this));
}
Also used : ScopedPreferencesFieldEditor(org.python.pydev.shared_ui.field_editors.ScopedPreferencesFieldEditor) FileFieldEditor(org.eclipse.jface.preference.FileFieldEditor) RadioGroupFieldEditor(org.python.pydev.shared_ui.field_editors.RadioGroupFieldEditor) LinkFieldEditor(org.python.pydev.shared_ui.field_editors.LinkFieldEditor) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) CustomizableFieldEditor(org.python.pydev.utils.CustomizableFieldEditor) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 5 with LinkFieldEditor

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

the class AnalysisPreferencesPage method createFieldEditors.

@Override
public void createFieldEditors() {
    final Composite initialParent = getFieldEditorParent();
    Composite p = initialParent;
    addField(new LabelFieldEditor("Analysis_pref_note", "NOTE: Any file with the comment below will not be analyzed.\n\n#@PydevCodeAnalysisIgnore\n\n", p));
    BooleanFieldEditor field = new BooleanFieldEditor(AnalysisPreferenceInitializer.DO_CODE_ANALYSIS, "Do code analysis?", BooleanFieldEditor.DEFAULT, p);
    addField(field);
    TabFolder tabFolder = new TabFolder(p, SWT.NONE);
    tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
    String[][] values = new String[][] { { "Error", String.valueOf(IMarker.SEVERITY_ERROR) }, { "Warning", String.valueOf(IMarker.SEVERITY_WARNING) }, { "Info", String.valueOf(IMarker.SEVERITY_INFO) }, { "Ignore", String.valueOf(-1) } };
    p = createTab(tabFolder, "Unused");
    addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_UNUSED_IMPORT, "Unused import", 4, values, p, true));
    addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_UNUSED_WILD_IMPORT, "Unused wild import", 4, values, p, true));
    addField(new StringFieldEditor(AnalysisPreferenceInitializer.NAMES_TO_IGNORE_UNUSED_IMPORT, "Don't report unused imports in modules named: (comma separated)", p));
    addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_UNUSED_PARAMETER, "Unused parameter", 4, values, p, true));
    addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_UNUSED_VARIABLE, "Unused variable", 4, values, p, true));
    addField(new StringFieldEditor(AnalysisPreferenceInitializer.NAMES_TO_IGNORE_UNUSED_VARIABLE, "Don't report unused variable if name starts with: (comma separated)", p) {

        @Override
        public int getNumberOfControls() {
            return 1;
        }
    });
    p = createTab(tabFolder, "Undefined");
    addField(new StringFieldEditor(AnalysisPreferenceInitializer.NAMES_TO_CONSIDER_GLOBALS, "Consider the following names as globals: (comma separated)", p));
    addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_UNDEFINED_VARIABLE, "Undefined variable", 4, values, p, true));
    addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_UNDEFINED_IMPORT_VARIABLE, "Undefined variable from import", 4, values, p, true));
    p = createTab(tabFolder, "Imports");
    addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_REIMPORT, "Import redefinition", 4, values, p, true));
    addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_UNRESOLVED_IMPORT, "Import not found", 4, values, p, true));
    p = createTab(tabFolder, "Others");
    addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_DUPLICATED_SIGNATURE, "Duplicated signature", 4, values, p, true));
    addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_NO_SELF, "'self' not specified in class method", 4, values, p, true));
    addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_NO_EFFECT_STMT, "Statement has no effect", 4, values, p, true));
    addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_INDENTATION_PROBLEM, "Indentation problems and mixing of tabs/spaces", 4, values, p, true));
    addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_ASSIGNMENT_TO_BUILT_IN_SYMBOL, "Redefinition of builtin symbols", 4, values, p, true));
    addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_INVALID_ENCODING, "Unsupported encoding", 4, values, p, true));
    // TODO: Add ARGUMENTS_MISMATCH again later on
    // addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_ARGUMENTS_MISMATCH, "Arguments mismatch", 4,values,p, true));
    p = createTab(tabFolder, "pycodestyle.py (pep8)");
    String[][] pep8values = new String[][] { { "Error", String.valueOf(IMarker.SEVERITY_ERROR) }, { "Warning", String.valueOf(IMarker.SEVERITY_WARNING) }, { "Info", String.valueOf(IMarker.SEVERITY_INFO) }, { "Don't run", String.valueOf(-1) } };
    addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_PEP8, "Pep8", 4, pep8values, p, true) {

        @Override
        protected void doFillIntoGrid(Composite parent, int numColumns) {
            super.doFillIntoGrid(parent, 4);
            adjustForNumColumns(4);
        }
    });
    if (AnalysisPreferenceInitializer.SHOW_IN_PEP8_FEATURE_ENABLED) {
        addField(new BooleanFieldEditor(AnalysisPreferenceInitializer.USE_PEP8_CONSOLE, "Redirect pycodestyle output to console?", p) {

            @Override
            protected void doFillIntoGrid(Composite parent, int numColumns) {
                super.doFillIntoGrid(parent, 4);
                adjustForNumColumns(4);
            }
        });
    }
    addField(new BooleanFieldEditor(AnalysisPreferenceInitializer.PEP8_USE_SYSTEM, "Use system interpreter (may be faster than internal Jython)", p) {

        @Override
        protected void doFillIntoGrid(Composite parent, int numColumns) {
            super.doFillIntoGrid(parent, 4);
            adjustForNumColumns(4);
        }
    });
    addField(new LinkFieldEditor(AnalysisPreferenceInitializer.PEP8_COMMAND_LINE, "Additional command line arguments (i.e.: --ignore=E5,W391). See <a>pycodestyle docs</a> for details.", p, new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Program.launch("https://pycodestyle.readthedocs.io/");
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    }) {

        @Override
        protected void doFillIntoGrid(Composite parent, int numColumns) {
            numColumns = 4;
            Link linkControl = getLinkControl(parent);
            Object layoutData = linkControl.getLayoutData();
            if (layoutData == null) {
                layoutData = new GridData();
                linkControl.setLayoutData(layoutData);
            }
            ((GridData) layoutData).horizontalSpan = numColumns;
            adjustForNumColumns(4);
        }
    });
    addField(new StringFieldEditor(AnalysisPreferenceInitializer.PEP8_COMMAND_LINE, "Arguments: ", p) {

        @Override
        protected void doFillIntoGrid(Composite parent, int numColumns) {
            super.doFillIntoGrid(parent, 4);
            adjustForNumColumns(4);
        }
    });
    addField(new ScopedPreferencesFieldEditor(initialParent, PyAnalysisScopedPreferences.ANALYSIS_SCOPE, this));
}
Also used : LinkFieldEditor(org.python.pydev.shared_ui.field_editors.LinkFieldEditor) Composite(org.eclipse.swt.widgets.Composite) TabFolder(org.eclipse.swt.widgets.TabFolder) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) StringFieldEditor(org.eclipse.jface.preference.StringFieldEditor) 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) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Link(org.eclipse.swt.widgets.Link) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

LinkFieldEditor (org.python.pydev.shared_ui.field_editors.LinkFieldEditor)12 SelectionEvent (org.eclipse.swt.events.SelectionEvent)11 SelectionListener (org.eclipse.swt.events.SelectionListener)10 Composite (org.eclipse.swt.widgets.Composite)9 BooleanFieldEditor (org.eclipse.jface.preference.BooleanFieldEditor)7 IWorkbenchPreferenceContainer (org.eclipse.ui.preferences.IWorkbenchPreferenceContainer)6 ScopedPreferencesFieldEditor (org.python.pydev.shared_ui.field_editors.ScopedPreferencesFieldEditor)6 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)5 GridData (org.eclipse.swt.layout.GridData)5 RadioGroupFieldEditor (org.python.pydev.shared_ui.field_editors.RadioGroupFieldEditor)5 LabelFieldEditor (org.python.pydev.shared_ui.field_editors.LabelFieldEditor)4 GridLayout (org.eclipse.swt.layout.GridLayout)3 Button (org.eclipse.swt.widgets.Button)3 ComboFieldEditor (org.python.pydev.shared_ui.field_editors.ComboFieldEditor)3 FileFieldEditor (org.eclipse.jface.preference.FileFieldEditor)2 IntegerFieldEditor (org.eclipse.jface.preference.IntegerFieldEditor)2 StringFieldEditor (org.eclipse.jface.preference.StringFieldEditor)2 Combo (org.eclipse.swt.widgets.Combo)2 StyledTextForShowingCodeFactory (org.python.pydev.editor.StyledTextForShowingCodeFactory)2 CustomizableFieldEditor (org.python.pydev.utils.CustomizableFieldEditor)2