use of com.cubrid.common.ui.spi.model.CubridDatabase in project cubrid-manager by CUBRID.
the class AddBackupPlanAction method run.
public void run() {
Object[] obj = this.getSelectedObj();
CubridDatabase database = null;
DefaultSchemaNode selection = null;
if (obj.length > 0 && obj[0] instanceof DefaultSchemaNode) {
selection = (DefaultSchemaNode) obj[0];
database = selection.getDatabase();
}
if (database == null) {
CommonUITool.openErrorBox(Messages.msgSelectDB);
return;
}
run(database);
}
use of com.cubrid.common.ui.spi.model.CubridDatabase in project cubrid-manager by CUBRID.
the class DeleteBackupPlanAction method isSupported.
/**
* Sets this action support this object
*
* @see org.eclipse.jface.action.IAction.ISelectionAction
* @param obj Object
* @return boolean
*/
public boolean isSupported(Object obj) {
if (obj instanceof ISchemaNode) {
ISchemaNode node = (ISchemaNode) obj;
CubridDatabase database = node.getDatabase();
if (CubridNodeType.BACKUP_PLAN.equals(node.getType()) && database != null && database.isLogined()) {
DbUserInfo dbUserInfo = database.getDatabaseInfo().getAuthLoginedDbUserInfo();
if (dbUserInfo != null && dbUserInfo.isDbaAuthority()) {
return true;
}
}
} else if (obj instanceof Object[]) {
Object[] objArr = (Object[]) obj;
CubridDatabase database = null;
for (Object object : objArr) {
DefaultSchemaNode node = (DefaultSchemaNode) object;
CubridDatabase db = node.getDatabase();
if (database == null) {
database = db;
} else if (!database.getId().equals(db.getId())) {
return false;
}
}
return true;
}
return false;
}
use of com.cubrid.common.ui.spi.model.CubridDatabase in project cubrid-manager by CUBRID.
the class DeleteBackupPlanAction method run.
/**
* Deletes the selected backup plan
*
*/
public void run(ISchemaNode[] nodeArray) {
List<String> nodeNames = new ArrayList<String>();
for (Object obj : nodeArray) {
ICubridNode selection = (ICubridNode) obj;
nodeNames.add(selection.getLabel());
}
if (!CommonUITool.openConfirmBox(Messages.bind(Messages.delBackupPlanConfirmContent, nodeNames))) {
return;
}
String taskName = Messages.bind(Messages.delBackupPlanTaskName, nodeNames);
CommonTaskExec taskExecutor = new CommonTaskExec(taskName);
for (Object obj : nodeArray) {
CubridDatabase database = null;
if (obj instanceof DefaultSchemaNode) {
database = ((DefaultSchemaNode) obj).getDatabase();
}
if (database == null) {
CommonUITool.openErrorBox(Messages.msgSelectDB);
return;
}
ServerInfo serverInfo = database.getServer().getServerInfo();
DelBackupPlanTask delBackupPlanTask = new DelBackupPlanTask(serverInfo);
delBackupPlanTask.setDbname(database.getName());
String backupid = ((DefaultSchemaNode) obj).getLabel();
delBackupPlanTask.setBackupid(backupid);
taskExecutor.addTask(delBackupPlanTask);
}
new ExecTaskWithProgress(taskExecutor).exec();
if (!taskExecutor.isSuccess()) {
return;
}
for (Object obj : nodeArray) {
TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
DefaultSchemaNode delNode = ((DefaultSchemaNode) obj);
ICubridNode parentNode = delNode.getParent();
parentNode.removeChild(delNode);
treeViewer.remove(delNode);
}
}
use of com.cubrid.common.ui.spi.model.CubridDatabase in project cubrid-manager by CUBRID.
the class DeleteQueryPlanAction method isSupported.
/**
* Sets this action support this object
*
* @see org.eclipse.jface.action.IAction.ISelectionAction
* @param obj Object
* @return boolean
*/
public boolean isSupported(Object obj) {
if (obj instanceof ISchemaNode) {
ISchemaNode node = (ISchemaNode) obj;
CubridDatabase database = node.getDatabase();
if (CubridNodeType.QUERY_PLAN.equals(node.getType()) && database != null && database.isLogined()) {
DbUserInfo dbUserInfo = database.getDatabaseInfo().getAuthLoginedDbUserInfo();
if (dbUserInfo != null && dbUserInfo.isDbaAuthority()) {
return true;
}
}
} else if (obj instanceof Object[]) {
Object[] objArr = (Object[]) obj;
CubridDatabase database = null;
for (Object object : objArr) {
DefaultSchemaNode node = (DefaultSchemaNode) object;
CubridDatabase db = node.getDatabase();
if (database == null) {
database = db;
} else if (!database.getId().equals(db.getId())) {
return false;
}
}
return true;
}
return false;
}
use of com.cubrid.common.ui.spi.model.CubridDatabase in project cubrid-manager by CUBRID.
the class MultiDatabaseLoginFailedDialog method editHost.
public void editHost(MultiDatabaseloginFailedInfo multiDatabaseloginFailedInfo) {
if (multiDatabaseloginFailedInfo == null) {
return;
}
CubridDatabase database = multiDatabaseloginFailedInfo.getCubridDatabase();
//if login ,can't edit
if (database.isLogined()) {
return;
}
// CubridDatabase oldDatabase = null;
// try {
// oldDatabase = database.clone();
// } catch (CloneNotSupportedException e) {
// //Ignore
// }
LoginDatabaseDialog dialog = new LoginDatabaseDialog(getShell(), database);
int returnVal = dialog.open();
if (returnVal == IDialogConstants.OK_ID) {
CubridNavigatorView view = CubridNavigatorView.getNavigatorView(CubridHostNavigatorView.ID);
TreeViewer treeViewer = view.getViewer();
database.removeAllChild();
if (database.getLoader() != null) {
database.getLoader().setLoaded(false);
}
treeViewer.refresh(database, true);
treeViewer.expandToLevel(database, 1);
/*Save the data*/
DatabaseEditorConfig editorConfig = QueryOptions.getEditorConfig(database, true);
if (editorConfig == null) {
editorConfig = new DatabaseEditorConfig();
}
editorConfig.setBackGround(dialog.getSelectedColor());
CMDBNodePersistManager.getInstance().addDatabase(database, editorConfig);
ActionManager.getInstance().fireSelectionChanged(treeViewer.getSelection());
LayoutManager.getInstance().fireSelectionChanged(treeViewer.getSelection());
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent(database, CubridNodeChangedEventType.DATABASE_LOGIN));
multiDatabaseloginFailedInfo.setErrMsg("");
}
databaseTable.refresh();
}
Aggregations