1
/*******************************************************************************
2
* Copyright (c) 2000, 2006 IBM Corporation and others.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* IBM Corporation - initial API and implementation
10
*******************************************************************************/
11
package org.eclipse.cdt.internal.ui.cview;
13
import org.eclipse.cdt.ui.CUIPlugin;
14
import org.eclipse.jface.viewers.Viewer;
15
import org.eclipse.swt.widgets.Shell;
16
import org.eclipse.ui.IWorkbench;
17
import org.eclipse.ui.IWorkbenchWindow;
18
import org.eclipse.ui.actions.SelectionProviderAction;
21
* Superclass of all actions provided by the cview.
23
public abstract class CViewAction extends SelectionProviderAction {
28
* Creates a new instance of the class.
30
public CViewAction(CView cview, String label) {
31
super(cview.getViewer(), label);
36
* Returns the cview for which this action was created.
38
public CView getCView() {
45
protected Viewer getViewer() {
46
return getCView().getViewer();
50
* Returns the shell to use within actions.
52
protected Shell getShell() {
53
return getCView().getSite().getShell();
57
* Returns the workbench.
59
protected IWorkbench getWorkbench() {
60
return CUIPlugin.getDefault().getWorkbench();
64
* Returns the workbench window.
66
protected IWorkbenchWindow getWorkbenchWindow() {
67
return getCView().getSite().getWorkbenchWindow();