Java Code Examples for org.eclipse.jface.operation.IRunnableWithProgress

The following examples show how to use org.eclipse.jface.operation.IRunnableWithProgress. These examples are extracted from open source projects. 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 Project: bonita-studio   Source File: ValidateAction.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
* @generated
*/
public void run() {
	IWorkbenchPart workbenchPart = page.getActivePart();
	if (workbenchPart instanceof IDiagramWorkbenchPart) {
		final IDiagramWorkbenchPart part = (IDiagramWorkbenchPart) workbenchPart;
		try {
			new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {

				public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
					runValidation(part.getDiagramEditPart(), part.getDiagram());
				}
			}).run(new NullProgressMonitor());
		} catch (Exception e) {
			ProcessDiagramEditorPlugin.getInstance().logError("Validation action failed", e); //$NON-NLS-1$
		}
	}
}
 
Example 2
Source Project: neoscada   Source File: PreviewPage.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void setVisible ( final boolean visible )
{
    super.setVisible ( visible );
    if ( visible )
    {
        try
        {
            getContainer ().run ( false, false, new IRunnableWithProgress () {

                @Override
                public void run ( final IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException
                {
                    setMergeResult ( PreviewPage.this.mergeController.merge ( wrap ( monitor ) ) );
                }
            } );
        }
        catch ( final Exception e )
        {
            final Status status = new Status ( IStatus.ERROR, Activator.PLUGIN_ID, Messages.PreviewPage_StatusErrorFailedToMerge, e );
            StatusManager.getManager ().handle ( status );
            ErrorDialog.openError ( getShell (), Messages.PreviewPage_TitleErrorFailedToMerge, Messages.PreviewPage_MessageErrorFailedToMerge, status );
        }
    }
}
 
Example 3
Source Project: neoscada   Source File: ExportEventsWizard.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
public boolean performFinish ()
{
    try
    {
        getContainer ().run ( true, true, new IRunnableWithProgress () {

            public void run ( final IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException
            {
                doExport ( monitor );
            }
        } );
        return true;
    }
    catch ( final Exception e )
    {
        StatusManager.getManager ().handle ( new Status ( IStatus.ERROR, Activator.PLUGIN_ID, Messages.ExportWizard_ErrorMessage, e ) );
        return false;
    }
}
 
Example 4
Source Project: scava   Source File: ValidateAction.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
* @generated
*/
public void run() {
	IWorkbenchPart workbenchPart = page.getActivePart();
	if (workbenchPart instanceof IDiagramWorkbenchPart) {
		final IDiagramWorkbenchPart part = (IDiagramWorkbenchPart) workbenchPart;
		try {
			new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {

				public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
					runValidation(part.getDiagramEditPart(), part.getDiagram());
				}
			}).run(new NullProgressMonitor());
		} catch (Exception e) {
			CrossflowDiagramEditorPlugin.getInstance().logError("Validation action failed", e); //$NON-NLS-1$
		}
	}
}
 
Example 5
Source Project: bonita-studio   Source File: ExportWizard.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean performFinish() {
	try {
		getContainer().run(true, false, new IRunnableWithProgress() {
			
			@Override
			public void run(IProgressMonitor monitor) throws InvocationTargetException,
					InterruptedException {
				monitor.beginTask(Messages.exporting, IProgressMonitor.UNKNOWN) ;
				Display.getDefault().asyncExec(new Runnable() {
					
					@Override
					public void run() {
						IAction action = page.getAction() ;
						action.run() ;	
					}
				}) ;
			}
		});
	} catch (Exception e){
		BonitaStudioLog.error(e) ;
	}
	
	
	return true;
}
 
Example 6
public void setProcess(final AbstractProcess process) {
    this.process = process;
    final Configuration configuration = getConfigurationFromProcess(process, configurationName);
    if (configuration != null) {
        final IProgressService service = PlatformUI.getWorkbench().getProgressService();
        try {
            service.run(true, false, new IRunnableWithProgress() {

                @Override
                public void run(final IProgressMonitor monitor) throws InvocationTargetException,
                        InterruptedException {
                    new ConfigurationSynchronizer(process, configuration).synchronize(monitor);
                }
            });
        } catch (final InvocationTargetException | InterruptedException e) {
            BonitaStudioLog.error(e);
        }
        configurationWorkingCopy = emfModelUpdater.from(configuration).getWorkingCopy();
    }
}
 
Example 7
/**
 * Return an attachment or detachment runner.
 * 
 * @param sourceArchive
 * @param isAttach
 * @return runner
 */
