类org.eclipse.swt.widgets.TypedListener源码实例Demo

下面列出了怎么用org.eclipse.swt.widgets.TypedListener的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: gama   文件: Popup2.java
public Popup2(final IPopupProvider provider, final Widget... controls) {
	super(WorkbenchHelper.getShell(), PopupDialog.HOVER_SHELLSTYLE, false, false, false, false, false, null, null);
	this.provider = provider;
	final Shell parent = provider.getControllingShell();
	parent.addListener(SWT.Move, hide);
	parent.addListener(SWT.Resize, hide);
	parent.addListener(SWT.Close, hide);
	parent.addListener(SWT.Deactivate, hide);
	parent.addListener(SWT.Hide, hide);
	parent.addListener(SWT.Dispose, event -> close());
	for (final Widget c : controls) {
		if (c == null) {
			continue;
		}
		final TypedListener typedListener = new TypedListener(mtl);
		c.addListener(SWT.MouseEnter, typedListener);
		c.addListener(SWT.MouseExit, typedListener);
		c.addListener(SWT.MouseHover, typedListener);
	}
}
 
源代码2 项目: APICloud-Studio   文件: CommonMergeViewer.java
private CursorLinePainter getCursorLinePainterInstalled(TextViewer viewer)
{
	Listener[] listeners = viewer.getTextWidget().getListeners(3001/* StyledText.LineGetBackground */);
	for (Listener listener : listeners)
	{
		if (listener instanceof TypedListener)
		{
			TypedListener typedListener = (TypedListener) listener;
			if (typedListener.getEventListener() instanceof CursorLinePainter)
			{
				return (CursorLinePainter) typedListener.getEventListener();
			}
		}
	}
	return null;
}
 
源代码3 项目: nebula   文件: CTree.java
/**
 * An item may be considered visible, and will be returned with
 * {@link CTree#getVisibleItems()}, even though it will not be
 * painted on the screen. Paint status, on the other hand, refers to whether
 * or not an item will actually be painted when the
 * {@link CTree#paintBody(Event)} method is called.
 * 
 * @return an array of items that will be painted to the screen during paint
 *         events
 * @see #getVisibleItems()
 */
// public CTreeItem[] getPaintedItems() {
// return (CTreeItem[]) paintedItems.toArray(new
// CTreeItem[paintedItems.size()]);
// }
public void addSelectionListener(SelectionListener listener) {
	checkWidget();
	if (listener != null) {
		TypedListener typedListener = new TypedListener(listener);
		addListener(SWT.Selection, typedListener);
		addListener(SWT.DefaultSelection, typedListener);
	}
}
 
源代码4 项目: nebula   文件: CTree.java
public void addTreeListener(TreeListener listener) {
	checkWidget ();
	if(listener != null) {
		TypedListener typedListener = new TypedListener (listener);
		addListener (SWT.Collapse, typedListener);
		addListener (SWT.Expand, typedListener);
	}
}
 
源代码5 项目: birt   文件: CSpinner.java
protected void addSelectionListener( SelectionListener listener )
{

	if ( listener == null )
		throw new SWTError( SWT.ERROR_NULL_ARGUMENT );
	addListener( SWT.Selection, new TypedListener( listener ) );
}
 
源代码6 项目: elexis-3-core   文件: DayDateCombo.java
public void addSelectionListener(SelectionListener listener){
	checkWidget();
	
	if (listener == null) {
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	}
	
	TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Selection, typedListener);
	addListener(SWT.DefaultSelection, typedListener);
	
}
 
源代码7 项目: nebula   文件: PGroupToolItem.java
public void addSelectionListener(SelectionListener listener) {
	TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Selection, typedListener);
	addListener(SWT.DefaultSelection, typedListener);
}
 
源代码8 项目: nebula   文件: SplitButton.java
/**
 * Removes the listener from the collection of listeners who will be notified
 * when the control is selected by the user.
 *
 * @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 SelectionListener
 * @see #addSelectionListener
 */
@Override
public void removeSelectionListener(SelectionListener listener) {
	checkWidget();
	if (listener == null) {
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	}

	final Iterator<Listener> it = listeners.iterator();
	while (it.hasNext()) {
		final Listener current = it.next();
		if (current instanceof TypedListener) {
			final TypedListener tl = (TypedListener) current;
			if (tl.getEventListener() != null && tl.getEventListener().equals(listener)) {
				it.remove();
			}
		}
	}
}
 
