cdt/cdt_6_0_x/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
changeset 62 c400a1d2216a
parent 54 89a4ce4b37f5
equal deleted inserted replaced
61:ff389f2cc4aa 62:c400a1d2216a
   137 	private String preLaunchBuildConfiguration;
   137 	private String preLaunchBuildConfiguration;
   138 
   138 
   139 	/**
   139 	/**
   140 	 * Used in conjunction with build before launch settings in the main tab.
   140 	 * Used in conjunction with build before launch settings in the main tab.
   141 	 */
   141 	 */
   142 	private boolean buildForLaunchCalled;
   142 	private boolean workspaceBuildBeforeLaunch;
       
   143 	
   143 	abstract public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
   144 	abstract public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
   144 			throws CoreException;
   145 			throws CoreException;
   145 
   146 
   146 	/**
   147 	/**
   147 	 * Returns the working directory specified by the given launch
   148 	 * Returns the working directory specified by the given launch
   598 	 *             if an exception occurs while building
   599 	 *             if an exception occurs while building
   599 	 */
   600 	 */
   600 	@Override
   601 	@Override
   601 	public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
   602 	public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
   602 
   603 
   603 		buildForLaunchCalled = true;
   604 		workspaceBuildBeforeLaunch = true;
   604 		
   605 		
   605 		// check the build before launch setting and honor it
   606 		// check the build before launch setting and honor it
   606 		int buildBeforeLaunchValue = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH,
   607 		int buildBeforeLaunchValue = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH,
   607 				ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING);
   608 				ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING);
   608 
   609 
   682 	 *             if an exception occurs while checking for compile errors.
   683 	 *             if an exception occurs while checking for compile errors.
   683 	 */
   684 	 */
   684 	@Override
   685 	@Override
   685 	public boolean finalLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
   686 	public boolean finalLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
   686 		
   687 		
   687 		if (!buildForLaunchCalled) {
   688 		if (!workspaceBuildBeforeLaunch) {
   688 			// buildForLaunch was not called which means that the workspace pref is disabled.  see if the user enabled the
   689 			// buildForLaunch was not called which means that the workspace pref is disabled.  see if the user enabled the
   689 			// launch specific setting in the main tab.  if so, we do call buildBeforeLaunch here.
   690 			// launch specific setting in the main tab.  if so, we do call buildBeforeLaunch here.
   690 			if (ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_ENABLED == configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH,
   691 			if (ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_ENABLED == configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH,
   691 					ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING)) {
   692 					ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING)) {
   692 				
   693 				
   805 	public boolean preLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
   806 	public boolean preLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
   806 		if(monitor == null) {
   807 		if(monitor == null) {
   807 			monitor = new NullProgressMonitor();
   808 			monitor = new NullProgressMonitor();
   808 		}
   809 		}
   809 
   810 
   810 		buildForLaunchCalled = false;
   811 		workspaceBuildBeforeLaunch = false;
   811 
   812 
   812 		int scale = 1000;
   813 		int scale = 1000;
   813 		int totalWork = 2 * scale;
   814 		int totalWork = 2 * scale;
   814 		
   815 		
   815 		try {
   816 		try {