]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/events/MenuListener.java
Remove invalid SHA-256-Digests
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / events / MenuListener.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2017 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.swt.events;
15
16
17 import java.util.function.*;
18
19 import org.eclipse.swt.internal.*;
20
21 /**
22  * Classes which implement this interface provide methods
23  * that deal with the hiding and showing of menus.
24  * <p>
25  * After creating an instance of a class that implements
26  * this interface it can be added to a menu using the
27  * <code>addMenuListener</code> method and removed using
28  * the <code>removeMenuListener</code> method. When the
29  * menu is hidden or shown, the appropriate method will
30  * be invoked.
31  * </p>
32  *
33  * @see MenuAdapter
34  * @see MenuEvent
35  */
36 public interface MenuListener extends SWTEventListener {
37
38 /**
39  * Sent when a menu is hidden.
40  *
41  * @param e an event containing information about the menu operation
42  */
43 void menuHidden(MenuEvent e);
44
45 /**
46  * Sent when a menu is shown.
47  *
48  * @param e an event containing information about the menu operation
49  */
50 void menuShown(MenuEvent e);
51
52 /**
53  * Static helper method to create a <code>MenuListener</code> for the
54  * {@link #menuHidden(MenuEvent e)}) method, given a lambda expression or a method reference.
55  *
56  * @param c the consumer of the event
57  * @return MenuListener
58  * @since 3.107
59  */
60 static MenuListener menuHiddenAdapter(Consumer<MenuEvent> c) {
61         return new MenuAdapter() {
62                 @Override
63                 public void menuHidden(MenuEvent e) {
64                         c.accept(e);
65                 }
66         };
67 }
68
69 /**
70  * Static helper method to create a <code>MenuListener</code> for the
71  * {@link #menuShown(MenuEvent e)}) method, given a lambda expression or a method reference.
72  *
73  * @param c the consumer of the event
74  * @return MenuListener
75  * @since 3.107
76  */
77 static MenuListener menuShownAdapter(Consumer<MenuEvent> c) {
78         return new MenuAdapter() {
79                 @Override
80                 public void menuShown(MenuEvent e) {
81                         c.accept(e);
82                 }
83         };
84 }
85 }