Search in sources :

Example 1 with AbstractDNode

use of org.eclipse.sirius.diagram.AbstractDNode in project InformationSystem by ObeoNetwork.

the class DatabaseServices method allSelectableExternalTables.

/**
 * Retrieve all non referenced external tables excluding those already displayed on the diagram
 * @param context the Table Container
 * @param diagram DSemanticDiagram diagram used to check for already displayed tables
 * @return List of tables
 */
public List<Table> allSelectableExternalTables(TableContainer context, DSemanticDiagram diagram) {
    // Retrieve all non Referenced External Tables
    List<Table> allNonReferencedExternalTables = allNonReferencedExternalTables(context);
    List<Table> tablesInDiagram = new ArrayList<Table>();
    // Retrieve all AbstracteDNode contained in diagram.
    List<EObject> allDNodes = EcoreServices.eAllContents(diagram, AbstractDNode.class);
    for (EObject node : allDNodes) {
        // Retrieve all tables contained in AbstractDNode
        if (((AbstractDNode) node).getTarget() instanceof Table) {
            tablesInDiagram.add((Table) ((AbstractDNode) node).getTarget());
        }
    }
    // Remove all tables contained in AbstractDNode present in allNonReferencedExternalTables
    allNonReferencedExternalTables.removeAll(tablesInDiagram);
    return allNonReferencedExternalTables;
}
Also used : Table(org.obeonetwork.dsl.database.Table) AbstractTable(org.obeonetwork.dsl.database.AbstractTable) EObject(org.eclipse.emf.ecore.EObject) AbstractDNode(org.eclipse.sirius.diagram.AbstractDNode) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 EObject (org.eclipse.emf.ecore.EObject)1 AbstractDNode (org.eclipse.sirius.diagram.AbstractDNode)1 AbstractTable (org.obeonetwork.dsl.database.AbstractTable)1 Table (org.obeonetwork.dsl.database.Table)1