protected Object[] getValidChildren(IContainer container) {
    List<IResource> resources = new ArrayList<IResource>();
    try {
      for (IResource child : container.members()) {
        if (isValid(child)) {
          resources.add(child);
        }
      }
    } catch (CoreException ce) {
      Logger.logError("Error while getting children for resource: " + container, ce);
    }

    return resources.toArray();
  }
 public boolean hasChildren(Object element) {
   if (element instanceof IContainer) {
     try {
       for (IResource child : ((IContainer) element).members()) {
         if (isValid(child)) {
           return true;
         }
       }
     } catch (CoreException ce) {
       Logger.logError("Error while getting children for resource: " + element, ce);
     }
   }
   return false;
 }
    public boolean update() {
      if (isOutOfSync()) {

        Logger.logDebug(
            String.format(
                "Updating because the pictogram elements point from '%s' to '%s', but the business objects point from '%s' to '%s'. The difference must be corrected before saving the diagram",
                graphicalStartId, graphicalEndId, businessStartId, businessEndId));

        TransactionalEditingDomain editingDomain = this.diagramEditor.getEditingDomain();
        editingDomain
            .getCommandStack()
            .execute(
                new RecordingCommand(editingDomain, "ConnectionUpdate") {
                  protected void doExecute() {
                    businessModelObjectToUpdate.setSourceRef((FlowNode) targetStartObject);
                    businessModelObjectToUpdate.setTargetRef((FlowNode) targetEndObject);
                  }
                });

        return true;
      }
      return false;
    }