use of com.cubrid.common.ui.spi.model.ISchemaNode in project cubrid-manager by CUBRID.
the class DeleteQueryPlanAction method isSupported.
/**
* Sets this action support this object
*
* @see org.eclipse.jface.action.IAction.ISelectionAction
* @param obj Object
* @return boolean
*/
public boolean isSupported(Object obj) {
if (obj instanceof ISchemaNode) {
ISchemaNode node = (ISchemaNode) obj;
CubridDatabase database = node.getDatabase();
if (CubridNodeType.QUERY_PLAN.equals(node.getType()) && database != null && database.isLogined()) {
DbUserInfo dbUserInfo = database.getDatabaseInfo().getAuthLoginedDbUserInfo();
if (dbUserInfo != null && dbUserInfo.isDbaAuthority()) {
return true;
}
}
} else if (obj instanceof Object[]) {
Object[] objArr = (Object[]) obj;
CubridDatabase database = null;
for (Object object : objArr) {
DefaultSchemaNode node = (DefaultSchemaNode) object;
CubridDatabase db = node.getDatabase();
if (database == null) {
database = db;
} else if (!database.getId().equals(db.getId())) {
return false;
}
}
return true;
}
return false;
}
use of com.cubrid.common.ui.spi.model.ISchemaNode in project cubrid-manager by CUBRID.
the class VolumeFolderInfoEditor method nodeChanged.
/**
*
* @see com.cubrid.common.ui.spi.event.ICubridNodeChangedListener#nodeChanged(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)
* @param event the CubridNodeChangedEvent object
*/
public void nodeChanged(CubridNodeChangedEvent event) {
ICubridNode eventNode = event.getCubridNode();
if (!(eventNode instanceof ISchemaNode) || event.getType() != CubridNodeChangedEventType.CONTAINER_NODE_REFRESH || cubridNode == null) {
return;
}
if (!CubridNodeType.DBSPACE_FOLDER.equals(eventNode.getType())) {
return;
}
ISchemaNode eventSchemaNode = (ISchemaNode) eventNode;
ISchemaNode schemaNode = (ISchemaNode) cubridNode;
if (!eventSchemaNode.getDatabase().getId().equals(schemaNode.getDatabase().getId())) {
return;
}
synchronized (this) {
if (database.getDatabaseInfo().getDbSpaceInfoList() == null) {
loadData();
}
}
}
use of com.cubrid.common.ui.spi.model.ISchemaNode 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.ISchemaNode 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.ISchemaNode in project cubrid-manager by CUBRID.
the class JobAutoDashboardEditorPart method deleteQueryPlan.
public void deleteQueryPlan() {
TableItem[] items = queryPlanInfoTable.getTable().getSelection();
if (items.length > 0) {
List<ISchemaNode> selectNodeList = new ArrayList<ISchemaNode>();
for (TableItem item : items) {
QueryPlanInfo queryPlanInfo = (QueryPlanInfo) item.getData();
Set<String> typeSet = new HashSet<String>();
typeSet.add(CubridNodeType.QUERY_PLAN);
ICubridNode queryPlanNode = CommonUITool.findNode(database, typeSet, queryPlanInfo.getQuery_id());
selectNodeList.add((ISchemaNode) queryPlanNode);
}
if (selectNodeList.size() > 0) {
DeleteQueryPlanAction action = (DeleteQueryPlanAction) ActionManager.getInstance().getAction(DeleteQueryPlanAction.ID);
ISchemaNode[] nodeArr = new ISchemaNode[selectNodeList.size()];
action.run(selectNodeList.toArray(nodeArr));
refreshQueryPlan();
}
} else {
CommonUITool.openWarningBox(Messages.errJobAutoNoSelection);
}
}
Aggregations