org.eclipse.swt.events.MouseListener Java Examples

The following examples show how to use org.eclipse.swt.events.MouseListener. 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: GeoMap.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Removes listener from appropriate listener lists depending on the listener
 * interfaces that are implemented.
 * 
 * @param listener
 *            the listener
 */
public void removeMouseHandler(EventListener listener) {
	if (listener instanceof MouseListener) {
		removeMouseListener((MouseListener) listener);
	}
	if (listener instanceof MouseMoveListener) {
		removeMouseMoveListener((MouseMoveListener) listener);
	}
	if (listener instanceof MouseTrackListener) {
		removeMouseTrackListener((MouseTrackListener) listener);
	}
	if (listener instanceof MouseWheelListener) {
		removeMouseWheelListener((MouseWheelListener) listener);
	}
	if (listener instanceof PaintListener) {
		removePaintListener((PaintListener) listener);
	}
}
 
Example #2
Source File: GeoMap.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Adds listener to appropriate listener lists depending on the listener
 * interfaces that are implemented.
 * 
 * @param listener
 *            the listener
 */
public void addMouseHandler(EventListener listener) {
	if (listener instanceof MouseListener) {
		addMouseListener((MouseListener) listener);
	}
	if (listener instanceof MouseMoveListener) {
		addMouseMoveListener((MouseMoveListener) listener);
	}
	if (listener instanceof MouseTrackListener) {
		addMouseTrackListener((MouseTrackListener) listener);
	}
	if (listener instanceof MouseWheelListener) {
		addMouseWheelListener((MouseWheelListener) listener);
	}
	if (listener instanceof PaintListener) {
		addPaintListener((PaintListener) listener);
	}
}
 
Example #3
Source File: BaseMouseProvider.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Method to register the provider to chart viewer.
 */
protected void register() {
    IPlotArea plotArea = getChart().getPlotArea();
    Control control = plotArea.getControl();
    if (this instanceof MouseListener) {
        control.addMouseListener((MouseListener) this);
    }
    if (this instanceof MouseMoveListener) {
        control.addMouseMoveListener((MouseMoveListener) this);
    }
    if (this instanceof MouseWheelListener) {
        control.addMouseWheelListener((MouseWheelListener) this);
    }
    if (this instanceof MouseTrackListener) {
        control.addMouseTrackListener((MouseTrackListener) this);
    }
    if (this instanceof ICustomPaintListener) {
        plotArea.addCustomPaintListener((ICustomPaintListener) this);
    } else if (this instanceof PaintListener) {
        control.addPaintListener((PaintListener) this);
    }
    TmfAbstractToolTipHandler tooltipHandler = getTooltipHandler();
    if(tooltipHandler != null) {
        tooltipHandler.activateHoverHelp(control);
    }
}
 
Example #4
Source File: TwistieLabel.java    From BiglyBT with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Remove the mouse listener from the control and also the <code>titleLabel</code>
 */
@Override
public void removeMouseListener(MouseListener listener) {
	if (null != titleLabel) {
		titleLabel.removeMouseListener(listener);
	}
	super.removeMouseListener(listener);
}
 
Example #5
Source File: TimeSlice.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void addMouseListener(MouseListener listener) {
	super.addMouseListener(listener);
	for (Iterator columnsIter = columns.iterator(); columnsIter.hasNext();) {
		TimeSlot cell = (TimeSlot) columnsIter.next();
		cell.addMouseListener(listener);
	}
}
 
Example #6
Source File: TimeSlice.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void removeMouseListener(MouseListener listener) {
	super.removeMouseListener(listener);
	for (Iterator columnsIter = columns.iterator(); columnsIter.hasNext();) {
		TimeSlot cell = (TimeSlot) columnsIter.next();
		cell.removeMouseListener(listener);
	}
}
 
Example #7
Source File: TmfBaseProvider.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Method to register the provider to chart viewer.
 */
protected void register() {
    IPlotArea plotArea = getChart().getPlotArea();
    Control control = plotArea.getControl();
    if (this instanceof MouseListener) {
        control.addMouseListener((MouseListener) this);
    }
    if (this instanceof MouseMoveListener) {
        control.addMouseMoveListener((MouseMoveListener) this);
    }
    if (this instanceof MouseWheelListener) {
        control.addMouseWheelListener((MouseWheelListener) this);
    }
    if (this instanceof MouseTrackListener) {
        control.addMouseTrackListener((MouseTrackListener) this);
    }
    if (this instanceof ICustomPaintListener) {
        plotArea.addCustomPaintListener((ICustomPaintListener) this);
    } else if (this instanceof PaintListener) {
        control.addPaintListener((PaintListener) this);
    }
    TmfAbstractToolTipHandler tooltipHandler = getTooltipHandler();
    if(tooltipHandler != null) {
        tooltipHandler.activateHoverHelp(control);
    }


}
 
