Search in sources :

Example 66 with ISchemaNode

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);
    }
}
Also used : ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) TransactionInfoDialog(com.cubrid.cubridmanager.ui.cubrid.database.dialog.TransactionInfoDialog)

Example 67 with ISchemaNode

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();
    }
}
Also used : ITask(com.cubrid.common.core.task.ITask) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) ArrayList(java.util.ArrayList) Shell(org.eclipse.swt.widgets.Shell) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ClassItem(com.cubrid.cubridmanager.core.cubrid.table.model.ClassItem) GetClassListTask(com.cubrid.cubridmanager.core.cubrid.table.task.GetClassListTask) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) UnloadDatabaseDialog(com.cubrid.cubridmanager.ui.cubrid.database.dialog.UnloadDatabaseDialog) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) DBClasses(com.cubrid.cubridmanager.core.cubrid.table.model.DBClasses)

Example 68 with ISchemaNode

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();
}
Also used : CheckDatabaseDialog(com.cubrid.cubridmanager.ui.cubrid.database.dialog.CheckDatabaseDialog) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Example 69 with ISchemaNode

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;
}
Also used : ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Example 70 with ISchemaNode

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;
}
Also used : ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Aggregations

ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)158 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)104 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)55 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)30 ArrayList (java.util.ArrayList)28 TreeViewer (org.eclipse.jface.viewers.TreeViewer)27 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)23 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)23 DefaultSchemaNode (com.cubrid.common.ui.spi.model.DefaultSchemaNode)22 DbUserInfo (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo)22 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)21 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)21 Shell (org.eclipse.swt.widgets.Shell)16 ITask (com.cubrid.common.core.task.ITask)13 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)13 IEditorPart (org.eclipse.ui.IEditorPart)12 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)12 HashSet (java.util.HashSet)11 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)11 PartInitException (org.eclipse.ui.PartInitException)10