blob: 7366aba1b244179857c8a2b14df0fc61c35a3971 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.views.bookmarkexplorer;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.SelectionProviderAction;
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
/**
* An abstract class for all bookmark view actions.
*/
abstract class BookmarkAction extends SelectionProviderAction {
private BookmarkNavigator view;
/**
* Creates a bookmark action.
*/
protected BookmarkAction(BookmarkNavigator view, String label) {
super(view.getViewer(), label);
this.view = view;
}
/**
* Returns the bookmarks view.
*/
public BookmarkNavigator getView() {
return view;
}
/**
* Execute the specified undoable operation
*/
void execute(IUndoableOperation operation, String message,
IProgressMonitor monitor, IAdaptable uiInfo) {
try {
PlatformUI.getWorkbench().getOperationSupport()
.getOperationHistory().execute(operation, monitor, uiInfo);
} catch (ExecutionException e) {
IDEWorkbenchPlugin.log(message, e);
}
}
}