Java Code Examples for org.eclipse.swt.widgets.TableColumn#setToolTipText()

The following examples show how to use org.eclipse.swt.widgets.TableColumn#setToolTipText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CausalFactorTable.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
public void render(Section section, FormToolkit toolkit) {
	Composite composite = UI.sectionClient(section, toolkit, 1);
	String[] columnTitles = getColumnTitles();
	viewer = Tables.createViewer(composite, columnTitles);
	viewer.setLabelProvider(new FactorLabel());
	Action copy = TableClipboard.onCopy(viewer);
	Actions.bind(viewer, copy);
	Tables.bindColumnWidths(viewer, 0.2, 0.1, 0.1, 0.1);
	createModifySupport();
	Table table = viewer.getTable();
	for (int i = 0; i < table.getColumnCount(); i++) {
		if (i < 4)
			continue;
		TableColumn column = table.getColumn(i);
		if (!editor.hasAnyComment("allocationFactors") || i % 2 == 0) {
			column.setWidth(80);
			column.setToolTipText(columnTitles[i]);
		} else {
			column.setWidth(24);
		}
	}
	for (int i = 3; i < table.getColumnCount(); i++) {
		viewer.getTable().getColumns()[i].setAlignment(SWT.RIGHT);
	}
}
 
Example 2
Source File: MedicationViewerHelper.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public static TableViewerColumn createMandantColumn(TableViewer viewer,
	TableColumnLayout layout, int columnIndex){
	TableViewerColumn ret = new TableViewerColumn(viewer, SWT.LEFT);
	TableColumn tblclmnMandant = ret.getColumn();
	ColumnWeightData mandantColumnWeightData =
		new ColumnWeightData(0, 50, true);
	layout.setColumnData(tblclmnMandant, mandantColumnWeightData);
	tblclmnMandant.setText(Messages.MedicationComposite_column_mandant);
	tblclmnMandant.setToolTipText(Messages.MedicationComposite_column_mandant);
	ret.setLabelProvider(new MedicationCellLabelProvider() {
		@Override
		public String getText(Object element){
			return ((MedicationTableViewerItem) element).getPrescriptorLabel();
		}
	});
	return ret;
}
 
Example 3
Source File: MedicationViewerHelper.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public static TableViewerColumn createDosageColumn(TableViewer viewer,
	TableColumnLayout layout, int columnIndex){
	TableViewerColumn ret = new TableViewerColumn(viewer, SWT.NONE);
	ret.setLabelProvider(new MedicationCellLabelProvider() {
		
		@Override
		public String getText(Object element){
			MedicationTableViewerItem pres = (MedicationTableViewerItem) element;
			String dosis = pres.getDosis();
			return (dosis.equals(StringConstants.ZERO) ? Messages.MedicationComposite_stopped
					: dosis);
		}
	});
	TableColumn tblclmnDosage = ret.getColumn();
	tblclmnDosage.setToolTipText(Messages.TherapieplanComposite_tblclmnDosage_toolTipText);
	tblclmnDosage.addSelectionListener(getSelectionAdapter(viewer, tblclmnDosage, columnIndex));
	layout.setColumnData(tblclmnDosage, new ColumnPixelData(60, true, true));
	ret.getColumn().setText(Messages.TherapieplanComposite_tblclmnDosage_text);
	return ret;
}
 
Example 4
Source File: MedicationViewerHelper.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public static TableViewerColumn createBeginColumn(TableViewer viewer,
	TableColumnLayout layout, int columnIndex){
	TableViewerColumn ret = new TableViewerColumn(viewer, SWT.CENTER);
	TableColumn tblclmnEnacted = ret.getColumn();
	layout.setColumnData(tblclmnEnacted, new ColumnPixelData(60, true, true));
	tblclmnEnacted.setImage(Images.resize(Images.IMG_NEXT_WO_SHADOW.getImage(),
		ImageSize._12x12_TableColumnIconSize));
	tblclmnEnacted.setToolTipText(Messages.MedicationComposite_column_sortBy + " "
		+ Messages.MedicationComposite_column_beginDate);
	tblclmnEnacted
		.addSelectionListener(getSelectionAdapter(viewer, tblclmnEnacted, columnIndex));
	ret.setLabelProvider(new MedicationCellLabelProvider() {
		
		@Override
		public String getText(Object element){
			MedicationTableViewerItem pres = (MedicationTableViewerItem) element;
			return pres.getBeginDate();
		}
	});
	return ret;
}
 
