use of org.eclipse.core.commands.ExecutionException in project bndtools by bndtools.
the class OpenMainConfigHandler method execute.
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
IFile buildFile = Central.getWorkspaceBuildFile();
if (buildFile == null)
return null;
FileEditorInput input = new FileEditorInput(buildFile);
IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindowChecked(event).getActivePage();
page.openEditor(input, "bndtools.bndWorkspaceConfigEditor", true);
} catch (PartInitException e) {
ErrorDialog.openError(HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell(), "Error", "Unable to open editor", e.getStatus());
} catch (Exception e) {
logger.logError("Error retrieving bnd configuration file", e);
}
return null;
}
use of org.eclipse.core.commands.ExecutionException in project bndtools by bndtools.
the class ReleaseWorkspaceHandler method execute.
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
if (ReleaseHelper.getReleaseRepositories().length == 0) {
Activator.message(Messages.noReleaseRepos);
return null;
}
if (!PlatformUI.getWorkbench().saveAllEditors(true)) {
return null;
}
WorkspaceAnalyserJob job = new WorkspaceAnalyserJob(null);
job.setRule(ResourcesPlugin.getWorkspace().getRoot());
job.schedule();
} catch (Exception e) {
throw new ExecutionException(e.getMessage(), e);
}
return null;
}
use of org.eclipse.core.commands.ExecutionException in project che by eclipse.
the class UndoableOperation2ChangeAdapter method undo.
public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if (monitor == null)
monitor = new NullProgressMonitor();
try {
ExecuteResult result = executeChange(getQuery(info, RefactoringCoreMessages.Refactoring_undo_label), monitor);
if (!result.changeExecuted) {
fUndoChange = null;
fRedoChange = null;
clearActiveChange();
return createStatus(result);
}
fRedoChange = result.reverseChange;
fActiveChange = fRedoChange;
fUndoChange = null;
return Status.OK_STATUS;
} catch (CoreException e) {
throw new ExecutionException(e.getStatus().getMessage(), e);
}
}
use of org.eclipse.core.commands.ExecutionException in project che by eclipse.
the class UndoableOperation2ChangeAdapter method computeUndoableStatus.
public IStatus computeUndoableStatus(IProgressMonitor monitor) throws ExecutionException {
if (fUndoChange == null)
return new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, RefactoringCoreMessages.UndoableOperation2ChangeAdapter_no_undo_available, null);
try {
if (monitor == null)
monitor = new NullProgressMonitor();
RefactoringStatus status = fUndoChange.isValid(monitor);
if (status.hasFatalError()) {
// The operation can no longer be undo.
fUndoChange = null;
clearActiveChange();
return asStatus(status);
} else {
// own dialog again inside the runnable.
return Status.OK_STATUS;
}
} catch (CoreException e) {
throw new ExecutionException(e.getStatus().getMessage(), e);
}
}
use of org.eclipse.core.commands.ExecutionException in project che by eclipse.
the class UndoableOperation2ChangeAdapter method redo.
public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if (monitor == null)
monitor = new NullProgressMonitor();
try {
ExecuteResult result = executeChange(getQuery(info, RefactoringCoreMessages.Refactoring_redo_label), monitor);
if (!result.changeExecuted) {
fUndoChange = null;
fRedoChange = null;
clearActiveChange();
return createStatus(result);
}
fUndoChange = result.reverseChange;
fActiveChange = fUndoChange;
fRedoChange = null;
return Status.OK_STATUS;
} catch (CoreException e) {
throw new ExecutionException(e.getStatus().getMessage(), e);
}
}
Aggregations