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

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

Introduction

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

Prototype

int NO_RECREATE

To view the source code for org.eclipse.jface.window ToolTip NO_RECREATE.

Click Source Link

Document

Don't recreate the tooltip as long the mouse doesn't leave the area triggering the tooltip creation

Usage

From source file:org.eclipse.recommenders.internal.coordinates.rcp.ProjectCoordinatesView.java

License:Open Source License

@Override
public void createPartControl(final Composite parent) {

    Composite composite = new Composite(parent, SWT.NONE);
    TableColumnLayout tableLayout = new TableColumnLayout();
    composite.setLayout(tableLayout);/*from   w w  w .  j  a va 2 s.c o m*/

    tableViewer = new TableViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);

    contentProvider = new ContentProvider();
    tableViewer.setContentProvider(contentProvider);
    tableViewer.setInput(getViewSite());

    ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.NO_RECREATE);

    locationColumn = new TableViewerColumn(tableViewer, SWT.NONE);
    TableColumn tableColumn = locationColumn.getColumn();
    tableColumn.setText(Messages.COLUMN_LABEL_LOCATION);
    tableLayout.setColumnData(tableColumn, new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true));

    coordinateColumn = new TableViewerColumn(tableViewer, SWT.NONE);
    coordinateColumn.setEditingSupport(new ProjectCoordinateEditing(tableViewer));
    tableColumn = coordinateColumn.getColumn();
    tableColumn.setText(Messages.COLUMN_LABEL_COORDINATE);
    tableLayout.setColumnData(tableColumn, new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true));

    table = tableViewer.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    Action refreshAction = new Action() {
        @Override
        public void run() {
            refreshTableUI();
        }
    };

    TableSortConfigurator.newConfigurator(tableViewer, refreshAction)
            .add(locationColumn.getColumn(), COMPARE_LOCATION)
            .add(coordinateColumn.getColumn(), COMPARE_COORDINATE)
            .initialize(locationColumn.getColumn(), SWT.UP).configure();

    addFilterFunctionality();
    addClearCacheButton();
    addRefreshButton();

    refreshData();
}

From source file:org.eclipse.recommenders.internal.privacy.rcp.widgets.PermissionWidget.java

License:Open Source License

private void createPermssionsView(final CheckboxTreeViewer sourceViewer, final Set<? extends ICategory> input,
        final CheckboxTreeViewer targetViewer, ColumnLabelProvider labelProvider) {

    GridDataFactory.fillDefaults().hint(SWT.DEFAULT, SWT.DEFAULT).grab(true, true)
            .applyTo(sourceViewer.getControl());
    sourceViewer.setLabelProvider(labelProvider);
    sourceViewer.setContentProvider(new CategoryContentProvider());
    sourceViewer.setInput(input);/*w ww  .j  a  v  a  2 s .  co  m*/
    PrivacyTooltipSupport.enableFor(sourceViewer, ToolTip.NO_RECREATE);
    sourceViewer.expandAll();
    sourceViewer.setCheckedElements(checkedPermissions.toArray());
    updateAncestors(sourceViewer);
    sourceViewer.addFilter(getFilter());
    sourceViewer.setSorter(new PrivacySorter());

    sourceViewer.addCheckStateListener(new ICheckStateListener() {

        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            if (event.getElement() instanceof ICategory) {
                ICategory category = (ICategory) event.getElement();
                for (PrivatePermission permission : category.getPermissions()) {
                    sourceViewer.setChecked(permission, event.getChecked());
                    targetViewer.setChecked(permission, event.getChecked());
                }
            } else {
                sourceViewer.setChecked(event.getElement(), event.getChecked());
                targetViewer.setChecked(event.getElement(), event.getChecked());
            }
            updateAncestors(sourceViewer);
            updateAncestors(targetViewer);
        }
    });

    sourceViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            if (selection.getFirstElement() instanceof PrivatePermission) {
                PrivatePermission permission = (PrivatePermission) selection.getFirstElement();
                if (permission.isAdvancedPreferencesSupported()) {
                    configurationButton.setEnabled(true);
                    return;
                }
            }
            configurationButton.setEnabled(false);
        }
    });
}

From source file:org.eclipse.recommenders.internal.privacy.rcp.widgets.SingleDatumWidget.java

License:Open Source License

