use of com.cubrid.common.ui.spi.event.CubridNodeChangedEvent in project cubrid-manager by CUBRID.
the class CubridSerialFolderLoader method load.
/**
*
* Load children object for parent
*
* @param parent the parent node
* @param monitor the IProgressMonitor object
*/
public void load(ICubridNode parent, final IProgressMonitor monitor) {
synchronized (this) {
if (isLoaded()) {
return;
}
CubridDatabase database = ((ISchemaNode) parent).getDatabase();
if (!database.isLogined() || database.getRunningType() == DbRunningType.STANDALONE) {
database.getDatabaseInfo().setSerialInfoList(null);
parent.removeAllChild();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
return;
}
DatabaseInfo databaseInfo = database.getDatabaseInfo();
final GetSerialInfoListTask task = new GetSerialInfoListTask(databaseInfo);
monitorCancel(monitor, new ITask[] { task });
task.execute();
final String errorMsg = task.getErrorMsg();
if (!monitor.isCanceled() && errorMsg != null && errorMsg.trim().length() > 0) {
parent.removeAllChild();
openErrorBox(errorMsg);
setLoaded(true);
return;
}
if (monitor.isCanceled()) {
setLoaded(true);
return;
}
parent.removeAllChild();
List<SerialInfo> serialInfoList = task.getSerialInfoList();
List<SerialInfo> authSerialInfoList = new ArrayList<SerialInfo>();
if (serialInfoList != null && !serialInfoList.isEmpty()) {
for (SerialInfo serialInfo : serialInfoList) {
authSerialInfoList.add(serialInfo);
String id = parent.getId() + NODE_SEPARATOR + serialInfo.getName();
ICubridNode serialNode = createSerialNode(id, serialInfo);
parent.addChild(serialNode);
}
}
databaseInfo.setSerialInfoList(authSerialInfoList);
Collections.sort(parent.getChildren());
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
use of com.cubrid.common.ui.spi.event.CubridNodeChangedEvent in project cubrid-manager by CUBRID.
the class CubridPartitionedTableLoader method load.
/**
*
* Load children object for parent
*
* @param parent the parent node
* @param monitor the IProgressMonitor object
*/
public void load(ICubridNode parent, final IProgressMonitor monitor) {
synchronized (this) {
if (isLoaded()) {
return;
}
CubridDatabase database = ((ISchemaNode) parent).getDatabase();
if (!database.isLogined() || database.getRunningType() == DbRunningType.STANDALONE) {
parent.removeAllChild();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
return;
}
DatabaseInfo databaseInfo = database.getDatabaseInfo();
final GetPartitionedClassListTask task = new GetPartitionedClassListTask(databaseInfo);
monitorCancel(monitor, new ITask[] { task });
List<ClassInfo> classInfoList = task.getAllPartitionedClassInfoList(parent.getLabel());
final String errorMsg = task.getErrorMsg();
if (!monitor.isCanceled() && errorMsg != null && errorMsg.trim().length() > 0) {
parent.removeAllChild();
Display display = Display.getDefault();
display.syncExec(new Runnable() {
public void run() {
CommonUITool.openErrorBox(errorMsg);
}
});
setLoaded(true);
return;
}
if (monitor.isCanceled()) {
setLoaded(true);
return;
}
parent.removeAllChild();
if (classInfoList != null && !classInfoList.isEmpty()) {
for (ClassInfo clasInfo : classInfoList) {
String id = parent.getId() + NODE_SEPARATOR + clasInfo.getClassName();
ICubridNode partitionedClassNode = new DefaultSchemaNode(id, clasInfo.getClassName(), "icons/navigator/schema_table_item.png");
partitionedClassNode.setType(NodeType.USER_PARTITIONED_TABLE);
partitionedClassNode.setModelObj(clasInfo);
partitionedClassNode.setContainer(false);
partitionedClassNode.setEditorId(SchemaInfoEditorPart.ID);
parent.addChild(partitionedClassNode);
}
}
database.getDatabaseInfo().addPartitionedTableList(parent.getLabel(), classInfoList);
Collections.sort(parent.getChildren());
loadColumns(parent, getLevel(), monitor);
loadIndexes(parent, getLevel(), monitor);
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
use of com.cubrid.common.ui.spi.event.CubridNodeChangedEvent in project cubrid-manager by CUBRID.
the class CubridSystemViewFolderLoader method load.
/**
*
* Load children object for parent
*
* @param parent the parent node
* @param monitor the IProgressMonitor object
*/
public void load(ICubridNode parent, final IProgressMonitor monitor) {
synchronized (this) {
if (isLoaded()) {
return;
}
CubridDatabase database = ((ISchemaNode) parent).getDatabase();
if (!database.isLogined() || database.getRunningType() == DbRunningType.STANDALONE) {
database.getDatabaseInfo().setSysViewInfoList(null);
parent.removeAllChild();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
return;
}
DatabaseInfo databaseInfo = database.getDatabaseInfo();
final GetAllClassListTask task = new GetAllClassListTask(databaseInfo);
monitorCancel(monitor, new ITask[] { task });
List<ClassInfo> allClassInfoList = task.getSchema(false, false);
final String errorMsg = task.getErrorMsg();
if (!monitor.isCanceled() && errorMsg != null && errorMsg.trim().length() > 0) {
parent.removeAllChild();
openErrorBox(errorMsg);
setLoaded(true);
return;
}
if (monitor.isCanceled()) {
setLoaded(true);
return;
}
parent.removeAllChild();
if (allClassInfoList != null) {
for (ClassInfo classInfo : allClassInfoList) {
String id = parent.getId() + NODE_SEPARATOR + classInfo.getClassName();
ICubridNode classNode = new DefaultSchemaNode(id, classInfo.getClassName(), "icons/navigator/schema_view_item.png");
classNode.setType(NodeType.SYSTEM_VIEW);
classNode.setEditorId(SchemaInfoEditorPart.ID);
classNode.setContainer(false);
classNode.setModelObj(classInfo);
parent.addChild(classNode);
}
}
database.getDatabaseInfo().setSysViewInfoList(allClassInfoList);
Collections.sort(parent.getChildren());
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
use of com.cubrid.common.ui.spi.event.CubridNodeChangedEvent in project cubrid-manager by CUBRID.
the class CubridTablesFolderLoader method load.
/**
*
* Load children object for parent
*
* @param parent the parent node
* @param monitor the IProgressMonitor object
*/
public void load(ICubridNode parent, final IProgressMonitor monitor) {
synchronized (this) {
if (isLoaded()) {
return;
}
CubridDatabase database = ((ISchemaNode) parent).getDatabase();
if (!database.isLogined() || database.getRunningType() == DbRunningType.STANDALONE) {
database.getDatabaseInfo().setUserTableInfoList(null);
database.getDatabaseInfo().setSysTableInfoList(null);
database.getDatabaseInfo().setPartitionedTableMap(null);
database.getDatabaseInfo().clearSchemas();
parent.removeAllChild();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
return;
}
DatabaseInfo databaseInfo = database.getDatabaseInfo();
final GetAllClassListTask task = new GetAllClassListTask(databaseInfo);
monitorCancel(monitor, new ITask[] { task });
List<ClassInfo> allClassInfoList = task.getSchema(true, true);
final String errorMsg = task.getErrorMsg();
if (!monitor.isCanceled() && errorMsg != null && errorMsg.trim().length() > 0) {
parent.removeAllChild();
openErrorBox(errorMsg);
setLoaded(true);
return;
}
if (monitor.isCanceled()) {
setLoaded(true);
return;
}
// add system table folder
String systemTableFolderId = parent.getId() + NODE_SEPARATOR + SYSTEM_TABLE_FOLDER_ID;
ICubridNode systemTableFolder = parent.getChild(systemTableFolderId);
parent.removeAllChild();
if (systemTableFolder == null) {
systemTableFolder = new DefaultSchemaNode(systemTableFolderId, SYSTEM_TABLE_FOLDER_NAME, "icons/navigator/folder_sys.png");
systemTableFolder.setType(NodeType.SYSTEM_TABLE_FOLDER);
systemTableFolder.setContainer(true);
ICubridNodeLoader loader = new CubridSystemTableFolderLoader();
loader.setLevel(getLevel());
systemTableFolder.setLoader(loader);
parent.addChild(systemTableFolder);
if (getLevel() == DEFINITE_LEVEL) {
systemTableFolder.getChildren(monitor);
}
} else {
parent.addChild(systemTableFolder);
if (systemTableFolder.getLoader() != null && systemTableFolder.getLoader().isLoaded()) {
systemTableFolder.getLoader().setLoaded(false);
systemTableFolder.getChildren(monitor);
}
}
if (allClassInfoList != null) {
createUserTableNodes(parent, allClassInfoList, getLevel(), monitor);
}
database.getDatabaseInfo().setUserTableInfoList(allClassInfoList);
database.getDatabaseInfo().clearSchemas();
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
use of com.cubrid.common.ui.spi.event.CubridNodeChangedEvent in project cubrid-manager by CUBRID.
the class AddBackupPlanAction method run.
/**
* Creates a Dialog which is the instance of EditBackupPlanDialog to add a backup plan
*
* @param database
*/
public void run(CubridDatabase database) {
TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
ICubridNode jobAutoFolderNode = database.getChild(database.getId() + ICubridNodeLoader.NODE_SEPARATOR + CubridDatabaseLoader.JOB_AUTO_FOLDER_ID);
DefaultSchemaNode buckupPlanFolderNode = (DefaultSchemaNode) jobAutoFolderNode.getChild(jobAutoFolderNode.getId() + ICubridNodeLoader.NODE_SEPARATOR + CubridJobAutoFolderLoader.BACKUP_PLAN_FOLDER_ID);
EditBackupPlanDialog editBackupPlanDlg = new EditBackupPlanDialog(getShell(), true);
editBackupPlanDlg.setOperation(AddEditType.ADD);
editBackupPlanDlg.initPara(buckupPlanFolderNode);
if (editBackupPlanDlg.open() == Dialog.OK) {
BackupPlanInfo backupPlanInfo = editBackupPlanDlg.getBackupPlanInfo();
String newBackupId = backupPlanInfo.getBackupid();
DefaultSchemaNode newNode = new DefaultSchemaNode(newBackupId, newBackupId, ICON_PATH);
newNode.setContainer(false);
newNode.setType(CubridNodeType.BACKUP_PLAN);
newNode.setModelObj(backupPlanInfo);
buckupPlanFolderNode.addChild(newNode);
treeViewer.add(buckupPlanFolderNode, newNode);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent(newNode, CubridNodeChangedEventType.NODE_ADD));
} else {
canceledTask = true;
}
}
Aggregations