Package org.python.pydev.core.uiutils

Examples of org.python.pydev.core.uiutils.AsynchronousProgressMonitorDialog


    /**
     * @param shell
     *
     */
    public static void startAction(Shell shell, ProgressAction action, boolean cancelable) {
        ProgressMonitorDialog monitorDialog = new AsynchronousProgressMonitorDialog(shell);
        monitorDialog.setCancelable(cancelable);
        monitorDialog.setBlockOnOpen(false);
        try {
            IRunnableWithProgress operation = new ProgressOperation(action);
            monitorDialog.run(false, false, operation);
            // Perform the action
        } catch (InvocationTargetException e) {
            Log.log(e);
        } catch (InterruptedException e) {
            Log.log(e);
View Full Code Here


                        int retCode = d.open();
                        final ByteArrayOutputStream output = new ByteArrayOutputStream();
                        if (retCode == InputDialog.OK) {

                            ProgressMonitorDialog monitorDialog = new AsynchronousProgressMonitorDialog(getShell());
                            monitorDialog.setBlockOnOpen(false);
                            final Exception[] exception = new Exception[1];
                            try {
                                IRunnableWithProgress operation = new IRunnableWithProgress() {

                                    public void run(final IProgressMonitor monitor) throws InvocationTargetException,
                                            InterruptedException {
                                        monitor.beginTask("Restoring PYTHONPATH", IProgressMonitor.UNKNOWN);

                                        IPythonInterpreter interpreter = JythonPlugin
                                                .newPythonInterpreter(false, false);
                                        interpreter.setErr(output);
                                        interpreter.setOut(output);
                                        HashMap<String, Object> locals = new HashMap<String, Object>();
                                        locals.put("api_file", filePath);
                                        locals.put("parts_for_module", d.getValue());
                                        locals.put("cancel_monitor", monitor);
                                        try {
                                            JythonPlugin.exec(locals, "convert_api_to_pypredef.py", interpreter);
                                        } catch (Exception e) {
                                            Log.log(e + "\n\n" + output.toString());
                                            exception[0] = e;
                                        }

                                        monitor.done();
                                    }
                                };

                                monitorDialog.run(true, true, operation);

                            } catch (Exception e) {
                                Log.log(e);
                            }
View Full Code Here

            logger.println("- Chosen interpreter (name and file):'" + interpreterNameAndExecutable);

            if (interpreterNameAndExecutable != null && interpreterNameAndExecutable.o2 != null) {
                //ok, now that we got the file, let's see if it is valid and get the library info.
                logger.println("- Ok, file is non-null. Getting info on:" + interpreterNameAndExecutable.o2);
                ProgressMonitorDialog monitorDialog = new AsynchronousProgressMonitorDialog(this.getShell());
                monitorDialog.setBlockOnOpen(false);
                ObtainInterpreterInfoOperation operation;
                while (true) {
                    operation = new ObtainInterpreterInfoOperation(interpreterNameAndExecutable.o2, logger,
                            interpreterManager);
                    monitorDialog.run(true, false, operation);
                    if (operation.e != null) {
                        logger.println("- Some error happened while getting info on the interpreter:");
                        operation.e.printStackTrace(logger);

                        if (operation.e instanceof SimpleJythonRunner.JavaNotConfiguredException) {
View Full Code Here

        }

        beforeRun();

        final Integer[] nChanged = new Integer[] { 0 };
        ProgressMonitorDialog monitorDialog = new AsynchronousProgressMonitorDialog(PyAction.getShell());
        try {
            IRunnableWithProgress operation = new IRunnableWithProgress() {

                public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                    for (Iterator<IResource> iter = selectedResources.iterator(); iter.hasNext();) {
                        IResource next = iter.next();
                        if (getRefreshBeforeExecute()) {
                            //as files are generated externally, if we don't refresh, it's very likely that we won't delete a bunch of files.
                            try {
                                next.refreshLocal(IResource.DEPTH_INFINITE, monitor);
                            } catch (Exception e) {
                                Log.log(e);
                            }
                        }
                        nChanged[0] += doActionOnResource(next, monitor);
                    }
                }
            };
            boolean fork = !needsUIThread();
            monitorDialog.run(fork, true, operation);
        } catch (Throwable e) {
            Log.log(e);
        }

        afterRun(nChanged[0]);
View Full Code Here

            }

        }

        //this is the default interpreter
        ProgressMonitorDialog monitorDialog = new AsynchronousProgressMonitorDialog(this.getShell());
        monitorDialog.setBlockOnOpen(false);

        try {
            IRunnableWithProgress operation = new IRunnableWithProgress() {

                public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                    monitor.beginTask("Restoring PYTHONPATH", IProgressMonitor.UNKNOWN);
                    try {
                        //clear all but the ones that appear
                        getInterpreterManager().setInfos(exesList, interpreterNamesToRestore, monitor);
                    } finally {
                        monitor.done();
                    }
                }
            };

            monitorDialog.run(true, true, operation);

        } catch (Exception e) {
            Log.log(e);
        }
    }
View Full Code Here

        }

        beforeRun();

        final Integer[] nChanged = new Integer[] { 0 };
        ProgressMonitorDialog monitorDialog = new AsynchronousProgressMonitorDialog(PyAction.getShell());
        try {
            IRunnableWithProgress operation = new IRunnableWithProgress() {

                public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                    for (Iterator<IContainer> iter = selectedContainers.iterator(); iter.hasNext();) {
                        IContainer next = iter.next();
                        if (getRefreshBeforeExecute()) {
                            //as files are generated externally, if we don't refresh, it's very likely that we won't delete a bunch of files.
                            try {
                                next.refreshLocal(IResource.DEPTH_INFINITE, monitor);
                            } catch (Exception e) {
                                Log.log(e);
                            }
                        }
                        nChanged[0] += doActionOnContainer(next, monitor);
                    }
                }
            };
            boolean fork = !needsUIThread();
            monitorDialog.run(fork, true, operation);
        } catch (Throwable e) {
            Log.log(e);
        }

        afterRun(nChanged[0]);
