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:uk.ac.diamond.scisoft.analysis.rcp.editors.DataEditor.java

License:Apache License

/**
 * This method to creates the table columns required to hold the
 * 1D data currently in the plotter passed in.
 * @param plotter//from   w w  w  . jav  a 2s. co m
 */
private void update(final DataSetPlotter plotter) {

    if (tableViewer != null) {
        GridUtils.setVisible(tableViewer.getTable(), false);
        tableViewer.getTable().dispose();
    }

    final List<IDataset> sets = plotter.getCurrentDataSets();
    if (sets == null || sets.isEmpty()) {
        GridUtils.setVisible(errorLabel, true);
        main.layout();
        return;
    }

    // We put the x values as the first set
    final List<AxisValues> axes = plotter.getXAxisValues();
    final Dataset x = axes.get(0).toDataset();
    x.setName(plotter.getXAxisLabel());
    sets.add(0, x);

    final Table table = new Table(main, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    this.tableViewer = new TableViewer(table);
    table.setLayoutData(new GridData(GridData.FILL_BOTH));
    table.setLinesVisible(true);
    table.setHeaderVisible(true);

    ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.NO_RECREATE);
    GridUtils.setVisible(errorLabel, false);
    main.layout();

    if (data == null)
        data = new LinkedHashMap<String, Dataset>();
    data.clear();

    final String[] names = new String[sets.size()];
    for (int i = 0; i < sets.size(); i++) {

        final Dataset set = DatasetUtils.convertToDataset(sets.get(i));

        final TableViewerColumn col = new TableViewerColumn(tableViewer, SWT.RIGHT, i);
        names[i] = set.getName() != null ? set.getName() : "";
        data.put(names[i], set);
        col.getColumn().setText(names[i]);
        col.getColumn().setWidth(150);
        col.setLabelProvider(new ValueColumnProvider(i));
    }
    tableViewer.setUseHashlookup(true);
    tableViewer.setColumnProperties(names);
    final MenuManager menuManager = new MenuManager();
    tableViewer.getControl().setMenu(menuManager.createContextMenu(tableViewer.getControl()));
    createActions(menuManager);

    final Object[] data = getRowData(sets);
    tableViewer.setContentProvider(new IStructuredContentProvider() {
        @Override
        public void dispose() {
        }

        @Override
        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        }

        @Override
        public Object[] getElements(Object inputElement) {
            return data;
        }
    });
    tableViewer.setInput(data);
    main.layout();
}

From source file:uk.ac.diamond.scisoft.analysis.rcp.views.nexus.DataSetPlotView.java

License:Apache License

private void createColumns() {

    ColumnViewerToolTipSupport.enableFor(dataViewer, ToolTip.NO_RECREATE);

    final TableViewerColumn name = new TableViewerColumn(dataViewer, SWT.LEFT, 0);
    name.getColumn().setText("Data");
    name.getColumn().setWidth(150);/* w  w w  . j  a v  a2s .c om*/
    name.setLabelProvider(new DataSetColumnLabelProvider(0));

    final TableViewerColumn axis = new TableViewerColumn(dataViewer, SWT.LEFT, 1);
    axis.getColumn().setText(" ");
    axis.getColumn().setWidth(24);
    axis.setLabelProvider(new DataSetColumnLabelProvider(1));

    final TableViewerColumn size = new TableViewerColumn(dataViewer, SWT.LEFT, 2);
    size.getColumn().setText("Size");
    size.getColumn().setWidth(requireToolbar ? 0 : 150);
    size.getColumn().setResizable(requireToolbar ? false : true);
    size.setLabelProvider(new DataSetColumnLabelProvider(2));

    final TableViewerColumn dims = new TableViewerColumn(dataViewer, SWT.LEFT, 3);
    dims.getColumn().setText("Dimensions");
    dims.getColumn().setWidth(requireToolbar ? 0 : 150);
    dims.getColumn().setResizable(requireToolbar ? false : true);
    dims.setLabelProvider(new DataSetColumnLabelProvider(3));

    final TableViewerColumn shape = new TableViewerColumn(dataViewer, SWT.LEFT, 4);
    shape.getColumn().setText("Shape");
    shape.getColumn().setWidth(requireToolbar ? 0 : 150);
    shape.getColumn().setResizable(requireToolbar ? false : true);
    shape.setLabelProvider(new DataSetColumnLabelProvider(4));

}

From source file:uk.ac.gda.client.experimentdefinition.components.ExperimentProviderUtils.java

License:Open Source License

/**
 * Creates a label provider on the file viewer for showing any exafs file.
 * /*  ww w. j  av a 2 s.  c  o  m*/
 * @param fileViewer
 */
public static void createExafsLabelProvider(final TableViewer fileViewer) {

    ColumnViewerToolTipSupport.enableFor(fileViewer, ToolTip.NO_RECREATE);

    final TableViewerColumn name = new TableViewerColumn(fileViewer, SWT.NONE);
    name.getColumn().setText("File");
    name.getColumn().setWidth(500);

    fileViewer.setLabelProvider(new DecoratingLabelProvider(new LabelProvider(),
            CommonRCPActivator.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator()));
}

