org.eclipse.jface.viewers.TableViewerColumn Java Examples

The following examples show how to use org.eclipse.jface.viewers.TableViewerColumn. 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: AttributeEditionControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createMultipleColumn(TableViewer viewer) {
    TableViewerColumn column = new TableViewerColumn(viewer, SWT.CENTER);
    column.getColumn().setText(Messages.multiple);
    column.setLabelProvider(new CheckboxLabelProviderBuilder<Field>()
            .withIsSelectedProvider(Field::isCollection)
            .createCheckboxLabelProvider(viewer));
    column.setEditingSupport(new EditingSupportBuilder<Field>(viewer)
            .withCellEditorProvider(field -> new CheckboxCellEditor((Composite) viewer.getControl(), SWT.CHECK))
            .withValueProvider(field -> field.isCollection())
            .withValueUpdater((field, multiple) -> {
                field.setCollection((boolean) multiple);
                if ((boolean) multiple) {
                    field.setNullable(true);
                }
            })
            .create());
}
 
Example #2
Source File: ConstraintEditionControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createConstraintnameColumn(TableViewer viewer) {
    TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
    column.getColumn().setText(Messages.name);
    UniqueConstraintNameValidator constraintNameValidator = new UniqueConstraintNameValidator();

    column.setLabelProvider(new LabelProviderBuilder<UniqueConstraint>()
            .withTextProvider(element -> element.getName())
            .withStatusProvider(constraint -> constraintNameValidator.validate(constraint))
            .shouldRefreshAllLabels(viewer)
            .createColumnLabelProvider());
    column.setEditingSupport(new EditingSupportBuilder<UniqueConstraint>(viewer)
            .withId(SWTBotConstants.SWTBOT_ID_UNIQUE_CONSTRAINT_NAME_TEXTEDITOR)
            .withValueProvider(UniqueConstraint::getName)
            .withValueUpdater((constraint, newName) -> {
                if (!Objects.equals(constraint.getName(), newName)) {
                    constraint.setName((String) newName);
                }
            })
            .create());
}
 
Example #3
Source File: ChartMakerDialog.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private void createTypeTable() {
    GridData typeGridData = new GridData();
    typeGridData.verticalSpan = 3;
    typeGridData.horizontalAlignment = SWT.FILL;
    typeGridData.verticalAlignment = SWT.FILL;
    typeGridData.grabExcessHorizontalSpace = false;
    typeGridData.grabExcessVerticalSpace = true;

    TableViewerColumn typeColumn = new TableViewerColumn(fTypeTable, SWT.NONE);
    typeColumn.getColumn().setWidth(50);
    typeColumn.setLabelProvider(new TypeLabelProvider());

    List<IChartTypeDefinition> types = new ArrayList<>();
    types.add(new BarChartTypeDefinition());
    types.add(new ScatterChartTypeDefinition());

    fTypeTable.getTable().setParent(fComposite);
    fTypeTable.getTable().setLayoutData(typeGridData);
    fTypeTable.setContentProvider(ArrayContentProvider.getInstance());
    fTypeTable.addSelectionChangedListener(new TypeSelectionListener());
    fTypeTable.setInput(types);
}
 
Example #4
Source File: QueryDetailsControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected TableViewerColumn createNameColumn(TableViewer viewer) {
    TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
    column.getColumn().setText(Messages.name);

    QueryParameterNameValidator parameterNameValidator = new QueryParameterNameValidator(querySelectedObservable);

    column.setLabelProvider(new LabelProviderBuilder<QueryParameter>()
            .withTextProvider(parameter -> parameter.getName())
            .withStatusProvider(parameterNameValidator::validate)
            .shouldRefreshAllLabels(viewer)
            .createColumnLabelProvider());
    column.setEditingSupport(new EditingSupportBuilder<QueryParameter>(viewer)
            .withCanEditProvider(e -> !isDefault())
            .withValueProvider(QueryParameter::getName)
            .withValueUpdater((parameter, newName) -> {
                String oldName = parameter.getName();
                if (!Objects.equals(oldName, newName)) {
                    parameter.setName((String) newName);
                    formPage.refreshQueryViewers();
                }
            })
            .withId(SWTBotConstants.SWTBOT_ID_QUERY_PARAM_NAME_TEXTEDITOR)
            .create());

    return column;
}
 