View Full Code Here

            }
        }

        if (outOfDateEntries.size() > 0 || outOfSyncEntries.size() > 0) {
            if (askForResearch(outOfDateEntries, outOfSyncEntries)) {
                ProgressMonitorDialog pmd = new AsynchronousProgressMonitorDialog(fSite.getShell());
                try {
                    pmd.run(true, true, new WorkspaceModifyOperation(null) {
                        protected void execute(IProgressMonitor monitor) throws CoreException {
                            research(monitor, outOfDateEntries, operation);
                        }
                    });
                    return true;
View Full Code Here

            IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
            IWorkbenchPage page = workbenchWindow.getActivePage();
            view = (PyHierarchyView) page.showView("com.python.pydev.ui.hierarchy.PyHierarchyView", null,
                    IWorkbenchPage.VIEW_VISIBLE);

            ProgressMonitorDialog monitorDialog = new AsynchronousProgressMonitorDialog(PyAction.getShell());
            try {
                IRunnableWithProgress operation = new IRunnableWithProgress() {

                    public void run(final IProgressMonitor monitor) throws InvocationTargetException,
                            InterruptedException {
                        try {
                            final HierarchyNodeModel model;

                            //set whatever is needed for the hierarchy
                            IPyRefactoring pyRefactoring = AbstractPyRefactoring.getPyRefactoring();
                            if (pyRefactoring instanceof IPyRefactoring2) {
                                RefactoringRequest refactoringRequest = getRefactoringRequest(monitor);
                                IPyRefactoring2 r2 = (IPyRefactoring2) pyRefactoring;
                                model = r2.findClassHierarchy(refactoringRequest, false);

                                if (monitor.isCanceled()) {
                                    return;
                                }
                                Runnable r = new Runnable() {
                                    public void run() {
                                        if (!monitor.isCanceled()) {
                                            view.setHierarchy(model);
                                        }
                                    }
                                };
                                Display.getDefault().asyncExec(r);
                            }
                        } catch (Exception e) {
                            Log.log(e);
                        }

                    }
                };

                boolean fork = true;
                monitorDialog.run(fork, true, operation);
            } catch (Throwable e) {
                Log.log(e);
            }
        } catch (Exception e) {
            Log.log(e);
View Full Code Here

TOP

Related Classes of org.python.pydev.core.uiutils.AsynchronousProgressMonitorDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.