Search in sources :

Example 1 with PydevPackageExplorer

use of org.python.pydev.navigator.ui.PydevPackageExplorer in project Pydev by fabioz.

the class PythonProjectWizard method performFinish.

/**
 * The user clicked Finish button
 *
 * Launches another thread to create Python project. A progress monitor is shown in the UI thread.
 */
@Override
public boolean performFinish() {
    createdProject = createNewProject();
    IWorkingSet[] workingSets = projectPage.getWorkingSets();
    if (workingSets.length > 0) {
        PlatformUI.getWorkbench().getWorkingSetManager().addToWorkingSets(createdProject, workingSets);
        // Workaround to properly show project in Package Explorer: if Top Level Elements are
        // working sets, and the destination working set of the new project is selected, that set
        // must be reselected in order to display the project.
        PydevPackageExplorer pView = (PydevPackageExplorer) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView("org.python.pydev.navigator.view");
        if (pView != null) {
            IWorkingSet[] inputSets = ((PydevCommonViewer) pView.getCommonViewer()).getSelectedWorkingSets();
            if (inputSets != null && inputSets.length == 1) {
                IWorkingSet inputSet = inputSets[0];
                if (inputSet != null) {
                    for (IWorkingSet destinationSet : workingSets) {
                        if (inputSet.equals(destinationSet)) {
                            pView.getCommonViewer().setInput(inputSet);
                            break;
                        }
                    }
                }
            }
        }
    }
    // Switch to default perspective (will ask before changing)
    BasicNewProjectResourceWizard.updatePerspective(fConfigElement);
    BasicNewResourceWizard.selectAndReveal(createdProject, workbench.getActiveWorkbenchWindow());
    return true;
}
Also used : PydevCommonViewer(org.python.pydev.navigator.ui.PydevPackageExplorer.PydevCommonViewer) PydevPackageExplorer(org.python.pydev.navigator.ui.PydevPackageExplorer) IWorkingSet(org.eclipse.ui.IWorkingSet)

Example 2 with PydevPackageExplorer

use of org.python.pydev.navigator.ui.PydevPackageExplorer in project Pydev by fabioz.

the class PySetupCustomFilters method run.

@Override
public void run(IAction action) {
    final Display display = Display.getDefault();
    display.syncExec(new Runnable() {

        @Override
        public void run() {
            // ask the filters to the user
            IInputValidator validator = null;
            IPreferenceStore prefs = PydevPlugin.getDefault().getPreferenceStore();
            InputDialog dialog = new InputDialog(display.getActiveShell(), "Custom Filters", "Enter the filters (separated by comma. E.g.: \"__init__.py, *.xyz\").\n" + "\n" + "Note 1: Only * and ? may be used for custom matching.\n" + "\n" + "Note 2: it'll only take effect if the 'Pydev: Hide custom specified filters'\n" + "is active in the menu: customize view > filters.", prefs.getString(CUSTOM_FILTERS_PREFERENCE_NAME), validator);
            dialog.setBlockOnOpen(true);
            dialog.open();
            if (dialog.getReturnCode() == Window.OK) {
                // update the preferences and refresh the viewer (when we update the preferences, the
                // filter that uses this will promptly update its values -- just before the refresh).
                prefs.setValue(CUSTOM_FILTERS_PREFERENCE_NAME, dialog.getValue());
                PydevPackageExplorer p = (PydevPackageExplorer) view;
                p.getCommonViewer().refresh();
            }
        }
    });
}
Also used : InputDialog(org.eclipse.jface.dialogs.InputDialog) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) PydevPackageExplorer(org.python.pydev.navigator.ui.PydevPackageExplorer) Display(org.eclipse.swt.widgets.Display) IInputValidator(org.eclipse.jface.dialogs.IInputValidator)

Aggregations

PydevPackageExplorer (org.python.pydev.navigator.ui.PydevPackageExplorer)2 IInputValidator (org.eclipse.jface.dialogs.IInputValidator)1 InputDialog (org.eclipse.jface.dialogs.InputDialog)1 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)1 Display (org.eclipse.swt.widgets.Display)1 IWorkingSet (org.eclipse.ui.IWorkingSet)1 PydevCommonViewer (org.python.pydev.navigator.ui.PydevPackageExplorer.PydevCommonViewer)1