Search in sources :

Example 31 with HostNode

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

the class DatabaseDashboardViewPart method init.

/**
	 * Initializes
	 *
	 * @param dbNode The DatabaseNode
	 */
public void init(DatabaseNode dbNode) {
    this.dbNode = dbNode;
    HostNode hostNode = dbNode.getParent();
    String partName = getPartName();
    String suffix = " - " + dbNode.getDbName() + "@" + hostNode.getIp() + ":" + hostNode.getPort();
    if (!partName.endsWith(suffix)) {
        setPartName(partName + suffix);
    }
    ServerInfo serverInfo = hostNode.getServerInfo();
    if (serverInfo != null) {
        String hostAddress = serverInfo.getHostAddress();
        int monPort = serverInfo.getHostMonPort();
        historyFileName = HistoryComposite.DBDASHBOARD_HISTORY_FILE_PREFIX + dbNode.getDbName() + "@" + hostAddress + "_" + monPort + HistoryComposite.HISTORY_SUFFIX;
        IPath histPath = CubridManagerCorePlugin.getDefault().getStateLocation();
        historyPath = histPath.toOSString() + File.separator + historyFileName;
        historyFileHelp = new HistoryFileHelp();
        historyFileHelp.setHistoryPath(historyPath);
    }
    List<String> typeLst = new ArrayList<String>();
    for (DbProcStatEnum dbProcEnum : DbProcStatEnum.values()) {
        typeLst.add(dbProcEnum.getName());
    }
    for (StandbyServerStatEnum standbyEnum : StandbyServerStatEnum.values()) {
        typeLst.add(standbyEnum.getName());
    }
    for (DbStatDumpEnum dbDumpEnum : DbStatDumpEnum.values()) {
        typeLst.add(dbDumpEnum.getName());
    }
    typeNames = typeLst.toArray(new String[typeLst.size()]);
    DataGeneratorPool pool = DataGeneratorPool.getInstance();
    String generatorName = hostNode.getUserName() + "@" + hostNode.getIp() + ":" + hostNode.getPort();
    generator = pool.getDataGenerator(generatorName, new DataProvider());
    generator.addDataUpdateListener(this);
}
Also used : IPath(org.eclipse.core.runtime.IPath) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) StandbyServerStatEnum(com.cubrid.cubridmanager.core.monitoring.model.StandbyServerStatEnum) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) ArrayList(java.util.ArrayList) DataProvider(com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.DataProvider) DbStatDumpEnum(com.cubrid.cubridmanager.core.monitoring.model.DbStatDumpEnum) DbProcStatEnum(com.cubrid.cubridmanager.core.monitoring.model.DbProcStatEnum) DataGeneratorPool(com.cubrid.cubridmanager.ui.mondashboard.editor.dispatcher.DataGeneratorPool)

Example 32 with HostNode

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

the class DbDashboardHistoryViewPart method init.

/**
	 * Initializes
	 *
	 * @param dbNode The DatabaseNode
	 */
public void init(DatabaseNode dbNode) {
    HostNode hostNode = dbNode.getParent();
    String hostAddress = hostNode.getIp();
    String hostPort = hostNode.getPort();
    String partName = getPartName();
    String suffix = " - " + dbNode.getDbName() + "@" + hostAddress + ":" + hostPort;
    if (!partName.endsWith(suffix)) {
        setPartName(partName + suffix);
    }
    historyFileName = HistoryComposite.DBDASHBOARD_HISTORY_FILE_PREFIX + dbNode.getDbName() + "@" + hostAddress + "_" + hostPort + HistoryComposite.HISTORY_SUFFIX;
    IPath path = CubridManagerCorePlugin.getDefault().getStateLocation();
    historyPath = path.toOSString() + File.separator + historyFileName;
    historyFileHelp = new HistoryFileHelp();
    historyFileHelp.setHistoryPath(historyPath);
}
Also used : IPath(org.eclipse.core.runtime.IPath) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)

Example 33 with HostNode

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

the class BrokerMonitorPart method performRequest.