Example 5
Source File: MedicationViewerHelper.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public static TableViewerColumn createIntakeCommentColumn(TableViewer viewer,
	TableColumnLayout layout, int columnIndex){
	TableViewerColumn ret = new TableViewerColumn(viewer, SWT.NONE);
	TableColumn tblclmnComment = ret.getColumn();
	layout.setColumnData(tblclmnComment,
		new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true));
	tblclmnComment.setText(Messages.TherapieplanComposite_tblclmnComment_text);
	tblclmnComment.setToolTipText(Messages.MedicationComposite_column_sortBy + " "
		+ Messages.TherapieplanComposite_tblclmnComment_text);
	tblclmnComment
		.addSelectionListener(getSelectionAdapter(viewer, tblclmnComment, columnIndex));
	tblclmnComment.setToolTipText(Messages.MedicationComposite_column_sortBy + " "
		+ Messages.TherapieplanComposite_tblclmnComment_text);
	ret.setLabelProvider(new MedicationCellLabelProvider() {
		
		@Override
		public String getText(Object element){
			MedicationTableViewerItem pres = (MedicationTableViewerItem) element;
			return pres.getRemark();
		}
	});
	return ret;
}
 
Example 6
Source File: MedicationViewerHelper.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public static TableViewerColumn createStopColumn(TableViewer viewer, TableColumnLayout layout,
	int columnIndex){
	TableViewerColumn ret = new TableViewerColumn(viewer, SWT.CENTER);
	TableColumn tblclmnStop = ret.getColumn();
	ColumnPixelData stopColumnPixelData = new ColumnPixelData(60, true, true);
	layout.setColumnData(tblclmnStop, stopColumnPixelData);
	tblclmnStop.setImage(Images.resize(Images.IMG_ARROWSTOP_WO_SHADOW.getImage(),
		ImageSize._12x12_TableColumnIconSize));
	tblclmnStop.setToolTipText(Messages.MedicationComposite_column_sortBy + " "
		+ Messages.MedicationComposite_column_endDate);
	tblclmnStop.addSelectionListener(getSelectionAdapter(viewer, tblclmnStop, columnIndex));
	ret.setLabelProvider(new MedicationCellLabelProvider() {
		@Override
		public String getText(Object element){
			MedicationTableViewerItem pres = (MedicationTableViewerItem) element;
			if (pres.getEntryType() != EntryType.RECIPE
				&& pres.getEntryType() != EntryType.SELF_DISPENSED) {
				return pres.getEndDate();
			}
			return "";
		}
	});
	return ret;
}
 
Example 7
Source File: CausalFactorTable.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void addColumn(Exchange product) {
	Column newColumn = new Column(product);
	Table table = viewer.getTable();
	TableColumn tableColumn = new TableColumn(table, SWT.VIRTUAL);
	tableColumn.setText(newColumn.getTitle());
	tableColumn.setToolTipText(newColumn.getTitle());
	tableColumn.setWidth(80);
	Column[] newColumns = new Column[columns.length + 1];
	System.arraycopy(columns, 0, newColumns, 0, columns.length);
	newColumns[columns.length] = newColumn;
	columns = newColumns;
	if (editor.hasAnyComment("allocationFactors")) {
		new TableColumn(table, SWT.VIRTUAL).setWidth(24);
	}
}
 
Example 8
Source File: ViewAttributeList.java    From arx with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new column
 * @param table
 * @param name
 * @param width
 * @param provider
 */
private TableViewerColumn createColumn(PageableTable table,
                                       String name, 
                                       int width,
                                       ColumnLabelProvider provider) {
    
    TableViewerColumn column = new TableViewerColumn(table.getViewer(), SWT.NONE);
    column.setLabelProvider(provider);
    TableColumn tColumn = column.getColumn();
    tColumn.setToolTipText(name);
    tColumn.setText(name);
    tColumn.setWidth(width);
    tColumn.setResizable(true);
    return column;
}
 
Example 9
Source File: ViewAttributeWeights.java    From arx with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new column
 * @param table
 * @param name
 * @param provider
 */
private TableViewerColumn createColumn(PageableTable table,
                                       String name,
                                       ColumnLabelProvider provider) {
    TableViewerColumn column = new TableViewerColumn(table.getViewer(), SWT.NONE);
    column.setLabelProvider(provider);
    TableColumn tColumn = column.getColumn();
    tColumn.setToolTipText(name);
    tColumn.setText(name);
    tColumn.setWidth(200);
    tColumn.setResizable(true);
    return column;
}
 
Example 10
Source File: ViewStatisticsClassificationAttributes.java    From arx with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new column
 * @param table
 * @param name
 * @param width
 * @param provider
 */
