Skip to main content
summaryrefslogtreecommitdiffstats
blob: df6cb1f88d6b0bb720ec61aef1b68923437d3f9c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
/*****************************************************************************
 * Copyright (c) 2008 CEA LIST.
 *
 *    
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Cedric Dumoulin Cedric.Dumoulin@lifl.fr- Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.outline.emftree;

import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorActionBarContributor;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IKeyBindingService;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.internal.services.INestable;
import org.eclipse.ui.part.EditorActionBarContributor;

/**
 * A site made of a main site and another ActionarContributor.
 * 
 * @author dumoulin
 * 
 */
public class MultiPageAdapterSite implements IEditorSite, INestable {

	/**
	 * The actionBarContributor to use instead of the one in the site.
	 */
	private EditorActionBarContributor actionBarContributor;

	/**
	 * The site to which methods delegate.
	 */
	private IEditorSite site;

	/**
	 * Constructor.
	 * 
	 * @param workbenchPartSite
	 * @param actionBarContributor
	 */
	public MultiPageAdapterSite(IEditorSite site, EditorActionBarContributor actionBarContributor) {
		super();
		this.site = site;
		this.actionBarContributor = actionBarContributor;
	}

	/**
	 * @see org.eclipse.ui.IEditorSite#getActionBarContributor()
	 * @return
	 * 
	 */
	public IEditorActionBarContributor getActionBarContributor() {

		return actionBarContributor;
	}

	/**
	 * @see org.eclipse.ui.IEditorSite#getActionBars()
	 * @return
	 * 
	 */
	public IActionBars getActionBars() {
		return site.getActionBars();
	}

	/**
	 * @see org.eclipse.ui.IEditorSite#registerContextMenu(org.eclipse.jface.action.MenuManager, org.eclipse.jface.viewers.ISelectionProvider,
	 *      boolean)
	 * @param menuManager
	 * @param selectionProvider
	 * @param includeEditorInput
	 * 
	 */
	public void registerContextMenu(MenuManager menuManager, ISelectionProvider selectionProvider, boolean includeEditorInput) {
		site.registerContextMenu(menuManager, selectionProvider, includeEditorInput);
	}

	/**
	 * @see org.eclipse.ui.IEditorSite#registerContextMenu(java.lang.String, org.eclipse.jface.action.MenuManager,
	 *      org.eclipse.jface.viewers.ISelectionProvider, boolean)
	 * @param menuId
	 * @param menuManager
	 * @param selectionProvider
	 * @param includeEditorInput
	 * 
	 */
	public void registerContextMenu(String menuId, MenuManager menuManager, ISelectionProvider selectionProvider, boolean includeEditorInput) {
		site.registerContextMenu(menuId, menuManager, selectionProvider, includeEditorInput);

	}

	/**
	 * @see org.eclipse.ui.IWorkbenchPartSite#getId()
	 * @return
	 * 
	 */
	public String getId() {
		return site.getId();
	}

	/**
	 * @see org.eclipse.ui.IWorkbenchPartSite#getKeyBindingService()
	 * @return
	 * @deprecated
	 * 
	 */
	@Deprecated
	public IKeyBindingService getKeyBindingService() {
		return site.getKeyBindingService();
	}

	/**
	 * @see org.eclipse.ui.IWorkbenchPartSite#getPart()
	 * @return
	 * 
	 */
	public IWorkbenchPart getPart() {
		return site.getPart();
	}

	/**
	 * @see org.eclipse.ui.IWorkbenchPartSite#getPluginId()
	 * @return
	 * 
	 */
	public String getPluginId() {
		return site.getPluginId();
	}

	/**
	 * @see org.eclipse.ui.IWorkbenchPartSite#getRegisteredName()
	 * @return
	 * 
	 */
	public String getRegisteredName() {
		return site.getRegisteredName();
	}

	/**
	 * @see org.eclipse.ui.IWorkbenchPartSite#registerContextMenu(org.eclipse.jface.action.MenuManager, org.eclipse.jface.viewers.ISelectionProvider)
	 * @param menuManager
	 * @param selectionProvider
	 * 
	 */
	public void registerContextMenu(MenuManager menuManager, ISelectionProvider selectionProvider) {
		site.registerContextMenu(menuManager, selectionProvider);

	}

	/**
	 * @see org.eclipse.ui.IWorkbenchPartSite#registerContextMenu(java.lang.String, org.eclipse.jface.action.MenuManager,
	 *      org.eclipse.jface.viewers.ISelectionProvider)
	 * @param menuId
	 * @param menuManager
	 * @param selectionProvider
	 * 
	 */
	public void registerContextMenu(String menuId, MenuManager menuManager, ISelectionProvider selectionProvider) {
		site.registerContextMenu(menuId, menuManager, selectionProvider);

	}

	/**
	 * @see org.eclipse.ui.IWorkbenchSite#getPage()
	 * @return
	 * 
	 */
	public IWorkbenchPage getPage() {
		return site.getPage();
	}

	/**
	 * @see org.eclipse.ui.IWorkbenchSite#getSelectionProvider()
	 * @return
	 * 
	 */
	public ISelectionProvider getSelectionProvider() {
		return site.getSelectionProvider();
	}

	/**
	 * @see org.eclipse.ui.IWorkbenchSite#getShell()
	 * @return
	 * 
	 */
	public Shell getShell() {
		return site.getShell();
	}

	/**
	 * @see org.eclipse.ui.IWorkbenchSite#getWorkbenchWindow()
	 * @return
	 * 
	 */
	public IWorkbenchWindow getWorkbenchWindow() {
		return site.getWorkbenchWindow();
	}

	/**
	 * @see org.eclipse.ui.IWorkbenchSite#setSelectionProvider(org.eclipse.jface.viewers.ISelectionProvider)
	 * @param provider
	 * 
	 */
	public void setSelectionProvider(ISelectionProvider provider) {
		site.setSelectionProvider(provider);

	}

	/**
	 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
	 * @param adapter
	 * @return
	 * 
	 */
	public Object getAdapter(Class adapter) {
		return site.getAdapter(adapter);
	}

	/**
	 * @see org.eclipse.ui.services.IServiceLocator#getService(java.lang.Class)
	 * @param api
	 * @return
	 * 
	 */
	public Object getService(Class api) {
		return site.getService(api);
	}

	/**
	 * @see org.eclipse.ui.services.IServiceLocator#hasService(java.lang.Class)
	 * @param api
	 * @return
	 * 
	 */
	public boolean hasService(Class api) {
		return site.hasService(api);
	}

	/**
	 * 
	 * @see org.eclipse.ui.internal.services.INestable#activate()
	 * 
	 */
	public void activate() {
		if(site instanceof INestable)
			((INestable)site).activate();
	}

	/**
	 * 
	 * @see org.eclipse.ui.internal.services.INestable#deactivate()
	 * 
	 */
	public void deactivate() {
		if(site instanceof INestable)
			((INestable)site).deactivate();
	}

}

Back to the top