use of com.cubrid.cubridmanager.ui.spi.model.CubridDbLogNode in project cubrid-manager by CUBRID.
the class CubridDatabaseLogLoader method load.
/**
*
* Load children object for parent
*
* @param parent the parent node
* @param monitor the IProgressMonitor object
*/
public void load(ICubridNode parent, final IProgressMonitor monitor) {
synchronized (this) {
if (isLoaded() || parent == null) {
return;
}
String dbName = parent.getLabel();
ServerInfo serverInfo = parent.getServer().getServerInfo();
DbLogInfos dbLogInfos = new DbLogInfos();
final CommonQueryTask<DbLogInfos> task = new CommonQueryTask<DbLogInfos>(serverInfo, CommonSendMsg.getCommonDatabaseSendMsg(), dbLogInfos);
task.setDbName(dbName);
monitorCancel(monitor, new ITask[] { task });
task.execute();
final String errorMsg = task.getErrorMsg();
if (!monitor.isCanceled() && errorMsg != null && errorMsg.trim().length() > 0) {
parent.removeAllChild();
openErrorBox(errorMsg);
setLoaded(true);
return;
}
if (monitor.isCanceled()) {
setLoaded(true);
return;
}
parent.removeAllChild();
dbLogInfos = task.getResultModel();
DbLogInfoList dbLogInfoList = dbLogInfos == null ? null : dbLogInfos.getDbLogInfoList();
List<LogInfo> logInfoList = dbLogInfoList == null ? null : dbLogInfoList.getDbLogInfoList();
if (logInfoList != null) {
for (LogInfo dbLogInfo : logInfoList) {
String id = parent.getId() + NODE_SEPARATOR + dbLogInfo.getName();
CubridDbLogNode dbLogInfoNode = new CubridDbLogNode(id, dbLogInfo.getName(), "icons/navigator/log_item.png");
dbLogInfoNode.setType(CubridNodeType.LOGS_SERVER_DATABASE_LOG);
dbLogInfoNode.setModelObj(dbLogInfo);
dbLogInfoNode.setEditorId(LogEditorPart.ID);
dbLogInfoNode.setContainer(false);
parent.addChild(dbLogInfoNode);
}
}
if (dbLogInfos != null && serverInfo.getLogInfoManager() != null) {
serverInfo.getLogInfoManager().addDbLogInfos(dbLogInfos);
}
if (parent.getChildren() != null && !parent.getChildren().isEmpty()) {
Collections.sort(parent.getChildren());
}
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
Aggregations