Search in sources :

Example 6 with BrokerMonitorPart

use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart in project cubrid-manager by CUBRID.

the class ShowBrokerClientAction method run.

/**
	 * Create a new figure in dashboard.
	 * 
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    IStructuredSelection selection = (IStructuredSelection) getSelection();
    BrokerMonitorPart cmp = (BrokerMonitorPart) selection.getFirstElement();
    DashboardPart dp = (DashboardPart) cmp.getParent();
    Dashboard db = (Dashboard) dp.getModel();
    BrokerNode model = (BrokerNode) cmp.getModel();
    ClientNode clientNode = db.getClientNodeByBroker(model);
    if (this.isChecked()) {
        if (null == clientNode) {
            clientNode = new ClientNode();
            clientNode.setBrokerNode(model);
            db.addClientNode(clientNode);
        }
        clientNode.setVisible(true);
    } else {
        clientNode.setVisible(false);
    }
    db.refresh();
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) BrokerMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart) DashboardPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart) ClientNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 7 with BrokerMonitorPart

use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart in project cubrid-manager by CUBRID.

the class ShowBrokerClientAction method isSupported.

/**
	 * Always support
	 * 
	 * @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java.lang.Object)
	 * @param obj Object
	 * @return boolean support:true;not support:false;
	 */
public boolean isSupported(Object obj) {
    IStructuredSelection selection = (IStructuredSelection) getSelection();
    if (!(selection.getFirstElement() instanceof BrokerMonitorPart)) {
        return false;
    }
    BrokerMonitorPart cmp = (BrokerMonitorPart) selection.getFirstElement();
    DashboardPart dp = (DashboardPart) cmp.getParent();
    Dashboard db = (Dashboard) dp.getModel();
    BrokerNode model = (BrokerNode) cmp.getModel();
    ClientNode clientNode = db.getClientNodeByBroker(model);
    setChecked(null != clientNode && clientNode.isVisible());
    return true;
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) BrokerMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart) DashboardPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart) ClientNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 8 with BrokerMonitorPart

use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart in project cubrid-manager by CUBRID.

the class ShowBrokerDabaseAction method run.

/**
	 * Create a new figure in dashboard.
	 * 
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    IStructuredSelection selection = (IStructuredSelection) getSelection();
    BrokerMonitorPart cmp = (BrokerMonitorPart) selection.getFirstElement();
    DashboardPart dp = (DashboardPart) cmp.getParent();
    Dashboard db = (Dashboard) dp.getModel();
    BrokerNode model = (BrokerNode) cmp.getModel();
    BrokerDBListNode brokerDBListNode = db.getBrokerDBListNodeByBroker(model);
    if (isChecked()) {
        if (null == brokerDBListNode) {
            brokerDBListNode = new BrokerDBListNode();
            brokerDBListNode.setBrokerNode(model);
            db.addBrokerDBListNode(brokerDBListNode);
        }
        brokerDBListNode.setVisible(true);
    } else {
        brokerDBListNode.setVisible(false);
    }
    db.refresh();
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) BrokerMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart) DashboardPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart) BrokerDBListNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerDBListNode) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 9 with BrokerMonitorPart

use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart in project cubrid-manager by CUBRID.

the class ShowBrokerDabaseAction method isSupported.

/**
	 * Always support
	 * 
	 * @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java.lang.Object)
	 * @param obj Object
	 * @return boolean support:true;not support:false;
	 */
public boolean isSupported(Object obj) {
    IStructuredSelection selection = (IStructuredSelection) getSelection();
    if (!(selection.getFirstElement() instanceof BrokerMonitorPart)) {
        return false;
    }
    BrokerMonitorPart cmp = (BrokerMonitorPart) selection.getFirstElement();
    DashboardPart dp = (DashboardPart) cmp.getParent();
    Dashboard db = (Dashboard) dp.getModel();
    BrokerNode model = (BrokerNode) cmp.getModel();
    BrokerDBListNode brokerDBListNode = db.getBrokerDBListNodeByBroker(model);
    setChecked(null != brokerDBListNode && brokerDBListNode.isVisible());
    return true;
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) BrokerMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart) DashboardPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart) BrokerDBListNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerDBListNode) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 10 with BrokerMonitorPart

use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart in project cubrid-manager by CUBRID.

the class ShowHostAction method isSupported.

/**
	 * Always support
	 * 
	 * @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java.lang.Object)
	 * @param obj Object
	 * @return boolean support:true;not support:false;
	 */
public boolean isSupported(Object obj) {
    IStructuredSelection selection = (IStructuredSelection) getSelection();
    Iterator<?> iterator = selection.iterator();
    boolean isVisible = true;
    while (iterator.hasNext()) {
        Object objSelected = iterator.next();
        if (objSelected instanceof DatabaseMonitorPart) {
            DatabaseMonitorPart cmp = (DatabaseMonitorPart) objSelected;
            DatabaseNode dn = ((DatabaseNode) cmp.getModel());
            if (!dn.getParent().isVisible()) {
                isVisible = false;
                break;
            }
        } else if (objSelected instanceof BrokerMonitorPart) {
            BrokerMonitorPart cmp = (BrokerMonitorPart) objSelected;
            BrokerNode bn = ((BrokerNode) cmp.getModel());
            if (!bn.getParent().isVisible()) {
                isVisible = false;
                break;
            }
        }
    }
    setChecked(isVisible);
    return true;
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) BrokerMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) DatabaseMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)

Aggregations

BrokerMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart)11 BrokerNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode)8 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)7 DatabaseMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)6 DashboardPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart)5 Dashboard (com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard)4 HostMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart)4 DatabaseNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode)3 BrokerDBListNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerDBListNode)2 ClientNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode)2 HostNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)2 BrokerDBListMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerDBListMonitorPart)2 ClientMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.ClientMonitorPart)2 HANode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANode)1 HANodePart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HANodePart)1 MonitorEditPartFacotry (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.MonitorEditPartFacotry)1 ArrayList (java.util.ArrayList)1 EditPart (org.eclipse.gef.EditPart)1 GraphicalViewer (org.eclipse.gef.GraphicalViewer)1 KeyHandler (org.eclipse.gef.KeyHandler)1