Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] A minor patch with some fixes for the Shared Tools Options Proposal (Committed last week) - Patch


Hi Leo,

Please find attached the patch. It's alraedy late in friday here. So if there are any problems I will answer them on Monday.

The patch contains the following changes:
  • Fix for the bug in that if you clone a configuration of a newly created project new option values (for options that are children of IToolChain only) are lost in the transfer. The second time round (i.e. when loaded from .cdtbuild) the options are not lost. This is a bug in Option class of CDT.
  • Implemented IOption.setValueHandlerExtraArgument method.
  • Corrected option "valuehandler"s to use getFilteredTools() method.
  • Re-implemented MBSManagedOptionValueHandler.isDefaultValue() method.

Attached the diff file (in txt) with the patch.


Regards,
-Bala


********************************************************************** Symbian Software Ltd is a company registered in England and Wales with registered number 4190020 and registered office at 2-6 Boundary Row, Southwark, London, SE1 8HP, UK. This message is intended only for use by the named addressee and may contain privileged and/or confidential information. If you are not the named addressee you should not disseminate, copy or take any action in reliance on it. If you have received this message in error please notify postmaster@xxxxxxxxxxx and delete the message and any attachments accompanying it immediately. Neither Symbian nor any of its subsidiaries accepts liability for any corruption, interception, amendment, tampering or viruses occurring to this message in transit or for any message sent by its employees which is not in compliance with Symbian corporate policy. **********************************************************************

Index: src/org/eclipse/cdt/managedbuilder/core/IOption.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java,v
retrieving revision 1.11
diff -c -r1.11 IOption.java
*** src/org/eclipse/cdt/managedbuilder/core/IOption.java	6 Jun 2005 15:51:49 -0000	1.11
--- src/org/eclipse/cdt/managedbuilder/core/IOption.java	10 Jun 2005 17:31:48 -0000
***************
*** 376,381 ****
--- 376,388 ----
  	public String getValueHandlerExtraArgument();
  		
  	/**
+ 	 * Sets the value handlers extra argument specified for this tool
+ 	 * @param extraArgument
+ 	 * @since 3.0
+ 	 */
+ 	public void setValueHandlerExtraArgument(String extraArgument);
+ 
+ 	/**
  	 * Returns <code>true</code> if this option was loaded from a manifest file,
  	 * and <code>false</code> if it was loaded from a project (.cdtbuild) file.
  	 * 
Index: src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java,v
retrieving revision 1.46
diff -c -r1.46 ManagedBuildManager.java
*** src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java	9 Jun 2005 17:34:45 -0000	1.46
--- src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java	10 Jun 2005 17:31:49 -0000
***************
*** 2437,2443 ****
  		}
  
  		// Get options associated with tools under toolChain
! 		ITool[] tools = toolChain.getTools();
  		for (int i = 0; i < tools.length; ++i) {
  			IOption[] toolOptions = tools[i].getOptions();
  			for (int j = 0; j < toolOptions.length; ++j) {
--- 2437,2443 ----
  		}
  
  		// Get options associated with tools under toolChain
! 		ITool[] tools = config.getFilteredTools();
  		for (int i = 0; i < tools.length; ++i) {
  			IOption[] toolOptions = tools[i].getOptions();
  			for (int j = 0; j < toolOptions.length; ++j) {
Index: src/org/eclipse/cdt/managedbuilder/core/ManagedOptionValueHandler.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedOptionValueHandler.java,v
retrieving revision 1.1
diff -c -r1.1 ManagedOptionValueHandler.java
*** src/org/eclipse/cdt/managedbuilder/core/ManagedOptionValueHandler.java	6 Jun 2005 15:51:49 -0000	1.1
--- src/org/eclipse/cdt/managedbuilder/core/ManagedOptionValueHandler.java	10 Jun 2005 17:31:49 -0000
***************
*** 11,16 ****
--- 11,18 ----
  
  package org.eclipse.cdt.managedbuilder.core;
  
+ import java.util.Arrays;
+ 
  
  /**
   * This class implements the default managed option value handler for MBS.
***************
*** 49,55 ****
                     IOption option,
                     String extraArgument, int event)
  	{
! 	/*	
  		// The following is for debug purposes and thus normally commented out		
  		String configLabel = "???"; //$NON-NLS-1$
  		String holderLabel = "???"; //$NON-NLS-1$
--- 51,57 ----
                     IOption option,
                     String extraArgument, int event)
  	{
! 		
  		// The following is for debug purposes and thus normally commented out		
  		String configLabel = "???"; //$NON-NLS-1$
  		String holderLabel = "???"; //$NON-NLS-1$
***************
*** 84,90 ****
  						   option.getId() + ", " +         //$NON-NLS-1$
  						   "String = " +                   //$NON-NLS-1$
  						   extraArgument + ")");           //$NON-NLS-1$
! 	*/	
  		// The event was not handled, thus return false
  		return false;
  	}
--- 86,92 ----
  						   option.getId() + ", " +         //$NON-NLS-1$
  						   "String = " +                   //$NON-NLS-1$
  						   extraArgument + ")");           //$NON-NLS-1$
! 		
  		// The event was not handled, thus return false
  		return false;
  	}
