use of com.cubrid.cubridmanager.ui.cubrid.database.dialog.OptimizeDialog in project cubrid-manager by CUBRID.
the class OptimizeAction method run.
public void run() {
Object[] obj = this.getSelectedObj();
if (!isSupported(obj[0])) {
setEnabled(false);
return;
}
ISchemaNode node = (ISchemaNode) obj[0];
final CubridDatabase database = node.getDatabase();
if (database == null) {
CommonUITool.openErrorBox(getShell(), Messages.msgSelectDB);
return;
}
OptimizeDialog dlg = new OptimizeDialog();
GetClassListTask task = new GetClassListTask(database.getServer().getServerInfo(), database.getDatabaseInfo().getCharSet());
task.setDbName(database.getName());
if (database.getDatabaseInfo().getRunningType() == DbRunningType.STANDALONE) {
task.setDbStatus(OnOffType.OFF);
} else {
task.setDbStatus(OnOffType.ON);
}
dlg.executeGetClassListTask(-1, task, true, getShell());
if (task.getErrorMsg() != null || task.isCancel()) {
return;
}
dlg.setDatabase(database);
dlg.setUserClassList(task.getDbClassInfo().getUserClassList().getClassList());
if (dlg.open() == DeleteDatabaseDialog.DELETE_ID) {
ISelectionProvider provider = getSelectionProvider();
if (provider instanceof TreeViewer) {
TreeViewer treeViewer = (TreeViewer) provider;
CommonUITool.refreshNavigatorTree(treeViewer, database.getParent());
setEnabled(false);
}
ActionManager.getInstance().fireSelectionChanged(getSelection());
}
}
Aggregations