Java Code Examples for org.eclipse.jface.operation.IRunnableWithProgress#run()

The following examples show how to use org.eclipse.jface.operation.IRunnableWithProgress#run() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BundleJavaProcessor.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
@Override
public void generatePom(int option) {
    super.generatePom(option);
    if (option == TalendProcessOptionConstants.GENERATE_IS_MAINJOB) {
        try {
            IRepositoryObject repositoryObject = new RepositoryObject(getProperty());

            // Fix TESB-22660: Avoide to operate repo viewer before it open
            if (PlatformUI.isWorkbenchRunning()) {
                RepositorySeekerManager.getInstance().searchRepoViewNode(getProperty().getId(), false);
            }

            IRunnableWithProgress action = new JavaCamelJobScriptsExportWSAction(repositoryObject, getProperty().getVersion(),
                    "", false);
            action.run(new NullProgressMonitor());
        } catch (Exception e) {
            ExceptionHandler.process(e);
        }
    }
}
 
Example 2
Source File: OSGIJavaProcessor.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
@Override
public void generatePom(int option) {
    // TESB-27828: Set OSGI type for pom creator
	if(ProcessorUtilities.isExportAsOSGI()) {
		getArguments().put(TalendProcessArgumentConstant.ARG_BUILD_TYPE, "OSGI");
	}
    try {
        IRepositoryObject repositoryObject = new RepositoryObject(getProperty());
        IRunnableWithProgress action = new JavaCamelJobScriptsExportWSAction(repositoryObject, getProperty().getVersion(), "",
                false);
        action.run(new NullProgressMonitor());
    } catch (Exception e) {
        e.printStackTrace();
    }
    super.generatePom(option);
}
 
Example 3
Source File: RunContainerProcessor.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
@Override
public void generatePom(int option) {
    super.generatePom(option);

    if (option == TalendProcessOptionConstants.GENERATE_IS_MAINJOB
            && ComponentCategory.CATEGORY_4_CAMEL.getName().equals(getProcess().getComponentsType())) {
        try {
            IRepositoryObject repositoryObject = new RepositoryObject(getProperty());

            // Fix TESB-22660: Avoide to operate repo viewer before it open
            if (PlatformUI.isWorkbenchRunning()) {
                RepositorySeekerManager.getInstance().searchRepoViewNode(getProperty().getId(), false);
            }

            IRunnableWithProgress action = new JavaCamelJobScriptsExportWSAction(repositoryObject, getProperty().getVersion(),
                    "", false);
            action.run(new NullProgressMonitor());
        } catch (Exception e) {
            ExceptionHandler.process(e);
        }
    }
}
 
Example 4
Source File: PipelineArgumentsTabTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Override
public Void answer(InvocationOnMock invocation)
    throws InvocationTargetException, InterruptedException {
  IRunnableWithProgress runnable = invocation.getArgumentAt(2, IRunnableWithProgress.class);
  runnable.run(new NullProgressMonitor());
  return null;
}
 
Example 5
Source File: BusyIndicatorRunnableContext.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void internalRun(boolean fork, final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
	Thread thread= Thread.currentThread();
	// Do not spawn another thread if we are already in a modal context
	// thread or inside a busy context thread.
	if (thread instanceof ThreadContext || ModalContext.isModalContextThread(thread))
		fork= false;

	if (fork) {
		final ThreadContext t= new ThreadContext(runnable);
		t.start();
		t.sync();
		// Check if the separate thread was terminated by an exception
		Throwable throwable= t.fThrowable;
		if (throwable != null) {
			if (throwable instanceof InvocationTargetException) {
				throw (InvocationTargetException) throwable;
			} else if (throwable instanceof InterruptedException) {
				throw (InterruptedException) throwable;
			} else if (throwable instanceof OperationCanceledException) {
				throw new InterruptedException();
			} else {
				throw new InvocationTargetException(throwable);
			}
		}
	} else {
		try {
			runnable.run(new NullProgressMonitor());
		} catch (OperationCanceledException e) {
			throw new InterruptedException();
		}
	}
}
 
Example 6
Source File: WorkbenchOperationExecutor.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
protected final void runRunnableWithProgress(IRunnableWithProgress progressRunnable)
		throws InvocationTargetException, InterruptedException {
	
	if(allowBackgroundAlready && Display.getCurrent() == null) {
		assertTrue(executeInUIOnly == false);
		// Perform computation directly in this thread, but cancellation won't be possible.
		progressRunnable.run(new NullProgressMonitor());
	} else {
		
		assertTrue(Display.getCurrent() != null);
		
		doRunRunnableWithProgress(progressRunnable);
	}
}
 
Example 7
Source File: RepositoryManager.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Run the given runnable
 */
public void run(IRunnableWithProgress runnable, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
	runnable.run(monitor);
}
 
Example 8
Source File: FakeProgressService.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void busyCursorWhile(final IRunnableWithProgress runnable)
        throws InvocationTargetException, InterruptedException {
    runnable.run(new NullProgressMonitor());
}
 
Example 9
Source File: FakeProgressService.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void run(final boolean fork, final boolean cancelable, final IRunnableWithProgress runnable)
        throws InvocationTargetException, InterruptedException {
    runnable.run(new NullProgressMonitor());
}
 
Example 10
Source File: TestWizardContainer.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable)
        throws InvocationTargetException, InterruptedException {
    runnable.run(new NullProgressMonitor());
}