use of org.eclipse.jface.viewers.ColumnLayoutData in project xtext-eclipse by eclipse.
the class AbstractCallHierarchyViewPart method getLocationColumnDescriptions.
protected Pair<String, ColumnLayoutData>[] getLocationColumnDescriptions() {
ColumnWeightData _columnWeightData = new ColumnWeightData(60);
Pair<String, ColumnLayoutData> _mappedTo = Pair.<String, ColumnLayoutData>of("Line", _columnWeightData);
ColumnWeightData _columnWeightData_1 = new ColumnWeightData(300);
Pair<String, ColumnLayoutData> _mappedTo_1 = Pair.<String, ColumnLayoutData>of("Call", _columnWeightData_1);
return new Pair[] { _mappedTo, _mappedTo_1 };
}
use of org.eclipse.jface.viewers.ColumnLayoutData in project xtext-eclipse by eclipse.
the class ListDialogField method getListControl.
// ------ UI creation
/**
* Returns the list control. When called the first time, the control will be
* created.
*
* @param parent
* The parent composite when called the first time, or
* <code>null</code> after.
*/
public Control getListControl(Composite parent) {
if (fTableControl == null) {
assertCompositeNotNull(parent);
if (fTableColumns == null) {
fTable = createTableViewer(parent);
Table tableControl = fTable.getTable();
fTableControl = tableControl;
tableControl.setLayout(new TableLayout());
} else {
TableLayoutComposite composite = new TableLayoutComposite(parent, SWT.NONE);
composite.setFont(parent.getFont());
fTableControl = composite;
fTable = createTableViewer(composite);
Table tableControl = fTable.getTable();
tableControl.setHeaderVisible(fTableColumns.headers != null);
tableControl.setLinesVisible(fTableColumns.drawLines);
ColumnLayoutData[] columns = fTableColumns.columns;
for (int i = 0; i < columns.length; i++) {
composite.addColumnData(columns[i]);
TableColumn column = new TableColumn(tableControl, SWT.NONE);
// tableLayout.addColumnData(columns[i]);
if (fTableColumns.headers != null) {
column.setText(fTableColumns.headers[i]);
}
}
}
fTable.getTable().addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
handleKeyPressed(e);
}
});
// fTableControl.setLayout(tableLayout);
fTable.setContentProvider(fListViewerAdapter);
fTable.setLabelProvider(fLabelProvider);
fTable.addSelectionChangedListener(fListViewerAdapter);
fTable.addDoubleClickListener(fListViewerAdapter);
fTable.setInput(fParentElement);
if (fViewerComparator != null) {
fTable.setComparator(fViewerComparator);
}
fTableControl.setEnabled(isEnabled());
if (fSelectionWhenEnabled != null) {
selectElements(fSelectionWhenEnabled);
}
}
return fTableControl;
}
use of org.eclipse.jface.viewers.ColumnLayoutData in project erlide_eclipse by erlang.
the class ListDialogField method getListControl.
// ------ ui creation
/**
* Returns the list control. When called the first time, the control will be created.
*
* @param parent
* The parent composite when called the first time, or <code>null</code>
* after.
*/
public Control getListControl(final Composite parent) {
if (fTableControl == null) {
assertCompositeNotNull(parent);
if (fTableColumns == null) {
fTable = createTableViewer(parent);
final Table tableControl = fTable.getTable();
fTableControl = tableControl;
tableControl.setLayout(new TableLayout());
} else {
final TableLayoutComposite composite = new TableLayoutComposite(parent, SWT.NONE);
fTableControl = composite;
fTable = createTableViewer(composite);
final Table tableControl = fTable.getTable();
tableControl.setHeaderVisible(fTableColumns.fHeaders != null);
tableControl.setLinesVisible(fTableColumns.fDrawLines);
final ColumnLayoutData[] columns = fTableColumns.fColumns;
for (int i = 0; i < columns.length; i++) {
composite.addColumnData(columns[i]);
final TableColumn column = new TableColumn(tableControl, SWT.NONE);
// tableLayout.addColumnData(columns[i]);
if (fTableColumns.fHeaders != null) {
column.setText(fTableColumns.fHeaders[i]);
}
}
}
fTable.getTable().addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(final KeyEvent e) {
handleKeyPressed(e);
}
});
// fTableControl.setLayout(tableLayout);
fTable.setContentProvider(fListViewerAdapter);
fTable.setLabelProvider(fLabelProvider);
fTable.addSelectionChangedListener(fListViewerAdapter);
fTable.addDoubleClickListener(fListViewerAdapter);
fTable.setInput(fParentElement);
if (fViewerSorter != null) {
fTable.setComparator(fViewerSorter);
}
fTableControl.setEnabled(isEnabled());
if (fSelectionWhenEnabled != null) {
postSetSelection(fSelectionWhenEnabled);
}
}
return fTableControl;
}
use of org.eclipse.jface.viewers.ColumnLayoutData in project erlide_eclipse by erlang.
the class TableLayoutComposite method computeTableSize.
// ---- Helpers
// -------------------------------------------------------------------------------------
protected Point computeTableSize(final Table table) {
final Point result = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
int width = 0;
for (final ColumnLayoutData layoutData : columns) {
if (layoutData instanceof ColumnPixelData) {
final ColumnPixelData col = (ColumnPixelData) layoutData;
width += col.width;
} else if (layoutData instanceof ColumnWeightData) {
final ColumnWeightData col = (ColumnWeightData) layoutData;
width += col.minimumWidth;
} else {
// $NON-NLS-1$
Assert.isTrue(false, "Unknown column layout data");
}
}
if (width > result.x) {
result.x = width;
}
return result;
}
use of org.eclipse.jface.viewers.ColumnLayoutData in project liferay-ide by liferay.
the class ContextProperties method createContextPage.
// private DirectoryEditor rootDirectory;
private Control createContextPage(Composite parent) {
contextValues = new Properties();
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout(1, true));
if (getElement() instanceof IProject) {
IProject project = (IProject) getElement();
Composite subComp = new Composite(composite, SWT.NULL);
subComp.setLayout(new GridLayout(2, false));
subComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// try {
// javascriptDirectory = new DirectoryEditor(getShell(), subComp, "Javascript Direcotory", project.getPersistentProperty(Constants.newQualifiedName(Constants.DIR_JAVASCRIPT)));
// }
// catch (CoreException ce) {}
}
Composite subComp = new Composite(composite, SWT.NULL);
subComp.setLayout(new GridLayout(1, false));
subComp.setLayoutData(new GridData(GridData.FILL_BOTH));
GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
contextValuesTable = new Table(subComp, SWT.BORDER | SWT.H_SCROLL | SWT.FULL_SELECTION);
contextValuesTable.setVisible(true);
contextValuesTable.setLinesVisible(false);
contextValuesTable.setHeaderVisible(true);
contextValuesTable.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
editContextValueButton.setEnabled(true);
deleteContextValueButton.setEnabled(true);
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
contextValuesTable.addKeyListener(new ContextValueDeleteKeyListener());
contextValuesTable.addMouseListener(new EditContextValueButtonListener());
// create the columns
TableColumn keyColumn = new TableColumn(contextValuesTable, SWT.LEFT);
TableColumn valueColumn = new TableColumn(contextValuesTable, SWT.LEFT);
keyColumn.setText(Messages.ContextProperties_KeyColumn);
valueColumn.setText(Messages.ContextProperties_ValueColumn);
ColumnLayoutData keyColumnLayout = new ColumnWeightData(30, false);
ColumnLayoutData valueColumnLayout = new ColumnWeightData(70, false);
// set columns in Table layout
TableLayout tableLayout = new TableLayout();
tableLayout.addColumnData(keyColumnLayout);
tableLayout.addColumnData(valueColumnLayout);
contextValuesTable.setLayout(tableLayout);
GridData data = new GridData(GridData.FILL_BOTH);
data.heightHint = 50;
data.grabExcessHorizontalSpace = true;
data.grabExcessVerticalSpace = true;
contextValuesTable.setLayoutData(data);
Composite buttonComposite = new Composite(subComp, SWT.NONE);
data = new GridData();
data.horizontalAlignment = GridData.BEGINNING;
data.verticalAlignment = GridData.BEGINNING;
buttonComposite.setLayoutData(data);
GridLayout gl = new GridLayout(3, true);
buttonComposite.setLayout(gl);
buttonComposite.setVisible(true);
addContextValueButton = new Button(buttonComposite, SWT.NATIVE);
addContextValueButton.setText(Messages.ContextProperties_NewButton);
addContextValueButton.setVisible(true);
addContextValueButton.addSelectionListener(new AddContextValueButtonListener());
data = new GridData();
data.widthHint = 45;
data.grabExcessHorizontalSpace = true;
addContextValueButton.setLayoutData(data);
editContextValueButton = new Button(buttonComposite, SWT.NATIVE);
editContextValueButton.setText(Messages.ContextProperties_EditButton);
editContextValueButton.addSelectionListener(new EditContextValueButtonListener());
data = new GridData();
data.widthHint = 45;
data.grabExcessHorizontalSpace = true;
editContextValueButton.setLayoutData(data);
deleteContextValueButton = new Button(buttonComposite, SWT.NATIVE);
deleteContextValueButton.setText(Messages.ContextProperties_DeleteButton);
deleteContextValueButton.addSelectionListener(new ContextValueDeleteKeyListener());
data = new GridData();
data.widthHint = 45;
data.grabExcessHorizontalSpace = true;
deleteContextValueButton.setLayoutData(data);
reloadContextValues();
return composite;
}
Aggregations