Search in sources :

Example 86 with ICubridNode

use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.

the class ColumnViewerSorter method registerContextMenu.

private void registerContextMenu() {
    final ActionManager manager = ActionManager.getInstance();
    final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    tableListView.getTable().addFocusListener(new FocusAdapter() {

        public void focusGained(FocusEvent event) {
            manager.changeFocusProvider(tableListView.getTable());
        }
    });
    Menu menu = new Menu(shell, SWT.POP_UP);
    // SELECT GROUP
    final Menu makeSelectQueryMenu = new Menu(menu);
    {
        MenuItem subMenuItem = new MenuItem(menu, SWT.CASCADE);
        subMenuItem.setText(com.cubrid.common.ui.spi.Messages.lblMakeSelectQueryGrp);
        subMenuItem.setMenu(makeSelectQueryMenu);
    }
    // SELECT
    initializeAction(makeSelectQueryMenu, getMakeQueryAction(MakeSelectQueryAction.ID));
    // Parameterized SELECT
    initializeAction(makeSelectQueryMenu, getMakeQueryAction(MakeSelectPstmtQueryAction.ID));
    // Parameterized INSERT
    initializeAction(menu, getMakeQueryAction(MakeInsertQueryAction.ID));
    // Parameterized UPDATE
    initializeAction(menu, getMakeQueryAction(MakeUpdateQueryAction.ID));
    // Parameterized DELETE
    initializeAction(menu, getMakeQueryAction(MakeDeleteQueryAction.ID));
    // CREATE
    initializeAction(menu, getMakeQueryAction(MakeCreateQueryAction.ID));
    new MenuItem(menu, SWT.SEPARATOR);
    final TableToJavaCodeAction createJavaCodeAction = (TableToJavaCodeAction) manager.getAction(TableToJavaCodeAction.ID);
    if (createJavaCodeAction != null) {
        MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
        menuItem.setText(createJavaCodeAction.getText());
        menuItem.setImage(CommonUITool.getImage(createJavaCodeAction.getImageDescriptor()));
        menuItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                ICubridNode[] nodes = getAllSelectedNodes();
                if (nodes != null && nodes.length > 0) {
                    createJavaCodeAction.run(nodes);
                }
            }
        });
    }
    final TableToPhpCodeAction createPhpCodeAction = (TableToPhpCodeAction) manager.getAction(TableToPhpCodeAction.ID);
    if (createPhpCodeAction != null) {
        MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
        menuItem.setText(createPhpCodeAction.getText());
        menuItem.setImage(CommonUITool.getImage(createPhpCodeAction.getImageDescriptor()));
        menuItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                ICubridNode[] nodes = getAllSelectedNodes();
                if (nodes != null && nodes.length > 0) {
                    createPhpCodeAction.run(nodes);
                }
            }
        });
    }
    final ExportTableDefinitionAction exportTableDefinitionAction = (ExportTableDefinitionAction) manager.getAction(ExportTableDefinitionAction.ID);
    if (exportTableDefinitionAction != null) {
        MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
        menuItem.setText(exportTableDefinitionAction.getText());
        menuItem.setImage(CommonUITool.getImage(exportTableDefinitionAction.getImageDescriptor()));
        menuItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                ICubridNode[] nodes = getAllSelectedNodes();
                if (nodes != null && nodes.length > 0) {
                    exportTableDefinitionAction.run(nodes);
                }
            }
        });
    }
    new MenuItem(menu, SWT.SEPARATOR);
    // View data menu
    final Menu viewDataMenu = new Menu(menu);
    {
        final MenuItem subMenuItem = new MenuItem(menu, SWT.CASCADE);
        subMenuItem.setText(com.cubrid.common.ui.spi.Messages.viewDataMenuName);
        subMenuItem.setMenu(viewDataMenu);
    }
    final TableSelectAllAction selectAllAction = (TableSelectAllAction) manager.getAction(TableSelectAllAction.ID);
    if (selectAllAction != null) {
        MenuItem menuItem = new MenuItem(viewDataMenu, SWT.PUSH);
        menuItem.setText(selectAllAction.getText());
        menuItem.setImage(CommonUITool.getImage(selectAllAction.getImageDescriptor()));
        menuItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                ICubridNode node = getFirstSelectedNode();
                if (node != null) {
                    selectAllAction.run((ISchemaNode) node);
                }
            }
        });
    }
    final SelectByOnePstmtDataAction selectPstmtAction = (SelectByOnePstmtDataAction) manager.getAction(SelectByOnePstmtDataAction.ID);
    if (selectPstmtAction != null) {
        MenuItem menuItem = new MenuItem(viewDataMenu, SWT.PUSH);
        menuItem.setText(selectPstmtAction.getText());
        menuItem.setImage(CommonUITool.getImage(selectPstmtAction.getImageDescriptor()));
        menuItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                ICubridNode node = getFirstSelectedNode();
                if (node != null) {
                    selectPstmtAction.run((ISchemaNode) node);
                }
            }
        });
    }
    final SelectByMultiPstmtDataAction selectMultiPstmtAction = (SelectByMultiPstmtDataAction) manager.getAction(SelectByMultiPstmtDataAction.ID);
    if (selectMultiPstmtAction != null) {
        MenuItem menuItem = new MenuItem(viewDataMenu, SWT.PUSH);
        menuItem.setText(selectMultiPstmtAction.getText());
        menuItem.setImage(CommonUITool.getImage(selectMultiPstmtAction.getImageDescriptor()));
        menuItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                ICubridNode node = getFirstSelectedNode();
                if (node != null) {
                    selectMultiPstmtAction.run((ISchemaNode) node);
                }
            }
        });
    }
    new MenuItem(viewDataMenu, SWT.SEPARATOR);
    final TableSelectCountAction selectCountAction = (TableSelectCountAction) manager.getAction(TableSelectCountAction.ID);
    if (selectCountAction != null) {
        MenuItem menuItem = new MenuItem(viewDataMenu, SWT.PUSH);
        menuItem.setText(selectCountAction.getText());
        menuItem.setImage(CommonUITool.getImage(selectAllAction.getImageDescriptor()));
        menuItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                ICubridNode node = getFirstSelectedNode();
                if (node != null) {
                    selectCountAction.run((ISchemaNode) node);
                }
            }
        });
    }
    // Input data menu
    final Menu inputDataMenu = new Menu(menu);
    {
        MenuItem subMenuItem = new MenuItem(menu, SWT.CASCADE);
        subMenuItem.setText(com.cubrid.common.ui.spi.Messages.inputDataMenuName);
        subMenuItem.setMenu(inputDataMenu);
    }
    final InsertOneByPstmtAction insertStmtAction = (InsertOneByPstmtAction) manager.getAction(InsertOneByPstmtAction.ID);
    if (insertStmtAction != null) {
        MenuItem menuItem = new MenuItem(inputDataMenu, SWT.PUSH);
        menuItem.setText(insertStmtAction.getText());
        menuItem.setImage(CommonUITool.getImage(insertStmtAction.getImageDescriptor()));
        menuItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                ICubridNode node = getFirstSelectedNode();
                if (node != null) {
                    insertStmtAction.run((ISchemaNode) node);
                }
            }
        });
    }
    final ImportDataFromFileAction insertMultiStmtAction = (ImportDataFromFileAction) manager.getAction(ImportDataFromFileAction.ID);
    if (insertMultiStmtAction != null) {
        MenuItem menuItem = new MenuItem(inputDataMenu, SWT.PUSH);
        menuItem.setText(insertMultiStmtAction.getText());
        menuItem.setImage(CommonUITool.getImage(insertMultiStmtAction.getImageDescriptor()));
        menuItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                ICubridNode node = getFirstSelectedNode();
                if (node != null) {
                    insertMultiStmtAction.run((ISchemaNode) node);
                }
            }
        });
    }
    new MenuItem(menu, SWT.SEPARATOR);
    // Export & Import
    final ExportWizardAction exportWizardAction = (ExportWizardAction) manager.getAction(ExportWizardAction.ID);
    if (exportWizardAction != null) {
        MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
        menuItem.setText(exportWizardAction.getText());
        menuItem.setImage(CommonUITool.getImage(exportWizardAction.getImageDescriptor()));
        menuItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                ICubridNode[] nodes = getAllSelectedNodes();
                if (nodes != null && nodes.length > 0) {
                    exportWizardAction.run(nodes);
                }
            }
        });
    }
    final ImportWizardAction importWizardAction = (ImportWizardAction) manager.getAction(ImportWizardAction.ID);
    if (importWizardAction != null) {
        MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
        menuItem.setText(importWizardAction.getText());
        menuItem.setImage(CommonUITool.getImage(importWizardAction.getImageDescriptor()));
        menuItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                ICubridNode[] nodes = getAllSelectedNodes();
                if (nodes != null && nodes.length > 0) {
                    importWizardAction.run(nodes);
                }
            }
        });
    }
    new MenuItem(menu, SWT.SEPARATOR);
    final EditTableAction editTableAction = (EditTableAction) manager.getAction(EditTableAction.ID);
    if (editTableAction != null) {
        MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
        menuItem.setText(editTableAction.getText());
        menuItem.setImage(CommonUITool.getImage(editTableAction.getImageDescriptor()));
        menuItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                ICubridNode node = getFirstSelectedNode();
                if (node != null) {
                    editTableAction.run((ISchemaNode) node);
                }
            }
        });
    }
    final RenameTableAction renameTableAction = (RenameTableAction) manager.getAction(RenameTableAction.ID);
    if (renameTableAction != null) {
        MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
        menuItem.setText(renameTableAction.getText());
        menuItem.setImage(CommonUITool.getImage(renameTableAction.getImageDescriptor()));
        menuItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                ICubridNode node = getFirstSelectedNode();
                if (node != null) {
                    renameTableAction.run(database, (ISchemaNode) node);
                }
            }
        });
    }
    new MenuItem(menu, SWT.SEPARATOR);
    final Menu manageTableMenu = new Menu(menu);
    {
        final MenuItem subMenuItem = new MenuItem(menu, SWT.CASCADE);
        subMenuItem.setText(com.cubrid.common.ui.spi.Messages.tableMoreName);
        subMenuItem.setMenu(manageTableMenu);
    }
    final DeleteTableAction deleteTableAction = (DeleteTableAction) manager.getAction(DeleteTableAction.ID);
    if (deleteTableAction != null) {
        MenuItem menuItem = new MenuItem(manageTableMenu, SWT.PUSH);
        menuItem.setText(deleteTableAction.getText());
        menuItem.setImage(CommonUITool.getImage(deleteTableAction.getImageDescriptor()));
        menuItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                ICubridNode[] nodes = getAllSelectedNodes();
                if (nodes != null && nodes.length > 0) {
                    deleteTableAction.run(nodes);
                }
            }
        });
    }
    final DropTableAction dropTableAction = (DropTableAction) manager.getAction(DropTableAction.ID);
    if (dropTableAction != null) {
        MenuItem menuItem = new MenuItem(manageTableMenu, SWT.PUSH);
        menuItem.setText(dropTableAction.getText());
        menuItem.setImage(CommonUITool.getImage(dropTableAction.getImageDescriptor()));
        menuItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                ICubridNode[] nodes = getAllSelectedNodes();
                if (nodes != null && nodes.length > 0) {
                    dropTableAction.run(nodes);
                }
            }
        });
    }
    if (CompatibleUtil.isSupportCreateTableLike(database.getDatabaseInfo())) {
        final CreateLikeTableAction createLikeTableAction = (CreateLikeTableAction) manager.getAction(CreateLikeTableAction.ID);
        if (createLikeTableAction != null) {
            MenuItem menuItem = new MenuItem(manageTableMenu, SWT.PUSH);
            menuItem.setText(createLikeTableAction.getText());
            menuItem.setImage(CommonUITool.getImage(createLikeTableAction.getImageDescriptor()));
            menuItem.addSelectionListener(new SelectionAdapter() {

                public void widgetSelected(SelectionEvent event) {
                    ICubridNode node = getFirstSelectedNode();
                    if (node != null) {
                        createLikeTableAction.run((ISchemaNode) node);
                    }
                }
            });
        }
    }
    new MenuItem(menu, SWT.SEPARATOR);
    final NewTableAction newTableAction = (NewTableAction) manager.getAction(NewTableAction.ID);
    if (newTableAction != null) {
        MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
        menuItem.setText(newTableAction.getText());
        menuItem.setImage(CommonUITool.getImage(newTableAction.getImageDescriptor()));
        menuItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent event) {
                newTableAction.run(database);
            }
        });
    }
    new MenuItem(menu, SWT.SEPARATOR);
    final MenuItem refreshItem = new MenuItem(menu, SWT.PUSH);
    refreshItem.setText(Messages.tablesDetailInfoPartRefreshMenu);
    refreshItem.setImage(CommonUIPlugin.getImage("icons/action/refresh.png"));
    refreshItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            refresh();
        }
    });
    tableListView.getTable().setMenu(menu);
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) ImportWizardAction(com.cubrid.common.ui.cubrid.table.action.ImportWizardAction) TableToPhpCodeAction(com.cubrid.common.ui.cubrid.table.action.TableToPhpCodeAction) RenameTableAction(com.cubrid.common.ui.cubrid.table.action.RenameTableAction) SelectByMultiPstmtDataAction(com.cubrid.common.ui.cubrid.table.action.SelectByMultiPstmtDataAction) TableSelectAllAction(com.cubrid.common.ui.cubrid.table.action.TableSelectAllAction) TableSelectCountAction(com.cubrid.common.ui.cubrid.table.action.TableSelectCountAction) FocusEvent(org.eclipse.swt.events.FocusEvent) ActionManager(com.cubrid.common.ui.spi.action.ActionManager) Shell(org.eclipse.swt.widgets.Shell) NewTableAction(com.cubrid.common.ui.cubrid.table.action.NewTableAction) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DropTableAction(com.cubrid.common.ui.cubrid.table.action.DropTableAction) ExportWizardAction(com.cubrid.common.ui.cubrid.table.action.ExportWizardAction) Menu(org.eclipse.swt.widgets.Menu) CreateLikeTableAction(com.cubrid.common.ui.cubrid.table.action.CreateLikeTableAction) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) EditTableAction(com.cubrid.common.ui.cubrid.table.action.EditTableAction) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) MenuItem(org.eclipse.swt.widgets.MenuItem) InsertOneByPstmtAction(com.cubrid.common.ui.cubrid.table.action.InsertOneByPstmtAction) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) ExportTableDefinitionAction(com.cubrid.common.ui.cubrid.table.action.ExportTableDefinitionAction) SelectByOnePstmtDataAction(com.cubrid.common.ui.cubrid.table.action.SelectByOnePstmtDataAction) DeleteTableAction(com.cubrid.common.ui.cubrid.table.action.DeleteTableAction) TableToJavaCodeAction(com.cubrid.common.ui.cubrid.table.action.TableToJavaCodeAction) ImportDataFromFileAction(com.cubrid.common.ui.cubrid.table.action.ImportDataFromFileAction)

