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

The following examples show how to use org.eclipse.swt.widgets.TableColumn#setText() . 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: ExportToTranslationDictionaryDialog.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
private void createTable(final Composite parent) {
    final GridData gridData = new GridData();
    gridData.heightHint = 150;
    gridData.horizontalSpan = 2;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;

    dictionaryTable = new Table(parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.MULTI);
    dictionaryTable.setHeaderVisible(true);
    dictionaryTable.setLinesVisible(true);
    dictionaryTable.setLayoutData(gridData);

    parent.pack();

    final int width = dictionaryTable.getBounds().width;

    final TableColumn physicalNameTableColumn = new TableColumn(dictionaryTable, SWT.LEFT);
    physicalNameTableColumn.setText(ResourceString.getResourceString("label.physical.name"));
    physicalNameTableColumn.setWidth(width / 2 - 5);

    final TableColumn logicalNameTableColumn = new TableColumn(dictionaryTable, SWT.LEFT);

    logicalNameTableColumn.setText(ResourceString.getResourceString("label.logical.name"));
    logicalNameTableColumn.setWidth(width / 2 - 5);
}
 
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 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 3
Source File: TBXMakerDialog.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 设置列属性 ;
 */
private void setColumnType() {
	if (cols < 2) {
		MessageDialog.openInformation(getShell(), Messages.getString("dialog.TBXMakerDialog.msgTitle"),
				Messages.getString("dialog.TBXMakerDialog.msg2"));
		return;
	}
	Vector<ColProperties> colTypes = new Vector<ColProperties>(cols);
	for (int i = 0; i < cols; i++) {
		colTypes.add((ColProperties) table.getColumn(i).getData());
	}

	ColumnTypeDialog selector = new ColumnTypeDialog(getShell(), colTypes, template, imagePath);
	if (selector.open() == IDialogConstants.OK_ID) {
		for (int i = 0; i < cols; i++) {
			TableColumn col = table.getColumn(i);
			ColProperties type = colTypes.get(i);
			if (!type.getColName().equals("") && !type.getLanguage().equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
				col.setText(type.getColName());
			}
		}
	}
}
 
Example 4
Source File: QueryExpressionEditor.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createValueColumn(final TableViewer tableViewer) {
    final TableViewerColumn valueColumnViewer = new TableViewerColumn(tableViewer, SWT.FILL);
    final TableColumn column = valueColumnViewer.getColumn();
    column.setText(Messages.value);
    final ExpressionColumnLabelProvider expressionLabelProvider = new ExpressionColumnLabelProvider(0);
    valueColumnViewer.setLabelProvider(new LabelProviderBuilder<Expression>()
            .withTextProvider(exp -> exp.getReferencedElements().isEmpty() ? null
                    : expressionLabelProvider.getText(exp.getReferencedElements().get(0)))
            .withImageProvider(exp -> exp.getReferencedElements().isEmpty() ? null
                    : expressionLabelProvider.getImage(exp.getReferencedElements().get(0)))
            .createColumnLabelProvider());

    editingSupport = new ReferencedExpressionEditingSupport(valueColumnViewer.getViewer());
    editingSupport.setFilter(new AvailableExpressionTypeFilter(new String[] { ExpressionConstants.CONSTANT_TYPE,
            ExpressionConstants.VARIABLE_TYPE,
            ExpressionConstants.PARAMETER_TYPE,
            ExpressionConstants.SCRIPT_TYPE,
            ExpressionConstants.CONTRACT_INPUT_TYPE }));
    valueColumnViewer.setEditingSupport(editingSupport);
}
 
Example 5
Source File: UsersWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createGeneralDataTable(final Composite tables) {
    final Composite generalDataTableComposite = new Composite(tables, SWT.NONE);
    generalDataTableComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
    generalDataTableComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    final Table generalDataTable = new Table(generalDataTableComposite, SWT.BORDER);
    generalDataTable.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    generalDataTable.setLinesVisible(true);
    generalDataTable.setHeaderVisible(true);

    final String[] generalDataItems = getGeneralDataItems();
    final TableColumn generalData = new TableColumn(generalDataTable, SWT.NONE);
    generalData.setText(Messages.defaultInformationGroupGeneralDataTableTitle);
    generalData.setResizable(false);

    for (int i = 0; i < generalDataItems.length; i++) {
        final TableItem item = new TableItem(generalDataTable, SWT.NONE | SWT.FILL);
        item.setText(generalDataItems[i]);
    }

    addTableColumLayout(generalDataTable);
}
 
