]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.selectionview/src/org/simantics/selectionview/PageSiteProxy.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.selectionview / src / org / simantics / selectionview / PageSiteProxy.java
1 /*******************************************************************************\r
2  * Copyright (c) 2012 Association for Decentralized Information Management in\r
3  * Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.selectionview;\r
13 \r
14 import org.eclipse.jface.action.MenuManager;\r
15 import org.eclipse.jface.viewers.ISelectionProvider;\r
16 import org.eclipse.swt.widgets.Shell;\r
17 import org.eclipse.ui.IActionBars;\r
18 import org.eclipse.ui.IWorkbenchPage;\r
19 import org.eclipse.ui.IWorkbenchWindow;\r
20 import org.eclipse.ui.internal.services.INestable;\r
21 import org.eclipse.ui.part.IPageSite;\r
22 \r
23 /**\r
24  * @author Tuukka Lehtonen\r
25  */\r
26 public class PageSiteProxy implements IPageSite, INestable {\r
27 \r
28     IPageSite proxy;\r
29 \r
30     public PageSiteProxy(IPageSite proxy) {\r
31         this.proxy = proxy;\r
32     }\r
33 \r
34     @Override\r
35     public IWorkbenchPage getPage() {\r
36         return proxy.getPage();\r
37     }\r
38 \r
39     @Override\r
40     public ISelectionProvider getSelectionProvider() {\r
41         return proxy.getSelectionProvider();\r
42     }\r
43 \r
44     @Override\r
45     public Shell getShell() {\r
46         return proxy.getShell();\r
47     }\r
48 \r
49     @Override\r
50     public IWorkbenchWindow getWorkbenchWindow() {\r
51         return proxy.getWorkbenchWindow();\r
52     }\r
53 \r
54     @Override\r
55     public void setSelectionProvider(ISelectionProvider provider) {\r
56         proxy.setSelectionProvider(provider);\r
57     }\r
58 \r
59     @Override\r
60     public Object getAdapter(Class adapter) {\r
61         return proxy.getAdapter(adapter);\r
62     }\r
63 \r
64     @Override\r
65     public Object getService(Class api) {\r
66         return proxy.getService(api);\r
67     }\r
68 \r
69     @Override\r
70     public boolean hasService(Class api) {\r
71         return proxy.hasService(api);\r
72     }\r
73 \r
74     @Override\r
75     public void activate() {\r
76         if (proxy instanceof INestable)\r
77             ((INestable) proxy).activate();\r
78     }\r
79 \r
80     @Override\r
81     public void deactivate() {\r
82         if (proxy instanceof INestable)\r
83             ((INestable) proxy).deactivate();\r
84     }\r
85 \r
86     @Override\r
87     public void registerContextMenu(String menuId, MenuManager menuManager, ISelectionProvider selectionProvider) {\r
88         proxy.registerContextMenu(menuId, menuManager, selectionProvider);\r
89     }\r
90 \r
91     @Override\r
92     public IActionBars getActionBars() {\r
93         return proxy.getActionBars();\r
94     }\r
95 \r
96 }