use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.
the class CubridTablesFolderLoader method createUserTableNodes.
/**
* Create user table node
*
* @param parent ICubridNode
* @param allClassInfoList A list includes all the class info
* @param level The load level
* @param monitor The IProgressMonitor
*/
private void createUserTableNodes(ICubridNode parent, List<ClassInfo> allClassInfoList, int level, IProgressMonitor monitor) {
List<String> tables = new ArrayList<String>();
for (ClassInfo classInfo : allClassInfoList) {
String id = parent.getId() + NODE_SEPARATOR + classInfo.getClassName();
ICubridNode classNode = new DefaultSchemaNode(id, classInfo.getClassName(), "icons/navigator/schema_table_item.png");
classNode.setEditorId(SchemaInfoEditorPart.ID);
classNode.setContainer(true);
classNode.setModelObj(classInfo);
classNode.setType(NodeType.USER_TABLE);
parent.addChild(classNode);
ICubridNodeLoader loader = null;
if (classInfo.isPartitionedClass()) {
classNode.setType(NodeType.USER_PARTITIONED_TABLE_FOLDER);
classNode.setIconPath("icons/navigator/schema_table_partition.png");
classNode.setContainer(true);
loader = new CubridPartitionedTableLoader();
} else {
loader = new CubridUserTableLoader();
}
loader.setLevel(level);
classNode.setLoader(loader);
tables.add(classInfo.getClassName());
}
if (level == DEFINITE_LEVEL) {
CubridDatabase database = ((ISchemaNode) parent).getDatabase();
DatabaseInfo databaseInfo = database.getDatabaseInfo();
final GetUserClassColumnsTask task = new GetUserClassColumnsTask(databaseInfo);
monitorCancel(monitor, new ITask[] { task });
Map<String, List<TableColumn>> columnsOfTable = task.getColumns(tables);
final String errorMsg = task.getErrorMsg();
if (!monitor.isCanceled() && !task.isInTransation() && errorMsg != null && errorMsg.trim().length() > 0) {
Display display = Display.getDefault();
display.syncExec(new Runnable() {
public void run() {
CommonUITool.openErrorBox(errorMsg);
}
});
parent.removeAllChild();
setLoaded(true);
return;
}
if (monitor.isCanceled()) {
setLoaded(true);
return;
}
for (ClassInfo classInfo : allClassInfoList) {
String tableId = parent.getId() + NODE_SEPARATOR + classInfo.getClassName();
ICubridNode node = parent.getChild(tableId);
CubridUserTableLoader tableLoader = (CubridUserTableLoader) node.getLoader();
tableLoader.setColumns(columnsOfTable.get(classInfo.getClassName()));
node.getChildren(monitor);
tableLoader.setLoaded(true);
}
}
}
use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.
the class CubridUserTableLoader method loadColumns.
/**
* Load the columns and its children node
*
* @param parent the parent node
* @param level the node level
* @param monitor the IProgressMonitor object
*/
protected void loadColumns(ICubridNode parent, int level, final IProgressMonitor monitor) {
String columnFolderId = parent.getId() + NODE_SEPARATOR + COLUMN_FOLDER_ID;
ICubridNode columnFolder = parent.getChild(columnFolderId);
if (columnFolder == null) {
columnFolder = new DefaultSchemaNode(columnFolderId, COLUMN_FOLDER_NAME, "icons/navigator/folder.png");
columnFolder.setType(NodeType.TABLE_COLUMN_FOLDER);
columnFolder.setContainer(true);
parent.addChild(columnFolder);
CubridUserTableColumnLoader columnLoader = new CubridUserTableColumnLoader();
columnLoader.setLevel(level);
columnFolder.setLoader(columnLoader);
if (level == DEFINITE_LEVEL) {
columnLoader.setColumns(columns);
columnFolder.getChildren(monitor);
}
} else {
if (columnFolder.getLoader() != null && columnFolder.getLoader().isLoaded()) {
columnFolder.getLoader().setLoaded(false);
columnFolder.getChildren(monitor);
}
}
columns = null;
}
use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.
the class CubridViewsFolderLoader method createUserViewNode.
/**
*
* Create user view node
*
* @param id The node id
* @param classInfo The model object
* @return ICubridNode
*/
public static ICubridNode createUserViewNode(String id, ClassInfo classInfo) {
ICubridNode classNode = new DefaultSchemaNode(id, classInfo.getClassName(), "icons/navigator/schema_view_item.png");
classNode.setType(NodeType.USER_VIEW);
classNode.setEditorId(SchemaInfoEditorPart.ID);
classNode.setContainer(false);
classNode.setModelObj(classInfo);
return classNode;
}
use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.
the class CubridSerialFolderLoader method createSerialNode.
/**
*
* Create serial node
*
* @param id The node id
* @param serialInfo The model object
* @return ICubridNode
*/
public static ICubridNode createSerialNode(String id, SerialInfo serialInfo) {
ICubridNode serialNode = new DefaultSchemaNode(id, serialInfo.getName(), "icons/navigator/serial_item.png");
serialNode.setId(id);
serialNode.setType(NodeType.SERIAL);
serialNode.setModelObj(serialInfo);
serialNode.setContainer(false);
return serialNode;
}
use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.
the class CubridTriggerFolderLoader method createTriggerNode.
/**
*
* Create trigger node
*
* @param id The node id
* @param trigger The model object
* @return ICubridNode
*/
public static ICubridNode createTriggerNode(String id, Trigger trigger) {
ICubridNode triggerNode = new DefaultSchemaNode(id, trigger.getName(), "icons/navigator/trigger_item.png");
triggerNode.setType(NodeType.TRIGGER);
triggerNode.setModelObj(trigger);
triggerNode.setContainer(false);
return triggerNode;
}
Aggregations