Example #8
Source File: TmfBaseProvider.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Method to deregister the provider from chart viewer.
 */
protected void deregister() {
    IPlotArea plotArea = getChart().getPlotArea();
    if (plotArea == null) {
        return;
    }
    Control control = plotArea.getControl();
    if (!control.isDisposed()) {
        if (this instanceof MouseListener) {
            control.removeMouseListener((MouseListener) this);
        }
        if (this instanceof MouseMoveListener) {
            control.removeMouseMoveListener((MouseMoveListener) this);
        }
        if (this instanceof MouseWheelListener) {
            control.removeMouseWheelListener((MouseWheelListener) this);
        }
        if (this instanceof MouseTrackListener) {
            control.removeMouseTrackListener((MouseTrackListener) this);
        }
        if (this instanceof ICustomPaintListener) {
            plotArea.removeCustomPaintListener((ICustomPaintListener) this);
        } else if (this instanceof PaintListener) {
            control.removePaintListener((PaintListener) this);
        }

        TmfAbstractToolTipHandler tooltipHandler = getTooltipHandler();
        if(tooltipHandler != null) {
            tooltipHandler.deactivateHoverHelp(control);
        }
    }
}
 
Example #9
Source File: BaseMouseProvider.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Method to deregister the provider from chart viewer.
 */
protected void deregister() {
    IPlotArea plotArea = getChart().getPlotArea();
    if (plotArea == null) {
        return;
    }
    Control control = plotArea.getControl();
    if (!control.isDisposed()) {
        if (this instanceof MouseListener) {
            control.removeMouseListener((MouseListener) this);
        }
        if (this instanceof MouseMoveListener) {
            control.removeMouseMoveListener((MouseMoveListener) this);
        }
        if (this instanceof MouseWheelListener) {
            control.removeMouseWheelListener((MouseWheelListener) this);
        }
        if (this instanceof MouseTrackListener) {
            control.removeMouseTrackListener((MouseTrackListener) this);
        }
        if (this instanceof ICustomPaintListener) {
            plotArea.removeCustomPaintListener((ICustomPaintListener) this);
        } else if (this instanceof PaintListener) {
            control.removePaintListener((PaintListener) this);
        }
        TmfAbstractToolTipHandler tooltipHandler = getTooltipHandler();
        if(tooltipHandler != null) {
            tooltipHandler.deactivateHoverHelp(control);
        }
    }
}
 
Example #10
Source File: ScrollView.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Remove the local Listener and add the new listener.
 *
 * @param nlistener the new listener
 */
public void replaceMouseListener(MouseListener nlistener) {
    if (fLocalMouseListener != null) {
        removeMouseListener(fLocalMouseListener);
        fLocalMouseListener = null;
    }
    fViewControl.addMouseListener(nlistener);
}
 
Example #11
Source File: DayEditorCalendarableItemControl.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void mouseDoubleClick(MouseEvent e) {
	e.widget = DayEditorCalendarableItemControl.this;
	for (Iterator listenerIter = mouseListeners.iterator(); listenerIter.hasNext();) {
		MouseListener l = (MouseListener) listenerIter.next();
		l.mouseDoubleClick(e);
	}
}
 
Example #12
Source File: DayEditorCalendarableItemControl.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void mouseDown(MouseEvent e) {
	e.widget = DayEditorCalendarableItemControl.this;
	for (Iterator listenerIter = mouseListeners.iterator(); listenerIter.hasNext();) {
		MouseListener l = (MouseListener) listenerIter.next();
		l.mouseDown(e);
	}
}
 
Example #13
Source File: MonthCalendar.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/** 
 * @see org.eclipse.swt.widgets.Control#addMouseListener(org.eclipse.swt.events.MouseListener)
 */
public void addMouseListener(MouseListener listener) {
	checkWidget();

	super.addMouseListener(listener);
	mouseListeners.add(listener);
}
 
Example #14
Source File: MonthCalendar.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void mouseDown(MouseEvent e) {
	Day day = getDay(e);
	Point coordinates = day.getMonthPosition();
	e.data = new MonthCalendarSelectedDay(day.getDate(), coordinates);

	for (Iterator<MouseListener> mouseListenersIter = mouseListeners.iterator(); mouseListenersIter.hasNext();) {
		MouseListener listener = (MouseListener) mouseListenersIter.next();
		listener.mouseDown(e);
	}
}
 
