org.eclipse.ui.progress.IProgressService#busyCursorWhile ( )源码实例Demo

下面列出了org.eclipse.ui.progress.IProgressService#busyCursorWhile ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: bonita-studio   文件: DeployArtifactsHandler.java
@Execute
public void deploy(@Named(IServiceConstants.ACTIVE_SHELL) Shell activeShell,
        RepositoryAccessor repositoryAccessor, IProgressService progressService)
        throws InvocationTargetException, InterruptedException {

    progressService.busyCursorWhile(monitor -> {
        repositoryModel = new RepositoryModelBuilder().create(repositoryAccessor);
    });

    SelectArtifactToDeployPage page = new SelectArtifactToDeployPage(repositoryModel,
            new EnvironmentProviderFactory().getEnvironmentProvider());
    if (defaultSelection != null) {
        page.setDefaultSelectedElements(defaultSelection.stream()
                .map(fStore -> asArtifact(fStore))
                .filter(Objects::nonNull)
                .collect(Collectors.toSet()));
    }
    Optional<IStatus> result = createWizard(newWizard(), page,
            repositoryAccessor,
            Messages.selectArtifactToDeployTitle,
            Messages.selectArtifactToDeploy)
                    .open(activeShell, Messages.deploy);
    if (result.isPresent()) {
        openStatusDialog(activeShell, result.get(), repositoryAccessor);
    }
}
 
源代码2 项目: bonita-studio   文件: TestDocumentRefactoring.java
private void refactorDocument(final Pool pool) throws InvocationTargetException, InterruptedException {
    final Document documentToRefactor = pool.getDocuments().get(0);
    final RefactorDocumentOperation refactorOperation = new RefactorDocumentOperation(RefactoringOperationType.UPDATE);
    refactorOperation.setEditingDomain(TransactionUtil.getEditingDomain(pool));
    final Document newDocument = EcoreUtil.copy(documentToRefactor);
    newDocument.setName(newDocumentName);
    refactorOperation.addItemToRefactor(newDocument, documentToRefactor);
    final IProgressService service = PlatformUI.getWorkbench().getProgressService();
    service.busyCursorWhile(refactorOperation);
    final Document documentRefactored = pool.getDocuments().get(0);
    assertEquals(newDocument.getName(), documentRefactored.getName());
    testDocumentInExpressionsRefactored(documentRefactored, 2, pool);
    final Document currentDoc = refactorDocumentTypeAndMultiplicity(pool, documentRefactored);
    testRemoveDocumentRefactoring(currentDoc, pool);

}
 
源代码3 项目: bonita-studio   文件: TestDocumentRefactoring.java
private Document refactorDocumentTypeAndMultiplicity(final Pool pool, final Document document)
        throws InvocationTargetException, InterruptedException {
    final Document newDocument = EcoreUtil.copy(document);
    newDocument.setMultiple(true);
    newDocument.setDocumentType(DocumentType.EXTERNAL);
    final RefactorDocumentOperation refactorOperation = new RefactorDocumentOperation(RefactoringOperationType.UPDATE);
    refactorOperation.setEditingDomain(TransactionUtil.getEditingDomain(pool));
    refactorOperation.addItemToRefactor(newDocument, document);
    final IProgressService service = PlatformUI.getWorkbench().getProgressService();
    service.busyCursorWhile(refactorOperation);
    final Document documentRefactored = pool.getDocuments().get(0);
    assertEquals(newDocument.getName(), documentRefactored.getName());
    assertEquals(newDocument.getDocumentType(), documentRefactored.getDocumentType());
    return documentRefactored;

}
 
源代码4 项目: 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();
    }
  }
}
 
源代码5 项目: bonita-studio   文件: ExpressionViewer.java
private boolean executeRemoveOperation(final CompoundCommand cc) {
    boolean isExecuted = false;
    if (removeOperation != null) {
        removeOperation.setCompoundCommand(cc);
        final IProgressService service = PlatformUI.getWorkbench().getProgressService();
        try {
            service.busyCursorWhile(removeOperation);
            isExecuted = true;
        } catch (final InvocationTargetException | InterruptedException e) {
            BonitaStudioLog.error(e);
        }

    }
    return isExecuted;
}
 