源代码9 项目: atdl4j   文件: SWTNullableSpinner.java
public void addSelectionListener(SelectionListener listener) {
	if (listener == null)
		throw new SWTError(SWT.ERROR_NULL_ARGUMENT);
	addListener(SWT.Selection, new TypedListener(listener));
}
 
源代码10 项目: pentaho-kettle   文件: JobStepDialog.java
private void addListener( Control el, int event, TypedListener listener ) {
  if ( ArrayUtils.contains( el.getListeners( event ), listener ) ) {
    return;
  }
  el.addListener( event, listener );
}
 
源代码11 项目: nebula   文件: PGroup.java
/**
 * Adds the listener to the collection of listeners who will
 * be notified when the receiver is expanded or collapsed
 * by sending it one of the messages defined in the <code>ExpandListener</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 ExpandListener
 * @see #removeExpandListener
 */
public void addExpandListener(ExpandListener listener)
{
    checkWidget();
    if (listener == null)
        SWT.error(SWT.ERROR_NULL_ARGUMENT);

    TypedListener typedListener = new TypedListener(listener);
    addListener(SWT.Expand, typedListener);
    addListener(SWT.Collapse, typedListener);
}
 
源代码12 项目: nebula   文件: Gallery.java
/**
 * Adds the listener to the collection of listeners who will be notified
 * when the receiver's selection changes, by sending it one of the messages
 * defined in the <code>SelectionListener</code> interface.
 * <p>
 * When <code>widgetSelected</code> is called, the item field of the event
 * object is valid.
 * </p>
 * 
 * @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 SelectionListener
 * @see #removeSelectionListener
 * @see SelectionEvent
 */
public void addSelectionListener(SelectionListener listener) {
	checkWidget();
	if (listener == null)
		SWT.error(SWT.ERROR_NULL_ARGUMENT);

	TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Selection, typedListener);
	addListener(SWT.DefaultSelection, typedListener);
}
 
源代码13 项目: nebula   文件: Gallery.java
/**
 * 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));
}
 
源代码14 项目: nebula   文件: SplitButton.java
/**
 * Adds the listener to the collection of listeners who will be notified when
 * the control is selected by the user, by sending it one of the messages
 * defined in the <code>SelectionListener</code> interface.
 * <p>
 * <code>widgetDefaultSelected</code> is not called.
 * </p>
 *
 * @param listener the listener which should be notified when the control is
 *            selected by the user,
 *
 * @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 SelectionListener
 * @see #removeSelectionListener
 * @see SelectionEvent
 */
@Override
public void addSelectionListener(SelectionListener listener) {
	checkWidget();
	if (listener == null) {
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	}
	final TypedListener typedListener = new TypedListener(listener);
	listeners.add(typedListener);
}
 
源代码15 项目: nebula   文件: GridItem.java
/**
 * Adds the listener to the collection of listeners who will be notified
 * when the row is resized, by sending it one of the messages defined in the
 * <code>ControlListener</code> interface.
 * <p>
 * Clients who wish to override the standard row resize logic should use the
 * untyped listener mechanisms. The untyped <code>Event</code> object passed
 * to an untyped listener will have its <code>detail</code> field populated
 * with the new row height. Clients may alter this value to, for example,
 * enforce minimum or maximum row sizes. Clients may also set the
 * <code>doit</code> field to false to prevent the entire resize operation.
 *
 * @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>
 */
public void addControlListener(ControlListener listener) {
	checkWidget();
	if (listener == null)
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Resize, typedListener);
}
 
源代码16 项目: nebula   文件: GridColumn.java
/**
 * Adds the listener to the collection of listeners who will be notified
 * when the receiver's is pushed, by sending it one of the messages defined
 * in the <code>SelectionListener</code> interface.
 *
 * @param listener
 *            the listener which should be notified
 * @throws IllegalArgumentException
 *             <ul>
 *             <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *             </ul>
 * @throws org.eclipse.swt.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>
 */
