use of com.cubrid.common.ui.spi.model.CubridDatabase 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.CubridDatabase 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.CubridDatabase 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;
}
use of com.cubrid.common.ui.spi.model.CubridDatabase in project cubrid-manager by CUBRID.
the class DeleteDatabaseAction method run.
public void run() {
Object[] obj = this.getSelectedObj();
if (!isSupported(obj[0])) {
setEnabled(false);
return;
}
ISelectionProvider provider = this.getSelectionProvider();
if (!(provider instanceof TreeViewer)) {
return;
}
ISchemaNode node = (ISchemaNode) obj[0];
CubridDatabase database = node.getDatabase();
if (database == null) {
CommonUITool.openErrorBox(getShell(), Messages.msgSelectDB);
return;
}
CommonQueryTask<DbSpaceInfoList> task = new CommonQueryTask<DbSpaceInfoList>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoList());
task.setDbName(database.getName());
TaskExecutor taskExcutor = new CommonTaskExec(Messages.getDbSpaceInfoTaskName);
taskExcutor.addTask(task);
new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
if (!taskExcutor.isSuccess()) {
return;
}
DeleteDatabaseDialog dlg = new DeleteDatabaseDialog(getShell());
dlg.setDbSpaceInfo(task.getResultModel());
dlg.setDatabase(database);
ICubridNode parent = database.getParent();
if (dlg.open() == DeleteDatabaseDialog.DELETE_ID) {
boolean isContinue = DatabaseUtils.processDatabaseDeleted(database);
if (isContinue) {
TreeViewer viewer = (TreeViewer) provider;
parent.removeChild(database);
viewer.remove(parent, obj);
viewer.setSelection(new StructuredSelection(parent));
}
}
}
use of com.cubrid.common.ui.spi.model.CubridDatabase in project cubrid-manager by CUBRID.
the class LoadDatabaseAction 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 LoadDatabaseDialog dialog = new LoadDatabaseDialog(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.loadDbUnloadInfoTaskName, 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 GetDbUnloadInfoTask) {
GetDbUnloadInfoTask getDbUnloadInfoTask = (GetDbUnloadInfoTask) task;
List<DbUnloadInfo> dbUnloadInfoList = getDbUnloadInfoTask.getDbUnloadInfoList();
dialog.setDbUnloadInfoList(dbUnloadInfoList);
}
}
return true;
}
};
ServerInfo serverInfo = database.getServer().getServerInfo();
GetDbUnloadInfoTask task = new GetDbUnloadInfoTask(serverInfo);
taskExcutor.addTask(task);
new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
if (taskExcutor.isSuccess()) {
dialog.open();
}
}
Aggregations