Example #15
Source File: MonthCalendar.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void mouseUp(MouseEvent e) {
	Day day = getDay(e);
	Point coordinates = day.getMonthPosition();
	e.data = new MonthCalendarSelectedDay(day.getDate(), coordinates);

	for (Iterator<MouseListener> mouseListenersIter = mouseListeners.iterator(); mouseListenersIter.hasNext();) {
		MouseListener listener = (MouseListener) mouseListenersIter.next();
		listener.mouseUp(e);
	}
}
 
Example #16
Source File: MonthCalendar.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void mouseDoubleClick(MouseEvent e) {
	Day day = getDay(e);
	Point coordinates = day.getMonthPosition();
	e.data = new MonthCalendarSelectedDay(day.getDate(), coordinates);

	for (Iterator<MouseListener> mouseListenersIter = mouseListeners.iterator(); mouseListenersIter.hasNext();) {
		MouseListener listener = (MouseListener) mouseListenersIter.next();
		listener.mouseDoubleClick(e);
	}
}
 
Example #17
Source File: Day.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void mouseDown(MouseEvent e) {
	setFocus();
	for (Iterator<MouseListener> i = mouseListeners.iterator(); i.hasNext();) {
		MouseListener listener = (MouseListener) i.next();
		listener.mouseDown(e);
	}
}
 
Example #18
Source File: SelectedResultView.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
private void addMouseListenerRecursively(Control control, MouseListener listener) {
	if (control instanceof Button) {
		control.setCursor(SWTResourceManager.getCursor(SWT.CURSOR_ARROW));
		return;
	}

	control.addMouseListener(listener);

	if (control instanceof Composite) {
		Composite composite = (Composite) control;
		for (Control child : composite.getChildren()) {
			addMouseListenerRecursively(child, listener);
		}
	}
}
 
Example #19
Source File: SearchResultView.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
private void addMouseListenerRecursively(Control control, MouseListener listener) {
	if (control instanceof Button) {
		return;
	}

	control.addMouseListener(listener);

	if (control instanceof Composite) {
		Composite composite = (Composite) control;
		for (Control child : composite.getChildren()) {
			addMouseListenerRecursively(child, listener);
		}
	}
}
 
Example #20
Source File: ChartAreaRenderer.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void removeMouseListener ( final ChartMouseListener listener )
{
    final MouseListener proxyListener = this.mouseListenerMap.remove ( listener );
    if ( proxyListener != null )
    {
        this.control.removeMouseListener ( proxyListener );
    }
}
 
Example #21
Source File: MonthCalendar.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/** 
 * @see org.eclipse.swt.widgets.Control#removeMouseListener(org.eclipse.swt.events.MouseListener)
 */
public void removeMouseListener(MouseListener listener) {
	checkWidget();

	super.removeMouseListener(listener);
	mouseListeners.remove(listener);
}
 
Example #22
Source File: TwistieLabel.java    From BiglyBT with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Add a mouse listener to the control and also the <code>titleLabel</code>
 */
@Override
public void addMouseListener(MouseListener listener) {
	if (null != titleLabel) {
		titleLabel.addMouseListener(listener);
	}
	super.addMouseListener(listener);
}
 
Example #23
Source File: DayEditorCalendarableItemControl.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void mouseUp(MouseEvent e) {
	e.widget = DayEditorCalendarableItemControl.this;
	for (Iterator listenerIter = mouseListeners.iterator(); listenerIter.hasNext();) {
		MouseListener l = (MouseListener) listenerIter.next();
		l.mouseUp(e);
	}
}
 
Example #24
Source File: ComponentHierarchy.java    From arx with Apache License 2.0 4 votes vote down vote up
/**
 * Adds a mouse listener
 * @param listener
 */
public void addMouseListener(MouseListener listener) {
    this.table.addMouseListener(listener);
    this.table.getControl().addMouseListener(listener);
}
 
