use of com.cubrid.cubridmanager.ui.spi.model.CubridBroker 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.cubridmanager.ui.spi.model.CubridBroker 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.cubridmanager.ui.spi.model.CubridBroker in project cubrid-manager by CUBRID.
the class RestartBrokerAction method isSupportedNode.
public static boolean isSupportedNode(Object obj) {
if (obj instanceof CubridBroker) {
CubridBroker selection = ((CubridBroker) obj);
if (selection.getServer() == null || selection.getServer().getServerInfo() == null) {
return false;
}
ServerUserInfo userInfo = selection.getServer().getServerInfo().getLoginedUserInfo();
if (userInfo == null || CasAuthType.AUTH_ADMIN != userInfo.getCasAuth()) {
return false;
}
CubridBrokerFolder parent = (CubridBrokerFolder) (selection.getParent());
return parent.isRunning() && selection.isRunning();
}
return false;
}
use of com.cubrid.cubridmanager.ui.spi.model.CubridBroker in project cubrid-manager by CUBRID.
the class StopBrokerAction method isSupportedNode.
/**
* Return whether this action support this object,if not support,this action
* will be disabled
*
* @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java
* .lang.Object)
* @param obj the object
* @return <code>true</code> if supported;<code>false</code>
*/
public static boolean isSupportedNode(Object obj) {
if (obj instanceof CubridBroker) {
CubridBroker selection = ((CubridBroker) obj);
ServerUserInfo userInfo = selection.getServer().getServerInfo().getLoginedUserInfo();
if (userInfo == null || CasAuthType.AUTH_ADMIN != userInfo.getCasAuth()) {
return false;
}
CubridBrokerFolder parent = (CubridBrokerFolder) (selection.getParent());
return parent.isRunning() && selection.isRunning();
}
return false;
}
use of com.cubrid.cubridmanager.ui.spi.model.CubridBroker in project cubrid-manager by CUBRID.
the class NavigatorTreeLabelProvider method getImage.
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
*/
public Image getImage(Object element) {
String iconPath = "";
if (element instanceof CubridServer) {
CubridServer server = (CubridServer) element;
if (server.isConnected()) {
iconPath = server.getConnectedIconPath();
} else {
iconPath = server.getDisConnectedIconPath();
}
Image serverImage = CubridManagerUIPlugin.getImage(iconPath);
return decorateServerImgae(serverImage, server);
} else if (element instanceof CubridDatabase) {
CubridDatabase database = (CubridDatabase) element;
if (database.getRunningType() == DbRunningType.STANDALONE && database.isLogined()) {
iconPath = database.getStopAndLoginIconPath();
} else if (database.getRunningType() == DbRunningType.STANDALONE && !database.isLogined()) {
iconPath = database.getStopAndLogoutIconPath();
} else if (database.getRunningType() == DbRunningType.CS && database.isLogined()) {
iconPath = database.getStartAndLoginIconPath();
} else if (database.getRunningType() == DbRunningType.CS && !database.isLogined()) {
iconPath = database.getStartAndLogoutIconPath();
}
Image databaseImage = CubridManagerUIPlugin.getImage(iconPath);
return decorateDatabaseImgae(databaseImage, database);
} else if (element instanceof CubridBrokerFolder) {
CubridBrokerFolder brokerFolder = (CubridBrokerFolder) element;
if (brokerFolder.isRunning()) {
iconPath = brokerFolder.getStartedIconPath();
} else {
iconPath = brokerFolder.getStopedIconPath();
}
} else if (element instanceof CubridBroker) {
CubridBroker broker = (CubridBroker) element;
if (broker.isRunning()) {
iconPath = broker.getStartedIconPath();
} else {
iconPath = broker.getStopedIconPath();
}
} else if (element instanceof CubridShardFolder) {
// TODO shard
CubridShardFolder shardFolder = (CubridShardFolder) element;
// if (shardFolder.isEnable()) {
if (shardFolder.isRunning()) {
iconPath = shardFolder.getStartedIconPath();
} else {
iconPath = shardFolder.getStopedIconPath();
}
// } else {
// iconPath = shardFolder.getDisableIconPath();
// }
} else if (element instanceof CubridShard) {
CubridShard shard = (CubridShard) element;
if (shard.isRunning()) {
iconPath = shard.getStartedIconPath();
} else {
iconPath = shard.getStopedIconPath();
}
} else if (element instanceof ICubridNode) {
ICubridNode node = (ICubridNode) element;
iconPath = node.getIconPath();
}
if (iconPath != null && iconPath.length() > 0) {
return CubridManagerUIPlugin.getImage(iconPath.trim());
}
return super.getImage(element);
}
Aggregations