Example 6
Source File: IndexDialog.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
private void initializeIndexColumnList(Composite parent) {
	GridData gridData = new GridData();
	gridData.heightHint = 150;
	gridData.verticalSpan = 2;

	indexColumnList = new Table(parent, SWT.FULL_SELECTION | SWT.BORDER);
	indexColumnList.setHeaderVisible(true);
	indexColumnList.setLayoutData(gridData);
	indexColumnList.setLinesVisible(false);

	TableColumn tableColumn = new TableColumn(indexColumnList, SWT.CENTER);
	tableColumn.setWidth(150);
	tableColumn.setText(ResourceString
			.getResourceString("label.column.name"));

	if (DBManagerFactory.getDBManager(this.table.getDiagram()).isSupported(
			DBManager.SUPPORT_DESC_INDEX)) {
		TableColumn tableColumn1 = new TableColumn(indexColumnList,
				SWT.CENTER);
		tableColumn1.setWidth(50);
		tableColumn1.setText(ResourceString
				.getResourceString("label.order.desc"));
	}
}
 
Example 7
Source File: SinkView.java    From lapse-plus with GNU General Public License v3.0 5 votes vote down vote up
private void createColumns() {
    TableLayout layout = new TableLayout();
    getTable().setLayout(layout);
    getTable().setHeaderVisible(true);
    for (int i = 0; i < columnHeaders.length; i++) {
        layout.addColumnData(columnLayouts[i]);
        TableColumn tc = new TableColumn(getTable(), SWT.BORDER, i);
        tc.setResizable(columnLayouts[i].resizable);
        tc.setText(columnHeaders[i]);
        tc.pack();
        final int j = i;
        tc.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                ViewerSorter oldSorter = viewer.getSorter();
                if (oldSorter instanceof ColumnBasedSorter) {
                    ColumnBasedSorter sorter = (ColumnBasedSorter) oldSorter;
                    if (sorter.getColumn() == j) {
                        sorter.toggle();
                        viewer.refresh();
                        // System.err.println("Resorting column " + j +
                        // " in order "
                        // + sorter.getOrientation());
                        return;
                    }
                }
                viewer.setSorter(new ColumnBasedSorter(j));
                logError("Sorting column " + j + " in order " + 1);
                viewer.refresh();
            }
        });
    }
}
 
Example 8
Source File: EditColTableDef.java    From depan with Apache License 2.0 5 votes vote down vote up
public static void setupTable(EditColTableDef[] tableDef, Table tableData) {
  for (EditColTableDef d : tableDef) {
    TableColumn col = new TableColumn(tableData, SWT.LEFT);
    col.setText(d.getLabel());
    col.setWidth(d.getWidth());
  }
}
 
Example 9
Source File: StringSortPageableTableExample.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private static TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound) {
	final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE);
	final TableColumn column = viewerColumn.getColumn();
	column.setText(title);
	column.setWidth(bound);
	column.setResizable(true);
	column.setMoveable(true);
	return viewerColumn;
}
 
Example 10
Source File: UnDefinesViewer.java    From cmake4eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates a table viewer column for the table.
 */
private TableViewerColumn createTableViewerColumn(final TableViewer viewer,
    String title, int colWidth, final int colNumber) {
  final TableViewerColumn viewerColumn = new TableViewerColumn(viewer,
      SWT.NONE);
  final TableColumn column = viewerColumn.getColumn();
  column.setText(title);
  column.setWidth(colWidth);
  column.setResizable(true);
  column.setMoveable(true);
  column.addSelectionListener(createSelectionAdapter(column, colNumber));
  return viewerColumn;
}
 
