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); } }
public Popup(final IPopupProvider provider, final Widget... controls) { 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); 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); } }
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; }
public void setChartDisplayStrategy(ChartDisplayStrategy chartDisplayStrategy) { this.chartDisplayStrategy = chartDisplayStrategy; //XXX XXX if (MainGui.viewEventsMenuItem.getSelection()) { MainGui.viewEventsMenuItem.setSelection(false); Listener[] listeners = MainGui.viewEventsMenuItem.getListeners(SWT.Selection); ((SelectionListener)((TypedListener)listeners[0]).getEventListener()).widgetSelected(null); updateCharts(true); } else { updateCharts(true); } }
protected void addSelectionListener( SelectionListener listener ) { if ( listener == null ) throw new SWTError( SWT.ERROR_NULL_ARGUMENT ); addListener( SWT.Selection, new TypedListener( listener ) ); }
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); }
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); }
@Override public void addSelectionListener(final SelectionListener listener) { Check.notNull(listener, "listener"); //$NON-NLS-1$ addListener(SWT.Selection, new TypedListener(listener)); }
public void addSelectionListener(final SelectionListener listener) { addListener(SWT.Selection, new TypedListener(listener)); }
@Override public void addMouseListener(final MouseListener listener) { addListener(SWT.MouseDown, new TypedListener(listener)); addListener(SWT.MouseUp, new TypedListener(listener)); addListener(SWT.MouseDoubleClick, new TypedListener(listener)); }
@Override public void removeMouseListener(final MouseListener listener) { removeListener(SWT.MouseDown, listener); removeListener(SWT.MouseUp, listener); removeListener(SWT.MouseDoubleClick, new TypedListener(listener)); }
@Override public void addMouseMoveListener(final MouseMoveListener listener) { addListener(SWT.MouseMove, new TypedListener(listener)); }
public void addModifyListener(final ModifyListener modifyListener) { addListener(SWT.Modify, new TypedListener(modifyListener)); }
/** * This is called when the parent menu is displayed. An arm listener is added to each menu item * in the parent menu. * * @param menuEvent * @param menuParentControl * @param isAutoOpen * @param autoOpenDelay * @param menuPosition * @param toolTip */ public void onShowParentMenu( final MenuEvent menuEvent, final Control menuParentControl, final boolean isAutoOpen, final boolean isAnimationEnabled, final int autoOpenDelay, final Point menuPosition, final ToolTip toolTip) { _menuParentControl = menuParentControl; _isAutoOpen = isAutoOpen; _isAnimationEnabled = isAnimationEnabled; _autoOpenDelay = autoOpenDelay; _advMenuPosition = menuPosition; _toolTip = toolTip; final Menu menu = (Menu) menuEvent.widget; // add arm listener to each menu item for (final MenuItem menuItem : menu.getItems()) { /* * check if an arm listener is already set */ final Listener[] itemArmListeners = menuItem.getListeners(SWT.Arm); boolean isArmAvailable = false; for (final Listener listener : itemArmListeners) { if (listener instanceof TypedListener) { if (((TypedListener) listener).getEventListener() instanceof ContextArmListener) { isArmAvailable = true; break; } } } if (isArmAvailable == false) { menuItem.addArmListener(_contextArmListener); } /* * it happened that the text of the menu item was not reset when the menu was opened * with a mouse click and not automatically */ if (_armMenuItem != null && _armMenuItem.isDisposed() == false && _armMenuItem == menuItem) { _armMenuItem.setText(_armActionText); } } // reset data from previous menu final IAction action = _actionContributionItem.getAction(); if (action instanceof IAdvancedMenuForActions) { ((IAdvancedMenuForActions) action).resetData(); } }
public void addSelectionListener(SelectionListener listener) { if (listener == null) throw new SWTError(SWT.ERROR_NULL_ARGUMENT); addListener(SWT.Selection, new TypedListener(listener)); }
/** * Adds a selection listener * @param listener */ public void addSelectionListener(SelectionListener listener) { super.checkWidget(); addListener(SWT.Selection, new TypedListener(listener)); }
public void addSelectionListener( SelectionListener listener ) { addListener( SWT.Selection, new TypedListener( listener ) ); }
private void addListener( Control el, int event, TypedListener listener ) { if ( ArrayUtils.contains( el.getListeners( event ), listener ) ) { return; } el.addListener( event, listener ); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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)); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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(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); }
/** * Adds the listener to the collection of listeners who will be notified when ratings stars has * been modified 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> * 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(final SelectionListener listener) { checkWidget(); if (listener == null) { SWT.error(SWT.ERROR_NULL_ARGUMENT); } final TypedListener typedListener = new TypedListener(listener); addListener(SWT.Selection, typedListener); }
/** * 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); }
/** * 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} interface. * <p> * Cell selection events may have <code>Event.detail = SWT.DRAG</code> when the * user is drag selecting multiple cells. A follow up selection event will be generated * when the drag is complete. * * @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); } addListener(SWT.Selection, new TypedListener(listener)); addListener(SWT.DefaultSelection, new TypedListener(listener)); }
/** * Adds the listener to the collection of listeners who will be notified * when the receiver's items changes, by sending it one of the messages * defined in the {@code TreeListener} 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> * @see TreeListener * @see #removeTreeListener * @see org.eclipse.swt.events.TreeEvent */ public void addTreeListener(TreeListener listener) { checkWidget(); if (listener == null) { SWT.error(SWT.ERROR_NULL_ARGUMENT); } addListener(SWT.Expand, new TypedListener(listener)); addListener(SWT.Collapse, new TypedListener(listener)); }
/** * 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)); }
/** * 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); }