Search in sources :

Example 1 with TableEditButtonSupport

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

the class ColumnViewerSorter method setInputs.

public void setInputs() {
    tableListView.setInput(tableList);
    tableListView.refresh();
    Connection connection = null;
    try {
        connection = JDBCConnectionManager.getConnection(database.getDatabaseInfo(), true);
        isSchemaCommentInstalled = SchemaCommentHandler.isInstalledMetaTable(database.getDatabaseInfo(), connection);
        TableDashboardComposite tableComp = new TableDashboardComposite(tabFolder, SWT.NONE);
        tableComp.initialize();
        if (database.getDatabaseInfo().getUserTableInfoList().size() > 0) {
            ClassInfo classInfo = database.getDatabaseInfo().getUserTableInfoList().get(0);
            SchemaInfo schemaInfo = database.getDatabaseInfo().getSchemaInfo(connection, classInfo.getClassName());
            IDatabaseSpec dbSpec = database.getDatabaseInfo();
            if (schemaInfo != null && SchemaCommentHandler.isInstalledMetaTable(dbSpec, connection)) {
                Map<String, SchemaComment> comments = SchemaCommentHandler.loadDescription(dbSpec, connection, classInfo.getClassName());
                if (comments != null) {
                    SchemaCommentHandler.bindSchemaInfo(comments, schemaInfo);
                }
            }
            tableComp.setInput(schemaInfo, database.getDatabaseInfo(), isSchemaCommentInstalled);
        }
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
    } finally {
        QueryUtil.freeQuery(connection);
    }
    if (isSchemaCommentInstalled) {
        new TableEditButtonSupport(tableListView, this, 1);
    }
}
Also used : TableEditButtonSupport(com.cubrid.common.ui.spi.table.button.TableEditButtonSupport) IDatabaseSpec(com.cubrid.common.core.common.model.IDatabaseSpec) Connection(java.sql.Connection) SchemaComment(com.cubrid.common.core.schemacomment.model.SchemaComment) PartInitException(org.eclipse.ui.PartInitException) SQLException(java.sql.SQLException) ClassInfo(com.cubrid.cubridmanager.core.cubrid.table.model.ClassInfo) SchemaInfo(com.cubrid.common.core.common.model.SchemaInfo)

Aggregations

IDatabaseSpec (com.cubrid.common.core.common.model.IDatabaseSpec)1 SchemaInfo (com.cubrid.common.core.common.model.SchemaInfo)1 SchemaComment (com.cubrid.common.core.schemacomment.model.SchemaComment)1 TableEditButtonSupport (com.cubrid.common.ui.spi.table.button.TableEditButtonSupport)1 ClassInfo (com.cubrid.cubridmanager.core.cubrid.table.model.ClassInfo)1 Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 PartInitException (org.eclipse.ui.PartInitException)1