use of org.eclipse.swt.widgets.Table in project cubrid-manager by CUBRID.
the class QueryPlanCompositeWithHistory method initialize.
/**
* Initializing a Plan Tab
*/
private void initialize() {
createPlanToolbar();
//create the plan tab folder and history sash
plansHistorySash = new SashForm(this, SWT.HORIZONTAL);
plansHistorySash.setLayout(new GridLayout(2, true));
plansHistorySash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
//create left plan tab folder
plansTabFolder = new CTabFolder(plansHistorySash, SWT.BOTTOM | SWT.CLOSE);
plansTabFolder.setSimple(false);
plansTabFolder.setUnselectedImageVisible(true);
plansTabFolder.setUnselectedCloseVisible(true);
plansTabFolder.setSelectionBackground(CombinedQueryEditorComposite.BACK_COLOR);
plansTabFolder.setSelectionForeground(ResourceManager.getColor(SWT.COLOR_BLACK));
plansTabFolder.setLayout(new GridLayout(1, true));
plansTabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
TabContextMenuManager tabContextMenuManager = new TabContextMenuManager(plansTabFolder);
tabContextMenuManager.createContextMenu();
//create the right plan history table
planHistoryTable = new Table(plansHistorySash, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
planHistoryTable.setLayout(new GridLayout(1, true));
planHistoryTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
planHistoryTable.setHeaderVisible(true);
planHistoryTable.setLinesVisible(true);
planHistoryTable.addMouseListener(new MouseListener() {
public void mouseDoubleClick(MouseEvent event) {
int selectionIndex = planHistoryTable.getSelectionIndex();
if (selectionIndex < 0) {
return;
}
TableItem tableItem = planHistoryTable.getItem(planHistoryTable.getSelectionIndex());
if (tableItem == null) {
return;
}
int uid = Integer.valueOf(tableItem.getText(0));
StructQueryPlan sq = planHistoryList.get(uid - 1);
PlanTabItem tabItem = findPlanTab(uid);
if (tabItem == null) {
tabItem = newPlanTab(uid);
}
plansTabFolder.setSelection(tabItem);
printPlan(tabItem, sq);
}
public void mouseDown(MouseEvent event) {
}
public void mouseUp(MouseEvent event) {
}
});
int i = 0;
planHistoryTblCols[i] = new TableColumn(planHistoryTable, SWT.RIGHT);
// No
planHistoryTblCols[i].setText(Messages.qedit_plan_history_col1);
planHistoryTblCols[i].setMoveable(true);
planHistoryTblCols[i].setWidth(20);
addNumberSorter(planHistoryTable, planHistoryTblCols[i]);
sortType.put(planHistoryTblCols[i], "NUMBER");
planHistoryTblCols[++i] = new TableColumn(planHistoryTable, SWT.LEFT);
// Date
planHistoryTblCols[i].setText(Messages.qedit_plan_history_col2);
planHistoryTblCols[i].setMoveable(true);
planHistoryTblCols[i].setWidth(100);
addStringSorter(planHistoryTable, planHistoryTblCols[i]);
sortType.put(planHistoryTblCols[i], "STRING");
planHistoryTblCols[++i] = new TableColumn(planHistoryTable, SWT.RIGHT);
// Cost
planHistoryTblCols[i].setText(Messages.qedit_plan_history_col4);
planHistoryTblCols[i].setMoveable(true);
planHistoryTblCols[i].setWidth(90);
addNumberSorter(planHistoryTable, planHistoryTblCols[i]);
sortType.put(planHistoryTblCols[i], "NUMBER");
planHistoryTblCols[++i] = new TableColumn(planHistoryTable, SWT.LEFT);
// Cost
planHistoryTblCols[i].setText(Messages.qedit_plan_history_col3);
planHistoryTblCols[i].setMoveable(false);
planHistoryTblCols[i].setWidth(90);
addStringSorter(planHistoryTable, planHistoryTblCols[i]);
sortType.put(planHistoryTblCols[i], "STRING");
sashPlanWeight = new int[] { 80, 20 };
plansHistorySash.setWeights(sashPlanWeight);
newPlanTab(1);
plansTabFolder.setSelection(0);
hideHistoryPane();
refreshToolbarStatus(QueryOptions.getQueryPlanDisplayType());
}
use of org.eclipse.swt.widgets.Table in project cubrid-manager by CUBRID.
the class QueryResultComposite method makeEmptyResult.
/**
* Make empty result contents.
*
*/
public void makeEmptyResult() {
resultTabFolder.setSelection(queryResultTabItem);
SashForm bottomSash = new SashForm(queryResultTabFolder, SWT.VERTICAL);
bottomSash.SASH_WIDTH = SASH_WIDTH;
bottomSash.setBackground(CombinedQueryEditorComposite.BACK_COLOR);
Table table = new Table(bottomSash, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
setDropTraget(table);
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableColumn tableColumn = new TableColumn(table, SWT.NONE);
tableColumn.setWidth(60);
SashForm tailSash = new SashForm(bottomSash, SWT.HORIZONTAL);
tailSash.SASH_WIDTH = SASH_WIDTH;
tailSash.setBackground(CombinedQueryEditorComposite.BACK_COLOR);
new StyledText(tailSash, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
bottomSash.setWeights(new int[] { 70, 30 });
CTabItem tabItem = new CTabItem(queryResultTabFolder, SWT.NONE);
tabItem.setText(Messages.qedit_result);
tabItem.setControl(bottomSash);
queryResultTabFolder.setSelection(tabItem);
}
use of org.eclipse.swt.widgets.Table in project cubrid-manager by CUBRID.
the class ServicePropertyPage method createDatabaseGroup.
/**
*
* Create database group composite
*
* @param parent the parent composite
*/
private void createDatabaseGroup(Composite parent) {
Group databaseInfoGroup = new Group(parent, SWT.NONE);
databaseInfoGroup.setText(Messages.grpAutoDatabase);
GridData gridData = new GridData(GridData.FILL_BOTH);
databaseInfoGroup.setLayoutData(gridData);
GridLayout layout = new GridLayout();
databaseInfoGroup.setLayout(layout);
databaseTable = new Table(databaseInfoGroup, SWT.CHECK | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.FULL_SELECTION);
databaseTable.setLinesVisible(false);
databaseTable.setHeaderVisible(false);
databaseTable.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, 100));
}
use of org.eclipse.swt.widgets.Table in project dbeaver by serge-rider.
the class DataTransferPageFinal method createControl.
@Override
public void createControl(Composite parent) {
initializeDialogUnits(parent);
Composite composite = new Composite(parent, SWT.NULL);
GridLayout gl = new GridLayout();
gl.marginHeight = 0;
gl.marginWidth = 0;
composite.setLayout(gl);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
{
Group tablesGroup = UIUtils.createControlGroup(composite, CoreMessages.data_transfer_wizard_final_group_tables, 3, GridData.FILL_BOTH, 0);
resultTable = new Table(tablesGroup, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
resultTable.setLayoutData(new GridData(GridData.FILL_BOTH));
resultTable.setHeaderVisible(true);
resultTable.setLinesVisible(true);
UIUtils.createTableColumn(resultTable, SWT.LEFT, CoreMessages.data_transfer_wizard_final_column_source);
UIUtils.createTableColumn(resultTable, SWT.LEFT, CoreMessages.data_transfer_wizard_final_column_target);
UIUtils.packColumns(resultTable);
}
setControl(composite);
}
use of org.eclipse.swt.widgets.Table in project dbeaver by serge-rider.
the class GenerateMultiSQLDialog method createObjectsSelector.
protected void createObjectsSelector(Composite parent) {
if (selectedObjects.size() < 2) {
// Don't need it for a single object
return;
}
UIUtils.createControlLabel(parent, "Tables");
objectsTable = new Table(parent, SWT.BORDER | SWT.CHECK);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.heightHint = 100;
objectsTable.setLayoutData(gd);
for (T table : selectedObjects) {
TableItem item = new TableItem(objectsTable, SWT.NONE);
item.setText(DBUtils.getObjectFullName(table, DBPEvaluationContext.UI));
item.setImage(DBeaverIcons.getImage(DBIcon.TREE_TABLE));
item.setChecked(true);
item.setData(table);
}
objectsTable.addSelectionListener(SQL_CHANGE_LISTENER);
objectsTable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
boolean hasChecked = !getCheckedObjects().isEmpty();
getButton(IDialogConstants.OK_ID).setEnabled(hasChecked);
getButton(IDialogConstants.DETAILS_ID).setEnabled(hasChecked);
}
});
}
Aggregations