Example 87 with ICubridNode

use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.

the class ColumnViewerSorter method getAllSelectedNodes.

/**
	 * Get all selected nodes
	 *
	 * @return
	 */
private ICubridNode[] getAllSelectedNodes() {
    TableItem[] items = tableListView.getTable().getSelection();
    ICubridNode[] nodes = null;
    if (items.length > 0) {
        List<ICubridNode> nodeList = new ArrayList<ICubridNode>();
        for (TableItem item : items) {
            TableDetailInfo tableInfo = (TableDetailInfo) item.getData();
            Set<String> typeSet = new HashSet<String>();
            typeSet.add(NodeType.USER_TABLE);
            typeSet.add(NodeType.USER_PARTITIONED_TABLE);
            ICubridNode tableNode = CommonUITool.findNode(database, typeSet, tableInfo.getTableName());
            if (tableNode != null) {
                nodeList.add(tableNode);
            }
        }
        nodes = new ICubridNode[nodeList.size()];
        return nodeList.toArray(nodes);
    }
    return nodes;
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem) ArrayList(java.util.ArrayList) TableDetailInfo(com.cubrid.common.core.common.model.TableDetailInfo) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) HashSet(java.util.HashSet)

Example 88 with ICubridNode

use of com.cubrid.common.ui.spi.model.ICubridNode 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 89 with ICubridNode

