use of com.cubrid.common.ui.spi.model.DefaultCubridNode in project cubrid-manager by CUBRID.
the class CubridStatusMonitorFolderLoader 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()) {
return;
}
ServerInfo serverInfo = parent.getServer().getServerInfo();
ServerUserInfo userInfo = serverInfo.getLoginedUserInfo();
if (userInfo == null || StatusMonitorAuthType.AUTH_NONE == userInfo.getStatusMonitorAuth()) {
parent.removeAllChild();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
return;
}
if (CompatibleUtil.isSupportBrokerOrDBStatusMonitor(serverInfo)) {
String brokerStatusId = parent.getId() + NODE_SEPARATOR + BROKER_STATUS_ID;
ICubridNode brokerStatusNode = new DefaultCubridNode(brokerStatusId, Messages.msgBrokerStatusMonitorName, "icons/navigator/status_item.png");
brokerStatusNode.setType(CubridNodeType.STATUS_MONITOR_TEMPLATE);
brokerStatusNode.setViewId(BrokerStatusMonitorViewPart.ID);
brokerStatusNode.setContainer(false);
parent.addChild(brokerStatusNode);
String dbStatusId = parent.getId() + NODE_SEPARATOR + DB_STATUS_ID;
ICubridNode dbStautsNode = new DefaultCubridNode(dbStatusId, Messages.msgDbStatusMonitorName, "icons/navigator/status_item.png");
dbStautsNode.setType(CubridNodeType.STATUS_MONITOR_TEMPLATE);
dbStautsNode.setViewId(DbStatusDumpMonitorViewPart.ID);
dbStautsNode.setContainer(false);
parent.addChild(dbStautsNode);
createTempStatusNode(parent);
} else {
if (!loadStatusTempInfoTask(parent, monitor, serverInfo)) {
return;
}
}
Collections.sort(parent.getChildren());
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
use of com.cubrid.common.ui.spi.model.DefaultCubridNode in project cubrid-manager by CUBRID.
the class CubridStatusMonitorFolderLoader method loadStatusTempInfoTask.
/**
* load sub node by the task of getStatusTemplateInfos
*
* @param parent the parent node
* @param monitor the instance of IProgressMonitor
* @param serverInfo the instance of serverInfo
* @return boolean false if error occur, true if succeed
*/
private boolean loadStatusTempInfoTask(ICubridNode parent, final IProgressMonitor monitor, ServerInfo serverInfo) {
StatusTemplateInfos statusTemplateInfos = new StatusTemplateInfos();
final CommonQueryTask<StatusTemplateInfos> task = new CommonQueryTask<StatusTemplateInfos>(serverInfo, CommonSendMsg.getCommonSimpleSendMsg(), statusTemplateInfos);
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 false;
}
if (monitor.isCanceled()) {
setLoaded(true);
return false;
}
parent.removeAllChild();
statusTemplateInfos = task.getResultModel();
if (statusTemplateInfos != null) {
List<StatusTemplateInfo> list = statusTemplateInfos.getStatusTemplateInfoList().getStatusTemplateInfoList();
if (list != null) {
for (StatusTemplateInfo statusTemplateInfo : list) {
String id = parent.getId() + NODE_SEPARATOR + statusTemplateInfo.getName();
ICubridNode logInfoNode = new DefaultCubridNode(id, statusTemplateInfo.getName(), "icons/navigator/status_item.png");
logInfoNode.setType(CubridNodeType.STATUS_MONITOR_TEMPLATE);
logInfoNode.setModelObj(statusTemplateInfo);
logInfoNode.setViewId(StatusMonitorViewPart.ID);
logInfoNode.setContainer(false);
parent.addChild(logInfoNode);
}
}
}
return true;
}
use of com.cubrid.common.ui.spi.model.DefaultCubridNode in project cubrid-manager by CUBRID.
the class CubridShardFolderLoader method load.
/**
*
* Load children object for parent
*
* @param parent
* the parent node
* @param monitor
* the IProgressMonitor object
*/
public void load(final ICubridNode parent, final IProgressMonitor monitor) {
synchronized (this) {
if (isLoaded()) {
return;
}
// add sql log folder
String sqlLogFolderId = parent.getId() + NODE_SEPARATOR + SQL_LOG_FOLDER_ID;
ICubridNode sqlLogFolder = parent.getChild(sqlLogFolderId);
if (sqlLogFolder == null) {
sqlLogFolder = new DefaultCubridNode(sqlLogFolderId, SQL_LOG_FOLDER_NAME, "icons/navigator/folder.png");
sqlLogFolder.setType(CubridNodeType.BROKER_SQL_LOG_FOLDER);
sqlLogFolder.setContainer(true);
parent.addChild(sqlLogFolder);
}
// add the children of sql log folder
ServerInfo serverInfo = parent.getServer().getServerInfo();
BrokerLogInfos brokerLogInfos = new BrokerLogInfos();
final CommonQueryTask<BrokerLogInfos> task = new CommonQueryTask<BrokerLogInfos>(serverInfo, CommonSendMsg.getGetBrokerLogFileInfoMSGItems(), brokerLogInfos);
task.setBroker(parent.getName());
monitorCancel(monitor, new ITask[] { task });
task.execute();
final String errorMsg = task.getErrorMsg();
if (!monitor.isCanceled() && errorMsg != null && errorMsg.trim().length() > 0) {
sqlLogFolder.removeAllChild();
openErrorBox(errorMsg);
setLoaded(true);
return;
}
if (monitor.isCanceled()) {
setLoaded(true);
return;
}
sqlLogFolder.removeAllChild();
brokerLogInfos = task.getResultModel();
List<LogInfo> logInfoList = brokerLogInfos == null ? null : brokerLogInfos.getBrokerLogInfoList().getLogFileInfoList();
if (logInfoList != null && !logInfoList.isEmpty()) {
for (LogInfo logInfo : logInfoList) {
String id = sqlLogFolder.getId() + NODE_SEPARATOR + logInfo.getName();
ICubridNode logInfoNode = new DefaultCubridNode(id, logInfo.getName(), "icons/navigator/sqllog_item.png");
logInfoNode.setContainer(false);
logInfoNode.setEditorId(LogEditorPart.ID);
logInfoNode.setModelObj(logInfo);
if (LogType.SCRIPT.getText().toLowerCase().equals(logInfo.getType())) {
logInfoNode.setType(CubridNodeType.BROKER_SQL_LOG);
sqlLogFolder.addChild(logInfoNode);
}
}
}
Collections.sort(sqlLogFolder.getChildren());
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
use of com.cubrid.common.ui.spi.model.DefaultCubridNode in project cubrid-manager by CUBRID.
the class DeleteUserAction method run.
/**
*
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
Object[] obj = this.getSelectedObj();
if (obj.length == 1 && obj[0] instanceof DefaultCubridNode) {
ISchemaNode schemaNode = (ISchemaNode) obj[0];
String msg = Messages.bind(Messages.msgDoYouWantToDeleteUser, schemaNode.getName());
if (!CommonUITool.openConfirmBox(getShell(), msg)) {
return;
}
doRun(schemaNode);
}
}
use of com.cubrid.common.ui.spi.model.DefaultCubridNode in project cubrid-manager by CUBRID.
the class QueryLogAction method run.
/**
*
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
Object[] obj = this.getSelectedObj();
DefaultCubridNode node = null;
CubridServer server = null;
if (obj.length > 0 && obj[0] instanceof DefaultCubridNode) {
node = (DefaultCubridNode) obj[0];
server = node.getServer();
}
QueryLogDialog dlg = new QueryLogDialog(getShell());
dlg.setServer(server);
if (dlg.loadData()) {
dlg.open();
}
}
Aggregations