use of com.cubrid.common.ui.spi.model.ISchemaNode in project cubrid-manager by CUBRID.
the class TransactionInfoAction 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;
}
TransactionInfoDialog dlg = new TransactionInfoDialog(getShell());
dlg.setDatabase(database);
try {
if (dlg.loadData(getShell())) {
dlg.open();
}
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
}
}
use of com.cubrid.common.ui.spi.model.ISchemaNode in project cubrid-manager by CUBRID.
the class UnloadDatabaseAction 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();
final UnloadDatabaseDialog dialog = new UnloadDatabaseDialog(getShell());
dialog.setDatabase(database);
final Shell shell = getShell();
TaskExecutor taskExcutor = new TaskExecutor() {
public boolean exec(final IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return false;
}
monitor.beginTask(Messages.loadAllClassTaskName, IProgressMonitor.UNKNOWN);
for (ITask task : taskList) {
task.execute();
final String msg = task.getErrorMsg();
if (openErrorBox(shell, msg, monitor)) {
return false;
}
if (monitor.isCanceled()) {
return false;
}
if (task instanceof GetClassListTask) {
GetClassListTask getClassListTask = (GetClassListTask) task;
List<String> allUserClassList = new ArrayList<String>();
DBClasses dbClasses = getClassListTask.getDbClassInfo();
List<ClassItem> userClassList = dbClasses == null ? null : dbClasses.getUserClassList().getClassList();
if (userClassList != null && !userClassList.isEmpty()) {
for (ClassItem userClass : userClassList) {
allUserClassList.add(userClass.getClassname());
}
}
Collections.sort(allUserClassList);
dialog.setUserClassList(allUserClassList);
}
}
return true;
}
};
ServerInfo serverInfo = database.getServer().getServerInfo();
GetClassListTask task = new GetClassListTask(serverInfo, database.getDatabaseInfo().getCharSet());
task.setDbName(database.getLabel());
task.setDbStatus(OnOffType.OFF);
taskExcutor.addTask(task);
new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
if (taskExcutor.isSuccess()) {
dialog.open();
}
}
use of com.cubrid.common.ui.spi.model.ISchemaNode in project cubrid-manager by CUBRID.
the class CheckDatabaseAction method run.
public void run() {
Object[] obj = this.getSelectedObj();
if (!isSupported(obj[0])) {
setEnabled(false);
return;
}
ISchemaNode node = (ISchemaNode) obj[0];
CubridDatabase database = node.getDatabase();
if (database == null) {
CommonUITool.openErrorBox(getShell(), Messages.msgSelectDB);
return;
}
CheckDatabaseDialog dlg = new CheckDatabaseDialog(getShell());
dlg.setDatabase(database);
dlg.open();
}
use of com.cubrid.common.ui.spi.model.ISchemaNode in project cubrid-manager by CUBRID.
the class CompactDatabaseAction method isSupported.
public boolean isSupported(Object obj) {
if (!ActionSupportUtil.hasAdminPermission(obj)) {
return false;
}
ISchemaNode node = (ISchemaNode) obj;
CubridDatabase database = node.getDatabase();
if (database == null) {
return false;
}
ServerInfo serverInfo = database.getServer() == null ? null : database.getServer().getServerInfo();
if (serverInfo == null) {
return false;
}
boolean canOnlineCompactDb = CompatibleUtil.isSupportOnlineCompactDb(serverInfo);
boolean isOnline = database.getRunningType() == DbRunningType.CS;
boolean isOffline = database.getRunningType() == DbRunningType.STANDALONE;
return isOffline || isOnline && canOnlineCompactDb;
}
use of com.cubrid.common.ui.spi.model.ISchemaNode in project cubrid-manager by CUBRID.
the class DatabaseStatusViewAction method isSupported.
public boolean isSupported(Object obj) {
if (obj instanceof ISchemaNode) {
ISchemaNode node = (ISchemaNode) obj;
CubridDatabase database = node.getDatabase();
boolean isDbNode = CubridNodeType.DATABASE.equals(node.getType());
boolean isDbSpcFolderNode = CubridNodeType.DBSPACE_FOLDER.equals(node.getType());
if ((isDbNode || isDbSpcFolderNode) && database.isLogined()) {
return true;
}
}
return false;
}
Aggregations