Search in sources :

Example 6 with CubridNodeChangedEventType

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

the class ServiceDashboardEditor method nodeChanged.

/**
	 * Perform node changed
	 */
public void nodeChanged(CubridNodeChangedEvent event) {
    ICubridNode cubridNode = event.getCubridNode();
    CubridNodeChangedEventType eventType = event.getType();
    if (cubridNode == null || eventType == null) {
        return;
    }
    if (NodeType.SERVER.equals(cubridNode.getType())) {
        if (CubridNodeChangedEventType.NODE_ADD.equals(event.getType()) || CubridNodeChangedEventType.NODE_REMOVE.equals(event.getType())) {
            loadAllData();
        } else {
            serviceTreeViewer.refresh(cubridNode);
        }
    }
}
Also used : CubridNodeChangedEventType(com.cubrid.common.ui.spi.event.CubridNodeChangedEventType) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode)

Example 7 with CubridNodeChangedEventType

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

the class ColumnProposalAdvisor method nodeChanged.

/**
	 * Perform node changed event
	 */
public void nodeChanged(CubridNodeChangedEvent event) {
    ICubridNode cubridNode = event.getCubridNode();
    CubridNodeChangedEventType eventType = event.getType();
    if (cubridNode == null || eventType == null) {
        return;
    }
    if ((NodeType.USER_TABLE.equals(cubridNode.getType()) || NodeType.USER_VIEW.equals(cubridNode.getType())) && cubridNode instanceof DefaultSchemaNode) {
        DefaultSchemaNode schemaNode = (DefaultSchemaNode) cubridNode;
        DatabaseInfo databaseInfo = schemaNode.getDatabase().getDatabaseInfo();
        if (CubridNodeChangedEventType.NODE_REMOVE.equals(eventType)) {
            removeTable(databaseInfo, schemaNode.getName());
        } else if (CubridNodeChangedEventType.NODE_ADD.equals(eventType) || CubridNodeChangedEventType.NODE_REFRESH.equals(eventType)) {
            refreshTable(databaseInfo, schemaNode.getName());
        }
    }
    if (NodeType.DATABASE.equals(cubridNode.getType()) && cubridNode instanceof CubridDatabase) {
        CubridDatabase database = (CubridDatabase) cubridNode;
        if (CubridNodeChangedEventType.DATABASE_LOGIN.equals(eventType)) {
            removeProposal(database.getDatabaseInfo());
            findProposal(database.getDatabaseInfo());
        }
        if (CubridNodeChangedEventType.DATABASE_LOGOUT.equals(eventType)) {
            removeProposal(database.getDatabaseInfo());
        }
        if (CubridNodeChangedEventType.CONTAINER_NODE_REFRESH.equals(eventType)) {
            removeProposal(database.getDatabaseInfo());
            findProposal(database.getDatabaseInfo());
        }
    }
    if (NodeType.TABLE_FOLDER.equals(cubridNode.getType()) || NodeType.VIEW_FOLDER.equals(cubridNode.getType()) && CubridNodeChangedEventType.CONTAINER_NODE_REFRESH.equals(eventType) && cubridNode instanceof DefaultSchemaNode) {
        DefaultSchemaNode schemaNode = (DefaultSchemaNode) cubridNode;
        removeProposal(schemaNode.getDatabase().getDatabaseInfo());
        findProposal(schemaNode.getDatabase().getDatabaseInfo());
    }
}
Also used : DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) CubridNodeChangedEventType(com.cubrid.common.ui.spi.event.CubridNodeChangedEventType) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Example 8 with CubridNodeChangedEventType

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

the class CubridEditorPart method close.

/**
	 * close the editors which are the same database 
	 * @param event
	 * @param database
	 */
public void close(CubridNodeChangedEvent event, CubridDatabase database) {
    ICubridNode cubridNode = event.getCubridNode();
    CubridNodeChangedEventType eventType = event.getType();
    if (cubridNode == null || eventType == null) {
        return;
    }
    if (event.getSource() instanceof CubridDatabase) {
        CubridDatabase eventCubridDatabase = (CubridDatabase) event.getSource();
        if (eventCubridDatabase.equals(database)) {
            IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
            if (window == null) {
                return;
            }
            window.getActivePage().closeEditor(this, true);
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) CubridNodeChangedEventType(com.cubrid.common.ui.spi.event.CubridNodeChangedEventType) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Example 9 with CubridNodeChangedEventType

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

the class ConnectionKeepAliveHandler method nodeChanged.

@Override
public void nodeChanged(CubridNodeChangedEvent event) {
    ICubridNode cubridNode = event.getCubridNode();
    CubridNodeChangedEventType eventType = event.getType();
    if (cubridNode == null || eventType == null) {
        return;
    }
    if (!(cubridNode instanceof CubridServer)) {
        return;
    }
    CubridServer server = (CubridServer) cubridNode;
    ServerInfo serverInfo = server.getServerInfo();
    if (CubridNodeChangedEventType.SERVER_CONNECTED.equals(eventType)) {
        addServer(serverInfo);
    } else if (CubridNodeChangedEventType.SERVER_DISCONNECTED.equals(eventType)) {
        delServer(serverInfo);
    }
}
Also used : CubridNodeChangedEventType(com.cubrid.common.ui.spi.event.CubridNodeChangedEventType) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridServer(com.cubrid.common.ui.spi.model.CubridServer)

Example 10 with CubridNodeChangedEventType

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

the class QueryEditorPart method nodeChanged.

/**
	 * When navigator node change ,refresh the database list on query editor
	 *
	 * @param event CubridNodeChangedEvent
	 */
public void nodeChanged(CubridNodeChangedEvent event) {
    ICubridNode cubridNode = event.getCubridNode();
    CubridNodeChangedEventType eventType = event.getType();
    if (cubridNode == null || eventType == null) {
        return;
    }
    String type = cubridNode.getType();
    if (!NodeType.SERVER.equals(type) && !NodeType.DATABASE_FOLDER.equals(type) && !NodeType.DATABASE.equals(type)) {
        return;
    }
    /* Judge the event type */
    if (!CubridNodeChangedEventType.SERVER_CONNECTED.equals(eventType) && !CubridNodeChangedEventType.SERVER_DISCONNECTED.equals(eventType) && !CubridNodeChangedEventType.DATABASE_LOGIN.equals(eventType) && !CubridNodeChangedEventType.DATABASE_LOGOUT.equals(eventType) && !CubridNodeChangedEventType.DATABASE_STOP.equals(eventType) && !CubridNodeChangedEventType.DATABASE_START.equals(eventType)) {
        return;
    }
    synchronized (this) {
        qeToolBar.refresh();
    }
}
Also used : CubridNodeChangedEventType(com.cubrid.common.ui.spi.event.CubridNodeChangedEventType) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode)

Aggregations

CubridNodeChangedEventType (com.cubrid.common.ui.spi.event.CubridNodeChangedEventType)13 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)13 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)5 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)4 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)3 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)2 DefaultSchemaNode (com.cubrid.common.ui.spi.model.DefaultSchemaNode)1 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)1 EventObject (java.util.EventObject)1