org.eclipse.swt.events.TreeListener Java Examples

The following examples show how to use org.eclipse.swt.events.TreeListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CTreeCombo.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void treeExpanded(TreeEvent e) {
	e.item = (Widget) e.item.getData(CTreeComboItem.DATA_ID);
	e.widget = CTreeCombo.this;
	for (final TreeListener l : treeListeners) {
		l.treeExpanded(e);
	}
}
 
Example #2
Source File: CTreeCombo.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void treeCollapsed(TreeEvent e) {
	e.item = (Widget) e.item.getData(CTreeComboItem.DATA_ID);
	e.widget = CTreeCombo.this;
	for (final TreeListener l : treeListeners) {
		l.treeCollapsed(e);
	}
}
 
Example #3
Source File: Grid_Test.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testAddRemoveTreeListener() {
  TreeListener listener = mock( TreeListener.class );
  grid.addTreeListener( listener );
  assertTrue( grid.isListening( SWT.Expand ) );
  assertTrue( grid.isListening( SWT.Collapse ) );
  grid.removeTreeListener( listener );
  assertFalse( grid.isListening( SWT.Expand ) );
  assertFalse( grid.isListening( SWT.Collapse ) );
}
 
Example #4
Source File: GridColumnGroup_Test.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testAddRemoveTreeListener() {
  TreeListener listener = new TreeAdapter() {};
  group.addTreeListener( listener );

  assertTrue( group.isListening( SWT.Expand ) );
  assertTrue( group.isListening( SWT.Collapse ) );

  group.removeTreeListener( listener );
  assertFalse( group.isListening( SWT.Expand ) );
  assertFalse( group.isListening( SWT.Collapse ) );
}
 
Example #5
Source File: CTree.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void addTreeListener(TreeListener listener) {
	checkWidget ();
	if(listener != null) {
		TypedListener typedListener = new TypedListener (listener);
		addListener (SWT.Collapse, typedListener);
		addListener (SWT.Expand, typedListener);
	}
}
 
Example #6
Source File: CTree.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void removeTreeListener(TreeListener listener) {
	checkWidget ();
	if(listener != null) {
		removeListener(SWT.Collapse, listener);
		removeListener(SWT.Expand, listener);
	}
}
 
Example #7
Source File: ManageableTableTreeEx.java    From SWET with MIT License 4 votes vote down vote up
public void removeTreeListener(TreeListener listener) {
	if (listener == null)
		throw new SWTError(SWT.ERROR_NULL_ARGUMENT);
	removeListener(SWT.Expand, listener);
	removeListener(SWT.Collapse, listener);
}
 
Example #8
Source File: CTreeViewer.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
protected void addTreeListener(Control control, TreeListener listener) {
	((CTree)control).addTreeListener(listener);
}
 
Example #9
Source File: GridTreeViewer.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
protected void addTreeListener(Control control, TreeListener listener) {
	((Grid) control).addTreeListener(listener);
}
 
Example #10
Source File: CTreeComboViewer.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @see org.eclipse.jface.viewers.AbstractTreeViewer#addTreeListener(org.eclipse.swt.widgets.Control, org.eclipse.swt.events.TreeListener)
 */
protected void addTreeListener(Control c, TreeListener listener) {
	((CTreeCombo) c).addTreeListener(listener);
}
 
Example #11
Source File: GridTreeViewer.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
protected void addTreeListener(Control control, TreeListener listener) {
	((Grid) control).addTreeListener(listener);
}
 
Example #12
Source File: GridTreeViewer.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
protected void addTreeListener(Control control, TreeListener listener) {
	((Grid) control).addTreeListener(listener);
}
 
Example #13
Source File: GridTreeViewer.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
protected void addTreeListener(Control control, TreeListener listener) {
	((Grid) control).addTreeListener(listener);
}
 
Example #14
Source File: GridColumnGroup.java    From translationstudio8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Removes the listener from the collection of listeners who will
 * be notified when items in the receiver are expanded or collapsed.
 *
 * @param listener the listener which should no longer be notified
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 * </ul>
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 *
 * @see TreeListener
 * @see #addTreeListener
 */
public void removeTreeListener(TreeListener listener) {
    checkWidget ();
    if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
    removeListener (SWT.Expand, listener);
    removeListener (SWT.Collapse, listener);
}
 
Example #15
Source File: GridColumnGroup.java    From translationstudio8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Adds the listener to the collection of listeners who will
 * be notified when an item in the receiver is expanded or collapsed
 * by sending it one of the messages defined in the <code>TreeListener</code>
 * interface.
 *
 * @param listener the listener which should be notified
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 * </ul>
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 *
 * @see TreeListener
 * @see #removeTreeListener
 */
