KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > IWorkbenchPartSite


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui;
12
13 import org.eclipse.jface.action.MenuManager;
14 import org.eclipse.jface.viewers.ISelectionProvider;
15 import org.eclipse.ui.contexts.IContextService;
16 import org.eclipse.ui.handlers.IHandlerService;
17 import org.eclipse.ui.services.IServiceLocator;
18
19 /**
20  * The primary interface between a workbench part and the workbench.
21  * <p>
22  * This interface is not intended to be implemented or extended by clients.
23  * </p>
24  */

25 public interface IWorkbenchPartSite extends IWorkbenchSite {
26
27     /**
28      * Returns the part registry extension id for this workbench site's part.
29      * <p>
30      * The name comes from the <code>id</code> attribute in the configuration
31      * element.
32      * </p>
33      *
34      * @return the registry extension id
35      */

36     public String JavaDoc getId();
37
38     /**
39      * Returns the unique identifier of the plug-in that defines this workbench
40      * site's part.
41      *
42      * @return the unique identifier of the declaring plug-in
43      */

44     public String JavaDoc getPluginId();
45
46     /**
47      * Returns the registered name for this workbench site's part.
48      * <p>
49      * The name comes from the <code>name</code> attribute in the configuration
50      * element.
51      * </p>
52      *
53      * @return the part name
54      */

55     public String JavaDoc getRegisteredName();
56
57     /**
58      * Registers a pop-up menu with a particular id for extension.
59      * This method should only be called if the target part has more
60      * than one context menu to register.
61      * <p>
62      * For a detailed description of context menu registration see
63      * <code>registerContextMenu(MenuManager, ISelectionProvider);
64      * </p>
65      *
66      * @param menuId the menu id
67      * @param menuManager the menu manager
68      * @param selectionProvider the selection provider
69      */

70     public void registerContextMenu(String JavaDoc menuId, MenuManager menuManager,
71             ISelectionProvider selectionProvider);
72
73     /**
74      * Registers a pop-up menu with the default id for extension.
75      * The default id is defined as the part id.
76      * <p>
77      * Within the workbench one plug-in may extend the pop-up menus for a view
78      * or editor within another plug-in. In order to be eligible for extension,
79      * the target part must publish each menu by calling <code>registerContextMenu</code>.
80      * Once this has been done the workbench will automatically insert any action
81      * extensions which exist.
82      * </p>
83      * <p>
84      * A menu id must be provided for each registered menu. For consistency across
85      * parts the following strategy should be adopted by all part implementors.
86      * </p>
87      * <ol>
88      * <li>If the target part has only one context menu it should be registered
89      * with <code>id == part id</code>. This can be done easily by calling
90      * <code>registerContextMenu(MenuManager, ISelectionProvider).
91      * <li>If the target part has more than one context menu a unique id should be
92      * defined for each. Prefix each menu id with the part id and publish these
93      * ids within the javadoc for the target part. Register each menu at
94      * runtime by calling <code>registerContextMenu(String, MenuManager,
95      * ISelectionProvider)</code>. </li>
96      * </ol>
97      * <p>
98      * Any pop-up menu which is registered with the workbench should also define a
99      * <code>GroupMarker</code> in the registered menu with id
100      * <code>IWorkbenchActionConstants.MB_ADDITIONS</code>. Other plug-ins will use this
101      * group as a reference point for insertion. The marker should be defined at an
102      * appropriate location within the menu for insertion.
103      * </p>
104      *
105      * @param menuManager the menu manager
106      * @param selectionProvider the selection provider
107      */

108     public void registerContextMenu(MenuManager menuManager,
109             ISelectionProvider selectionProvider);
110
111     /**
112      * Returns the key binding service in use.
113      * <p>
114      * The part will access this service to register all of its actions, to set
115      * the active scope.
116      * </p>
117      *
118      * @return the key binding service in use
119      * @since 2.1
120      * @deprecated Use {@link IServiceLocator#getService(Class)} instead.
121      * @see IContextService
122      * @see IHandlerService
123      */

124     public IKeyBindingService getKeyBindingService();
125     
126     /**
127      * Returns the part associated with this site
128      *
129      * @since 3.1
130      *
131      * @return the part associated with this site
132      */

133     public IWorkbenchPart getPart();
134 }
135
Popular Tags