Search in sources :

Example 21 with ISchemaNode

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

the class DeleteQueryPlanAction method isSupported.

/**
	 * Sets this action support this object
	 * 
	 * @see org.eclipse.jface.action.IAction.ISelectionAction
	 * @param obj Object
	 * @return boolean
	 */
public boolean isSupported(Object obj) {
    if (obj instanceof ISchemaNode) {
        ISchemaNode node = (ISchemaNode) obj;
        CubridDatabase database = node.getDatabase();
        if (CubridNodeType.QUERY_PLAN.equals(node.getType()) && database != null && database.isLogined()) {
            DbUserInfo dbUserInfo = database.getDatabaseInfo().getAuthLoginedDbUserInfo();
            if (dbUserInfo != null && dbUserInfo.isDbaAuthority()) {
                return true;
            }
        }
    } else if (obj instanceof Object[]) {
        Object[] objArr = (Object[]) obj;
        CubridDatabase database = null;
        for (Object object : objArr) {
            DefaultSchemaNode node = (DefaultSchemaNode) object;
            CubridDatabase db = node.getDatabase();
            if (database == null) {
                database = db;
            } else if (!database.getId().equals(db.getId())) {
                return false;
            }
        }
        return true;
    }
    return false;
}
Also used : DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode)

Example 22 with ISchemaNode

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

the class VolumeFolderInfoEditor method nodeChanged.

/**
	 *
	 * @see com.cubrid.common.ui.spi.event.ICubridNodeChangedListener#nodeChanged(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)
	 * @param event the CubridNodeChangedEvent object
	 */
public void nodeChanged(CubridNodeChangedEvent event) {
    ICubridNode eventNode = event.getCubridNode();
    if (!(eventNode instanceof ISchemaNode) || event.getType() != CubridNodeChangedEventType.CONTAINER_NODE_REFRESH || cubridNode == null) {
        return;
    }
    if (!CubridNodeType.DBSPACE_FOLDER.equals(eventNode.getType())) {
        return;
    }
    ISchemaNode eventSchemaNode = (ISchemaNode) eventNode;
    ISchemaNode schemaNode = (ISchemaNode) cubridNode;
    if (!eventSchemaNode.getDatabase().getId().equals(schemaNode.getDatabase().getId())) {
        return;
    }
    synchronized (this) {
        if (database.getDatabaseInfo().getDbSpaceInfoList() == null) {
            loadData();
        }
    }
}
Also used : ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode)

Example 23 with ISchemaNode

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

the class StartRetargetAction method run.

/**
	 * start database or broker
	 */
public void run() {
    final Object[] obj = this.getSelectedObj();
    if (!isSupported(obj[0])) {
        return;
    }
    ICubridNode node = (ICubridNode) obj[0];
    if (NodeType.SERVER.equals(node.getType())) {
        StartServiceAction startServiceAction = (StartServiceAction) ActionManager.getInstance().getAction(StartServiceAction.ID);
        startServiceAction.run();
    }
    if (node instanceof ISchemaNode) {
        StartDatabaseAction startDatabaseAction = (StartDatabaseAction) ActionManager.getInstance().getAction(StartDatabaseAction.ID);
        startDatabaseAction.run();
    }
    if (node instanceof CubridBroker) {
        StartBrokerAction startBrokerAction = (StartBrokerAction) ActionManager.getInstance().getAction(StartBrokerAction.ID);
        startBrokerAction.run();
    }
    if (node instanceof CubridBrokerFolder) {
        StartBrokerEnvAction startBrokerEnvAction = (StartBrokerEnvAction) ActionManager.getInstance().getAction(StartBrokerEnvAction.ID);
        startBrokerEnvAction.run();
    }
}
Also used : StartBrokerEnvAction(com.cubrid.cubridmanager.ui.broker.action.StartBrokerEnvAction) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) StartBrokerAction(com.cubrid.cubridmanager.ui.broker.action.StartBrokerAction) CubridBroker(com.cubrid.cubridmanager.ui.spi.model.CubridBroker) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) StartDatabaseAction(com.cubrid.cubridmanager.ui.cubrid.database.action.StartDatabaseAction) CubridBrokerFolder(com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder)

