Search in sources :

Example 71 with DefaultSchemaNode

use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.

the class CubridQueryPlanFolderLoader method load.

/**
	 * 
	 * Load children object for parent
	 * 
	 * @param parent the parent node
	 * @param monitor the IProgressMonitor object
	 */
public void load(ICubridNode parent, final IProgressMonitor monitor) {
    synchronized (this) {
        if (isLoaded()) {
            return;
        }
        CubridDatabase database = ((ISchemaNode) parent).getDatabase();
        DatabaseInfo databaseInfo = database.getDatabaseInfo();
        final GetQueryPlanListTask task = new GetQueryPlanListTask(parent.getServer().getServerInfo());
        task.setDbName(database.getLabel());
        monitorCancel(monitor, new ITask[] { task });
        task.execute();
        final String errorMsg = task.getErrorMsg();
        if (!monitor.isCanceled() && errorMsg != null && errorMsg.trim().length() > 0) {
            parent.removeAllChild();
            openErrorBox(errorMsg);
            setLoaded(true);
            return;
        }
        if (monitor.isCanceled()) {
            setLoaded(true);
            return;
        }
        parent.removeAllChild();
        List<QueryPlanInfo> queryPlanInfoList = task.getQueryPlanInfoList();
        if (queryPlanInfoList != null && !queryPlanInfoList.isEmpty()) {
            for (QueryPlanInfo queryPlanInfo : queryPlanInfoList) {
                String id = parent.getId() + NODE_SEPARATOR + queryPlanInfo.getQuery_id();
                ICubridNode queryPlanInfoNode = new DefaultSchemaNode(id, queryPlanInfo.getQuery_id(), "icons/navigator/auto_query_item.png");
                queryPlanInfoNode.setContainer(false);
                queryPlanInfoNode.setModelObj(queryPlanInfo);
                queryPlanInfoNode.setType(CubridNodeType.QUERY_PLAN);
                parent.addChild(queryPlanInfoNode);
            }
        }
        databaseInfo.setQueryPlanInfoList(queryPlanInfoList);
        Collections.sort(parent.getChildren());
        setLoaded(true);
        CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
    }
}
Also used : ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) GetQueryPlanListTask(com.cubrid.cubridmanager.core.cubrid.jobauto.task.GetQueryPlanListTask) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) QueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode)

Example 72 with DefaultSchemaNode

use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.

the class CubridDatabaseLoader method addUserFolder.

/**
	 * Add user folder
	 * 
	 * @param monitor the IProgressMonitor
	 * @param database the CubridDatabase
	 */
private void addUserFolder(final IProgressMonitor monitor, CubridDatabase database) {
    String userFolderId = database.getId() + NODE_SEPARATOR + USERS_FOLDER_ID;
    ICubridNode userFolder = database.getChild(userFolderId);
    if (userFolder == null) {
        userFolder = new DefaultSchemaNode(userFolderId, USERS_FOLDER_NAME, "icons/navigator/user_group.png");
        userFolder.setType(CubridNodeType.USER_FOLDER);
        userFolder.setContainer(true);
        ICubridNodeLoader loader = new CubridDbUsersFolderLoader();
        loader.setLevel(getLevel());
        userFolder.setLoader(loader);
        database.addChild(userFolder);
        if (getLevel() == DEFINITE_LEVEL) {
            userFolder.getChildren(monitor);
        }
    } else {
        if (userFolder.getLoader() != null && userFolder.getLoader().isLoaded()) {
            userFolder.getLoader().setLoaded(false);
            userFolder.getChildren(monitor);
        }
    }
}
Also used : ICubridNodeLoader(com.cubrid.common.ui.spi.model.ICubridNodeLoader) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode)

Example 73 with DefaultSchemaNode

use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.

the class CubridDatabaseLoader method addTriggerFolder.

/**
	 * Add trigger folder
	 * 
	 * @param monitor the IProgressMonitor
	 * @param database the CubridDatabase
	 */
