Example usage for org.eclipse.jface.window ToolTip setHideDelay

List of usage examples for org.eclipse.jface.window ToolTip setHideDelay

Introduction

In this page you can find the example usage for org.eclipse.jface.window ToolTip setHideDelay.

Prototype

public void setHideDelay(int hideDelay) 

Source Link

Document

Set the hide delay.

Usage

From source file:org.eclipse.ui.internal.handlers.SpyHandler.java

License:Open Source License

/**
 * @param control/* www  .  ja v a 2  s.c o  m*/
 * @param offset
 * @param contributionInfo
 */
protected void doShowTooltip(Control control, Point offset, final ContributionInfo contributionInfo) {
    ToolTip toolTip = new ToolTip(control, ToolTip.NO_RECREATE, true) {

        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);
}