1 11 12 package org.eclipse.ui.views.bookmarkexplorer; 13 14 import org.eclipse.core.commands.ExecutionException; 15 import org.eclipse.core.commands.operations.IUndoableOperation; 16 import org.eclipse.core.runtime.CoreException; 17 import org.eclipse.core.runtime.IAdaptable; 18 import org.eclipse.core.runtime.IProgressMonitor; 19 import org.eclipse.jface.dialogs.ErrorDialog; 20 import org.eclipse.ui.PlatformUI; 21 import org.eclipse.ui.actions.SelectionProviderAction; 22 import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; 23 24 27 abstract class BookmarkAction extends SelectionProviderAction { 28 private BookmarkNavigator view; 29 30 33 protected BookmarkAction(BookmarkNavigator view, String label) { 34 super(view.getViewer(), label); 35 this.view = view; 36 } 37 38 41 public BookmarkNavigator getView() { 42 return view; 43 } 44 45 48 void execute(IUndoableOperation operation, String title, 49 IProgressMonitor monitor, IAdaptable uiInfo) { 50 try { 51 PlatformUI.getWorkbench().getOperationSupport() 52 .getOperationHistory().execute(operation, monitor, uiInfo); 53 } catch (ExecutionException e) { 54 if (e.getCause() instanceof CoreException) { 55 ErrorDialog.openError(view.getShell(), title, 56 null, ((CoreException)e.getCause()).getStatus()); 57 } else { 58 IDEWorkbenchPlugin.log(title, e); 59 } 60 } 61 } 62 63 } 64 | Popular Tags |