Search in sources :

Example 1 with CubridNodeChangedEventType

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

the class EditVirtualTableDialog method nodeChanged.

public void nodeChanged(CubridNodeChangedEvent event) {
    ICubridNode cubridNode = event.getCubridNode();
    CubridNodeChangedEventType eventType = event.getType();
    if (cubridNode == null || eventType == null) {
        return;
    }
    if (CubridNodeChangedEventType.SERVER_DISCONNECTED.equals(event.getType())) {
        super.close();
    }
    if (CubridNodeChangedEventType.DATABASE_LOGOUT.equals(event.getType()) || CubridNodeChangedEventType.DATABASE_STOP.equals(event.getType())) {
        super.close();
    }
}
Also used : CubridNodeChangedEventType(com.cubrid.common.ui.spi.event.CubridNodeChangedEventType) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode)

Example 2 with CubridNodeChangedEventType

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

the class DBSpaceLabelProvider method nodeChanged.

/**
	 * Perform node change event
	 */
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.SERVER_DISCONNECTED.equals(eventType) || CubridNodeChangedEventType.NODE_REMOVE.equals(eventType)) {
            if (serverInfo != null && StringUtil.isEqualNotIgnoreNull(cubridNode.getName(), serverInfo.getServerName())) {
                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)

Example 3 with CubridNodeChangedEventType

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

the class SchemaInfoEditorPart method nodeChanged.

/**
	 * @see com.cubrid.common.ui.spi.event.ICubridNodeChangedListener#nodeChanged(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)
	 * @param event the CubridNodeChangedEvent object
	 */
public void nodeChanged(CubridNodeChangedEvent event) {
    ICubridNode eventNode = event.getCubridNode();
    if (eventNode == null) {
        return;
    }
    CubridNodeChangedEventType type = event.getType();
    ICubridNode node = null;
    if (type == CubridNodeChangedEventType.CONTAINER_NODE_REFRESH) {
        node = eventNode.getChild(cubridNode == null ? "" : cubridNode.getId());
    } else if (type == CubridNodeChangedEventType.NODE_REFRESH && eventNode.getId().equals(cubridNode.getId())) {
        node = eventNode;
    } else {
        return;
    }
    if (node == null) {
        return;
    }
    cubridNode = node;
    synchronized (this) {
        database.clearSchemas();
        refresh();
    }
}
Also used : CubridNodeChangedEventType(com.cubrid.common.ui.spi.event.CubridNodeChangedEventType) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode)

Example 4 with CubridNodeChangedEventType

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

the class ERSchemaEditor method close.

/**
	 * Close the editors which are the same database
	 * 
	 * @param event CubridNodeChangedEvent
	 * @param database CubridDatabase
	 */
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 5 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 server 
	 * @param event
	 * @param database
	 */
public void close(CubridNodeChangedEvent event, CubridServer server) {
    ICubridNode cubridNode = event.getCubridNode();
    CubridNodeChangedEventType eventType = event.getType();
    if (cubridNode == null || eventType == null) {
        return;
    }
    if (event.getSource() instanceof CubridServer) {
        CubridServer eventCubridServer = (CubridServer) event.getSource();
        if (eventCubridServer.equals(server)) {
            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) CubridServer(com.cubrid.common.ui.spi.model.CubridServer)

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