Search in sources :

Example 1 with ExecutionException

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);
    }
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) RefactoringStatus(org.eclipse.ltk.core.refactoring.RefactoringStatus) CoreException(org.eclipse.core.runtime.CoreException) IUndoableOperation(org.eclipse.core.commands.operations.IUndoableOperation) ExecutionException(org.eclipse.core.commands.ExecutionException)

Example 2 with ExecutionException

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);
    }
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) RefactoringStatus(org.eclipse.ltk.core.refactoring.RefactoringStatus) CoreException(org.eclipse.core.runtime.CoreException) IUndoableOperation(org.eclipse.core.commands.operations.IUndoableOperation) ExecutionException(org.eclipse.core.commands.ExecutionException)

Example 3 with ExecutionException

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);
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) CoreException(org.eclipse.core.runtime.CoreException) ExecutionException(org.eclipse.core.commands.ExecutionException)

Example 4 with ExecutionException

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);
    }
}
Also used : IViewPart(org.eclipse.ui.IViewPart) PartInitException(org.eclipse.ui.PartInitException) ExecutionException(org.eclipse.core.commands.ExecutionException)

Example 5 with ExecutionException

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;
}
Also used : IFile(org.eclipse.core.resources.IFile) ViewerActions(code.satyagraha.gfm.viewer.model.api.ViewerActions) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IOException(java.io.IOException) ExecutionException(org.eclipse.core.commands.ExecutionException)

Aggregations

ExecutionException (org.eclipse.core.commands.ExecutionException)47 CoreException (org.eclipse.core.runtime.CoreException)18 IFile (org.eclipse.core.resources.IFile)13 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)12 ArrayList (java.util.ArrayList)11 IEditorPart (org.eclipse.ui.IEditorPart)11 IStatus (org.eclipse.core.runtime.IStatus)9 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)9 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)9 InvocationTargetException (java.lang.reflect.InvocationTargetException)8 XLFHandler (net.heartsome.cat.ts.core.file.XLFHandler)8 IProject (org.eclipse.core.resources.IProject)8 Status (org.eclipse.core.runtime.Status)8 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)8 List (java.util.List)7 XLIFFEditorImplWithNatTable (net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable)7 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)7 ISelection (org.eclipse.jface.viewers.ISelection)7 FileEditorInput (org.eclipse.ui.part.FileEditorInput)7 PartInitException (org.eclipse.ui.PartInitException)5