Example #5
Source File: TmfSimpleTableViewer.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create a column for the table. The column will have a default width set,
 * and will be resizable, moveable and sortable.
 *
 * @param name
 *            the name of the column
 * @param provider
 *            the label provider of the column
 * @param comparator
 *            the comparator associated with clicking on the column, if it
 *            is null, a string comparator on the label will be used
 * @return the column that was created
 * @since 2.0
 */
public final <T> TableColumn createColumn(String name, ColumnLabelProvider provider, @Nullable Comparator<T> comparator) {
    TableViewerColumn col = new TableViewerColumn(fTableViewer, SWT.NONE);
    col.setLabelProvider(provider);
    final TableColumn column = col.getColumn();
    column.setWidth(DEFAULT_COL_WIDTH);
    column.setText(name);
    column.setResizable(true);
    column.setMoveable(true);
    if (comparator == null) {
        column.addSelectionListener(new ColumnSorter<>(column, new ColumnLabelComparator(provider)));
    } else {
        column.addSelectionListener(new ColumnSorter<>(column, comparator));
    }
    return column;
}
 
Example #6
Source File: MenuPage.java    From EasyShell with Eclipse Public License 2.0 6 votes vote down vote up
private void createColumns(final Composite parent, final TableViewer viewer) {
    TableViewerColumn viewerColumn1 = new TableViewerColumn(viewer,
            SWT.NONE);
    TableColumn column1 = viewerColumn1.getColumn();
    column1.setText(Activator.getResourceString("easyshell.menu.page.header.title.column0"));
    column1.setWidth(200);
    column1.setResizable(true);
    column1.setMoveable(true);

    TableViewerColumn viewerColumn2 = new TableViewerColumn(viewer,
            SWT.NONE);
    TableColumn column2 = viewerColumn2.getColumn();
    column2.setText(Activator.getResourceString("easyshell.menu.page.header.title.column1"));
    column2.setWidth(400);
    column2.setResizable(true);
    column2.setMoveable(true);
}
 
Example #7
Source File: RenamingView.java    From MergeProcessor with Apache License 2.0 6 votes vote down vote up
/**
 * @param parent a widget which will be the parent of the new instance (cannot
 *               be null)
 * @param style  the style of widget to construct
 */
public RenamingView(Composite parent, int style) {
	super(parent, style);

	final TableColumnLayout layout = new TableColumnLayout();
	setLayout(layout);

	viewer = new TableViewer(this, SWT.FULL_SELECTION);
	viewer.getTable().setHeaderVisible(true);
	viewer.getTable().setLinesVisible(true);

	viewerColumnFrom = new TableViewerColumn(viewer, SWT.NONE);
	viewerColumnFrom.getColumn().setText("From");
	layout.setColumnData(viewerColumnFrom.getColumn(), new ColumnWeightData(1));

	viewerColumnTo = new TableViewerColumn(viewer, SWT.NONE);
	viewerColumnTo.getColumn().setText("To");
	layout.setColumnData(viewerColumnTo.getColumn(), new ColumnWeightData(1));

}
 
Example #8
Source File: ContractInputTableViewer.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public void initialize() {
    final TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(100, false));
    getTable().setLayout(layout);
    getTable().setHeaderVisible(true);

    final TableViewerColumn columnViewer = new TableViewerColumn(this, SWT.NONE);
    final TableColumn column = columnViewer.getColumn();
    column.setText(Messages.name);
    columnViewer.setLabelProvider(new ContractInputLabelProvider());

    final TableColumnSorter sorter = new TableColumnSorter(this);
    sorter.setColumn(column);

    setContentProvider(ArrayContentProvider.getInstance());
}
 
