use of org.eclipse.swt.custom.ScrolledComposite 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();
}
use of org.eclipse.swt.custom.ScrolledComposite in project cubrid-manager by CUBRID.
the class ERSchemaEditor method createToolBar.
public void createToolBar(Composite parent) {
ScrolledComposite scrolledComp = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
FillLayout flayout = new FillLayout();
scrolledComp.setLayout(flayout);
topPane = new Composite(scrolledComp, SWT.NONE);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
gridLayout.verticalSpacing = 0;
gridLayout.marginWidth = 0;
gridLayout.marginHeight = 0;
gridLayout.horizontalSpacing = 0;
topPane.setLayout(gridLayout);
topPane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
scrolledComp.setContent(topPane);
scrolledComp.setExpandHorizontal(true);
scrolledComp.setExpandVertical(true);
final Composite toolBarComposite = new Composite(topPane, SWT.NONE);
toolBarComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
GridLayout gridLayout2 = new GridLayout();
gridLayout2.marginHeight = 0;
gridLayout2.horizontalSpacing = 0;
gridLayout2.marginWidth = 0;
toolBarComposite.setLayout(gridLayout2);
erToolBar = new ERSchemaToolBar(toolBarComposite, SWT.WRAP | SWT.FLAT, this);
erToolBar.init();
topPane.pack();
erToolBar.pack();
}
use of org.eclipse.swt.custom.ScrolledComposite in project cubrid-manager by CUBRID.
the class HostDashboardViewPart method createPartControl.
/**
* Creates the SWT controls for this workbench part.
*
* @param parent the parent control
*/
public void createPartControl(Composite parent) {
final ScrolledComposite scrolledComp = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
composite = new Composite(scrolledComp, SWT.NONE);
GridLayout layout = new GridLayout(1, false);
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
chartComp = new Composite(composite, SWT.RESIZE);
GridLayout chartCompLayout = new GridLayout(1, true);
chartComp.setLayout(chartCompLayout);
chartComp.setLayoutData(new GridData(GridData.FILL_BOTH));
loadCpuChart(chartComp);
loadMemoryChart(chartComp);
loadIowaitChart(chartComp);
sysInfoComp = new Composite(composite, SWT.RESIZE);
GridLayout sysInfoCompLayout = new GridLayout();
sysInfoComp.setLayout(sysInfoCompLayout);
GridData sysGridData = new GridData(GridData.FILL_HORIZONTAL);
sysInfoComp.setLayoutData(sysGridData);
loadSystemInfoComposite(sysInfoComp);
scrolledComp.setContent(composite);
scrolledComp.setExpandHorizontal(true);
scrolledComp.setExpandVertical(true);
scrolledComp.setMinHeight(800);
scrolledComp.setMinWidth(350);
makeActions();
}
use of org.eclipse.swt.custom.ScrolledComposite in project cubrid-manager by CUBRID.
the class HostSystemMonitorHistoryViewPart method createPartControl.
/**
* Creates the SWT controls for this workbench part.
*
* @param parent the parent control
* @see IWorkbenchPart
*/
public void createPartControl(Composite parent) {
final ScrolledComposite scrolledComp = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
composite = new Composite(scrolledComp, SWT.RESIZE);
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
final HistoryComposite historyComposite = new HistoryComposite();
historyComposite.loadTimeSelection(composite);
Label sepWithResult = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_OUT);
sepWithResult.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
chartComp = new Composite(composite, SWT.RESIZE);
GridLayout chartCompLayout = new GridLayout(1, true);
chartComp.setLayout(chartCompLayout);
chartComp.setLayoutData(new GridData(GridData.FILL_BOTH));
loadCpuChart(chartComp);
loadMemoryChart(chartComp);
loadIowaitChart(chartComp);
scrolledComp.setContent(composite);
scrolledComp.setExpandHorizontal(true);
scrolledComp.setExpandVertical(true);
scrolledComp.setMinHeight(800);
scrolledComp.setMinWidth(350);
historyComposite.getQueryBtn().addSelectionListener(new HistoryBtnSelectionListener(historyComposite));
makeActions();
}
use of org.eclipse.swt.custom.ScrolledComposite in project cubrid-manager by CUBRID.
the class DbSystemMonitorHistoryViewPart method createPartControl.
/**
* Creates the SWT controls for this workbench part.
*
* @param parent the parent control
*/
public void createPartControl(Composite parent) {
final ScrolledComposite scrolledComp = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
composite = new Composite(scrolledComp, SWT.RESIZE);
GridLayout layout = new GridLayout(1, false);
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
final HistoryComposite historyComposite = new HistoryComposite();
historyComposite.loadTimeSelection(composite);
Label sepWithResult = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_OUT);
sepWithResult.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
chartComp = new Composite(composite, SWT.RESIZE);
GridLayout chartCompLayout = new GridLayout(1, true);
chartComp.setLayout(chartCompLayout);
chartComp.setLayoutData(new GridData(GridData.FILL_BOTH));
loadCpuChart(chartComp);
loadMemoryChart(chartComp);
scrolledComp.setContent(composite);
scrolledComp.setExpandHorizontal(true);
scrolledComp.setExpandVertical(true);
scrolledComp.setMinHeight(800);
scrolledComp.setMinWidth(545);
historyComposite.getQueryBtn().addSelectionListener(new HistoryBtnSelectionListener(historyComposite));
List<String> databaseLst = new ArrayList<String>();
List<DatabaseInfo> databaseInfoLst = serverInfo.getLoginedUserInfo().getDatabaseInfoList();
for (DatabaseInfo databaseInfo : databaseInfoLst) {
DbRunningType dbRunningType = databaseInfo.getRunningType();
if (dbRunningType == DbRunningType.CS) {
databaseLst.add(databaseInfo.getDbName());
}
}
dbCombo = new DbComboContribution("database");
dbCombo.setDatabaseLst(databaseLst);
if (!databaseLst.isEmpty()) {
databaseLst.add(0, ALL_DB_NAME);
dbCombo.setSelectedDb(databaseLst.get(0));
}
String selectDb = dbCombo.getSelectedDb();
if (ALL_DB_NAME.equals(selectDb)) {
dbName = "";
} else {
dbName = selectDb;
}
makeActions();
}
Aggregations