use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class EditQueryPlanDialog method initPara.
/**
* Sets the queryPlanInfo and selection which is a folder
*
* @param selection the selection to set
*/
public void initPara(DefaultSchemaNode selection) {
childrenLabel = new ArrayList<String>();
ICubridNode[] childrenNode = null;
QueryPlanInfo qpi = null;
if (operation == AddEditType.EDIT) {
qpi = (QueryPlanInfo) selection.getAdapter(QueryPlanInfo.class);
childrenNode = selection.getParent().getChildren(new NullProgressMonitor());
} else {
qpi = new QueryPlanInfo();
childrenNode = selection.getChildren(new NullProgressMonitor());
}
queryPlanInfo = new QueryPlanInfoHelp();
queryPlanInfo.setQueryPlanInfo(qpi);
database = selection.getDatabase();
for (ICubridNode childNode : childrenNode) {
childrenLabel.add(childNode.getLabel());
}
withUser = CompatibleUtil.isSupportQueryPlanWithUser(database.getDatabaseInfo());
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class JobAutoDashboardEditorPart method expandBackOrQueryPlanChildNode.
public void expandBackOrQueryPlanChildNode() {
Set<String> typeSet = new HashSet<String>();
typeSet.add(CubridNodeType.JOB_FOLDER);
ICubridNode jobFolderNode = CommonUITool.findNode(database, typeSet);
if (jobFolderNode != null) {
CubridNavigatorView view = CubridNavigatorView.getNavigatorView("com.cubrid.cubridmanager.host.navigator");
if (view == null) {
return;
}
TreeViewer treeViewer = view.getViewer();
for (ICubridNode backOrQueryFolderNode : jobFolderNode.getChildren()) {
//if not expand ,expand the node and wait until all children be added
if (!treeViewer.getExpandedState(backOrQueryFolderNode)) {
treeViewer.expandToLevel(backOrQueryFolderNode, 1);
}
}
}
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class JobAutoDashboardEditorPart method editQueryPlan.
public void editQueryPlan() {
TableItem[] items = queryPlanInfoTable.getTable().getSelection();
if (items.length != 0) {
TableItem item = items[0];
QueryPlanInfo queryPlanInfo = (QueryPlanInfo) item.getData();
Set<String> typeSet = new HashSet<String>();
typeSet.add(CubridNodeType.QUERY_PLAN);
ICubridNode queryPlanNode = findAutoJobInfoNode(CubridNodeType.QUERY_PLAN, queryPlanInfo.getQuery_id());
if (queryPlanNode != null) {
EditQueryPlanAction action = (EditQueryPlanAction) ActionManager.getInstance().getAction(EditQueryPlanAction.ID);
if (action.run(database, (DefaultSchemaNode) queryPlanNode) == IDialogConstants.OK_ID) {
refreshQueryPlan();
}
}
} else {
CommonUITool.openWarningBox(Messages.errJobAutoNoSelection);
}
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class JobAutoDashboardEditorPart method findAutoJobInfoNode.
/**
* find queryPlanoNode or backupPlanNode from treeView
*
* @param nodeType String
* @param nodeType id
* @return
*/
public ICubridNode findAutoJobInfoNode(String nodeType, String id) {
Set<String> typeSet = new HashSet<String>();
typeSet.add(nodeType);
ICubridNode node = CommonUITool.findNode(database, typeSet, id);
//if backupPlanNode is null,expand the backupPlanNodeFolder then find again
if (node == null) {
CubridNavigatorView view = CubridNavigatorView.getNavigatorView(CubridHostNavigatorView.ID);
TreeViewer treeViewer = view.getViewer();
ICubridNode jobAutoFolderNode = database.getChild(database.getId() + ICubridNodeLoader.NODE_SEPARATOR + CubridDatabaseLoader.JOB_AUTO_FOLDER_ID);
String childNodeFolderID = nodeType.equals(CubridNodeType.BACKUP_PLAN) ? CubridJobAutoFolderLoader.BACKUP_PLAN_FOLDER_ID : CubridJobAutoFolderLoader.QUERY_PLAN_FOLDER_ID;
DefaultSchemaNode folderNode = (DefaultSchemaNode) jobAutoFolderNode.getChild(jobAutoFolderNode.getId() + ICubridNodeLoader.NODE_SEPARATOR + childNodeFolderID);
treeViewer.expandToLevel(folderNode, 1);
//wait 5 times expand the folder node
int time = 0;
while (folderNode.getChildren().size() == 0 && time++ < 5) {
try {
Thread.sleep(500);
} catch (Exception e) {
}
}
}
return CommonUITool.findNode(database, typeSet, id);
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class ViewServerVersionAction 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 obj;<code>false</code>
* otherwise
*/
public boolean isSupported(Object obj) {
if (obj instanceof ICubridNode) {
ICubridNode node = (ICubridNode) obj;
CubridServer server = node.getServer();
return server != null && server.isConnected();
}
return false;
}
Aggregations