/**
	 * @see org.eclipse.gef.editparts.AbstractEditPart#performRequest(org.eclipse.gef.Request)
	 * @param req Request
	 */
public void performRequest(Request req) {
    if (req.getType() == RequestConstants.REQ_OPEN) {
        BrokerNode bn = (BrokerNode) getModel();
        String brokerName = bn.getBrokerName();
        HostNode hn = bn.getParent();
        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        if (window == null) {
            return;
        }
        IWorkbenchPage page = window.getActivePage();
        if (page == null) {
            return;
        }
        String secondaryId = new StringBuffer(brokerName + "@" + hn.getUserName()).append("&").append(hn.getIp()).append("&").append(hn.getPort()).toString();
        IViewReference viewReference = page.findViewReference(BrokerDashboardViewPart.ID, secondaryId);
        if (viewReference == null) {
            try {
                IViewPart viewPart = page.showView(BrokerDashboardViewPart.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
                ((BrokerDashboardViewPart) viewPart).init((BrokerNode) getModel());
            } catch (PartInitException ex) {
                viewReference = null;
            }
        } else {
            IViewPart viewPart = viewReference.getView(false);
            window.getActivePage().bringToTop(viewPart);
            ((BrokerDashboardViewPart) viewPart).init((BrokerNode) getModel());
        }
    }
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IViewPart(org.eclipse.ui.IViewPart) BrokerDashboardViewPart(com.cubrid.cubridmanager.ui.mondashboard.editor.BrokerDashboardViewPart) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) IViewReference(org.eclipse.ui.IViewReference) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException)

Example 34 with HostNode

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

the class BrokerMonitorPart method createFigure.

/**
	 * get a database monitor figure.
	 * 
	 * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
	 * @return a database figure
	 */
protected IFigure createFigure() {
    BrokerMonitorFigure figure = new BrokerMonitorFigure();
    BrokerNode broker = (BrokerNode) getModel();
    setMode2View(figure, broker);
    HostNode hostNode = broker.getParent();
    figure.setHint(new StringBuffer(" ").append(broker.getBrokerName()).append("@").append(hostNode.getIp()).append(":").append(hostNode.getPort()).append(" ").toString());
    return figure;
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) BrokerMonitorFigure(com.cubrid.cubridmanager.ui.mondashboard.editor.figure.BrokerMonitorFigure) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)

Example 35 with HostNode

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

the class DatabaseMonitorPart method performRequest.

/**
	 * @see org.eclipse.gef.editparts.AbstractEditPart#performRequest(org.eclipse.gef.Request)
	 * @param req Request
	 */
public void performRequest(Request req) {
    if (req.getType() == RequestConstants.REQ_OPEN) {
        DatabaseNode databaseNode = (DatabaseNode) getModel();
        if (!databaseNode.isConnected()) {
            return;
        }
        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        if (window == null) {
            return;
        }
        IWorkbenchPage page = window.getActivePage();
        if (page == null) {
            return;
        }
        HostNode hn = databaseNode.getParent();
        String secondaryId = new StringBuffer(databaseNode.getDbName()).append("&").append(hn.getUserName()).append("&").append(hn.getIp()).append("&").append(hn.getPort()).toString();
        IViewReference viewReference = page.findViewReference(DatabaseDashboardViewPart.ID, secondaryId);
        if (viewReference == null) {
            try {
                IViewPart viewPart = page.showView(DatabaseDashboardViewPart.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
                ((DatabaseDashboardViewPart) viewPart).init(databaseNode);
            } catch (PartInitException ex) {
                viewReference = null;
            }
        } else {
            IViewPart viewPart = viewReference.getView(false);
            window.getActivePage().bringToTop(viewPart);
            ((DatabaseDashboardViewPart) viewPart).init(databaseNode);
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IViewPart(org.eclipse.ui.IViewPart) DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) IViewReference(org.eclipse.ui.IViewReference) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException) DatabaseDashboardViewPart(com.cubrid.cubridmanager.ui.mondashboard.editor.DatabaseDashboardViewPart)

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