Search in sources :

Example 41 with CubridNodeChangedEvent

use of com.cubrid.common.ui.spi.event.CubridNodeChangedEvent in project cubrid-manager by CUBRID.

the class CQBConnectionChangingObserver method afterDelete.

/**
	 * Delete a connection.
	 *
	 * @param initiator IJDBCInfoChangedSubject who triggered the event.
	 * @param delCon IJDBCConnecInfo
	 */
public void afterDelete(IJDBCInfoChangedSubject initiator, IJDBCConnecInfo delCon) {
    if (CQBDBNodePersistManager.getInstance().equals(initiator)) {
        return;
    }
    //If not a CUBRID connection
    if (delCon.getDbType() != 1) {
        return;
    }
    CubridDatabase database = CQBDatabaseFactory.getDatabaseJDBCConnectInfo(delCon);
    if (database != null) {
        /*Remove in CQB*/
        CQBConnectionUtils.processConnectionDeleted(database);
        CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent(database, CubridNodeChangedEventType.DATABASE_LOGOUT));
        refreshNavigationTree(null);
    }
}
Also used : CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Example 42 with CubridNodeChangedEvent

use of com.cubrid.common.ui.spi.event.CubridNodeChangedEvent in project cubrid-manager by CUBRID.

the class CubridSystemMonitorFolderLoader method load.

/**
	 * 
	 * Load children object for parent
	 * 
	 * @param parent the parent node
	 * @param monitor the IProgressMonitor object
	 */
public void load(ICubridNode parent, final IProgressMonitor monitor) {
    synchronized (this) {
        if (isLoaded()) {
            return;
        }
        ServerInfo serverInfo = parent.getServer().getServerInfo();
        ServerUserInfo userInfo = serverInfo.getLoginedUserInfo();
        if (userInfo == null || StatusMonitorAuthType.AUTH_NONE == userInfo.getStatusMonitorAuth()) {
            parent.removeAllChild();
            CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
            return;
        }
        String hostSystemId = parent.getId() + NODE_SEPARATOR + HOST_SYSTEM_ID;
        ICubridNode hostSystemNode = new DefaultCubridNode(hostSystemId, Messages.msgHostSystemMonitorName, "icons/navigator/status_item.png");
        hostSystemNode.setType(CubridNodeType.SYSTEM_MONITOR_TEMPLATE);
        hostSystemNode.setViewId(HostSystemMonitorViewPart.ID);
        hostSystemNode.setContainer(false);
        parent.addChild(hostSystemNode);
        if (CompatibleUtil.isSupportDBSystemMonitor(serverInfo)) {
            String dbSystemId = parent.getId() + NODE_SEPARATOR + DB_SYSTEM_ID;
            ICubridNode dbSystemNode = new DefaultCubridNode(dbSystemId, Messages.msgDbSystemMonitorName, "icons/navigator/status_item.png");
            dbSystemNode.setType(CubridNodeType.SYSTEM_MONITOR_TEMPLATE);
            dbSystemNode.setViewId(DbSystemMonitorViewPart.ID);
            dbSystemNode.setContainer(false);
            parent.addChild(dbSystemNode);
        }
    }
    Collections.sort(parent.getChildren());
    setLoaded(true);
    CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
Also used : DefaultCubridNode(com.cubrid.common.ui.spi.model.DefaultCubridNode) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode)

Example 43 with CubridNodeChangedEvent

use of com.cubrid.common.ui.spi.event.CubridNodeChangedEvent in project cubrid-manager by CUBRID.

the class MonitorStatisticPersistManager method removeMonitorStatistic.

/**
	 * Remove MonitorStatistic node according to <i>hostId</i>. If <i>hostId</i>
	 * is null, will check all the MonitorStatistic node belong to Dashboard
	 * tab.
	 *
	 * @param node
	 * @param hostId
	 */
public void removeMonitorStatistic(MonitorStatistic node, String hostId) {
    if (node == null) {
        return;
    }
    synchronized (this) {
        if (hostId == null) {
            hostId = HOST_ID_FOR_MULTI_HOST;
        }
        List<MonitorStatistic> monitorStatisticList = monitorStatisticMap.get(hostId);
        if (monitorStatisticList != null) {
            monitorStatisticList.remove(node);
            saveStatistic();
            CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent(node, CubridNodeChangedEventType.NODE_REMOVE));
        }
    }
}
Also used : MonitorStatistic(com.cubrid.common.ui.spi.model.MonitorStatistic) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)

Example 44 with CubridNodeChangedEvent

use of com.cubrid.common.ui.spi.event.CubridNodeChangedEvent in project cubrid-manager by CUBRID.

the class MonitorStatisticPersistManager method addMonitorStatistic.

/**
	 *
	 * Add MonitorStatistic node according to <i>hostId</i>. If <i>hostId</i> is
	 * not null, will add a single host node for the specified host, else add a
	 * multi-host node for Dashboard tab.
	 *
	 * @param node MonitorStatistic
	 * @param hostId Host node id
	 */
public void addMonitorStatistic(MonitorStatistic node, String hostId) {
    if (node == null) {
        return;
    }
    synchronized (this) {
        if (hostId == null) {
            hostId = HOST_ID_FOR_MULTI_HOST;
        }
        List<MonitorStatistic> monitorStatisticList = monitorStatisticMap.get(hostId);
        if (monitorStatisticList == null) {
            monitorStatisticList = new ArrayList<MonitorStatistic>();
        }
        monitorStatisticList.add(node);
        //TODO:
        monitorStatisticMap.put(hostId, monitorStatisticList);
        saveStatistic();
        CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent(node, CubridNodeChangedEventType.NODE_ADD));
    }
}
Also used : MonitorStatistic(com.cubrid.common.ui.spi.model.MonitorStatistic) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)

