Search in sources :

Example 1 with DatabaseMonitorPart

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

the class ShowHostAction method run.

/**
	 * Create a new figure in dashboard.
	 * 
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    IStructuredSelection selection = (IStructuredSelection) getSelection();
    Iterator<?> iterator = selection.iterator();
    List<HostNode> hosts = new ArrayList<HostNode>();
    EditPart root = null;
    while (iterator.hasNext()) {
        Object objSelected = iterator.next();
        if (objSelected instanceof DatabaseMonitorPart) {
            DatabaseMonitorPart cmp = (DatabaseMonitorPart) objSelected;
            DatabaseNode dn = ((DatabaseNode) cmp.getModel());
            if (!hosts.contains(dn.getParent())) {
                hosts.add(dn.getParent());
            }
            root = cmp.getParent();
        } else if (objSelected instanceof BrokerMonitorPart) {
            BrokerMonitorPart cmp = (BrokerMonitorPart) objSelected;
            BrokerNode bn = ((BrokerNode) cmp.getModel());
            if (!hosts.contains(bn.getParent())) {
                hosts.add(bn.getParent());
            }
            root = cmp.getParent();
        }
    }
    for (HostNode host : hosts) {
        if (host.isVisible() == isChecked()) {
            continue;
        }
        host.setVisible(isChecked());
    }
    if (root != null) {
        root.refresh();
    }
}
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) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) ArrayList(java.util.ArrayList) EditPart(org.eclipse.gef.EditPart) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) DatabaseMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)

Example 2 with DatabaseMonitorPart

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

the class DbDashboardHistoryAction method run.

/**
	 * Open monitor host detail windows.
	 */
public void run() {
    if (getSelectedObj() == null || getSelectedObj().length == 0) {
        return;
    }
    Object obj = getSelectedObj()[0];
    if (!(obj instanceof DatabaseMonitorPart)) {
        return;
    }
    DatabaseMonitorPart part = (DatabaseMonitorPart) obj;
    DatabaseNode dn = (DatabaseNode) part.getModel();
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
        return;
    }
    IWorkbenchPage page = window.getActivePage();
    if (page == null) {
        return;
    }
    HostNode hn = dn.getParent();
    String secondaryId = new StringBuffer(dn.getDbName()).append("&").append(hn.getUserName()).append("&").append(hn.getIp()).append("&").append(hn.getPort()).toString();
    IViewReference viewReference = page.findViewReference(DbDashboardHistoryViewPart.ID, secondaryId);
    if (viewReference == null) {
        try {
            IViewPart viewPart = page.showView(DbDashboardHistoryViewPart.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
            ((DbDashboardHistoryViewPart) viewPart).init((DatabaseNode) part.getModel());
        } catch (PartInitException ex) {
            viewReference = null;
        }
    } else {
        IViewPart viewPart = viewReference.getView(false);
        window.getActivePage().bringToTop(viewPart);
        ((DbDashboardHistoryViewPart) viewPart).init((DatabaseNode) part.getModel());
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IViewPart(org.eclipse.ui.IViewPart) DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) IViewReference(org.eclipse.ui.IViewReference) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) DbDashboardHistoryViewPart(com.cubrid.cubridmanager.ui.mondashboard.editor.DbDashboardHistoryViewPart) PartInitException(org.eclipse.ui.PartInitException) DatabaseMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)

Example 3 with DatabaseMonitorPart

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

the class MonitorDetailAction method run.

/**
	 * Open monitor detail windows.
	 */
public void run() {
    Object[] objArr = this.getSelectedObj();
    if (objArr == null || objArr.length <= 0 || !isSupported(objArr[0])) {
        setEnabled(false);
        return;
    }
    HANodePart part = null;
    if (objArr[0] instanceof HostMonitorPart) {
        part = (HostMonitorPart) objArr[0];
    } else if (objArr[0] instanceof DatabaseMonitorPart) {
        part = (DatabaseMonitorPart) objArr[0];
    } else if (objArr[0] instanceof BrokerMonitorPart) {
        part = (BrokerMonitorPart) objArr[0];
    }
    if (part != null) {
        SelectionRequest sr = new SelectionRequest();
        sr.setType(RequestConstants.REQ_OPEN);
        part.performRequest(sr);
    }
}
Also used : BrokerMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart) SelectionRequest(org.eclipse.gef.requests.SelectionRequest) HostMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart) DatabaseMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart) HANodePart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HANodePart)

