Search in sources :

Example 1 with Dashboard

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

use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard 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 3 with Dashboard

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

the class MonitorDashboardEditor method initializeGraphicalViewer.

/**
	 * initialize viewer
	 * 
	 * @see org.eclipse.gef.ui.parts.GraphicalEditor.initializeGraphicalViewer
	 */
protected void initializeGraphicalViewer() {
    IEditorInput input = this.getEditorInput();
    if (input instanceof ICubridNode) {
        ICubridNode node = (ICubridNode) input;
        Dashboard dashboard = (Dashboard) node.getAdapter(Dashboard.class);
        getGraphicalViewer().setContents(dashboard);
        dashboard.refresh();
    }
}
Also used : Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) IEditorInput(org.eclipse.ui.IEditorInput)

Example 4 with Dashboard

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

the class BrokerDBListMonitorPart method refreshVisuals.

/**
	 * Refreshes this EditPart's <i>visuals</i>. This method is called by
	 * {@link #refresh()}, and may also be called in response to notifications
	 * from the model.
	 */
protected void refreshVisuals() {
    BrokerDBListFigure figure = (BrokerDBListFigure) this.getFigure();
    BrokerDBListNode dn = (BrokerDBListNode) this.getModel();
    figure.setName(dn.getName());
    //Remove defined dabatases.
    List<String> dbList = new ArrayList<String>();
    dbList.addAll(dn.getDbList());
    Dashboard dashboard = (Dashboard) getParent().getModel();
    for (DatabaseNode dbNode : dashboard.getAllDatabaseNode()) {
        String dbName = dbNode.getDbName() + "@" + dbNode.getParent().getIp();
        if (dn.getDbList().contains(dbName)) {
            dbList.remove(dbName);
        }
    }
    figure.setDBList(dbList);
    BrokerNode broker = dn.getBrokerNode();
    figure.setHostConnected(broker.getParent().isConnected());
    super.refreshVisuals();
}
Also used : BrokerDBListFigure(com.cubrid.cubridmanager.ui.mondashboard.editor.figure.BrokerDBListFigure) BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) BrokerDBListNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerDBListNode) ArrayList(java.util.ArrayList) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard)

Example 5 with Dashboard

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

the class DashboardPart method refreshVisuals.

/**
	 * refresh Visuals
	 */
protected void refreshVisuals() {
    Dashboard model = (Dashboard) getModel();
    model.getConnectionManager().refreshConnections();
    super.refreshVisuals();
}
Also used : Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard)

Aggregations

Dashboard (com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard)16 HostNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)8 BrokerNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode)7 DashboardPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart)6 BrokerDBListNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerDBListNode)5 ClientNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode)4 BrokerMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 CMWizardDialog (com.cubrid.common.ui.spi.dialog.CMWizardDialog)3 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)3 AddHostAndDbWizard (com.cubrid.cubridmanager.ui.mondashboard.dialog.wizard.AddHostAndDbWizard)3 DatabaseNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode)3 HostMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart)3 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)2 IXMLMemento (com.cubrid.cubridmanager.core.common.xml.IXMLMemento)2 AddDashboardDialog (com.cubrid.cubridmanager.ui.mondashboard.dialog.AddDashboardDialog)2 Point (org.eclipse.draw2d.geometry.Point)2 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)1