use of com.cubrid.common.ui.cubrid.table.dashboard.control.TableDashboardComposite.TablesDetailInfoCTabItem in project cubrid-manager by CUBRID.
the class ColumnViewerSorter method fireTableDetailChanged.
/**
* Fire the table info changed to tabFolder
*
* @param name
*/
private void fireTableDetailChanged(String name) {
if (tabFolder != null && !tabFolder.isDisposed()) {
CTabItem[] items = tabFolder.getItems();
for (CTabItem item : items) {
TablesDetailInfoCTabItem tabItem = (TablesDetailInfoCTabItem) item;
SchemaInfo schema = tabItem.getTableInfoComposite().getData();
if (schema != null && StringUtil.isEqualNotIgnoreNull(schema.getClassname(), name)) {
item.dispose();
}
}
}
}
use of com.cubrid.common.ui.cubrid.table.dashboard.control.TableDashboardComposite.TablesDetailInfoCTabItem in project cubrid-manager by CUBRID.
the class ColumnViewerSorter method createPartControl.
public void createPartControl(Composite parent) {
parent.setLayout(new GridLayout(1, false));
ToolBar toolBar = new ToolBar(parent, SWT.LEFT_TO_RIGHT | SWT.FLAT);
toolBar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
ToolItem refreshItem = new ToolItem(toolBar, SWT.PUSH);
refreshItem.setText(Messages.tablesDetailInfoPartRefreshBtn);
refreshItem.setToolTipText(Messages.tablesDetailInfoPartBtnRefreshTip);
refreshItem.setImage(CommonUIPlugin.getImage("icons/action/refresh.png"));
refreshItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
refresh();
}
});
new ToolItem(toolBar, SWT.SEPARATOR);
ToolItem countItem = new ToolItem(toolBar, SWT.PUSH);
countItem.setText(Messages.tablesDetailInfoPartBtnEsitmateRecord);
countItem.setToolTipText(Messages.tablesDetailInfoPartBtnEsitmateRecordTip);
countItem.setImage(CommonUIPlugin.getImage("icons/action/count.gif"));
countItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
List<TableDetailInfo> list = new ArrayList<TableDetailInfo>();
TableItem[] items = tableListView.getTable().getSelection();
for (TableItem item : items) {
list.add((TableDetailInfo) item.getData());
}
// Check selected size and confirm
if (list.size() == 0) {
CommonUITool.openWarningBox(Messages.tablesDetailInfoPartAlertNotSelected);
return;
}
if (CommonUITool.openConfirmBox(Messages.tablesDetailInfoPartBtnEsitmateRecordAlert)) {
LoadTableRecordCountsProgress progress = new LoadTableRecordCountsProgress(database, list);
progress.getTableCounts();
tableListView.refresh();
}
}
});
new ToolItem(toolBar, SWT.SEPARATOR);
ToolItem viewDataItem = new ToolItem(toolBar, SWT.PUSH);
viewDataItem.setText(Messages.tablesDetailInfoPartBtnViewData);
viewDataItem.setToolTipText(Messages.tablesDetailInfoPartBtnViewDataTip);
viewDataItem.setImage(CommonUIPlugin.getImage("icons/action/table_select_all.png"));
viewDataItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TableItem[] items = tableListView.getTable().getSelection();
if (items.length == 1) {
TableDetailInfo tableDetailInfo = (TableDetailInfo) items[0].getData();
String query = SQLGenerateUtils.getSelectSQLWithLimit(tableDetailInfo.getTableName(), 1, 100);
QueryEditorUtil.openQueryEditorAndRunQuery(database, query, true, true);
} else {
CommonUITool.openInformationBox(Messages.tablesDetailInfoPartBtnViewDataSelectOne);
}
}
});
new ToolItem(toolBar, SWT.SEPARATOR);
ToolItem copyTableNamesItem = new ToolItem(toolBar, SWT.PUSH);
copyTableNamesItem.setText(Messages.tablesDetailInfoPartBtnCopyTableNames);
copyTableNamesItem.setToolTipText(Messages.tablesDetailInfoPartBtnCopyTableNamesTip);
copyTableNamesItem.setImage(CommonUIPlugin.getImage("icons/action/copy_table_name.gif"));
copyTableNamesItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
List<String> nameList = new ArrayList<String>();
for (TableDetailInfo tablesDetailInfoPOJO : tableList) {
nameList.add(tablesDetailInfoPOJO.getTableName());
}
if (nameList.size() == 0) {
CommonUITool.openWarningBox(Messages.tablesDetailInfoPartBtnCopySuccessFailed);
return;
}
copyNamesToClipboard(nameList);
CommonUITool.openInformationBox(Messages.tablesDetailInfoPartBtnCopySuccessTitle, Messages.tablesDetailInfoPartBtnCopySuccessMsg);
}
});
new ToolItem(toolBar, SWT.SEPARATOR);
ToolItem copyColumnNamesItem = new ToolItem(toolBar, SWT.PUSH);
copyColumnNamesItem.setText(Messages.tablesDetailInfoPartBtnCopyColumnNames);
copyColumnNamesItem.setToolTipText(Messages.tablesDetailInfoPartBtnCopyColumnNamesTip);
copyColumnNamesItem.setImage(CommonUIPlugin.getImage("icons/action/copy_column_name.gif"));
copyColumnNamesItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TablesDetailInfoCTabItem tabItem = (TablesDetailInfoCTabItem) tabFolder.getSelection();
schemaInfo = tabItem.getTableInfoComposite().getData();
if (schemaInfo == null) {
CommonUITool.openWarningBox(Messages.tablesDetailInfoPartBtnCopySuccessFailed);
return;
}
List<String> nameList = new ArrayList<String>();
for (DBAttribute att : schemaInfo.getAttributes()) {
nameList.add(att.getName());
}
copyNamesToClipboard(nameList);
CommonUITool.openInformationBox(Messages.tablesDetailInfoPartBtnCopySuccessTitle, Messages.tablesDetailInfoPartBtnCopySuccessMsg);
}
});
new ToolItem(toolBar, SWT.SEPARATOR);
final NewTableAction newTableAction = (NewTableAction) ActionManager.getInstance().getAction(NewTableAction.ID);
ToolItem newTableItem = new ToolItem(toolBar, SWT.PUSH);
newTableItem.setText(newTableAction.getText());
newTableItem.setImage(CommonUITool.getImage(newTableAction.getImageDescriptor()));
newTableItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
newTableAction.run(database);
}
});
ScrolledComposite scrolledComp = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
scrolledComp.setLayout(new FillLayout());
scrolledComp.setExpandHorizontal(true);
scrolledComp.setExpandVertical(true);
scrolledComp.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
topSash = new SashForm(scrolledComp, SWT.VERTICAL);
topSash.setBackground(ResourceManager.getColor(136, 161, 227));
GridLayout gridLayout = new GridLayout();
gridLayout.verticalSpacing = 0;
gridLayout.marginWidth = 0;
gridLayout.marginHeight = 0;
gridLayout.horizontalSpacing = 0;
topSash.setLayout(gridLayout);
topSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
topSash.SASH_WIDTH = 1;
scrolledComp.setContent(topSash);
createTablesDetailInfoTable(topSash);
createTabFolder(topSash);
topSash.setWeights(new int[] { 70, 30 });
this.setInputs();
}
Aggregations