use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.
the class AddQueryPlanAction method run.
public void run(CubridDatabase database) {
ICubridNode jobAutoFolderNode = database.getChild(database.getId() + ICubridNodeLoader.NODE_SEPARATOR + CubridDatabaseLoader.JOB_AUTO_FOLDER_ID);
DefaultSchemaNode queryPlanFolderNode = (DefaultSchemaNode) jobAutoFolderNode.getChild(jobAutoFolderNode.getId() + ICubridNodeLoader.NODE_SEPARATOR + CubridJobAutoFolderLoader.QUERY_PLAN_FOLDER_ID);
boolean withUser = false;
if (CompatibleUtil.isSupportQueryPlanWithUser(database.getDatabaseInfo())) {
withUser = true;
}
TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
EditQueryPlanDialog editQueryPlanDlg = new EditQueryPlanDialog(getShell(), true);
editQueryPlanDlg.setDatabase(database);
editQueryPlanDlg.setOperation(AddEditType.ADD);
editQueryPlanDlg.initPara(queryPlanFolderNode);
DefaultSchemaNode newNode = null;
if (editQueryPlanDlg.open() == Dialog.OK) {
// Sets the data of task
QueryPlanInfoHelp queryPlanInfoHelp = editQueryPlanDlg.getQueryPlanInfo();
QueryPlanInfo queryPlanInfo = queryPlanInfoHelp.getQueryPlanInfo();
String newQueryId = queryPlanInfoHelp.getQuery_id();
newNode = new DefaultSchemaNode(newQueryId, newQueryId, ICON_PATH);
newNode.setContainer(false);
newNode.setType(CubridNodeType.QUERY_PLAN);
newNode.setModelObj(queryPlanInfo);
List<ICubridNode> list = queryPlanFolderNode.getChildren();
List<String> msgList = new ArrayList<String>();
QueryPlanInfo queryPlan = null;
QueryPlanInfoHelp qHelp = new QueryPlanInfoHelp();
for (ICubridNode icn : list) {
if (!icn.isContainer()) {
queryPlan = (QueryPlanInfo) icn.getAdapter(QueryPlanInfo.class);
qHelp.setQueryPlanInfo(queryPlan);
msgList.add(qHelp.buildMsg(withUser));
}
}
qHelp.setQueryPlanInfo(queryPlanInfo);
msgList.add(qHelp.buildMsg(withUser));
ServerInfo serverInfo = database.getServer().getServerInfo();
SetQueryPlanListTask task = new SetQueryPlanListTask(serverInfo);
task.setDbname(database.getName());
task.buildMsg(msgList);
String taskName = Messages.bind(com.cubrid.cubridmanager.ui.cubrid.jobauto.Messages.addQueryPlanTaskName, newQueryId);
TaskExecutor taskExecutor = new CommonTaskExec(taskName);
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).exec();
if (!taskExecutor.isSuccess()) {
return;
}
} else {
canceledTask = true;
}
if (null != newNode) {
queryPlanFolderNode.addChild(newNode);
treeViewer.add(queryPlanFolderNode, newNode);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent(newNode, CubridNodeChangedEventType.NODE_ADD));
}
}
use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.
the class AddQueryPlanAction method run.
public void run() {
Object[] obj = this.getSelectedObj();
CubridDatabase database = null;
DefaultSchemaNode selection = null;
if (obj.length > 0 && obj[0] instanceof DefaultSchemaNode) {
selection = (DefaultSchemaNode) obj[0];
database = selection.getDatabase();
}
assert (null != selection);
if (database == null) {
CommonUITool.openErrorBox(Messages.msgSelectDB);
return;
}
run(database);
}
use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.
the class BackupErrLogAction method run.
/**
*
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
Shell shell = getShell();
Object[] obj = this.getSelectedObj();
DefaultSchemaNode node = null;
if (obj.length > 0 && obj[0] instanceof DefaultSchemaNode) {
node = (DefaultSchemaNode) obj[0];
}
if (node == null) {
return;
}
BackupErrLogDialog dlg = new BackupErrLogDialog(shell);
dlg.setDatabase(node.getDatabase());
try {
if (dlg.loadData(shell)) {
dlg.open();
}
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
}
}
Aggregations