@Override
 public void elementChanged(ElementChangedEvent event) {
   initializeCache(true);
   Set<IJavaProject> javaProjectsWithClasspathChange =
       javaProjectClasspathChangeAnalyzer.getJavaProjectsWithClasspathChange(event.getDelta());
   if (!javaProjectsWithClasspathChange.isEmpty()) {
     for (IJavaProject project : javaProjectsWithClasspathChange) {
       updateCache(project);
     }
   }
   for (IJavaElementDelta projectDelta : getProjectDeltas(event.getDelta())) {
     IJavaProject project = (IJavaProject) projectDelta.getElement();
     if ((projectDelta.getKind() & IJavaElementDelta.REMOVED) != 0) {
       clearCache(project, Collections.<PackageFragmentRootData>emptySet());
     }
     switch (projectDelta.getFlags()) {
       case IJavaElementDelta.F_OPENED:
         updateCache(project);
         break;
       case IJavaElementDelta.F_CLOSED:
         clearCache(project, Collections.<PackageFragmentRootData>emptySet());
         break;
     }
   }
 }
  public void elementChanged(ElementChangedEvent event) {
    IJavaElementDelta[] children = event.getDelta().getChangedChildren(); // children = IProjects
    for (IJavaElementDelta child : children) {
      IProject project = child.getElement().getJavaProject().getProject();
      int size = child.getAffectedChildren().length; // .getChangedElement() = JavaProject
      if (size == 1) {
        IJavaElementDelta elementDelta =
            child.getAffectedChildren()[0]; // if it is only 1, name is ".tmp"
        // and elementDelta.kind = 4
        // (CHANGED)
        IJavaElement changedElement = elementDelta.getElement();
        if (changedElement
            .getElementName()
            .equals(ImportUtils.getImportPref(ResourceBuilder.LOCALE_INTERFACES_FOLDER_NAME))) {
          _changedBuildClasspath.put(project.getName(), Boolean.FALSE);
          break;
        }
      }
      if (isClasspathChange(
          child)) { // adding classpath entries might induce reordering the classpath entries
        _changedBuildClasspath.put(project.getName(), Boolean.TRUE);
        // notify the listeners
        EJDEEventNotifier.getInstance()
            .notifyClassPathChanged(child.getElement().getJavaProject(), hasCPRemoved(child));
        // validate the project
        ValidationManager.getInstance()
            .validateProjects(
                ProjectUtils.getAllReferencingProjects(
                    new IProject[] {child.getElement().getJavaProject().getProject()}),
                null);
      }
      if ((child.getFlags() & IJavaElementDelta.F_CLASSPATH_CHANGED) != 0
          || (child.getFlags() & IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED) != 0) {
        IJavaElement javaElement = child.getElement();
        final IJavaProject javaProject = javaElement.getJavaProject();
        classPathChanged(javaProject, child);
      }
      checkSourceAttachement(child.getAffectedChildren());
    }

    for (final IJavaElementDelta addedElemDelta : event.getDelta().getAddedChildren()) {
      final IJavaProject javaProject = addedElemDelta.getElement().getJavaProject();
      try {
        if (javaProject.getProject().hasNature(BlackBerryProjectCoreNature.NATURE_ID)) {
          if (addedElemDelta.getAffectedChildren().length == 0) {
            final IJavaElement addedElement = addedElemDelta.getElement();
            if (addedElement instanceof IJavaProject) {
              final IJavaProject addedJavaProj = (IJavaProject) addedElement;
              if (addedJavaProj.equals(javaProject)) {
                projectCreated(javaProject);
              }
            }
          }
        }
      } catch (final CoreException ce) {
        _log.error("", ce);
      }
    }
  }
  /**
   * Called when an IJavaElement changes. Used to reflect changes in the editor, which has a view
   * that is based on the <code>JavaModel</code>.
   *
   * @param event - The change that occurred to the <code>JavaModel</code>.
   */
  @SuppressWarnings("unchecked")
  public void elementChanged(ElementChangedEvent event) {
    try {
      /* Goes through these classes looking for any that are added, moved
       * or removed. Calls methods that updates the editor to reflect any
       * changes found.
       */
      for (Class type : map.keySet()) {
        List<IJavaElementDelta> added = findAddedElements(event.getDelta(), type);
        List<IJavaElementDelta> removed = findRemovedElements(event.getDelta(), type);
        List<IJavaElementDelta> changed = findChangedElements(event.getDelta(), type);
        HashMap<IJavaElement, IJavaElement> moved = extractMovedElements(added, removed);

        // ignore updating the editors if no changes occurred
        if (added.size() == 0 && removed.size() == 0 && moved.size() == 0 && changed.size() == 0) {
          continue;
        }

        List<DiagramEditor> editors = new ArrayList<DiagramEditor>(DiagramEditor.getEditors());

        // handle changes
        for (DiagramEditor editor : editors) {
          RootModel root = editor.getRootModel();

          // handle moves
          for (IJavaElement sourceElement : moved.keySet()) {
            IJavaElement targetElement = moved.get(sourceElement);
            map.get(sourceElement.getClass()).handleMove(root, sourceElement, targetElement);
          }

          // handle removes
          for (IJavaElementDelta removedElement : removed) {
            map.get(removedElement.getElement().getClass())
                .handleRemove(root, removedElement.getElement());
          }

          // handle adds
          for (IJavaElementDelta addedElement : added) {
            map.get(addedElement.getElement().getClass())
                .handleAdd(root, addedElement.getElement());
          }

          // handle changes (to modifiers, etc.)
          for (IJavaElementDelta changedElement : changed) {
            handleElementChange(changedElement);
          }

          editor.forceRefreshRelationships();
        }
      }
    } catch (Throwable t) {
      // TODO Incremental exploration throws Null Pointer.  Virtually unreproduceable.
      GreenException.critical(t);
    } finally {
      TypeRefactorHandler.REMOVED_TYPE = null;
    }
  }
 public void elementChanged(ElementChangedEvent event) {
   if (event.getType() == ElementChangedEvent.POST_CHANGE) {
     Object obj = event.getSource();
     if (obj instanceof IJavaElementDelta) {
       IJavaElementDelta delta = (IJavaElementDelta) obj;
       iterateChildren(new IJavaElementDelta[] {delta}, new IJavaProject[1]);
     }
   }
 }
 /*
  * @see org.eclipse.jdt.core.IElementChangedListener#elementChanged(org.eclipse.jdt.core.ElementChangedEvent)
  */
 public void elementChanged(ElementChangedEvent event) {
   try {
     processDelta(event.getDelta());
   } catch (JavaModelException e) {
     JavaPlugin.log(e);
   }
 }
 @Override
 public void elementChanged(ElementChangedEvent event) {
   IWorkingSet[] workingSets;
   synchronized (fWorkingSets) {
     workingSets = fWorkingSets.toArray(new IWorkingSet[fWorkingSets.size()]);
   }
   for (int w = 0; w < workingSets.length; w++) {
     WorkingSetDelta workingSetDelta = new WorkingSetDelta(workingSets[w]);
     processJavaDelta(workingSetDelta, event.getDelta());
     IResourceDelta[] resourceDeltas = event.getDelta().getResourceDeltas();
     if (resourceDeltas != null) {
       for (int r = 0; r < resourceDeltas.length; r++) {
         processResourceDelta(workingSetDelta, resourceDeltas[r]);
       }
     }
     workingSetDelta.process();
   }
 }
 public void elementChanged(ElementChangedEvent event) {
   if (processDelta(event.getDelta())) {
     OpenTypeHistory.getInstance().markAsInconsistent();
   }
 }