private TableViewerColumn createColumn(PageableTable table,
                                       String name, 
                                       int width,
                                       ColumnLabelProvider provider) {
    
    TableViewerColumn column = new TableViewerColumn(table.getViewer(), SWT.NONE);
    column.setLabelProvider(provider);
    TableColumn tColumn = column.getColumn();
    tColumn.setToolTipText(name);
    tColumn.setText(name);
    tColumn.setWidth(width);
    tColumn.setResizable(true);
    return column;
}
 
Example 11
Source File: ViewStatisticsQuality.java    From arx with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new column
 * @param table
 * @param name
 * @param width
 * @param provider
 */
private TableViewerColumn createColumn(PageableTable table,
                                       String name, 
                                       ColumnLabelProvider provider) {
    
    TableViewerColumn column = new TableViewerColumn(table.getViewer(), SWT.NONE);
    column.setLabelProvider(provider);
    TableColumn tColumn = column.getColumn();
    tColumn.setToolTipText(name);
    tColumn.setText(name);
    tColumn.setWidth(30);
    tColumn.setResizable(false);
    return column;
}
 
Example 12
Source File: CoverageLabelProvider.java    From tlaplus with MIT License 5 votes vote down vote up
/**
 * @param stateTable
 */
void createTableColumns(final Table stateTable, final TableColumnLayout layout) {
	for (int i = 0; i < COLUMN_TITLES.length; i++) {
		final TableColumn column = new TableColumn(stateTable, SWT.NULL);
		column.setWidth(COLUMN_WIDTHS[i]);
		column.setText(COLUMN_TITLES[i]);
		column.setToolTipText(COLUMN_TOOLTIPS[i]);
		column.setData(COVERAGE_COMPARATOR, COLUMN_COMP[i]);

		final int weight = (int)(100.0 * COLUMN_WIDTH_PERCENTAGES[i]);
		layout.setColumnData(column, new ColumnWeightData(weight, COLUMN_WIDTHS[i], true));
	}
}
 
Example 13
Source File: MedicationViewerHelper.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public static TableViewerColumn createStopReasonColumn(TableViewer viewer,
	TableColumnLayout layout,
	int columnIndex){
	TableViewerColumn ret = new TableViewerColumn(viewer, SWT.LEFT);
	TableColumn tblclmnReason = ret.getColumn();
	ColumnWeightData reasonColumnWeightData =
		new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true);
	layout.setColumnData(tblclmnReason, reasonColumnWeightData);
	tblclmnReason.setText(Messages.MedicationComposite_stopReason);
	tblclmnReason.setToolTipText(Messages.MedicationComposite_column_sortBy + " "
		+ Messages.MedicationComposite_stopReason);
	tblclmnReason.addSelectionListener(getSelectionAdapter(viewer, tblclmnReason, columnIndex));
	ret.setLabelProvider(new MedicationCellLabelProvider() {
		@Override
		public String getText(Object element){
			MedicationTableViewerItem pres = (MedicationTableViewerItem) element;
			if (pres.getEntryType() != EntryType.RECIPE
				&& pres.getEntryType() != EntryType.SELF_DISPENSED) {
				String stopReason = pres.getStopReason();
				if (stopReason != null && !stopReason.isEmpty()) {
					return stopReason;
				}
			}
			return "";
		}
	});
	return ret;
}
 
Example 14
Source File: ImportWizardPagePreview.java    From arx with Apache License 2.0 4 votes vote down vote up
/**
 * Adds input to table once page gets visible to the user
 * 
 * This retrieves the preview data {@link ImportWizardModel#getPreviewData()} and applies it to the given {@link #tableViewer}. Only columns that have been enabled will be shown.
 * New names and reordering is also considered.
 *
 * @param visible
 */
@Override
public void setVisible(boolean visible) {

    super.setVisible(visible);

    if (visible) {

        /* Disable rendering until everything is finished */
        table.setRedraw(false);

        /* Remove old columns */
        while (table.getColumnCount() > 0) {
            table.getColumns()[0].dispose();
        }

        /* Add enabled columns with appropriate label providers */
        int columns = 0;
        for (ImportColumn column : wizardImport.getData().getEnabledColumns()) {

            columns++;
            if (columns > MAX_COLUMS) {
                setMessage(Resources.getMessage("ImportWizardPageCSV.21"), WARNING); //$NON-NLS-1$
                break;
            }
            
            TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
            tableViewerColumn.setLabelProvider(new PreviewColumnLabelProvider(((IImportColumnIndexed) column).getIndex()));

            TableColumn tblclmnColumn = tableViewerColumn.getColumn();
            tblclmnColumn.setToolTipText(Resources.getMessage("ImportWizardPagePreview.5") + //$NON-NLS-1$
                                         column.getDataType());
            tblclmnColumn.setWidth(100);
            tblclmnColumn.setText(column.getAliasName());
        }

        ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.NO_RECREATE);

        /* Apply input to tableViewer */
        tableViewer.setInput(wizardImport.getData().getPreviewData());

        /* Make table visible again */
        table.layout();
        table.setRedraw(true);

        setPageComplete(true);

    } else {
        setPageComplete(false);
    }
}
 
