KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > menus > IMenuService


1 /*******************************************************************************
2  * Copyright (c) 2005, 2007 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.menus;
12
13 import org.eclipse.core.expressions.IEvaluationContext;
14 import org.eclipse.jface.action.ContributionManager;
15 import org.eclipse.ui.services.IServiceWithSources;
16
17 /**
18  * <p>
19  * Provides services related to the menu architecture within the workbench. It
20  * can be used to contribute additional items to the menu, tool bar and status
21  * line.
22  * </p>
23  * <p>
24  * This interface should not be implemented or extended by clients.
25  * </p>
26  *
27  * @since 3.3
28  */

29 public interface IMenuService extends IServiceWithSources {
30
31     /**
32      * Contribute and initialize the contribution factory. This should only be
33      * called once per factory. After the call, the factory should be treated as
34      * an unmodifiable object.
35      * <p>
36      * <b>Note:</b> In 3.3M4, this will make the factory available for any
37      * following calls to
38      * {@link #populateContributionManager(ContributionManager, String)}, but
39      * it will not add those contributions to already populated managers.
40      * </p>
41      *
42      * @param factory
43      * the contribution factory. Must not be <code>null</code>
44      */

45     public void addContributionFactory(AbstractContributionFactory factory);
46
47     /**
48      * Remove the contributed factory from the menu service. If the factory is
49      * not contained by this service, this call does nothing.
50      * <p>
51      * <b>Note:</b>In 3.3M4, this factory will no longer be called during
52      * {@link #populateContributionManager(ContributionManager, String)} calls,
53      * but outstanding contributions will not be removed from populated
54      * contribution managers.
55      * </p>
56      *
57      * @param factory
58      * the contribution factory to remove. Must not be
59      * <code>null</code>.
60      */

61     public void removeContributionFactory(AbstractContributionFactory factory);
62
63     /**
64      * Populate a <code>ContributionManager</code> at the specified starting
65      * location with a set of <code>IContributionItems</code>s. It applies
66      * <code>AbstractContributionFactory</code>s that are stored against the
67      * provided location.
68      *
69      * @param mgr
70      * The ContributionManager to populate
71      * @param location
72      * The starting location to begin populating this contribution
73      * manager. The format is the Menu API URI format.
74      * @see #releaseContributions(ContributionManager)
75      */

76     public void populateContributionManager(ContributionManager mgr,
77             String JavaDoc location);
78
79     /**
80      * Before calling dispose() on a ContributionManager populated by the menu
81      * service, you must inform the menu service to release its contributions.
82      * This takes care of unregistering any IContributionItems that have their
83      * visibleWhen clause managed by this menu service.
84      *
85      * @param mgr
86      * The manager that was populated by a call to
87      * {@link #populateContributionManager(ContributionManager, String)}
88      */

89     public void releaseContributions(ContributionManager mgr);
90
91     /**
92      * Get the current state of eclipse as seen by the menu service.
93      *
94      * @return an IEvaluationContext containing state variables.
95      *
96      * @see org.eclipse.ui.ISources
97      */

98     public IEvaluationContext getCurrentState();
99 }
100
Popular Tags