use of org.eclipse.jface.viewers.TableLayout 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.TableLayout in project cubrid-manager by CUBRID.
the class InsertTableDataDialog method createAttrTable.
/**
* Create the table attribute table
*/
private void createAttrTable() {
attrTable = new Table(sashForm, SWT.BORDER | SWT.FULL_SELECTION);
attrTable.setLayoutData(new GridData(GridData.FILL_BOTH));
attrTable.setHeaderVisible(true);
attrTable.setLinesVisible(true);
TableLayout layout = new TableLayout();
layout.addColumnData(new ColumnWeightData(20, 120));
layout.addColumnData(new ColumnWeightData(20, 120));
layout.addColumnData(new ColumnWeightData(20, 120));
layout.addColumnData(new ColumnWeightData(40, 160));
attrTable.setLayout(layout);
TableColumn[] tblColumns = new TableColumn[4];
tblColumns[0] = new TableColumn(attrTable, SWT.NONE);
tblColumns[0].setText(Messages.metaAttribute);
tblColumns[1] = new TableColumn(attrTable, SWT.NONE);
tblColumns[1].setText(Messages.metaDomain);
tblColumns[2] = new TableColumn(attrTable, SWT.NONE);
tblColumns[2].setText(Messages.metaConstaints);
tblColumns[3] = new TableColumn(attrTable, SWT.NONE);
tblColumns[3].setText(Messages.metaValue);
TableItem item;
for (int i = 0, n = schemaInfo.getAttributes().size(); i < n; i++) {
DBAttribute da = (DBAttribute) schemaInfo.getAttributes().get(i);
String type = DataType.getShownType(da.getType());
if (type.toUpperCase(Locale.getDefault()).startsWith(DataType.DATATYPE_BLOB) || type.toUpperCase(Locale.getDefault()).startsWith(DataType.DATATYPE_CLOB)) {
continue;
}
item = new TableItem(attrTable, SWT.NONE);
item.setText(0, da.getName());
item.setText(1, type);
item.setText(2, getConstaintString(da));
}
packTable();
tableEditor = new TableEditor(attrTable);
tableEditor.horizontalAlignment = SWT.LEFT;
tableEditor.grabHorizontal = true;
attrTable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
// Identify the selected row
TableItem item = (TableItem) event.item;
if (item == null) {
return;
}
handleValue(item);
}
});
}
use of org.eclipse.jface.viewers.TableLayout 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.TableLayout 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.TableLayout in project cubrid-manager by CUBRID.
the class BrokerDashboardViewPart method makeActions.
/**
* This method is to create actions at tool bar
*
*/
private void makeActions() {
Action columnAction = new Action() {
public void run() {
BrokerStatusSettingDlg settingDlg = new BrokerStatusSettingDlg(null);
ServerInfo serverInfo = brokerNode.getParent().getServerInfo();
settingDlg.setServerInfo(serverInfo);
settingDlg.setAppendDiag(true);
if (settingDlg.open() == Dialog.OK) {
refreshLayout();
}
}
/**
* refresh table layout
*/
private void refreshLayout() {
//refresh basic info table
TableLayout basicLayout = new TableLayout();
brokerTablePart.setBasicLayout(basicLayout);
basicTableViewer.getTable().setLayout(basicLayout);
basicTableViewer.getTable().layout();
//refresh apply server table
TableLayout asLayout = new TableLayout();
brokerTablePart.setAsLayout(asLayout);
asTableViewer.getTable().setLayout(asLayout);
asTableViewer.getTable().layout();
//refresh job queue table
TableLayout jqLayout = new TableLayout();
brokerTablePart.setJqLayout(jqLayout);
jqTableViewer.getTable().setLayout(jqLayout);
jqTableViewer.getTable().layout();
}
};
columnAction.setText(Messages.columnSettingTxt);
columnAction.setImageDescriptor(CubridManagerUIPlugin.getImageDescriptor("icons/action/setting-small.png"));
IActionBars bars = getViewSite().getActionBars();
IToolBarManager manager = bars.getToolBarManager();
manager.add(columnAction);
}
Aggregations