KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > action > IMenuCreator


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.jface.action;
12
13 import org.eclipse.swt.widgets.Control;
14 import org.eclipse.swt.widgets.Menu;
15
16 /**
17  * Interface for something that creates and disposes of SWT menus. Note that
18  * it is the responsibility of the implementor to dispose of SWT menus it
19  * creates.
20  */

21 public interface IMenuCreator {
22     /**
23      * Disposes the menu returned by <code>getMenu</code>. Does nothing
24      * if there is no menu. This method will be executed only when the
25      * parent of the menu is disposed.
26      */

27     public void dispose();
28
29     /**
30      * Returns the SWT menu, created as a pop up menu parented by the
31      * given control. In most cases, this menu can be created once, cached and reused
32      * when the pop-up/drop-down action occurs. If the menu must be dynamically
33      * created (i.e., each time it is popped up or dropped down), the old menu
34      * should be disposed of before replacing it with the new menu.
35      *
36      * @param parent the parent control
37      * @return the menu, or <code>null</code> if the menu could not
38      * be created
39      */

40     public Menu getMenu(Control parent);
41
42     /**
43      * Returns an SWT menu created as a drop down menu parented by the
44      * given menu. In most cases, this menu can be created once, cached and reused
45      * when the pop-up/drop-down action occurs. If the menu must be dynamically
46      * created (i.e., each time it is popped up or dropped down), the old menu
47      * should be disposed of before replacing it with the new menu.
48      *
49      * @param parent the parent menu
50      * @return the menu, or <code>null</code> if the menu could not
51      * be created
52      */

53     public Menu getMenu(Menu parent);
54 }
55
Popular Tags