001: /*******************************************************************************
002: * Copyright (c) 2000, 2006 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.ui;
011:
012: import org.eclipse.jface.action.MenuManager;
013: import org.eclipse.jface.viewers.ISelectionProvider;
014: import org.eclipse.ui.contexts.IContextService;
015: import org.eclipse.ui.handlers.IHandlerService;
016: import org.eclipse.ui.services.IServiceLocator;
017:
018: /**
019: * The primary interface between a workbench part and the workbench.
020: * <p>
021: * This interface is not intended to be implemented or extended by clients.
022: * </p>
023: */
024: public interface IWorkbenchPartSite extends IWorkbenchSite {
025:
026: /**
027: * Returns the part registry extension id for this workbench site's part.
028: * <p>
029: * The name comes from the <code>id</code> attribute in the configuration
030: * element.
031: * </p>
032: *
033: * @return the registry extension id
034: */
035: public String getId();
036:
037: /**
038: * Returns the unique identifier of the plug-in that defines this workbench
039: * site's part.
040: *
041: * @return the unique identifier of the declaring plug-in
042: */
043: public String getPluginId();
044:
045: /**
046: * Returns the registered name for this workbench site's part.
047: * <p>
048: * The name comes from the <code>name</code> attribute in the configuration
049: * element.
050: * </p>
051: *
052: * @return the part name
053: */
054: public String getRegisteredName();
055:
056: /**
057: * Registers a pop-up menu with a particular id for extension.
058: * This method should only be called if the target part has more
059: * than one context menu to register.
060: * <p>
061: * For a detailed description of context menu registration see
062: * <code>registerContextMenu(MenuManager, ISelectionProvider);
063: * </p>
064: *
065: * @param menuId the menu id
066: * @param menuManager the menu manager
067: * @param selectionProvider the selection provider
068: */
069: public void registerContextMenu(String menuId,
070: MenuManager menuManager,
071: ISelectionProvider selectionProvider);
072:
073: /**
074: * Registers a pop-up menu with the default id for extension.
075: * The default id is defined as the part id.
076: * <p>
077: * Within the workbench one plug-in may extend the pop-up menus for a view
078: * or editor within another plug-in. In order to be eligible for extension,
079: * the target part must publish each menu by calling <code>registerContextMenu</code>.
080: * Once this has been done the workbench will automatically insert any action
081: * extensions which exist.
082: * </p>
083: * <p>
084: * A menu id must be provided for each registered menu. For consistency across
085: * parts the following strategy should be adopted by all part implementors.
086: * </p>
087: * <ol>
088: * <li>If the target part has only one context menu it should be registered
089: * with <code>id == part id</code>. This can be done easily by calling
090: * <code>registerContextMenu(MenuManager, ISelectionProvider).
091: * <li>If the target part has more than one context menu a unique id should be
092: * defined for each. Prefix each menu id with the part id and publish these
093: * ids within the javadoc for the target part. Register each menu at
094: * runtime by calling <code>registerContextMenu(String, MenuManager,
095: * ISelectionProvider)</code>. </li>
096: * </ol>
097: * <p>
098: * Any pop-up menu which is registered with the workbench should also define a
099: * <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: }
|