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

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

Introduction

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

Prototype

public void setHideOnMouseDown(final boolean hideOnMouseDown) 

Source Link

Document

If you don't want the tool tip to be hidden when the user clicks inside the tool tip set this to false.

Usage

From source file:org.activiti.designer.property.extension.field.CustomPropertyDataGridField.java

License:Apache License

private void createHeader() {

    if (dataGridAnnotation.orderable()) {
        // Empty label for the header of order column
        final CLabel orderColumnLabel = factory.createCLabel(dataGridControl, "", SWT.WRAP);
    }/*from   ww  w. j  a v a  2  s  . co  m*/

    // Create a row with headers
    for (final FieldInfo fieldInfo : gridFields) {

        final Property propertyAnnotation = fieldInfo.getPropertyAnnotation();

        Composite headerGroup = factory.createFlatFormComposite(dataGridControl);

        final GridLayout headerLayout = new GridLayout(2, false);
        headerGroup.setLayout(headerLayout);

        final CLabel headerLabel = factory.createCLabel(headerGroup, propertyAnnotation.displayName());
        GridData headerLabelData = new GridData();
        headerLabelData.grabExcessHorizontalSpace = true;
        headerLabelData.horizontalAlignment = GridData.FILL;
        headerLabel.setLayoutData(headerLabelData);
        headerLabel.setFont(PropertyCustomServiceTaskSection.boldFont);

        final Help help = getHelpAnnotation();
        if (help != null) {
            final Button propertyHelp = factory.createButton(headerGroup, "", SWT.BUTTON1);
            propertyHelp.setImage(
                    PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_LCL_LINKTO_HELP));

            GridData headerButtonData = new GridData();
            headerButtonData.horizontalAlignment = SWT.END;
            headerLabel.setLayoutData(headerButtonData);

            // create a tooltip
            final ToolTip tooltip = new FormToolTip(propertyHelp,
                    String.format("Help for field %s",
                            propertyAnnotation.displayName().equals("") ? fieldInfo.getFieldName()
                                    : propertyAnnotation.displayName()),
                    help.displayHelpShort(), help.displayHelpLong());
            tooltip.setHideOnMouseDown(false);

            propertyHelp.addMouseListener(new MouseListener() {

                @Override
                public void mouseUp(MouseEvent e) {
                }

                @Override
                public void mouseDown(MouseEvent e) {
                    tooltip.show(new Point(0, 0));
                }

                @Override
                public void mouseDoubleClick(MouseEvent e) {
                }
            });
        }

        final GridData gridData = new GridData();
        gridData.grabExcessHorizontalSpace = true;
        gridData.horizontalAlignment = GridData.FILL;
        headerGroup.setLayoutData(gridData);

    }

    if (dataGridAnnotation.orderable()) {
        // Empty label for the header of the two ordering columns
        final CLabel upColumnLabel = factory.createCLabel(dataGridControl, "", SWT.WRAP);

        final CLabel downColumnLabel = factory.createCLabel(dataGridControl, "", SWT.WRAP);
    }

    // Empty label for the header of the final column
    final CLabel finalColumnLabel = factory.createCLabel(dataGridControl, "", SWT.WRAP);
}

From source file:org.eclipse.ecf.internal.example.collab.ui.LineChatClientView.java

License:Open Source License

public LineChatClientView(EclipseCollabSharedObject lch, LineChatView view, String name, String initText,
        String downloaddir) {/* w ww.j a v  a2 s.  c  o  m*/
    super();
    this.lch = lch;
    this.view = view;
    this.name = name;
    this.teamChat = new TeamChat(this, view.tabFolder, SWT.NULL, initText);
    this.userdata = lch.getUser();
    this.downloaddir = downloaddir;
    users = new ArrayList();
    teamChat.getTableViewer().setInput(users);
    if (userdata != null)
        addUser(userdata);

    ClientPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty().equals(ClientPlugin.PREF_DISPLAY_TIMESTAMP)) {
                showTimestamp = ((Boolean) event.getNewValue()).booleanValue();
            }
        }

    });

    JFaceResources.getColorRegistry().put(ViewerToolTip.HEADER_BG_COLOR, new RGB(255, 255, 255));
    JFaceResources.getFontRegistry().put(ViewerToolTip.HEADER_FONT, JFaceResources.getFontRegistry()
            .getBold(JFaceResources.getDefaultFont().getFontData()[0].getName()).getFontData());

    final ToolTip toolTip = new ViewerToolTip(teamChat.getTableViewer().getControl());
    toolTip.setHideOnMouseDown(false);
    toolTip.setPopupDelay(200);
}

From source file:org.eclipse.ecf.presence.ui.MultiRosterView.java

License:Open Source License

protected void setupTreeViewer(Composite parent) {
    treeViewer = new TreeViewer(parent, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);
    getSite().setSelectionProvider(treeViewer);
    presenceListener = new PresenceListener();
    treeViewer.setContentProvider(new MultiRosterContentProvider());
    treeViewer.setLabelProvider(new MultiRosterLabelProvider());
    treeViewer.addFilter(hideOfflineFilter);
    treeViewer.addFilter(hideEmptyGroupsFilter);
    treeViewer.setInput(rosterAccounts);
    treeViewer.addOpenListener(new IOpenListener() {
        public void open(OpenEvent e) {
            message((IStructuredSelection) e.getSelection());
        }//  ww w .  j  a va 2 s.  c o  m
    });

    ToolTip toolTip = new ViewerToolTip(treeViewer.getControl());
    toolTip.setHideOnMouseDown(false);
    toolTip.setPopupDelay(200);
    toolTip.setShift(new Point(5, 5));

    makeActions();
    hookContextMenu();
    contributeToActionBars();
    hookDropSupport();
    retrieveServices();
    treeViewer.expandToLevel(DEFAULT_EXPAND_LEVEL);

}

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

License:Open Source License

/**
 * @param control/*from  ww w. j  a va  2 s .  co 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);
}