Skip to content

Commit

Permalink
dbeaver/dbeaver-ee#1771 add child types for sqlite (#17561)
Browse files Browse the repository at this point in the history
* dbeaver/dbeaver-ee#1771 add child types for sqlite

* dbeaver/dbeaver-ee#1771 Check and create an association asynchronously

Co-authored-by: ShadelessFox <yanuari.channel@gmail.com>
  • Loading branch information
Destrolaric and ShadelessFox committed Sep 28, 2022
1 parent 4b2adb1 commit 8a3354f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
Expand Up @@ -393,15 +393,15 @@ public void handleDataSourceEvent(DBPEvent event)
} else if (entityAssociation != null) {
ERDEntity erdEntity = diagram.getEntity(entity);
ERDEntity targetEntity = diagram.getEntity(entityAssociation.getAssociatedEntity());
if (erdEntity != null &&
erdEntity.getAssociation(entityAssociation) == null &&
erdEntity.getReferenceAssociation(entityAssociation) == null)
{
DBSEntityAssociation addedAssociation = entityAssociation;
UIUtils.asyncExec(() -> {
DBSEntityAssociation addedAssociation = entityAssociation;
UIUtils.asyncExec(() -> {
if (erdEntity != null &&
erdEntity.getAssociation(addedAssociation) == null &&
erdEntity.getReferenceAssociation(addedAssociation) == null)
{
new ERDAssociation(addedAssociation, erdEntity, targetEntity, true);
});
}
}
});
} else {
// New entity. Add it if it has the same object container
// or if this entity was created from the same editor
Expand Down
Expand Up @@ -19,15 +19,18 @@
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.generic.edit.GenericTableManager;
import org.jkiss.dbeaver.ext.generic.model.GenericDataSource;
import org.jkiss.dbeaver.ext.generic.model.GenericTableBase;
import org.jkiss.dbeaver.ext.generic.model.*;
import org.jkiss.dbeaver.ext.sqlite.model.SQLiteTableColumn;
import org.jkiss.dbeaver.ext.sqlite.model.SQLiteTableForeignKey;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.edit.DBECommandContext;
import org.jkiss.dbeaver.model.edit.DBEObjectRenamer;
import org.jkiss.dbeaver.model.edit.DBEPersistAction;
import org.jkiss.dbeaver.model.exec.DBCExecutionContext;
import org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.utils.CommonUtils;

import java.util.List;
import java.util.Map;
Expand All @@ -37,6 +40,19 @@
*/
public class SQLiteTableManager extends GenericTableManager implements DBEObjectRenamer<GenericTableBase> {

private static final Class<? extends DBSObject>[] CHILD_TYPES = CommonUtils.array(
SQLiteTableColumn.class,
SQLiteTableForeignKey.class,
GenericTableIndex.class,
GenericUniqueKey.class
);

@NotNull
@Override
public Class<? extends DBSObject>[] getChildTypes() {
return CHILD_TYPES;
}

@Override
protected void addObjectRenameActions(DBRProgressMonitor monitor, DBCExecutionContext executionContext, List<DBEPersistAction> actions, ObjectRenameCommand command, Map<String, Object> options)
{
Expand Down

0 comments on commit 8a3354f

Please sign in to comment.