Search in sources :

Example 11 with HostMonitorPart

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

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

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

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

the class EditAliasNameAction method run.

/**
	 * Edit alias name
	 * 
	 * @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;
    }
    HANode haNode = null;
    if (objArr[0] instanceof HostMonitorPart) {
        HostMonitorPart hostMonPart = (HostMonitorPart) objArr[0];
        haNode = (HANode) hostMonPart.getModel();
    } else if (objArr[0] instanceof DatabaseMonitorPart) {
        DatabaseMonitorPart dbMonPart = (DatabaseMonitorPart) objArr[0];
        haNode = (HANode) dbMonPart.getModel();
    } else if (objArr[0] instanceof BrokerMonitorPart) {
        BrokerMonitorPart brokerMonPart = (BrokerMonitorPart) objArr[0];
        haNode = (HANode) brokerMonPart.getModel();
    } else if (objArr[0] instanceof ClientMonitorPart) {
        ClientMonitorPart clientMonitorPart = (ClientMonitorPart) objArr[0];
        haNode = (HANode) clientMonitorPart.getModel();
    } else if (objArr[0] instanceof BrokerDBListMonitorPart) {
        BrokerDBListMonitorPart brokerDBListMonitorPart = (BrokerDBListMonitorPart) objArr[0];
        haNode = (HANode) brokerDBListMonitorPart.getModel();
    }
    if (haNode == null) {
        return;
    }
    InputDialog dialog = new InputDialog(getShell(), Messages.titleEditNickNameDialog, Messages.msgEditNickNameDialog, haNode.getName(), new IInputValidator() {

        public String isValid(String newText) {
            if (newText == null || newText.trim().length() == 0) {
                return Messages.errEditNickName;
            }
            return null;
        }
    });
    if (IDialogConstants.OK_ID == dialog.open()) {
        String aliasName = dialog.getValue();
        haNode.setName(aliasName);
    }
}
Also used : BrokerDBListMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerDBListMonitorPart) InputDialog(org.eclipse.jface.dialogs.InputDialog) BrokerMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart) ClientMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.ClientMonitorPart) HostMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart) DatabaseMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart) HANode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANode) IInputValidator(org.eclipse.jface.dialogs.IInputValidator)

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