Example 11
Source File: Bug469441.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private static TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound) {
	final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE);
	final TableColumn column = viewerColumn.getColumn();
	column.setText(title);
	column.setWidth(bound);
	column.setResizable(true);
	column.setMoveable(true);
	return viewerColumn;
}
 
Example 12
Source File: UsersWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createMembershipsTable(final Composite memberships) {

        final Table membershipTable = new Table(memberships, SWT.BORDER | SWT.FILL);
        membershipTable.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
        membershipTable.setLinesVisible(true);
        membershipTable.setHeaderVisible(true);

        final TableColumn membershipColumn = new TableColumn(membershipTable, SWT.NONE | SWT.FILL);
        membershipColumn.setText(Messages.defaultInformationGroupMembershipsTableTitle);
        membershipColumn.setResizable(false);

        final TableItem descriptionMembership = new TableItem(membershipTable, SWT.NONE);
        descriptionMembership.setText(Messages.defaultInformationGroupMembershipsTableText);
        addTableColumLayout(membershipTable);
    }
 
Example 13
Source File: ResolvablePropertiesDialog.java    From eclipse-cs with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Creates the dialogs main contents.
 *
 * @param parent
 *          the parent composite
 */
@Override
protected Control createDialogArea(Composite parent) {

  // set the logo
  this.setTitleImage(CheckstyleUIPluginImages.getImage(CheckstyleUIPluginImages.PLUGIN_LOGO));
  this.setTitle(Messages.ResolvablePropertiesDialog_titleMessageArea);
  this.setMessage(Messages.ResolvablePropertiesDialog_msgAdditionalProperties);

  Composite composite = (Composite) super.createDialogArea(parent);

  Composite contents = new Composite(composite, SWT.NULL);
  contents.setLayout(new GridLayout(2, false));
  GridData fd = new GridData(GridData.FILL_BOTH);
  contents.setLayoutData(fd);

  Table table = new Table(contents, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
  table.setLayoutData(new GridData(GridData.FILL_BOTH));

  table.setHeaderVisible(true);
  table.setLinesVisible(true);

  TableLayout tableLayout = new TableLayout();
  table.setLayout(tableLayout);

  TableColumn column1 = new TableColumn(table, SWT.NULL);
  column1.setText(Messages.ResolvablePropertiesDialog_colName);
  tableLayout.addColumnData(new ColumnWeightData(50));

  TableColumn column2 = new TableColumn(table, SWT.NULL);
  column2.setText(Messages.ResolvablePropertiesDialog_colValue);
  tableLayout.addColumnData(new ColumnWeightData(50));

  mTableViewer = new EnhancedTableViewer(table);
  PropertiesLabelProvider multiProvider = new PropertiesLabelProvider();
  mTableViewer.setLabelProvider(multiProvider);
  mTableViewer.setTableComparableProvider(multiProvider);
  mTableViewer.setTableSettingsProvider(multiProvider);
  mTableViewer.installEnhancements();

  mTableViewer.setContentProvider(new ArrayContentProvider());
  mTableViewer.addDoubleClickListener(mController);
  mTableViewer.getTable().addKeyListener(mController);

  Composite buttonBar = new Composite(contents, SWT.NULL);
  GridLayout layout = new GridLayout(1, false);
  layout.marginHeight = 0;
  layout.marginWidth = 0;
  buttonBar.setLayout(layout);
  GridData gd = new GridData();
  gd.verticalAlignment = GridData.BEGINNING;
  buttonBar.setLayoutData(gd);

  mBtnAdd = new Button(buttonBar, SWT.PUSH);
  mBtnAdd.setText(Messages.ResolvablePropertiesDialog_btnAdd);
  mBtnAdd.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  mBtnAdd.addSelectionListener(mController);

  mBtnEdit = new Button(buttonBar, SWT.PUSH);
  mBtnEdit.setText(Messages.ResolvablePropertiesDialog_btnEdit);
  mBtnEdit.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  mBtnEdit.addSelectionListener(mController);

  mBtnRemove = new Button(buttonBar, SWT.PUSH);
  mBtnRemove.setText(Messages.ResolvablePropertiesDialog_btnRemove);
  mBtnRemove.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  mBtnRemove.addSelectionListener(mController);

  return composite;
}
 
Example 14
Source File: MainWalkerGroupManageDialog.java    From erflute with Apache License 2.0 4 votes vote down vote up
private void createCategoryGroup(Composite composite) {
    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 4;

    final Group group = new Group(composite, SWT.NONE);
    group.setText(DisplayMessages.getMessage("label.category.message"));
    group.setLayout(gridLayout);

    CompositeFactory.filler(group, 4);

    final GridData tableGridData = new GridData();
    tableGridData.heightHint = 200;
    tableGridData.horizontalSpan = 3;
    tableGridData.verticalSpan = 2;

    this.categoryTable = new Table(group, SWT.BORDER | SWT.FULL_SELECTION);
    categoryTable.setHeaderVisible(true);
    categoryTable.setLayoutData(tableGridData);
    categoryTable.setLinesVisible(true);

    final GridData upButtonGridData = new GridData();
    upButtonGridData.grabExcessHorizontalSpace = false;
    upButtonGridData.verticalAlignment = GridData.END;
    upButtonGridData.grabExcessVerticalSpace = true;
    upButtonGridData.widthHint = DesignResources.BUTTON_WIDTH;

    final GridData downButtonGridData = new GridData();
    downButtonGridData.grabExcessVerticalSpace = true;
    downButtonGridData.verticalAlignment = GridData.BEGINNING;
    downButtonGridData.widthHint = DesignResources.BUTTON_WIDTH;

    this.upButton = new Button(group, SWT.NONE);
    upButton.setText(DisplayMessages.getMessage("label.up.arrow"));
    upButton.setLayoutData(upButtonGridData);

    this.downButton = new Button(group, SWT.NONE);
    downButton.setText(DisplayMessages.getMessage("label.down.arrow"));
    downButton.setLayoutData(downButtonGridData);

    final GridData textGridData = new GridData();
    textGridData.widthHint = 150;

    this.categoryNameText = new Text(group, SWT.BORDER);
    categoryNameText.setLayoutData(textGridData);

    final GridData buttonGridData = new GridData();
    buttonGridData.widthHint = DesignResources.BUTTON_WIDTH;

    this.addCategoryButton = new Button(group, SWT.NONE);
    addCategoryButton.setLayoutData(buttonGridData);
    addCategoryButton.setText(DisplayMessages.getMessage("label.button.add"));

    this.updateCategoryButton = new Button(group, SWT.NONE);
    updateCategoryButton.setLayoutData(buttonGridData);
    updateCategoryButton.setText(DisplayMessages.getMessage("label.button.update"));

    this.deleteCategoryButton = new Button(group, SWT.NONE);
    deleteCategoryButton.setLayoutData(buttonGridData);
    deleteCategoryButton.setText(DisplayMessages.getMessage("label.button.delete"));

    final TableColumn tableColumn = new TableColumn(categoryTable, SWT.NONE);
    tableColumn.setWidth(30);
    tableColumn.setResizable(false);
    final TableColumn tableColumn1 = new TableColumn(categoryTable, SWT.NONE);
    tableColumn1.setWidth(230);
    tableColumn1.setResizable(false);
    tableColumn1.setText(DisplayMessages.getMessage("label.category.name"));
}
 
Example 15
Source File: FileSetEditDialog.java    From eclipse-cs with GNU Lesser General Public License v2.1 4 votes vote down vote up
private Control createFileMatchPatternPart(Composite parent) {

    Group composite = new Group(parent, SWT.NONE);
    composite.setText(Messages.FileSetEditDialog_titlePatternsTable);
    composite.setLayout(new FormLayout());

    final Composite buttons = new Composite(composite, SWT.NULL);
    FormData fd = new FormData();
    fd.top = new FormAttachment(0, 3);
    fd.right = new FormAttachment(100, -3);
    fd.bottom = new FormAttachment(100, -3);

    buttons.setLayoutData(fd);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    buttons.setLayout(layout);

    final Table table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.FULL_SELECTION);
    fd = new FormData();
    fd.left = new FormAttachment(0, 3);
    fd.top = new FormAttachment(0, 3);
    fd.right = new FormAttachment(buttons, -3, SWT.LEFT);
    fd.bottom = new FormAttachment(100, -3);
    table.setLayoutData(fd);

    TableLayout tableLayout = new TableLayout();
    table.setLayout(tableLayout);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    TableColumn column1 = new TableColumn(table, SWT.NONE);
    column1.setText(Messages.FileSetEditDialog_colInclude);

    tableLayout.addColumnData(new ColumnWeightData(11));

    TableColumn column2 = new TableColumn(table, SWT.NONE);
    column2.setText(Messages.FileSetEditDialog_colRegex);
    tableLayout.addColumnData(new ColumnWeightData(89));

    mPatternViewer = new CheckboxTableViewer(table);

    mPatternViewer.setLabelProvider(new FileMatchPatternLabelProvider());
    mPatternViewer.setContentProvider(new ArrayContentProvider());
    mPatternViewer.addDoubleClickListener(mController);
    mPatternViewer.addCheckStateListener(mController);

    //
    // Build the buttons.
    //

    mAddButton = createPushButton(buttons, Messages.FileSetEditDialog_btnAdd);
    mAddButton.addSelectionListener(mController);

    mEditButton = createPushButton(buttons, Messages.FileSetEditDialog_btnEdit);
    mEditButton.addSelectionListener(mController);

    mRemoveButton = createPushButton(buttons, Messages.FileSetEditDialog_btnRemove);
    mRemoveButton.addSelectionListener(mController);

    mUpButton = createPushButton(buttons, Messages.FileSetEditDialog_btnUp);
    mUpButton.addSelectionListener(mController);

    mDownButton = createPushButton(buttons, Messages.FileSetEditDialog_btnDown);
    mDownButton.addSelectionListener(mController);

    return composite;
  }
 