Example 15
Source File: TreePropertySection.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Adds columns to the provided <code>TableViewer</code>.
 * 
 * @param tableViewer
 */
protected void addTableViewerColumns(TableViewer tableViewer) {

	if (tableViewer != null) {
		TableColumn column;
		ICellContentProvider contentProvider;

		// ---- Create the name column. ---- //
		nameColumn = new TableViewerColumn(tableViewer, SWT.LEFT);
		column = nameColumn.getColumn();
		column.setText("Name");
		column.setToolTipText("The name of the property");
		column.setResizable(true);
		// Create an ICellContentProvider, then use it to generate the
		// column labels and provide editing support for the name column.
		contentProvider = new NameCellContentProvider() {
			@Override
			public boolean setValue(Object element, Object value) {
				boolean changed = super.setValue(element, value);
				// If the value changed, mark the associated ICEFormEditor
				// as dirty.
				if (changed && editor != null) {
					editor.setDirty(true);
				}
				return changed;
			}
		};
		nameColumn.setLabelProvider(
				new CellColumnLabelProvider(contentProvider));
		nameColumn.setEditingSupport(
				new TextCellEditingSupport(tableViewer, contentProvider));
				// --------------------------------- //

		// ---- Create the value column. ---- //
		valueColumn = new TableViewerColumn(tableViewer, SWT.LEFT);
		column = valueColumn.getColumn();
		column.setText("Value");
		column.setToolTipText("The value of the property");
		column.setResizable(true);
		// Create an ICellContentProvider, then use it to generate the
		// column labels and provide editing support for the value column.
		contentProvider = new ValueCellContentProvider() {
			@Override
			public boolean setValue(Object element, Object value) {
				boolean changed = super.setValue(element, value);
				// If the value changed, mark the associated ICEFormEditor
				// as dirty.
				if (changed && editor != null) {
					editor.setDirty(true);
				}
				return changed;
			}
		};
		valueColumn.setLabelProvider(
				new CellColumnLabelProvider(contentProvider));
		valueColumn.setEditingSupport(new ComboCellEditingSupport(
				tableViewer, (IComboCellContentProvider) contentProvider));
		// ---------------------------------- //
	}

	return;
}
 
Example 16
Source File: MOOSETreePropertySection.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Adds the default and additional columns to the provided
 * <code>TableViewer</code>. This should only be invoked on
 * CheckboxTableViewers.
 */
@Override
protected void addTableViewerColumns(TableViewer tableViewer) {
	if (tableViewer != null) {
		TableColumn column;
		ICellContentProvider contentProvider;

		// // ---- Create the placeholder CheckBox column. ---- //
		checkColumn = new TableViewerColumn(tableViewer, SWT.LEFT);
		column = checkColumn.getColumn();
		column.setText("Enabled");
		column.setToolTipText("If checked, the parameter will be written "
				+ "to the input file.\n" + "If unchecked, the parameter "
				+ "will be commented out in the input file.");
		column.setResizable(true);

		// Create the check state manager. It also functions as the cell
		// content provider for the first column.
		TableCheckStateManager checkStateManager = new TableCheckStateManager(
				tableViewer) {
			@Override
			public boolean setValue(Object element, Object value) {
				boolean changed = super.setValue(element, value);
				// If the value changed, mark the associated ICEFormEditor
				// as dirty.
				if (changed && getFormEditor() != null) {
					getFormEditor().setDirty(true);
				}
				return changed;
			}
		};

		// Create a MOOSECheckStateProvider which sets the FormEditor as
		// dirty when the checkbox's value is changed.
		contentProvider = checkStateManager;

		// Add a blank label provider. Nothing should appear in the first
		// column except for the checkboxes.
		checkColumn.setLabelProvider(
				new CellColumnLabelProvider(contentProvider));

		// Set the content provider and listener for the CheckBox column
		CheckboxTableViewer checkedTableViewer = (CheckboxTableViewer) tableViewer;
		checkedTableViewer.setCheckStateProvider(checkStateManager);
		checkedTableViewer.addCheckStateListener(checkStateManager);

		// Create the default columns.
		super.addTableViewerColumns(tableViewer);

		// ---- Create the description/comments column. ---- //
		descriptionColumn = new TableViewerColumn(tableViewer, SWT.LEFT);
		column = descriptionColumn.getColumn();
		column.setText("Comments");
		column.setToolTipText("Comments about the property. These are "
				+ "stored as comments in the input file.");
		column.setResizable(true);
		// Create an ICellContentProvider for a column that shows the
		// descriptions of Entries. Then hook it up as a label provider and
		// for editing support.
		contentProvider = new DescriptionCellContentProvider() {
			@Override
			public boolean setValue(Object element, Object value) {
				boolean changed = super.setValue(element, value);
				// If the value changed, mark the associated ICEFormEditor
				// as dirty.
				if (changed && getFormEditor() != null) {
					getFormEditor().setDirty(true);
				}
				return changed;
			}
		};
		descriptionColumn.setLabelProvider(
				new CellColumnLabelProvider(contentProvider));
		descriptionColumn.setEditingSupport(
				new TextCellEditingSupport(tableViewer, contentProvider));
		// ------------------------------------------------- //
	}

	return;
}
 
