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