Example 45 with CubridNodeChangedEvent

use of com.cubrid.common.ui.spi.event.CubridNodeChangedEvent in project cubrid-manager by CUBRID.

the class CubridMonitorFolderLoader method load.

/**
	 *
	 * Load children object for parent
	 *
	 * @param parent the parent node
	 * @param monitor the IProgressMonitor object
	 */
public void load(ICubridNode parent, final IProgressMonitor monitor) {
    synchronized (this) {
        if (isLoaded()) {
            return;
        }
        ServerInfo serverInfo = parent.getServer().getServerInfo();
        ServerUserInfo userInfo = serverInfo.getLoginedUserInfo();
        if (userInfo == null || StatusMonitorAuthType.AUTH_NONE == userInfo.getStatusMonitorAuth()) {
            parent.removeAllChild();
            CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
            return;
        }
        //add status node
        if (CompatibleUtil.isSupportBrokerOrDBStatusMonitor(serverInfo)) {
            String brokerStatusId = parent.getId() + NODE_SEPARATOR + BROKER_STATUS_ID;
            ICubridNode brokerStatusNode = new DefaultCubridNode(brokerStatusId, Messages.msgBrokerStatusMonitorName, "icons/navigator/status_item.png");
            brokerStatusNode.setType(CubridNodeType.STATUS_MONITOR_TEMPLATE);
            brokerStatusNode.setViewId(BrokerStatusMonitorViewPart.ID);
            brokerStatusNode.setContainer(false);
            parent.addChild(brokerStatusNode);
            String dbStatusId = parent.getId() + NODE_SEPARATOR + DB_STATUS_ID;
            ICubridNode dbStautsNode = new DefaultCubridNode(dbStatusId, Messages.msgDbStatusMonitorName, "icons/navigator/status_item.png");
            dbStautsNode.setType(CubridNodeType.STATUS_MONITOR_TEMPLATE);
            dbStautsNode.setViewId(DbStatusDumpMonitorViewPart.ID);
            dbStautsNode.setContainer(false);
            parent.addChild(dbStautsNode);
            createTempStatusNode(parent);
        } else {
            if (!loadStatusTempInfoTask(parent, monitor, serverInfo)) {
                return;
            }
        }
        //add system node
        if (CompatibleUtil.isSupportSystemMonitor(serverInfo)) {
            String hostSystemId = parent.getId() + NODE_SEPARATOR + HOST_SYSTEM_ID;
            ICubridNode hostSystemNode = new DefaultCubridNode(hostSystemId, Messages.msgHostSystemMonitorName, "icons/navigator/status_item.png");
            hostSystemNode.setType(CubridNodeType.SYSTEM_MONITOR_TEMPLATE);
            hostSystemNode.setViewId(HostSystemMonitorViewPart.ID);
            hostSystemNode.setContainer(false);
            parent.addChild(hostSystemNode);
            if (CompatibleUtil.isSupportDBSystemMonitor(serverInfo)) {
                String dbSystemId = parent.getId() + NODE_SEPARATOR + DB_SYSTEM_ID;
                ICubridNode dbSystemNode = new DefaultCubridNode(dbSystemId, Messages.msgDbSystemMonitorName, "icons/navigator/status_item.png");
                dbSystemNode.setType(CubridNodeType.SYSTEM_MONITOR_TEMPLATE);
                dbSystemNode.setViewId(DbSystemMonitorViewPart.ID);
                dbSystemNode.setContainer(false);
                parent.addChild(dbSystemNode);
            }
        }
        //add monitor statistic node
        if (CompatibleUtil.isSupportMonitorStatistic(serverInfo)) {
            List<MonitorStatistic> childList = MonitorStatisticPersistManager.getInstance().getMonitorStatisticListByHostId(serverInfo.getServerName());
            for (MonitorStatistic node : childList) {
                if (node == null) {
                    continue;
                }
                parent.addChild(node);
            }
        }
        Collections.sort(parent.getChildren());
        setLoaded(true);
        CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
    }
}
Also used : DefaultCubridNode(com.cubrid.common.ui.spi.model.DefaultCubridNode) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) MonitorStatistic(com.cubrid.common.ui.spi.model.MonitorStatistic) ServerUserInfo(com.cubrid.cubridmanager.core.common.model.ServerUserInfo) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode)

Aggregations

CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)98 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)55 TreeViewer (org.eclipse.jface.viewers.TreeViewer)45 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)42 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)23 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)23 CubridNavigatorView (com.cubrid.common.ui.common.navigator.CubridNavigatorView)21 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)21 DefaultSchemaNode (com.cubrid.common.ui.spi.model.DefaultSchemaNode)17 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)17 ArrayList (java.util.ArrayList)13 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)11 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)10 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)10 ClassInfo (com.cubrid.cubridmanager.core.cubrid.table.model.ClassInfo)10 Display (org.eclipse.swt.widgets.Display)10 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)9 ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)9 DbUserInfo (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo)9 ICubridNodeLoader (com.cubrid.common.ui.spi.model.ICubridNodeLoader)8