Java 类org.eclipse.ui.progress.IProgressService 实例源码

项目:ForgedUI-Eclipse    文件:GenerateCodeActionDelegate.java   
protected void processFile(IFile file) {

        if (file != null
                && file.getFileExtension().equalsIgnoreCase(
                        GUIEditorPlugin.FORGED_UI_EXTENSION)) {

            if (GUIEditorPlugin.getDefault().getWorkbench()
                    .saveAllEditors(true)) {
                // Do the start of the job here.
                Shell shell = PlatformUI.getWorkbench()
                        .getActiveWorkbenchWindow().getShell();
                IProgressService progressService = PlatformUI.getWorkbench()
                        .getProgressService();
                CodeGenJob job = new CodeGenJob(file);
                UIJob runJob = new EditorUIJob(job);
                progressService.showInDialog(shell, runJob);
                // runJob.setRule(ISchedulingRule);
                runJob.schedule();

            }
        }

    }
项目:libraries    文件:ViewSiteRelationsListener.java   
public ViewSiteRelationsListener(
  final IRunnableContext runnableContext,
  final IProgressService progressService,
  final ILogger logger,
  final IJavaModel model,
  final IObjectModel<IItem> selectedItemModel,
  final IObjectListModel<IItem> selectedItemsModel,
  final Label label,
  final IDependenciesModel dependenciesModel,
  final WritableList<IDependencyRelation> descriptions,
  final INameHitMaps nameHitMaps) {
  this.runnableContext = runnableContext;
  this.logger = logger;
  this.progressService = progressService;
  this.model = model;
  this.selectedItemModel = selectedItemModel;
  this.selectedItemsModel = selectedItemsModel;
  this.label = label;
  this.dependenciesModel = dependenciesModel;
  this.descriptions = descriptions;
  this.nameHitMaps = nameHitMaps;
}
项目:bts    文件:RefactoringWizardOpenOperation_NonForking.java   
/**
 * CHANGED to protected
 * CHANGED do not fork as we are keeping the resource lock.
 */
