use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.
the class AddVolumeAction method run.
/**
*
* Creates a Dialog which is the instance of AddVolumeDialog to add a query
* plan
*
*/
public void run() {
Object[] obj = this.getSelectedObj();
CubridDatabase database = null;
if (obj.length > 0 && obj[0] instanceof DefaultSchemaNode) {
selection = (DefaultSchemaNode) obj[0];
database = selection.getDatabase();
}
if (database == null) {
CommonUITool.openErrorBox(Messages.msgSelectDB);
return;
}
// Gets the status of adding volume
GetAddVolumeStatusInfo getAddVolumeStatusInfo = new GetAddVolumeStatusInfo();
final CommonQueryTask<GetAddVolumeStatusInfo> statusTask = new CommonQueryTask<GetAddVolumeStatusInfo>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), getAddVolumeStatusInfo);
statusTask.setDbName(database.getLabel());
TaskExecutor taskExecutor = new CommonTaskExec(com.cubrid.cubridmanager.ui.cubrid.dbspace.Messages.getVolumeInfoTaskName);
taskExecutor.addTask(statusTask);
CommonQueryTask<DbSpaceInfoList> spaceInfoTask = null;
DatabaseInfo databaseInfo = database.getDatabaseInfo();
DbSpaceInfoList dbSpaceInfoList = databaseInfo.getDbSpaceInfoList();
int pageSize = 0;
if (null == dbSpaceInfoList) {
dbSpaceInfoList = new DbSpaceInfoList();
spaceInfoTask = new CommonQueryTask<DbSpaceInfoList>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), dbSpaceInfoList);
spaceInfoTask.setDbName(database.getLabel());
taskExecutor.addTask(spaceInfoTask);
}
new ExecTaskWithProgress(taskExecutor).busyCursorWhile();
if (spaceInfoTask == null) {
pageSize = dbSpaceInfoList.getPagesize();
} else {
final DbSpaceInfoList model = ((CommonQueryTask<DbSpaceInfoList>) spaceInfoTask).getResultModel();
pageSize = model.getPagesize();
}
getAddVolumeStatusInfo = statusTask.getResultModel();
TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
AddVolumeDialog addVolumeDialog = new AddVolumeDialog(getShell());
addVolumeDialog.setGetAddVolumeStatusInfo(getAddVolumeStatusInfo);
addVolumeDialog.initPara(selection);
addVolumeDialog.setTreeViewer(treeViewer);
addVolumeDialog.setPageSize(pageSize);
addVolumeDialog.open();
}
use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.
the class SetAutoAddVolumeAction method run.
/**
* Creates a Dialog which is the instance of SetAutoAddVolumeDialog to set a
* auto adding volume
*/
public void run() {
Object[] obj = this.getSelectedObj();
DefaultSchemaNode selection = null;
CubridDatabase database = null;
if (obj.length > 0 && obj[0] instanceof DefaultSchemaNode) {
selection = (DefaultSchemaNode) obj[0];
database = selection.getDatabase();
}
if (database == null) {
CommonUITool.openErrorBox(Messages.msgSelectDB);
return;
}
//Get the info of AutoAddVolumeInfo
GetAutoAddVolumeInfo getAutoAddVolumeInfo = new GetAutoAddVolumeInfo();
final CommonQueryTask<GetAutoAddVolumeInfo> autoAddVolumetask = new CommonQueryTask<GetAutoAddVolumeInfo>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), getAutoAddVolumeInfo);
autoAddVolumetask.setDbName(database.getLabel());
TaskExecutor taskExecutor = new CommonTaskExec(com.cubrid.cubridmanager.ui.cubrid.dbspace.Messages.getVolumeInfoTaskName);
taskExecutor.addTask(autoAddVolumetask);
//Gets the page size in the database
int pageSize = 0;
CommonQueryTask<DbSpaceInfoList> spaceInfoTask = null;
DatabaseInfo databaseInfo = database.getDatabaseInfo();
DbSpaceInfoList dbSpaceInfoList = databaseInfo.getDbSpaceInfoList();
if (null == dbSpaceInfoList) {
dbSpaceInfoList = new DbSpaceInfoList();
spaceInfoTask = new CommonQueryTask<DbSpaceInfoList>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), dbSpaceInfoList);
spaceInfoTask.setDbName(database.getLabel());
taskExecutor.addTask(spaceInfoTask);
}
new ExecTaskWithProgress(taskExecutor).busyCursorWhile();
if (!taskExecutor.isSuccess()) {
return;
}
if (spaceInfoTask == null) {
pageSize = dbSpaceInfoList.getPagesize();
} else {
final DbSpaceInfoList model = ((CommonQueryTask<DbSpaceInfoList>) spaceInfoTask).getResultModel();
pageSize = model.getPagesize();
}
getAutoAddVolumeInfo = autoAddVolumetask.getResultModel();
SetAutoAddVolumeDialog dialog = new SetAutoAddVolumeDialog(getShell());
dialog.setGetAutoAddVolumeInfo(getAutoAddVolumeInfo);
dialog.setPageSize(pageSize);
GetAutoAddVolumeInfo returnInfo = dialog.getGetAutoAddVolumeInfo();
if (dialog.open() == Dialog.OK) {
ServerInfo serverInfo = database.getServer().getServerInfo();
SetAutoAddVolumeTask setTask = new SetAutoAddVolumeTask(serverInfo);
setTask.setDbname(database.getName());
setTask.setData(returnInfo.getData());
setTask.setDataWarnOutofspace(returnInfo.getData_warn_outofspace());
setTask.setDataExtPage(returnInfo.getData_ext_page());
setTask.setIndex(returnInfo.getIndex());
setTask.setIndexWarnOutofspace(returnInfo.getIndex_warn_outofspace());
setTask.setIndexExtPage(returnInfo.getIndex_ext_page());
taskExecutor = new CommonTaskExec(com.cubrid.cubridmanager.ui.cubrid.dbspace.Messages.setAutoAddedVolInfoTaskName);
taskExecutor.addTask(setTask);
new ExecTaskWithProgress(taskExecutor).exec();
}
}
use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.
the class VolumeFolderInfoEditor method init.
/**
* Initializes this editor with the given editor site and input.
*
* @param site the editor site
* @param input the editor input
* @exception PartInitException if this editor was not initialized
* successfully
*/
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
super.init(site, input);
if (input instanceof DefaultSchemaNode) {
ICubridNode node = (DefaultSchemaNode) input;
database = ((DefaultSchemaNode) node).getDatabase();
String type = node.getType();
if ((volumeType = folderTypeMap.get(type)) != null && (((DefaultSchemaNode) node).getChildren() != null && ((DefaultSchemaNode) node).getChildren().size() > 0)) {
for (ICubridNode child : ((DefaultSchemaNode) node).getChildren()) {
dbSpaceList.add((DbSpaceInfo) ((DefaultSchemaNode) child).getAdapter(DbSpaceInfo.class));
}
}
volumeFolderName = node.getName();
}
}
use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.
the class VolumeInformationEditor method init.
/**
* Initializes this editor with the given editor site and input.
*
* @param site the editor site
* @param input the editor input
* @exception PartInitException if this editor was not initialized
* successfully
*/
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
super.init(site, input);
if (input instanceof DefaultSchemaNode) {
ICubridNode node = (DefaultSchemaNode) input;
String type = node.getType();
database = ((DefaultSchemaNode) node).getDatabase();
if (CubridNodeType.GENERIC_VOLUME_FOLDER.equals(type) || CubridNodeType.DATA_VOLUME_FOLDER.equals(type) || CubridNodeType.INDEX_VOLUME_FOLDER.equals(type) || CubridNodeType.TEMP_VOLUME_FOLDER.equals(type) || CubridNodeType.ARCHIVE_LOG_FOLDER.equals(type) || CubridNodeType.ACTIVE_LOG_FOLDER.equals(type) || CubridNodeType.PP_VOLUME_FOLDER.equals(type) || CubridNodeType.PT_VOLUME_FOLDER.equals(type) || CubridNodeType.TT_VOLUME_FOLDER.equals(type)) {
dbSpaceInfo = (DbSpaceInfo) ((DefaultSchemaNode) node).getAdapter(DbSpaceInfo.class);
}
}
}
use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.
the class EditQueryPlanAction method run.
/**
* get edit query plan node
*/
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();
}
if (database == null) {
CommonUITool.openErrorBox(Messages.msgSelectDB);
return;
}
run(database, selection);
}
Aggregations