use of com.cubrid.common.ui.spi.event.CubridNodeChangedEventType in project cubrid-manager by CUBRID.
the class TableEditorPart 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())) {
close(event, database.getServer());
}
if (CubridNodeChangedEventType.DATABASE_LOGOUT.equals(event.getType()) || CubridNodeChangedEventType.DATABASE_STOP.equals(event.getType())) {
close(event, database);
}
}
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 server
*
* @param event CubridNodeChangedEvent
* @param database CubridServer
*/
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);
}
}
}
use of com.cubrid.common.ui.spi.event.CubridNodeChangedEventType in project cubrid-manager by CUBRID.
the class ERSchemaEditor method nodeChanged.
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.DATABASE.equals(type) && !NodeType.SERVER.equals(type)) {
return;
}
if (!CubridNodeChangedEventType.DATABASE_LOGIN.equals(eventType) && !CubridNodeChangedEventType.DATABASE_LOGOUT.equals(eventType) && !CubridNodeChangedEventType.NODE_REMOVE.equals(eventType) && !CubridNodeChangedEventType.NODE_REFRESH.equals(eventType) && !CubridNodeChangedEventType.SERVER_DISCONNECTED.equals(eventType)) {
return;
}
if (NodeType.SERVER.equals(type) && cubridNode instanceof CubridServer) {
if (CubridNodeChangedEventType.NODE_REMOVE.equals(eventType) || CubridNodeChangedEventType.SERVER_DISCONNECTED.equals(eventType)) {
Object obj = database.getAdapter(ServerInfo.class);
CubridServer server = (CubridServer) cubridNode;
ServerInfo severInfo = server.getServerInfo();
if (severInfo != null && severInfo.equals(obj)) {
setDatabase(ERVirtualDatabase.getInstance());
CubridNodeManager.getInstance().removeCubridNodeChangeListener(this);
}
}
}
if (CubridNodeChangedEventType.DATABASE_LOGOUT.equals(eventType) || CubridNodeChangedEventType.NODE_REMOVE.equals(eventType)) {
if (cubridNode.equals(database)) {
setDatabase(ERVirtualDatabase.getInstance());
CubridNodeManager.getInstance().removeCubridNodeChangeListener(this);
}
}
synchronized (this) {
erToolBar.refresh();
}
}
Aggregations