public void addSelectionListener(SelectionListener listener) {
	checkWidget();
	if (listener == null) {
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	}
	this.addListener(SWT.Selection, new TypedListener(listener));
}
 
源代码17 项目: nebula   文件: GridColumn.java
/**
 * Adds a listener to the list of listeners notified when the column is
 * moved or resized.
 *
 * @param listener
 *            listener
 * @throws IllegalArgumentException
 *             <ul>
 *             <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *             </ul>
 * @throws org.eclipse.swt.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>
 */
public void addControlListener(ControlListener listener) {
	checkWidget();
	if (listener == null) {
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	}
	TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Resize, typedListener);
	addListener(SWT.Move, typedListener);
}
 
源代码18 项目: nebula   文件: GridColumnGroup.java
/**
 * 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);
}
 
源代码19 项目: nebula   文件: RadioGroup.java
/**
 * Adds the listener to the collection of listeners who will
 * be notified when the control is selected by the user, by sending
 * it one of the messages defined in the <code>SelectionListener</code>
 * interface.
 * <p>
 * <code>widgetSelected</code> is called when the control is selected by the user.
 * <code>widgetDefaultSelected</code> is not called.
 * </p>
 * <p>
 * When the <code>SWT.RADIO</code> style bit is set, the <code>widgetSelected</code> method is
 * also called when the receiver loses selection because another item in the same radio group
 * was selected by the user. During <code>widgetSelected</code> the application can use
 * <code>getSelection()</code> to determine the current selected state of the receiver.
 * </p>
 *
 * @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 SelectionListener
 * @see #removeSelectionListener
 * @see SelectionEvent
 */
public void addSelectionListener(SelectionListener listener) {
	checkWidget();
	if (listener == null) {
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	}
	final TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Selection, typedListener);
	addListener(SWT.DefaultSelection, typedListener);
}
 
源代码20 项目: nebula   文件: CustomCombo.java
/**
 * Adds the listener to the collection of listeners who will be notified
 * when the receiver's text is modified, by sending it one of the messages
 * defined in the <code>ModifyListener</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 ModifyListener
 * @see #removeModifyListener
 */
public void addModifyListener(ModifyListener listener) {
	checkWidget();
	if (listener == null)
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Modify, typedListener);
}
 
源代码21 项目: nebula   文件: CustomCombo.java
/**
 * Adds the listener to the collection of listeners who will be notified
 * when the user changes the receiver's selection, by sending it one of the
 * messages defined in the <code>SelectionListener</code> interface.
 * <p>
 * <code>widgetSelected</code> is called when the combo's list selection
 * changes. <code>widgetDefaultSelected</code> is typically called when
 * ENTER is pressed the combo's text area.
 * </p>
 * 
 * @param listener the listener which should be notified when the user
 *            changes the receiver's selection
 * 
 * @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 SelectionListener
 * @see #removeSelectionListener
 * @see SelectionEvent
 */
public void addSelectionListener(SelectionListener listener) {
	checkWidget();
	if (listener == null)
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Selection, typedListener);
	addListener(SWT.DefaultSelection, typedListener);
}
 
源代码22 项目: nebula   文件: CustomCombo.java
/**
 * Adds the listener to the collection of listeners who will be notified
 * when the receiver's text is verified, by sending it one of the messages
 * defined in the <code>VerifyListener</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 VerifyListener
 * @see #removeVerifyListener
 * 
 * @since 3.3
 */
public void addVerifyListener(VerifyListener listener) {
	checkWidget();
	if (listener == null)
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Verify, typedListener);
}
 
源代码23 项目: nebula   文件: AbstractCombo.java
/**
 * Adds the listener to the collection of listeners who will
 * be notified when the receiver's text is modified, by sending
 * it one of the messages defined in the <code>ModifyListener</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 ModifyListener
 * @see #removeModifyListener
 */
public void addModifyListener(ModifyListener listener) {
	checkWidget();
	if (listener == null)
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Modify, typedListener);
}
 
源代码24 项目: nebula   文件: AbstractCombo.java
/**
 * Adds the listener to the collection of listeners who will
 * be notified when the receiver's selection changes, by sending
 * it one of the messages defined in the <code>SelectionListener</code>
 * interface.
 * <p>
 * <code>widgetSelected</code> is called when the combo's list selection changes.
 * <code>widgetDefaultSelected</code> is typically called when ENTER is pressed the combo's text area.
 * </p>
 *
 * @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 SelectionListener
 * @see #removeSelectionListener
 * @see SelectionEvent
 */