private static IRunnableWithProgress getRunnerInternal( final File sourceArchive, final boolean isAttach )
{
	IRunnableWithProgress runner = new IRunnableWithProgress()
	{
		@Override
		public void run( IProgressMonitor monitor ) throws InvocationTargetException
		{
			List<IProject> projects = Arrays.asList( ResourcesPlugin.getWorkspace().getRoot().getProjects() );
			int progress = 0;
			for( IProject project: projects )
			{
				if( FixProjectsUtils.isAHybrisExtension( project ) )
				{
					processProject( monitor, isAttach, project, sourceArchive );
				}
				progress++;
				monitor.worked( progress );
			}
		}
	};
	
	return runner;
}
 
Example 8
@Test
public void should_open_an_error_dialog_if_remove_operation_failed() throws Exception {
    final IProgressService mockProgressService = mock(IProgressService.class);
    contractInputController = spy(new ContractInputController(mockProgressService));
    doReturn(new TransactionalEditingDomainImpl(new ProcessItemProviderAdapterFactory())).when(contractInputController).editingDomain(any(Contract.class));

    final Contract contract = aContract().havingInput(aContractInput()).in(aTask()).build();
    observableValue.setValue(contract);
    when(viewer.getSelection()).thenReturn(new StructuredSelection(contract.getInputs()));
    final InvocationTargetException error = new InvocationTargetException(new Throwable());
    doThrow(error).when(mockProgressService).run(anyBoolean(), anyBoolean(), any(IRunnableWithProgress.class));

    contractInputController.remove(viewer);

    verify(contractInputController).openErrorDialog(error);
}
 
Example 9
Source Project: statecharts   Source File: ExampleWizard.java    License: Eclipse Public License 1.0 6 votes vote down vote up
public boolean performFinish() {
	final List<ExampleData> selection = page.getSelection();
	if (selection != null) {
		try {
			getContainer().run(true, true, new IRunnableWithProgress() {
				@Override
				public void run(IProgressMonitor monitor) throws InvocationTargetException {
					for (ExampleData exampleData : selection) {
						if (overrideIfExists(exampleData)) {
							IProject project = importer.importExample(exampleData, monitor);
							opener.openModelFiles(project);
						}
					}
				}
			});
		} catch (InvocationTargetException | InterruptedException e) {
			e.printStackTrace();
		}
	}
	return true;
}
 
Example 10
Source Project: olca-app   Source File: CheckoutAction.java    License: Mozilla Public License 2.0 6 votes vote down vote up
private void doCheckout(Commit commit) throws Exception {
	ProgressMonitorDialog dialog = new ProgressMonitorDialog(UI.shell());
	dialog.run(true, false, new IRunnableWithProgress() {

		@Override
		public void run(IProgressMonitor m) throws InvocationTargetException, InterruptedException {
			try {
				FetchNotifierMonitor monitor = new FetchNotifierMonitor(m, M.CheckingOutCommit);
				RepositoryClient client = Database.getRepositoryClient();
				client.checkout(commit.id, monitor);
			} catch (WebRequestException e) {
				throw new InvocationTargetException(e, e.getMessage());
			}
		}
	});
}
 
Example 11
Source Project: gama   Source File: RefreshAction.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
final protected IRunnableWithProgress createOperation(final IStatus[] errorStatus) {
	return new WorkspaceModifyOperation() {
		@Override
		public void execute(final IProgressMonitor monitor) {
			final Iterator<? extends IResource> resourcesEnum = resources.iterator();
			try {
				while (resourcesEnum.hasNext()) {
					try {
						final IResource resource = resourcesEnum.next();
						refreshResource(resource, null);
					} catch (final CoreException e) {}
					if (monitor.isCanceled()) { throw new OperationCanceledException(); }
				}
			} finally {
				monitor.done();
			}
		}
	};
}
 
Example 12
public void execute(IAction action) throws InterruptedException, InvocationTargetException {
       if (action != null && !action.isEnabled()) { 
       	action.setEnabled(true);
       } 
       else {
		run(new IRunnableWithProgress() {
			public void run(IProgressMonitor monitor) {
				IResource[] resources = getSelectedResources();
				if (resources.length != 1) return;
				IHistoryView view = (IHistoryView) showView(ISVNUIConstants.HISTORY_VIEW_ID);
				if (view != null) {
					view.showHistoryFor(resources[0]);
				}
			}
		}, false /* cancelable */, PROGRESS_BUSYCURSOR);
       }
}
 
