1 11 package org.eclipse.jdt.launching; 12 import java.io.File ; 13 import com.ibm.icu.text.MessageFormat; 14 import java.util.ArrayList ; 15 import java.util.HashMap ; 16 import java.util.HashSet ; 17 import java.util.List ; 18 import java.util.Map ; 19 import java.util.Set ; 20 21 import org.eclipse.core.resources.IContainer; 22 import org.eclipse.core.resources.IMarker; 23 import org.eclipse.core.resources.IProject; 24 import org.eclipse.core.resources.IResource; 25 import org.eclipse.core.resources.ResourcesPlugin; 26 import org.eclipse.core.runtime.CoreException; 27 import org.eclipse.core.runtime.IPath; 28 import org.eclipse.core.runtime.IProgressMonitor; 29 import org.eclipse.core.runtime.IStatus; 30 import org.eclipse.core.runtime.Path; 31 import org.eclipse.core.runtime.Status; 32 import org.eclipse.core.variables.VariablesPlugin; 33 import org.eclipse.debug.core.DebugEvent; 34 import org.eclipse.debug.core.DebugPlugin; 35 import org.eclipse.debug.core.IBreakpointManager; 36 import org.eclipse.debug.core.IDebugEventSetListener; 37 import org.eclipse.debug.core.ILaunch; 38 import org.eclipse.debug.core.ILaunchConfiguration; 39 import org.eclipse.debug.core.ILaunchManager; 40 import org.eclipse.debug.core.model.IBreakpoint; 41 import org.eclipse.debug.core.model.LaunchConfigurationDelegate; 42 import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; 43 import org.eclipse.jdt.core.IJavaModelMarker; 44 import org.eclipse.jdt.core.IJavaProject; 45 import org.eclipse.jdt.core.JavaCore; 46 import org.eclipse.jdt.debug.core.IJavaDebugTarget; 47 import org.eclipse.jdt.debug.core.IJavaMethodBreakpoint; 48 import org.eclipse.jdt.debug.core.JDIDebugModel; 49 import org.eclipse.jdt.internal.launching.JRERuntimeClasspathEntryResolver; 50 import org.eclipse.jdt.internal.launching.JavaSourceLookupDirector; 51 import org.eclipse.jdt.internal.launching.LaunchingMessages; 52 import org.eclipse.jdt.internal.launching.LaunchingPlugin; 53 64 public abstract class AbstractJavaLaunchConfigurationDelegate 65 extends 66 LaunchConfigurationDelegate implements IDebugEventSetListener { 67 70 private IProject[] fOrderedProjects; 71 76 protected ILaunchManager getLaunchManager() { 77 return DebugPlugin.getDefault().getLaunchManager(); 78 } 79 93 protected void abort(String message, Throwable exception, int code) 94 throws CoreException { 95 throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin 96 .getUniqueIdentifier(), code, message, exception)); 97 } 98 109 public IVMInstall getVMInstall(ILaunchConfiguration configuration) 110 throws CoreException { 111 return JavaRuntime.computeVMInstall(configuration); 112 } 113 124 public String getVMInstallName(ILaunchConfiguration configuration) 125 throws CoreException { 126 return configuration.getAttribute( 127 IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_NAME, 128 (String ) null); 129 } 130 141 public IVMInstallType getVMInstallType(ILaunchConfiguration configuration) 142 throws CoreException { 143 String id = getVMInstallTypeId(configuration); 144 if (id != null) { 145 IVMInstallType type = JavaRuntime.getVMInstallType(id); 146 if (type != null) { 147 return type; 148 } 149 } 150 return null; 151 } 152 163 public String getVMInstallTypeId(ILaunchConfiguration configuration) 164 throws CoreException { 165 return configuration.getAttribute( 166 IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, 167 (String ) null); 168 } 169 181 public IVMInstall verifyVMInstall(ILaunchConfiguration configuration) 182 throws CoreException { 183 IVMInstall vm = getVMInstall(configuration); 184 if (vm == null) { 185 abort( 186 LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_The_specified_JRE_installation_does_not_exist_4, 187 null, 188 IJavaLaunchConfigurationConstants.ERR_VM_INSTALL_DOES_NOT_EXIST); 189 } 190 File location = vm.getInstallLocation(); 191 if (location == null) { 192 abort( 193 MessageFormat 194 .format( 195 LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_JRE_home_directory_not_specified_for__0__5, 196 new String []{vm.getName()}), 197 null, 198 IJavaLaunchConfigurationConstants.ERR_VM_INSTALL_DOES_NOT_EXIST); 199 } 200 if (!location.exists()) { 201 abort( 202 MessageFormat 203 .format( 204 LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_JRE_home_directory_for__0__does_not_exist___1__6, 205 new String []{vm.getName(), 206 location.getAbsolutePath()}), 207 null, 208 IJavaLaunchConfigurationConstants.ERR_VM_INSTALL_DOES_NOT_EXIST); 209 } 210 return vm; 211 } 212 223 public String getVMConnectorId(ILaunchConfiguration configuration) 224 throws CoreException { 225 return configuration.getAttribute( 226 IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, 227 (String ) null); 228 } 229 244 public String [] getBootpath(ILaunchConfiguration configuration) 245 throws CoreException { 246 String [][] paths = getBootpathExt(configuration); 247 String [] pre = paths[0]; 248 String [] main = paths[1]; 249 String [] app = paths[2]; 250 if (pre == null && main == null && app == null) { 251 return null; 253 } 254 IRuntimeClasspathEntry[] entries = JavaRuntime 255 .computeUnresolvedRuntimeClasspath(configuration); 256 entries = JavaRuntime.resolveRuntimeClasspath(entries, configuration); 257 List bootEntries = new ArrayList (entries.length); 258 boolean empty = true; 259 boolean allStandard = true; 260 for (int i = 0; i < entries.length; i++) { 261 if (entries[i].getClasspathProperty() != IRuntimeClasspathEntry.USER_CLASSES) { 262 String location = entries[i].getLocation(); 263 if (location != null) { 264 empty = false; 265 bootEntries.add(location); 266 allStandard = allStandard 267 && entries[i].getClasspathProperty() == IRuntimeClasspathEntry.STANDARD_CLASSES; 268 } 269 } 270 } 271 if (empty) { 272 return new String [0]; 273 } else if (allStandard) { 274 return null; 275 } else { 276 return (String []) bootEntries 277 .toArray(new String [bootEntries.size()]); 278 } 279 } 280 297 public String [][] getBootpathExt(ILaunchConfiguration configuration) 298 throws CoreException { 299 String [][] bootpathInfo = new String [3][]; 300 IRuntimeClasspathEntry[] entries = JavaRuntime 301 .computeUnresolvedRuntimeClasspath(configuration); 302 List bootEntriesPrepend = new ArrayList (); 303 int index = 0; 304 IRuntimeClasspathEntry jreEntry = null; 305 while (jreEntry == null && index < entries.length) { 306 IRuntimeClasspathEntry entry = entries[index++]; 307 if (entry.getClasspathProperty() == IRuntimeClasspathEntry.BOOTSTRAP_CLASSES 308 || entry.getClasspathProperty() == IRuntimeClasspathEntry.STANDARD_CLASSES) { 309 if (JavaRuntime.isVMInstallReference(entry)) { 310 jreEntry = entry; 311 } else { 312 bootEntriesPrepend.add(entry); 313 } 314 } 315 } 316 IRuntimeClasspathEntry[] bootEntriesPrep = JavaRuntime 317 .resolveRuntimeClasspath( 318 (IRuntimeClasspathEntry[]) bootEntriesPrepend 319 .toArray(new IRuntimeClasspathEntry[bootEntriesPrepend 320 .size()]), configuration); 321 String [] entriesPrep = null; 322 if (bootEntriesPrep.length > 0) { 323 entriesPrep = new String [bootEntriesPrep.length]; 324 for (int i = 0; i < bootEntriesPrep.length; i++) { 325 entriesPrep[i] = bootEntriesPrep[i].getLocation(); 326 } 327 } 328 if (jreEntry != null) { 329 List bootEntriesAppend = new ArrayList (); 330 for (; index < entries.length; index++) { 331 IRuntimeClasspathEntry entry = entries[index]; 332 if (entry.getClasspathProperty() == IRuntimeClasspathEntry.BOOTSTRAP_CLASSES) { 333 bootEntriesAppend.add(entry); 334 } 335 } 336 bootpathInfo[0] = entriesPrep; 337 IRuntimeClasspathEntry[] bootEntriesApp = JavaRuntime 338 .resolveRuntimeClasspath( 339 (IRuntimeClasspathEntry[]) bootEntriesAppend 340 .toArray(new IRuntimeClasspathEntry[bootEntriesAppend 341 .size()]), configuration); 342 if (bootEntriesApp.length > 0) { 343 bootpathInfo[2] = new String [bootEntriesApp.length]; 344 for (int i = 0; i < bootEntriesApp.length; i++) { 345 bootpathInfo[2][i] = bootEntriesApp[i].getLocation(); 346 } 347 } 348 IVMInstall install = getVMInstall(configuration); 349 LibraryLocation[] libraryLocations = install.getLibraryLocations(); 350 if (libraryLocations != null) { 351 if (!JRERuntimeClasspathEntryResolver.isSameArchives(libraryLocations, install.getVMInstallType().getDefaultLibraryLocations(install.getInstallLocation()))) { 358 IRuntimeClasspathEntry[] bootEntries = null; 360 if (jreEntry.getType() == IRuntimeClasspathEntry.CONTAINER) { 361 IRuntimeClasspathEntry bootEntry = JavaRuntime.newRuntimeContainerClasspathEntry( 362 jreEntry.getPath(), 363 IRuntimeClasspathEntry.BOOTSTRAP_CLASSES, 364 getJavaProject(configuration)); 365 bootEntries = JavaRuntime.resolveRuntimeClasspathEntry(bootEntry, configuration); 366 } else { 367 bootEntries = JavaRuntime.resolveRuntimeClasspathEntry(jreEntry, configuration); 368 } 369 370 String [] bootpath = new String [bootEntriesPrep.length 372 + bootEntries.length + bootEntriesApp.length]; 373 if (bootEntriesPrep.length > 0) { 374 System.arraycopy(bootpathInfo[0], 0, bootpath, 0, 375 bootEntriesPrep.length); 376 } 377 int dest = bootEntriesPrep.length; 378 for (int i = 0; i < bootEntries.length; i++) { 379 bootpath[dest] = bootEntries[i].getLocation(); 380 dest++; 381 } 382 if (bootEntriesApp.length > 0) { 383 System.arraycopy(bootpathInfo[2], 0, bootpath, dest, 384 bootEntriesApp.length); 385 } 386 bootpathInfo[0] = null; 387 bootpathInfo[1] = bootpath; 388 bootpathInfo[2] = null; 389 } 390 } 391 } else { 392 if (entriesPrep == null) { 393 bootpathInfo[1] = new String [0]; 394 } else { 395 bootpathInfo[1] = entriesPrep; 396 } 397 } 398 return bootpathInfo; 399 } 400 413 public String [] getClasspath(ILaunchConfiguration configuration) 414 throws CoreException { 415 IRuntimeClasspathEntry[] entries = JavaRuntime 416 .computeUnresolvedRuntimeClasspath(configuration); 417 entries = JavaRuntime.resolveRuntimeClasspath(entries, configuration); 418 List userEntries = new ArrayList (entries.length); 419 Set set = new HashSet (entries.length); 420 for (int i = 0; i < entries.length; i++) { 421 if (entries[i].getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) { 422 String location = entries[i].getLocation(); 423 if (location != null) { 424 if (!set.contains(location)) { 425 userEntries.add(location); 426 set.add(location); 427 } 428 } 429 } 430 } 431 return (String []) userEntries.toArray(new String [userEntries.size()]); 432 } 433 444 public IJavaProject getJavaProject(ILaunchConfiguration configuration) 445 throws CoreException { 446 String projectName = getJavaProjectName(configuration); 447 if (projectName != null) { 448 projectName = projectName.trim(); 449 if (projectName.length() > 0) { 450 IProject project = ResourcesPlugin.getWorkspace().getRoot() 451 .getProject(projectName); 452 IJavaProject javaProject = JavaCore.create(project); 453 if (javaProject != null && javaProject.exists()) { 454 return javaProject; 455 } 456 } 457 } 458 return null; 459 } 460 471 public String getJavaProjectName(ILaunchConfiguration configuration) 472 throws CoreException { 473 return configuration.getAttribute( 474 IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, 475 (String ) null); 476 } 477 488 public String getMainTypeName(ILaunchConfiguration configuration) 489 throws CoreException { 490 String mainType = configuration.getAttribute( 491 IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, 492 (String ) null); 493 if (mainType == null) { 494 return null; 495 } 496 return VariablesPlugin.getDefault().getStringVariableManager() 497 .performStringSubstitution(mainType); 498 } 499 511 public String getProgramArguments(ILaunchConfiguration configuration) 512 throws CoreException { 513 String arguments = configuration.getAttribute( 514 IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, ""); return VariablesPlugin.getDefault().getStringVariableManager() 516 .performStringSubstitution(arguments); 517 } 518 529 public String getVMArguments(ILaunchConfiguration configuration) throws CoreException { 530 String arguments = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, ""); String args = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(arguments); 532 int libraryPath = args.indexOf("-Djava.library.path"); if (libraryPath < 0) { 534 String [] javaLibraryPath = getJavaLibraryPath(configuration); 536 if (javaLibraryPath != null && javaLibraryPath.length > 0) { 537 StringBuffer path = new StringBuffer (args); 538 path.append(" -Djava.library.path="); path.append("\""); for (int i = 0; i < javaLibraryPath.length; i++) { 541 if (i > 0) { 542 path.append(File.pathSeparatorChar); 543 } 544 path.append(javaLibraryPath[i]); 545 } 546 path.append("\""); args = path.toString(); 548 } 549 } 550 return args; 551 } 552 562 public Map getVMSpecificAttributesMap(ILaunchConfiguration configuration) 563 throws CoreException { 564 Map map = configuration 565 .getAttribute( 566 IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP, 567 (Map ) null); 568 String [][] paths = getBootpathExt(configuration); 569 String [] pre = paths[0]; 570 String [] boot = paths[1]; 571 String [] app = paths[2]; 572 if (pre != null || app != null || boot != null) { 573 if (map == null) { 574 map = new HashMap (3); 575 } 576 if (pre != null) { 577 map 578 .put( 579 IJavaLaunchConfigurationConstants.ATTR_BOOTPATH_PREPEND, 580 pre); 581 } 582 if (app != null) { 583 map.put(IJavaLaunchConfigurationConstants.ATTR_BOOTPATH_APPEND, 584 app); 585 } 586 if (boot != null) { 587 map.put(IJavaLaunchConfigurationConstants.ATTR_BOOTPATH, boot); 588 } 589 } 590 return map; 591 } 592 603 public File getWorkingDirectory(ILaunchConfiguration configuration) 604 throws CoreException { 605 return verifyWorkingDirectory(configuration); 606 } 607 618 public IPath getWorkingDirectoryPath(ILaunchConfiguration configuration) 619 throws CoreException { 620 String path = configuration.getAttribute( 621 IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, 622 (String ) null); 623 if (path != null) { 624 path = VariablesPlugin.getDefault().getStringVariableManager() 625 .performStringSubstitution(path); 626 return new Path(path); 627 } 628 return null; 629 } 630 641 public IJavaProject verifyJavaProject(ILaunchConfiguration configuration) 642 throws CoreException { 643 String name = getJavaProjectName(configuration); 644 if (name == null) { 645 abort( 646 LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Java_project_not_specified_9, 647 null, 648 IJavaLaunchConfigurationConstants.ERR_UNSPECIFIED_PROJECT); 649 } 650 IJavaProject project = getJavaProject(configuration); 651 if (project == null) { 652 abort( 653 LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Project_does_not_exist_or_is_not_a_Java_project_10, 654 null, 655 IJavaLaunchConfigurationConstants.ERR_NOT_A_JAVA_PROJECT); 656 } 657 return project; 658 } 659 670 public String verifyMainTypeName(ILaunchConfiguration configuration) 671 throws CoreException { 672 String name = getMainTypeName(configuration); 673 if (name == null) { 674 abort( 675 LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Main_type_not_specified_11, 676 null, 677 IJavaLaunchConfigurationConstants.ERR_UNSPECIFIED_MAIN_TYPE); 678 } 679 return name; 680 } 681 693 public File verifyWorkingDirectory(ILaunchConfiguration configuration) 694 throws CoreException { 695 IPath path = getWorkingDirectoryPath(configuration); 696 if (path == null) { 697 File dir = getDefaultWorkingDirectory(configuration); 698 if (dir != null) { 699 if (!dir.isDirectory()) { 700 abort( 701 MessageFormat.format( 702 LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Working_directory_does_not_exist___0__12, 703 new String []{dir.toString()}), 704 null, 705 IJavaLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST); 706 } 707 return dir; 708 } 709 } else { 710 if (path.isAbsolute()) { 711 File dir = new File (path.toOSString()); 712 if (dir.isDirectory()) { 713 return dir; 714 } 715 IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(path); 719 if (res instanceof IContainer && res.exists()) { 720 return res.getLocation().toFile(); 721 } 722 abort( 723 MessageFormat 724 .format( 725 LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Working_directory_does_not_exist___0__12, 726 new String []{path.toString()}), 727 null, 728 IJavaLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST); 729 } else { 730 IResource res = ResourcesPlugin.getWorkspace().getRoot() 731 .findMember(path); 732 if (res instanceof IContainer && res.exists()) { 733 return res.getLocation().toFile(); 734 } 735 abort( 736 MessageFormat 737 .format( 738 LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Working_directory_does_not_exist___0__12, 739 new String []{path.toString()}), 740 null, 741 IJavaLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST); 742 } 743 } 744 return null; 745 } 746 756 public boolean isAllowTerminate(ILaunchConfiguration configuration) 757 throws CoreException { 758 return configuration.getAttribute( 759 IJavaLaunchConfigurationConstants.ATTR_ALLOW_TERMINATE, false); 760 } 761 772 public boolean isStopInMain(ILaunchConfiguration configuration) 773 throws CoreException { 774 return configuration.getAttribute( 775 IJavaLaunchConfigurationConstants.ATTR_STOP_IN_MAIN, false); 776 } 777 789 protected void setDefaultSourceLocator(ILaunch launch, 790 ILaunchConfiguration configuration) throws CoreException { 791 if (launch.getSourceLocator() == null) { 793 ISourceLookupDirector sourceLocator = new JavaSourceLookupDirector(); 794 sourceLocator 795 .setSourcePathComputer(getLaunchManager() 796 .getSourcePathComputer( 797 "org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer")); sourceLocator.initializeDefaults(configuration); 799 launch.setSourceLocator(sourceLocator); 800 } 801 } 802 813 protected void prepareStopInMain(ILaunchConfiguration configuration) 814 throws CoreException { 815 if (isStopInMain(configuration)) { 816 DebugPlugin.getDefault().addDebugEventListener(this); 821 } 822 } 823 830 public void handleDebugEvents(DebugEvent[] events) { 831 for (int i = 0; i < events.length; i++) { 832 DebugEvent event = events[i]; 833 if (event.getKind() == DebugEvent.CREATE 834 && event.getSource() instanceof IJavaDebugTarget) { 835 IJavaDebugTarget target = (IJavaDebugTarget) event.getSource(); 836 ILaunch launch = target.getLaunch(); 837 if (launch != null) { 838 ILaunchConfiguration configuration = launch 839 .getLaunchConfiguration(); 840 if (configuration != null) { 841 try { 842 if (isStopInMain(configuration)) { 843 String mainType = getMainTypeName(configuration); 844 if (mainType != null) { 845 Map map = new HashMap (); 846 map 847 .put( 848 IJavaLaunchConfigurationConstants.ATTR_STOP_IN_MAIN, 849 IJavaLaunchConfigurationConstants.ATTR_STOP_IN_MAIN); 850 IJavaMethodBreakpoint bp = JDIDebugModel 851 .createMethodBreakpoint( 852 ResourcesPlugin 853 .getWorkspace() 854 .getRoot(), 855 mainType, "main", "([Ljava/lang/String;)V", true, false, false, -1, -1, 858 -1, 1, false, map); 859 bp.setPersisted(false); 860 target.breakpointAdded(bp); 861 DebugPlugin.getDefault() 862 .removeDebugEventListener(this); 863 } 864 } 865 } catch (CoreException e) { 866 LaunchingPlugin.log(e); 867 } 868 } 869 } 870 } 871 } 872 } 873 874 880 protected IProject[] getBuildOrder(ILaunchConfiguration configuration, 881 String mode) throws CoreException { 882 return fOrderedProjects; 883 } 884 890 protected IProject[] getProjectsForProblemSearch( 891 ILaunchConfiguration configuration, String mode) 892 throws CoreException { 893 return fOrderedProjects; 894 } 895 896 899 protected boolean isLaunchProblem(IMarker problemMarker) throws CoreException { 900 return super.isLaunchProblem(problemMarker) && problemMarker.getType().equals(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); 901 } 902 908 public boolean preLaunchCheck(ILaunchConfiguration configuration, 909 String mode, IProgressMonitor monitor) throws CoreException { 910 if (monitor != null) { 912 monitor.subTask(LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_20); 913 } 914 fOrderedProjects = null; 915 IJavaProject javaProject = JavaRuntime.getJavaProject(configuration); 916 if (javaProject != null) { 917 fOrderedProjects = computeReferencedBuildOrder(new IProject[]{javaProject 918 .getProject()}); 919 } 920 return super.preLaunchCheck(configuration, mode, monitor); 922 } 923 924 927 protected IBreakpoint[] getBreakpoints(ILaunchConfiguration configuration) { 928 IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager(); 929 if (!breakpointManager.isEnabled()) { 930 return null; 932 } 933 return breakpointManager.getBreakpoints(JDIDebugModel.getPluginIdentifier()); 934 } 935 936 946 public IVMRunner getVMRunner(ILaunchConfiguration configuration, String mode) throws CoreException { 947 IVMInstall vm = verifyVMInstall(configuration); 948 IVMRunner runner = vm.getVMRunner(mode); 949 if (runner == null) { 950 abort(MessageFormat.format(LaunchingMessages.JavaLocalApplicationLaunchConfigurationDelegate_0, new String []{vm.getName(), mode}), null, IJavaLaunchConfigurationConstants.ERR_VM_RUNNER_DOES_NOT_EXIST); 951 } 952 return runner; 953 } 954 955 964 public String [] getEnvironment(ILaunchConfiguration configuration) throws CoreException { 965 return DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration); 966 } 967 968 978 public String [] getJavaLibraryPath(ILaunchConfiguration configuration) throws CoreException { 979 IJavaProject project = getJavaProject(configuration); 980 if (project != null) { 981 String [] paths = JavaRuntime.computeJavaLibraryPath(project, true); 982 if (paths.length > 0) { 983 return paths; 984 } 985 } 986 return null; 987 } 988 989 999 protected File getDefaultWorkingDirectory(ILaunchConfiguration configuration) throws CoreException { 1000 IJavaProject jp = getJavaProject(configuration); 1002 if (jp != null) { 1003 IProject p = jp.getProject(); 1004 return p.getLocation().toFile(); 1005 } 1006 return null; 1007 } 1008} 1009 | Popular Tags |