org.eclipse.jface.viewers.ColumnLayoutData Java Examples

The following examples show how to use org.eclipse.jface.viewers.ColumnLayoutData. 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: AbstractCallHierarchyViewPart.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
protected TableViewer createLocationViewer(Composite parent) {
	TableViewer locationViewer = new TableViewer(parent);
	locationViewer.setContentProvider(new ArrayContentProvider());
	locationViewer.setLabelProvider(createLocationLabelProvider());

	TableLayout layout = new TableLayout();
	locationViewer.getTable().setLayout(layout);
	locationViewer.getTable().setHeaderVisible(true);

	Pair<String, ColumnLayoutData>[] locationColumnDescriptions = getLocationColumnDescriptions();
	IntStream.range(0, locationColumnDescriptions.length).forEach(index -> {
		layout.addColumnData(locationColumnDescriptions[index].getValue());
		createColumn(locationViewer.getTable(), locationColumnDescriptions[index], index);
	});

	return locationViewer;
}
 
Example #2
Source File: BundledResourcesSelectionBlock.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
private void createListField() {
  String[] buttons = new String[] {
      "Add...", "Add Multiple...", "Edit", null, "Remove", null};

  resourcesField =
      new ListDialogField<ClientBundleResource>(new SelectionAdapter(), buttons,
      new ColumnLabelProvider());
  resourcesField.setLabelText(labelText);

  String[] columnNames = {"File", "Type", "Method name"};
  ColumnLayoutData[] columnLayouts = {
      new ColumnPixelData(100), new ColumnPixelData(100),
      new ColumnPixelData(100)};

  resourcesField.setTableColumns(new ListDialogField.ColumnsDescription(
      columnLayouts, columnNames, false));

  // Edit and Remove buttons disabled by default
  resourcesField.enableButton(IDX_EDIT, false);
  resourcesField.enableButton(IDX_REMOVE, false);
}
 
Example #3
Source File: ColumnViewerBuilder.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/***/
protected ColumnLayoutData createColumnLayoutData(final int columnIndex) {
	if (null == columnWeights) {
		return new ColumnPixelData(getColumnWidthInPixel(columnIndex), resizable);
	}
	return new ColumnWeightData(columnWeights.get(columnIndex), MINIMUM_WIDTH, resizable);
}
 
Example #4
Source File: LayoutTable.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private static ColumnLayoutData[] createColumnWeightData( int nColumns )
{
	ColumnLayoutData[] data = new ColumnLayoutData[nColumns];
	for ( int i = 0; i < nColumns; i++ )
	{
		data[i] = new ColumnWeightData( 1 );
	}
	return data;
}
 
Example #5
Source File: LayoutTable.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public ColumnsDescription( ColumnLayoutData[] columns,
		String[] headers, boolean drawLines )
{
	Assert.isNotNull( columns );
	this.columns = columns;
	this.headers = headers;
	this.drawLines = drawLines;
}
 
Example #6
Source File: ListDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static ColumnLayoutData[] createColumnWeightData(int nColumns) {
	ColumnLayoutData[] data= new ColumnLayoutData[nColumns];
	for (int i= 0; i < nColumns; i++) {
		data[i]= new ColumnWeightData(1);
	}
	return data;
}
 
Example #7
Source File: ExternalizeWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private Control createTable(Composite parent) {
	Composite c= new Composite(parent, SWT.NONE);
	GridLayout gl= new GridLayout();
	gl.numColumns= 2;
	gl.marginWidth= 0;
	gl.marginHeight= 0;
	c.setLayout(gl);


	fTable= new Table(c, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION | SWT.HIDE_SELECTION | SWT.BORDER);
	fTable.setFont(parent.getFont());

	GridData tableGD= new GridData(GridData.FILL_BOTH);
	tableGD.heightHint= SWTUtil.getTableHeightHint(fTable, ROW_COUNT);
	//tableGD.widthHint= 40;
	fTable.setLayoutData(tableGD);

	fTable.setLinesVisible(true);

	TableLayout layout= new TableLayout();
	fTable.setLayout(layout);
	fTable.setHeaderVisible(true);

	ColumnLayoutData[] columnLayoutData= new ColumnLayoutData[SIZE];
	columnLayoutData[STATE_PROP]= new ColumnPixelData(18, false, true);
	columnLayoutData[KEY_PROP]= new ColumnWeightData(40, true);
	columnLayoutData[VAL_PROP]= new ColumnWeightData(40, true);

	for (int i= 0; i < fgTitles.length; i++) {
		TableColumn tc= new TableColumn(fTable, SWT.NONE, i);
		tc.setText(fgTitles[i]);
		layout.addColumnData(columnLayoutData[i]);
		tc.setResizable(columnLayoutData[i].resizable);
	}

	createButtonComposite(c);
	return c;
}
 
