List of usage examples for org.eclipse.jdt.core IClasspathEntry CPE_LIBRARY
int CPE_LIBRARY
To view the source code for org.eclipse.jdt.core IClasspathEntry CPE_LIBRARY.
Click Source Link
From source file:at.bestsolution.efxclipse.robovm.RobovmSetupHandler.java
License:Open Source License
private void resolveDataProject(IJavaProject project, Set<IPath> listProjectSourceDirs, Set<IPath> listRefProjectSourceDirs, Set<IPath> listRefLibraries) { try {//from ww w . j a va 2 s.com IClasspathEntry[] entries = project.getRawClasspath(); for (IClasspathEntry e : entries) { if (e.getEntryKind() == IClasspathEntry.CPE_PROJECT) { IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(e.getPath().lastSegment()); if (p.exists()) { resolveDataProject(JavaCore.create(p), listRefProjectSourceDirs, listRefProjectSourceDirs, listRefLibraries); } } else if (e.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { listRefLibraries.add(e.getPath()); } else if (e.getEntryKind() == IClasspathEntry.CPE_SOURCE) { listProjectSourceDirs.add(e.getPath()); } else if (e.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { String start = e.getPath().segment(0); // TODO remove hard coded strings if (!"org.eclipse.jdt.launching.JRE_CONTAINER".equals(start) && !"org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER".equals(start)) { IClasspathContainer cpe = JavaCore.getClasspathContainer(e.getPath(), project); IClasspathEntry[] cpEntries = cpe.getClasspathEntries(); for (IClasspathEntry tmp : cpEntries) { if (tmp.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { listRefLibraries.add(tmp.getPath()); } } } } } } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:at.bestsolution.efxclipse.tooling.css.cssext.ui.CssExtManager.java
License:Open Source License
public void searchClasspath(URI uri) { IJavaProject project = getJavaprojectFromPlatformURI(uri); try {/*from www . j a v a 2 s . com*/ for (IClasspathEntry entry : project.getRawClasspath()) { switch (entry.getEntryKind()) { case IClasspathEntry.CPE_LIBRARY: } } } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:at.bestsolution.efxclipse.tooling.jdt.ui.internal.handler.AbstractAntHandler.java
License:Open Source License
private void resolveDataProject(IJavaProject project, Set<IPath> listProjectSourceDirs, Set<IPath> listRefProjectSourceDirs, Set<IPath> listRefLibraries) { try {//from www.j a v a 2 s. co m IClasspathEntry[] entries = project.getRawClasspath(); for (IClasspathEntry e : entries) { if (e.getEntryKind() == IClasspathEntry.CPE_PROJECT) { IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(e.getPath().lastSegment()); if (p.exists()) { resolveDataProject(JavaCore.create(p), listRefProjectSourceDirs, listRefProjectSourceDirs, listRefLibraries); } } else if (e.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { listRefLibraries.add(e.getPath()); } else if (e.getEntryKind() == IClasspathEntry.CPE_SOURCE) { listProjectSourceDirs.add(e.getPath()); } else if (e.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { String start = e.getPath().segment(0); // TODO remove hard coded strings if (!"org.eclipse.jdt.launching.JRE_CONTAINER".equals(start) && !"at.bestsolution.efxclipse.tooling.jdt.core.JAVAFX_CONTAINER".equals(start)) { IClasspathContainer cpe = JavaCore.getClasspathContainer(e.getPath(), project); IClasspathEntry[] cpEntries = cpe.getClasspathEntries(); for (IClasspathEntry tmp : cpEntries) { if (tmp.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { listRefLibraries.add(tmp.getPath()); } } } } } } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:at.bestsolution.efxclipse.tooling.ui.preview.LivePreviewSynchronizer.java
License:Open Source License
private void resolveDataProject(IJavaProject project, Set<IPath> outputPath, Set<IPath> listRefLibraries) { try {// www . j av a 2 s.c o m IClasspathEntry[] entries = project.getRawClasspath(); outputPath.add(project.getOutputLocation()); for (IClasspathEntry e : entries) { if (e.getEntryKind() == IClasspathEntry.CPE_PROJECT) { IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(e.getPath().lastSegment()); if (p.exists()) { resolveDataProject(JavaCore.create(p), outputPath, listRefLibraries); } } else if (e.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { listRefLibraries.add(e.getPath()); } else if ("org.eclipse.pde.core.requiredPlugins".equals(e.getPath().toString())) { IClasspathContainer cpContainer = JavaCore.getClasspathContainer(e.getPath(), project); for (IClasspathEntry cpEntry : cpContainer.getClasspathEntries()) { if (cpEntry.getEntryKind() == IClasspathEntry.CPE_PROJECT) { IProject p = ResourcesPlugin.getWorkspace().getRoot() .getProject(cpEntry.getPath().lastSegment()); if (p.exists()) { resolveDataProject(JavaCore.create(p), outputPath, listRefLibraries); } } else if (cpEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { listRefLibraries.add(cpEntry.getPath()); } } } } } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:at.bestsolution.fxide.jdt.corext.javadoc.JavaDocLocations.java
License:Open Source License
public static URL getJavadocBaseLocation(IJavaElement element) throws JavaModelException { if (element.getElementType() == IJavaElement.JAVA_PROJECT) { return getProjectJavadocLocation((IJavaProject) element); }//w w w.ja v a 2s . c om IPackageFragmentRoot root = JavaModelUtil.getPackageFragmentRoot(element); if (root == null) { return null; } if (root.getKind() == IPackageFragmentRoot.K_BINARY) { IClasspathEntry entry = root.getResolvedClasspathEntry(); URL javadocLocation = getLibraryJavadocLocation(entry); if (javadocLocation != null) { return getLibraryJavadocLocation(entry); } entry = root.getRawClasspathEntry(); switch (entry.getEntryKind()) { case IClasspathEntry.CPE_LIBRARY: case IClasspathEntry.CPE_VARIABLE: return getLibraryJavadocLocation(entry); default: return null; } } else { return getProjectJavadocLocation(root.getJavaProject()); } }
From source file:at.bestsolution.fxide.jdt.corext.javadoc.JavaDocLocations.java
License:Open Source License
public static URL getLibraryJavadocLocation(IClasspathEntry entry) { if (entry == null) { throw new IllegalArgumentException("Entry must not be null"); //$NON-NLS-1$ }/*from w w w . ja va 2 s . c om*/ int kind = entry.getEntryKind(); if (kind != IClasspathEntry.CPE_LIBRARY && kind != IClasspathEntry.CPE_VARIABLE) { throw new IllegalArgumentException("Entry must be of kind CPE_LIBRARY or CPE_VARIABLE"); //$NON-NLS-1$ } IClasspathAttribute[] extraAttributes = entry.getExtraAttributes(); for (int i = 0; i < extraAttributes.length; i++) { IClasspathAttribute attrib = extraAttributes[i]; if (IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME.equals(attrib.getName())) { return parseURL(attrib.getValue()); } } return null; }
From source file:at.bestsolution.fxide.jdt.corext.util.JavaModelUtil.java
License:Open Source License
/** * Returns the classpath entry of the given package fragment root. This is the raw entry, except * if the root is a referenced library, in which case it's the resolved entry. * * @param root a package fragment root/*from w w w.j a v a 2s. c om*/ * @return the corresponding classpath entry * @throws JavaModelException if accessing the entry failed * @since 3.6 */ public static IClasspathEntry getClasspathEntry(IPackageFragmentRoot root) throws JavaModelException { IClasspathEntry rawEntry = root.getRawClasspathEntry(); int rawEntryKind = rawEntry.getEntryKind(); switch (rawEntryKind) { case IClasspathEntry.CPE_LIBRARY: case IClasspathEntry.CPE_VARIABLE: case IClasspathEntry.CPE_CONTAINER: // should not happen, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=305037 if (root.isArchive() && root.getKind() == IPackageFragmentRoot.K_BINARY) { IClasspathEntry resolvedEntry = root.getResolvedClasspathEntry(); if (resolvedEntry.getReferencingEntry() != null) return resolvedEntry; else return rawEntry; } } return rawEntry; }
From source file:at.bestsolution.fxide.jdt.text.javadoc.JavadocContentAccess2.java
License:Open Source License
private static String getSourceAttachmentEncoding(IPackageFragmentRoot root) throws JavaModelException { String encoding = ResourcesPlugin.getEncoding(); IClasspathEntry entry = root.getRawClasspathEntry(); if (entry != null) { int kind = entry.getEntryKind(); if (kind == IClasspathEntry.CPE_LIBRARY || kind == IClasspathEntry.CPE_VARIABLE) { IClasspathAttribute[] extraAttributes = entry.getExtraAttributes(); for (int i = 0; i < extraAttributes.length; i++) { IClasspathAttribute attrib = extraAttributes[i]; if (IClasspathAttribute.SOURCE_ATTACHMENT_ENCODING.equals(attrib.getName())) { return attrib.getValue(); }/* w w w.j av a2 s .c o m*/ } } } return encoding; }
From source file:at.bestsolution.javafx.ide.jdt.internal.jdt.CPListElement.java
License:Open Source License
public CPListElement(Object parent, IJavaProject project, int entryKind, IPath path, boolean newElement, IResource res, IPath linkTarget) { fProject = project;//from www . j a va2 s. c o m fEntryKind = entryKind; fPath = path; fOrginalPath = newElement ? null : path; fLinkTarget = linkTarget; fOrginalLinkTarget = linkTarget; fChildren = new ArrayList<Object>(); fResource = res; fIsExported = false; fIsMissing = false; fCachedEntry = null; fParentContainer = parent; switch (entryKind) { case IClasspathEntry.CPE_SOURCE: createAttributeElement(OUTPUT, null, true); createAttributeElement(INCLUSION, new Path[0], true); createAttributeElement(EXCLUSION, new Path[0], true); createAttributeElement(NATIVE_LIB_PATH, null, false); createAttributeElement(IGNORE_OPTIONAL_PROBLEMS, null, false); break; case IClasspathEntry.CPE_LIBRARY: case IClasspathEntry.CPE_VARIABLE: createAttributeElement(SOURCEATTACHMENT, null, true); createAttributeElement(JAVADOC, null, false); createAttributeElement(SOURCE_ATTACHMENT_ENCODING, null, false); createAttributeElement(NATIVE_LIB_PATH, null, false); createAttributeElement(ACCESSRULES, new IAccessRule[0], true); break; case IClasspathEntry.CPE_PROJECT: createAttributeElement(ACCESSRULES, new IAccessRule[0], true); createAttributeElement(COMBINE_ACCESSRULES, Boolean.FALSE, true); // not rendered createAttributeElement(NATIVE_LIB_PATH, null, false); break; case IClasspathEntry.CPE_CONTAINER: createAttributeElement(ACCESSRULES, new IAccessRule[0], true); try { IClasspathContainer container = JavaCore.getClasspathContainer(fPath, fProject); if (container != null) { IClasspathEntry[] entries = container.getClasspathEntries(); if (entries != null) { // catch invalid container implementation for (int i = 0; i < entries.length; i++) { IClasspathEntry entry = entries[i]; if (entry != null) { CPListElement curr = createFromExisting(this, entry, fProject); fChildren.add(curr); } else { JavaPlugin.logErrorMessage("Null entry in container '" + fPath + "'"); //$NON-NLS-1$//$NON-NLS-2$ } } } else { JavaPlugin.logErrorMessage("container returns null as entries: '" + fPath + "'"); //$NON-NLS-1$//$NON-NLS-2$ } } } catch (JavaModelException e) { } createAttributeElement(NATIVE_LIB_PATH, null, false); break; default: } }
From source file:at.bestsolution.javafx.ide.jdt.internal.jdt.CPListElement.java
License:Open Source License
private IClasspathEntry newClasspathEntry() { IClasspathAttribute[] extraAttributes = getClasspathAttributes(); switch (fEntryKind) { case IClasspathEntry.CPE_SOURCE: IPath[] inclusionPattern = (IPath[]) getAttribute(INCLUSION); IPath[] exclusionPattern = (IPath[]) getAttribute(EXCLUSION); IPath outputLocation = (IPath) getAttribute(OUTPUT); return JavaCore.newSourceEntry(fPath, inclusionPattern, exclusionPattern, outputLocation, extraAttributes);//from ww w .j a v a 2 s. c o m case IClasspathEntry.CPE_LIBRARY: { IPath attach = (IPath) getAttribute(SOURCEATTACHMENT); IAccessRule[] accesRules = (IAccessRule[]) getAttribute(ACCESSRULES); return JavaCore.newLibraryEntry(fPath, attach, null, accesRules, extraAttributes, isExported()); } case IClasspathEntry.CPE_PROJECT: { IAccessRule[] accesRules = (IAccessRule[]) getAttribute(ACCESSRULES); boolean combineAccessRules = ((Boolean) getAttribute(COMBINE_ACCESSRULES)).booleanValue(); return JavaCore.newProjectEntry(fPath, accesRules, combineAccessRules, extraAttributes, isExported()); } case IClasspathEntry.CPE_CONTAINER: { IAccessRule[] accesRules = (IAccessRule[]) getAttribute(ACCESSRULES); return JavaCore.newContainerEntry(fPath, accesRules, extraAttributes, isExported()); } case IClasspathEntry.CPE_VARIABLE: { IPath varAttach = (IPath) getAttribute(SOURCEATTACHMENT); IAccessRule[] accesRules = (IAccessRule[]) getAttribute(ACCESSRULES); return JavaCore.newVariableEntry(fPath, varAttach, null, accesRules, extraAttributes, isExported()); } default: return null; } }