use of org.eclipse.sirius.tree.DTree 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);
}
}