Example #8
Source File: WebappProjectPropertyPage.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private void createExcludedJarsComponent(Composite parent) {
  excludedJarsComponent = new Composite(parent, SWT.NONE);
  GridData excludedJarsComponentGridData = new GridData(GridData.FILL_BOTH);
  excludedJarsComponentGridData.horizontalSpan = ((GridLayout) parent.getLayout()).numColumns;
  excludedJarsComponentGridData.grabExcessVerticalSpace = true;
  excludedJarsComponent.setLayoutData(excludedJarsComponentGridData);
  GridLayout containerGridLayout = new GridLayout(3, false);
  containerGridLayout.marginTop = 16;
  excludedJarsComponent.setLayout(containerGridLayout);

  Label label = new Label(excludedJarsComponent, SWT.NONE);
  GridData labelGridData = new GridData(GridData.FILL_HORIZONTAL);
  labelGridData.horizontalSpan = 3;
  label.setLayoutData(labelGridData);
  label.setText("Suppress warnings about these build path entries being outside of WEB-INF/lib:");

  String[] buttons = new String[] { "Add...", null, "Remove" };
  excludedJarsField = new ListDialogField(new ExcludedJarSelectionAdapter(), buttons, new ExcludedJarLabelProvider());

  ColumnLayoutData[] columns = new ColumnLayoutData[] { new ColumnWeightData(1, 100, true),
      new ColumnWeightData(2, 100, true) };
  String[] columnHeaderNames = { "JAR file", "Location" };
  excludedJarsField.setTableColumns(new ListDialogField.ColumnsDescription(columns, columnHeaderNames, false));
  excludedJarsField.setRemoveButtonIndex(IDX_REMOVE);
  excludedJarsField.doFillIntoGrid(excludedJarsComponent, 3);

  GridData layoutData = (GridData) excludedJarsField.getListControl(excludedJarsComponent).getLayoutData();
  layoutData.grabExcessHorizontalSpace = true;
  layoutData.grabExcessVerticalSpace = true;
  excludedJarsField.getListControl(excludedJarsComponent).setLayoutData(layoutData);
}
 
Example #9
Source File: ListDialogField.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
private static ColumnLayoutData[] createColumnWeightData(int nColumns) {
	ColumnLayoutData[] data = new ColumnLayoutData[nColumns];
	for (int i = 0; i < nColumns; i++) {
		data[i] = new ColumnWeightData(1);
	}
	return data;
}
 
Example #10
Source File: AssociationHierarchyViewPart.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected Pair<String, ColumnLayoutData>[] getLocationColumnDescriptions() {
	return new Pair[] { 
		Pair.of("Line", new ColumnWeightData(60)),
		Pair.of("Property", new ColumnWeightData(300)) 
	};
}
 
Example #11
Source File: ListDialogField.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public ColumnsDescription(ColumnLayoutData[] columns, String[] headers,
		boolean drawLines) {
	this.columns = columns;
	this.headers = headers;
	this.drawLines = drawLines;
}
 
Example #12
Source File: AbstractCallHierarchyViewPart.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected void createColumn(Table table, Pair<String, ColumnLayoutData> columnDescription, int index) {
	TableColumn column = new TableColumn(table, SWT.NONE, index);
	column.setResizable(columnDescription.getValue().resizable);
	column.setText(columnDescription.getKey());
}
 
