Search in sources :

Example 11 with DefaultSchemaNode

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();
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) TreeViewer(org.eclipse.jface.viewers.TreeViewer) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode) GetAddVolumeStatusInfo(com.cubrid.cubridmanager.core.cubrid.dbspace.model.GetAddVolumeStatusInfo) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) AddVolumeDialog(com.cubrid.cubridmanager.ui.cubrid.dbspace.dialog.AddVolumeDialog) DbSpaceInfoList(com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Example 12 with DefaultSchemaNode

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();
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) DbSpaceInfoList(com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList) SetAutoAddVolumeDialog(com.cubrid.cubridmanager.ui.cubrid.dbspace.dialog.SetAutoAddVolumeDialog) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask) SetAutoAddVolumeTask(com.cubrid.cubridmanager.core.cubrid.dbspace.task.SetAutoAddVolumeTask) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) GetAutoAddVolumeInfo(com.cubrid.cubridmanager.core.cubrid.dbspace.model.GetAutoAddVolumeInfo)

Example 13 with DefaultSchemaNode

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();
    }
}
Also used : ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode)

Example 14 with DefaultSchemaNode

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);
        }
    }
}
Also used : ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode)

Example 15 with DefaultSchemaNode

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);
}
Also used : CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode)

Aggregations

DefaultSchemaNode (com.cubrid.common.ui.spi.model.DefaultSchemaNode)88 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)62 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)33 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)22 ICubridNodeLoader (com.cubrid.common.ui.spi.model.ICubridNodeLoader)21 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)18 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)17 ArrayList (java.util.ArrayList)15 TreeViewer (org.eclipse.jface.viewers.TreeViewer)10 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)9 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)9 Display (org.eclipse.swt.widgets.Display)9 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)8 ClassInfo (com.cubrid.cubridmanager.core.cubrid.table.model.ClassInfo)7 File (java.io.File)5 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)4 CommonQueryTask (com.cubrid.cubridmanager.core.common.task.CommonQueryTask)4 DbSpaceInfoList (com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList)4 GetAllClassListTask (com.cubrid.cubridmanager.core.cubrid.table.task.GetAllClassListTask)4 DbUserInfo (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo)4