Example 13
protected void execute(IAction action)
	throws InvocationTargetException, InterruptedException {
       RepositoryManager manager = SVNUIPlugin.getPlugin().getRepositoryManager();
       final String message = manager.promptForComment(getShell(), new IResource[]{});
       
       if (message == null)
           return; // cancel
       
       run(new IRunnableWithProgress() {
           public void run(IProgressMonitor monitor) throws InvocationTargetException {
               try {
                   SVNProviderPlugin.getPlugin().getRepositoryResourcesManager().
                       deleteRemoteResources(        
                           getSelectedRemoteResources(),message,monitor);
               } catch (TeamException e) {
                   throw new InvocationTargetException(e);
               }
           }
       }, true /* cancelable */, PROGRESS_BUSYCURSOR); //$NON-NLS-1$        

}
 
Example 14
protected void execute(IAction action)
	throws InvocationTargetException, InterruptedException {
		run(new IRunnableWithProgress() {
			public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
				ISVNProperty svnProperty = getSelectedSvnProperties()[0];
				ISVNLocalResource svnResource = getSVNLocalResource(svnProperty);
				SvnWizardSetPropertyPage setPropertyPage = new SvnWizardSetPropertyPage(svnResource, svnProperty);
				SvnWizard wizard = new SvnWizard(setPropertyPage);
			    SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
			    wizard.setParentDialog(dialog); 					
				if (dialog.open() != SvnWizardDialog.OK) return;
		
				try {
					if (setPropertyPage.getPropertyValue() != null) {
						svnResource.setSvnProperty(setPropertyPage.getPropertyName(), setPropertyPage.getPropertyValue(),setPropertyPage.getRecurse());
					} else {
						svnResource.setSvnProperty(setPropertyPage.getPropertyName(), setPropertyPage.getPropertyFile(),setPropertyPage.getRecurse());
					}
					SvnPropertiesView.refreshView();
				} catch (SVNException e) {
					throw new InvocationTargetException(e);
				}
			} 
		}, false /* cancelable */, PROGRESS_BUSYCURSOR);
}
 
Example 15
protected IRunnableWithProgress buildContractOperationFromData(BusinessObjectData data,
        RootContractInputGenerator contractInputGenerator) {
    return monitor -> {
        try {
            if (contractContainer instanceof Pool) {
                contractInputGenerator.buildForInstanciation(data, monitor);
            } else {
                contractInputGenerator.build(data, generationOptions.getEditMode(), monitor);
            }
            monitor.beginTask("Generating contract constraints...", IProgressMonitor.UNKNOWN);
            List<ContractConstraint> constraints = contractConstraintBuilder.buildConstraints(
                    contractInputGenerator.getRootContractInput(), ModelHelper.getParentPool(contractContainer));
            editingDomain.getCommandStack().execute(createCommand(contractInputGenerator, data, constraints));
        } catch (final OperationCreationException e) {
            throw new InvocationTargetException(e);
        }
    };
}
 
Example 16
Source Project: olca-app   Source File: ExcelExportWizard.java    License: Mozilla Public License 2.0 6 votes vote down vote up
private void run(final ExcelExport export) {
	try {
		getContainer().run(true, false, new IRunnableWithProgress() {
			@Override
			public void run(IProgressMonitor monitor)
					throws InvocationTargetException, InterruptedException {
				monitor.beginTask(M.Export,
						IProgressMonitor.UNKNOWN);
				export.run();
				monitor.done();
			}
		});
	} catch (Exception e) {
		log.error("Export failed", e);
	}
}
 
Example 17
protected void checkImplementationDependencies(final ConnectorImplementation implementation) {
    if(!implementation.getJarDependencies().getJarDependency().isEmpty()){
        try {
            final IProgressService service =  PlatformUI.getWorkbench().getProgressService() ;
            service.run(true, false, new IRunnableWithProgress() {

                @Override
                public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                    monitor.beginTask(Messages.addingImplementationDependencies, IProgressMonitor.UNKNOWN) ;
                    final DependencyRepositoryStore depStore = RepositoryManager.getInstance().getRepositoryStore(DependencyRepositoryStore.class) ;
                    for(final String jarName : implementation.getJarDependencies().getJarDependency()){
                        if( depStore.getChild(jarName, true) == null){
                            final InputStream is = getResourceProvider().getDependencyInputStream(jarName) ;
                            if(is != null){
                                depStore.importInputStream(jarName, is) ;
                            }
                        }
                    }
                }
            }) ;
        } catch (final Exception e){
            BonitaStudioLog.error(e) ;
        }
    }
}
 