Example 4 with DatabaseMonitorPart

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

the class MonitorDetailAction method isSupported.

/**
	 * 
	 * 
	 * @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java.lang.Object)
	 * @param obj Object
	 * @return is supported.
	 */
public boolean isSupported(Object obj) {
    HostNode hostNode = null;
    if (obj instanceof HostMonitorPart) {
        hostNode = (HostNode) ((HostMonitorPart) obj).getModel();
    } else if (obj instanceof BrokerMonitorPart) {
        BrokerNode brokerNode = (BrokerNode) ((BrokerMonitorPart) obj).getModel();
        hostNode = brokerNode.getParent();
    }
    if (hostNode != null) {
        return hostNode.isConnected();
    }
    if (obj instanceof DatabaseMonitorPart) {
        DatabaseNode dbNode = (DatabaseNode) ((DatabaseMonitorPart) obj).getModel();
        hostNode = dbNode.getParent();
        return hostNode.isConnected() && dbNode.isConnected();
    }
    return false;
}
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) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) HostMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart) DatabaseMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)

Example 5 with DatabaseMonitorPart

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

the class OpenApplyLogDBLogAction method run.

/**
	 * open apply database log
	 * 
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    Object[] objArr = this.getSelectedObj();
    if (objArr == null || objArr.length <= 0 || !isSupported(objArr[0])) {
        setEnabled(false);
        return;
    }
    DatabaseMonitorPart dbMonPart = (DatabaseMonitorPart) objArr[0];
    DatabaseNode dbNode = (DatabaseNode) dbMonPart.getModel();
    HostNode hostNode = dbNode.getParent();
    ServerInfo serverInfo = hostNode.getServerInfo();
    CubridServer server = new CubridServer(serverInfo.getHostAddress(), serverInfo.getHostAddress(), null, null);
    server.setServerInfo(serverInfo);
    LogInfo logInfo = new LogInfo();
    String logPath = serverInfo.getEnvInfo().getRootDir() + serverInfo.getPathSeparator() + "log" + serverInfo.getPathSeparator();
    String fileName = dbNode.getDbName() + "@localhost_applylogdb_" + dbNode.getDbName() + "_" + hostNode.getHostStatusInfo().getMasterHostStatusInfo().getHostName() + ".err";
    logInfo.setPath(logPath + fileName);
    DefaultCubridNode dbLogInfoNode = new DefaultCubridNode(dbNode.getDbName() + ICubridNodeLoader.NODE_SEPARATOR + "apply_database_log", logInfo.getName(), "icons/navigator/log_item.png");
    dbLogInfoNode.setType(CubridNodeType.LOGS_APPLY_DATABASE_LOG);
    dbLogInfoNode.setModelObj(logInfo);
    dbLogInfoNode.setEditorId(LogEditorPart.ID);
    dbLogInfoNode.setContainer(false);
    dbLogInfoNode.setServer(server);
    LogViewAction action = (LogViewAction) ActionManager.getInstance().getAction(LogViewAction.ID);
    action.setCubridNode(dbLogInfoNode);
    action.run();
}
Also used : LogViewAction(com.cubrid.cubridmanager.ui.logs.action.LogViewAction) DefaultCubridNode(com.cubrid.common.ui.spi.model.DefaultCubridNode) DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) LogInfo(com.cubrid.cubridmanager.core.logs.model.LogInfo) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) DatabaseMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart) CubridServer(com.cubrid.common.ui.spi.model.CubridServer)

Aggregations

DatabaseMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)14 DatabaseNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode)11 HostNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)9 BrokerMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart)6 HostMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)3 BrokerNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode)3 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)2 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)2 LogInfo (com.cubrid.cubridmanager.core.logs.model.LogInfo)2 LogViewAction (com.cubrid.cubridmanager.ui.logs.action.LogViewAction)2 BrokerDBListMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerDBListMonitorPart)2 ClientMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.ClientMonitorPart)2 DatabaseLogListDialog (com.cubrid.cubridmanager.ui.mondashboard.dialog.DatabaseLogListDialog)1 DbDashboardHistoryViewPart (com.cubrid.cubridmanager.ui.mondashboard.editor.DbDashboardHistoryViewPart)1 HANode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANode)1 DashboardPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart)1 HANodePart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HANodePart)1 MonitorEditPartFacotry (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.MonitorEditPartFacotry)1