Search in sources :

Example 56 with ICubridNode

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());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) QueryPlanInfoHelp(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfoHelp) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) QueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo)

Example 57 with ICubridNode

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);
            }
        }
    }
}
Also used : CubridNavigatorView(com.cubrid.common.ui.common.navigator.CubridNavigatorView) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) HashSet(java.util.HashSet)

Example 58 with ICubridNode

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);
    }
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) QueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode) HashSet(java.util.HashSet) EditQueryPlanAction(com.cubrid.cubridmanager.ui.cubrid.jobauto.action.EditQueryPlanAction)

Example 59 with ICubridNode

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);
}
Also used : CubridNavigatorView(com.cubrid.common.ui.common.navigator.CubridNavigatorView) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode) PartInitException(org.eclipse.ui.PartInitException) HashSet(java.util.HashSet)

Example 60 with ICubridNode

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

Aggregations

ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)362 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)67 ArrayList (java.util.ArrayList)67 DefaultSchemaNode (com.cubrid.common.ui.spi.model.DefaultSchemaNode)62 TreeViewer (org.eclipse.jface.viewers.TreeViewer)62 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)55 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)55 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)41 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)40 ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)33 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)32 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)31 ICubridNodeLoader (com.cubrid.common.ui.spi.model.ICubridNodeLoader)27 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)26 CubridGroupNode (com.cubrid.common.ui.spi.model.CubridGroupNode)25 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)25 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)25 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)25 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)23 CubridNavigatorView (com.cubrid.common.ui.common.navigator.CubridNavigatorView)22