本文整理了Java中org.eclipse.swt.widgets.Control.addMouseTrackListener()
方法的一些代码示例,展示了Control.addMouseTrackListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Control.addMouseTrackListener()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Control
类名称:Control
方法名:addMouseTrackListener
[英]Adds the listener to the collection of listeners who will be notified when the mouse passes or hovers over controls, by sending it one of the messages defined in the MouseTrackListener
interface.
[中]通过发送MouseTrackListener
界面中定义的消息之一,将侦听器添加到侦听器集合中,当鼠标经过或悬停在控件上时,将通知这些侦听器。
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui
/**
* @param infoControl
* @param control
* @param provider
*/
public static void addHoverListenerToControl(final IInformationControl infoControl, final Control control, final IControlHoverContentProvider provider) {
control.addMouseTrackListener(new MouseTrackListener() {
@Override
public void mouseEnter(MouseEvent e) {
}
@Override
public void mouseExit(MouseEvent e) {
if (infoControl instanceof PDEDefaultInformationControl && ((PDEDefaultInformationControl) infoControl).isDisposed())
return;
infoControl.setVisible(false);
}
@Override
public void mouseHover(MouseEvent e) {
if (infoControl instanceof PDEDefaultInformationControl && ((PDEDefaultInformationControl) infoControl).isDisposed())
return;
String text = provider.getHoverContent(control);
if (text == null || text.trim().length() == 0)
return;
updateHover(infoControl, text);
infoControl.setLocation(control.toDisplay(new Point(10, 25)));
infoControl.setVisible(true);
}
});
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text
/**
* Starts this mouse tracker. The given control becomes this tracker's subject control.
* Installs itself as mouse track listener on the subject control. The mouse move listener
* gets installed on the area control. The subject control is the element the hover element
* is attached to. The area control is the container that holds the subject control. It
* denotes the area to be tracked for mouse move events while the hover is open. Usually
* this should be the root composite of the current view. If the area is too small, the
* hover will not close correctly on some occasions.
*
* @param subjectControl the subject control
* @param areaControl the area control
* @since 3.11
*/
public void start(Control subjectControl, Control areaControl) {
fSubjectCOntrol= subjectControl;
fAreaCOntrol= areaControl;
if (fSubjectControl != null && !fSubjectControl.isDisposed())
fSubjectControl.addMouseTrackListener(this);
fIsInRestartMode= false;
fIsComputing= false;
fMouseLostWhileComputing= false;
fShellDeactivatedWhileComputing= false;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text
/**
* Starts this mouse tracker. The given control becomes this tracker's subject control.
* Installs itself as mouse track listener on the subject control. The mouse move listener
* gets installed on the area control. The subject control is the element the hover element
* is attached to. The area control is the container that holds the subject control. It
* denotes the area to be tracked for mouse move events while the hover is open. Usually
* this should be the root composite of the current view. If the area is too small, the
* hover will not close correctly on some occasions.
*
* @param subjectControl the subject control
* @param areaControl the area control
* @since 3.11
*/
public void start(Control subjectControl, Control areaControl) {
fSubjectCOntrol= subjectControl;
fAreaCOntrol= areaControl;
if (fSubjectControl != null && !fSubjectControl.isDisposed())
fSubjectControl.addMouseTrackListener(this);
fIsInRestartMode= false;
fIsComputing= false;
fMouseLostWhileComputing= false;
fShellDeactivatedWhileComputing= false;
}
代码示例来源:origin: org.eclipse.e4.ui.css/swt
public void initialize() {
super.initialize();
if (!dynamicEnabled) return;
Control cOntrol= getControl();
// Add focus listener
control.addFocusListener(focusListener);
// Add mouse track listener
control.addMouseTrackListener(mouseHoverListener);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt
@Override
public void initialize() {
super.initialize();
if (!dynamicEnabled) {
return;
}
Control cOntrol= getControl();
// Add focus listener
control.addFocusListener(focusListener);
// Add mouse track listener
control.addMouseTrackListener(mouseHoverListener);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text
control. addMouseTrackListener((MouseTrackListener) listener);
return;
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text
control. addMouseTrackListener((MouseTrackListener) listener);
return;
代码示例来源:origin: BiglySoftware/BiglyBT
/**
* Adds mousetracklistener to composite and all it's children
*
* @param parent Composite to start at
* @param listener Listener to add
*/
private void addMouseTrackListener(Composite parent,
MouseTrackListener listener) {
if (parent == null || listener == null || parent.isDisposed())
return;
parent.addMouseTrackListener(listener);
Control[] children = parent.getChildren();
for (int i = 0; i
if (control instanceof Composite)
addMouseTrackListener((Composite) control, listener);
else
control.addMouseTrackListener(listener);
}
}
代码示例来源:origin: org.eclipse/org.eclipse.help.ui
/**
* @param control
* org.eclipse.swt.widgets.Control
* @param listener
* org.eclipse.help.ui.internal.IHyperlinkListener
*/
public void registerHyperlink(Control control, IHyperlinkListener listener) {
if (background != null)
control.setBackground(background);
if (foreground != null)
control.setForeground(foreground);
control.addMouseListener(this);
control.addMouseTrackListener(this);
control.addListener(SWT.DefaultSelection, this);
if (hyperlinkUnderlineMode == UNDERLINE_ALWAYS)
control.addPaintListener(this);
hyperlinkListeners.put(control, listener);
removeDisposedLinks();
}
public IHyperlinkListener getLinkListener(Control c) {
代码示例来源:origin: org.xworker/xworker_swt
if(!SwtUtils.isRWT()) {
control.addPaintListener(designer.listener);
control.addMouseTrackListener(designer.listener);
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text
control.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseExit(MouseEvent e) {
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text
control.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseExit(MouseEvent e) {
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text
/**
* Ensures that the column is fully instantiated, i.e. has a control, and that the viewer is
* visible.
*/
private void connectIfNeeded() {
if (isConnected() || fParentRuler == null)
return;
fViewer= fParentRuler.getTextViewer();
if (fViewer == null)
return;
fWidget= fViewer.getTextWidget();
if (fWidget == null)
return;
fCOntrol= fColumn.getControl();
if (fCOntrol== null)
return;
fControl.addMouseTrackListener(fMouseHandler);
fControl.addMouseMoveListener(fMouseHandler);
fControl.addListener(SWT.MouseUp, fMouseHandler);
fControl.addListener(SWT.MouseDown, fMouseHandler);
fControl.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
handleDispose();
}
});
fRevisionSelectionProvider.install(fViewer);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text
/**
* Ensures that the column is fully instantiated, i.e. has a control, and that the viewer is
* visible.
*/
private void connectIfNeeded() {
if (isConnected() || fParentRuler == null)
return;
fViewer= fParentRuler.getTextViewer();
if (fViewer == null)
return;
fWidget= fViewer.getTextWidget();
if (fWidget == null)
return;
fCOntrol= fColumn.getControl();
if (fCOntrol== null)
return;
fControl.addMouseTrackListener(fMouseHandler);
fControl.addMouseMoveListener(fMouseHandler);
fControl.addListener(SWT.MouseUp, fMouseHandler);
fControl.addListener(SWT.MouseDown, fMouseHandler);
fControl.addDisposeListener(e -> handleDispose());
fRevisionSelectionProvider.install(fViewer);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text
@Override
public void start(Rectangle subjectArea) {
if (fIsActive) return;
fIsActive= true;
fSubjectArea= subjectArea;
fInformationControlToClose.addDisposeListener(this);
if (fSubjectControl != null && !fSubjectControl.isDisposed()) {
fSubjectControl.addMouseListener(this);
fSubjectControl.addMouseMoveListener(this);
fSubjectControl.addMouseTrackListener(this);
fSubjectControl.getShell().addShellListener(this);
fSubjectControl.addControlListener(this);
fSubjectControl.addKeyListener(this);
fDisplay= fSubjectControl.getDisplay();
if (!fDisplay.isDisposed() && fHideOnMouseWheel) {
fHasWheelFilter= true;
fDisplay.addFilter(SWT.MouseHorizontalWheel, this);
fDisplay.addFilter(SWT.MouseVerticalWheel, this);
}
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
mainControl.addMouseTrackListener(labelComboListener);
labelControl.addMouseTrackListener(labelComboListener);
代码示例来源:origin: ajermakovics/eclipse-instasearch
resultViewer.addTreeListener(this);
resultViewer.getControl().addMouseTrackListener(new MouseTrackAdapter()
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text
@Override
public void start(Rectangle subjectArea) {
if (fIsActive) return;
fIsActive= true;
fSubjectArea= subjectArea;
fInformationControlToClose.addDisposeListener(this);
if (fSubjectControl != null && !fSubjectControl.isDisposed()) {
fSubjectControl.addMouseListener(this);
fSubjectControl.addMouseMoveListener(this);
fSubjectControl.addMouseTrackListener(this);
fSubjectControl.getShell().addShellListener(this);
fSubjectControl.addControlListener(this);
fSubjectControl.addKeyListener(this);
fDisplay= fSubjectControl.getDisplay();
if (!fDisplay.isDisposed() && fHideOnMouseWheel) {
fHasWheelFilter= true;
fDisplay.addFilter(SWT.MouseHorizontalWheel, this);
fDisplay.addFilter(SWT.MouseVerticalWheel, this);
}
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
control.addMouseTrackListener(new MouseTrackAdapter () {
@Override
public void mouseExit(MouseEvent e) {
代码示例来源:origin: org.eclipse/org.eclipse.datatools.sqltools.sqleditor
_viewer.getControl().addMouseTrackListener(new TooltipPresenter());
_viewer.setContentProvider(new SQLContentProvider());
SQLLabelProvider labelProvider = new SQLLabelProvider();