Example 24 with ISchemaNode

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

the class StopRetargetAction method run.

/**
	 * stop database or broker
	 */
public void run() {
    final Object[] obj = this.getSelectedObj();
    if (!isSupported(obj[0])) {
        return;
    }
    ICubridNode node = (ICubridNode) obj[0];
    if (NodeType.SERVER.equals(node.getType())) {
        StopServiceAction stopServiceAction = (StopServiceAction) ActionManager.getInstance().getAction(StopServiceAction.ID);
        stopServiceAction.run();
    }
    if (node instanceof ISchemaNode) {
        StopDatabaseAction stopDatabaseAction = (StopDatabaseAction) ActionManager.getInstance().getAction(StopDatabaseAction.ID);
        stopDatabaseAction.run();
    }
    if (node instanceof CubridBroker) {
        StopBrokerAction stopBrokerAction = (StopBrokerAction) ActionManager.getInstance().getAction(StopBrokerAction.ID);
        stopBrokerAction.run();
    }
    if (node instanceof CubridBrokerFolder) {
        StopBrokerEnvAction stopBrokerEnvAction = (StopBrokerEnvAction) ActionManager.getInstance().getAction(StopBrokerEnvAction.ID);
        stopBrokerEnvAction.run();
    }
}
Also used : StopBrokerEnvAction(com.cubrid.cubridmanager.ui.broker.action.StopBrokerEnvAction) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) StopDatabaseAction(com.cubrid.cubridmanager.ui.cubrid.database.action.StopDatabaseAction) CubridBroker(com.cubrid.cubridmanager.ui.spi.model.CubridBroker) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridBrokerFolder(com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder) StopBrokerAction(com.cubrid.cubridmanager.ui.broker.action.StopBrokerAction)

Example 25 with ISchemaNode

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

the class JobAutoDashboardEditorPart method deleteQueryPlan.

public void deleteQueryPlan() {
    TableItem[] items = queryPlanInfoTable.getTable().getSelection();
    if (items.length > 0) {
        List<ISchemaNode> selectNodeList = new ArrayList<ISchemaNode>();
        for (TableItem item : items) {
            QueryPlanInfo queryPlanInfo = (QueryPlanInfo) item.getData();
            Set<String> typeSet = new HashSet<String>();
            typeSet.add(CubridNodeType.QUERY_PLAN);
            ICubridNode queryPlanNode = CommonUITool.findNode(database, typeSet, queryPlanInfo.getQuery_id());
            selectNodeList.add((ISchemaNode) queryPlanNode);
        }
        if (selectNodeList.size() > 0) {
            DeleteQueryPlanAction action = (DeleteQueryPlanAction) ActionManager.getInstance().getAction(DeleteQueryPlanAction.ID);
            ISchemaNode[] nodeArr = new ISchemaNode[selectNodeList.size()];
            action.run(selectNodeList.toArray(nodeArr));
            refreshQueryPlan();
        }
    } else {
        CommonUITool.openWarningBox(Messages.errJobAutoNoSelection);
    }
}
Also used : ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) TableItem(org.eclipse.swt.widgets.TableItem) ArrayList(java.util.ArrayList) DeleteQueryPlanAction(com.cubrid.cubridmanager.ui.cubrid.jobauto.action.DeleteQueryPlanAction) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) QueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo) HashSet(java.util.HashSet)

Aggregations

ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)158 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)104 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)55 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)30 ArrayList (java.util.ArrayList)28 TreeViewer (org.eclipse.jface.viewers.TreeViewer)27 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)23 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)23 DefaultSchemaNode (com.cubrid.common.ui.spi.model.DefaultSchemaNode)22 DbUserInfo (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo)22 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)21 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)21 Shell (org.eclipse.swt.widgets.Shell)16 ITask (com.cubrid.common.core.task.ITask)13 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)13 IEditorPart (org.eclipse.ui.IEditorPart)12 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)12 HashSet (java.util.HashSet)11 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)11 PartInitException (org.eclipse.ui.PartInitException)10