use of com.cubrid.cubridmanager.core.logs.model.DbLogInfoList in project cubrid-manager by CUBRID.
the class DatabaseLogListDialog method postTaskFinished.
/**
* After a task has been executed, do some thing such as refresh.
*
* @param task the task
* @return IStatus if complete refresh false if run into error
*
*/
@SuppressWarnings("unchecked")
public IStatus postTaskFinished(ITask task) {
if (task instanceof CommonQueryTask) {
CommonQueryTask<DbLogInfos> getLogListTask = (CommonQueryTask<DbLogInfos>) task;
DbLogInfos dbLogInfos = getLogListTask.getResultModel();
DbLogInfoList dbLogInfoList = dbLogInfos == null ? null : dbLogInfos.getDbLogInfoList();
List<LogInfo> logInfoList = dbLogInfoList == null ? null : dbLogInfoList.getDbLogInfoList();
for (int i = 0; logInfoList != null && i < logInfoList.size(); i++) {
Map<String, Object> map = new HashMap<String, Object>();
LogInfo logInfo = logInfoList.get(i);
map.put("0", logInfo.getName());
map.put("1", logInfo);
dbLogList.add(map);
}
if (dbLogTable != null && !dbLogTable.isDisposed()) {
dbLogTableViewer.refresh();
for (int i = 0; i < dbLogTable.getColumnCount(); i++) {
dbLogTable.getColumn(i).pack();
}
}
}
return Status.OK_STATUS;
}
use of com.cubrid.cubridmanager.core.logs.model.DbLogInfoList in project cubrid-manager by CUBRID.
the class LogsModelTest method testModelDbLogInfoList.
public void testModelDbLogInfoList() {
DbLogInfoList bean = new DbLogInfoList();
bean.removeAllLog();
bean.addLog(new LogInfo());
bean.removeLog(new LogInfo());
bean.removeAllLog();
bean.getDbLogInfoList();
bean.getDbLogInfo("aa");
bean.addLog(new LogInfo());
bean.removeAllLog();
LogInfo aInfo = new LogInfo();
aInfo.setPath("path");
bean.addLog(aInfo);
LogInfo bInfo = new LogInfo();
bInfo.setPath("aaa");
bean.addLog(bInfo);
bean.getDbLogInfo("path");
}
use of com.cubrid.cubridmanager.core.logs.model.DbLogInfoList 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));
}
}
use of com.cubrid.cubridmanager.core.logs.model.DbLogInfoList in project cubrid-manager by CUBRID.
the class LogsModelTest method testModelDbLogInfoList.
public void testModelDbLogInfoList() {
DbLogInfoList bean = new DbLogInfoList();
bean.addLog(new LogInfo());
bean.removeLog(new LogInfo());
bean.removeAllLog();
bean.getDbLogInfoList();
bean.getDbLogInfo("aa");
}
use of com.cubrid.cubridmanager.core.logs.model.DbLogInfoList in project cubrid-manager by CUBRID.
the class ManagerLogInfoListTest method testModelDbLogInfoList.
public void testModelDbLogInfoList() {
DbLogInfoList bean = new DbLogInfoList();
bean.addLog(new LogInfo());
bean.removeLog(new LogInfo());
bean.removeAllLog();
bean.getDbLogInfoList();
bean.getDbLogInfo("aa");
}
Aggregations