Example #25
Source File: ChartComposite.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
     * Hook an SWT listener on the canvas where the chart is drawn.
     * The purpose of this method is to allow some degree of customization.
     *
     * @param listener The SWT listener to attach to the canvas.
     */
    public void addSWTListener(EventListener listener) {
        if (listener instanceof ControlListener) {
            this.canvas.addControlListener((ControlListener) listener);
        }
        else if (listener instanceof DisposeListener) {
            this.canvas.addDisposeListener((DisposeListener) listener);
//      }
//      else if (listener instanceof DragDetectListener) {
//          this.canvas.addDragDetectListener((DragDetectListener) listener);
        }
        else if (listener instanceof FocusListener) {
            this.canvas.addFocusListener((FocusListener) listener);
        }
        else if (listener instanceof HelpListener) {
            this.canvas.addHelpListener((HelpListener) listener);
        }
        else if (listener instanceof KeyListener) {
            this.canvas.addKeyListener((KeyListener) listener);
//      }
//      else if (listener instanceof MenuDetectListener) {
//          this.canvas.addMenuDetectListener((MenuDetectListener) listener);
        }
        else if (listener instanceof MouseListener) {
            this.canvas.addMouseListener((MouseListener) listener);
        }
        else if (listener instanceof MouseMoveListener) {
            this.canvas.addMouseMoveListener((MouseMoveListener) listener);
        }
        else if (listener instanceof MouseTrackListener) {
            this.canvas.addMouseTrackListener((MouseTrackListener) listener);
//      } else if (listener instanceof MouseWheelListener) {
//          this.canvas.addMouseWheelListener((MouseWheelListener) listener);
        }
        else if (listener instanceof PaintListener) {
            this.canvas.addPaintListener((PaintListener) listener);
        }
        else if (listener instanceof TraverseListener) {
            this.canvas.addTraverseListener((TraverseListener) listener);
        }
    }
 
Example #26
Source File: ChartComposite.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
     * Hook an SWT listener on the canvas where the chart is drawn.
     * The purpose of this method is to allow some degree of customization.
     *
     * @param listener The SWT listener to attach to the canvas.
     */
    public void addSWTListener(EventListener listener) {
        if (listener instanceof ControlListener) {
            this.canvas.addControlListener((ControlListener) listener);
        }
        else if (listener instanceof DisposeListener) {
            this.canvas.addDisposeListener((DisposeListener) listener);
//      }
//      else if (listener instanceof DragDetectListener) {
//          this.canvas.addDragDetectListener((DragDetectListener) listener);
        }
        else if (listener instanceof FocusListener) {
            this.canvas.addFocusListener((FocusListener) listener);
        }
        else if (listener instanceof HelpListener) {
            this.canvas.addHelpListener((HelpListener) listener);
        }
        else if (listener instanceof KeyListener) {
            this.canvas.addKeyListener((KeyListener) listener);
//      }
//      else if (listener instanceof MenuDetectListener) {
//          this.canvas.addMenuDetectListener((MenuDetectListener) listener);
        }
        else if (listener instanceof MouseListener) {
            this.canvas.addMouseListener((MouseListener) listener);
        }
        else if (listener instanceof MouseMoveListener) {
            this.canvas.addMouseMoveListener((MouseMoveListener) listener);
        }
        else if (listener instanceof MouseTrackListener) {
            this.canvas.addMouseTrackListener((MouseTrackListener) listener);
//      } else if (listener instanceof MouseWheelListener) {
//          this.canvas.addMouseWheelListener((MouseWheelListener) listener);
        }
        else if (listener instanceof PaintListener) {
            this.canvas.addPaintListener((PaintListener) listener);
        }
        else if (listener instanceof TraverseListener) {
            this.canvas.addTraverseListener((TraverseListener) listener);
        }
    }
 
Example #27
Source File: ChartComposite.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Hook an SWT listener on the canvas where the chart is drawn.
 * The purpose of this method is to allow some degree of customization.
 * @param listener The SWT listener to attach to the canvas.
 */
public void addSWTListener(SWTEventListener listener) {
    if (listener instanceof ControlListener) {
        this.canvas.addControlListener((ControlListener) listener);
    } 
    else if (listener instanceof DisposeListener) {
        this.canvas.addDisposeListener((DisposeListener) listener);
    } 
    else if (listener instanceof DragDetectListener) {
        this.canvas.addDragDetectListener((DragDetectListener) listener);
    } 
    else if (listener instanceof FocusListener) {
        this.canvas.addFocusListener((FocusListener) listener);
    } 
    else if (listener instanceof HelpListener) {
        this.canvas.addHelpListener((HelpListener) listener);
    } 
    else if (listener instanceof KeyListener) {
        this.canvas.addKeyListener((KeyListener) listener);
    } 
    else if (listener instanceof MenuDetectListener) {
        this.canvas.addMenuDetectListener((MenuDetectListener) listener);
    } 
    else if (listener instanceof MouseListener) {
        this.canvas.addMouseListener((MouseListener) listener);
    } 
    else if (listener instanceof MouseMoveListener) {
        this.canvas.addMouseMoveListener((MouseMoveListener) listener);
    } 
    else if (listener instanceof MouseTrackListener) {
        this.canvas.addMouseTrackListener((MouseTrackListener) listener);
    } 
    else if (listener instanceof MouseWheelListener) {
        this.canvas.addMouseWheelListener((MouseWheelListener) listener);
    } 
    else if (listener instanceof PaintListener) {
        this.canvas.addPaintListener((PaintListener) listener);
    } 
    else if (listener instanceof TraverseListener) {
        this.canvas.addTraverseListener((TraverseListener) listener);
    } 
}
 