Example #9
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 #10
Source File: BuyOrderTableViewer.java    From offspring with MIT License 6 votes vote down vote up
private void createColumns() {
  for (int id : BuyOrderTable.getColumns()) {
    TableViewerColumn viewerColumn = new TableViewerColumn(this, SWT.NONE);
    TableColumn column = viewerColumn.getColumn();

    viewerColumn.setEditingSupport(new BuyOrderEditingSupport(this, id));

    viewerColumn.setLabelProvider(BuyOrderTable.createLabelProvider(id));
    column.addSelectionListener(getSelectionAdapter(column, id));

    column.setText(BuyOrderTable.getColumnLabel(id));
    column.setAlignment(BuyOrderTable.getColumnAlignment(id));

    column.setResizable(BuyOrderTable.getColumnResizable(id));
    column.setWidth(BuyOrderTable.getColumnWidth(id));
  }
}
 
Example #11
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 #12
Source File: RolesWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void addNameColumn(final TableViewer tViewer) {
    final TableViewerColumn column = new TableViewerColumn(tViewer, SWT.FILL);
    final TableColumn nameColumn = column.getColumn();
    column.getColumn().setText(Messages.roleName);
    column.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(final Object element) {
            return ((Role) element).getName();
        }
    });

    column.getColumn().setWidth(90);
    column.getColumn().setMoveable(false);
    column.getColumn().setResizable(true);

    final TableColumnSorter sorter = new TableColumnSorter(tViewer);
    sorter.setColumn(nameColumn);
}
 
Example #13
Source File: ConstraintEditionControl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createAttributesColumn(TableViewer viewer) {
    TableViewerColumn column = new TableViewerColumn(viewer, SWT.LEFT);
    column.getColumn().setText(Messages.attributes);
    UniqueConstraintFieldsValidator uniqueConstraintFieldsValidator = new UniqueConstraintFieldsValidator();
    column.setLabelProvider(new LabelProviderBuilder<UniqueConstraint>()
            .withTextProvider(constraint -> constraint.getFieldNames().toString())
            .withStatusProvider(constraint -> uniqueConstraintFieldsValidator.validate(constraint))
            .createColumnLabelProvider());
}
 
Example #14
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 #15
Source File: ExpressionCollectionViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected void addColumnToViewer(final int index) {
    final TableViewerColumn column = new TableViewerColumn(viewer, SWT.FILL);

    if (captions != null && captions.size() > index
            && captions.get(index) != null) {
        column.getColumn().setText(captions.get(index));
    }

    final ExpressionCollectionEditingSupport editingSupport = new ExpressionCollectionEditingSupport(
            column.getViewer(), index, editingDomain, removeRowListener);
    if (context != null) {
        editingSupport.setInput(context);
    }
    if (viewerFilters != null && viewerFilters.size() > index) {
        final ViewerFilter filter = viewerFilters.get(index);
        if (filter != null) {
            editingSupport.addFilter(filter);
        }
        if (viewerExprProviders != null
                && viewerExprProviders.size() > index) {
            final IExpressionNatureProvider provider = viewerExprProviders
                    .get(index);
            if (provider != null) {
                editingSupport.setExpressionNatureProvider(provider);
            }
        }
    }
    editingSupports.add(index, editingSupport);
    column.setEditingSupport(editingSupport);
    column.setLabelProvider(new ExpressionColumnLabelProvider(index));
    viewer.getTable().setLayout(createTableLayout());
}
 
Example #16
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 #17
Source File: QueryExpressionEditor.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createNameColumn(final TableViewer tableViewer) {
    final TableViewerColumn nameColumnViewer = new TableViewerColumn(tableViewer, SWT.LEFT);
    final TableColumn column = nameColumnViewer.getColumn();
    column.setText(Messages.name);
    nameColumnViewer.setLabelProvider(
            new LabelProviderBuilder<Expression>()
                    .withTextProvider(Expression::getName)
                    .createColumnLabelProvider());
}
 
