本文整理汇总了Java中org.eclipse.swt.events.MouseTrackAdapter类的典型用法代码示例。如果您正苦于以下问题:Java MouseTrackAdapter类的具体用法?Java MouseTrackAdapter怎么用?Java MouseTrackAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MouseTrackAdapter类属于org.eclipse.swt.events包,在下文中一共展示了MouseTrackAdapter类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addListener
import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
private void addListener(final Control ownerControl, final ToolBar toolBar) {
toolBar.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseExit(final MouseEvent e) {
// prevent to open the tooltip
_canOpenToolTip = false;
}
});
// ownerControl.addDisposeListener(new DisposeListener() {
// @Override
// public void widgetDisposed(final DisposeEvent e) {
// onDispose();
// }
// });
}
示例2: DialogPhotoProperties
import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
public DialogPhotoProperties(final Control ownerControl, final ToolBar toolBar, final IDialogSettings state) {
super(ownerControl);
_state = state;
toolBar.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseExit(final MouseEvent e) {
// prevent to open the tooltip
_canOpenToolTip = false;
}
});
PhotoManager.addPhotoEventListener(this);
setToolTipCreateStyle(AnimatedToolTipShell.TOOLTIP_STYLE_KEEP_CONTENT);
setBehaviourOnMouseOver(AnimatedToolTipShell.MOUSE_OVER_BEHAVIOUR_IGNORE_OWNER);
setIsKeepShellOpenWhenMoved(false);
setFadeInSteps(1);
}
示例3: createCellEditorOn
import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
/**
* Creates the cell editor on the given composite. The cell editor is
* created by instantiating the cell editor type passed into this
* DirectEditManager's constuctor.
*
* @param composite
* the composite to create the cell editor on
* @return the newly created cell editor
*/
protected CellEditor createCellEditorOn( Composite composite )
{
int style = this.applyBidiStyle( SWT.MULTI | SWT.WRAP ); // bidi_hcg
LabelCellEditor editor = new LabelCellEditor( composite, style );
//new LabelCellEditor( composite, SWT.MULTI | SWT.WRAP );
final Control c = editor.getControl( );
c.addMouseTrackListener( new MouseTrackAdapter( )
{
public void mouseEnter( MouseEvent e )
{
c.setCursor( SharedCursors.IBEAM );
}
} );
return editor;
}
示例4: addMouseHoverListenerToLink
import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
private void addMouseHoverListenerToLink(Link link,final Composite container) {
link.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseHover(MouseEvent e) {
container.setFocus();
}
});
}
示例5: addToolTipContainerFocusListener
import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
/**
* adds listener to focus container when mouse hover on container
* @param container
*/
private void addToolTipContainerFocusListener(final Composite container) {
container.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseHover(MouseEvent e) {
container.setFocus();
logger.debug("ComponentTooltip.addToolTipContainerFocusListener() - mouseHover - container focused");
}
});
logger.debug("ComponentTooltip.addToolTipContainerFocusListener() - added container focus listener");
}
示例6: addListener
import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
private void addListener(final Control ownerControl, final ToolBar toolBar) {
toolBar.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseExit(final MouseEvent e) {
// prevent to open the tooltip
_canOpenToolTip = false;
}
});
}
示例7: addListener
import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
private void addListener(final Control ownerControl) {
ownerControl.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseExit(final MouseEvent e) {
// prevent to open the tooltip
_canOpenToolTip = false;
}
});
}
示例8: getMainComposite
import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
protected Composite getMainComposite() {
if(this.mainComposite != null)
return this.mainComposite;
mainComposite = new Composite(shell, SWT.NONE);
mainComposite.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseExit(MouseEvent e) {
// mouse leaves the tooltip, dispose the tooltip
if (!mainComposite.getBounds().intersects(e.x, e.y, 1, 1)) {
shell.setVisible(false);
}
// check if parent should be disposed
if (groupScaleTimelineMarkerTooltip != null
&& !groupScaleTimelineMarkerTooltip.shell.isDisposed()
&& !shell.isVisible()) {
Point point = new Point(e.x, e.y);
point = shell.toDisplay(point);
point = groupScaleTimelineMarkerTooltip.getMainComposite().toControl(point);
Rectangle bounds = groupScaleTimelineMarkerTooltip.getMainComposite().getBounds();
if (!bounds.intersects(point.x, point.y, 1, 1)) {
// child tooltip disposed and mouse no longer over tooltip
groupScaleTimelineMarkerTooltip.shell.dispose();
}
}
if (!shell.isDisposed() && !shell.isVisible()) {
shell.dispose();
}
}
});
mainComposite.setBackground(shell.getBackground());
mainComposite.setLayout(new TableWrapLayout());
return mainComposite;
}
示例9: hookShellListeners
import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
/**
* @see PopUpHelper#hookShellListeners()
*/
protected void hookShellListeners() {
// Close the tooltip window if the mouse enters the tooltip
getShell().addMouseTrackListener(new MouseTrackAdapter() {
public void mouseEnter(org.eclipse.swt.events.MouseEvent e) {
hide();
currentTipSource = null;
// if (timer != null) {
// timer.cancel();
// }
}
});
}
示例10: addToolTip
import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
/**
* Add Tooltip for root TreeItem.
*/
protected void addToolTip( )
{
final Tree tree = getTreeViewer( ).getTree( );
tree.addMouseTrackListener( new MouseTrackAdapter( ) {
public void mouseHover( MouseEvent event )
{
Widget widget = event.widget;
if ( widget == tree )
{
Point pt = new Point( event.x, event.y );
TreeItem item = tree.getItem( pt );
if ( item == null )
{
tree.setToolTipText( null );
}
else
{
if ( getTreeViewer( ).getLabelProvider( ) instanceof FileLabelProvider )
{
tree.setToolTipText( ( (FileLabelProvider) getTreeViewer( ).getLabelProvider( ) ).getToolTip( item.getData( ) ) );
}
else
{
tree.setToolTipText( null );
}
}
}
}
} );
refreshRoot( );
}
示例11: addToolTip
import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
/**
* Add Tooltip for root TreeItem.
*/
protected void addToolTip( )
{
final Tree tree = getTreeViewer( ).getTree( );
tree.addMouseTrackListener( new MouseTrackAdapter( ) {
public void mouseHover( MouseEvent event )
{
Widget widget = event.widget;
if ( widget == tree )
{
Point pt = new Point( event.x, event.y );
TreeItem item = tree.getItem( pt );
if ( item == null )
{
tree.setToolTipText( null );
}
else
{
if ( getTreeViewer( ).getLabelProvider( ) instanceof ResourceFileLabelProvider )
{
tree.setToolTipText( ( (ResourceFileLabelProvider) getTreeViewer( ).getLabelProvider( ) ).getToolTip( item.getData( ) ) );
}
else
{
tree.setToolTipText( null );
}
}
}
}
} );
refreshRoot( );
}
示例12: AnnotationExpansionControl
import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
/**
* Creates a new control.
*
* @param parent parent shell
* @param shellStyle additional style flags
* @param access the annotation access
*/
public AnnotationExpansionControl(Shell parent, int shellStyle, IAnnotationAccess access) {
fPaintListener= new MyPaintListener();
fMouseTrackListener= new MyMouseTrackListener();
fMouseListener= new MyMouseListener();
fMenuDetectListener= new MyMenuDetectListener();
fDisposeListener= new MyDisposeListener();
fViewportListener= new IViewportListener() {
public void viewportChanged(int verticalOffset) {
dispose();
}
};
fLayouter= new LinearLayouter();
if (access instanceof IAnnotationAccessExtension)
fAnnotationAccessExtension= (IAnnotationAccessExtension) access;
fShell= new Shell(parent, shellStyle | SWT.NO_FOCUS | SWT.ON_TOP);
Display display= fShell.getDisplay();
fShell.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
fComposite= new Composite(fShell, SWT.NO_FOCUS | SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM);
// fComposite= new Composite(fShell, SWT.NO_FOCUS | SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.V_SCROLL);
GridLayout layout= new GridLayout(1, true);
layout.marginHeight= 0;
layout.marginWidth= 0;
fShell.setLayout(layout);
GridData data= new GridData(GridData.FILL_BOTH);
data.heightHint= fLayouter.getAnnotationSize() + 2 * fLayouter.getBorderWidth() + 4;
fComposite.setLayoutData(data);
fComposite.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseExit(MouseEvent e) {
if (fComposite == null)
return;
Control[] children= fComposite.getChildren();
Rectangle bounds= null;
for (int i= 0; i < children.length; i++) {
if (bounds == null)
bounds= children[i].getBounds();
else
bounds.add(children[i].getBounds());
if (bounds.contains(e.x, e.y))
return;
}
// if none of the children contains the event, we leave the popup
dispose();
}
});
// fComposite.getVerticalBar().addListener(SWT.Selection, new Listener() {
//
// public void handleEvent(Event event) {
// Rectangle bounds= fShell.getBounds();
// int x= bounds.x - fLayouter.getAnnotationSize() - fLayouter.getBorderWidth();
// int y= bounds.y;
// fShell.setBounds(x, y, bounds.width, bounds.height);
// }
//
// });
Cursor handCursor= getHandCursor(display);
fShell.setCursor(handCursor);
fComposite.setCursor(handCursor);
setInfoSystemColor();
}
示例13: initPage
import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
/**
* Initializes the data view page.
*/
protected void initPage( )
{
createContextMenus( );
// !remove sorter to keep same order with outline view
// treeViewer.setSorter( new ViewerSorter( ) {
//
// public int category( Object element )
// {
// if ( element instanceof LibraryHandle )
// {
// return 1;
// }
// return super.category( element );
// }
//
// } );
final Tree tree = getTreeViewer( ).getTree( );
tree.addMouseTrackListener( new MouseTrackAdapter( ) {
public void mouseHover( MouseEvent event )
{
Widget widget = event.widget;
if ( widget == tree )
{
Point pt = new Point( event.x, event.y );
TreeItem item = tree.getItem( pt );
try
{
tree.setToolTipText( getTooltip( item ) );
}
catch ( IOException e )
{
// Does nothing
}
}
}
} );
}
示例14: initTable
import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
private void initTable( TableViewer tableViewer, boolean leafOnly )
{
final Table table = tableViewer.getTable( );
GridData gd = new GridData( GridData.FILL_BOTH );
gd.heightHint = 150;
table.setLayoutData( gd );
table.setToolTipText( null );
final TableColumn column = new TableColumn( table, SWT.NONE );
column.setWidth( 200 );
table.getShell( ).addControlListener( new ControlAdapter( ) {
public void controlResized( ControlEvent e )
{
Display.getCurrent( ).asyncExec( new Runnable( ) {
public void run( )
{
if ( column != null && !column.isDisposed( ) )
{
column.setWidth( table.getSize( ).x > 204 ? table.getSize( ).x - 4
: 200 );
}
}
} );
}
} );
table.addMouseTrackListener( new MouseTrackAdapter( ) {
public void mouseHover( MouseEvent event )
{
Widget widget = event.widget;
if ( widget == table )
{
Point pt = new Point( event.x, event.y );
TableItem item = table.getItem( pt );
if ( item == null )
{
table.setToolTipText( null );
}
else
{
table.setToolTipText( provider.getTooltipText( item.getData( ) ) );
}
}
}
} );
tableViewer.setLabelProvider( new ExpressionLabelProvider( ) );
tableViewer.setContentProvider( new TableContentProvider( tableViewer, leafOnly ) );
tableViewer.addSelectionChangedListener( selectionListener );
tableViewer.addDoubleClickListener( doubleClickListener );
}