Search in sources :

Example 46 with HostNode

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

the class EditMonitorDashboardAction method run.

/**
	 * Open the selected monitoring dash board
	 */
public void run() {
    Object[] objArr = this.getSelectedObj();
    if (objArr == null || objArr.length <= 0) {
        setEnabled(false);
        return;
    }
    ICubridNode node = (ICubridNode) objArr[0];
    Dashboard dashboard = (Dashboard) node.getAdapter(Dashboard.class);
    if (dashboard == null) {
        return;
    }
    AddDashboardDialog dialog = new AddDashboardDialog(getShell());
    dialog.setDashboard(dashboard);
    int returnCode = dialog.open();
    if (returnCode == IDialogConstants.OK_ID) {
        node.setId(dashboard.getName());
        node.setLabel(dashboard.getName());
        MonitorDashboardPersistManager.getInstance().saveDashboard();
        ISelectionProvider provider = getSelectionProvider();
        if (provider instanceof TreeViewer) {
            TreeViewer treeViewer = (TreeViewer) provider;
            treeViewer.refresh(node, true);
        }
        IEditorPart part = LayoutUtil.getEditorPart(node, node.getEditorId());
        if (part instanceof MonitorDashboardEditor) {
            ((MonitorDashboardEditor) part).changePartName(dashboard.getName());
        }
    } else {
        for (int i = 0; i < dashboard.getHostNodeList().size(); i++) {
            HostNode hostNode = dashboard.getHostNodeList().get(i);
            hostNode.getCopyedHaNodeList().clear();
            hostNode.getCopyedHaNodeList().addAll(hostNode.getDbNodeList());
            hostNode.getCopyedHaNodeList().addAll(hostNode.getBrokerNodeList());
        }
    }
}
Also used : AddDashboardDialog(com.cubrid.cubridmanager.ui.mondashboard.dialog.AddDashboardDialog) ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) TreeViewer(org.eclipse.jface.viewers.TreeViewer) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) MonitorDashboardEditor(com.cubrid.cubridmanager.ui.mondashboard.editor.MonitorDashboardEditor) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) IEditorPart(org.eclipse.ui.IEditorPart)

Example 47 with HostNode

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

the class HARoleChangeAction method isSupported.

/**
	 * node should be active node.
	 * 
	 * @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java.lang.Object)
	 * @param obj Object
	 * @return is supported.
	 */
public boolean isSupported(Object obj) {
    if (obj instanceof HostMonitorPart) {
        HostMonitorPart dbPart = (HostMonitorPart) obj;
        HostNode dbNode = (HostNode) dbPart.getModel();
        return dbNode.getHostStatusInfo() != null && dbNode.getHostStatusInfo().getStatusType() == HostStatusType.MASTER;
    }
    return false;
}
Also used : HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) HostMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart)

Example 48 with HostNode

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

the class HideHostAction 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();
    while (iterator.hasNext()) {
        Object objSelected = iterator.next();
        if (objSelected instanceof HostMonitorPart) {
            HostMonitorPart cmp = (HostMonitorPart) objSelected;
            HostNode hn = (HostNode) cmp.getModel();
            hn.setVisible(false);
            cmp.getParent().refresh();
        }
    }
}
Also used : HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) HostMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart)

Example 49 with HostNode

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

the class HostDashboardHistoryAction method run.

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

Example 50 with HostNode

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

the class OpenApplyLogDBLogAction 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) {
    if (obj instanceof DatabaseMonitorPart) {
        DatabaseMonitorPart dbMonPart = (DatabaseMonitorPart) obj;
        DatabaseNode dbNode = (DatabaseNode) dbMonPart.getModel();
        HostNode hostNode = dbNode.getParent();
        if (hostNode != null && hostNode.isConnected() && (dbNode.getDbStatusType() == DBStatusType.STANDBY || dbNode.getDbStatusType() == DBStatusType.MAINTENANCE) && hostNode.getHostStatusInfo() != null && hostNode.getHostStatusInfo().getMasterHostStatusInfo() != null) {
            return true;
        }
    }
    return false;
}
Also used : DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) DatabaseMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)

Aggregations

HostNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)57 DatabaseNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode)20 BrokerNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode)12 HostMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart)10 DatabaseMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)9 Dashboard (com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard)8 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)7 ArrayList (java.util.ArrayList)6 Point (org.eclipse.draw2d.geometry.Point)6 CMWizardDialog (com.cubrid.common.ui.spi.dialog.CMWizardDialog)4 AddHostAndDbWizard (com.cubrid.cubridmanager.ui.mondashboard.dialog.wizard.AddHostAndDbWizard)4 DataProvider (com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.DataProvider)4 IViewPart (org.eclipse.ui.IViewPart)4 IViewReference (org.eclipse.ui.IViewReference)4 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)4 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)4 PartInitException (org.eclipse.ui.PartInitException)4 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)3 ServerType (com.cubrid.cubridmanager.core.common.model.ServerType)3 HAHostStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo)3