protected RefactoringStatus checkInitialConditions(Refactoring refactoring, Shell parent, String title,
        IRunnableContext context) throws InterruptedException {
    try {
        CheckConditionsOperation cco = new CheckConditionsOperation(refactoring,
                CheckConditionsOperation.INITIAL_CONDITONS);
        WorkbenchRunnableAdapter workbenchRunnableAdapter = new WorkbenchRunnableAdapter(cco, ResourcesPlugin
                .getWorkspace().getRoot());
        /* CHANGE: don't fork (or use busyCursorWhile) as this will cause a deadlock */
        if (context == null) {
            PlatformUI.getWorkbench().getProgressService().run(false, true, workbenchRunnableAdapter);
        } else if (context instanceof IProgressService) {
            ((IProgressService) context).run(false, true, workbenchRunnableAdapter);
        } else {
            context.run(false, true, workbenchRunnableAdapter);
        }
        return cco.getStatus();
    } catch (InvocationTargetException e) {
        ExceptionHandler.handle(e, parent, title, RefactoringUIMessages.RefactoringUI_open_unexpected_exception);
        return RefactoringStatus
                .createFatalErrorStatus(RefactoringUIMessages.RefactoringUI_open_unexpected_exception);
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:NLSAccessorConfigurationDialog.java   
protected void browseForAccessorClass() {
    IProgressService service= PlatformUI.getWorkbench().getProgressService();
    IPackageFragmentRoot root= fAccessorPackage.getSelectedFragmentRoot();

    IJavaSearchScope scope= root != null ? SearchEngine.createJavaSearchScope(new IJavaElement[] { root }) : SearchEngine.createWorkspaceScope();

    FilteredTypesSelectionDialog  dialog= new FilteredTypesSelectionDialog (getShell(), false,
        service, scope, IJavaSearchConstants.CLASS);
    dialog.setTitle(NLSUIMessages.NLSAccessorConfigurationDialog_Accessor_Selection);
    dialog.setMessage(NLSUIMessages.NLSAccessorConfigurationDialog_Choose_the_accessor_file);
    dialog.setInitialPattern("*Messages"); //$NON-NLS-1$
    if (dialog.open() == Window.OK) {
        IType selectedType= (IType) dialog.getFirstResult();
        if (selectedType != null) {
            fAccessorClassName.setText(selectedType.getElementName());
            fAccessorPackage.setSelected(selectedType.getPackageFragment());
        }
    }


}
项目:Eclipse-Postfix-Code-Completion    文件:FindAction.java   
private void performNewSearch(IJavaElement element) throws JavaModelException, InterruptedException {
    JavaSearchQuery query= new JavaSearchQuery(createQuery(element));
    if (query.canRunInBackground()) {
        /*
         * This indirection with Object as parameter is needed to prevent the loading
         * of the Search plug-in: the VM verifies the method call and hence loads the
         * types used in the method signature, eventually triggering the loading of
         * a plug-in (in this case ISearchQuery results in Search plug-in being loaded).
         */
        SearchUtil.runQueryInBackground(query);
    } else {
        IProgressService progressService= PlatformUI.getWorkbench().getProgressService();
        /*
         * This indirection with Object as parameter is needed to prevent the loading
         * of the Search plug-in: the VM verifies the method call and hence loads the
         * types used in the method signature, eventually triggering the loading of
         * a plug-in (in this case it would be ISearchQuery).
         */
        IStatus status= SearchUtil.runQueryInForeground(progressService, query);
        if (status.matches(IStatus.ERROR | IStatus.INFO | IStatus.WARNING)) {
            ErrorDialog.openError(getShell(), SearchMessages.Search_Error_search_title, SearchMessages.Search_Error_search_message, status);
        }
    }
}
项目:idecore    文件:ActionController.java   
protected void syncCheckWork() throws InvocationTargetException, InterruptedException {
    IProgressService service = PlatformUI.getWorkbench().getProgressService();
    service.run(true, true, new IRunnableWithProgress() {
        @Override
        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            monitor.beginTask("Synchronize check against server", 2);
            try {
                monitorWork(monitor);
                boolean tmpInSync = false;
                for (IResource resource : getSelectedResources()) {
                    ProjectService projectService = ContainerDelegate.getInstance().getServiceLocator().getProjectService();
                    tmpInSync = projectService.isResourceInSync(
                            resource,
                            new SubProgressMonitor(monitor, 4));
                    if (!tmpInSync) {
                        isInSync = false;
                    }
                }
            } catch (Exception e) {
                throw new InvocationTargetException(e);
            } finally {
                monitor.done();
            }
        }
    });
}
项目:idecore    文件:ProjectContentPropertyPage.java   
private static void refreshProject(final IWorkbench workbench, final IStructuredSelection selection) throws InvocationTargetException,
        InterruptedException {
    final IProgressService service = PlatformUI.getWorkbench().getProgressService();
    service.run(false, false, new IRunnableWithProgress() {
        @Override
        public void run(final IProgressMonitor monitor) throws InvocationTargetException {
            monitor.beginTask("Refreshing project...", IProgressMonitor.UNKNOWN);
            try {
                RefreshResourceHandler.execute(workbench, selection);
            } catch (Throwable e) {
                throw new InvocationTargetException(e);
            } finally {
                monitor.done();
            }
        }
    });
}
项目:idecore    文件:DeploymentResultsPage.java   
private void deploy() throws InvocationTargetException {
    IProgressService service = PlatformUI.getWorkbench().getProgressService();
    try {
        service.run(true, true, new IRunnableWithProgress() {
            @Override
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                monitor.beginTask("Deploying components...", 1);
                try {
                    deploymentWizard.getDeploymentController().finish(new SubProgressMonitor(monitor, 3));
                    monitor.worked(1);
                } finally {
                    monitor.subTask("Done");
                }
            }
        });
    } catch (InterruptedException e) {
        logger.warn("Operation cancelled: " + e.getMessage());
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:NLSAccessorConfigurationDialog.java   
protected void browseForAccessorClass() {
    IProgressService service= PlatformUI.getWorkbench().getProgressService();
    IPackageFragmentRoot root= fAccessorPackage.getSelectedFragmentRoot();

    IJavaSearchScope scope= root != null ? SearchEngine.createJavaSearchScope(new IJavaElement[] { root }) : SearchEngine.createWorkspaceScope();

    FilteredTypesSelectionDialog  dialog= new FilteredTypesSelectionDialog (getShell(), false,
        service, scope, IJavaSearchConstants.CLASS);
    dialog.setTitle(NLSUIMessages.NLSAccessorConfigurationDialog_Accessor_Selection);
    dialog.setMessage(NLSUIMessages.NLSAccessorConfigurationDialog_Choose_the_accessor_file);
    dialog.setInitialPattern("*Messages"); //$NON-NLS-1$
    if (dialog.open() == Window.OK) {
        IType selectedType= (IType) dialog.getFirstResult();
        if (selectedType != null) {
            fAccessorClassName.setText(selectedType.getElementName());
            fAccessorPackage.setSelected(selectedType.getPackageFragment());
        }
    }


}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:FindAction.java   
private void performNewSearch(IJavaElement element) throws JavaModelException, InterruptedException {
    JavaSearchQuery query= new JavaSearchQuery(createQuery(element));
    if (query.canRunInBackground()) {
        /*
         * This indirection with Object as parameter is needed to prevent the loading
         * of the Search plug-in: the VM verifies the method call and hence loads the
         * types used in the method signature, eventually triggering the loading of
         * a plug-in (in this case ISearchQuery results in Search plug-in being loaded).
         */
        SearchUtil.runQueryInBackground(query);
    } else {
        IProgressService progressService= PlatformUI.getWorkbench().getProgressService();
        /*
         * This indirection with Object as parameter is needed to prevent the loading
         * of the Search plug-in: the VM verifies the method call and hence loads the
         * types used in the method signature, eventually triggering the loading of
         * a plug-in (in this case it would be ISearchQuery).
         */
        IStatus status= SearchUtil.runQueryInForeground(progressService, query);
        if (status.matches(IStatus.ERROR | IStatus.INFO | IStatus.WARNING)) {
            ErrorDialog.openError(getShell(), SearchMessages.Search_Error_search_title, SearchMessages.Search_Error_search_message, status);
        }
    }
}
项目:XRobot    文件:UploadAction.java   
@Override
public void run(IAction action) {
    final ArrayList<File> tmp = new ArrayList<File>();
    LeJOSEV3Util.getFilesFromSelection(_selection, tmp);
    if (!tmp.isEmpty())
    {
        // open progress monitor
        IWorkbench wb = PlatformUI.getWorkbench();
        IProgressService ps = wb.getProgressService();
        try {
            ps.busyCursorWhile(new IRunnableWithProgress() {
                public void run(IProgressMonitor pm) {
                    uploadFile(pm, tmp);
                } // end run
            });
        } catch (Throwable t) {
            // log
            LeJOSEV3Util.log(t);
        }
    }
}
项目:libraries    文件:RelationsTableListener.java   
public RelationsTableListener(
  final ILogger logger,
  final IRunnableContext context,
  final IProgressService progressService,
  final WritableList<IType> types,
  final IDependenciesModel dependenciesModel,
  final IObjectModel<IItem> selectedItemModel) {
  this.logger = logger;
  this.context = context;
  this.progressService = progressService;
  this.types = types;
  this.dependenciesModel = dependenciesModel;
  this.selectedItemModel = selectedItemModel;
}
项目:mesfavoris    文件:BookmarksViewerDropListener.java   
private List<Bookmark> getBookmarks(IStructuredSelection selection) {
    List<Bookmark> bookmarks = new ArrayList<>();
    IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
    try {
        progressService.busyCursorWhile(monitor -> {
            bookmarks.addAll(getBookmarks(selection, monitor));
        });
    } catch (InvocationTargetException | InterruptedException e) {
        // ignore
    }
    return bookmarks;
}
项目:mesfavoris    文件:ImportTeamProjectHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
    Bookmark bookmark = getSelectedBookmark(selection);
    ImportTeamProjectFromBookmarkJob job = new ImportTeamProjectFromBookmarkJob(bookmark);
    IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
    progressService.showInDialog(HandlerUtil.getActiveShell(event), job);
    job.schedule();
    return null;
}
项目:typescript.java    文件:FindReferencesInProjectAction.java   
private void findReferences(IResource resource, int offset, int length) {
    TypeScriptSearchQuery query = new TypeScriptSearchQuery(resource, offset);
    if (query.canRunInBackground()) {
        /*
         * This indirection with Object as parameter is needed to prevent
         * the loading of the Search plug-in: the VM verifies the method
         * call and hence loads the types used in the method signature,
         * eventually triggering the loading of a plug-in (in this case
         * ISearchQuery results in Search plug-in being loaded).
         */
        SearchUtil.runQueryInBackground(query);
    } else {
        IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
        /*
         * This indirection with Object as parameter is needed to prevent
         * the loading of the Search plug-in: the VM verifies the method
         * call and hence loads the types used in the method signature,
         * eventually triggering the loading of a plug-in (in this case it
         * would be ISearchQuery).
         */
        IStatus status = SearchUtil.runQueryInForeground(progressService, query);
        if (status.matches(IStatus.ERROR | IStatus.INFO | IStatus.WARNING)) {
            ErrorDialog.openError(getShell(), SearchMessages.Search_Error_search_title,
                    SearchMessages.Search_Error_search_message, status);
        }
    }
}
项目:eclipse-extras    文件:LaunchConfigStarter.java   
private void terminateLaunches() {
  if( preferences.isTerminateBeforeRelaunch() ) {
    IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
    try {
      progressService.busyCursorWhile( this::terminateLaunches );
    } catch( InvocationTargetException ite ) {
      handleException( ite.getCause() );
    } catch( InterruptedException ignore ) {
      Thread.interrupted();
    }
  }
}
项目:SecureBPMN    文件:SaveBpmnModelFeature.java   
public void execute(ICustomContext context) {
  try {
    URI uri = getDiagram().eResource().getURI();
    URI bpmnUri = uri.trimFragment();
    bpmnUri = bpmnUri.trimFileExtension();
    bpmnUri = bpmnUri.appendFileExtension("bpmn20.xml");

    IProject project = null;
    String parentDiagramName = null;
    if (bpmnUri.isPlatformResource()) {
      String platformString = bpmnUri.toPlatformString(true);
      IResource fileResource = ResourcesPlugin.getWorkspace().getRoot().findMember(platformString);
      if (fileResource != null) {
        project = fileResource.getProject();
        parentDiagramName = uri.trimFragment().trimFileExtension().lastSegment();
      }
    }

    final IProgressService progressService = PlatformUI.getWorkbench().getProgressService();

    final ExportMarshallerRunnable runnable = new ExportMarshallerRunnable(getDiagram(), ActivitiBPMNDiagramConstants.BPMN_MARSHALLER_NAME);
    progressService.busyCursorWhile(runnable);

  } catch (Exception e) {
    e.printStackTrace();
  }
}
项目:limpet    文件:ApplicationWorkbenchAdvisor.java   
public void preStartup()
{

  // Suspend background jobs while we startup
  Job.getJobManager().suspend();

  // Register the build actions
  IProgressService service = PlatformUI.getWorkbench().getProgressService();
  ImageDescriptor newImage =
      IDEInternalWorkbenchImages
          .getImageDescriptor(IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC);
  service
      .registerIconForFamily(newImage, ResourcesPlugin.FAMILY_MANUAL_BUILD);
  service.registerIconForFamily(newImage, ResourcesPlugin.FAMILY_AUTO_BUILD);
}
项目:Eclipse-Postfix-Code-Completion    文件:GotoPackageAction.java   
private SelectionDialog createAllPackagesDialog(Shell shell) {
    IProgressService progressService= PlatformUI.getWorkbench().getProgressService();
    IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
    int flag= PackageSelectionDialog.F_HIDE_EMPTY_INNER;
    PackageSelectionDialog dialog= new PackageSelectionDialog(shell, progressService, flag, scope);
    dialog.setFilter(""); //$NON-NLS-1$
    dialog.setIgnoreCase(false);
    dialog.setMultipleSelection(false);
    return dialog;
}
项目:Eclipse-Postfix-Code-Completion    文件:ClipboardOperationAction.java   
private IProgressService getProgressService() {
    IEditorPart editor= getTextEditor();
    if (editor != null) {
        IWorkbenchPartSite site= editor.getSite();
        if (site != null)
            return (IWorkbenchSiteProgressService) editor.getSite().getAdapter(IWorkbenchSiteProgressService.class);
    }
    return PlatformUI.getWorkbench().getProgressService();
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:GotoPackageAction.java   
private SelectionDialog createAllPackagesDialog(Shell shell) {
    IProgressService progressService= PlatformUI.getWorkbench().getProgressService();
    IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
    int flag= PackageSelectionDialog.F_HIDE_EMPTY_INNER;
    PackageSelectionDialog dialog= new PackageSelectionDialog(shell, progressService, flag, scope);
    dialog.setFilter(""); //$NON-NLS-1$
    dialog.setIgnoreCase(false);
    dialog.setMultipleSelection(false);
    return dialog;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ClipboardOperationAction.java   
private IProgressService getProgressService() {
    IEditorPart editor= getTextEditor();
    if (editor != null) {
        IWorkbenchPartSite site= editor.getSite();
        if (site != null)
            return (IWorkbenchSiteProgressService) editor.getSite().getAdapter(IWorkbenchSiteProgressService.class);
    }
    return PlatformUI.getWorkbench().getProgressService();
}
项目:elexis-3-core    文件:RnContentProvider.java   
@SuppressWarnings("unchecked")
public Object[] getElements(final Object inputElement){
    IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
    try {
        progressService.run(true, true, new IRunnableWithProgress() {

            @Override
            public void run(final IProgressMonitor monitor){
                reload(monitor);
                if (monitor.isCanceled()) {
                    monitor.done();
                }

                rlv.getSite().getShell().getDisplay().syncExec(new Runnable() {
                    @Override
                    public void run(){
                        InvoiceListBottomComposite invoiceListeBottomComposite =
                            rlv.getInvoiceListeBottomComposite();
                        if (invoiceListeBottomComposite != null) {
                            invoiceListeBottomComposite.update(Integer.toString(iPat),
                                Integer.toString(iRn), mAmount.getAmountAsString(),
                                mOpen.getAmountAsString());
                        }
                    }
                });
            }
        });
    } catch (Throwable ex) {
        ExHandler.handle(ex);
    }

    return result == null ? new Tree[0] : result;
}
项目:elexis-3-core    文件:KGDrucker.java   
public void doPrint(Patient pat){
    this.patient = pat;
    kgPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IProgressService progressService = PlatformUI.getWorkbench().getProgressService();

    try {
        kgp = (KGPrintView) kgPage.showView(KGPrintView.ID);
        progressService.runInUI(PlatformUI.getWorkbench().getProgressService(),
            new IRunnableWithProgress() {
                public void run(IProgressMonitor monitor){
                    monitor.beginTask(Messages.KGDrucker_printEMR, 1); //$NON-NLS-1$
                    // gw 23.7.2006 an neues Selectionmodell angepasst
                    Patient actPatient = ElexisEventDispatcher.getSelectedPatient();
                    if (kgp.doPrint(actPatient, monitor) == false) {
                        ErrorDialog.openError(null, Messages.KGDrucker_errorPrinting,
                            Messages.KGDrucker_couldntprint + patient.getLabel()
                                + Messages.KGDrucker_emr, null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

                    }

                    monitor.done();
                }
            }, null);

        kgPage.hideView(kgp);

    } catch (Exception ex) {
        ElexisStatus status =
            new ElexisStatus(ElexisStatus.ERROR, Hub.PLUGIN_ID, ElexisStatus.CODE_NONE,
                Messages.KGDrucker_errorPrinting + ": " + Messages.KGDrucker_couldntShow, ex);
        StatusManager.getManager().handle(status);
    }
}
项目:olca-app    文件:App.java   
public static void runWithProgress(String name, Runnable runnable) {
    IProgressService progress = PlatformUI.getWorkbench()
            .getProgressService();
    try {
        progress.run(true, false, (monitor) -> {
            monitor.beginTask(name, IProgressMonitor.UNKNOWN);
            runnable.run();
            monitor.done();
        });
    } catch (InvocationTargetException | InterruptedException e) {
        log.error("Error while running progress " + name, e);
    }
}
项目:libraries    文件:ViewSiteListener.java   
public ViewSiteListener(final Device device, final IProgressService progressService, final WritableList<IGuiIconDescription> input) {
  this.device = device;
  this.progressService = progressService;
  this.descriptions = input;
}
项目:gef-gwt    文件:Workbench.java   
@Override
public IProgressService getProgressService() {
    // TODO Auto-generated method stub
    return null;
}
项目:goclipse    文件:WorkbenchOperationExecutor.java   
protected void doRunRunnableWithProgress(IRunnableWithProgress progressRunnable)
        throws InvocationTargetException, InterruptedException {
    IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
    progressService.run(!executeInUIOnly, true, progressRunnable);
}
项目:NEXCORE-UML-Modeler    文件:UiCorePlugin.java   
/**
 * getProgressService
 *  
 * @return IProgressService
 */
public IProgressService getProgressService() {
    return getWorkbench().getProgressService();
}
项目:gef-gwt    文件:IWorkbench.java   
/**
 * Returns the progress service for the workbench.
 * 
 * @return the progress service
 * @since 3.0
 */
public IProgressService getProgressService();