Search in sources :

Example 1 with InputTextDialog

use of com.cubrid.common.ui.spi.table.button.InputTextDialog in project cubrid-manager by CUBRID.

the class TableDashboardComposite method showEditDialog.

public void showEditDialog(Table table, int index) {
    SchemaInfo info = getData();
    if (info == null) {
        return;
    }
    List<DBAttribute> attrs = info.getAttributes();
    if (attrs == null) {
        return;
    }
    if (index >= attrs.size()) {
        return;
    }
    DBAttribute attr = attrs.get(index);
    if (attr == null) {
        return;
    }
    InputTextDialog dialog = new InputTextDialog(Display.getCurrent().getActiveShell(), com.cubrid.common.ui.cubrid.table.Messages.titleColumnDescEditor, com.cubrid.common.ui.cubrid.table.Messages.msgColumnDescEditor, com.cubrid.common.ui.cubrid.table.Messages.labelColumnDescEditor, attr.getDescription());
    if (dialog.open() == IDialogConstants.OK_ID) {
        // FIXME move this logic to core module
        String tableName = info.getClassname();
        String columnName = attr.getName();
        String description = dialog.getResult();
        Connection conn = null;
        try {
            conn = JDBCConnectionManager.getConnection(databaseInfo, true);
            SchemaCommentHandler.updateDescription(databaseInfo, conn, tableName, columnName, description);
            attr.setDescription(description);
            columnTableView.setInput(info);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            QueryUtil.commit(conn);
            QueryUtil.freeQuery(conn);
        }
    }
}
Also used : InputTextDialog(com.cubrid.common.ui.spi.table.button.InputTextDialog) DBAttribute(com.cubrid.common.core.common.model.DBAttribute) Connection(java.sql.Connection) SchemaInfo(com.cubrid.common.core.common.model.SchemaInfo)

Example 2 with InputTextDialog

use of com.cubrid.common.ui.spi.table.button.InputTextDialog in project cubrid-manager by CUBRID.

the class ColumnViewerSorter method showEditDialog.

public void showEditDialog(Table table, int index) {
    if (tableListView.getTable().getItemCount() < index) {
        return;
    }
    TableItem item = table.getItem(index);
    Object objData = item.getData();
    if (objData != null && objData instanceof TableDetailInfo) {
        TableDetailInfo info = (TableDetailInfo) objData;
        InputTextDialog dialog = new InputTextDialog(Display.getCurrent().getActiveShell(), Messages.titleTableDescEditor, Messages.msgTableDescEditor, Messages.labelTableDescEditor, info.getTableDesc());
        if (dialog.open() == IDialogConstants.OK_ID) {
            String tableName = info.getTableName();
            String columnName = null;
            String description = dialog.getResult();
            Connection conn = null;
            try {
                conn = JDBCConnectionManager.getConnection(database.getDatabaseInfo(), true);
                SchemaCommentHandler.updateDescription(database.getDatabaseInfo(), conn, tableName, columnName, description);
                info.setTableDesc(description);
                tableListView.setInput(tableList);
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                QueryUtil.commit(conn);
                QueryUtil.freeQuery(conn);
            }
        }
    //For bug TOOLS-3324
    //			if (info != null) {
    //				openTableDetail(info);
    //			}
    }
}
Also used : InputTextDialog(com.cubrid.common.ui.spi.table.button.InputTextDialog) TableItem(org.eclipse.swt.widgets.TableItem) TableDetailInfo(com.cubrid.common.core.common.model.TableDetailInfo) Connection(java.sql.Connection) PartInitException(org.eclipse.ui.PartInitException) SQLException(java.sql.SQLException)

Aggregations

InputTextDialog (com.cubrid.common.ui.spi.table.button.InputTextDialog)2 Connection (java.sql.Connection)2 DBAttribute (com.cubrid.common.core.common.model.DBAttribute)1 SchemaInfo (com.cubrid.common.core.common.model.SchemaInfo)1 TableDetailInfo (com.cubrid.common.core.common.model.TableDetailInfo)1 SQLException (java.sql.SQLException)1 TableItem (org.eclipse.swt.widgets.TableItem)1 PartInitException (org.eclipse.ui.PartInitException)1