Search in sources :

Example 1 with ERDObject

use of org.jkiss.dbeaver.ext.erd.model.ERDObject in project dbeaver by serge-rider.

the class ERDEditorStandalone method getExecutionContext.

@Override
public DBCExecutionContext getExecutionContext() {
    for (Object part : getViewer().getSelectedEditParts()) {
        EditPart editPart = (EditPart) part;
        if (editPart.getModel() instanceof ERDObject) {
            final ERDObject model = (ERDObject) editPart.getModel();
            Object object = model.getObject();
            if (object instanceof DBSObject) {
                DBSObject dbObject = (DBSObject) object;
                DBPDataSource dataSource = dbObject.getDataSource();
                return dataSource.getDefaultContext(true);
            }
        }
    }
    return null;
}
Also used : DBSObject(org.jkiss.dbeaver.model.struct.DBSObject) EditPart(org.eclipse.gef.EditPart) ERDObject(org.jkiss.dbeaver.ext.erd.model.ERDObject) ERDObject(org.jkiss.dbeaver.ext.erd.model.ERDObject) DBSObject(org.jkiss.dbeaver.model.struct.DBSObject) DBPDataSource(org.jkiss.dbeaver.model.DBPDataSource)

Example 2 with ERDObject

use of org.jkiss.dbeaver.ext.erd.model.ERDObject in project dbeaver by dbeaver.

the class ERDEditorStandalone method getExecutionContext.

@Override
public DBCExecutionContext getExecutionContext() {
    for (Object part : getViewer().getSelectedEditParts()) {
        EditPart editPart = (EditPart) part;
        if (editPart.getModel() instanceof ERDObject) {
            final ERDObject model = (ERDObject) editPart.getModel();
            Object object = model.getObject();
            if (object instanceof DBSObject) {
                DBSObject dbObject = (DBSObject) object;
                DBPDataSource dataSource = dbObject.getDataSource();
                return dataSource.getDefaultContext(true);
            }
        }
    }
    return null;
}
Also used : DBSObject(org.jkiss.dbeaver.model.struct.DBSObject) EditPart(org.eclipse.gef.EditPart) ERDObject(org.jkiss.dbeaver.ext.erd.model.ERDObject) ERDObject(org.jkiss.dbeaver.ext.erd.model.ERDObject) DBSObject(org.jkiss.dbeaver.model.struct.DBSObject) DBPDataSource(org.jkiss.dbeaver.model.DBPDataSource)

Aggregations

EditPart (org.eclipse.gef.EditPart)2 ERDObject (org.jkiss.dbeaver.ext.erd.model.ERDObject)2 DBPDataSource (org.jkiss.dbeaver.model.DBPDataSource)2 DBSObject (org.jkiss.dbeaver.model.struct.DBSObject)2