Example #18
Source File: SelectUserMappingWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void createControl(final Composite parent) {
    super.createControl(parent);

    final Composite mainComposite = (Composite) getControl();
    final Composite viewersComposite = new Composite(mainComposite, SWT.NONE);
    viewersComposite.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).span(2, 1).hint(SWT.DEFAULT, 250).create());
    viewersComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(5, 5).extendedMargins(0, 0, 10, 0).create());

    availableUserViewer = CheckboxTableViewer.newCheckList(viewersComposite, SWT.BORDER | SWT.FULL_SELECTION);
    availableUserViewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    availableUserViewer.getTable().setHeaderVisible(true);
    availableUserViewer.setContentProvider(new ArrayContentProvider());
    final TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(100));
    availableUserViewer.getTable().setLayout(layout);

    final TableViewerColumn columnViewer = new TableViewerColumn(availableUserViewer, SWT.NONE);
    final TableColumn usernameColumn = columnViewer.getColumn();
    usernameColumn.setText(Messages.userName);
    columnViewer.setLabelProvider(new ColumnLabelProvider());
    final TableColumnSorter sorter = new TableColumnSorter(availableUserViewer);
    sorter.setColumn(usernameColumn);

    availableUserViewer.setInput(availableUsers);
    availableUserViewer.setCheckedElements(selectedUsers.toArray());

}
 
Example #19
Source File: BlockTableViewer.java    From offspring with MIT License 5 votes vote down vote up
private void createColumns() {
  for (int id : BlockTable.getColumns()) {
    TableViewerColumn viewerColumn = new TableViewerColumn(this, SWT.NONE);
    TableColumn column = viewerColumn.getColumn();

    viewerColumn.setLabelProvider(BlockTable.createLabelProvider(id));

    column.setText(BlockTable.getColumnLabel(id));
    column.setAlignment(BlockTable.getColumnAlignment(id));

    column.setResizable(BlockTable.getColumnResizable(id));
    column.setWidth(BlockTable.getColumnWidth(id));
  }
}
 
Example #20
Source File: DefinesViewer.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 #21
Source File: XPathExpressionEditor.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Control createExpressionEditor(final Composite parent, final EMFDataBindingContext ctx) {
    mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    mainComposite.setLayout(new GridLayout(2, true));

    viewer = new TableViewer(mainComposite, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);

    final TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(100, false));
    viewer.getTable().setLayout(layout);
    viewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    final TableViewerColumn columnViewer = new TableViewerColumn(viewer, SWT.NONE);
    final TableColumn column = columnViewer.getColumn();
    column.setText(Messages.name);

    final TableColumnSorter sorter = new TableColumnSorter(viewer);
    sorter.setColumn(column);

    viewer.getTable().setHeaderVisible(true);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new DataStyledTreeLabelProvider());
    viewer.addPostSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            if (!event.getSelection().isEmpty()) {
                xsdViewer.expandAll();
                XPathExpressionEditor.this.fireSelectionChanged();
            }
        }
    });

    createXPathChooser(mainComposite);
    createReturnTypeComposite(parent);

    return mainComposite;
}
 
Example #22
Source File: View.java    From codeexamples-eclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createPartControl(Composite parent) {
	viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
	viewer.getTable().setLinesVisible(true);

	TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
	column.setLabelProvider(new StringLabelProvider());

	viewer.getTable().getColumn(0).setWidth(200);
	
	viewer.setContentProvider(ArrayContentProvider.getInstance());
	
	// Provide the input to the ContentProvider
	viewer.setInput(createInitialDataModel());
}
 
Example #23
Source File: AdditionalResourcesConfigurationWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createFileColumn() {
    TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
    column.getColumn().setText(Messages.file);

    AdditionalResourceProjectPathValidator validator = new AdditionalResourceProjectPathValidator();

    column.setLabelProvider(new LabelProviderBuilder<Resource>()
            .withTextProvider(Resource::getProjectPath)
            .shouldRefreshAllLabels(viewer)
            .withStatusProvider(validator::validate)
            .createColumnLabelProvider());
    column.setEditingSupport(new AdditionalResourcesFileEditingSupport(viewer));
}
 
