List of usage examples for org.eclipse.jdt.core IClasspathEntry CPE_CONTAINER
int CPE_CONTAINER
To view the source code for org.eclipse.jdt.core IClasspathEntry CPE_CONTAINER.
Click Source Link
From source file:org.seasar.diigu.eclipse.util.JavaProjectClassLoader.java
License:Apache License
protected void addClasspathEntries(IJavaProject project, Set already, boolean atFirst) { already.add(project);//w w w. ja v a 2 s.com try { IContainer workspaceroot = project.getProject().getParent(); IPath path = project.getOutputLocation(); addURL(toURL(workspaceroot.getFolder(path).getLocation())); IClasspathEntry[] entries = project.getResolvedClasspath(true); for (int i = 0; i < entries.length; i++) { IClasspathEntry entry = entries[i]; switch (entry.getEntryKind()) { case IClasspathEntry.CPE_SOURCE: IPath dist = entry.getOutputLocation(); if (dist != null) { addURL(toURL(workspaceroot.getFolder(dist).getLocation())); } break; case IClasspathEntry.CPE_LIBRARY: case IClasspathEntry.CPE_CONTAINER: case IClasspathEntry.CPE_VARIABLE: IPath p = entry.getPath(); if (p.toFile().exists()) { addURL(toURL(p)); } else { addURL(toURL(workspaceroot.getFile(p).getLocation())); } break; case IClasspathEntry.CPE_PROJECT: IJavaProject proj = ProjectUtils.getJavaProject(entry.getPath().segment(0)); if (proj != null && proj.exists() && already.contains(proj) == false && (atFirst || entry.isExported())) { addClasspathEntries(proj, already, false); } break; default: break; } } } catch (Exception e) { DiiguPlugin.log(e); } }
From source file:org.seasar.kijimuna.core.util.JavaProjectClassLoader.java
License:Apache License
protected void addClasspathEntries(IJavaProject project, Set already, boolean atFirst) { already.add(project);/*from w ww .ja v a 2 s . c o m*/ try { IContainer workspaceroot = project.getProject().getParent(); IPath path = project.getOutputLocation(); addURL(toURL(workspaceroot.getFolder(path).getLocation())); IClasspathEntry[] entries = project.getResolvedClasspath(true); for (int i = 0; i < entries.length; i++) { IClasspathEntry entry = entries[i]; switch (entry.getEntryKind()) { case IClasspathEntry.CPE_SOURCE: IPath dist = entry.getOutputLocation(); if (dist != null) { addURL(toURL(workspaceroot.getFolder(dist).getLocation())); } break; case IClasspathEntry.CPE_LIBRARY: case IClasspathEntry.CPE_CONTAINER: case IClasspathEntry.CPE_VARIABLE: IPath p = entry.getPath(); if (p.toFile().exists()) { addURL(toURL(p)); } else { addURL(toURL(workspaceroot.getFile(p).getLocation())); } break; case IClasspathEntry.CPE_PROJECT: IJavaProject proj = JavaCore.create(ProjectUtils.getProject(entry.getPath().segment(0))); if (proj != null && proj.exists() && already.contains(proj) == false && (atFirst || entry.isExported())) { addClasspathEntries(proj, already, false); } break; default: break; } } } catch (Exception e) { KijimunaCore.reportException(e); } }
From source file:org.springframework.ide.eclipse.ajdt.ui.actions.SpringAspectsToolingEnabler.java
License:Open Source License
private IClasspathEntry findSpringAspectsJar(IClasspathEntry[] entries) throws JavaModelException { for (IClasspathEntry entry : entries) { if (isSpringAspectsEntry(entry)) { return entry; } else if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { IClasspathEntry containedEntry = findSpringAspectsJar(extractEntriesFomContainer(entry)); if (containedEntry != null) { return containedEntry; }/*w w w . ja v a 2s . c o m*/ } } return null; }
From source file:org.springframework.ide.eclipse.ajdt.ui.actions.SpringAspectsToolingEnabler.java
License:Open Source License
private boolean hasSpringAspectsJar(IClasspathEntry[] entries) throws JavaModelException { for (IClasspathEntry entry : entries) { if (isSpringAspectsEntry(entry)) { return true; } else if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { if (hasSpringAspectsJar(extractEntriesFomContainer(entry))) { return true; }//ww w . j a v a 2s.c o m } } return false; }
From source file:org.springframework.ide.eclipse.ajdt.ui.actions.SpringAspectsToolingEnabler.java
License:Open Source License
private boolean isJarOnAspectPath(IClasspathEntry[] entries) throws JavaModelException { for (IClasspathEntry entry : entries) { if (isSpringAspectsEntry(entry)) { if (AspectJCorePreferences.isOnAspectpath(entry)) { return true; }//from w w w . jav a2 s. co m } else if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { if (isJarOnAspectPath(extractEntriesFomContainer(entry))) { return true; } } } return false; }
From source file:org.springframework.ide.eclipse.boot.properties.editor.StsConfigMetadataRepositoryJsonLoader.java
License:Open Source License
private String ekind(int ekind) { switch (ekind) { case IClasspathEntry.CPE_SOURCE: return "SRC"; case IClasspathEntry.CPE_LIBRARY: return "LIB"; case IClasspathEntry.CPE_PROJECT: return "PRJ"; case IClasspathEntry.CPE_VARIABLE: return "VAR"; case IClasspathEntry.CPE_CONTAINER: return "CON"; default:// w w w . j av a 2s .co m return "" + ekind; } }
From source file:org.springframework.tooling.jdt.ls.commons.classpath.ClasspathUtil.java
License:Open Source License
private static IClasspathEntry getJreContainer(IClasspathEntry[] rawClasspath) { if (rawClasspath != null) { for (IClasspathEntry cpe : rawClasspath) { if (cpe.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { if (cpe.getPath().segment(0).equals(JRE_CONTAINER_ID)) { return cpe; }//from w w w. j a v a2 s . c om } } } return null; }
From source file:org.springsource.ide.eclipse.commons.frameworks.core.legacyconversion.LegacyProjectConverter.java
License:Open Source License
private static void convertGradleProject(IProject project, SubMonitor sub) throws Exception { // nature/*from ww w . j av a 2s . c o m*/ IProjectDescription description = project.getDescription(); String[] ids = description.getNatureIds(); List<String> newIds = new ArrayList<String>(ids.length); for (int i = 0; i < ids.length; i++) { if (!ids[i].equals(GRADLE_OLD_NATURE) && !ids[i].equals(GRADLE_NEW_NATURE)) { newIds.add(ids[i]); } else { newIds.add(GRADLE_NEW_NATURE); } } description.setNatureIds(newIds.toArray(new String[0])); project.setDescription(description, sub); // project preferences // DO NOTHING: gradle tooling handles these itself by reading in both old and new locations. // classpath container IJavaProject javaProject = JavaCore.create(project); IClasspathEntry[] classpath = javaProject.getRawClasspath(); List<IClasspathEntry> newClasspath = new ArrayList<IClasspathEntry>(); for (int i = 0; i < classpath.length; i++) { IClasspathEntry entry = classpath[i]; if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { String path = entry.getPath().toString(); if (path.contains(GRADLE_OLD_PREFIX)) { entry = JavaCore.newContainerEntry(new Path(path.replace(GRADLE_OLD_PREFIX, GRADLE_NEW_PREFIX)), entry.getAccessRules(), entry.getExtraAttributes(), entry.isExported()); } } newClasspath.add(entry); } javaProject.setRawClasspath(newClasspath.toArray(new IClasspathEntry[0]), sub); }
From source file:org.springsource.ide.eclipse.gradle.core.ClassPath.java
License:Open Source License
public static boolean isContainerOnClasspath(IJavaProject jp, String containerID) { try {/*ww w .j a v a 2 s .com*/ IClasspathEntry[] entries = jp.getRawClasspath(); for (IClasspathEntry e : entries) { if (e.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { IPath path = e.getPath(); if (containerID.equals(path.segment(0))) { return true; } } } } catch (JavaModelException e) { GradleCore.log(e); } return false; }
From source file:org.springsource.ide.eclipse.gradle.core.ClassPath.java
License:Open Source License
/** * See STS-2054, it is not sufficient to avoid adding duplicates, sometimes gradle * adds them and it is nice for us to remove them if it does. *//*from w ww .ja v a 2 s . co m*/ private void removeDuplicateJREContainers() { Collection<IClasspathEntry> entries = getEntries(IClasspathEntry.CPE_CONTAINER); Iterator<IClasspathEntry> iterator = entries.iterator(); IClasspathEntry jreContainer = null; while (iterator.hasNext()) { IClasspathEntry element = iterator.next(); if (isJREContainer(element)) { if (jreContainer != null) { iterator.remove(); //Already seen a container, so this one is duplicate! } else { jreContainer = element; } } } }