]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/events/TreeListener.java
Remove invalid SHA-256-Digests
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / events / TreeListener.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 expanding and collapsing of tree
24  * branches.
25  * <p>
26  * After creating an instance of a class that implements
27  * this interface it can be added to a tree control using the
28  * <code>addTreeListener</code> method and removed using
29  * the <code>removeTreeListener</code> method. When a branch
30  * of the tree is expanded or collapsed, the appropriate method
31  * will be invoked.
32  * </p>
33  *
34  * @see TreeAdapter
35  * @see TreeEvent
36  */
37 public interface TreeListener extends SWTEventListener {
38
39 /**
40  * Sent when a tree branch is collapsed.
41  *
42  * @param e an event containing information about the tree operation
43  */
44 void treeCollapsed(TreeEvent e);
45
46 /**
47  * Sent when a tree branch is expanded.
48  *
49  * @param e an event containing information about the tree operation
50  */
51 void treeExpanded(TreeEvent e);
52
53 /**
54  * Static helper method to create a <code>TreeListener</code> for the
55  * {@link #treeCollapsed(TreeEvent e)}) method, given a lambda expression or a method reference.
56  *
57  * @param c the consumer of the event
58  * @return TreeListener
59  * @since 3.107
60  */
61 static TreeListener treeCollapsedAdapter(Consumer<TreeEvent> c) {
62         return new TreeAdapter() {
63                 @Override
64                 public void treeCollapsed(TreeEvent e) {
65                         c.accept(e);
66                 }
67         };
68 }
69
70 /**
71  * Static helper method to create a <code>TreeListener</code> for the
72  * {@link #treeExpanded(TreeEvent e)}) method, given a lambda expression or a method reference.
73  *
74  * @param c the consumer of the event
75  * @return TreeListener
76  * @since 3.107
77  */
78 static TreeListener treeExpandedAdapter(Consumer<TreeEvent> c) {
79         return new TreeAdapter() {
80                 @Override
81                 public void treeExpanded(TreeEvent e) {
82                         c.accept(e);
83                 }
84         };
85 }
86 }