Example 18
private static IRunnableWithProgress getRunnable(final Shell shell, final IJavaElement elem, final String nativeLibraryPath, final IClasspathEntry entry, final IPath containerPath, final boolean isReferencedEntry) {
	return new IRunnableWithProgress() {
		public void run(IProgressMonitor monitor) throws InvocationTargetException {
			try {
				IJavaProject project= elem.getJavaProject();
				if (elem instanceof IPackageFragmentRoot) {
					CPListElement cpElem= CPListElement.createFromExisting(entry, project);
					cpElem.setAttribute(CPListElement.NATIVE_LIB_PATH, nativeLibraryPath);
					IClasspathEntry newEntry= cpElem.getClasspathEntry();
					String[] changedAttributes= { CPListElement.NATIVE_LIB_PATH };
					BuildPathSupport.modifyClasspathEntry(shell, newEntry, changedAttributes, project, containerPath, isReferencedEntry,  monitor);
				}
			} catch (CoreException e) {
				throw new InvocationTargetException(e);
			}
		}
	};
}
 
Example 19
/**
 * Test code below
 */
public static void main(String[] arg) {
    Shell shl = new Shell();
    ProgressMonitorDialog dlg = new AsynchronousProgressMonitorDialog(shl);

    long l = System.currentTimeMillis();
    try {
        dlg.run(true, true, new IRunnableWithProgress() {

            @Override
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                monitor.beginTask("Testing", 100000);
                for (long i = 0; i < 100000 && !monitor.isCanceled(); i++) {
                    //monitor.worked(1);
                    monitor.setTaskName("Task " + i);
                }
            }
        });
    } catch (Exception e) {
        Log.log(e);
    }
    System.out.println("Took " + ((System.currentTimeMillis() - l)));
}
 
Example 20
/**
 * Searches for all main methods in the given scope.
 * Valid styles are IJavaElementSearchConstants.CONSIDER_BINARIES and
 * IJavaElementSearchConstants.CONSIDER_EXTERNAL_JARS
 * @param context runnable context
 * @param scope the search scope
 * @param style style search style constants (see {@link IJavaElementSearchConstants})
 * @return the types found
 * @throws InvocationTargetException
 * @throws InterruptedException
 */
public IType[] searchMainMethods(IRunnableContext context, final IJavaSearchScope scope, final int style) throws InvocationTargetException, InterruptedException  {
	int allFlags=  IJavaElementSearchConstants.CONSIDER_EXTERNAL_JARS | IJavaElementSearchConstants.CONSIDER_BINARIES;
	Assert.isTrue((style | allFlags) == allFlags);

	final IType[][] res= new IType[1][];

	IRunnableWithProgress runnable= new IRunnableWithProgress() {
		public void run(IProgressMonitor pm) throws InvocationTargetException {
			try {
				res[0]= searchMainMethods(pm, scope, style);
			} catch (CoreException e) {
				throw new InvocationTargetException(e);
			}
		}
	};
	context.run(true, true, runnable);

	return res[0];
}
 
Example 21
Source Project: tesb-studio-se   Source File: BundleJavaProcessor.java    License: 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 22
Source Project: tesb-studio-se   Source File: OSGIJavaProcessor.java    License: 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 23
Source Project: tesb-studio-se   Source File: RunContainerProcessor.java    License: 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 24
@Override
protected void okPressed() {
	styledText.setText("");
	final String tmxFilePath = txtTmxFilePath.getText();
	try {
		run(isFork(), canCancel(), new IRunnableWithProgress() {
			@Override
			public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
				TmxValidator validator = new TmxValidator(monitor);
				validator.setReport(true);
				validator.setNormalize(true);
				validator.setDebug(true);
				validator.setStyledText(styledText);
				validator.validate(tmxFilePath);
			}
		});
	} catch (Exception e) {
		LOGGER.error("", e);
		OpenMessageUtils.openMessage(IStatus.ERROR, e.getMessage());
	}
}
 
Example 25
Source Project: tmxeditor8   Source File: TmxEditor.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void doFilter(final TmxEditorFilterBean filter) {
	TeActiveCellEditor.commit();
	final String srcSearchStr = getSearchText(srcSearchText);
	final String tgtSearchStr = getSearchText(tgtSearchText);
	IRunnableWithProgress progress = new IRunnableWithProgress() {
		@Override
		public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
			tmxDataAccess.loadDisplayTuIdentifierByFilter(monitor, filter, srcLangCode, tgtLangCode, srcSearchStr,
					tgtSearchStr);
		}
	};
	try {
		new ProgressMonitorDialog(Display.getDefault().getActiveShell()).run(true, true, progress);
	} catch (Exception e) {
		e.printStackTrace();
	}
	tmxEditorImpWithNattable.setSrcSearchStr(srcSearchStr);
	tmxEditorImpWithNattable.setTgtSearchStr(tgtSearchStr);
	tmxEditorImpWithNattable.getTable().setFocus();
	tmxEditorImpWithNattable.refrush();
	tmxEditorImpWithNattable.selectCell(getTgtColumnIndex(), 0);
}
 
