コード例 #1
0
 protected String getNewColumnName(DBECommandContext context, TABLE_TYPE table) {
   for (int i = 1; ; i++) {
     final String name =
         DBObjectNameCaseTransformer.transformName(table.getDataSource(), "Column" + i);
     try {
       // check for existing columns
       boolean exists = table.getAttribute(VoidProgressMonitor.INSTANCE, name) != null;
       if (!exists) {
         // Check for new columns (they are present only within command context)
         for (DBPObject contextObject : context.getEditedObjects()) {
           if (contextObject instanceof JDBCTableColumn
               && ((JDBCTableColumn) contextObject).getTable() == table
               && name.equalsIgnoreCase(((JDBCTableColumn) contextObject).getName())) {
             exists = true;
             break;
           }
         }
       }
       if (!exists) {
         return name;
       }
     } catch (DBException e) {
       log.warn(e);
       return name;
     }
   }
 }
コード例 #2
0
 @Override
 protected DBEPersistAction[] makeObjectCreateActions(ObjectCreateCommand command) {
   final TABLE_TYPE table = command.getObject().getTable();
   return new DBEPersistAction[] {
     new SQLDatabasePersistAction(
         ModelMessages.model_jdbc_create_new_table_column,
         "ALTER TABLE "
             + table.getFullQualifiedName()
             + " ADD "
             + getNestedDeclaration(table, command))
   }; //$NON-NLS-1$ //$NON-NLS-2$
 }
コード例 #3
0
 @Override
 public boolean canCreateObject(TABLE_TYPE parent) {
   return parent != null && !parent.isView();
 }
コード例 #4
0
 @Override
 public boolean canEditObject(OBJECT_TYPE object) {
   TABLE_TYPE table = object.getParentObject();
   return table != null && !table.isView();
 }