org.eclipse.swt.widgets.TypedListener Java Examples

The following examples show how to use org.eclipse.swt.widgets.TypedListener. 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: Popup2.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
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);
	}
}
 
Example #2
Source File: CommonMergeViewer.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example #3
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 #4
Source File: CTree.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * 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);
	}
}
 
Example #5
Source File: CSpinner.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void addSelectionListener( SelectionListener listener )
{

	if ( listener == null )
		throw new SWTError( SWT.ERROR_NULL_ARGUMENT );
	addListener( SWT.Selection, new TypedListener( listener ) );
}
 
Example #6
Source File: DayDateCombo.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
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);
	
}
 
Example #7
Source File: SplitButton.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * 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();
			}
		}
	}
}
 
Example #8
Source File: SWTNullableSpinner.java    From atdl4j with MIT License 4 votes vote down vote up
public void addSelectionListener(SelectionListener listener) {
	if (listener == null)
		throw new SWTError(SWT.ERROR_NULL_ARGUMENT);
	addListener(SWT.Selection, new TypedListener(listener));
}
 
Example #9
Source File: JobStepDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addListener( Control el, int event, TypedListener listener ) {
  if ( ArrayUtils.contains( el.getListeners( event ), listener ) ) {
    return;
  }
  el.addListener( event, listener );
}
 
Example #10
Source File: PGroupToolItem.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public void addSelectionListener(SelectionListener listener) {
	TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Selection, typedListener);
	addListener(SWT.DefaultSelection, typedListener);
}
 
Example #11
Source File: TableCombo.java    From Pydev with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * 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);
}
 
Example #12
Source File: TableCombo.java    From Pydev with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * 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);
}
 
Example #13
Source File: DatePickerCombo.java    From elexis-3-core with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Adds the listener to receive events.
 * 
 * @param listener
 *            the listener
 * 
 * @exception SWTError
 *                (ERROR_THREAD_INVALID_ACCESS) when called from the wrong thread
 * @exception SWTError
 *                (ERROR_WIDGET_DISPOSED) when the widget has been disposed
 * @exception SWTError
 *                (ERROR_NULL_ARGUMENT) when listener is null
 * 
 * @see ModifyListener
 * @see #removeModifyListener(ModifyListener)
 */
public void addModifyListener(ModifyListener listener){
	checkWidget();
	
	if (listener == null) {
		SWT.error(SWT.ERROR_NULL_ARGUMENT);
	}
	
	TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Modify, typedListener);
}
 
Example #14
Source File: DatePickerCombo.java    From elexis-3-core with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Adds the listener to receive events.
 * 
 * @param listener
 *            the listener
 * 
 * @exception SWTError
 *                (ERROR_THREAD_INVALID_ACCESS) when called from the wrong thread
 * @exception SWTError
 *                (ERROR_WIDGET_DISPOSED) when the widget has been disposed
 * @exception SWTError
 *                (ERROR_NULL_ARGUMENT) when listener is null
 * 
 * @see SelectionListener
 * @see #removeSelectionListener(SelectionListener)
 */
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);
}
 
Example #15
Source File: DatePicker.java    From elexis-3-core with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Adds the listener to receive events.
 * 
 * @param listener
 *            the listener
 * 
 * @exception SWTError
 *                (ERROR_THREAD_INVALID_ACCESS) when called from the wrong thread
 * @exception SWTError
 *                (ERROR_WIDGET_DISPOSED) when the widget has been disposed
 * @exception SWTError
 *                (ERROR_NULL_ARGUMENT) when listener is null
 * 
 * @see SelectionListener
 * @see #removeSelectionListener
 */
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);
}
 
Example #16
Source File: TableCombo.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 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);
}
 
Example #17
Source File: TextIconButton.java    From swt-bling with MIT License 3 votes vote down vote up
/**
 * 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>
 *
 * @param listener the listener which should be notified
 * @throws IllegalArgumentException <ul>
 *                                  <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *                                  </ul>
 * @throws 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);
}
 
Example #18
Source File: TableCombo.java    From Pydev with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * 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);
}
 
Example #19
Source File: TableCombo.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 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);
}
 
Example #20
Source File: CCombo.java    From birt with Eclipse Public License 1.0 3 votes vote down vote up
/**	 
* Adds the listener to receive events.
* <p>
*
* @param listener the listener
*
* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
*	when called from the wrong thread
* @exception SWTError(ERROR_WIDGET_DISPOSED)
*	when the widget has been disposed
* @exception SWTError(ERROR_NULL_ARGUMENT)
*	when listener is null
*/
public void addModifyListener (ModifyListener listener) {
	checkWidget();
	if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
	TypedListener typedListener = new TypedListener (listener);
	addListener (SWT.Modify, typedListener);
}
 
Example #21
Source File: TableCombo.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 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);
}
 
Example #22
Source File: TableCombo.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 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);
}
 
Example #23
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 #24
Source File: GridColumn.java    From tmxeditor8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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);
}
 
Example #25
Source File: GridColumn.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 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));
}
 
Example #26
Source File: GridItem.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 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);
}
 
Example #27
Source File: SwtHexEdit.java    From Flashtool with GNU General Public License v3.0 3 votes vote down vote up
/**
 * 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) {
	TypedListener typedListener = new TypedListener (listener);
	addListener (SWT.Modify, typedListener);}
}
 
Example #28
Source File: TableCombo.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 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);
}
 
Example #29
Source File: TableCombo.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 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);
}
 
Example #30
Source File: GridItem.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 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);
}