use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.

the class TableEditorPart method completeAll.

public void completeAll() {
    CommonUITool.openInformationBox(Messages.titleSuccess, Messages.bind(Messages.msgNull2DefComplete, jobName));
    if (this.isNewTableFlag) {
        ICubridNode node = database.getChild(database.getId() + ICubridNodeLoader.NODE_SEPARATOR + CubridTablesFolderLoader.TABLES_FOLDER_ID);
        if (node == null || !node.getLoader().isLoaded()) {
            return;
        }
        String id = node.getId() + ICubridNodeLoader.NODE_SEPARATOR + tableName;
        boolean isPartition = newSchemaInfo.getPartitionList() != null && newSchemaInfo.getPartitionList().size() > 0;
        ClassInfo newClassInfo = new ClassInfo(tableName, owner, ClassType.NORMAL, false, isPartition);
        ICubridNode newNode = CubridTablesFolderLoader.createUserTableNode(node, id, newClassInfo, node.getLoader().getLevel(), new NullProgressMonitor());
        if (CubridNavigatorView.findNavigationView() == null) {
            getSite().getWorkbenchWindow().getActivePage().closeEditor(editor, false);
            return;
        }
        TreeViewer treeViewer = CubridNavigatorView.findNavigationView().getViewer();
        if (treeViewer == null || treeViewer.getTree() == null || treeViewer.getTree().isDisposed()) {
            getSite().getWorkbenchWindow().getActivePage().closeEditor(editor, false);
            return;
        }
        CommonUITool.addNodeToTree(treeViewer, node, newNode);
        // refresh table folder count label
        CommonUITool.updateFolderNodeLabelIncludingChildrenCount(treeViewer, node);
        CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent(newNode, CubridNodeChangedEventType.NODE_ADD));
    } else {
        if (database == null) {
            return;
        }
        database.getDatabaseInfo().removeSchema(tableName);
        if (oldPartitionInfoList.isEmpty() && !partitionInfoList.isEmpty()) {
            editedTableNode.setIconPath("icons/navigator/schema_table_partition.png");
            editedTableNode.setType(NodeType.USER_PARTITIONED_TABLE_FOLDER);
            editedTableNode.setLoader(new CubridPartitionedTableLoader());
        } else if (!oldPartitionInfoList.isEmpty() && partitionInfoList.isEmpty()) {
            editedTableNode.setIconPath("icons/navigator/schema_table_item.png");
            editedTableNode.setType(NodeType.USER_TABLE);
            editedTableNode.setLoader(new CubridUserTableLoader());
        }
        TreeViewer treeViewer = CubridNavigatorView.findNavigationView().getViewer();
        if (treeViewer == null || treeViewer.getTree() == null || treeViewer.getTree().isDisposed()) {
            getSite().getWorkbenchWindow().getActivePage().closeEditor(editor, false);
            return;
        }
        CommonUITool.refreshNavigatorTree(treeViewer, editedTableNode);
        CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent(editedTableNode, CubridNodeChangedEventType.NODE_REFRESH));
        /* Broadcast the view changed */
        QueryEditorUtil.fireSchemaNodeChanged(editedTableNode);
    }
    getSite().getWorkbenchWindow().getActivePage().closeEditor(editor, false);
}
Also used : CubridPartitionedTableLoader(com.cubrid.common.ui.spi.model.loader.schema.CubridPartitionedTableLoader) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) TreeViewer(org.eclipse.jface.viewers.TreeViewer) CubridUserTableLoader(com.cubrid.common.ui.spi.model.loader.schema.CubridUserTableLoader) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) ClassInfo(com.cubrid.cubridmanager.core.cubrid.table.model.ClassInfo)

Example 90 with ICubridNode

use of com.cubrid.common.ui.spi.model.ICubridNode 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)

Aggregations

ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)362 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)67 ArrayList (java.util.ArrayList)67 DefaultSchemaNode (com.cubrid.common.ui.spi.model.DefaultSchemaNode)62 TreeViewer (org.eclipse.jface.viewers.TreeViewer)62 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)55 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)55 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)41 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)40 ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)33 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)32 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)31 ICubridNodeLoader (com.cubrid.common.ui.spi.model.ICubridNodeLoader)27 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)26 CubridGroupNode (com.cubrid.common.ui.spi.model.CubridGroupNode)25 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)25 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)25 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)25 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)23 CubridNavigatorView (com.cubrid.common.ui.common.navigator.CubridNavigatorView)22