Search in sources :

Example 1 with DTable

use of org.eclipse.sirius.table.metamodel.table.DTable in project InformationSystem by ObeoNetwork.

the class CreateTablesAndTreesLocallyDAnalysisSelector method selectSmartlyAnalysisForAddedRepresentation.

/**
 * Overridden to restrict {@link DAnalysis} selection for
 * {@link DRepresentation} creation only on remote {@link DAnalysis} if
 * {@link CDOViewpointPreferenceKeys#PREF_ENABLE_LOCAL_REPRESENTATION_CREATION}
 * preference is at false.
 *
 * {@inheritDoc}
 */
public DAnalysis selectSmartlyAnalysisForAddedRepresentation(DRepresentation createdDRepresentation, Collection<DAnalysis> allDAnalysis) {
    // Tables and trees are created locally
    if (createdDRepresentation instanceof DTable || createdDRepresentation instanceof DTree) {
        DAnalysis selectedDAnalysis = null;
        Collection<DAnalysis> localDAnalysis = getAllLocalDAnalyses(allDAnalysis);
        if (localDAnalysis.size() == 1) {
            selectedDAnalysis = localDAnalysis.iterator().next();
        } else {
            selectedDAnalysis = originalDAnalysisSelector.selectSmartlyAnalysisForAddedRepresentation(createdDRepresentation, localDAnalysis);
        }
        return selectedDAnalysis;
    } else {
        // other representations are created as before
        return originalDAnalysisSelector.selectSmartlyAnalysisForAddedRepresentation(createdDRepresentation, allDAnalysis);
    }
}
Also used : DTree(org.eclipse.sirius.tree.DTree) DAnalysis(org.eclipse.sirius.viewpoint.DAnalysis) DTable(org.eclipse.sirius.table.metamodel.table.DTable)

Aggregations

DTable (org.eclipse.sirius.table.metamodel.table.DTable)1 DTree (org.eclipse.sirius.tree.DTree)1 DAnalysis (org.eclipse.sirius.viewpoint.DAnalysis)1