private void serviceGroupChanged(ServiceEvent e) {
    ServiceViewItem item = findItemSafe(e.target, e.contributorClass);
    if (!(item instanceof ServiceNode)) return;

    ServiceViewItem parent = item.getParent();
    if (parent == null) return;

    ServiceGroupNode group = null;
    if (parent instanceof ServiceGroupNode) {
      group = (ServiceGroupNode)parent;
      parent = group.getParent();
      while (parent instanceof ServiceGroupNode) {
        parent = parent.getParent();
      }
      if (parent == null) return;
    }

    if (group != null) {
      group.getChildren().remove(item);
    }
    else {
      parent.getChildren().remove(item);
    }

    Object value = e.target;
    ServiceViewContributor<?> providingContributor = ((ServiceNode)item).getProvidingContributor();
    if (providingContributor != null && !providingContributor.equals(e.target)) {
      value = providingContributor;
    }

    ServiceNode serviceNode = addService(value, parent.getChildren(), myProject, parent, item.getContributor());
    serviceNode.moveChildren((ServiceNode)item);
    while (group != null && group.getChildren().isEmpty()) {
      ServiceViewItem groupParent = group.getParent();
      if (groupParent == null) return;

      groupParent.getChildren().remove(group);
      group = groupParent instanceof ServiceGroupNode ? (ServiceGroupNode)groupParent : null;
    }
  }
private void serviceGroupChanged(ServiceEvent e)