use of com.cubrid.cubridmanager.ui.monitoring.editor.internal.DbComboContribution in project cubrid-manager by CUBRID.
the class DbStatusDumpMonitorViewPart method createPartControl.
/**
* Creates the SWT controls for this workbench part.
*
* @param parent the parent control
* @see IWorkbenchPart
*/
public void createPartControl(Composite parent) {
composite = new Composite(parent, SWT.RESIZE);
composite.setLayout(new FillLayout());
serverInfo = cubridNode.getServer().getServerInfo();
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());
}
}
DbStatDumpData dbStatDumpData = new DbStatDumpData();
TreeMap<String, String> map = convertMapKey(dbStatDumpData.getDiagStatusResultMap());
chartPart = new ChartCompositePart(composite, map);
dbCombo = new DbComboContribution("database", this);
dbCombo.setDatabaseLst(databaseLst);
if (databaseLst.isEmpty()) {
runflag = false;
} else {
dbCombo.setSelectedDb(databaseLst.get(0));
}
String hostAddress = serverInfo.getHostAddress();
int monPort = serverInfo.getHostMonPort();
String dbName = dbCombo.getSelectedDb();
String historyFileName = HistoryComposite.DB_HISTORY_FILE_PREFIX + dbName + "@" + hostAddress + "_" + monPort + HistoryComposite.HISTORY_SUFFIX;
chartPart.setHistoryFileName(historyFileName);
if (null == monInstaceData) {
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
ShowSetting showSetting = chartPart.getSettingMap().get(key);
ShowSettingMatching.match(key, showSetting, MonitorType.DATABASE);
}
chartPart.setChartTitle(Messages.dbMonitorChartTtl);
IPath historyPath = CubridManagerCorePlugin.getDefault().getStateLocation();
String sHistoryPath = historyPath.toOSString() + File.separator + historyFileName;
chartPart.setHistoryPath(sHistoryPath);
} else {
String titleName = monInstaceData.getTitleName();
chartPart.setChartTitle(titleName);
chartPart.setSettingData(monInstaceData);
}
chartPart.loadContent();
makeActions();
this.dbName = dbCombo.getSelectedDb();
new DataGenerator().start();
}
Aggregations