Example 16
Source File: ShowSummaryFieldDialog.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private void createSummaryFiledViewer( Composite dialogArea )
{
	Table table = new Table( dialogArea, SWT.BORDER
			| SWT.SINGLE
			| SWT.H_SCROLL
			| SWT.V_SCROLL
			| SWT.FULL_SELECTION
			| SWT.CHECK );
	table.setLinesVisible( true );
	table.setHeaderVisible( true );

	GridData gd = new GridData( GridData.FILL_BOTH );
	gd.heightHint = 250;
	table.setLayoutData( gd );

	summaryFieldViewer = new CheckboxTableViewer( table );
	SummaryFieldProvider provider = new SummaryFieldProvider( );

	for ( int i = 0; i < columnNames.length; i++ )
	{
		TableColumn column = new TableColumn( table, SWT.LEFT );
		column.setText( columnNames[i] );
		column.setWidth( columnWidth[i] );
	}
	ComboBoxCellEditor comboCell = new ComboBoxCellEditor( table,
			new String[0],
			SWT.READ_ONLY );
	// TextCellEditor textCell = new TextCellEditor(table, SWT.NONE);
	cellEditor = new CellEditor[]{
			null, comboCell
	};
	summaryFieldViewer.setColumnProperties( columnNames );
	summaryFieldViewer.setCellEditors( cellEditor );
	summaryFieldViewer.setCellModifier( cellModifier );
	summaryFieldViewer.setUseHashlookup( true );
	summaryFieldViewer.setContentProvider( provider );
	summaryFieldViewer.setLabelProvider( provider );

	summaryFieldViewer.addCheckStateListener( new ICheckStateListener( ) {

		public void checkStateChanged( CheckStateChangedEvent event )
		{
			MeasureInfo info = (MeasureInfo) event.getElement( );
			if ( event.getChecked( ) )
			{
				info.setShow( true );
			}
			else
			{
				info.setShow( false );
			}
			checkOKButtonStatus( );
		}

	} );
}
 
