1 /*******************************************************************************
2 * Copyright (c) 2012 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.selectionview;
14 import org.eclipse.jface.action.MenuManager;
15 import org.eclipse.jface.viewers.ISelectionProvider;
16 import org.eclipse.swt.widgets.Shell;
17 import org.eclipse.ui.IActionBars;
18 import org.eclipse.ui.IWorkbenchPage;
19 import org.eclipse.ui.IWorkbenchWindow;
20 import org.eclipse.ui.internal.services.INestable;
21 import org.eclipse.ui.part.IPageSite;
24 * @author Tuukka Lehtonen
26 public class PageSiteProxy implements IPageSite, INestable {
30 public PageSiteProxy(IPageSite proxy) {
35 public IWorkbenchPage getPage() {
36 return proxy.getPage();
40 public ISelectionProvider getSelectionProvider() {
41 return proxy.getSelectionProvider();
45 public Shell getShell() {
46 return proxy.getShell();
50 public IWorkbenchWindow getWorkbenchWindow() {
51 return proxy.getWorkbenchWindow();
55 public void setSelectionProvider(ISelectionProvider provider) {
56 proxy.setSelectionProvider(provider);
60 public Object getAdapter(Class adapter) {
61 return proxy.getAdapter(adapter);
65 public Object getService(Class api) {
66 return proxy.getService(api);
70 public boolean hasService(Class api) {
71 return proxy.hasService(api);
75 public void activate() {
76 if (proxy instanceof INestable)
77 ((INestable) proxy).activate();
81 public void deactivate() {
82 if (proxy instanceof INestable)
83 ((INestable) proxy).deactivate();
87 public void registerContextMenu(String menuId, MenuManager menuManager, ISelectionProvider selectionProvider) {
88 proxy.registerContextMenu(menuId, menuManager, selectionProvider);
92 public IActionBars getActionBars() {
93 return proxy.getActionBars();