private void createPermssionsView(final TableViewer sourceViewer, final Set<? extends ICategory> input) {
    GridDataFactory.fillDefaults().hint(SWT.DEFAULT, SWT.DEFAULT).grab(true, true)
            .applyTo(sourceViewer.getControl());
    sourceViewer.setLabelProvider(new DatumLabelProvider());
    sourceViewer.setContentProvider(new PermissionContentProvider());
    sourceViewer.setInput(getShownPermissions(input));
    PrivacyTooltipSupport.enableFor(sourceViewer, ToolTip.NO_RECREATE);
    sourceViewer.addFilter(getFilter());
    sourceViewer.setSorter(new PrivacySorter());
}

From source file:org.eclipse.recommenders.models.rcp.dependencymonitor.views.DependencyMonitor.java

License:Open Source License

@Override
public void createPartControl(final Composite parent) {
    this.parent = parent;
    tableViewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
    tableViewer.setLabelProvider(new ViewLabelProvider());
    contentProvider = new ContentProvider();
    tableViewer.setContentProvider(contentProvider);
    tableViewer.setInput(getViewSite());
    comparator = new TableComparator();
    tableViewer.setComparator(comparator);

    ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.NO_RECREATE);

    tableViewer.getTable().setHeaderVisible(true);
    tableViewer.getTable().setLinesVisible(true);

    locationColumn = new TableViewerColumn(tableViewer, SWT.NONE);
    TableColumn tableColumn = locationColumn.getColumn();
    tableColumn.setText("Location");
    tableColumn.setWidth(200);/*  w  ww.  jav  a  2s .  c o  m*/
    tableColumn.addSelectionListener(new SelectionListener(tableColumn, 0));

    coordinateColumn = new TableViewerColumn(tableViewer, SWT.NONE);
    tableColumn = coordinateColumn.getColumn();
    tableColumn.setText("Coordinate");
    tableColumn.setWidth(450);
    tableColumn.addSelectionListener(new SelectionListener(tableColumn, 1));

    tableViewer.getTable().setSortDirection(SWT.UP);
    tableViewer.getTable().setSortColumn(locationColumn.getColumn());

    checkForDependencyUpdates();
}

From source file:org.eclipse.richbeans.widgets.selector.VerticalListEditor.java

License:Open Source License

protected void createLabelProvider() {

    if (labelProivderAdded)
        return;/* ww  w .j ava  2  s .co  m*/

    ColumnViewerToolTipSupport.enableFor(listViewer, ToolTip.NO_RECREATE);

    final TableViewerColumn name = new TableViewerColumn(listViewer, SWT.NONE, 0);
    if (getNameField() != null) {
        name.getColumn().setText(RichBeanUtils.getFieldWithUpperCaseFirstLetter(getNameField()));
    } else {
        name.getColumn().setText("Name");
    }
    if (columnNames != null)
        try {
            name.getColumn().setText(columnNames[0]);
        } catch (Throwable ignored) {
        }

    name.getColumn().setWidth(columnWidths[0]);

    name.setLabelProvider(new ColumnLabelProvider() {
        @Override
        public String getText(Object element) {
            @SuppressWarnings("unchecked")
            final BeanWrapper<T> bean = (BeanWrapper<T>) element;
            final String name = bean.getName();
            return name != null ? name : "null";
        }

        @Override
        public String getToolTipText(Object element) {
            return additionalFields != null ? "Right click to choose compare mode." : null;
        }
    });

    if (additionalFields != null) {
        extraColumns = new ArrayList<TableViewerColumn>(additionalFields.length);
        for (int i = 0; i < additionalFields.length; i++) {
            final String additionalField = RichBeanUtils.getFieldWithUpperCaseFirstLetter(additionalFields[i]);

            final TableViewerColumn col = new TableViewerColumn(listViewer, SWT.NONE, i + 1);
            extraColumns.add(col);

            String columnTitle = additionalField;
            if (columnNames != null && columnNames.length > i + 1) {
                columnTitle = columnNames[i + 1];
            }
            col.getColumn().setText(columnTitle);

            int width = 300;
            if (columnWidths != null && columnWidths.length > i + 1) {
                width = columnWidths[i + 1];
            }
            col.getColumn().setWidth(width);

            col.setLabelProvider(new ColumnLabelProvider() {
                @Override
                public String getText(Object element) {
                    @SuppressWarnings("unchecked")
                    final BeanWrapper<T> bean = (BeanWrapper<T>) element;
                    final Object ob = bean.getBean();
                    try {
                        Method method = ob.getClass().getMethod("get" + additionalField);
                        Object val = method.invoke(ob);
                        if (val instanceof Double && columnFormat != null) {
                            val = columnFormat.format(((Number) val).doubleValue());
                        }
                        return val.toString();

                    } catch (Exception e) {
                        return e.getMessage();
                    }
                }
            });

        }
    }

    labelProivderAdded = true;
}

