Search in sources :

Example 1 with OptimizeDialog

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());
    }
}
Also used : ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) GetClassListTask(com.cubrid.cubridmanager.core.cubrid.table.task.GetClassListTask) TreeViewer(org.eclipse.jface.viewers.TreeViewer) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) OptimizeDialog(com.cubrid.cubridmanager.ui.cubrid.database.dialog.OptimizeDialog)

Aggregations

CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)1 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)1 GetClassListTask (com.cubrid.cubridmanager.core.cubrid.table.task.GetClassListTask)1 OptimizeDialog (com.cubrid.cubridmanager.ui.cubrid.database.dialog.OptimizeDialog)1 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1