private void addTriggerFolder(final IProgressMonitor monitor, CubridDatabase database) {
    String tiggerFolderId = database.getId() + NODE_SEPARATOR + CubridTriggerFolderLoader.TRIGGER_FOLDER_ID;
    ICubridNode tiggerFolder = database.getChild(tiggerFolderId);
    //IsDBAUserTask
    if (tiggerFolder == null) {
        tiggerFolder = new DefaultSchemaNode(tiggerFolderId, TRIGGER_FOLDER_NAME, "icons/navigator/trigger_group.png");
        tiggerFolder.setType(NodeType.TRIGGER_FOLDER);
        tiggerFolder.setContainer(true);
        ICubridNodeLoader loader = new CubridTriggerFolderLoader();
        loader.setLevel(getLevel());
        tiggerFolder.setLoader(loader);
        database.addChild(tiggerFolder);
        if (getLevel() == DEFINITE_LEVEL) {
            tiggerFolder.getChildren(monitor);
        }
    } else {
        if (tiggerFolder.getLoader() != null && tiggerFolder.getLoader().isLoaded()) {
            tiggerFolder.getLoader().setLoaded(false);
            tiggerFolder.getChildren(monitor);
        }
    }
}
Also used : ICubridNodeLoader(com.cubrid.common.ui.spi.model.ICubridNodeLoader) CubridTriggerFolderLoader(com.cubrid.common.ui.spi.model.loader.CubridTriggerFolderLoader) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode)

Example 74 with DefaultSchemaNode

use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.

the class CubridDatabaseLoader method addTableFolder.

/**
	 * Add table folder
	 * 
	 * @param monitor the IProgressMonitor
	 * @param database the CubridDatabase
	 */
private void addTableFolder(final IProgressMonitor monitor, CubridDatabase database) {
    String tablesFolderId = database.getId() + NODE_SEPARATOR + CubridTablesFolderLoader.TABLES_FOLDER_ID;
    ICubridNode tablesFolder = database.getChild(tablesFolderId);
    if (tablesFolder == null) {
        tablesFolder = new DefaultSchemaNode(tablesFolderId, TABLES_FOLDER_NAME, "icons/navigator/schema_table.png");
        tablesFolder.setType(NodeType.TABLE_FOLDER);
        tablesFolder.setContainer(true);
        ICubridNodeLoader loader = new CubridTablesFolderLoader();
        loader.setLevel(getLevel());
        tablesFolder.setLoader(loader);
        database.addChild(tablesFolder);
        if (getLevel() == DEFINITE_LEVEL) {
            tablesFolder.getChildren(monitor);
        }
    } else {
        if (tablesFolder.getLoader() != null && tablesFolder.getLoader().isLoaded()) {
            tablesFolder.getLoader().setLoaded(false);
            tablesFolder.getChildren(monitor);
        }
    }
}
Also used : ICubridNodeLoader(com.cubrid.common.ui.spi.model.ICubridNodeLoader) CubridTablesFolderLoader(com.cubrid.common.ui.spi.model.loader.schema.CubridTablesFolderLoader) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode)

Example 75 with DefaultSchemaNode

use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.

the class CubridDatabaseLoader method addJobAutoFolder.

/**
	 * Add job auto folder
	 * 
	 * @param monitor the IProgressMonitor
	 * @param database the CubridDatabase
	 */
private void addJobAutoFolder(final IProgressMonitor monitor, CubridDatabase database) {
    String jobAutoFolderId = database.getId() + NODE_SEPARATOR + JOB_AUTO_FOLDER_ID;
    ICubridNode jobAutoFolder = database.getChild(jobAutoFolderId);
    if (jobAutoFolder == null) {
        jobAutoFolder = new DefaultSchemaNode(jobAutoFolderId, JOB_AUTO_FOLDER_NAME, "icons/navigator/auto_group.png");
        jobAutoFolder.setType(CubridNodeType.JOB_FOLDER);
        jobAutoFolder.setContainer(true);
        ICubridNodeLoader loader = new CubridJobAutoFolderLoader();
        loader.setLevel(getLevel());
        jobAutoFolder.setLoader(loader);
        database.addChild(jobAutoFolder);
        if (getLevel() == DEFINITE_LEVEL) {
            jobAutoFolder.getChildren(monitor);
        }
    } else {
        if (jobAutoFolder.getLoader() != null && jobAutoFolder.getLoader().isLoaded()) {
            jobAutoFolder.getLoader().setLoaded(false);
            jobAutoFolder.getChildren(monitor);
        }
    }
}
Also used : ICubridNodeLoader(com.cubrid.common.ui.spi.model.ICubridNodeLoader) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode) CubridJobAutoFolderLoader(com.cubrid.cubridmanager.ui.spi.model.loader.jobauto.CubridJobAutoFolderLoader)

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