use of org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation in project mechanoid by robotoworks.
the class NewMechanoidElementWizard method performFinish.
@Override
public boolean performFinish() {
final IPath newFilePath = createNewResourceFilePath();
onBeforeCreateElementResource();
WorkspaceModifyDelegatingOperation op = new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
mNewResource = createElementResource(monitor, newFilePath);
} catch (Exception e) {
throw new InvocationTargetException(e);
} finally {
monitor.done();
}
}
});
try {
getContainer().run(true, true, op);
selectAndReveal(mNewResource);
openResource(mNewResource);
} catch (InvocationTargetException e) {
Throwable realException = e.getTargetException();
MessageDialog.openError(getShell(), Messages.NewMechanoidElementWizard_Dialog_CreateResourceError_Title, realException.getMessage());
return false;
} catch (InterruptedException e) {
return false;
}
return true;
}
Aggregations