use of org.eclipse.core.commands.ExecutionException in project che by eclipse.
the class UndoManager2 method performRedo.
public void performRedo(IValidationCheckResultQuery query, IProgressMonitor pm) throws CoreException {
IUndoableOperation redo = fOperationHistory.getRedoOperation(RefactoringCorePlugin.getUndoContext());
UndoableOperation2ChangeAdapter changeOperation = getUnwrappedOperation(redo);
if (changeOperation == null)
throw new CoreException(new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, RefactoringCoreMessages.UndoManager2_no_change, null));
if (query == null)
query = new NullQuery();
try {
fOperationHistory.redoOperation(redo, pm, new QueryAdapter(query));
} catch (ExecutionException e) {
handleException(e);
}
}
use of org.eclipse.core.commands.ExecutionException in project che by eclipse.
the class UndoManager2 method performUndo.
public void performUndo(IValidationCheckResultQuery query, IProgressMonitor pm) throws CoreException {
IUndoableOperation undo = fOperationHistory.getUndoOperation(RefactoringCorePlugin.getUndoContext());
UndoableOperation2ChangeAdapter changeOperation = getUnwrappedOperation(undo);
if (changeOperation == null)
throw new CoreException(new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, RefactoringCoreMessages.UndoManager2_no_change, null));
if (query == null)
query = new NullQuery();
try {
fOperationHistory.undoOperation(undo, pm, new QueryAdapter(query));
} catch (ExecutionException e) {
handleException(e);
}
}
use of org.eclipse.core.commands.ExecutionException in project che by eclipse.
the class UndoableOperation2ChangeAdapter method execute.
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if (monitor == null)
monitor = new NullProgressMonitor();
try {
ExecuteResult result = executeChange(getQuery(info, RefactoringCoreMessages.Refactoring_execute_label), monitor);
if (!result.changeExecuted) {
return createStatus(result);
}
fUndoChange = result.reverseChange;
fActiveChange = fUndoChange;
fExecuteChange = null;
return Status.OK_STATUS;
} catch (CoreException e) {
throw new ExecutionException(e.getStatus().getMessage(), e);
}
}
use of org.eclipse.core.commands.ExecutionException in project gfm_viewer by satyagraha.
the class ViewManager method activateView.
/**
* Activate a view by id.
*
* @param event
* @param viewId
* @throws ExecutionException
*/
public static void activateView(ExecutionEvent event, String viewId) throws ExecutionException {
try {
IViewPart view = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().showView(viewId);
HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().activate(view);
} catch (PartInitException e) {
throw new ExecutionException("failed to show view", e);
}
}
use of org.eclipse.core.commands.ExecutionException in project gfm_viewer by satyagraha.
the class ShowMarkdownFile method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
LOGGER.fine("");
IStructuredSelection structuredSelection = (IStructuredSelection) HandlerUtil.getActiveMenuSelection(event);
Object firstElement = structuredSelection.getFirstElement();
if (firstElement instanceof IFile) {
ViewManager.activateView(event, MarkdownView.ID);
IFile iFile = (IFile) firstElement;
try {
DIManager.getDefault().getInjector(Scope.PAGE).getInstance(ViewerActions.class).showMarkdownFile(iFile);
} catch (IOException e) {
throw new ExecutionException("could not show file", e);
}
} else {
LOGGER.fine("unexpected selection: " + firstElement);
}
return null;
}
Aggregations