public void addSelectionListener(SelectionListener listener) {
	checkWidget();
	if (listener == null)
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Selection, typedListener);
	addListener(SWT.DefaultSelection, typedListener);
}
 
源代码25 项目: nebula   文件: AbstractCombo.java
/**
 * Adds the listener to the collection of listeners who will
 * be notified when the receiver's text is verified, by sending
 * it one of the messages defined in the <code>VerifyListener</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 VerifyListener
 * @see #removeVerifyListener
 */
public void addVerifyListener(VerifyListener listener) {
	checkWidget();
	if (listener == null)
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Verify, typedListener);
}
 
源代码26 项目: nebula   文件: DateChooser.java
/**
 * Adds the listener to the collection of listeners who will
 * be notified when the receiver's selection changes, by sending
 * it one of the messages defined in the <code>SelectionListener</code>
 * interface.
 * <p>
 * <code>widgetSelected</code> is called when the dates selection changes.
 * </p>
 *
 * @param lsnr the listener which should be notified
 * @see SelectionListener
 * @see #removeSelectionListener
 */
public void addSelectionListener(SelectionListener lsnr) {
	checkWidget();
	if (lsnr == null) {
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	}
	final TypedListener typedListener = new TypedListener(lsnr);
	addListener(SWT.Selection, typedListener);
}
 
源代码27 项目: nebula   文件: TableCombo.java
/**
 * Adds the listener to the collection of listeners who will be notified when
 * the receiver's text is modified, by sending it one of the messages defined in
 * the <code>ModifyListener</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 ModifyListener
 * @see #removeModifyListener
 */
public void addModifyListener(final ModifyListener listener) {
	checkWidget();
	if (listener == null) {
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	}
	final TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Modify, typedListener);
}
 
源代码28 项目: nebula   文件: TableCombo.java
/**
 * Adds the listener to the collection of listeners who will be notified when
 * the user changes the receiver's selection, by sending it one of the messages
 * defined in the <code>SelectionListener</code> interface.
 * <p>
 * <code>widgetSelected</code> is called when the combo's list selection
 * changes. <code>widgetDefaultSelected</code> is typically called when ENTER is
 * pressed the combo's text area.
 * </p>
 *
 * @param listener
 *            the listener which should be notified when the user changes the
 *            receiver's selection
 *
 * @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 SelectionListener
 * @see #removeSelectionListener
 * @see SelectionEvent
 */
public void addSelectionListener(final SelectionListener listener) {
	checkWidget();
	if (listener == null) {
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	}

	final TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Selection, typedListener);
	addListener(SWT.DefaultSelection, typedListener);
}
 
源代码29 项目: nebula   文件: TableCombo.java
/**
 * Adds the listener to the collection of listeners who will be notified when
 * the receiver's text is verified, by sending it one of the messages defined in
 * the <code>VerifyListener</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 VerifyListener
 * @see #removeVerifyListener
 *
 * @since 3.3
 */
public void addVerifyListener(final VerifyListener listener) {
	checkWidget();
	if (listener == null) {
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	}
	final TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Verify, typedListener);
}
 
源代码30 项目: nebula   文件: CTreeCombo.java
/**
 * Adds the listener to the collection of listeners who will be notified when
 * the user changes the receiver's selection, by sending it one of the messages
 * defined in the <code>SelectionListener</code> interface.
 * <p>
 * <code>widgetSelected</code> is called when the combo's list selection
 * changes. <code>widgetDefaultSelected</code> is typically called when ENTER is
 * pressed the combo's text area.
 * </p>
 *
 * @param listener
 *            the listener which should be notified when the user changes the
 *            receiver's selection
 *
 * @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 SelectionListener
 * @see #removeSelectionListener
 * @see SelectionEvent
 */
public void addSelectionListener(final SelectionListener listener) {
	checkWidget();
	if (listener == null) {
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	}

	final TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Selection, typedListener);
	addListener(SWT.DefaultSelection, typedListener);
}
 
 类所在包
 同包方法