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); } } }
private void checkProjectOptions(IJavaProject javaProj) { _log.trace("Entered checkProjectOptions(); project: " + javaProj.getProject().getName()); try { // we only check BB projects and Java projects which are depended by any BB projects if (!javaProj.getProject().hasNature(BlackBerryProjectCoreNature.NATURE_ID) && !ProjectUtils.isDependedByBBProject(javaProj.getProject())) return; // get all referred projects List<IJavaProject> referedProjects = ProjectUtils.getAllReferencedJavaProjects(javaProj); List<IJavaProject> nonBBProjects = ProjectUtils.getNonBBJavaProjects(referedProjects); // get non-bb projects which has JDK compatibility problem List<IJavaProject> projectsWithProblem = ProjectUtils.getJavaProjectsContainJDKCompatibilityProblem(referedProjects); if (nonBBProjects.size() > 0) { setJDKCompatibilitySettings(javaProj, nonBBProjects, projectsWithProblem); } } catch (JavaModelException e) { _log.error(e.getMessage()); } catch (CoreException e) { _log.error(e.getMessage()); } }