List of usage examples for org.eclipse.jdt.core IJavaElement getPath
IPath getPath();
From source file:edu.brown.cs.bubbles.bedrock.BedrockUtil.java
License:Open Source License
private static void outputJavaElementImpl(IJavaElement elt, Set<String> files, boolean children, IvyXmlWriter xw) {/* w w w .ja v a2 s. c o m*/ if (elt == null) return; String close = null; switch (elt.getElementType()) { case IJavaElement.CLASS_FILE: return; case IJavaElement.PACKAGE_FRAGMENT: IOpenable opn = (IOpenable) elt; if (!opn.isOpen()) { try { opn.open(null); } catch (JavaModelException e) { BedrockPlugin.logE("Package framgent " + elt.getElementName() + " not open"); return; } } try { outputNameDetails((IPackageFragment) elt, xw); } catch (JavaModelException e) { } break; case IJavaElement.PACKAGE_FRAGMENT_ROOT: IPackageFragmentRoot pfr = (IPackageFragmentRoot) elt; try { if (!pfr.isOpen() && pfr.getKind() == IPackageFragmentRoot.K_SOURCE) { pfr.open(null); } } catch (JavaModelException e) { return; } outputNameDetails(pfr, xw); break; case IJavaElement.JAVA_PROJECT: IJavaProject ijp = (IJavaProject) elt; outputNameDetails(ijp, xw); break; case IJavaElement.JAVA_MODEL: case IJavaElement.IMPORT_CONTAINER: case IJavaElement.IMPORT_DECLARATION: case IJavaElement.TYPE_PARAMETER: default: break; case IJavaElement.COMPILATION_UNIT: IProject ip = elt.getJavaProject().getProject(); File f = getFileForPath(elt.getPath(), ip); if (files != null && !files.contains(f.getPath()) && !files.contains(f.getAbsolutePath())) { return; } xw.begin("FILE"); xw.textElement("PATH", f.getAbsolutePath()); String root = getRootForPath(elt.getPath(), ip); if (root != null) xw.textElement("PATHROOT", root); close = "FILE"; break; case IJavaElement.TYPE: try { outputNameDetails((IType) elt, xw); } catch (JavaModelException e) { } break; case IJavaElement.FIELD: try { outputNameDetails((IField) elt, xw); } catch (JavaModelException e) { } break; case IJavaElement.METHOD: try { outputNameDetails((IMethod) elt, xw); } catch (JavaModelException e) { } break; case IJavaElement.INITIALIZER: outputNameDetails((IInitializer) elt, xw); break; case IJavaElement.PACKAGE_DECLARATION: outputNameDetails((IPackageDeclaration) elt, xw); break; case IJavaElement.LOCAL_VARIABLE: outputNameDetails((ILocalVariable) elt, xw); break; } if (children && elt instanceof IParent) { try { for (IJavaElement c : ((IParent) elt).getChildren()) { outputJavaElementImpl(c, files, children, xw); } } catch (JavaModelException e) { } } if (close != null) xw.end(close); }
From source file:edu.brown.cs.bubbles.bedrock.BedrockUtil.java
License:Open Source License
private static void outputSymbol(IJavaElement elt, String what, String nm, String key, IvyXmlWriter xw) { if (what == null || nm == null) return;//from w w w.j a v a 2s .c o m xw.begin("ITEM"); xw.field("TYPE", what); xw.field("NAME", nm); xw.field("HANDLE", elt.getHandleIdentifier()); xw.field("WORKING", (elt.getPrimaryElement() != elt)); ICompilationUnit cu = (ICompilationUnit) elt.getAncestor(IJavaElement.COMPILATION_UNIT); if (cu != null) { xw.field("CUWORKING", cu.isWorkingCopy()); } try { xw.field("KNOWN", elt.isStructureKnown()); } catch (JavaModelException e) { } if (elt instanceof ISourceReference) { try { ISourceRange rng = ((ISourceReference) elt).getSourceRange(); if (rng != null) { xw.field("STARTOFFSET", rng.getOffset()); xw.field("ENDOFFSET", rng.getOffset() + rng.getLength()); xw.field("LENGTH", rng.getLength()); } } catch (JavaModelException e) { BedrockPlugin.logE("Problem getting source range: " + e); } } if (elt instanceof ILocalVariable) { ILocalVariable lcl = (ILocalVariable) elt; xw.field("SIGNATURE", lcl.getTypeSignature()); } if (elt instanceof IMember) { try { IMember mem = ((IMember) elt); int fgs = mem.getFlags(); if (mem.getParent() instanceof IType && !(elt instanceof IType)) { IType par = (IType) mem.getParent(); if (par.isInterface()) { if (elt instanceof IMethod) fgs |= Flags.AccAbstract; fgs |= Flags.AccPublic; } xw.field("QNAME", par.getFullyQualifiedName() + "." + nm); } xw.field("FLAGS", fgs); } catch (JavaModelException e) { } } if (elt instanceof IPackageFragment || elt instanceof IType) { Display d = BedrockApplication.getDisplay(); if (d != null) { JavadocUrl ju = new JavadocUrl(elt); d.syncExec(ju); URL u = ju.getResult(); if (u != null) { xw.field("JAVADOC", u.toString()); } } } xw.field("SOURCE", "USERSOURCE"); if (key != null) xw.field("KEY", key); boolean havepath = false; for (IJavaElement pe = elt.getParent(); pe != null; pe = pe.getParent()) { if (pe.getElementType() == IJavaElement.COMPILATION_UNIT) { IProject ip = elt.getJavaProject().getProject(); File f = BedrockUtil.getFileForPath(elt.getPath(), ip); xw.field("PATH", f.getAbsolutePath()); havepath = true; break; } } IJavaProject ijp = elt.getJavaProject(); if (ijp != null) xw.field("PROJECT", ijp.getProject().getName()); IPath p = elt.getPath(); if (p != null) { xw.field("XPATH", p); if (!havepath) { IProject ip = elt.getJavaProject().getProject(); File f = getFileForPath(elt.getPath(), ip); xw.field("PATH", f.getAbsolutePath()); } } if (elt instanceof IMethod) { IMethod m = (IMethod) elt; try { xw.field("RESOLVED", m.isResolved()); ISourceRange rng = m.getNameRange(); if (rng != null) { xw.field("NAMEOFFSET", rng.getOffset()); xw.field("NAMELENGTH", rng.getLength()); } xw.field("RETURNTYPE", m.getReturnType()); xw.field("NUMPARAM", m.getNumberOfParameters()); String[] pnms = m.getParameterNames(); String[] ptys = m.getParameterTypes(); for (int i = 0; i < ptys.length; ++i) { xw.begin("PARAMETER"); if (i < pnms.length) xw.field("NAME", pnms[i]); xw.field("TYPE", ptys[i]); xw.end(); } for (String ex : m.getExceptionTypes()) { xw.begin("EXCEPTION"); xw.field("TYPE", ex); xw.end(); } } catch (JavaModelException e) { } } // TODO: output parameters as separate elements with type and name if (elt instanceof IAnnotatable) { IAnnotatable ann = (IAnnotatable) elt; try { IAnnotation[] ans = ann.getAnnotations(); for (IAnnotation an : ans) { xw.begin("ANNOTATION"); xw.field("NAME", an.getElementName()); xw.field("COUNT", an.getOccurrenceCount()); try { for (IMemberValuePair mvp : an.getMemberValuePairs()) { xw.begin("VALUE"); xw.field("NAME", mvp.getMemberName()); if (mvp.getValue() != null) xw.field("VALUE", mvp.getValue().toString()); xw.field("KIND", mvp.getValueKind()); xw.end("VALUE"); } } catch (JavaModelException e) { } xw.end("ANNOTATION"); } } catch (JavaModelException e) { } } xw.end("ITEM"); }
From source file:jp.littleforest.pathtools.handlers.AbstractOpenHandler.java
License:Open Source License
/** * JarPackageFragmentRoot ? Jar ????<br /> * * @param adaptable//from w w w . j a va 2 s. co m * JarPackageFragmentRoot ? {@link IAdaptable} * @return Jar ?? {@link File} */ protected File getJarFile(IAdaptable adaptable) {//JarPackageFragmentRoot IJavaElement jpfr = (IJavaElement) adaptable; File selected = jpfr.getPath().makeAbsolute().toFile(); if (!(selected).exists()) { File projectFile = new File(jpfr.getJavaProject().getProject().getLocation().toOSString()); selected = new File(projectFile.getParent() + selected.toString()); } return selected; }
From source file:net.rim.ejde.internal.ui.wizards.NewResourceFileWizard.java
License:Open Source License
@Override public boolean performFinish() { final IProject userSelectedProject = ProjectUtils .getProject(newResourceFileCreationPage.getUserSelectedProject()); String fileName = newResourceFileCreationPage.getFileName(); IFile newResourceFile = null;//from ww w . jav a 2 s. c om IPackageFragmentRoot userSelectedSourceFolder = newResourceFileCreationPage.getUserSelectedSourceFolder(); IPackageFragment userSelectedPackage = newResourceFileCreationPage.getUserSelectedPackage(); String _resourcePackageId = newResourceFileCreationPage.getResourcePackageId(); if (newResourceFileCreationPage.isValidPackage()) { // Package is valid. No need to find or create a package. newResourceFile = newResourceFileCreationPage.createNewFile(); } else { // Package selected is invalid. First we try and find package within // project workspace. IPackageFragmentRoot sourceRoots[] = ProjectUtils.getProjectSourceFolders(userSelectedProject); try { IJavaElement foundPackageElement = null; for (IPackageFragmentRoot sourceRoot : sourceRoots) { IPackageFragment packageFragment = sourceRoot.getPackageFragment(_resourcePackageId); if (packageFragment.exists()) { foundPackageElement = packageFragment; break; } } if (foundPackageElement == null) { // Package could not be found. We must create the package. IPackageFragment newlyCreatedPackage = userSelectedSourceFolder .createPackageFragment(_resourcePackageId, true, null); /* * The following code uses reflection to access a private TreeViewer. I had to work through multiple levels of * objects to access the private field. In the future this code can break, if the hierarchy for these classes * or the names of these fields change. Once i access the TreeViewer i then refresh it. This allows the newly * created package to be added to the Tree and prevents a NullPointerException. */ Field fieldToAccess = WizardNewFileCreationPage.class.getDeclaredField("resourceGroup"); //$NON-NLS-1$ fieldToAccess.setAccessible(true); ResourceAndContainerGroup resourceGroup = ((ResourceAndContainerGroup) fieldToAccess .get(newResourceFileCreationPage)); fieldToAccess = ResourceAndContainerGroup.class.getDeclaredField("containerGroup"); //$NON-NLS-1$ fieldToAccess.setAccessible(true); ContainerSelectionGroup containerGroup = ((ContainerSelectionGroup) fieldToAccess .get(resourceGroup)); fieldToAccess = ContainerSelectionGroup.class.getDeclaredField("treeViewer"); //$NON-NLS-1$ fieldToAccess.setAccessible(true); TreeViewer treeViewer = ((TreeViewer) fieldToAccess.get(containerGroup)); treeViewer.refresh(); /* * This code will set the container path to null if the above tree isn't refreshed when the package is * created. */ newResourceFileCreationPage.setContainerFullPath(newlyCreatedPackage.getPath()); } else { // Package was found in project. Change the container path // to the found package. newResourceFileCreationPage.setContainerFullPath(foundPackageElement.getPath()); } newResourceFile = newResourceFileCreationPage.createNewFile(); } catch (Throwable e) { logger.error("performFinish() error", e); //$NON-NLS-1$ } } // if resource file is linked, we just return. Fix SDR213684 if (newResourceFile.isLinked()) { return true; } String packageStmt = createPackageStatement(userSelectedPackage); FileOutputStream fout = null; try { if (fileName.endsWith(ResourceConstants.RRH_SUFFIX)) { // user enters .rrh file extension // 1. create package statement File resourceFile = newResourceFile.getLocation().toFile(); if (resourceFile.length() == 0 && resourceFile.canWrite()) { fout = new FileOutputStream(resourceFile); new PrintStream(fout).println(packageStmt); } // 2. create associated .rrc root locale file if it doesn't // exist String rrcFileName = fileName.substring(0, fileName.lastIndexOf(".")) //$NON-NLS-1$ + ResourceConstants.RRC_SUFFIX; File rrcOSFile = new File(newResourceFile.getLocation().toFile().getParentFile(), rrcFileName); if (!rrcOSFile.exists()) { rrcOSFile.createNewFile();// TO->JDP } } if (fileName.endsWith(ResourceConstants.RRC_SUFFIX)) { // user enters .rrc file extension // if corresponding rrh file doesn't exist, create it and set // package statement // if corresponding .rrc root locale file doesn't exist, create // it as well String rrhFileName; String rrcRootLocaleFileName = null; String rrcRootLanguageLocaleFileName = null; boolean hasCountryCode = (fileName.indexOf("_") != fileName.lastIndexOf("_")); //$NON-NLS-1$ //$NON-NLS-2$ if (fileName.contains("_")) { //$NON-NLS-1$ rrhFileName = fileName.substring(0, fileName.indexOf("_")) + ResourceConstants.RRH_SUFFIX; //$NON-NLS-1$ // set root rrc file name rrcRootLocaleFileName = fileName.substring(0, fileName.indexOf("_")) //$NON-NLS-1$ + ResourceConstants.RRC_SUFFIX; if (hasCountryCode) { // set root language rrc file name rrcRootLanguageLocaleFileName = fileName.substring(0, fileName.lastIndexOf("_")) //$NON-NLS-1$ + ResourceConstants.RRC_SUFFIX; } } else { rrhFileName = fileName.substring(0, fileName.lastIndexOf(".")) + ResourceConstants.RRH_SUFFIX; //$NON-NLS-1$ } File rrhOSFile = new File(newResourceFile.getLocation().toFile().getParentFile(), rrhFileName); if (!rrhOSFile.exists()) { rrhOSFile.createNewFile();// // TO->JDP if (rrhOSFile.length() == 0 && rrhOSFile.canWrite()) { fout = new FileOutputStream(rrhOSFile); new PrintStream(fout).println(packageStmt); } } File rrcOSFile = null; // create .rrc root locale file if required if (rrcRootLocaleFileName != null) { rrcOSFile = new File(newResourceFile.getLocation().toFile().getParentFile(), rrcRootLocaleFileName); if (!rrcOSFile.exists()) { rrcOSFile.createNewFile(); } } // create .rrc root language locale file if required if (rrcRootLanguageLocaleFileName != null) { rrcOSFile = new File(newResourceFile.getLocation().toFile().getParentFile(), rrcRootLanguageLocaleFileName); if (!rrcOSFile.exists()) { rrcOSFile.createNewFile(); } } } } catch (Exception e) { logger.error("performFinish: Error creating file", e); //$NON-NLS-1$ return false; } finally { try { if (null != fout) fout.close(); } catch (IOException e) { logger.error("performFinish: Could not close the file", e); //$NON-NLS-1$ } } // Fix for DPI224873. Project becomes out of sync, which results // in out // of sync errors. The below will refresh project. try { userSelectedProject.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); } catch (CoreException e) { logger.error("performFinish: Error during project refresh", e); //$NON-NLS-1$ } return true; }
From source file:net.sf.j2s.ui.actions.UnitJavaScriptUtil.java
License:Open Source License
protected static String getRelativeJSPath(ICompilationUnit unit) { if (unit == null) { return null; }//from www.j a va 2s.co m IJavaProject javaProject = unit.getJavaProject(); if (javaProject != null) { String relativePath = null; IJavaElement parent = unit.getParent(); while (parent != null) { if (parent instanceof PackageFragmentRoot) { relativePath = unit.getPath().toPortableString() .substring(parent.getPath().toPortableString().length()); break; } parent = parent.getParent(); } IPath outputLocation = null; try { outputLocation = javaProject.getOutputLocation(); } catch (JavaModelException e) { e.printStackTrace(); } if (outputLocation != null && relativePath != null) { relativePath = outputLocation + relativePath.substring(0, relativePath.lastIndexOf('.')) + ".js"; return relativePath; } } return null; }
From source file:net.sourceforge.metrics.core.sources.AbstractMetricSource.java
License:Open Source License
/** * returns the path if this object represent a compilation unit or bigger scope, null otherwise * /* ww w . j av a2 s. co m*/ * @return */ public String getPath() { IJavaElement element = getJavaElement(); if (element.getElementType() <= IJavaElement.COMPILATION_UNIT) { return element.getPath().toString(); } /* else { */ return null; /* } */ }
From source file:net.sourceforge.metrics.ui.layeredpackagegraph.LayeredPackageTable.java
License:Open Source License
/** * @param handle * @return String */ private String getPath(IJavaElement element) { return element.getPath().toString(); }
From source file:nz.co.senanque.madura.wizards.RuleNewWizardPage.java
License:Open Source License
/** * Tests if the current workbench selection is a suitable container to use. *///from w ww.j a va 2 s . c o m private void initialize() { if (selection != null && selection.isEmpty() == false && selection instanceof IStructuredSelection) { IStructuredSelection ssel = (IStructuredSelection) selection; if (ssel.size() > 1) return; Object obj = ssel.getFirstElement(); if (obj instanceof IJavaElement) { IJavaElement ijp = (IJavaElement) obj; containerText.setText(ijp.getPath().toPortableString()); resource = ijp.getJavaProject().getProject(); } if (obj instanceof IFolder) { IFolder ijp = (IFolder) obj; containerText.setText(ijp.getFullPath().toPortableString()); resource = ijp; } if (obj instanceof IFile) { IFile ijp = (IFile) obj; IContainer container = ijp.getParent(); if (container instanceof IFolder) { IFolder f = (IFolder) container; containerText.setText(f.getFullPath().toPortableString()); resource = f; } else if (container instanceof IProject) { IProject p = (IProject) container; containerText.setText(p.getFullPath().toPortableString()); resource = p; } } } fileText.setText("new_file.rul"); }
From source file:nz.co.senanque.madura.wizards.WorkflowNewWizardPage.java
License:Open Source License
/** * Tests if the current workbench selection is a suitable container to use. *//*from w ww. j a v a 2s. c om*/ private void initialize() { if (selection != null && selection.isEmpty() == false && selection instanceof IStructuredSelection) { IStructuredSelection ssel = (IStructuredSelection) selection; if (ssel.size() > 1) return; Object obj = ssel.getFirstElement(); if (obj instanceof IJavaElement) { IJavaElement ijp = (IJavaElement) obj; containerText.setText(ijp.getPath().toPortableString()); resource = ijp.getJavaProject().getProject(); } if (obj instanceof IFolder) { IFolder ijp = (IFolder) obj; containerText.setText(ijp.getFullPath().toPortableString()); resource = ijp; } if (obj instanceof IFile) { IFile ijp = (IFile) obj; IContainer container = ijp.getParent(); if (container instanceof IFolder) { IFolder f = (IFolder) container; containerText.setText(f.getFullPath().toPortableString()); resource = f; } else if (container instanceof IProject) { IProject p = (IProject) container; containerText.setText(p.getFullPath().toPortableString()); resource = p; } } } fileText.setText("new_file.wrk"); }
From source file:org.eclipse.che.jdt.internal.core.DeltaProcessor.java
License:Open Source License
private boolean createExternalArchiveDelta(HashSet refreshedElements, IProgressMonitor monitor) { HashMap externalArchivesStatus = new HashMap(); boolean hasDelta = false; // find JARs to refresh HashSet archivePathsToRefresh = new HashSet(); Iterator iterator = refreshedElements.iterator(); while (iterator.hasNext()) { IJavaElement element = (IJavaElement) iterator.next(); switch (element.getElementType()) { case IJavaElement.PACKAGE_FRAGMENT_ROOT: archivePathsToRefresh.add(element.getPath()); break; case IJavaElement.JAVA_PROJECT: JavaProject javaProject = (JavaProject) element; if (!JavaProject.hasJavaNature(javaProject.getProject())) { // project is not accessible or has lost its Java nature break; }/* ww w . j av a2 s . c om*/ IClasspathEntry[] classpath; try { classpath = javaProject.getResolvedClasspath(); for (int j = 0, cpLength = classpath.length; j < cpLength; j++) { if (classpath[j].getEntryKind() == IClasspathEntry.CPE_LIBRARY) { archivePathsToRefresh.add(classpath[j].getPath()); } } } catch (JavaModelException e) { // project doesn't exist -> ignore } break; case IJavaElement.JAVA_MODEL: // Iterator projectNames = this.state.getOldJavaProjecNames().iterator(); // while (projectNames.hasNext()) { // String projectName = (String) projectNames.next(); // IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); // if (!JavaProject.hasJavaNature(project)) { // // project is not accessible or has lost its Java nature // continue; // } // javaProject = (JavaProject) JavaCore.create(project); // try { // classpath = javaProject.getResolvedClasspath(); // for (int k = 0, cpLength = classpath.length; k < cpLength; k++){ // if (classpath[k].getEntryKind() == IClasspathEntry.CPE_LIBRARY){ // archivePathsToRefresh.add(classpath[k].getPath()); // } // } // } catch (JavaModelException e2) { // // project doesn't exist -> ignore // continue; // } // } throw new UnsupportedOperationException(); // break; } } // // perform refresh // Iterator projectNames = this.state.getOldJavaProjecNames().iterator(); // IWorkspaceRoot wksRoot = ResourcesPlugin.getWorkspace().getRoot(); // while (projectNames.hasNext()) { // // if (monitor != null && monitor.isCanceled()) break; // // String projectName = (String) projectNames.next(); // IProject project = wksRoot.getProject(projectName); // if (!JavaProject.hasJavaNature(project)) { // // project is not accessible or has lost its Java nature // continue; // } // JavaProject javaProject = (JavaProject) JavaCore.create(project); // IClasspathEntry[] entries; // try { // entries = javaProject.getResolvedClasspath(); // } catch (JavaModelException e1) { // // project does not exist -> ignore // continue; // } // boolean deltaContainsModifiedJar = false; // for (int j = 0; j < entries.length; j++){ // if (entries[j].getEntryKind() == IClasspathEntry.CPE_LIBRARY) { // IPath entryPath = entries[j].getPath(); // // if (!archivePathsToRefresh.contains(entryPath)) continue; // not supposed to be refreshed // // String status = (String)externalArchivesStatus.get(entryPath); // if (status == null){ // // // Clear the external file state for this path, since this method is responsible for updating it. // this.manager.clearExternalFileState(entryPath); // // // compute shared status // Object targetLibrary = JavaModel.getTarget(entryPath, true); // // if (targetLibrary == null){ // missing JAR // if (this.state.getExternalLibTimeStamps().remove(entryPath) != null /* file was known*/ // && this.state.roots.get(entryPath) != null /* and it was on the classpath*/) { // externalArchivesStatus.put(entryPath, EXTERNAL_JAR_REMOVED); // // the jar was physically removed: remove the index // this.manager.indexManager.removeIndex(entryPath); // } // // } else if (targetLibrary instanceof File){ // external JAR // // File externalFile = (File)targetLibrary; // // // check timestamp to figure if JAR has changed in some way // Long oldTimestamp =(Long) this.state.getExternalLibTimeStamps().get(entryPath); // long newTimeStamp = getTimeStamp(externalFile); // if (oldTimestamp != null){ // // if (newTimeStamp == 0){ // file doesn't exist // externalArchivesStatus.put(entryPath, EXTERNAL_JAR_REMOVED); // this.state.getExternalLibTimeStamps().remove(entryPath); // // remove the index // this.manager.indexManager.removeIndex(entryPath); // // } else if (oldTimestamp.longValue() != newTimeStamp){ // externalArchivesStatus.put(entryPath, EXTERNAL_JAR_CHANGED); // this.state.getExternalLibTimeStamps().put(entryPath, new Long(newTimeStamp)); // // first remove the index so that it is forced to be re-indexed // this.manager.indexManager.removeIndex(entryPath); // // then index the jar // this.manager.indexManager.indexLibrary(entryPath, project.getProject(), ((ClasspathEntry)entries[j]) // .getLibraryIndexLocation(), true); // } else { // URL indexLocation = ((ClasspathEntry)entries[j]).getLibraryIndexLocation(); // if (indexLocation != null) { // force reindexing, this could be faster rather than maintaining the list // this.manager.indexManager.indexLibrary(entryPath, project.getProject(), indexLocation); // } // externalArchivesStatus.put(entryPath, EXTERNAL_JAR_UNCHANGED); // } // } else { // if (newTimeStamp == 0){ // jar still doesn't exist // externalArchivesStatus.put(entryPath, EXTERNAL_JAR_UNCHANGED); // } else { // externalArchivesStatus.put(entryPath, EXTERNAL_JAR_ADDED); // this.state.getExternalLibTimeStamps().put(entryPath, new Long(newTimeStamp)); // // index the new jar // this.manager.indexManager.removeIndex(entryPath); // this.manager.indexManager.indexLibrary(entryPath, project.getProject(), ((ClasspathEntry)entries[j]) // .getLibraryIndexLocation()); // } // } // } else { // internal JAR // externalArchivesStatus.put(entryPath, INTERNAL_JAR_IGNORE); // } // } // // according to computed status, generate a delta // status = (String)externalArchivesStatus.get(entryPath); // if (status != null){ // if (status == EXTERNAL_JAR_ADDED){ // PackageFragmentRoot root = (PackageFragmentRoot) javaProject.getPackageFragmentRoot(entryPath.toString()); // if (VERBOSE){ // System.out.println("- External JAR ADDED, affecting root: "+root.getElementName()); //$NON-NLS-1$ // } // elementAdded(root, null, null); // deltaContainsModifiedJar = true; // this.state.addClasspathValidation(javaProject); // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=185733 // hasDelta = true; // } else if (status == EXTERNAL_JAR_CHANGED) { // PackageFragmentRoot root = (PackageFragmentRoot) javaProject.getPackageFragmentRoot(entryPath.toString()); // if (VERBOSE){ // System.out.println("- External JAR CHANGED, affecting root: "+root.getElementName()); //$NON-NLS-1$ // } // contentChanged(root); // deltaContainsModifiedJar = true; // hasDelta = true; // } else if (status == EXTERNAL_JAR_REMOVED) { // PackageFragmentRoot root = (PackageFragmentRoot) javaProject.getPackageFragmentRoot(entryPath.toString()); // if (VERBOSE){ // System.out.println("- External JAR REMOVED, affecting root: "+root.getElementName()); //$NON-NLS-1$ // } // elementRemoved(root, null, null); // deltaContainsModifiedJar = true; // this.state.addClasspathValidation(javaProject); // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=185733 // hasDelta = true; // } // } // } // } // // if (deltaContainsModifiedJar) { // javaProject.resetResolvedClasspath(); // } // } // // if (hasDelta){ // // flush jar type cache // JavaModelManager.getJavaModelManager().resetJarTypeCache(); // } return hasDelta; }