}
public void ungroup() {
StatisticsAW.shared().recordEvent(StatisticsAW.EVENT_RULE_UNGROUP);
ElementGroup openGroup = window.editorRules.getSelectedGroup();
if(openGroup == null) {
// No open group selected in the tree. Try to find the closest open group
// by moving backward
openGroup = window.editorRules.findOpenGroupClosestToLocation(window.getTextPane().getSelectionStart());
if(openGroup == null) {
// Still no open group ? Give up
XJAlert.display(window.getJavaContainer(), "Ungroup", "Cannot ungroup because no enclosing group has been found.");
return;
}
}
ElementGroup closingGroup = window.editorRules.findClosingGroupForGroup(openGroup);
window.beginGroupChange("Ungroup");
if(closingGroup != null) {
// End of file is considered as a closing group but no group really exists