Example 17
Source File: DBSettingListDialog.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
@Override
protected void initialize(Composite composite) {
	GridData gridData = new GridData();
	gridData.heightHint = 150;

	this.settingTable = new Table(composite, SWT.FULL_SELECTION
			| SWT.BORDER);
	this.settingTable.setHeaderVisible(true);
	this.settingTable.setLayoutData(gridData);
	this.settingTable.setLinesVisible(false);

	TableColumn dbsystemColumn = new TableColumn(this.settingTable,
			SWT.LEFT);
	dbsystemColumn.setWidth(100);
	dbsystemColumn.setText(ResourceString
			.getResourceString("label.database"));

	TableColumn serverColumn = new TableColumn(this.settingTable, SWT.LEFT);
	serverColumn.setWidth(100);
	serverColumn.setText(ResourceString
			.getResourceString("label.server.name"));

	TableColumn portColumn = new TableColumn(this.settingTable, SWT.RIGHT);
	portColumn.setWidth(80);
	portColumn.setText(ResourceString.getResourceString("label.port"));

	TableColumn databaseColumn = new TableColumn(this.settingTable,
			SWT.LEFT);
	databaseColumn.setWidth(100);
	databaseColumn.setText(ResourceString
			.getResourceString("label.database.name"));

	TableColumn userNameColumn = new TableColumn(this.settingTable,
			SWT.LEFT);
	userNameColumn.setWidth(100);
	userNameColumn.setText(ResourceString
			.getResourceString("label.user.name"));

	TableColumn urlTableColumn = new TableColumn(this.settingTable,
			SWT.LEFT);
	urlTableColumn.setWidth(130);
	urlTableColumn.setText(ResourceString.getResourceString("label.url"));
}
 
