use of org.eclipse.jface.viewers.ColumnPixelData 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.ColumnPixelData in project translationstudio8 by heartsome.
the class WebSearchPreferencePage method createTableArea.
private Composite createTableArea(Composite parent) {
Composite tableArea = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout(1, false);
gridLayout.marginWidth = 0;
tableArea.setLayout(gridLayout);
GridData gridData = new GridData(GridData.FILL_BOTH);
tableArea.setLayoutData(gridData);
checkboxTableViewer = CheckboxTableViewer.newCheckList(tableArea, SWT.BORDER | SWT.FULL_SELECTION);
table = checkboxTableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(false);
TableLayout tableLayout = new TableLayout();
tableLayout.addColumnData(new ColumnPixelData(40));
tableLayout.addColumnData(new ColumnWeightData(50, 50, true));
tableLayout.addColumnData(new ColumnWeightData(70, 50, true));
table.setLayout(tableLayout);
GridData tableGridData = new GridData(GridData.FILL_BOTH);
table.setLayoutData(tableGridData);
WebSearchLableProvider webSearchLableProvider = new WebSearchLableProvider();
webSearchLableProvider.createColumns(checkboxTableViewer);
checkboxTableViewer.setContentProvider(new WebSearchContentProvider());
checkboxTableViewer.setLabelProvider(webSearchLableProvider);
checkboxTableViewer.setCheckStateProvider(new CheckProvider());
checkboxTableViewer.addCheckStateListener(new CheckListener());
// checkboxTableViewer.setCellEditors(new CellEditor[] { null, new TextCellEditor(table),
// new TextCellEditor(table) });
// checkboxTableViewer.setCellModifier(new NameModifier());
checkboxTableViewer.setColumnProperties(new String[] { APP_PROP, NAME_PROP, URL_PROP });
cache = WebSearchPreferencStore.getIns().getSearchConfig();
checkboxTableViewer.setInput((Object) cache);
return tableArea;
}
use of org.eclipse.jface.viewers.ColumnPixelData in project cubrid-manager by CUBRID.
the class FavoriteQueryNavigatorView method createTableGroup.
private void createTableGroup(Composite composite) {
final String[] columnNames = new String[] { "", com.cubrid.common.ui.query.Messages.msgBatchRunSqlFile, com.cubrid.common.ui.query.Messages.msgBatchRunMemo, com.cubrid.common.ui.query.Messages.msgBatchRunRegdate };
tv = CommonUITool.createCommonTableViewer(composite, null, columnNames, CommonUITool.createGridData(GridData.FILL_BOTH, 3, 1, -1, 200));
tv.setInput(FavoriteQueryPersistUtil.getInstance().getListData());
{
TableLayout tableLayout = new TableLayout();
tableLayout.addColumnData(new ColumnPixelData(0));
tableLayout.addColumnData(new ColumnPixelData(209));
tableLayout.addColumnData(new ColumnPixelData(80));
tableLayout.addColumnData(new ColumnPixelData(118));
tv.getTable().setLayout(tableLayout);
}
editor = new TableEditor(tv.getTable());
editor.horizontalAlignment = SWT.LEFT;
editor.grabHorizontal = true;
tv.getTable().addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
updateButtonStatus();
}
});
tv.getTable().addListener(SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
if (event.button != 1) {
return;
}
updateButtonStatus();
Point pt = new Point(event.x, event.y);
int newIndex = tv.getTable().getSelectionIndex();
if (tv.getTable().getItemCount() <= newIndex || newIndex < 0) {
return;
}
final TableItem item = tv.getTable().getItem(newIndex);
if (item == null) {
return;
}
Rectangle rect = item.getBounds(2);
if (rect.contains(pt)) {
focusCell(item, newIndex, 2);
}
}
});
tv.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
ISelection selection = event.getSelection();
openSelectedFile(selection);
}
});
createContextMenu();
}
use of org.eclipse.jface.viewers.ColumnPixelData in project cubrid-manager by CUBRID.
the class SqlmapNavigatorView method createParamView.
private void createParamView(Composite parent) {
String[] columnNames = { Messages.lblSqlmapName, Messages.lblSqlmapValue, Messages.lblSqlmapType };
Label lblCondTitle = new Label(parent, SWT.NONE);
lblCondTitle.setText(Messages.lblSqlmapParameters);
paramView = CommonUITool.createCommonTableViewer(parent, null, columnNames, CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, 120));
paramView.setColumnProperties(columnNames);
paramView.setContentProvider(new TableContentProvider());
paramView.setLabelProvider(new TableLabelProvider());
TableLayout tableLayout = new TableLayout();
tableLayout.addColumnData(new ColumnPixelData(100));
tableLayout.addColumnData(new ColumnPixelData(80));
tableLayout.addColumnData(new ColumnPixelData(70));
paramView.getTable().setLayout(tableLayout);
paramView.addDoubleClickListener(new IDoubleClickListener() {
@SuppressWarnings("unchecked")
public void doubleClick(DoubleClickEvent event) {
StructuredSelection sel = (StructuredSelection) event.getSelection();
Map<String, String> data = (Map<String, String>) sel.getFirstElement();
modifyParam(data);
}
});
Menu menu = new Menu(paramView.getTable().getShell(), SWT.POP_UP);
paramView.getTable().setMenu(menu);
final MenuItem addMenuItem = new MenuItem(menu, SWT.PUSH);
addMenuItem.setText(Messages.mnuSqlmapAdd);
addMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
addParameter();
}
});
final MenuItem modifyMenuItem = new MenuItem(menu, SWT.PUSH);
modifyMenuItem.setText(Messages.mnuSqlmapModify);
modifyMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
modifyParameterByCurrentSelected();
}
});
final MenuItem delMenuItem = new MenuItem(menu, SWT.PUSH);
delMenuItem.setText(Messages.mnuSqlmapRemove);
delMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (CommonUITool.openConfirmBox(Messages.msgSqlmapRemove)) {
removeParameterByCurrentSelected();
}
}
});
}
use of org.eclipse.jface.viewers.ColumnPixelData in project tdi-studio-se by Talend.
the class AssignmentPropertySection method createControls.
@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
super.createControls(parent, aTabbedPropertySheetPage);
composite = getWidgetFactory().createFlatFormComposite(parent);
// PTODO mhelleboid externalize tableviewer creation
adapterFactory = new BusinessItemProviderAdapterFactory();
tableViewer = new TableViewer(composite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
tableViewer.setLabelProvider(new RepositoryFactoryProxyLabelProvider(adapterFactory));
Table table = tableViewer.getTable();
TableLayout tableLayout = new TableLayout();
table.setLayout(tableLayout);
table.setHeaderVisible(true);
table.setLinesVisible(true);
final String[] columnProperties = new String[] { Messages.getString("AssignmentPropertySection.Type"), Messages.getString("AssignmentPropertySection.Name"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Messages.getString("AssignmentPropertySection.Comment") };
TableColumn column1 = new TableColumn(table, SWT.NONE);
tableLayout.addColumnData(new ColumnPixelData(125, true));
column1.setText(columnProperties[0]);
TableColumn column2 = new TableColumn(table, SWT.NONE);
tableLayout.addColumnData(new ColumnPixelData(125, true));
column2.setText(columnProperties[1]);
TableColumn column3 = new TableColumn(table, SWT.NONE);
tableLayout.addColumnData(new ColumnWeightData(1, 150, true));
column3.setText(columnProperties[2]);
tableViewer.setColumnProperties(columnProperties);
final IItemPropertyDescriptor itemPropertyDescriptor = getItemPropertyDescriptor();
tableViewer.setCellModifier(new ICellModifier() {
public boolean canModify(Object element, String property) {
return property.equals(columnProperties[2]);
}
public Object getValue(Object element, String property) {
return EmfPropertyHelper.getValue(itemPropertyDescriptor, element);
}
public void modify(Object element, String property, Object value) {
if (element instanceof TableItem) {
TableItem tableItem = (TableItem) element;
itemPropertyDescriptor.setPropertyValue(tableItem.getData(), value);
}
}
});
CellEditor[] cellEditors = new CellEditor[3];
cellEditors[2] = new TextCellEditor(table);
tableViewer.setCellEditors(cellEditors);
createKeyListener(table);
createSelectionListener();
createPopupMenu();
createDoubleClickListener();
handleLayout(parent, table, column1, column2, column3);
aTabbedPropertySheetPage.getSite().setSelectionProvider(this);
}
Aggregations