Java Code Examples for org.eclipse.jdt.launching.JavaRuntime#newRuntimeContainerClasspathEntry()
The following examples show how to use
org.eclipse.jdt.launching.JavaRuntime#newRuntimeContainerClasspathEntry() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MyMvnSourceContainer.java From m2e.sourcelookup with Eclipse Public License 1.0 | 6 votes |
private ISourceContainer[] fromJavaRuntimeResolver() throws CoreException { for (final IClasspathEntry cpe : jp.getRawClasspath()) { if (IClasspathEntry.CPE_CONTAINER == cpe.getEntryKind() && // IClasspathManager.CONTAINER_ID.equals(cpe.getPath().toString())) { final IRuntimeClasspathEntry newRuntimeContainerClasspathEntry = JavaRuntime.newRuntimeContainerClasspathEntry(cpe.getPath(), IRuntimeClasspathEntry.USER_CLASSES, jp); final IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry = JavaRuntime.resolveRuntimeClasspathEntry( newRuntimeContainerClasspathEntry, jp); // there is only one maven2 classpath container in a project return return JavaRuntime.getSourceContainers(resolveRuntimeClasspathEntry); } } return new ISourceContainer[] {}; }
Example 2
Source File: MyMvnSourceContainer.java From m2e.sourcelookup with Eclipse Public License 1.0 | 6 votes |
private ISourceContainer[] fromMavenSourcePathProvider() throws CoreException { final IRuntimeClasspathEntry mavenEntry = JavaRuntime.newRuntimeContainerClasspathEntry(new Path(IClasspathManager.CONTAINER_ID), IRuntimeClasspathEntry.USER_CLASSES); final ILaunchConfiguration launchConfiguration = getDirector().getLaunchConfiguration(); // final ILaunchConfigurationWorkingCopy wc = launchConfiguration.getWorkingCopy(); // wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, getProjectName()); // final ILaunchConfiguration doSave = wc.doSave(); final ILaunchConfiguration javaProjectLaunchConfiguration = new JavaProjectLaunchConfiguration(launchConfiguration, this); final IRuntimeClasspathEntry[] resolved = mavenRuntimeClasspathProvider.resolveClasspath(new IRuntimeClasspathEntry[] { mavenEntry }, javaProjectLaunchConfiguration); // final IRuntimeClasspathEntry[] entries = JavaRuntime.computeUnresolvedSourceLookupPath(doSave); // final IRuntimeClasspathEntry[] resolved = JavaRuntime.resolveSourceLookupPath(entries, doSave); return JavaRuntime.getSourceContainers(resolved); }
Example 3
Source File: AbstractSARLLaunchConfigurationDelegate.java From sarl with Apache License 2.0 | 4 votes |
@SuppressWarnings("checkstyle:npathcomplexity") private void getBootpathExtForJRE(ILaunchConfiguration configuration, IRuntimeClasspathEntry[] entries, IRuntimeClasspathEntry jreEntry, int idx, String[] entriesPrep, IRuntimeClasspathEntry[] bootEntriesPrep, String[][] bootpathInfo) throws CoreException { int index = idx; final List<IRuntimeClasspathEntry> bootEntriesAppend = new ArrayList<>(); for (; index < entries.length; index++) { final IRuntimeClasspathEntry entry = entries[index]; if (entry.getClasspathProperty() == IRuntimeClasspathEntry.BOOTSTRAP_CLASSES) { bootEntriesAppend.add(entry); } } bootpathInfo[0] = entriesPrep; final IRuntimeClasspathEntry[] bootEntriesApp = JavaRuntime .resolveRuntimeClasspath( bootEntriesAppend .toArray(new IRuntimeClasspathEntry[bootEntriesAppend .size()]), configuration); if (bootEntriesApp.length > 0) { bootpathInfo[2] = new String[bootEntriesApp.length]; for (int i = 0; i < bootEntriesApp.length; i++) { bootpathInfo[2][i] = bootEntriesApp[i].getLocation(); } } final IVMInstall install = getVMInstall(configuration); final LibraryLocation[] libraryLocations = install.getLibraryLocations(); if (libraryLocations != null) { // determine if explicit bootpath should be used if (!JRERuntimeClasspathEntryResolver.isSameArchives(libraryLocations, install.getVMInstallType().getDefaultLibraryLocations(install.getInstallLocation()))) { // resolve bootpath entries in JRE entry final IRuntimeClasspathEntry[] bootEntries; if (jreEntry.getType() == IRuntimeClasspathEntry.CONTAINER) { final IRuntimeClasspathEntry bootEntry = JavaRuntime.newRuntimeContainerClasspathEntry( jreEntry.getPath(), IRuntimeClasspathEntry.BOOTSTRAP_CLASSES, getJavaProject(configuration)); bootEntries = JavaRuntime.resolveRuntimeClasspathEntry(bootEntry, configuration); } else { bootEntries = JavaRuntime.resolveRuntimeClasspathEntry(jreEntry, configuration); } // non-default JRE libraries - use explicit bootpath only final String[] bootpath = new String[bootEntriesPrep.length + bootEntries.length + bootEntriesApp.length]; if (bootEntriesPrep.length > 0) { System.arraycopy(bootpathInfo[0], 0, bootpath, 0, bootEntriesPrep.length); } int dest = bootEntriesPrep.length; for (int i = 0; i < bootEntries.length; i++) { bootpath[dest] = bootEntries[i].getLocation(); dest++; } if (bootEntriesApp.length > 0) { System.arraycopy(bootpathInfo[2], 0, bootpath, dest, bootEntriesApp.length); } bootpathInfo[0] = null; bootpathInfo[1] = bootpath; bootpathInfo[2] = null; } } }