Example #13
Source File: NameConventionConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public NameConventionConfigurationBlock(IStatusChangeListener context, IProject project, IWorkbenchPreferenceContainer container) {
	super(context, project, getAllKeys(), container);

	NameConventionAdapter adapter=  new NameConventionAdapter();
	String[] buttons= new String[] {
		PreferencesMessages.NameConventionConfigurationBlock_list_edit_button
	};
	fNameConventionList= new ListDialogField<NameConventionEntry>(adapter, buttons, new NameConventionLabelProvider()) {
		@Override
		protected int getListStyle() {
			return super.getListStyle() & ~SWT.MULTI | SWT.SINGLE;
		}

	};
	fNameConventionList.setDialogFieldListener(adapter);
	fNameConventionList.setLabelText(PreferencesMessages.NameConventionConfigurationBlock_list_label);

	String[] columnsHeaders= new String[] {
		PreferencesMessages.NameConventionConfigurationBlock_list_name_column,
		PreferencesMessages.NameConventionConfigurationBlock_list_prefix_column,
		PreferencesMessages.NameConventionConfigurationBlock_list_suffix_column,
	};
	ColumnLayoutData[] data= new ColumnLayoutData[] {
		new ColumnWeightData(3),
		new ColumnWeightData(2),
		new ColumnWeightData(2)
	};

	fNameConventionList.setTableColumns(new ListDialogField.ColumnsDescription(data, columnsHeaders, true));

	if (fNameConventionList.getSize() > 0) {
		fNameConventionList.selectFirstElement();
	} else {
		fNameConventionList.enableButton(0, false);
	}

	fExceptionName= new StringDialogField();
	fExceptionName.setDialogFieldListener(adapter);
	fExceptionName.setLabelText(PreferencesMessages.NameConventionConfigurationBlock_exceptionname_label);

	fUseKeywordThisBox= new SelectionButtonDialogField(SWT.CHECK | SWT.WRAP);
	fUseKeywordThisBox.setDialogFieldListener(adapter);
	fUseKeywordThisBox.setLabelText(PreferencesMessages.NameConventionConfigurationBlock_keywordthis_label);

	fUseIsForBooleanGettersBox= new SelectionButtonDialogField(SWT.CHECK | SWT.WRAP);
	fUseIsForBooleanGettersBox.setDialogFieldListener(adapter);
	fUseIsForBooleanGettersBox.setLabelText(PreferencesMessages.NameConventionConfigurationBlock_isforbooleangetters_label);

	fUseOverrideAnnotation= new SelectionButtonDialogField(SWT.CHECK | SWT.WRAP);
	fUseOverrideAnnotation.setDialogFieldListener(adapter);
	fUseOverrideAnnotation.setLabelText(PreferencesMessages.NameConventionConfigurationBlock_use_override_annotation_label);

	updateControls();
}
 
Example #14
Source File: ListDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public ColumnsDescription(ColumnLayoutData[] columns, String[] headers, boolean drawLines) {
	this.columns= columns;
	this.headers= headers;
	this.drawLines= drawLines;
}
 
Example #15
Source File: AbstractCallHierarchyViewPart.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected Pair<String, ColumnLayoutData>[] getLocationColumnDescriptions() {
	return new Pair[] { Pair.of("Line", new ColumnWeightData(60)), Pair.of("Call", new ColumnWeightData(300)) };
}
 
Example #16
Source File: LayoutTable.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public ColumnsDescription( ColumnLayoutData[] columns, boolean drawLines )
{
	this( columns, null, drawLines );
}
 
Example #17
Source File: GridColumnLayout.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
protected ColumnLayoutData getLayoutData(Scrollable tableTree,
		int columnIndex) {
	GridColumn column = ((Grid) tableTree).getColumn(columnIndex);
	return (ColumnLayoutData) column.getData(LAYOUT_DATA);
}
 
Example #18
Source File: AutoResizeTableLayout.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void addColumnData(ColumnLayoutData data){  
    columns.add(data);  
    super.addColumnData(data);  
}
 
Example #19
Source File: ListDialogField.java    From xtext-eclipse with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Adds a new column of data to this table layout.
 * 
 * @param data
 *            the column layout data
 */
public void addColumnData(ColumnLayoutData data) {
	columns.add(data);
}
 
Example #20
Source File: TableLayoutComposite.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Adds a new column of data to this table layout.
 *
 * @param data the column layout data
 */
public void addColumnData(ColumnLayoutData data) {
	columns.add(data);
}
 
Example #21
Source File: TableLayoutComposite.java    From Pydev with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Adds a new column of data to this table layout.
 *
 * @param data the column layout data
 */
public void addColumnData(ColumnLayoutData data) {
    columns.add(data);
}