public CheckBoxToolTip( Control control ) { super( control, ToolTip.RECREATE, true ); image = control.getDisplay().getSystemImage( SWT.ICON_INFORMATION ); listeners = new ArrayList<CheckBoxToolTipListener>(); visible = false; display = control.getDisplay(); super.setRespectMonitorBounds( true ); super.setRespectDisplayBounds( true ); super.setHideDelay( 50000 ); super.setPopupDelay( 0 ); super.setHideOnMouseDown( false ); }
/** * @param control * @param offset * @param contributionInfo */ protected void doShowTooltip(Control control, Point offset, final ContributionInfo contributionInfo) { ToolTip toolTip = new ToolTip(control, ToolTip.NO_RECREATE, true) { @Override protected Composite createToolTipContentArea(Event event, Composite parent) { // Create the content area Composite composite = new Composite(parent, SWT.NONE); Color fg = parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND); Color bg = parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND); composite.setForeground(fg); composite.setBackground(bg); Text text = new Text(composite, SWT.READ_ONLY); text.setForeground(fg); text.setBackground(bg); String info = NLS.bind(ContributionInfoMessages.ContributionInfo_ContributedBy, contributionInfo.getElementType(), contributionInfo.getBundleId()); text.setText(info); GridLayoutFactory.fillDefaults().margins(2, 2).generateLayout(composite); return composite; } }; toolTip.setHideOnMouseDown(false); toolTip.setHideDelay(3000); toolTip.show(offset); }