public void addTreeListener(TreeListener listener) {
    checkWidget ();
    if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
    TypedListener typedListener = new TypedListener (listener);
    addListener (SWT.Expand, typedListener);
    addListener (SWT.Collapse, typedListener);
}
 
Example #16
Source File: GridColumnGroup.java    From tmxeditor8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Adds the listener to the collection of listeners who will
 * be notified when an item in the receiver is expanded or collapsed
 * by sending it one of the messages defined in the <code>TreeListener</code>
 * interface.
 *
 * @param listener the listener which should be notified
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 * </ul>
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 *
 * @see TreeListener
 * @see #removeTreeListener
 */
public void addTreeListener(TreeListener listener) {
    checkWidget ();
    if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
    TypedListener typedListener = new TypedListener (listener);
    addListener (SWT.Expand, typedListener);
    addListener (SWT.Collapse, typedListener);
}
 
Example #17
Source File: GridColumnGroup.java    From tmxeditor8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Removes the listener from the collection of listeners who will
 * be notified when items in the receiver are expanded or collapsed.
 *
 * @param listener the listener which should no longer be notified
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 * </ul>
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 *
 * @see TreeListener
 * @see #addTreeListener
 */
public void removeTreeListener(TreeListener listener) {
    checkWidget ();
    if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
    removeListener (SWT.Expand, listener);
    removeListener (SWT.Collapse, listener);
}
 
Example #18
Source File: ManageableTableTreeEx.java    From SWET with MIT License 3 votes vote down vote up
public void addTreeListener(TreeListener listener) {

			if (listener == null)
				throw new SWTError(SWT.ERROR_NULL_ARGUMENT);

			TypedListener typedListener = new TypedListener(listener);

			addListener(SWT.Expand, typedListener);

			addListener(SWT.Collapse, typedListener);

		}
 
Example #19
Source File: GridColumnGroup.java    From nebula with Eclipse Public License 2.0 3 votes vote down vote up
/**
 * Removes the listener from the collection of listeners who will
 * be notified when items in the receiver are expanded or collapsed.
 *
 * @param listener the listener which should no longer be notified
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 * </ul>
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 *
 * @see TreeListener
 * @see #addTreeListener
 */
public void removeTreeListener(TreeListener listener) {
    checkWidget ();
    if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
    removeListener (SWT.Expand, listener);
    removeListener (SWT.Collapse, listener);
}
 
Example #20
Source File: GridColumnGroup.java    From nebula with Eclipse Public License 2.0 3 votes vote down vote up
/**
 * Adds the listener to the collection of listeners who will
 * be notified when an item in the receiver is expanded or collapsed
 * by sending it one of the messages defined in the <code>TreeListener</code>
 * interface.
 *
 * @param listener the listener which should be notified
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 * </ul>
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 *
 * @see TreeListener
 * @see #removeTreeListener
 */
public void addTreeListener(TreeListener listener) {
    checkWidget ();
    if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
    TypedListener typedListener = new TypedListener (listener);
    addListener (SWT.Expand, typedListener);
    addListener (SWT.Collapse, typedListener);
}
 
Example #21
Source File: Gallery.java    From nebula with Eclipse Public License 2.0 3 votes vote down vote up
/**
 * Adds the listener to the collection of listeners who will be notified
 * when an item in the receiver is expanded or collapsed by sending it one
 * of the messages defined in the TreeListener interface.
 * 
 * @param listener
 */
public void addTreeListener(TreeListener listener) {
	checkWidget();
	if (listener == null)
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	addListener(SWT.Expand, new TypedListener(listener));
}
 
Example #22
Source File: CTreeCombo.java    From nebula with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Removes the listener from the collection of listeners who will
 * be notified when items in the receiver are expanded or collapsed.
 *
 * @param listener the listener which should no longer be notified
 *
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 *                </ul>
 *
 * @see TreeListener
 * @see #addTreeListener
 */
public void removeTreeListener(TreeListener listener) {
	checkWidget();
	treeListeners.remove(listener);
}
 
Example #23
Source File: CTreeCombo.java    From nebula with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Adds the listener to the collection of listeners who will
 * be notified when an item in the receiver is expanded or collapsed
 * by sending it one of the messages defined in the <code>TreeListener</code>
 * interface.
 *
 * @param listener the listener which should be notified
 *
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 *                </ul>
 *
 * @see TreeListener
 * @see #removeTreeListener
 */
public void addTreeListener(TreeListener listener) {
	checkWidget();
	treeListeners.add(listener);
}
 
Example #24
Source File: GalleryTreeViewer.java    From nebula with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * @see org.eclipse.jface.viewers.AbstractTreeViewer#addTreeListener(org.eclipse
 *      .swt.widgets.Control, org.eclipse.swt.events.TreeListener)
 */
protected void addTreeListener(Control control, TreeListener listener) {
	((Gallery) control).addTreeListener(listener);
}