List of usage examples for org.eclipse.jdt.core IClasspathEntry CPE_SOURCE
int CPE_SOURCE
To view the source code for org.eclipse.jdt.core IClasspathEntry CPE_SOURCE.
Click Source Link
From source file:org.drools.eclipse.util.ProjectClassLoader.java
License:Apache License
public static List<URL> getProjectClassPathURLs(IJavaProject project, List<String> alreadyLoadedProjects) { List<URL> pathElements = new ArrayList<URL>(); try {/* www .jav a2 s. com*/ IClasspathEntry[] paths = project.getResolvedClasspath(true); Set<IPath> outputPaths = new HashSet<IPath>(); if (paths != null) { for (int i = 0; i < paths.length; i++) { IClasspathEntry path = paths[i]; if (path.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { URL url = getRawLocationURL(path.getPath()); pathElements.add(url); } else if (path.getEntryKind() == IClasspathEntry.CPE_SOURCE) { IPath output = path.getOutputLocation(); if (path.getOutputLocation() != null) { outputPaths.add(output); } } } } IPath location = getProjectLocation(project.getProject()); IPath outputPath = location.append(project.getOutputLocation().removeFirstSegments(1)); pathElements.add(0, outputPath.toFile().toURI().toURL()); for (IPath path : outputPaths) { outputPath = location.append(path.removeFirstSegments(1)); pathElements.add(0, outputPath.toFile().toURI().toURL()); } // also add classpath of required projects for (String projectName : project.getRequiredProjectNames()) { if (!alreadyLoadedProjects.contains(projectName)) { alreadyLoadedProjects.add(projectName); IProject reqProject = project.getProject().getWorkspace().getRoot().getProject(projectName); if (reqProject != null) { IJavaProject reqJavaProject = JavaCore.create(reqProject); pathElements.addAll(getProjectClassPathURLs(reqJavaProject, alreadyLoadedProjects)); } } } } catch (JavaModelException e) { DroolsEclipsePlugin.log(e); } catch (MalformedURLException e) { DroolsEclipsePlugin.log(e); } catch (Throwable t) { DroolsEclipsePlugin.log(t); } return pathElements; }
From source file:org.ebayopensource.turmeric.eclipse.errorlibrary.buildsystem.core.ErrorLibraryBuildSystemConfigurer.java
License:Open Source License
/** * Adds the java support./*from www . j a v a2 s . c o m*/ * * @param errorLibraryProject the error library project * @param outputLocation the output location * @param monitor the monitor * @throws CoreException the core exception */ public static void addJavaSupport(SOAErrorLibraryProject errorLibraryProject, String outputLocation, IProgressMonitor monitor) throws CoreException { final IProject project = errorLibraryProject.getProject(); boolean changedClasspath = false; if (JDTUtil.addJavaNature(project, monitor)) { changedClasspath = true; } // Configuring the Java Project final IJavaProject javaProject = JavaCore.create(project); final List<IClasspathEntry> classpath = JDTUtil.rawClasspath(javaProject, true); final List<IClasspathEntry> classpathContainers = new ArrayList<IClasspathEntry>(); // TODO Lets see if we need this if (outputLocation.equals(javaProject.getOutputLocation()) == false) { final IFolder outputDirClasses = project.getFolder(outputLocation); javaProject.setOutputLocation(outputDirClasses.getFullPath(), monitor); changedClasspath = true; } // Dealing with the case where the root of the project is set to be the // src and bin destinations... bad... bad... for (final Iterator<IClasspathEntry> iterator = classpath.iterator(); iterator.hasNext();) { final IClasspathEntry entry = iterator.next(); if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { classpathContainers.add(entry); } if (entry.getEntryKind() != IClasspathEntry.CPE_SOURCE || !entry.getPath().equals(new Path("/" + project.getName()))) continue; iterator.remove(); changedClasspath |= true; } for (final SOAProjectSourceDirectory dir : errorLibraryProject.getSourceDirectories()) { if (!WorkspaceUtil.isDotDirectory(dir.getLocation())) { final IFolder source = project.getFolder(dir.getLocation()); // If the Java project existed previously, checking if // directories // already exist in // its classpath. boolean found = false; for (final IClasspathEntry entry : classpath) { if (!entry.getPath().equals(source.getFullPath())) continue; found = true; break; } if (found) continue; changedClasspath |= true; IPath[] excludePatterns = ClasspathEntry.EXCLUDE_NONE; if (dir.getExcludePatterns() != null) { int length = dir.getExcludePatterns().length; excludePatterns = new Path[length]; for (int i = 0; i < length; i++) { excludePatterns[i] = new Path(dir.getExcludePatterns()[i]); } } IPath outputPath = dir.getOutputLocation() != null ? project.getFolder(dir.getOutputLocation()).getFullPath() : null; final IClasspathEntry entry = JavaCore.newSourceEntry(source.getFullPath(), excludePatterns, outputPath); classpath.add(entry); } } ProgressUtil.progressOneStep(monitor); // Adding the runtime library boolean found = false; for (final IClasspathEntry entry : classpath) { // All JRE Containers should have a prefix of // org.eclipse.jdt.launching.JRE_CONTAINER if (JavaRuntime.newDefaultJREContainerPath().isPrefixOf(entry.getPath()) && JavaRuntime.newDefaultJREContainerPath().equals(entry.getPath())) { found = true; break; } } if (!found) { changedClasspath = true; classpath.add(JavaRuntime.getDefaultJREContainerEntry()); } // we want all classpath containers to be the end of .classpath file classpath.removeAll(classpathContainers); classpath.addAll(classpathContainers); ProgressUtil.progressOneStep(monitor); // Configuring the classpath of the Java Project if (changedClasspath) { javaProject.setRawClasspath(classpath.toArray(new IClasspathEntry[0]), null); } }
From source file:org.ebayopensource.turmeric.eclipse.resources.util.SOAConsumerUtil.java
License:Open Source License
/** * Fill metadata.// w ww. j av a2 s . c o m * * @param consumerProject the consumer project * @param serviceNames the service names * @return the sOA consumer project * @throws Exception the exception */ public static SOAConsumerProject fillMetadata(final SOAConsumerProject consumerProject, final List<String> serviceNames) throws Exception { final List<SOAProjectSourceDirectory> entries = new ArrayList<SOAProjectSourceDirectory>(); for (final IClasspathEntry entry : JDTUtil.rawClasspath(consumerProject.getProject(), false)) { if (entry == null || entry.getEntryKind() != IClasspathEntry.CPE_SOURCE) continue; final String path = entry.getPath().removeFirstSegments(1).toString(); entries.add(new SOAProjectSourceDirectory(path)); } consumerProject.setSourceDirectories(entries); if (serviceNames != null) { if (consumerProject instanceof SOAConsumerProject) { ((SOAConsumerProject) consumerProject).getMetadata().setServiceNames(serviceNames); } for (final String serviceName : serviceNames) { final IProject intfProject = WorkspaceUtil.getProject(serviceName); if (intfProject != null && intfProject.isAccessible()) { SOAIntfMetadata intfMetadata = SOAServiceUtil .getSOAIntfMetadata(SOAServiceUtil.getSOAEclipseMetadata(intfProject)); intfMetadata.setServiceName(serviceName); SOAIntfUtil.fillMetadata(intfProject, intfMetadata); consumerProject.getRequiredServices().put(serviceName, intfMetadata); } } } return consumerProject; }
From source file:org.ebayopensource.turmeric.eclipse.resources.util.SOAImplUtil.java
License:Open Source License
/** * Fill metadata./* ww w. j a va2s . co m*/ * * @param eclipseMetadata the eclipse metadata * @param implProject the impl project * @return the sOA impl project * @throws Exception the exception */ public static SOAImplProject fillMetadata(final SOAProjectEclipseMetadata eclipseMetadata, final SOAImplProject implProject) throws Exception { if (SOALogger.DEBUG) logger.entering(eclipseMetadata, implProject); final List<SOAProjectSourceDirectory> entries = new ArrayList<SOAProjectSourceDirectory>(); for (final IClasspathEntry entry : JDTUtil.rawClasspath(implProject.getProject(), false)) { if (entry != null && entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { final String path = entry.getPath().removeFirstSegments(1).toString(); entries.add(new SOAProjectSourceDirectory(path)); } } if (SOALogger.DEBUG) logger.debug("Setting source directories->", entries, " to the impl project->", implProject.getProject()); implProject.setSourceDirectories(entries); final String serviceName = implProject.getMetadata().getServiceName(); if (serviceName != null) { final IProject intfProject = WorkspaceUtil.getProject(serviceName); if (intfProject != null && intfProject.isAccessible()) { SOAServiceUtil.getSOAIntfMetadata(SOAServiceUtil.getSOAEclipseMetadata(intfProject), implProject.getMetadata().getIntfMetadata()); SOAIntfUtil.fillMetadata(intfProject, implProject.getMetadata().getIntfMetadata()); } else { logger.warning("The interface project is not accessible->", intfProject); } } else { if (SOALogger.DEBUG) logger.debug("The interface project/service name for the implementation project", implProject.getProject(), " is null->"); } return implProject; }
From source file:org.ebayopensource.turmeric.eclipse.utils.plugin.JDTUtil.java
License:Open Source License
/** * Adds the java support to eclipse project. * ie soa nature is added here./*from ww w. ja v a 2s . c o m*/ * Class Path container related linking etc.. * * @param project the project * @param sourceDirectories the source directories * @param defaultCompilerLevel the default compiler level * @param outputLocation the output location * @param monitor the monitor * @throws CoreException the core exception */ public static void addJavaSupport(IProject project, List<String> sourceDirectories, String defaultCompilerLevel, String outputLocation, IProgressMonitor monitor) throws CoreException { boolean changedClasspath = false; if (addJavaNature(project, monitor)) { changedClasspath = true; } // Configuring the Java Project final IJavaProject javaProject = JavaCore.create(project); final List<IClasspathEntry> classpath = JDTUtil.rawClasspath(javaProject, true); if (outputLocation.equals(javaProject.getOutputLocation()) == false) { final IFolder outputDirClasses = project.getFolder(outputLocation); javaProject.setOutputLocation(outputDirClasses.getFullPath(), monitor); changedClasspath = true; } // Dealing with the case where the root of the project is set to be the // src and bin destinations... bad... bad... for (final Iterator<IClasspathEntry> iterator = classpath.iterator(); iterator.hasNext();) { final IClasspathEntry entry = iterator.next(); if (entry.getEntryKind() != IClasspathEntry.CPE_SOURCE || !entry.getPath().equals(new Path("/" + project.getName()))) continue; iterator.remove(); changedClasspath |= true; } for (final String dir : sourceDirectories) { final IFolder source = project.getFolder(dir); // If the Java project existed previously, checking if directories // already exist in // its classpath. boolean found = false; for (final IClasspathEntry entry : classpath) { if (!entry.getPath().equals(source.getFullPath())) continue; found = true; break; } if (found) continue; changedClasspath |= true; classpath.add(JavaCore.newSourceEntry(source.getFullPath())); } ProgressUtil.progressOneStep(monitor, 10); // Adding the runtime library boolean found = false; for (final IClasspathEntry entry : classpath) { // All JRE Containers should have a prefix of // org.eclipse.jdt.launching.JRE_CONTAINER if (JavaRuntime.newDefaultJREContainerPath().isPrefixOf(entry.getPath()) && JavaRuntime.newDefaultJREContainerPath().equals(entry.getPath())) { found = true; break; } } if (!found) { changedClasspath = true; classpath.add(JavaRuntime.getDefaultJREContainerEntry()); } ProgressUtil.progressOneStep(monitor); // Configuring the classpath of the Java Project if (changedClasspath) { javaProject.setRawClasspath(classpath.toArray(new IClasspathEntry[0]), null); } IProjectFacetVersion projectFacetVersion = JavaFacetUtils.JAVA_60; if (StringUtils.isNotBlank(defaultCompilerLevel)) { try { projectFacetVersion = JavaFacetUtils.compilerLevelToFacet(defaultCompilerLevel); } catch (Exception e) { Logger.getLogger(JDTUtil.class.getName()).throwing(JDTUtil.class.getName(), "addJavaSupport", e); } } JavaFacetUtils.setCompilerLevel(project, projectFacetVersion); }
From source file:org.ebayopensource.turmeric.eclipse.utils.plugin.JDTUtil.java
License:Open Source License
private static void resolveClasspathToURLs(final IJavaProject javaProject, final Set<URL> resolvedEntries, final Set<String> visited) throws JavaModelException, IOException { if (javaProject == null || !javaProject.exists()) return;// ww w . ja v a 2s.c o m final String projectName = javaProject.getProject().getName(); if (visited.contains(projectName)) return; visited.add(projectName); for (final IClasspathEntry entry : javaProject.getResolvedClasspath(true)) { if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) { resolveClasspathToURLs(JavaCore.create(WorkspaceUtil.getProject(entry.getPath())), resolvedEntries, visited); } else if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { resolvedEntries.add(WorkspaceUtil.getLocation(entry.getPath()).toFile().toURI().toURL()); } else if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { IPath location = entry.getOutputLocation() != null ? entry.getOutputLocation() : javaProject.getOutputLocation(); if (location.toString().startsWith(WorkspaceUtil.PATH_SEPERATOR + projectName)) { //it happens that the path is not absolute location = javaProject.getProject().getFolder(location.removeFirstSegments(1)).getLocation(); } resolvedEntries.add(location.toFile().toURI().toURL()); } } }
From source file:org.ebayopensource.turmeric.eclipse.utils.plugin.JDTUtil.java
License:Open Source License
/** * Gets the source directories.//from w ww.ja va 2 s . c om * * @param project the project * @return the source directories */ public static List<IPath> getSourceDirectories(final IProject project) { final IJavaProject jProject = JavaCore.create(project); final List<IPath> srcEntries = new ArrayList<IPath>(); for (final IClasspathEntry entry : jProject.readRawClasspath()) { if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { srcEntries.add(entry.getPath()); } } return srcEntries; }
From source file:org.ebayopensource.turmeric.repositorysystem.imp.impl.TurmericProjectConfigurer.java
License:Open Source License
private void mavenizeAndCleanUp(final IProject project, final ProjectMavenizationRequest request, final IProgressMonitor monitor) throws CoreException, MavenEclipseApiException, IOException, InterruptedException, TemplateException { if (SOALogger.DEBUG) logger.entering(project, request); final IMavenEclipseApi api = MavenCoreUtils.mavenEclipseAPI(); try {// ww w.ja va 2 s.c o m // It seems that the pom.xml is not updated in the Eclipse Workspace by the mavenize project operation // Util.refresh( project.getFile( "pom.xml" ) ); // Project Mavenization doesn't seem to care that the output directory is set here and set in the pom.xml // it will use the maven default of target-eclipse no matter what. IJavaProject javaProject = null; try { api.mavenizeProject(request, monitor); logger.info("Mavenization finished->" + project); ProgressUtil.progressOneStep(monitor); javaProject = JavaCore.create(project); //javaProject.setOutputLocation( project.getFolder( SOAProjectConstants.FOLDER_OUTPUT_DIR).getFullPath(), null ); FileUtils.deleteDirectory(project.getFolder("target-eclipse").getLocation().toFile()); //Util.delete( project.getFolder( "target-eclipse" ), null ); final Map<?, ?> options = javaProject.getOptions(false); options.clear(); javaProject.setOptions(options); } catch (NullPointerException e) { throw new CoreException(EclipseMessageUtils.createErrorStatus( "NPE occured during projects mavenization.\n\n" + "The possible cause is that the M2Eclipse Maven indexes in your current workspace might be corrupted. " + "Please remove folder {workspace}/.metadata/.plugins/org.maven.ide.eclipse/, and then restart your IDE.", e)); } // The Mavenization also seemed to take the META-SRC src directory and add an exclusion pattern along with // setting its output location to itself. Maybe they wanted to do a class library folder? Either way its // no good for us. Secondly, we are setting the Maven classpath container to have its entries exported by default. // Finally, we are adding the classpath entry attribute 'org.eclipse.jst.component.dependency' in case the project // is a WTP web project so that WTP will use the maven classpath container when deploying to its runtime servers. boolean changed = false; final List<IClasspathEntry> newEntries = ListUtil.list(); final IPath containerPath = new Path(SOAMavenConstants.MAVEN_CLASSPATH_CONTAINER_ID); for (final IClasspathEntry cpEntry : JDTUtil.rawClasspath(javaProject, true)) { if (cpEntry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { if (cpEntry.getPath().equals(containerPath)) { newEntries.add(JavaCore.newContainerEntry(containerPath, true)); changed |= true; } } else if (cpEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { if (!ArrayUtils.isEmpty(cpEntry.getExclusionPatterns()) || cpEntry.getOutputLocation() != null) { newEntries.add(JavaCore.newSourceEntry(cpEntry.getPath())); changed |= true; } else { newEntries.add(cpEntry); } } else { newEntries.add(cpEntry); } } ProgressUtil.progressOneStep(monitor, 15); if (changed) { javaProject.setRawClasspath(newEntries.toArray(new IClasspathEntry[0]), null); ProgressUtil.progressOneStep(monitor); //This is a hot fix for the Maven classpath container issue, //should be removed as soon as the M2Eclipse guys fix it int count = 0; //we only go to sleep 5 times. while (MavenCoreUtils.getMaven2ClasspathContainer(javaProject).getClasspathEntries().length == 0 && count < 5) { logger.warning("Maven Classpath is empty->", SOAMavenConstants.MAVEN_CLASSPATH_CONTAINER_ID, ", going to sleep..."); Thread.sleep(1000); ProgressUtil.progressOneStep(monitor, 10); count++; } } } finally { if (SOALogger.DEBUG) logger.exiting(); } }
From source file:org.ebayopensource.vjet.eclipse.internal.launching.VjetInterpreterRunner.java
License:Open Source License
/** * Launches new jvm instance and runs within it interpreter. * /*from w w w . ja v a 2s.c o m*/ * @param config * launch configuration * @param launch * the result of launching a debug session. * @throws CoreException * if an error occurred when running interpreter * @see {@link ILaunch} * @see {@link } */ public void doRunImpl(InterpreterConfig config, ILaunch launch) throws CoreException { IScriptProject proj = AbstractScriptLaunchConfigurationDelegate .getScriptProject(launch.getLaunchConfiguration()); // do not cross boundary to java sdk - looks like we are tied to Java // IDE here IJavaProject myJavaProject = JavaCore.create(proj.getProject()); IVMInstall vmInstall = myJavaProject.exists() ? JavaRuntime.getVMInstall(myJavaProject) : JavaRuntime.getDefaultVMInstall(); if (vmInstall == null) { throw new CoreException( new Status(IStatus.ERROR, VjetPlugin.PLUGIN_ID, IStatus.ERROR, "No VMInstall", null)); } IVMRunner vmRunner = vmInstall.getVMRunner(m_mode); if (vmRunner == null) { throw new CoreException( new Status(IStatus.ERROR, VjetPlugin.PLUGIN_ID, IStatus.ERROR, "No VMRunner", null)); } IWorkspaceRoot workspaceRoot = proj.getProject().getWorkspace().getRoot(); // prepare js source search path String sourceSearchPath = null; // sourceSearchPath = prepareSourceSearchPath(proj, myJavaProject, // workspaceRoot, sourceSearchPath); // prepare java runtime class path String[] clzPath = VjoRunnerInfo.getClassPath(); if (DEBUG_LAUNCH) { for (String path : clzPath) { System.out.println(path); } } String[] jarPaths = null; if (myJavaProject.exists()) { // add this project's dependent jars (include those from all // dependent projects) // so the dependented javascript can be loaded from those jar files jarPaths = getJarPaths(myJavaProject); } else { jarPaths = getJarPaths(proj); } if (jarPaths.length > 0) { String[] newClzPath = new String[clzPath.length + jarPaths.length]; System.arraycopy(clzPath, 0, newClzPath, 0, clzPath.length); System.arraycopy(jarPaths, 0, newClzPath, clzPath.length, jarPaths.length); clzPath = newClzPath; } VMRunnerConfiguration vmConfig = new VMRunnerConfiguration(VjoRunnerInfo.getClassName(), clzPath); IPath scriptFilePath = config.getScriptFilePath(); if (scriptFilePath == null) { throw new CoreException(new Status(IStatus.ERROR, VjetPlugin.PLUGIN_ID, IStatus.ERROR, "Script File name is not specified...", null)); } else if (!proj.exists() && !myJavaProject.exists()) { throw new CoreException(new Status(IStatus.ERROR, VjetPlugin.PLUGIN_ID, IStatus.ERROR, "Must run js from a VJET or JAVA project!", null)); } // find vjo class String jsFile = scriptFilePath.toFile().getAbsolutePath(); String vjoClz = ""; if (!jsFile.endsWith(".js")) { // do nothing } else { // get vjo class name String sourceRoot = null; if (proj.exists()) {// get vjo class name from script project IModelElement[] children = proj.getChildren(); for (IModelElement elem : children) { if (elem instanceof IProjectFragment) { IProjectFragment melem = (IProjectFragment) elem; if (!melem.isReadOnly()) { String absolutePath = proj.getProject().getLocation().toFile().getAbsolutePath(); String srcDir = absolutePath.substring(0, absolutePath.indexOf(proj.getProject().getName())) + melem.getPath(); srcDir = srcDir.replace("/", "\\"); srcDir = srcDir.replace("\\\\", "\\"); if (jsFile.startsWith(srcDir)) { sourceRoot = srcDir; break; } } } } } if (StringUtils.isBlankOrEmpty(sourceRoot) && myJavaProject.exists()) {// get vjo class name from java // project IClasspathEntry[] classpathEntries = myJavaProject.getRawClasspath(); for (IClasspathEntry entry : classpathEntries) { if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { String path = getSourceFile(entry, workspaceRoot).getAbsolutePath(); if (jsFile.startsWith(path)) { sourceRoot = path; break; } } } } if (sourceRoot != null) { String vjoFile = jsFile.substring(sourceRoot.length() + 1); int suffixIndex = vjoFile.indexOf("."); if (suffixIndex > 0) { vjoFile = vjoFile.substring(0, suffixIndex); } vjoClz = vjoFile.replace("/", "."); vjoClz = vjoClz.replace("\\", "."); } } ILaunchConfiguration launchConf = launch.getLaunchConfiguration(); String args = launchConf.getAttribute(ScriptLaunchConfigurationConstants.ATTR_SCRIPT_ARGUMENTS, "").trim(); Map env = launchConf.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map) new HashMap()); List<String> loadJSList = launchConf.getAttribute( org.ebayopensource.vjet.eclipse.launching.ILaunchConstants.ATTR_INCLUDE_PATH, new ArrayList<String>()); if (loadJSList.size() > 0) { StringBuilder loadJSStr = new StringBuilder(); for (String js : loadJSList) { //int kind = Integer.parseInt(js.substring(0, 1)); String path = js.substring(1); loadJSStr.append(path).append(JsRunner.LIST_SEPERATOR); } env.put(JsRunner.LOAD_JS_KEY, loadJSStr.toString()); } List<String> pArgs = new ArrayList<String>(); if (vjoClz == "" && jsFile.indexOf("htm") != -1) { env.put("type", "html"); } addEnvOptions(env, pArgs); // add env options pArgs.add(scriptFilePath.toFile().getAbsolutePath()); pArgs.add(vjoClz); // pArgs.add(findMainFunc(vjoClz, proj.getProject().getName())); // add script arguments as line pArgs.add(new ArgsNormalizer(args).normalize()); vmConfig.setProgramArguments(pArgs.toArray(new String[] {})); List<String> vmArgs = new ArrayList<String>(4); if (sourceSearchPath != null) { vmArgs.add("-Djava.source.path=" + sourceSearchPath); } IFileStore s = org.eclipse.core.filesystem.EFS.getStore(proj.getProject().getProject().getLocationURI()); File f = s.toLocalFile(0, null); if (m_mode.equals(ILaunchManager.DEBUG_MODE)) { vmArgs.add("-DVJETDebugHost=" + config.getProperty(DbgpConstants.HOST_PROP)); vmArgs.add("-DVJETDebugPort=" + config.getProperty(DbgpConstants.PORT_PROP)); vmArgs.add("-DVJETDebugSessionID=" + config.getProperty(DbgpConstants.SESSION_ID_PROP)); vmArgs.add("-DVJETProjectPath=" + f.getAbsolutePath()); } // org.eclipse.jdt.launching.PROJECT_ATTR String javaprojectprop = "org.eclipse.jdt.launching.PROJECT_ATTR"; String projectName = myJavaProject.getProject().getName(); ILaunchConfigurationWorkingCopy copy = launch.getLaunchConfiguration().getWorkingCopy(); copy.setAttribute(javaprojectprop, projectName); copy.doSave(); setupProxySrcLocator(launch, copy); vmConfig.setVMArguments(vmArgs.toArray(new String[vmArgs.size()])); // ILaunch launchr = new Launch(launch.ge, m_mode, null); // // ISourceLookupDirector sourceLocator = new JavaSourceLookupDirector(); // sourceLocator // .setSourcePathComputer(DebugPlugin.getDefault().getLaunchManager() // .getSourcePathComputer( // "org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer")); //$NON-NLS-1$ // sourceLocator.initializeDefaults(launchConf); // // launch.setSourceLocator(sourceLocator); vmRunner.run(vmConfig, launch, null); IDebugTarget[] debugTargets = launch.getDebugTargets(); if (debugTargets.length > 0) { VjetLaunchingPlugin.getDefault().getLog() .log(new Status( IStatus.INFO, VjetPlugin.PLUGIN_ID, IStatus.INFO, "!USAGE_TRACKING: NAME=" + VjetPlugin.PLUGIN_ID + ".debug; ACCESS_TIME=" + new Date().toString() + ";", null)); } else { VjetLaunchingPlugin.getDefault().getLog() .log(new Status( IStatus.INFO, VjetPlugin.PLUGIN_ID, IStatus.INFO, "!USAGE_TRACKING: NAME=" + VjetPlugin.PLUGIN_ID + ".run; ACCESS_TIME=" + new Date().toString() + ";", null)); } // for (int a = 0; a < debugTargets.length; a++) { // // launch.addDebugTarget(debugTargets[a]); // } // // IProcess[] processes = launch.getProcesses(); // for (int a = 0; a < processes.length; a++) { // launch.addProcess(processes[a]); // } }
From source file:org.ebayopensource.vjet.eclipse.internal.launching.VjetInterpreterRunner.java
License:Open Source License
private static void getProjectSourcePaths(List<File> sourcePaths, IWorkspaceRoot workspaceRoot, IClasspathEntry[] classPathEntries) { if (classPathEntries != null) { for (IClasspathEntry classPathEntry : classPathEntries) { if (classPathEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { sourcePaths.add(getSourceFile(classPathEntry, workspaceRoot)); }// ww w . j av a 2 s . c o m } } }