From source file:uk.ac.gda.client.experimentdefinition.components.ExperimentRunEditor.java

License:Open Source License

private void createColumns(TableViewer table) {

    ColumnViewerToolTipSupport.enableFor(table, ToolTip.NO_RECREATE);

    // Stupidly you have to set width on a column to see it in the table.
    final TableViewerColumn name = new TableViewerColumn(table, SWT.LEFT, 0);
    name.getColumn().setText("Name");
    name.getColumn().setWidth(150);//from w  w w.  jav  a  2 s.c o  m
    name.setLabelProvider(new RunColumnLabelProvider());

    final String sizeColumn = System.getProperty("gda.exafs.run.editor.column.width");
    final int width = sizeColumn != null ? Integer.parseInt(sizeColumn) : 200;

    List<IExperimentBeanDescription> beanTypes = ExperimentBeanManager.INSTANCE.getBeanDescriptions();
    String[] columnNames = runObjectManager.getOrderedColumnBeanTypes();
    for (int index = 0; index < columnNames.length; index++) {
        String columnName = columnNames[index];
        for (IExperimentBeanDescription type : beanTypes) {
            if (type.includeInNew() && columnName.equals(type.getBeanType())) {
                TableViewerColumn thisColumn = new TableViewerColumn(table, SWT.LEFT, index + 1);
                thisColumn.getColumn().setText(type.getBeanType());
                thisColumn.getColumn().setWidth(width);
                thisColumn.setLabelProvider(new BeanColumnLabelProvider(type));
                break;
            }
        }
    }

    final TableViewerColumn runNum = new TableViewerColumn(table, SWT.LEFT, columnNames.length + 1);
    runNum.getColumn().setText("Repetitions");
    runNum.getColumn().setWidth(30);
    runNum.setLabelProvider(new RepetitionsColumnLabelProvider());
}

From source file:uk.ac.gda.ui.dialog.VisitIDDialog.java

License:Open Source License

private void createTableColumns() {

    ColumnViewerToolTipSupport.enableFor(userTable, ToolTip.NO_RECREATE);

    final TableViewerColumn visitIDCol = new TableViewerColumn(userTable, SWT.NONE, 0);
    TableColumn tableColumn = visitIDCol.getColumn();
    tableColumn.setAlignment(SWT.CENTER);
    visitIDCol.getColumn().setText("Visit ID");
    visitIDCol.getColumn().setWidth(100);
    visitIDCol.setLabelProvider(new VisitIDColumnLabelProvider(0));

    //      final TableViewerColumn proposalCol = new TableViewerColumn(userTable, SWT.NONE, 1);
    //      TableColumn tableColumn_1 = proposalCol.getColumn();
    //      tableColumn_1.setAlignment(SWT.CENTER);
    //      proposalCol.getColumn().setText("Proposal ID");
    //      proposalCol.getColumn().setWidth(100);
    //      proposalCol.setLabelProvider(new VisitIDColumnLabelProvider(1));

    final TableViewerColumn descriptionCol = new TableViewerColumn(userTable, SWT.NONE, 1);
    descriptionCol.getColumn().setText("Title");
    descriptionCol.getColumn().setWidth(300);
    descriptionCol.setLabelProvider(new VisitIDColumnLabelProvider(1));

}

From source file:uk.ac.gda.ui.doe.DOEView.java

License:Open Source License

/**
 * Create contents of the view part./*from  ww  w .j  a  va2  s .c  o  m*/
 * @param parent
 */
@Override
public void createPartControl(Composite parent) {

    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new GridLayout());

    final Table table = new Table(container,
            SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.grabExcessVerticalSpace = true;
    gridData.horizontalSpan = 3;
    table.setLayoutData(gridData);
    table.setLinesVisible(true);
    table.setHeaderVisible(true);

    this.tableViewer = new TableViewer(table);

    tableViewer.setUseHashlookup(true);
    tableViewer.setContentProvider(createContentProvider());
    ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.NO_RECREATE);

    createRightClickMenu();

    getSite().setSelectionProvider(tableViewer);

    getSite().getShell().getDisplay().asyncExec(new Runnable() {
        @Override
        public void run() {
            refresh();
        }
    });

}

From source file:uk.ac.gda.views.baton.BatonView.java

License:Open Source License