Example 26
@Override
public void run(IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
	progressMon.setVisible(true);
	try {
		ModalContext.run(runnable, true, progressMon, getShell().getDisplay());
	} finally {
		progressMon.done();
		progressMon.setVisible(false);
	}
}
 
Example 27
@Override
public void run(IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
	progressMon.setVisible(true);
	try {
		ModalContext.run(runnable, true, progressMon, getShell().getDisplay());
	} finally {
		progressMon.done();
		progressMon.setVisible(false);
	}
}
 
Example 28
Source Project: n4js   Source File: N4JSOrganizeImportsHandler.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/** Creates {@link IRunnableWithProgress} that will be organize imports in the provided files. */
private IRunnableWithProgress createOrganizingRunnable(List<IFile> collectedFiles) {
	IRunnableWithProgress op = new IRunnableWithProgress() {
		@Override
		public void run(IProgressMonitor mon) throws InvocationTargetException, InterruptedException {
			int totalWork = collectedFiles.size();
			SubMonitor subMon = SubMonitor.convert(mon, "Organize imports.", totalWork);
			for (int i = 0; !subMon.isCanceled() && i < totalWork; i++) {
				IFile currentFile = collectedFiles.get(i);
				subMon.setTaskName("Organize imports." + " - File (" + (i + 1) + " of " + totalWork + ")");
				try {
					OrganizeImportsService.organizeImportsInFile(currentFile, Interaction.breakBuild, subMon);

				} catch (CoreException | RuntimeException e) {
					String msg = "Exception in file " + currentFile.getFullPath().toString() + ".";
					LOGGER.error(msg, e);
					boolean errorDialogShowed = ErrorDialogWithStackTraceUtil.showErrorDialogWithStackTrace(
							msg + " Hit OK to continue.", e);
					if (!errorDialogShowed) {
						throw new InvocationTargetException(e);
					}
				}
			}
			if (subMon.isCanceled()) {
				throw new InterruptedException();
			}
		}

	};
	return op;
}
 
Example 29
Source Project: n4js   Source File: ProjectCompareTree.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new default comparison of all API / implementation projects in the default workspace (i.e. the one
 * accessed via {@link IN4JSCore}) and shows this comparison in the widget.
 */
public void setComparison() {
	final ProgressMonitorDialog dlg = new ProgressMonitorDialog(getTree().getShell());
	try {
		dlg.run(false, false, new IRunnableWithProgress() {
			@Override
			public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
				setComparison(monitor);
			}
		});
	} catch (InvocationTargetException | InterruptedException e) {
		// ignore
	}
}
 
Example 30
@Before
public void setUp() throws CoreException, InvocationTargetException, InterruptedException {
  workspaceRoot = mock(IWorkspaceRoot.class);
  dependencyManager = mock(DataflowDependencyManager.class);

  project1 = mockProject("project1");
  javaProject1 = mock(IJavaProject.class);
  when(workspaceRoot.getProject("project1")).thenReturn(project1);
  when(project1.getAdapter(IJavaElement.class)).thenReturn(javaProject1);
  when(javaProject1.getJavaProject()).thenReturn(javaProject1);

  configuration1 = mockLaunchConfiguration();
  when(configuration1.getAttribute(eq(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME),
      anyString())).thenReturn("project1");
  doReturn(MajorVersion.ONE).when(dependencyManager).getProjectMajorVersion(project1);

  project2 = mockProject("project2");
  javaProject2 = mock(IJavaProject.class);
  when(project2.getAdapter(IJavaElement.class)).thenReturn(javaProject2);
  when(javaProject2.getJavaProject()).thenReturn(javaProject2);

  when(workspaceRoot.getProject("project2")).thenReturn(project2);
  configuration2 = mockLaunchConfiguration();
  when(configuration2.getAttribute(eq(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME),
      anyString())).thenReturn("project2");
  doReturn(MajorVersion.TWO).when(dependencyManager).getProjectMajorVersion(project2);

  ILaunchConfigurationDialog dialog = mock(ILaunchConfigurationDialog.class);
  doAnswer(new SynchronousIRunnableContextExecutor()).when(dialog).run(anyBoolean(),
      anyBoolean(), any(IRunnableWithProgress.class));

  pipelineArgumentsTab = new PipelineArgumentsTab(workspaceRoot, dependencyManager);
  pipelineArgumentsTab.setLaunchConfigurationDialog(dialog);
  pipelineArgumentsTab.createControl(shellResource.getShell());
}