1 /*******************************************************************************
2 * Copyright (c) 2012 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.internal
.tmf
.ui
.project
.handlers
;
15 import org
.eclipse
.ui
.IActionBars
;
16 import org
.eclipse
.ui
.actions
.ActionFactory
;
17 import org
.eclipse
.ui
.navigator
.CommonActionProvider
;
18 import org
.eclipse
.ui
.navigator
.ICommonActionConstants
;
19 import org
.eclipse
.ui
.navigator
.ICommonActionExtensionSite
;
20 import org
.eclipse
.ui
.navigator
.ICommonViewerSite
;
21 import org
.eclipse
.ui
.navigator
.ICommonViewerWorkbenchSite
;
24 * Base action provider.
26 * @author Patrick Tassé
28 public class TmfActionProvider
extends CommonActionProvider
{
30 private OpenAction openAction
;
31 private DeleteAction deleteAction
;
32 private RefreshAction refreshAction
;
37 public TmfActionProvider() {
42 * @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator.ICommonActionExtensionSite)
45 public void init(ICommonActionExtensionSite aSite
) {
46 ICommonViewerSite viewSite
= aSite
.getViewSite();
47 if (viewSite
instanceof ICommonViewerWorkbenchSite
) {
48 ICommonViewerWorkbenchSite workbenchSite
= (ICommonViewerWorkbenchSite
) viewSite
;
49 openAction
= new OpenAction(workbenchSite
.getPage(), workbenchSite
.getSelectionProvider());
50 deleteAction
= new DeleteAction(workbenchSite
.getPage(), workbenchSite
.getSelectionProvider());
51 refreshAction
= new RefreshAction(workbenchSite
.getPage(), workbenchSite
.getSelectionProvider());
57 * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
60 public void fillActionBars(IActionBars actionBars
) {
61 if (openAction
.isEnabled()) {
62 actionBars
.setGlobalActionHandler(ICommonActionConstants
.OPEN
, openAction
);
64 if (deleteAction
.isEnabled()) {
65 actionBars
.setGlobalActionHandler(ActionFactory
.DELETE
.getId(), deleteAction
);
67 if (refreshAction
.isEnabled()) {
68 actionBars
.setGlobalActionHandler(ActionFactory
.REFRESH
.getId(), refreshAction
);