private void createTableColumns() {

    ColumnViewerToolTipSupport.enableFor(userTable, ToolTip.NO_RECREATE);

    int first = columnType.CLIENT_NUMBER.ordinal();
    final TableViewerColumn number = new TableViewerColumn(userTable, SWT.NONE, first);
    number.getColumn().setText(columnToolTip[first]);
    number.getColumn().setWidth(100);//from  w ww .  j  ava 2s . c om
    number.setLabelProvider(new BatonColumnLabelProvider(first));

    int second = columnType.USER.ordinal();
    final TableViewerColumn userName = new TableViewerColumn(userTable, SWT.NONE, second);
    userName.getColumn().setText(columnToolTip[second]);
    userName.getColumn().setWidth(150);
    userName.setLabelProvider(new BatonColumnLabelProvider(second));

    int nameIndex = columnType.NAME.ordinal();
    final TableViewerColumn nameColumn = new TableViewerColumn(userTable, SWT.NONE, nameIndex);
    nameColumn.getColumn().setText(columnToolTip[nameIndex]);
    nameColumn.getColumn().setWidth(200);
    nameColumn.setLabelProvider(new BatonColumnLabelProvider(nameIndex));

    int third = columnType.HOSTNAME.ordinal();
    final TableViewerColumn hostName = new TableViewerColumn(userTable, SWT.NONE, third);
    hostName.getColumn().setText(columnToolTip[third]);
    hostName.getColumn().setWidth(200);
    hostName.setLabelProvider(new BatonColumnLabelProvider(third));

    int fourth = columnType.VISIT.ordinal();
    final TableViewerColumn visitName = new TableViewerColumn(userTable, SWT.NONE, fourth);
    visitName.getColumn().setText(columnToolTip[fourth]);
    visitName.getColumn().setWidth(150);
    visitName.setLabelProvider(new BatonColumnLabelProvider(fourth));

    int fifth = columnType.HOLDING_BATON.ordinal();
    final TableViewerColumn hasBaton = new TableViewerColumn(userTable, SWT.NONE, fifth);
    hasBaton.getColumn().setText(columnToolTip[fifth]);
    hasBaton.getColumn().setWidth(100);
    hasBaton.setLabelProvider(new BatonColumnLabelProvider(fifth));

    int sixth = columnType.AUTH_LEVEL.ordinal();
    final TableViewerColumn authLevel = new TableViewerColumn(userTable, SWT.NONE, sixth);
    authLevel.getColumn().setText(columnToolTip[sixth]);
    authLevel.getColumn().setWidth(150);
    authLevel.setLabelProvider(new BatonColumnLabelProvider(sixth));
}

From source file:yahamp.ui.log.LogDisplayPart.java

License:Open Source License

/** Create table that displays the log
*  @param parent Parent widget//from ww w.  j a  v a  2  s .co m
*/
private void createLogTable(final Composite parent) {
    parent.setLayout(new GridLayout(2, false));

    Label l = new Label(parent, 0);
    l.setText("Category");
    l.setLayoutData(new GridData());

    category = new Combo(parent, 0);
    category.setLayoutData(new GridData(SWT.FILL, 0, true, false));
    category.setText(ALL);

    // TableColumnLayout requires table to be only widget
    // in its container, so create box for that
    final Composite box = new Composite(parent, 0);
    box.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    final TableColumnLayout layout = new TableColumnLayout();
    box.setLayout(layout);

    viewer = new TableViewer(box,
            SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION | SWT.VIRTUAL);
    viewer.setUseHashlookup(true);
    final Table table = viewer.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    viewer.setContentProvider(new LogTableContentProvider());

    new LogColumn(layout, viewer, "#", 1, 35) {
        @Override
        protected void update(final ViewerCell cell, final QSO qso) {
            cell.setText(Integer.toString(qso.getNumber()));
        }
    };
    new LogColumn(layout, viewer, "UTC", 25, 85) {
        @Override
        protected void update(final ViewerCell cell, final QSO qso) {
            cell.setText(qso.getUTC().toString());
        }
    };
    new LogColumn(layout, viewer, "Call", 10, 65) {
        @Override
        protected void update(final ViewerCell cell, final QSO qso) {
            cell.setText(qso.getCall());
        }
    };
    new LogColumn(layout, viewer, "Sent", 10, 40) {
        @Override
        protected void update(final ViewerCell cell, final QSO qso) {
            cell.setText(qso.getRstSent());
        }
    };
    new LogColumn(layout, viewer, "Rcvd", 10, 40) {
        @Override
        protected void update(final ViewerCell cell, final QSO qso) {
            cell.setText(qso.getRstRcvd());
        }
    };
    new LogColumn(layout, viewer, "Freq", 10, 35) {
        @Override
        protected void update(final ViewerCell cell, final QSO qso) {
            cell.setText(qso.getFreq());
        }
    };
    new LogColumn(layout, viewer, "Mode", 10, 40) {
        @Override
        protected void update(final ViewerCell cell, final QSO qso) {
            cell.setText(qso.getMode());
        }
    };
    new LogColumn(layout, viewer, "Cat", 10, 50) {
        @Override
        protected void update(final ViewerCell cell, final QSO qso) {
            cell.setText(qso.getCategory());
        }
    };
    new LogColumn(layout, viewer, "Info", 100, 10) {
        @Override
        protected void update(final ViewerCell cell, final QSO qso) {
            cell.setText(qso.getInfo());
        }
    };

    // Enable tool tips
    ColumnViewerToolTipSupport.enableFor(viewer, ToolTip.NO_RECREATE);
}