01: /*******************************************************************************
02: * Copyright (c) 2005, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.navigator;
11:
12: import org.eclipse.jface.viewers.ISelectionProvider;
13: import org.eclipse.swt.widgets.Shell;
14: import org.eclipse.ui.IEditorSite;
15: import org.eclipse.ui.IViewSite;
16: import org.eclipse.ui.internal.navigator.CommonViewerSiteDelegate;
17: import org.eclipse.ui.internal.navigator.CommonViewerSiteIEditorPartSiteDelegate;
18: import org.eclipse.ui.internal.navigator.CommonViewerSiteIPageSiteDelegate;
19: import org.eclipse.ui.internal.navigator.CommonViewerSiteIViewSiteDelegate;
20: import org.eclipse.ui.part.IPageSite;
21:
22: /**
23: * Allows clients to create {@link ICommonViewerSite} for a variety of contexts.
24: * The {@link ICommonViewerSite} may be used by the
25: * {@link NavigatorActionService} to allow customization for any
26: * {@link CommonActionProvider} used by a particular instance of the Common
27: * Navigator.
28: *
29: *
30: * @since 3.2
31: */
32: public final class CommonViewerSiteFactory {
33: /**
34: *
35: * @param aViewSite
36: * The viewer site that should be delegated to to satisfy the
37: * contract of ICommonViewerSite.
38: * @return An ICommonViewerSite that delegates to the given parameter.
39: */
40: public static ICommonViewerWorkbenchSite createCommonViewerSite(
41: IViewSite aViewSite) {
42: return new CommonViewerSiteIViewSiteDelegate(aViewSite);
43: }
44:
45: /**
46: *
47: * @param aEditorSite
48: * The editor site that should be delegated to to satisfy the
49: * contract of ICommonViewerSite.
50: * @return An ICommonViewerSite that delegates to the given parameter.
51: */
52: public static ICommonViewerWorkbenchSite createCommonViewerSite(
53: IEditorSite aEditorSite) {
54: return new CommonViewerSiteIEditorPartSiteDelegate(aEditorSite);
55: }
56:
57: /**
58: *
59: * @param anId
60: * The unique identifier corresponding to the abstract viewer for
61: * the returned ICommonViewerSite.
62: *
63: * @param aSelectionProvider
64: * The selection provider that will initially be returned by
65: * {@link ICommonViewerSite#getSelectionProvider()}
66: *
67: * @param aShell
68: * The shell that will be returned by
69: * {@link ICommonViewerSite#getShell()}
70: * @return An ICommonViewerSite that delegates to the given parameter.
71: */
72: public static ICommonViewerSite createCommonViewerSite(String anId,
73: ISelectionProvider aSelectionProvider, Shell aShell) {
74: return new CommonViewerSiteDelegate(anId, aSelectionProvider,
75: aShell);
76: }
77:
78: /**
79: *
80: * @param anId
81: * The unique identifier corresponding to the abstract viewer for
82: * the returned ICommonViewerSite.
83: * @param aPageSite
84: * The page site that should be delegated to to satisfy the
85: * contract of ICommonViewerSite.
86: * @return An ICommonViewerSite that delegates to the given parameter.
87: */
88: public static ICommonViewerSite createCommonViewerSite(String anId,
89: IPageSite aPageSite) {
90: return new CommonViewerSiteIPageSiteDelegate(anId, aPageSite);
91: }
92:
93: }
|