| /*******************************************************************************
|
| * Copyright (c) 2010, 2019 Mia-Software and others.
|
| * All rights reserved. This program and the accompanying materials
|
| * are made available under the terms of the Eclipse Public License v2.0
|
| * which accompanies this distribution, and is available at
|
| * http://www.eclipse.org/legal/epl-v20.html
|
| *
|
| * Contributors:
|
| * Nicolas Bros (Mia-Software) - initial API and implementation
|
| *******************************************************************************/ |
| package org.eclipse.modisco.infra.browser.uicore.examples.cnf.actions;
|
|
|
| import org.eclipse.jface.action.IMenuManager;
|
| import org.eclipse.ui.IActionBars;
|
| import org.eclipse.ui.navigator.CommonActionProvider;
|
| import org.eclipse.ui.navigator.ICommonActionConstants;
|
| import org.eclipse.ui.navigator.ICommonActionExtensionSite;
|
| import org.eclipse.ui.navigator.ICommonMenuConstants;
|
| import org.eclipse.ui.navigator.ICommonViewerSite;
|
| import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
|
|
|
| /**
|
| * @deprecated Will be replaced by EMF Facet,
|
| * cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=470715
|
| */
|
| @Deprecated
|
| public class OpenProvider extends CommonActionProvider {
|
|
|
| private OpenAction openAction;
|
|
|
| public OpenProvider() {
|
| // nothing
|
| }
|
|
|
| @Override
|
| public void init(final ICommonActionExtensionSite aSite) {
|
| ICommonViewerSite viewSite = aSite.getViewSite();
|
| if (viewSite instanceof ICommonViewerWorkbenchSite) {
|
| ICommonViewerWorkbenchSite workbenchSite = (ICommonViewerWorkbenchSite) viewSite;
|
| this.openAction = new OpenAction(workbenchSite.getPage(), workbenchSite
|
| .getSelectionProvider());
|
|
|
| }
|
| }
|
|
|
| @Override
|
| public void fillActionBars(final IActionBars actionBars) {
|
| if (this.openAction.isEnabled()) {
|
| actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, this.openAction);
|
| }
|
| }
|
|
|
| @Override
|
| public void fillContextMenu(final IMenuManager menu) {
|
| if (this.openAction.isEnabled()) {
|
| menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, this.openAction);
|
| }
|
| }
|
|
|
| }
|