本文整理汇总了Java中org.eclipse.jface.operation.IRunnableWithProgress类的典型用法代码示例。如果您正苦于以下问题:Java IRunnableWithProgress类的具体用法?Java IRunnableWithProgress怎么用?Java IRunnableWithProgress使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IRunnableWithProgress类属于org.eclipse.jface.operation包,在下文中一共展示了IRunnableWithProgress类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setVisible
import org.eclipse.jface.operation.IRunnableWithProgress; //导入依赖的package包/类
@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 );
}
}
}
示例2: performFinish
import org.eclipse.jface.operation.IRunnableWithProgress; //导入依赖的package包/类
@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;
}
}
示例3: performFinish
import org.eclipse.jface.operation.IRunnableWithProgress; //导入依赖的package包/类
@Override
public boolean performFinish() {
try {
getContainer().run(true, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
monitor.beginTask("Generating ", 1);
persist();
monitor.worked(1);
monitor.done();
}
});
} catch (Exception e) {
ResourceManager.logException(e);
}
return true;
}
示例4: performFinish
import org.eclipse.jface.operation.IRunnableWithProgress; //导入依赖的package包/类
@Override
public boolean performFinish() {
if (resourcePage.isJavaApiBasedCheckbox()) {
boolean autoBuilding = ResourcesPlugin.getWorkspace().getDescription().isAutoBuilding();
try {
ResourceManager.setAutoBuilding(false);
String modelFileName = resourcePage.getFilename().split(Pattern.quote("."))[0] + "Reduced." + Constant.GRAPH_JSON_FILE;
File outputModelFile = elementsPage.getModelOutputFile(modelFileName);
File outputjavafile = resourcePage.getOutputFile();
String executionName = executionContextPage.getClassName();
IRunnableWithProgress generator = new JavaApiBasedConverter(
outputModelFile,
outputjavafile,
resourcePage.getModelFile(),
executionName,
elementsPage.getElements());
getContainer().run(true, true, generator);
} catch (Exception e) {
DialogManager.displayErrorMessage(MessageUtil.getString("error"), MessageUtil.getString("an_error_has_occured_while_generating_test"), e);
ResourceManager.logException(e);
} finally {
ResourceManager.setAutoBuilding(autoBuilding);
}
}
return true;
}
示例5: runInUI
import org.eclipse.jface.operation.IRunnableWithProgress; //导入依赖的package包/类
@Override
public void runInUI(IRunnableContext context,
IRunnableWithProgress runnable, ISchedulingRule rule)
throws InvocationTargetException, InterruptedException {
final RunnableWithStatus runnableWithStatus = new RunnableWithStatus(
context,
runnable, rule);
uiSynchronize.syncExec(new Runnable() {
@Override
public void run() {
BusyIndicator.showWhile(getDisplay(), runnableWithStatus);
}
});
IStatus status = runnableWithStatus.getStatus();
if (!status.isOK()) {
Throwable exception = status.getException();
if (exception instanceof InvocationTargetException)
throw (InvocationTargetException) exception;
else if (exception instanceof InterruptedException)
throw (InterruptedException) exception;
else // should be OperationCanceledException
throw new InterruptedException(exception.getMessage());
}
}
示例6: execute
import org.eclipse.jface.operation.IRunnableWithProgress; //导入依赖的package包/类
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
run(new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
ISVNRemoteResource[] resources = getSelectedRemoteResources();
if (resources.length == 0)
resources = getSelectedRemoteFolders();
try {
if (resources.length > 0) {
getTargetPage().openEditor(
new RevisionGraphEditorInput(resources[0]),
"org.tigris.subversion.subclipse.graph.editors.revisionGraphEditor");
}
} catch (Exception e) {
Activator.handleError(e);
Activator.showErrorDialog(getErrorTitle(), e);
}
}
}, false /* cancelable */, PROGRESS_BUSYCURSOR);
}
示例7: refreshViewer
import org.eclipse.jface.operation.IRunnableWithProgress; //导入依赖的package包/类
/**
* this is called whenever a new repository location is added for example
* or when user wants to refresh
*/
protected void refreshViewer(Object object, boolean refreshRepositoriesFolders) {
if (treeViewer == null) return;
if (refreshRepositoriesFolders) {
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
SVNProviderPlugin.getPlugin().getRepositories().refreshRepositoriesFolders(monitor);
}
};
try {
new ProgressMonitorDialog(getShell()).run(true, false, runnable);
} catch (Exception e) {
SVNUIPlugin.openError(getShell(), null, null, e, SVNUIPlugin.LOG_TEAM_EXCEPTIONS);
}
}
if (object == null) treeViewer.refresh();
else {
if (object instanceof ISVNRemoteFolder) {
ISVNRemoteFolder parent = ((ISVNRemoteFolder)object).getParent();
if (parent == null) {
treeViewer.refresh();
return;
}
}
treeViewer.refresh(object);
}
}
示例8: execute
import org.eclipse.jface.operation.IRunnableWithProgress; //导入依赖的package包/类
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);
}
}
示例9: execute
import org.eclipse.jface.operation.IRunnableWithProgress; //导入依赖的package包/类
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$
}
示例10: execute
import org.eclipse.jface.operation.IRunnableWithProgress; //导入依赖的package包/类
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);
}
示例11: testInitializeForm_noExceptionForNonAccessibleProject
import org.eclipse.jface.operation.IRunnableWithProgress; //导入依赖的package包/类
@Test
public void testInitializeForm_noExceptionForNonAccessibleProject()
throws CoreException, InvocationTargetException, InterruptedException {
IWorkspaceRoot workspaceRoot = mock(IWorkspaceRoot.class);
when(workspaceRoot.getProject(anyString())).thenReturn(mock(IProject.class));
ILaunchConfigurationDialog dialog = mock(ILaunchConfigurationDialog.class);
doAnswer(new SynchronousIRunnableContextExecutor())
.when(dialog).run(anyBoolean(), anyBoolean(), any(IRunnableWithProgress.class));
ILaunchConfiguration configuration = mock(ILaunchConfiguration.class);
when(configuration.getAttribute(
eq(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME), anyString()))
.thenReturn("my-project");
when(configuration.getAttribute(
eq(PipelineConfigurationAttr.RUNNER_ARGUMENT.toString()), anyString()))
.thenReturn("DirectPipelineRunner");
PipelineArgumentsTab tab = new PipelineArgumentsTab(workspaceRoot);
tab.setLaunchConfigurationDialog(dialog);
tab.createControl(shellResource.getShell());
tab.initializeFrom(configuration); // Should not throw NPE.
ProjectUtils.waitForProjects(); // Suppress some non-terminated-job error logs
}
示例12: performFinish
import org.eclipse.jface.operation.IRunnableWithProgress; //导入依赖的package包/类
@Override
public boolean performFinish() {
getWizardPageConfig();
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
generateExtension(monitor, extension.getName(), saveLocation);
} catch (CoreException ce) {
throw new InvocationTargetException(ce);
} finally {
monitor.done();
}
}
};
try {
getContainer().run(true, false, runnable);
} catch (InterruptedException ie) {
return false;
} catch (InvocationTargetException ite) {
Throwable realException = ite.getTargetException();
MessageDialog.openError(getShell(), "Error", realException.getMessage());
return false;
}
return true;
}
示例13: getRunnerInternal
import org.eclipse.jface.operation.IRunnableWithProgress; //导入依赖的package包/类
/**
* 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;
}
示例14: execute
import org.eclipse.jface.operation.IRunnableWithProgress; //导入依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException
{
Shell activeShell = HandlerUtil.getActiveShell(event);
IRunnableWithProgress runner = ProjectSourceUtil.getRunner();
try
{
new ProgressMonitorDialog( activeShell ).run( true, false, runner );
}
catch( InvocationTargetException | InterruptedException e )
{
Throwable t = (e instanceof InvocationTargetException) ? e.getCause() : e;
MessageDialog.openError( activeShell, "Error detaching sources", t.toString() );
}
return null;
}
示例15: attachSources
import org.eclipse.jface.operation.IRunnableWithProgress; //导入依赖的package包/类
/**
* Attaches the sources.
*/
private void attachSources()
{
final File sourceArchive = page2.getSourceFile();
if (sourceArchive == null)
{
return; //nothing to do
}
IRunnableWithProgress runner = ProjectSourceUtil.getRunner(sourceArchive);
try
{
new ProgressMonitorDialog( getContainer().getShell() ).run( true, false, runner );
}
catch( InvocationTargetException | InterruptedException e )
{
Throwable t = (e instanceof InvocationTargetException) ? e.getCause() : e;
MessageDialog.openError( getShell(), "Error attaching sources", t.toString() );
}
}