From source file:org.eclipse.riena.ui.swt.facades.internal.TableRidgetToolTipSupport.java

License:Open Source License

/**
 * Enable ToolTip support for the viewer by creating an instance from this
 * class. To get all necessary informations this support class consults the
 * {@link TableRidgetLabelProvider}.//from   w w w  .j  a v  a2 s.  co  m
 * 
 * @param viewer
 *            the viewer the support is attached to
 * @param style
 *            style passed to control tool tip behavior
 * 
 * @param manualActivation
 *            <code>true</code> if the activation is done manually using
 *            {@link #show(Point)}
 */
protected TableRidgetToolTipSupport(final ColumnViewer viewer, final int style) {
    super(viewer, ToolTip.NO_RECREATE, false);
    Assert.isLegal(viewer instanceof TableRidgetTableViewer);
    this.viewer = (TableRidgetTableViewer) viewer;
}

From source file:org.eclipse.riena.ui.swt.facades.internal.TableRidgetToolTipSupport.java

License:Open Source License

/**
 * Enable ToolTip support for the viewer by creating an instance from this
 * class. To get all necessary informations this support class consults the
 * {@link TableRidgetLabelProvider}.//from  ww w . ja v a2s . c  om
 * 
 * @param viewer
 *            the viewer the support is attached to
 */
public static void enableFor(final ColumnViewer viewer) {
    enableFor(viewer, ToolTip.NO_RECREATE);
}

From source file:org.eclipse.scanning.device.ui.model.ModelFieldEditorFactory.java

License:Open Source License

private static void showHint(final String hint, final Composite parent) {

    if (parent.isDisposed())
        return;/*from ww  w.ja  v a  2  s .c  o m*/
    if (parent != null)
        parent.getDisplay().asyncExec(new Runnable() {
            public void run() {

                currentHint = new DefaultToolTip(parent, ToolTip.NO_RECREATE, true);
                ((DefaultToolTip) currentHint).setText(hint);
                currentHint.setHideOnMouseDown(true);
                currentHint.show(new Point(0, parent.getSize().y));

                if (selectionListener == null) {
                    if (PageUtil.getPage() != null) {
                        selectionListener = new ISelectionListener() {
                            @Override
                            public void selectionChanged(IWorkbenchPart part, ISelection selection) {
                                if (currentHint != null)
                                    currentHint.hide();
                            }
                        };

                        PageUtil.getPage().addSelectionListener(selectionListener);
                    }

                }
            }
        });
}

From source file:org.eclipse.scout.rt.ui.swt.basic.table.SwtScoutTooltipSupport.java

License:Open Source License

public static void enableFor(ColumnViewer viewer) {
    new SwtScoutTooltipSupport(viewer, ToolTip.NO_RECREATE, false);
}

From source file:org.eclipse.sirius.ui.business.api.viewpoint.ViewpointSelection.java

License:Open Source License

private static Control createViewpointsTableControl(final Composite parent, final Set<Viewpoint> viewpoints,
        final TableViewerAwareCellModifier cellModifier, final IBaseLabelProvider labelProvider) {

    final Composite control = SWTUtil.createCompositeBothFill(parent, 1, false);
    final TableViewer tableViewer = new TableViewer(control, SWT.BORDER | SWT.FULL_SELECTION);
    ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.NO_RECREATE);

    final Table table = tableViewer.getTable();

    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    final TableColumn tc0 = new TableColumn(table, SWT.CENTER, 0);
    tc0.setWidth(30);//from w  ww  .  j ava  2  s  .co  m

    final TableColumn tc1 = new TableColumn(table, SWT.CENTER, 1);
    tc1.setWidth(30);

    final TableViewerColumn column = new TableViewerColumn(tableViewer, SWT.LEFT, 2);
    column.getColumn().setWidth(450);

    table.setSize(new Point(table.getSize().x, 510));

    // Can only changes the first column - the visible column
    final CellEditor[] editors = new CellEditor[3];
    editors[0] = new CheckboxCellEditor(table);
    for (int i = 1; i < 3; i++) {
        editors[i] = null;
    }

    tableViewer.setColumnProperties(COLUMNS);

    tableViewer.setCellEditors(editors);
    cellModifier.setViewer(tableViewer);
    tableViewer.setCellModifier(cellModifier);
    tableViewer.setContentProvider(new ViewpointsTableContentProvider());
    tableViewer.setLabelProvider(labelProvider);
    tableViewer.setComparator(new ViewerComparator());

    tableViewer.setInput(viewpoints);

    /* Lines and headers are not visible */
    table.setLinesVisible(false);
    table.setHeaderVisible(false);

    return control;
}