Example #28
Source File: ChartComposite.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Hook an SWT listener on the canvas where the chart is drawn.
 * The purpose of this method is to allow some degree of customization.
 *
 * @param listener The SWT listener to attach to the canvas.
 */
public void addSWTListener(EventListener listener) {
    if (listener instanceof ControlListener) {
        this.canvas.addControlListener((ControlListener) listener);
    }
    else if (listener instanceof DisposeListener) {
        this.canvas.addDisposeListener((DisposeListener) listener);
    }
    else if (listener instanceof DragDetectListener) {
        this.canvas.addDragDetectListener((DragDetectListener) listener);
    }
    else if (listener instanceof FocusListener) {
        this.canvas.addFocusListener((FocusListener) listener);
    }
    else if (listener instanceof HelpListener) {
        this.canvas.addHelpListener((HelpListener) listener);
    }
    else if (listener instanceof KeyListener) {
        this.canvas.addKeyListener((KeyListener) listener);
    }
    else if (listener instanceof MenuDetectListener) {
        this.canvas.addMenuDetectListener((MenuDetectListener) listener);
    }
    else if (listener instanceof MouseListener) {
        this.canvas.addMouseListener((MouseListener) listener);
    }
    else if (listener instanceof MouseMoveListener) {
        this.canvas.addMouseMoveListener((MouseMoveListener) listener);
    }
    else if (listener instanceof MouseTrackListener) {
        this.canvas.addMouseTrackListener((MouseTrackListener) listener);
    }
    else if (listener instanceof MouseWheelListener) {
        this.canvas.addMouseWheelListener((MouseWheelListener) listener);
    }
    else if (listener instanceof PaintListener) {
        this.canvas.addPaintListener((PaintListener) listener);
    }
    else if (listener instanceof TraverseListener) {
        this.canvas.addTraverseListener((TraverseListener) listener);
    }
}
 
Example #29
Source File: ChartComposite.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
     * Hook an SWT listener on the canvas where the chart is drawn.
     * The purpose of this method is to allow some degree of customization.
     *
     * @param listener The SWT listener to attach to the canvas.
     */
    public void addSWTListener(EventListener listener) {
        if (listener instanceof ControlListener) {
            this.canvas.addControlListener((ControlListener) listener);
        }
        else if (listener instanceof DisposeListener) {
            this.canvas.addDisposeListener((DisposeListener) listener);
//      }
//      else if (listener instanceof DragDetectListener) {
//          this.canvas.addDragDetectListener((DragDetectListener) listener);
        }
        else if (listener instanceof FocusListener) {
            this.canvas.addFocusListener((FocusListener) listener);
        }
        else if (listener instanceof HelpListener) {
            this.canvas.addHelpListener((HelpListener) listener);
        }
        else if (listener instanceof KeyListener) {
            this.canvas.addKeyListener((KeyListener) listener);
//      }
//      else if (listener instanceof MenuDetectListener) {
//          this.canvas.addMenuDetectListener((MenuDetectListener) listener);
        }
        else if (listener instanceof MouseListener) {
            this.canvas.addMouseListener((MouseListener) listener);
        }
        else if (listener instanceof MouseMoveListener) {
            this.canvas.addMouseMoveListener((MouseMoveListener) listener);
        }
        else if (listener instanceof MouseTrackListener) {
            this.canvas.addMouseTrackListener((MouseTrackListener) listener);
//      } else if (listener instanceof MouseWheelListener) {
//          this.canvas.addMouseWheelListener((MouseWheelListener) listener);
        }
        else if (listener instanceof PaintListener) {
            this.canvas.addPaintListener((PaintListener) listener);
        }
        else if (listener instanceof TraverseListener) {
            this.canvas.addTraverseListener((TraverseListener) listener);
        }
    }
 
Example #30
Source File: BufferedTruncatedLabel.java    From BiglyBT with GNU General Public License v2.0 4 votes vote down vote up
public void addMouseListener(MouseListener listener) {
  label.addMouseListener(listener);
}