Example #24
Source File: ContractConstraintsTableViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected void createConstraintNameColumn() {
    final TableViewerColumn nameColumnViewer = createColumnViewer(Messages.name + " *", SWT.FILL);
    nameColumnViewer.setLabelProvider(new ConstraintNameCellLabelProvider(propertySourceProvider, knowElements()));
    final ConstraintNameObservableEditingSupport editingSupport = new ConstraintNameObservableEditingSupport(this, messageManager,
            emfDataBindingContext);
    editingSupport.setControlId(SWTBotConstants.SWTBOT_ID_CONSTRAINT_NAME_TEXTEDITOR);
    nameColumnViewer.setEditingSupport(editingSupport);
}
 
Example #25
Source File: StatisticsView.java    From CogniCrypt with Eclipse Public License 2.0 5 votes vote down vote up
private TableViewerColumn createTableViewerColumn(String title, int bound, final int colNumber) {
	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 #26
Source File: SearchResultViewer.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Create the table columns.
 */
private void createColumns() {
	for (int col = 0; col < columnLabel.length; col++) {
		TableViewerColumn column = new TableViewerColumn(this, SWT.NONE);
		column.getColumn().setText(columnLabel[col]);
		column.getColumn().setWidth(columnWidth[col]);
		column.getColumn().setResizable(true);
		column.getColumn().setMoveable(true);
	}
}
 
Example #27
Source File: IndexControl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createAttributesColumn(TableViewer viewer) {
    TableViewerColumn column = new TableViewerColumn(viewer, SWT.LEFT);
    column.getColumn().setText(Messages.attributes);
    IndexFieldsValidator indexFieldsValidator = new IndexFieldsValidator();
    column.setLabelProvider(new LabelProviderBuilder<Index>()
            .withTextProvider(index -> index.getFieldNames().toString())
            .withStatusProvider(index -> indexFieldsValidator.validate(index))
            .createColumnLabelProvider());
}
 
Example #28
Source File: AbapGitView.java    From ADT_Frontend with MIT License 5 votes vote down vote up
private TableViewerColumn createTableViewerColumn(String title, int bound) {
	TableViewerColumn viewerColumn = new TableViewerColumn(this.viewer, SWT.NONE);
	TableColumn column = viewerColumn.getColumn();
	column.setText(title);
	column.setWidth(bound);
	column.setResizable(true);
	column.setMoveable(true);
	return viewerColumn;
}
 
Example #29
Source File: AttributeEditionControl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createNameColumn(TableViewer viewer) {
    TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
    column.getColumn().setText(Messages.name);
    FieldNameValidator fieldNameValidator = new FieldNameValidator();

    column.setLabelProvider(new LabelProviderBuilder<Field>()
            .withTextProvider(element -> element.getName())
            .withStatusProvider(fieldNameValidator::validate)
            .shouldRefreshAllLabels(viewer)
            .createColumnLabelProvider());
    column.setEditingSupport(new EditingSupportBuilder<Field>(viewer)
            .withId(SWTBotConstants.SWTBOT_ID_ATTRIBUTE_NAME_TEXTEDITOR)
            .withValueProvider(Field::getName)
            .withValueUpdater((field, newName) -> {
                String oldName = field.getName();
                if (!Objects.equals(oldName, newName)) {
                    Field oldField = EcoreUtil.copy(field);
                    field.setName((String) newName);
                    refactorConstraintsOnRename(oldName, (String) newName);
                    refactorIndexesOnRename(oldName, (String) newName);
                    refactorQueriesOnRename(oldName, (String) newName);
                    DiffElement diff = new DiffElement(Event.RENAME_ATTRIBUTE, oldField, field);
                    diff.addProperty(PARENT_QUALIFIED_NAME, ((BusinessObject) field.eContainer()).getQualifiedName());
                    formPage.refactorAccessControl(diff);
                }
            })
            .create());
}
 
Example #30
Source File: ModelSortPageableTableExample.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;
}