use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class AddDashboardDialog method verify.
/**
*
* Verify data
*
*/
private void verify() {
String dashboardName = dashboardNameText.getText();
if (dashboardName.trim().length() == 0) {
getButton(IDialogConstants.OK_ID).setEnabled(false);
setErrorMessage(Messages.errDashboardName);
return;
}
List<ICubridNode> dashboardList = MonitorDashboardPersistManager.getInstance().getAllMonitorDashboards();
for (int i = 0; i < dashboardList.size(); i++) {
ICubridNode node = dashboardList.get(i);
if (dashboardName.equals(node.getLabel()) && (dashboard == null || !dashboard.getName().equals(dashboardName))) {
getButton(IDialogConstants.OK_ID).setEnabled(false);
setErrorMessage(Messages.errDashboardNameExist);
return;
}
}
/*TOOLS-3672 Avoid to dashboard node and statistic node have the same name*/
List<MonitorStatistic> monitorList = MonitorStatisticPersistManager.getInstance().getMonitorStatisticListByHostId(null);
for (MonitorStatistic monitorStatistic : monitorList) {
if (dashboardName.equals(monitorStatistic.getId())) {
if (dashboardName.equals(monitorStatistic.getLabel())) {
getButton(IDialogConstants.OK_ID).setEnabled(false);
setErrorMessage(Messages.errDashboardNameExist);
return;
}
}
}
if (hostNodeList.isEmpty()) {
getButton(IDialogConstants.OK_ID).setEnabled(false);
setErrorMessage(Messages.errHostAndDbList);
return;
}
getButton(IDialogConstants.OK_ID).setEnabled(true);
setErrorMessage(null);
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class StartRetargetAction method run.
/**
* start database or broker
*/
public void run() {
final Object[] obj = this.getSelectedObj();
if (!isSupported(obj[0])) {
return;
}
ICubridNode node = (ICubridNode) obj[0];
if (NodeType.SERVER.equals(node.getType())) {
StartServiceAction startServiceAction = (StartServiceAction) ActionManager.getInstance().getAction(StartServiceAction.ID);
startServiceAction.run();
}
if (node instanceof ISchemaNode) {
StartDatabaseAction startDatabaseAction = (StartDatabaseAction) ActionManager.getInstance().getAction(StartDatabaseAction.ID);
startDatabaseAction.run();
}
if (node instanceof CubridBroker) {
StartBrokerAction startBrokerAction = (StartBrokerAction) ActionManager.getInstance().getAction(StartBrokerAction.ID);
startBrokerAction.run();
}
if (node instanceof CubridBrokerFolder) {
StartBrokerEnvAction startBrokerEnvAction = (StartBrokerEnvAction) ActionManager.getInstance().getAction(StartBrokerEnvAction.ID);
startBrokerEnvAction.run();
}
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class StartServiceAction method isSupported.
/**
*
* Return whether this action support this object,if not support,this action
* will be disabled
*
* @param obj the Object
* @return <code>true</code> if support this object;<code>false</code>
* otherwise
*/
public boolean isSupported(Object obj) {
if (obj instanceof ICubridNode) {
ICubridNode node = (ICubridNode) obj;
CubridServer server = node.getServer();
if (server == null) {
return false;
}
ServerInfo serverInfo = server.getServerInfo();
ServerType serverType = serverInfo == null ? null : serverInfo.getServerType();
if (serverType == null || serverType == ServerType.BROKER) {
return false;
}
if (server != null && server.isConnected() && serverInfo != null && serverInfo.getLoginedUserInfo() != null && serverInfo.getLoginedUserInfo().isAdmin()) {
return true;
}
}
return false;
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class StopRetargetAction method run.
/**
* stop database or broker
*/
public void run() {
final Object[] obj = this.getSelectedObj();
if (!isSupported(obj[0])) {
return;
}
ICubridNode node = (ICubridNode) obj[0];
if (NodeType.SERVER.equals(node.getType())) {
StopServiceAction stopServiceAction = (StopServiceAction) ActionManager.getInstance().getAction(StopServiceAction.ID);
stopServiceAction.run();
}
if (node instanceof ISchemaNode) {
StopDatabaseAction stopDatabaseAction = (StopDatabaseAction) ActionManager.getInstance().getAction(StopDatabaseAction.ID);
stopDatabaseAction.run();
}
if (node instanceof CubridBroker) {
StopBrokerAction stopBrokerAction = (StopBrokerAction) ActionManager.getInstance().getAction(StopBrokerAction.ID);
stopBrokerAction.run();
}
if (node instanceof CubridBrokerFolder) {
StopBrokerEnvAction stopBrokerEnvAction = (StopBrokerEnvAction) ActionManager.getInstance().getAction(StopBrokerEnvAction.ID);
stopBrokerEnvAction.run();
}
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class BrokerEnvStatusView method nodeChanged.
/**
* Response to cubrid node changes
*
* @param event the event
*/
public void nodeChanged(CubridNodeChangedEvent event) {
ICubridNode eventNode = event.getCubridNode();
if (eventNode == null || this.cubridNode == null) {
return;
}
//if it is not in the same host,return
if (!eventNode.getServer().getId().equals(this.cubridNode.getServer().getId())) {
return;
}
//if changed node is not broker folder or server,return
String type = eventNode.getType();
if (!CubridNodeType.BROKER_FOLDER.equals(type) && !CubridNodeType.SERVER.equals(type)) {
return;
}
synchronized (this) {
if (type == NodeType.SERVER) {
String id = eventNode.getId();
CubridBrokerFolder currentNode = (CubridBrokerFolder) eventNode.getChild(id);
this.cubridNode = currentNode;
} else {
this.cubridNode = eventNode;
}
if (this.cubridNode == null || !((CubridBrokerFolder) eventNode).isRunning()) {
setRunflag(false);
this.setTitleImage(CubridManagerUIPlugin.getImage("icons/navigator/broker_group.png"));
return;
} else {
setRunflag(true);
this.setTitleImage(CubridManagerUIPlugin.getImage("icons/navigator/broker_service_started.png"));
}
refresh(true, false);
}
}
Aggregations