Search in sources :

Example 1 with BrokerDashboardViewPart

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

the class BrokerDataProvider method setDefaultValue.

/**
	 * 
	 * Set default value
	 * 
	 */
private void setDefaultValue() {
    isExecGetBrokerTask = false;
    errorMsg = "";
    if (brokerNodeList == null || brokerNodeList.isEmpty()) {
        return;
    }
    BrokerNode brokerNode = null;
    for (BrokerNode node : brokerNodeList) {
        if (node.getParent().isConnected()) {
            brokerNode = node;
            break;
        }
    }
    if (brokerNode == null) {
        return;
    }
    HostNode hostNode = brokerNode.getParent();
    if (hostNode != null && hostNode.isConnected()) {
        List<DataUpdateListener> listenerList = generator.getListeners();
        for (DataUpdateListener listener : listenerList) {
            if (listener instanceof BrokerMonitorPartHelper || listener instanceof BrokerDashboardViewPart) {
                isExecGetBrokerTask = true;
                break;
            }
        }
        serverInfo = hostNode.getServerInfo();
    }
    StringBuffer strBuff = new StringBuffer();
    for (BrokerNode node : brokerNodeList) {
        strBuff.append(node.getBrokerName());
        strBuff.append(",");
    }
    strBuff = strBuff.deleteCharAt(strBuff.length() - 1);
    allBrokersStr = strBuff.toString();
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) BrokerDashboardViewPart(com.cubrid.cubridmanager.ui.mondashboard.editor.BrokerDashboardViewPart) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) BrokerMonitorPartHelper(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.helper.BrokerMonitorPartHelper)

Example 2 with BrokerDashboardViewPart

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

the class BrokerMonitorPart method performRequest.

/**
	 * @see org.eclipse.gef.editparts.AbstractEditPart#performRequest(org.eclipse.gef.Request)
	 * @param req Request
	 */
public void performRequest(Request req) {
    if (req.getType() == RequestConstants.REQ_OPEN) {
        BrokerNode bn = (BrokerNode) getModel();
        String brokerName = bn.getBrokerName();
        HostNode hn = bn.getParent();
        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        if (window == null) {
            return;
        }
        IWorkbenchPage page = window.getActivePage();
        if (page == null) {
            return;
        }
        String secondaryId = new StringBuffer(brokerName + "@" + hn.getUserName()).append("&").append(hn.getIp()).append("&").append(hn.getPort()).toString();
        IViewReference viewReference = page.findViewReference(BrokerDashboardViewPart.ID, secondaryId);
        if (viewReference == null) {
            try {
                IViewPart viewPart = page.showView(BrokerDashboardViewPart.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
                ((BrokerDashboardViewPart) viewPart).init((BrokerNode) getModel());
            } catch (PartInitException ex) {
                viewReference = null;
            }
        } else {
            IViewPart viewPart = viewReference.getView(false);
            window.getActivePage().bringToTop(viewPart);
            ((BrokerDashboardViewPart) viewPart).init((BrokerNode) getModel());
        }
    }
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IViewPart(org.eclipse.ui.IViewPart) BrokerDashboardViewPart(com.cubrid.cubridmanager.ui.mondashboard.editor.BrokerDashboardViewPart) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) IViewReference(org.eclipse.ui.IViewReference) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException)

Aggregations

BrokerDashboardViewPart (com.cubrid.cubridmanager.ui.mondashboard.editor.BrokerDashboardViewPart)2 BrokerNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode)2 HostNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)2 BrokerMonitorPartHelper (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.helper.BrokerMonitorPartHelper)1 IViewPart (org.eclipse.ui.IViewPart)1 IViewReference (org.eclipse.ui.IViewReference)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 PartInitException (org.eclipse.ui.PartInitException)1