源代码6 项目: bonita-studio   文件: TestParametersRefactoring.java
private void refactorParameter(final List<Pool> pools, final List<Parameter> pool1Parameters,
        final List<Parameter> pool2Parameters,
        final List<Operation> pool1Operations,
        final List<Operation> pool2Operations) throws InvocationTargetException, InterruptedException {
    final Parameter parameterToRefactor = pool1Parameters.get(0);
    final Parameter parameterWithSameName = pool2Parameters.get(0);
    final String parameterWithSameNameName = parameterWithSameName.getName();
    final String secondParameterOldName = pool1Parameters.get(1).getName();
    Configuration localeConfiguration = getLocalConfiguration(pools.get(0));
    final String parameterValue = localeConfiguration.getParameters().get(0).getValue();
    final RefactorParametersOperation op = new RefactorParametersOperation(pools.get(0));
    op.setEditingDomain(TransactionUtil.getEditingDomain(pools.get(0)));
    final Parameter newParameter = EcoreUtil.copy(parameterToRefactor);
    newParameter.setName(newParameterName);
    op.addItemToRefactor(newParameter, parameterToRefactor);
    final IProgressService service = PlatformUI.getWorkbench().getProgressService();
    service.busyCursorWhile(op);
    localeConfiguration = getLocalConfiguration(pools.get(0));
    assertEquals("refactoring first parameter also changed second parameter", secondParameterOldName,
            pool1Parameters.get(1).getName());
    assertEquals("parameter reference has not beeen refactored", newParameterName,
            pool1Operations.get(0).getRightOperand().getName());
    assertEquals("second parameter reference should not have changed", secondParameterOldName,
            pool1Operations.get(1).getRightOperand().getName());
    assertEquals("parameter with same name in second pool should not have changed", parameterWithSameNameName,
            parameterWithSameName.getName());
    assertEquals("parameter reference in second pool should not have been refactored", parameterWithSameNameName,
            pool2Operations.get(0).getRightOperand()
                    .getName());
    assertEquals("parameter name in configuration has not been refactored", newParameterName,
            localeConfiguration.getParameters().get(0).getName());
    assertEquals("refactored parameter has no value anymore", parameterValue,
            localeConfiguration.getParameters().get(0).getValue());
}
 
源代码7 项目: bonita-studio   文件: TestParametersRefactoring.java
private void removeParameter(final List<Pool> pools, final List<Parameter> pool1Parameters,
        final List<Operation> operations)
        throws InvocationTargetException,
        InterruptedException {
    final RemoveParametersOperation op = new RemoveParametersOperation(pool1Parameters.get(0), pools.get(0));
    op.setEditingDomain(TransactionUtil.getEditingDomain(pools.get(0)));
    final IProgressService service = PlatformUI.getWorkbench().getProgressService();
    service.busyCursorWhile(op);
    assertEquals("parameter has not been removed", 1, pools.get(0).getParameters().size());
    assertEquals("parameter reference has not been removed", "", operations.get(0).getRightOperand().getName());
    final Configuration localeConfiguration = getLocalConfiguration(pools.get(0));
    assertEquals("parameter has not been removed correctly in ", 1, localeConfiguration.getParameters().size());
}
 
源代码8 项目: bonita-studio   文件: TestDocumentRefactoring.java
private void testRemoveDocumentRefactoring(final Document document, final Pool pool)
        throws InvocationTargetException, InterruptedException {
    final RefactorDocumentOperation refactorOperation = new RefactorDocumentOperation(RefactoringOperationType.REMOVE);
    refactorOperation.setEditingDomain(TransactionUtil.getEditingDomain(pool));
    refactorOperation.addItemToRefactor(null, document);
    final IProgressService service = PlatformUI.getWorkbench().getProgressService();
    service.busyCursorWhile(refactorOperation);
    assertTrue(pool.getDocuments().isEmpty());
    final List<Task> tasks = ModelHelper.getAllItemsOfType(pool, ProcessPackage.Literals.TASK);
    final Task step1 = tasks.get(0);
    final Operation op = step1.getOperations().get(0);
    final Expression expr = op.getRightOperand();
    assertEquals(expr.getContent(), empty);
}