Example 17
Source File: ValidationPreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
private Control createValidators(Composite parent)
{
	Composite main = new Composite(parent, SWT.NONE);
	main.setLayout(GridLayoutFactory.fillDefaults().spacing(0, 0).create());

	Composite labelComp = new Composite(main, SWT.NONE);
	labelComp.setLayout(GridLayoutFactory.fillDefaults().extendedMargins(5, 0, 0, 0).numColumns(2)
			.spacing(2, SWT.DEFAULT).create());
	labelComp.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).create());
	Label label = new Label(labelComp, SWT.NONE);
	label.setText(Messages.ValidationPreferencePage_LBL_Validators);
	Label helpImage = new Label(labelComp, SWT.NONE);
	helpImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_LCL_LINKTO_HELP));
	helpImage.setToolTipText(Messages.ValidationPreferencePage_EnablingValidatorWarning);

	Group group = new Group(main, SWT.NONE);
	group.setLayout(GridLayoutFactory.swtDefaults().margins(4, 4).create());
	group.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

	Table table = new Table(group, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
	table.setLayoutData(GridDataFactory.fillDefaults().hint(300, 100).grab(true, false).create());
	table.setLinesVisible(true);
	table.setHeaderVisible(true);

	// set up columns
	// Name column
	TableColumn name = new TableColumn(table, SWT.LEFT);
	name.setWidth(250);
	name.setText(Messages.ValidationPreferencePage_NameColumn);
	name.setToolTipText(Messages.ValidationPreferencePage_NameColumn);

	// Build column
	TableColumn build = new TableColumn(table, SWT.CENTER);
	build.setWidth(40);
	build.setText(Messages.ValidationPreferencePage_BuildColumn);
	build.setToolTipText(Messages.ValidationPreferencePage_BuildColumn);

	// Reconcile column
	TableColumn reconcile = new TableColumn(table, SWT.CENTER);
	reconcile.setWidth(75);
	reconcile.setText(Messages.ValidationPreferencePage_ReconcileColumn);
	reconcile.setToolTipText(Messages.ValidationPreferencePage_ReconcileColumn);

	// Now set up table viewer!
	validatorsViewer = new TableViewer(table);
	// validatorsViewer.setUseHashlookup(true);
	validatorsViewer.setColumnProperties(new String[] { NAME, BUILD, RECONCILE });

	// Assign the cell editors to the viewer
	validatorsViewer.setCellEditors(new CellEditor[] { null, new CheckboxCellEditor(table),
			new CheckboxCellEditor(table) });

	// Set the cell modifier for the viewer
	validatorsViewer.setCellModifier(new ParticipantCellModifier(validatorsViewer));

	// Now set up content/label providers
	validatorsViewer.setContentProvider(ArrayContentProvider.getInstance());
	validatorsViewer.setLabelProvider(new ParticipantLabelProvider());
	// Hide required participants
	validatorsViewer.addFilter(new RequiredParticipantFilter());
	// check the selected build participant, show it's filters
	validatorsViewer.addSelectionChangedListener(new ISelectionChangedListener()
	{
		public void selectionChanged(SelectionChangedEvent event)
		{
			updateFilterExpressions();
		}
	});

	// Now set input
	validatorsViewer.setInput(this.participants);

	return main;
}