Search in sources :

Example 1 with CloneTableDialog

use of com.cubrid.common.ui.cubrid.table.dialog.CloneTableDialog in project cubrid-manager by CUBRID.

the class MakeCloneQueryAction method run.

/**
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    final Object[] obj = this.getSelectedObj();
    if (!isSupported(obj)) {
        setEnabled(false);
        return;
    }
    final DefaultSchemaNode tableNode = (DefaultSchemaNode) obj[0];
    CubridDatabase db = tableNode.getDatabase();
    DatabaseInfo dbInfo = db.getDatabaseInfo();
    GetTablesTask getTableTask = new GetTablesTask(dbInfo);
    List<String> tableList = getTableTask.getAllTableAndViews();
    String tableName = null;
    if (NodeType.USER_TABLE.equals(tableNode.getType())) {
        tableName = tableNode.getName();
    }
    final CloneTableDialog dialog = new CloneTableDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), tableList, tableName);
    if (IDialogConstants.OK_ID == dialog.open()) {
        targetName = dialog.getTargetName();
        ICubridNode[] nodeArray = { tableNode };
        super.doRun(nodeArray);
    }
}
Also used : DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) CloneTableDialog(com.cubrid.common.ui.cubrid.table.dialog.CloneTableDialog) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) GetTablesTask(com.cubrid.cubridmanager.core.cubrid.table.task.GetTablesTask)

Aggregations

CloneTableDialog (com.cubrid.common.ui.cubrid.table.dialog.CloneTableDialog)1 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)1 DefaultSchemaNode (com.cubrid.common.ui.spi.model.DefaultSchemaNode)1 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)1 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)1 GetTablesTask (com.cubrid.cubridmanager.core.cubrid.table.task.GetTablesTask)1