Search in sources :

Example 11 with DatabaseMonitorPart

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

the class OpenDatabaseLogAction method isSupported.

/**
	 * only support database monitor and database must be connected.
	 * 
	 * @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java.lang.Object)
	 * @param obj Object must be DatabaseMonitorPart
	 * @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.getServerInfo() != null && hostNode.getServerInfo().isConnected()) {
            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)

Example 12 with DatabaseMonitorPart

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

the class OpenDatabaseLogAction method run.

/**
	 * open 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();
    String dbName = dbNode.getDbName();
    HostNode hostNode = dbNode.getParent();
    ServerInfo serverInfo = hostNode.getServerInfo();
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    DatabaseLogListDialog dialog = new DatabaseLogListDialog(shell, dbName, serverInfo);
    dialog.open();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) DatabaseLogListDialog(com.cubrid.cubridmanager.ui.mondashboard.dialog.DatabaseLogListDialog) DatabaseMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)

Example 13 with DatabaseMonitorPart

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

the class DeleteDatabaseMonitorAction method run.

/**
	 * delete database monitor from dashboard.
	 */
public void run() {
    IStructuredSelection selection = (IStructuredSelection) getSelection();
    DatabaseMonitorPart dmp = (DatabaseMonitorPart) selection.getFirstElement();
    //EditPart dashboardPart = dmp.getParent();
    DatabaseNode dn = (DatabaseNode) dmp.getModel();
    boolean isDelete = CommonUITool.openConfirmBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.bind(Messages.msgConfirmDeleteDatabase, dn.getName()));
    if (!isDelete) {
        return;
    }
    dn.getParent().removeDbNode(dn);
//dashboardPart.refresh();
}
Also used : DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) DatabaseMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)

Example 14 with DatabaseMonitorPart

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

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