use of com.cubrid.common.ui.spi.model.loader.schema.CubridPartitionedTableLoader 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);
}
Aggregations