Example 18
Source File: ModelPropertiesDialog.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
/**
 * This method initializes composite1
 */
private void createTableComposite(final Composite parent) {
    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 3;

    final GridData gridData = new GridData();
    gridData.heightHint = 320;

    final GridData tableGridData = new GridData();
    tableGridData.horizontalSpan = 3;
    tableGridData.heightHint = 185;

    final Composite composite = new Composite(parent, SWT.BORDER);
    composite.setLayout(gridLayout);
    composite.setLayoutData(gridData);

    table = new Table(composite, SWT.BORDER | SWT.FULL_SELECTION);
    table.setHeaderVisible(true);
    table.setLayoutData(tableGridData);
    table.setLinesVisible(true);

    final TableColumn tableColumn0 = new TableColumn(table, SWT.NONE);
    tableColumn0.setWidth(200);
    tableColumn0.setText(ResourceString.getResourceString("label.property.name"));
    final TableColumn tableColumn1 = new TableColumn(table, SWT.NONE);
    tableColumn1.setWidth(200);
    tableColumn1.setText(ResourceString.getResourceString("label.property.value"));

    tableEditor = new TableEditor(table);
    tableEditor.grabHorizontal = true;

    table.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDown(final MouseEvent event) {
            final int index = table.getSelectionIndex();
            if (index == -1) {
                return;
            }

            final TableItem item = table.getItem(index);
            final Point selectedPoint = new Point(event.x, event.y);

            targetColumn = -1;

            for (int i = 0; i < table.getColumnCount(); i++) {
                final Rectangle rect = item.getBounds(i);
                if (rect.contains(selectedPoint)) {
                    targetColumn = i;
                    break;
                }
            }

            if (targetColumn == -1) {
                return;
            }

            edit(item, tableEditor);
        }

    });
}
 
Example 19
Source File: ExportTmxDialog.java    From translationstudio8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 设置TableViewer 列属性
 * @param viewer
 * @param title
 *            列标题
 * @param bound
 *            列宽
 * @param colNumber
 *            列序号
 * @return {@link TableViewerColumn};
 */
private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) {
	final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize);
	final TableColumn column = viewerColumn.getColumn();
	column.setText(title);
	column.setWidth(bound);
	column.setResizable(true);
	column.setMoveable(true);
	return viewerColumn;
}
 
Example 20
Source File: PreTranslationResultDialog.java    From tmxeditor8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 设置TableViewer 列属性
 * @param viewer
 * @param title
 *            列标题
 * @param bound
 *            列宽
 * @param colNumber
 *            列序号
 * @return {@link TableViewerColumn};
 */
private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) {
	final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize);
	final TableColumn column = viewerColumn.getColumn();
	column.setText(title);
	column.setWidth(bound);
	column.setResizable(true);
	column.setMoveable(true);
	return viewerColumn;
}