Search in sources :

Example 1 with DbComboContribution

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();
}
Also used : DbComboContribution(com.cubrid.cubridmanager.ui.monitoring.editor.internal.DbComboContribution) Composite(org.eclipse.swt.widgets.Composite) HistoryComposite(com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite) IPath(org.eclipse.core.runtime.IPath) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) DbStatDumpData(com.cubrid.cubridmanager.core.monitoring.model.DbStatDumpData) ArrayList(java.util.ArrayList) FillLayout(org.eclipse.swt.layout.FillLayout) ShowSetting(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ShowSetting) ChartCompositePart(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartCompositePart) DbRunningType(com.cubrid.cubridmanager.core.common.model.DbRunningType) Map(java.util.Map) TreeMap(java.util.TreeMap)

Aggregations

DbRunningType (com.cubrid.cubridmanager.core.common.model.DbRunningType)1 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)1 DbStatDumpData (com.cubrid.cubridmanager.core.monitoring.model.DbStatDumpData)1 ChartCompositePart (com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartCompositePart)1 DbComboContribution (com.cubrid.cubridmanager.ui.monitoring.editor.internal.DbComboContribution)1 HistoryComposite (com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite)1 ShowSetting (com.cubrid.cubridmanager.ui.monitoring.editor.internal.ShowSetting)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 IPath (org.eclipse.core.runtime.IPath)1 FillLayout (org.eclipse.swt.layout.FillLayout)1 Composite (org.eclipse.swt.widgets.Composite)1