***************
*** 95,106 ****
  	public boolean isDefaultValue(IBuildObject configuration, 
                        IHoldsOptions holder, 
                        IOption option, String extraArgument) {
! 		// Implement default behavior
! 	   if (option.getDefaultValue() == option.getValue()) {
! 		   return true;
! 	   } else {
! 		   return false;
! 	   }
  	}
  
  	/* (non-Javadoc)
--- 97,154 ----
  	public boolean isDefaultValue(IBuildObject configuration, 
                        IHoldsOptions holder, 
                        IOption option, String extraArgument) {
! 		// Get the default Value
! 	   Object defaultValue = option.getDefaultValue();
! 	   
! 		try {
! 			// Figure out which type the option is and implement default behaviour for it.
! 			switch (option.getValueType()) {
! 				case IOption.STRING:
! 					if (option.getStringValue() == (String)defaultValue) {
! 						return true;
! 					}
! 					break;
! 				case IOption.BOOLEAN:
! 					if (option.getBooleanValue() == ((Boolean)defaultValue).booleanValue()) {
! 						return true;
! 					}
! 					break;
! 				case IOption.ENUMERATED:
! 					if (option.getValue().toString() == defaultValue.toString()) {
! 						return true;
! 					}
! 					break;
! 				case IOption.INCLUDE_PATH:
! 					if (Arrays.equals(option.getIncludePaths(), (String[])defaultValue)) {
! 						return true;
! 					}
! 					break;
! 				case IOption.STRING_LIST:
! 					if (Arrays.equals(option.getStringListValue(), (String[])defaultValue)) {
! 						return true;
! 					}
! 					break;
! 				case IOption.PREPROCESSOR_SYMBOLS:
! 					if (Arrays.equals(option.getDefinedSymbols(), (String[])defaultValue)) {
! 						return true;
! 					}
! 					break;
! 				case IOption.LIBRARIES:
! 					if (Arrays.equals(option.getLibraries(), (String[])defaultValue)) {
! 						return true;
! 					}
! 					break;
! 				case IOption.OBJECTS:
! 					if (Arrays.equals(option.getUserObjects(), (String[])defaultValue)) {
! 						return true;
! 					}
! 					break;
! 				default:
! 					break;
! 				}
! 		} catch (BuildException e) {
! 		}
! 		return false;
  	}
  
  	/* (non-Javadoc)
Index: src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java,v
retrieving revision 1.18
diff -c -r1.18 Option.java
*** src/org/eclipse/cdt/managedbuilder/internal/core/Option.java	6 Jun 2005 15:51:49 -0000	1.18
--- src/org/eclipse/cdt/managedbuilder/internal/core/Option.java	10 Jun 2005 17:31:49 -0000
***************
*** 195,203 ****
  			enumCommands = new HashMap(option.enumCommands);
  			enumNames = new HashMap(option.enumNames);
  		}
  		if (option.valueType != null) {
  			valueType = new Integer(option.valueType.intValue());
! 			switch (valueType.intValue()) {
  				case BOOLEAN:
  					if (option.value != null) {
  						value = new Boolean(((Boolean)option.value).booleanValue());
--- 195,214 ----
  			enumCommands = new HashMap(option.enumCommands);
  			enumNames = new HashMap(option.enumNames);
  		}
+ 
+ 		//Bug fix start
+ 		Integer vType = null;
+ 		try {
+ 			vType = new Integer(option.getValueType());
+ 		} catch (BuildException be) {
+ 			//should we ignore this??
+ 		}
  		if (option.valueType != null) {
  			valueType = new Integer(option.valueType.intValue());
! 		}
! 		//Bug fix end
! 		if (vType != null) {
! 			switch (vType.intValue()) {
  				case BOOLEAN:
  					if (option.value != null) {
  						value = new Boolean(((Boolean)option.value).booleanValue());
***************
*** 1438,1443 ****
--- 1449,1469 ----
  		}
  		return valueHandlerExtraArgument;
  	}
+ 
+ 	/* (non-Javadoc)
+ 	 * @see org.eclipse.cdt.managedbuilder.core.IOption#setValueHandlerExtraArgument(String))
+ 	 */
+ 	public void setValueHandlerExtraArgument(String extraArgument) {
+ 		if (valueHandlerExtraArgument != null) {
+ 			if (extraArgument == null)
+ 				extraArgument = ""; //$NON-NLS-1$
+ 			if (!valueHandlerExtraArgument.equals(extraArgument)) {
+ 				valueHandlerExtraArgument = extraArgument;
+ 				setDirty(true);
+ 			}
+ 		}
+ 	}
+ 
  	
  	/*
  	 *  O B J E C T   S T A T E   M A I N T E N A N C E
Index: src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java,v
retrieving revision 1.19
diff -c -r1.19 OptionReference.java
*** src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java	6 Jun 2005 15:51:49 -0000	1.19
--- src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java	10 Jun 2005 17:31:49 -0000
***************
*** 782,787 ****
--- 782,793 ----
  	}
  
  	/* (non-Javadoc)
+ 	 * @see org.eclipse.cdt.managedbuilder.core.IOption#setValueHandlerExtraArgument(String))
+ 	 */
+ 	public void setValueHandlerExtraArgument(String extraArgument) {
+ 	}
+ 	
+ 	/* (non-Javadoc)
  	 * @see org.eclipse.cdt.managedbuilder.core.IOption#isValid()
  	 */
  	public boolean isValid() {

Back to the top