Search in sources :

Example 1 with HostMonitorPart

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

the class AddDatabaseMonitorAction method run.

/**
	 * open add database monitor dialog.
	 * 
	 * @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;
    }
    HostMonitorPart hostMonPart = (HostMonitorPart) objArr[0];
    HostNode hostNode = (HostNode) hostMonPart.getModel();
    Dashboard dashboard = (Dashboard) hostMonPart.getParent().getModel();
    if (hostNode != null && dashboard != null) {
        AddHostAndDbWizard wizard = new AddHostAndDbWizard(hostNode, dashboard.getHostNodeList(), 1);
        CMWizardDialog dialog = new CMWizardDialog(getShell(), wizard);
        dialog.setPageSize(660, 380);
        int returnCode = dialog.open();
        if (returnCode == IDialogConstants.OK_ID) {
            List<HostNode> addedHostNodeList = wizard.getAddedHostNodeList();
            HAUtil.mergeHostNode(dashboard, addedHostNodeList);
            HAUtil.calcLocation(dashboard.getHostNodeList());
        }
    }
}
Also used : HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) AddHostAndDbWizard(com.cubrid.cubridmanager.ui.mondashboard.dialog.wizard.AddHostAndDbWizard) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) HostMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart) CMWizardDialog(com.cubrid.common.ui.spi.dialog.CMWizardDialog)

Example 2 with HostMonitorPart

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

the class AddDatabaseMonitorAction method isSupported.

/**
	 * selection is Host node host is connected
	 * 
	 * @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) {
    if (obj instanceof HostMonitorPart) {
        HostMonitorPart hostMonPart = (HostMonitorPart) obj;
        HostNode hostNode = (HostNode) hostMonPart.getModel();
        if (hostNode == null || hostNode.getServerInfo() == null || hostNode.getServerInfo().getLoginedUserInfo() == null) {
            return false;
        }
        ServerType type = hostNode.getServerInfo().getServerType();
        return type == ServerType.BOTH || type == ServerType.DATABASE;
    }
    return false;
}
Also used : ServerType(com.cubrid.cubridmanager.core.common.model.ServerType) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) HostMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart)

Example 3 with HostMonitorPart

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

the class DeleteHostMonitorAction method run.

/**
	 * Delete host and it's databases from dashboard.
	 */
public void run() {
    if (getSelectedObj() == null || getSelectedObj().length == 0) {
        return;
    }
    HostMonitorPart part = (HostMonitorPart) getSelectedObj()[0];
    DashboardPart dashboardPart = (DashboardPart) part.getParent();
    Dashboard dashboard = (Dashboard) dashboardPart.getModel();
    HostNode hn = (HostNode) part.getModel();
    boolean isDelete = CommonUITool.openConfirmBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.bind(Messages.msgConfirmDeleteHost, hn.getName()));
    if (!isDelete) {
        return;
    }
    dashboard.removeNode(hn);
}
Also used : DashboardPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) HostMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart)

Example 4 with HostMonitorPart

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

the class HideHostAction 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) {
    if (obj instanceof HostMonitorPart) {
        HostMonitorPart hp = (HostMonitorPart) obj;
        HostNode hn = (HostNode) hp.getModel();
        if (hn.getDbNodeList().isEmpty() && hn.getBrokerNodeList().isEmpty()) {
            return false;
        }
    }
    return true;
}
Also used : HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) HostMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart)

Example 5 with HostMonitorPart

use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart 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)

Aggregations

HostMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart)14 HostNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)10 BrokerMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart)4 DatabaseMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)4 Dashboard (com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard)3 CMWizardDialog (com.cubrid.common.ui.spi.dialog.CMWizardDialog)2 ServerType (com.cubrid.cubridmanager.core.common.model.ServerType)2 AddHostAndDbWizard (com.cubrid.cubridmanager.ui.mondashboard.dialog.wizard.AddHostAndDbWizard)2 BrokerDBListMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerDBListMonitorPart)2 ClientMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.ClientMonitorPart)2 DashboardPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)1 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)1 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)1 HARoleChangeTask (com.cubrid.cubridmanager.core.mondashboard.task.HARoleChangeTask)1 HostDashboardHistoryViewPart (com.cubrid.cubridmanager.ui.mondashboard.editor.HostDashboardHistoryViewPart)1 BrokerNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode)1 DatabaseNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode)1 HANode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANode)1