use of com.intellij.designer.model.IComponentDeletionParticipant in project intellij-community by JetBrains.
the class CommonEditActionsProvider method handleDeletion.
private static void handleDeletion(@NotNull List<RadComponent> components) throws Exception {
// Segment the deleted components into lists of siblings
Map<RadComponent, List<RadComponent>> siblingLists = RadComponent.groupSiblings(components);
// Notify parent components about children getting deleted
for (Map.Entry<RadComponent, List<RadComponent>> entry : siblingLists.entrySet()) {
RadComponent parent = entry.getKey();
List<RadComponent> children = entry.getValue();
boolean finished = false;
if (parent instanceof IComponentDeletionParticipant) {
IComponentDeletionParticipant handler = (IComponentDeletionParticipant) parent;
finished = handler.deleteChildren(parent, children);
} else if (parent != null && /*check root*/
parent.getLayout() instanceof IComponentDeletionParticipant) {
IComponentDeletionParticipant handler = (IComponentDeletionParticipant) parent.getLayout();
finished = handler.deleteChildren(parent, children);
}
if (!finished) {
deleteComponents(children);
}
}
}
Aggregations