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(); // } // }); }
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); }
/** * 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; }
private void addMouseHoverListenerToLink(Link link,final Composite container) { link.addMouseTrackListener(new MouseTrackAdapter() { @Override public void mouseHover(MouseEvent e) { container.setFocus(); } }); }
/** * 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"); }
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; } }); }
private void addListener(final Control ownerControl) { ownerControl.addMouseTrackListener(new MouseTrackAdapter() { @Override public void mouseExit(final MouseEvent e) { // prevent to open the tooltip _canOpenToolTip = false; } }); }
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; }
/** * @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(); // } } }); }
/** * 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( ); }
/** * 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( ); }
/** * 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(); }
/** * 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 } } } } ); }
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 ); }