[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Patch to add built-in symbols and include paths to tool specifications
|
Hi All,
This patch contains some minor UI changes and a big chunk of work to add
built-in symbols and includes search paths to a tool specification.
The UI change is a switch from dynamically resizing the property page when
an option category is selected from the list, but rather using a scrolled
edit area. Now, if the option set is larger than the viewable area, a
horizontal and/or vertical scrollbar is displayed.
In terms of built-ins, there is no UI support to change the values just
yet. That is coming, but I wanted to get the framework and some
definitions in place so that the indexer and scanner can start using them.
Patches have been tested on *nix and do not cause any regression on the
build tests or problems in the UI.
Sean Evoy
Rational Software - IBM Software Group
Ottawa, Ontario, Canada
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/ChangeLog,v
retrieving revision 1.125
diff -u -r1.125 ChangeLog
--- ChangeLog 18 Aug 2003 17:34:23 -0000 1.125
+++ ChangeLog 19 Aug 2003 22:43:57 -0000
@@ -1,3 +1,35 @@
+2003-08-19 Sean Evoy
+ In order to properly support the indexing feature, the scanner has to
+ function as well as the version that ships with the toolset if possible.
+ This is made difficult by the fact that we are trying to be tool-agnostic.
+ One of the things that the scanner should take into account when it runs
+ is the "built-in" symbols and search paths that are defined for a compiler
+ in a given toolchain. While we need to come up with a standard mechanism
+ for the CDT in the future, the managed build system can provide a work-around
+ in the near-term. The easiest solution is to add an optional attribute to a
+ list element that flags the item as a built-in value. When clients like
+ the indexer query the build model, they will receive the union of the built-in
+ values and the user-defined values.
+
+ Updated the comment for the IScannerInfo::getIncludesPaths() method to
+ explain the content of the return value.
+ * parser/org/eclipse/cdt/core/parser/IScannerInfo.java
+
+ Added code to answer the built-ins when IScannerInfo methods are called.
+ * build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java
+
+ Updated the schema to include the new attribute
+ * schema/ManagedBuildTools.exsd
+
+ Added a public method to extract the built-in values for an option.
+ * build/org/eclipse/cdt/core/build/managed/IOption.java
+
+ Added the code to read, store and persist the built-in list values
+ differently than standard list elements. Also added code to answer
+ those built-ins to conform to the interface change.
+ * build/org/eclipse/cdt/internal/core/build/managed/Option.java
+ * build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java
+
2003-08-13 Sean Evoy
Changed text generated into makefile comments from the rather abstract
term 'module' to the more meaningful 'subdirectory'.
Index: build/org/eclipse/cdt/core/build/managed/IOption.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java,v
retrieving revision 1.10
diff -u -r1.10 IOption.java
--- build/org/eclipse/cdt/core/build/managed/IOption.java 31 Jul 2003 13:20:37 -0000 1.10
+++ build/org/eclipse/cdt/core/build/managed/IOption.java 19 Aug 2003 22:43:57 -0000
@@ -23,7 +23,7 @@
public static final int PREPROCESSOR_SYMBOLS = 5;
public static final int LIBRARIES = 6;
- // Schema element names for options
+ // Schema attribute names for option elements
public static final String CATEGORY = "category";
public static final String COMMAND = "command";
public static final String DEFAULT_VALUE = "defaultValue";
@@ -37,7 +37,10 @@
public static final String TYPE_STRING = "string";
public static final String TYPE_STR_LIST = "stringList";
public static final String VALUE_TYPE = "valueType";
- public static final String VALUE = "value";
+
+ // Schema attribute names for listOptionValue elements
+ public static final String LIST_ITEM_VALUE = "value";
+ public static final String LIST_ITEM_BUILTIN = "builtIn";
/**
@@ -56,6 +59,16 @@
* @throws BuildException
*/
public boolean getBooleanValue() throws BuildException;
+
+ /**
+ * Answers an array of strings containing the built-in values
+ * defined for a stringList, includePaths, definedSymbols, or libs
+ * option. If none have been defined, the array will be empty but
+ * never <code>null</code>.
+ *
+ * @return
+ */
+ public String[] getBuiltIns();
/**
* Returns the category for this option.
Index: build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java,v
retrieving revision 1.5
diff -u -r1.5 ManagedBuildInfo.java
--- build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java 18 Aug 2003 17:34:23 -0000 1.5
+++ build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java 19 Aug 2003 22:43:58 -0000
@@ -14,14 +14,15 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import org.eclipse.cdt.core.build.managed.BuildException;
import org.eclipse.cdt.core.build.managed.IConfiguration;
-import org.eclipse.cdt.core.build.managed.IOption;
import org.eclipse.cdt.core.build.managed.IManagedBuildInfo;
+import org.eclipse.cdt.core.build.managed.IOption;
import org.eclipse.cdt.core.build.managed.ITarget;
import org.eclipse.cdt.core.build.managed.ITool;
import org.eclipse.cdt.core.parser.IScannerInfo;
@@ -80,7 +81,7 @@
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#addTarget(org.eclipse.cdt.core.build.managed.ITarget)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#addTarget(org.eclipse.cdt.core.build.managed.ITarget)
*/
public void addTarget(ITarget target) {
targetMap.put(target.getId(), target);
@@ -104,7 +105,7 @@
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getBuildArtifactName()
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getBuildArtifactName()
*/
public String getBuildArtifactName() {
// Get the default target and use its value
@@ -133,7 +134,7 @@
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getDefaultConfiguration()
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getDefaultConfiguration()
*/
public IConfiguration getDefaultConfiguration(ITarget target) {
// Get the default config associated with the defalt target
@@ -150,7 +151,7 @@
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getDefaultTarget()
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getDefaultTarget()
*/
public ITarget getDefaultTarget() {
if (defaultTarget == null) {
@@ -160,7 +161,53 @@
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getFlagsForSource(java.lang.String)
+ * @see org.eclipse.cdt.core.build.managed.IScannerInfo#getDefinedSymbols()
+ */
+ public Map getDefinedSymbols() {
+ // Return the defined symbols for the default configuration
+ HashMap symbols = new HashMap();
+ IConfiguration config = getDefaultConfiguration(getDefaultTarget());
+ ITool[] tools = config.getTools();
+ for (int i = 0; i < tools.length; i++) {
+ ITool tool = tools[i];
+ IOption[] opts = tool.getOptions();
+ for (int j = 0; j < opts.length; j++) {
+ IOption option = opts[j];
+ if (option.getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
+ try {
+ ArrayList symbolList = new ArrayList();
+ symbolList.addAll(Arrays.asList(option.getBuiltIns()));
+ symbolList.addAll(Arrays.asList(option.getDefinedSymbols()));
+ Iterator iter = symbolList.listIterator();
+ while (iter.hasNext()) {
+ String symbol = (String) iter.next();
+ if (symbol.length() == 0){
+ continue;
+ }
+ String key = new String();
+ String value = new String();
+ int index = symbol.indexOf("=");
+ if (index != -1) {
+ key = symbol.substring(0, index).trim();
+ value = symbol.substring(index + 1).trim();
+ } else {
+ key = symbol.trim();
+ }
+ symbols.put(key, value);
+ }
+
+ } catch (BuildException e) {
+ // we should never get here
+ continue;
+ }
+ }
+ }
+ }
+ return symbols;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getFlagsForSource(java.lang.String)
*/
public String getFlagsForSource(String extension) {
// Get all the tools for the current config
@@ -183,7 +230,7 @@
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getToolFlags(java.lang.String)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getToolFlags(java.lang.String)
*/
public String getFlagsForTarget(String extension) {
// Treat null extensions as an empty string
@@ -199,7 +246,8 @@
try {
flags = tool.getToolFlags();
} catch (BuildException e) {
- // TODO: handle exception
+ // Somehow the model is out of sync for this item. Keep iterating
+ continue;
}
return flags;
}
@@ -222,9 +270,12 @@
IOption option = opts[j];
if (option.getValueType() == IOption.INCLUDE_PATH) {
try {
+ // Get all the built-in paths from the option
+ paths.addAll(Arrays.asList(option.getBuiltIns()));
+ // Get all the user-defined paths from the option
paths.addAll(Arrays.asList(option.getIncludePaths()));
} catch (BuildException e) {
- // we should never get here
+ // we should never get here, but continue anyway
continue;
}
}
@@ -289,7 +340,7 @@
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getOutputExtension(java.lang.String)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getOutputExtension(java.lang.String)
*/
public String getOutputExtension(String resourceExtension) {
// Get all the tools for the current config
@@ -349,21 +400,21 @@
return owner;
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getTarget(org.eclipse.cdt.core.build.managed.IConfiguration)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getTarget(org.eclipse.cdt.core.build.managed.IConfiguration)
*/
public ITarget getTarget(String id) {
return (ITarget) targetMap.get(id);
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getTargets(org.eclipse.cdt.core.build.managed.IConfiguration)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getTargets(org.eclipse.cdt.core.build.managed.IConfiguration)
*/
public List getTargets() {
return targets;
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getToolForSource(java.lang.String)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getToolForSource(java.lang.String)
*/
public String getToolForSource(String extension) {
// Get all the tools for the current config
@@ -379,7 +430,7 @@
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getToolInvocation(java.lang.String)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getToolInvocation(java.lang.String)
*/
public String getToolForTarget(String extension) {
// Treat a null argument as an empty string
@@ -418,7 +469,7 @@
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#setDefaultConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#setDefaultConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration)
*/
public void setDefaultConfiguration(IConfiguration configuration) {
// Get the target associated with the argument
@@ -429,56 +480,13 @@
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#setDefaultTarget(org.eclipse.cdt.core.build.managed.ITarget)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#setDefaultTarget(org.eclipse.cdt.core.build.managed.ITarget)
*/
public void setDefaultTarget(ITarget target) {
if (defaultTarget != null && defaultTarget.getId().equals(target.getId())) {
return;
}
defaultTarget = target;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IScannerInfo#getDefinedSymbols()
- */
- public Map getDefinedSymbols() {
- // Return the defined symbols for the default configuration
- HashMap symbols = new HashMap();
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- ITool[] tools = config.getTools();
- for (int i = 0; i < tools.length; i++) {
- ITool tool = tools[i];
- IOption[] opts = tool.getOptions();
- for (int j = 0; j < opts.length; j++) {
- IOption option = opts[j];
- if (option.getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
- try {
- String[] symbolList = option.getDefinedSymbols();
- for (int k = 0; k < symbolList.length; k++) {
- String symbol = symbolList[k];
- if (symbol.length() == 0){
- continue;
- }
- String key = new String();
- String value = new String();
- int index = symbol.indexOf("=");
- if (index != -1) {
- key = symbol.substring(0, index).trim();
- value = symbol.substring(index + 1).trim();
- } else {
- key = symbol.trim();
- }
- symbols.put(key, value);
- }
-
- } catch (BuildException e) {
- // we should never get here
- continue;
- }
- }
- }
- }
- return symbols;
}
}
Index: build/org/eclipse/cdt/internal/core/build/managed/Option.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java,v
retrieving revision 1.9
diff -u -r1.9 Option.java
--- build/org/eclipse/cdt/internal/core/build/managed/Option.java 31 Jul 2003 13:20:37 -0000 1.9
+++ build/org/eclipse/cdt/internal/core/build/managed/Option.java 19 Aug 2003 22:43:58 -0000
@@ -26,18 +26,20 @@
*
*/
public class Option extends BuildObject implements IOption {
+ // Static default return values
+ private static final String EMPTY_STRING = new String();
+ private static final String[] EMPTY_STRING_ARRAY = new String[0];
- private ITool tool;
+ // Private bookeeping attributes
+ private List builtIns;
private IOptionCategory category;
-
- private int valueType;
- private Object value;
- private Map enumCommands;
- private String defaultEnumName;
private String command;
+ private String defaultEnumName;
+ private Map enumCommands;
+ private ITool tool;
+ private Object value;
+ private int valueType;
- private static final String[] EMPTY_STRING_ARRAY = new String[0];
- private static final String EMPTY_STRING = new String();
public Option(ITool tool) {
this.tool = tool;
@@ -103,7 +105,7 @@
enumCommands.put(optName, optCommand);
Boolean isDefault = new Boolean(enumElements[i].getAttribute(IOption.IS_DEFAULT));
if (isDefault.booleanValue()) {
- defaultEnumName = optName;
+ defaultEnumName = optName;
}
}
value = enumList;
@@ -113,9 +115,17 @@
case IOption.PREPROCESSOR_SYMBOLS:
case IOption.LIBRARIES:
List valueList = new ArrayList();
+ builtIns = new ArrayList();
IConfigurationElement[] valueElements = element.getChildren(IOption.LIST_VALUE);
for (int i = 0; i < valueElements.length; ++i) {
- valueList.add(valueElements[i].getAttribute(IOption.VALUE));
+ IConfigurationElement valueElement = valueElements[i];
+ Boolean isBuiltIn = new Boolean(valueElement.getAttribute(IOption.LIST_ITEM_BUILTIN));
+ if (isBuiltIn.booleanValue()) {
+ builtIns.add(valueElement.getAttribute(IOption.LIST_ITEM_VALUE));
+ }
+ else {
+ valueList.add(valueElement.getAttribute(IOption.LIST_ITEM_VALUE));
+ }
}
value = valueList;
break;
@@ -139,6 +149,16 @@
return bool.booleanValue();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getBuiltIns()
+ */
+ public String[] getBuiltIns() {
+ // Return the list of built-ins as an array
+ return builtIns == null ?
+ EMPTY_STRING_ARRAY:
+ (String[])builtIns.toArray(new String[builtIns.size()]);
+ }
+
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getCategory()
*/
Index: build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java,v
retrieving revision 1.11
diff -u -r1.11 OptionReference.java
--- build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java 31 Jul 2003 13:20:37 -0000 1.11
+++ build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java 19 Aug 2003 22:43:58 -0000
@@ -30,6 +30,8 @@
*/
public class OptionReference implements IOption {
+ // List of built-in values a tool defines
+ private List builtIns;
// Used for all option references that override the command
private String command;
// The option this reference overrides
@@ -48,6 +50,7 @@
public OptionReference(ToolReference owner, IOption option) {
this.owner = owner;
this.option = option;
+
// Until the option reference is changed, all values will be extracted from original option
owner.addOptionReference(this);
}
@@ -84,10 +87,17 @@
case IOption.PREPROCESSOR_SYMBOLS:
case IOption.LIBRARIES:
List valueList = new ArrayList();
+ builtIns = new ArrayList();
IConfigurationElement[] valueElements = element.getChildren(IOption.LIST_VALUE);
for (int i = 0; i < valueElements.length; ++i) {
- valueList.add(valueElements[i].getAttribute(IOption.VALUE));
- }
+ IConfigurationElement valueElement = valueElements[i];
+ Boolean isBuiltIn = new Boolean(valueElement.getAttribute(IOption.LIST_ITEM_BUILTIN));
+ if (isBuiltIn.booleanValue()) {
+ builtIns.add(valueElement.getAttribute(IOption.LIST_ITEM_VALUE));
+ }
+ else {
+ valueList.add(valueElement.getAttribute(IOption.LIST_ITEM_VALUE));
+ } }
value = valueList;
break;
}
@@ -119,11 +129,17 @@
case IOption.PREPROCESSOR_SYMBOLS:
case IOption.LIBRARIES:
List valueList = new ArrayList();
+ builtIns = new ArrayList();
NodeList nodes = element.getElementsByTagName(IOption.LIST_VALUE);
for (int i = 0; i < nodes.getLength(); ++i) {
Node node = nodes.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
- valueList.add(((Element)node).getAttribute(IOption.VALUE));
+ Boolean isBuiltIn = new Boolean(((Element)node).getAttribute(IOption.LIST_ITEM_BUILTIN));
+ if (isBuiltIn.booleanValue()) {
+ builtIns.add(((Element)node).getAttribute(IOption.LIST_ITEM_VALUE));
+ } else {
+ valueList.add(((Element)node).getAttribute(IOption.LIST_ITEM_VALUE));
+ }
}
}
value = valueList;
@@ -158,9 +174,20 @@
ListIterator iter = stringList.listIterator();
while (iter.hasNext()) {
Element valueElement = doc.createElement(IOption.LIST_VALUE);
- valueElement.setAttribute(IOption.VALUE, (String)iter.next());
+ valueElement.setAttribute(IOption.LIST_ITEM_VALUE, (String)iter.next());
+ valueElement.setAttribute(IOption.LIST_ITEM_BUILTIN, "false");
element.appendChild(valueElement);
}
+ // Serialize the built-ins that have been overridden
+ if (builtIns != null) {
+ iter = builtIns.listIterator();
+ while (iter.hasNext()) {
+ Element valueElement = doc.createElement(IOption.LIST_VALUE);
+ valueElement.setAttribute(IOption.LIST_ITEM_VALUE, (String)iter.next());
+ valueElement.setAttribute(IOption.LIST_ITEM_BUILTIN, "true");
+ element.appendChild(valueElement);
+ }
+ }
break;
}
}
@@ -267,6 +294,17 @@
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getBuiltIns()
+ */
+ public String[] getBuiltIns() {
+ // Return any overridden built-ins here, or the default set
+ // from the option this is a reference to
+ return builtIns == null ?
+ option.getBuiltIns():
+ (String[])builtIns.toArray(new String[builtIns.size()]);
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue()
*/
public String getSelectedEnum() throws BuildException {
@@ -371,5 +409,4 @@
else
throw new BuildException("bad value type");
}
-
}
Index: parser/org/eclipse/cdt/core/parser/IScannerInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IScannerInfo.java,v
retrieving revision 1.1
diff -u -r1.1 IScannerInfo.java
--- parser/org/eclipse/cdt/core/parser/IScannerInfo.java 4 Jul 2003 18:36:45 -0000 1.1
+++ parser/org/eclipse/cdt/core/parser/IScannerInfo.java 19 Aug 2003 22:44:00 -0000
@@ -29,9 +29,12 @@
public Map getDefinedSymbols();
/**
- * Answers a <code>String</code> array containing all the known include
- * search paths. If there are no paths defined, the receiver will
- * return an empty array, never <code>null</code>
+ * Answers a <code>String</code> array containing the union of all the
+ * built-in include search paths followed by the user-defined include
+ * search paths.
+ *
+ * If there are no paths defined, the receiver will return an empty
+ * array, never <code>null</code>
*
* @return
*/
Index: schema/ManagedBuildTools.exsd
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/schema/ManagedBuildTools.exsd,v
retrieving revision 1.11
diff -u -r1.11 ManagedBuildTools.exsd
--- schema/ManagedBuildTools.exsd 31 Jul 2003 13:20:37 -0000 1.11
+++ schema/ManagedBuildTools.exsd 19 Aug 2003 22:44:01 -0000
@@ -142,8 +142,8 @@
<attribute name="valueType" use="default" value="string">
<annotation>
<documentation>
- General options can be one of the following types; 'string' for catch-all entries for options that cannot be easily defined any other way, 'string list' for entries that consist of a list of values such as defined symbols or paths, 'boolean' for options that have two values, and 'enumerated' for options that are one-of a list of values.
-
+ General options can be one of the following types; 'string' for catch-all entries for options that cannot be easily defined any other way, 'string list' for entries that consist of a list of values such as defined symbols or paths, 'boolean' for options that have two values, and 'enumerated' for options that are one-of a list of values.
+
Two additional types exist to flag options of special relevance to the build model; 'include', and 'definedSymbols'. You can pre-populate with optionValues, and they will display in the UI the same way the 'StringList' options do. The build model will look specifically for these value types when clients query for include paths and preprocessor defines.
</documentation>
</annotation>
@@ -166,13 +166,6 @@
</restriction>
</simpleType>
</attribute>
- <attribute name="value" type="string">
- <annotation>
- <documentation>
- Overridden value assigned to the option by the end user.
- </documentation>
- </annotation>
- </attribute>
<attribute name="category" type="string">
<annotation>
<documentation>
@@ -263,6 +256,11 @@
</element>
<element name="toolReference">
+ <annotation>
+ <documentation>
+ This is reserved for future use. It currently gets instantiated for saving tool settings.
+ </documentation>
+ </annotation>
<complexType>
<sequence>
<element ref="optionReference"/>
@@ -437,6 +435,13 @@
</documentation>
</annotation>
</attribute>
+ <attribute name="builtIn" type="boolean">
+ <annotation>
+ <documentation>
+ This attribute flags the list value as a built-in value as opposed to something the user has entered. Built-ins will not be passed to clients that generate command lines (like the makefile generator). However, clients that need to take these settings into account (like the indexing service), will receive these settings. These values will appear grey in the UI.
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>
@@ -454,48 +459,48 @@
<meta.section type="examples"/>
</appInfo>
<documentation>
- The following is an example of the extension point usage:
-<p>
-<pre>
- <extension
- id="buildExample"
- name="Tools for Build Example"
- point="org.eclipse.cdt.core.ManagedBuildInfo">
- <target
- makeFlags="-k"
- isTest="false"
- cleanCommand="rm -rf"
- name="Executable"
- defaultExtension=".exe"
- isAbstract="false"
- makeCommand="make"
- id="example.target.executable">
- <tool
- sources="C"
- name="Compiler"
- outputFlag="-o"
- outputs="exe"
- command="g++"
- id="executable.compiler">
- <optionCategory
- owner="executable.compiler"
- name="Flags"
- id="compiler.category.flags">
- </optionCategory>
- <option
- defaultValue="-c"
- name="Compiler Flags"
- category="compiler.category.flags"
- valueType="string"
- id="category.flags.comp_flags">
- </option>
- </tool>
- <configuration
- name="Default"
- id="example.config.default">
- </configuration>
- </target>
- </extension>
+ The following is an example of the extension point usage:
+<p>
+<pre>
+ <extension
+ id="buildExample"
+ name="Tools for Build Example"
+ point="org.eclipse.cdt.core.ManagedBuildInfo">
+ <target
+ makeFlags="-k"
+ isTest="false"
+ cleanCommand="rm -rf"
+ name="Executable"
+ defaultExtension=".exe"
+ isAbstract="false"
+ makeCommand="make"
+ id="example.target.executable">
+ <tool
+ sources="C"
+ name="Compiler"
+ outputFlag="-o"
+ outputs="exe"
+ command="g++"
+ id="executable.compiler">
+ <optionCategory
+ owner="executable.compiler"
+ name="Flags"
+ id="compiler.category.flags">
+ </optionCategory>
+ <option
+ defaultValue="-c"
+ name="Compiler Flags"
+ category="compiler.category.flags"
+ valueType="string"
+ id="category.flags.comp_flags">
+ </option>
+ </tool>
+ <configuration
+ name="Default"
+ id="example.config.default">
+ </configuration>
+ </target>
+ </extension>
</pre>
</documentation>
</annotation>
@@ -523,7 +528,7 @@
<meta.section type="copyright"/>
</appInfo>
<documentation>
- Copyright (c) 2003 IBM Corporation and others.
+ Copyright (c) 2003 IBM Corporation and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available on the <a href="http://www.eclipse.org/legal/cpl-v10.html"> Eclipse</a> website.
</documentation>
</annotation>
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.62
diff -u -r1.62 ChangeLog
--- ChangeLog 14 Aug 2003 19:49:48 -0000 1.62
+++ ChangeLog 19 Aug 2003 22:44:24 -0000
@@ -1,3 +1,24 @@
+2003-08-19 Sean Evoy
+ In order to properly support the indexing feature, the scanner has to
+ function as well as the version that ships with the toolset if possible.
+ This is made difficult by the fact that we are trying to be tool-agnostic.
+ One of the things that the scanner should take into account when it runs
+ is the "built-in" symbols and search paths that are defined for a compiler
+ in a given toolchain. While we need to come up with a standard mechanism
+ for the CDT in the future, the managed build system can provide a work-around
+ in the near-term. The easiest solution is to add an optional attribute to a
+ list element that flags the item as a built-in value. When clients like
+ the indexer query the build model, they will receive the union of the built-in
+ values and the user-defined values.
+
+ Added built-in information to the existing plugin definition. Also added a
+ new include path and defined symol for updated test cases.
+ * plugin.xml
+
+ Updated the test cases to check that built-ins defined in the plugin manifest
+ are properly read and dealt with during project creation and persisting settings.
+ * build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java
+
2003-08-14 John Camelon
Removed warnings from AutomatedIntegrationSuite.java (removing implicit accessor generation).
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/plugin.xml,v
retrieving revision 1.6
diff -u -r1.6 plugin.xml
--- plugin.xml 31 Jul 2003 13:20:27 -0000 1.6
+++ plugin.xml 19 Aug 2003 22:44:24 -0000
@@ -56,7 +56,12 @@
value="a">
</listOptionValue>
<listOptionValue
- value="b">
+ value="b"
+ builtIn="false">
+ </listOptionValue>
+ <listOptionValue
+ value="c"
+ builtIn="true">
</listOptionValue>
</option>
<option
@@ -142,12 +147,20 @@
<listOptionValue
value="/opt/gnome/include">
</listOptionValue>
+ <listOptionValue
+ value="/usr/gnu/include"
+ builtIn="true">
+ </listOptionValue>
</option>
<option
name="Defined Symbols"
command="-D"
valueType="definedSymbols"
id="sub.tool.opt.def.symbols">
+ <listOptionValue
+ value="BUILTIN"
+ builtIn="true">
+ </listOptionValue>
</option>
<option
name="More Includes"
@@ -155,7 +168,8 @@
valueType="includePath"
id="sub.tool.opts.inc.paths.more">
<listOptionValue
- value="/home/tester/include">
+ value="C:\home\tester/include"
+ builtIn="false">
</listOptionValue>
</option>
</tool>
Index: build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java,v
retrieving revision 1.1
diff -u -r1.1 ManagedBuildTests.java
--- build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java 13 Aug 2003 17:45:21 -0000 1.1
+++ build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java 19 Aug 2003 22:44:25 -0000
@@ -114,8 +114,8 @@
*/
public void testScannerInfoInterface(){
// These are the expected path settings
- final String[] expectedPaths = {"/usr/include", "/opt/gnome/include", "/home/tester/include"};
-
+ final String[] expectedPaths = {"/usr/gnu/include", "/usr/include", "/opt/gnome/include", "C:\\home\\tester/include"};
+
// Open the test project
IProject project = null;
try {
@@ -159,18 +159,23 @@
// Check the build information right away
IScannerInfo currentSettings = provider.getScannerInformation(project);
Map currentSymbols = currentSettings.getDefinedSymbols();
- assertTrue(currentSymbols.isEmpty());
+ // It should simply contain the built-in
+ assertTrue(currentSymbols.containsKey("BUILTIN"));
+ assertEquals((String)currentSymbols.get("BUILTIN"), "");
String[] currentPaths = currentSettings.getIncludePaths();
assertTrue(Arrays.equals(expectedPaths, currentPaths));
// Now subscribe (note that the method will be called after a change
provider.subscribe(project, new IScannerInfoChangeListener () {
public void changeNotification(IResource project, IScannerInfo info) {
- // Test the symbols
+ // Test the symbols: expect "BUILTIN" from the manifest, and "DEBUG" and "GNOME=ME"
+ // from the overidden settings
Map definedSymbols = info.getDefinedSymbols();
+ assertTrue(definedSymbols.containsKey("BUILTIN"));
assertTrue(definedSymbols.containsKey("DEBUG"));
assertTrue(definedSymbols.containsKey("GNOME"));
assertTrue(definedSymbols.containsValue("ME"));
+ assertEquals((String)definedSymbols.get("BUILTIN"), "");
assertEquals((String)definedSymbols.get("DEBUG"), "");
assertEquals((String)definedSymbols.get("GNOME"), "ME");
// Test the includes path
@@ -502,13 +507,16 @@
// 4 Options are defined in the root tool
IOption[] options = rootTool.getOptions();
assertEquals(4, options.length);
- // First option is a 2-element list
+ // First option is a 3-element list with 1 built-in
assertEquals("List Option in Top", options[0].getName());
assertEquals(IOption.STRING_LIST, options[0].getValueType());
String[] valueList = options[0].getStringListValue();
assertEquals(2, valueList.length);
assertEquals("a", valueList[0]);
assertEquals("b", valueList[1]);
+ String[] builtInList = options[0].getBuiltIns();
+ assertEquals(1, builtInList.length);
+ assertEquals("c", builtInList[0]);
assertEquals(options[0].getCommand(), "-L");
// Next option is a boolean in top
assertEquals("Boolean Option in Top", options[1].getName());
@@ -647,17 +655,25 @@
assertEquals(2, incPath.length);
assertEquals("/usr/include", incPath[0]);
assertEquals("/opt/gnome/include", incPath[1]);
+ String[] builtInPaths = subOpts[0].getBuiltIns();
+ assertEquals(1, builtInPaths.length);
+ assertEquals("/usr/gnu/include", builtInPaths[0]);
assertEquals("-I", subOpts[0].getCommand());
+ // There are no user-defined preprocessor symbols
assertEquals("Defined Symbols", subOpts[1].getName());
assertEquals(IOption.PREPROCESSOR_SYMBOLS, subOpts[1].getValueType());
String[] defdSymbols = subOpts[1].getDefinedSymbols();
assertEquals(0, defdSymbols.length);
assertEquals("-D", subOpts[1].getCommand());
+ // But there is a builtin
+ String[] builtInSymbols = subOpts[1].getBuiltIns();
+ assertEquals(1, builtInSymbols.length);
+ assertEquals("BUILTIN", builtInSymbols[0]);
assertEquals("More Includes", subOpts[2].getName());
assertEquals(IOption.INCLUDE_PATH, subOpts[2].getValueType());
String[] moreIncPath = subOpts[2].getIncludePaths();
assertEquals(1, moreIncPath.length);
- assertEquals("/home/tester/include", moreIncPath[0]);
+ assertEquals("C:\\home\\tester/include", moreIncPath[0]);
assertEquals("-I", subOpts[2].getCommand());
// Get the configs for this target
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.141
diff -u -r1.141 ChangeLog
--- ChangeLog 18 Aug 2003 17:34:19 -0000 1.141
+++ ChangeLog 19 Aug 2003 22:44:41 -0000
@@ -1,3 +1,19 @@
+2003-08-19 Sean Evoy
+ Switched the property page edit area to a scrolled composite instead of resizing
+ for large option sets. This actually makes the selection event code simpler.
+ * build/org/eclipse/cdt/ui/build/properties/BuildPropertyPage.java
+
+ I added an accessor method for getting the internal Map in the settings store.
+ The code was vulnerable because there was never a check to make sure the
+ Map had been instantiated before use.
+ * build/org/eclipse/cdt/ui/build/properties/BuildToolsSettingsStore.java
+
+ Added some builtin symbols and include paths for the Gnu compilers.
+ * plugin.xml
+
+ Fixed a spelling error in a category name.
+ * plugin.properties
+
2003-08-14 Sean Evoy
Added initial toolchain description for Solaris and Linux targets using Gnu tools.
* plugin.xml
Index: plugin.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/plugin.properties,v
retrieving revision 1.24
diff -u -r1.24 plugin.properties
--- plugin.properties 18 Aug 2003 17:34:19 -0000 1.24
+++ plugin.properties 19 Aug 2003 22:44:41 -0000
@@ -97,11 +97,10 @@
OptionCategory.Preproc = Preprocessor
OptionCategory.Dirs = Directories
OptionCategory.General = General
-OptionCategory.CLSum = Command Line Summary
OptionCategory.Optimize=Optimization
OptionCategory.Debug=Debugging
OptionCategory.Warn=Warnings
-OptionCategory.Misc=Miscelaneous
+OptionCategory.Misc=Miscellaneous
OptionCategory.Libs=Libraries
# C/C++ Search
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/plugin.xml,v
retrieving revision 1.41
diff -u -r1.41 plugin.xml
--- plugin.xml 18 Aug 2003 17:34:19 -0000 1.41
+++ plugin.xml 19 Aug 2003 22:44:41 -0000
@@ -642,15 +642,131 @@
id="cygwin.compiler.category.preprocessor">
</optionCategory>
<option
- name="Defined Symbols"
+ defaultValue="false"
+ name="Do not search system directories (-nostdinc)"
+ category="cygwin.compiler.category.preprocessor"
+ command="-nostdinc"
+ valueType="boolean"
+ id="cygwin.gnu.compiler.preprocessor.nostdinc">
+ </option>
+ <option
+ defaultValue="false"
+ name="Preprocess only (-E)"
category="cygwin.compiler.category.preprocessor"
+ command="-E"
+ valueType="boolean"
+ id="cygwin.gnu.compiler.preprocessor.preprocess">
+ </option>
+ <option
+ name="Answers (-A)"
+ category="cygwin.compiler.category.preprocessor"
+ command="-A"
+ valueType="stringList"
+ id="cygwin.gnu.preprocessor.answers">
+ </option>
+ <optionCategory
+ owner="org.eclipse.cdt.build.tool.cygwin.compiler"
+ name="Symbols"
+ id="cygwin.gnu.compiler.category.symbols">
+ </optionCategory>
+ <option
+ name="Defined symbols (-D)"
+ category="cygwin.gnu.compiler.category.symbols"
command="-D"
valueType="definedSymbols"
id="cygwin.preprocessor.def.symbols">
+ <listOptionValue
+ value="_X86_=1"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__OPTIMIZE__"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__STDC_HOSTED__=1"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="i386"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__i386"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__i386__"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__tune_i686__"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__tune_pentiumpro__"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__tune_pentium2__"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__tune_pentium3__"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__stdcall=__attribute__((__stdcall__))"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__fastcall=__attribute__((__fastcall__))"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__cdecl=__attribute__((__cdecl__))"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="_stdcall=__attribute__((__stdcall__))"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="_fastcall=__attribute__((__fastcall__))"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="_cdecl=__attribute__((__cdecl__))"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__declspec(x)=__attribute__((x))"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__CYGWIN32__"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__CYGWIN__"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="unix"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__unix__"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__unix"
+ builtIn="true">
+ </listOptionValue>
</option>
<option
- name="Undefined Symbols"
- category="cygwin.compiler.category.preprocessor"
+ name="Undefined symbols (-U)"
+ category="cygwin.gnu.compiler.category.symbols"
command="-U"
valueType="stringList"
id="cygwin.preprocessor.undef.symbol">
@@ -728,6 +844,10 @@
command="-I"
valueType="includePath"
id="cygwin.compiler.general.include.paths">
+ <listOptionValue
+ value="C:\cygwin\usr\include\w32api"
+ builtIn="true">
+ </listOptionValue>
</option>
<option
defaultValue="false"
@@ -737,16 +857,6 @@
valueType="boolean"
id="cygwin.compiler.general.verbose">
</option>
- <optionCategory
- owner="org.eclipse.cdt.build.tool.cygwin.compiler"
- name="%OptionCategory.CLSum"
- id="cygwin.compiler.category.commandline">
- </optionCategory>
- <option
- name="Compiler Command Line"
- category="cygwin.compiler.category.commandline"
- id="cygwin.compiler.commandline.args">
- </option>
</tool>
</target>
<target
@@ -795,16 +905,6 @@
valueType="libs"
id="cygwin.link.libs">
</option>
- <optionCategory
- owner="org.eclipse.cdt.build.tool.cygwin.link"
- name="%OptionCategory.CLSum"
- id="cygwin.linker.category.commandline">
- </optionCategory>
- <option
- name="Linker Command Line"
- category="cygwin.linker.category.commandline"
- id="cygwin.linker.commandline.args">
- </option>
</tool>
</target>
<target
@@ -984,6 +1084,66 @@
command="-D"
valueType="definedSymbols"
id="linux.gnu.compiler.preprocessor.def">
+ <listOptionValue
+ value="__ELF__"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="unix"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__gnu_linux__"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="linux"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__unix__"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__linux__"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__unix"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__linux"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__OPTIMIZE__"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__STDC_HOSTED__=1"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="_GNU_SOURCE"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="i386"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__i386"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__i386__"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="__tune_i386__"
+ builtIn="true">
+ </listOptionValue>
</option>
<optionCategory
owner="cdt.build.tool.linux.gnu.compiler"
@@ -994,8 +1154,16 @@
name="Include search paths (-I)"
category="linux.gnu.compiler.category.dirs"
command="-I"
- valueType="stringList"
+ valueType="includePath"
id="linux.gnu.compiler.dirs.incpaths">
+ <listOptionValue
+ value="/usr/local/include"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ value="/usr/include"
+ builtIn="true">
+ </listOptionValue>
</option>
<optionCategory
owner="cdt.build.tool.linux.gnu.compiler"
@@ -1441,6 +1609,58 @@
command="-D"
valueType="definedSymbols"
id="solaris.gnu.compiler.preprocessor.def">
+ <listOptionValue
+ builtIn="true"
+ value="sun">
+ </listOptionValue>
+ <listOptionValue
+ builtIn="true"
+ value="sparc">
+ </listOptionValue>
+ <listOptionValue
+ builtIn="true"
+ value="unix">
+ </listOptionValue>
+ <listOptionValue
+ builtIn="true"
+ value="__svr4__">
+ </listOptionValue>
+ <listOptionValue
+ builtIn="true"
+ value="__SVR4">
+ </listOptionValue>
+ <listOptionValue
+ builtIn="true"
+ value="__GCC_NEW_VARARGS__">
+ </listOptionValue>
+ <listOptionValue
+ builtIn="true"
+ value="__sun__">
+ </listOptionValue>
+ <listOptionValue
+ builtIn="true"
+ value="__sparc__">
+ </listOptionValue>
+ <listOptionValue
+ builtIn="true"
+ value="__unix__">
+ </listOptionValue>
+ <listOptionValue
+ builtIn="true"
+ value="__sun">
+ </listOptionValue>
+ <listOptionValue
+ builtIn="true"
+ value="__sparc">
+ </listOptionValue>
+ <listOptionValue
+ builtIn="true"
+ value="__unix">
+ </listOptionValue>
+ <listOptionValue
+ builtIn="true"
+ value="__OPTIMIZE__">
+ </listOptionValue>
</option>
<optionCategory
owner="cdt.build.tool.solaris.gnu.compiler"
@@ -1451,8 +1671,16 @@
name="Include search paths (-I)"
category="solaris.gnu.compiler.category.dirs"
command="-I"
- valueType="stringList"
+ valueType="includePath"
id="solaris.gnu.compiler.dirs.incpaths">
+ <listOptionValue
+ value="/usr/local/include"
+ builtIn="true">
+ </listOptionValue>
+ <listOptionValue
+ builtIn="true"
+ value="/usr/include">
+ </listOptionValue>
</option>
<optionCategory
owner="cdt.build.tool.solaris.gnu.compiler"
Index: build/org/eclipse/cdt/ui/build/properties/BuildPropertyPage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/build/org/eclipse/cdt/ui/build/properties/BuildPropertyPage.java,v
retrieving revision 1.2
diff -u -r1.2 BuildPropertyPage.java
--- build/org/eclipse/cdt/ui/build/properties/BuildPropertyPage.java 11 Aug 2003 17:33:10 -0000 1.2
+++ build/org/eclipse/cdt/ui/build/properties/BuildPropertyPage.java 19 Aug 2003 22:44:41 -0000
@@ -33,6 +33,7 @@
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
@@ -87,7 +88,8 @@
private SashForm sashForm;
private Group sashGroup;
private Composite settingsPageContainer;
-
+ private ScrolledComposite containerSC;
+
/*
* Bookeeping variables
*/
@@ -150,36 +152,6 @@
configToPageListMap = new HashMap();
}
- protected void constrainShellSize() {
- // limit the shell size to the display size
- Shell shell = getShell();
- Point size = shell.getSize();
- Rectangle bounds = shell.getDisplay().getClientArea();
- int newX = Math.min(size.x, bounds.width);
- int newY = Math.min(size.y, bounds.height);
- if (size.x != newX || size.y != newY)
- shell.setSize(newX, newY);
-
- // move the shell origin as required
- Point loc = shell.getLocation();
-
- //Choose the position between the origin of the client area and
- //the bottom right hand corner
- int x =
- Math.max(
- bounds.x,
- Math.min(loc.x, bounds.x + bounds.width - size.x));
- int y =
- Math.max(
- bounds.y,
- Math.min(loc.y, bounds.y + bounds.height - size.y));
- shell.setLocation(x, y);
-
- // record opening shell size
- if (lastShellSize == null)
- lastShellSize = getShell().getSize();
- }
-
protected Control createContents(Composite parent) {
// Initialize the key data
targets = ManagedBuildManager.getTargets(getProject());
@@ -272,9 +244,17 @@
* Add the tabs relevant to the project to edit area tab folder.
*/
protected void createEditArea(Composite parent) {
+ containerSC = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
+ containerSC.setExpandHorizontal(true);
+ containerSC.setExpandVertical(true);
+
// Add a container for the build settings page
- settingsPageContainer = new Composite(parent, SWT.NULL);
+ settingsPageContainer = new Composite(containerSC, SWT.NULL);
settingsPageContainer.setLayout(new PageLayout());
+
+ containerSC.setContent(settingsPageContainer);
+ containerSC.setMinSize(settingsPageContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ settingsPageContainer.layout();
}
protected void createSelectionArea (Composite parent) {
@@ -323,36 +303,6 @@
currentSettingsPage.createControl(settingsPageContainer);
}
}
-
- // Force calculation of the page's description label because
- // label can be wrapped.
- Point contentSize = currentSettingsPage.computeSize();
- // Do we need resizing. Computation not needed if the
- // first page is inserted since computing the dialog's
- // size is done by calling dialog.open().
- // Also prevent auto resize if the user has manually resized
- Shell shell = getShell();
- Point shellSize = shell.getSize();
- if (oldPage != null) {
- Rectangle rect = settingsPageContainer.getClientArea();
- Point containerSize = new Point(rect.width, rect.height);
- int hdiff = contentSize.x - containerSize.x;
- int vdiff = contentSize.y - containerSize.y;
-
- if (hdiff > 0 || vdiff > 0) {
- if (shellSize.equals(getLastShellSize())) {
- hdiff = Math.max(0, hdiff);
- vdiff = Math.max(0, vdiff);
- setShellSize(shellSize.x + hdiff, shellSize.y + vdiff);
- lastShellSize = shell.getSize();
- } else {
- currentSettingsPage.setSize(containerSize);
- }
- } else if (hdiff < 0 || vdiff < 0) {
- currentSettingsPage.setSize(containerSize);
- }
-
- }
// Make all the other pages invisible
Control[] children = settingsPageContainer.getChildren();
@@ -364,6 +314,10 @@
currentSettingsPage.setVisible(true);
if (oldPage != null)
oldPage.setVisible(false);
+
+ // Set the size of the scrolled area
+ containerSC.setMinSize(currentSettingsPage.computeSize());
+ settingsPageContainer.layout();
}
/* (non-Javadoc)
@@ -533,18 +487,6 @@
// Make sure the active configuration is selected
configSelector.select(0);
handleConfigSelection();
- }
-
- /**
- * Changes the shell size to the given size, ensuring that
- * it is no larger than the display bounds.
- *
- * @param width the shell width
- * @param height the shell height
- */
- private void setShellSize(int width, int height) {
- getShell().setSize(width, height);
- constrainShellSize();
}
/**
Index: build/org/eclipse/cdt/ui/build/properties/BuildToolsSettingsStore.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/build/org/eclipse/cdt/ui/build/properties/BuildToolsSettingsStore.java,v
retrieving revision 1.3
diff -u -r1.3 BuildToolsSettingsStore.java
--- build/org/eclipse/cdt/ui/build/properties/BuildToolsSettingsStore.java 25 Jul 2003 17:30:57 -0000 1.3
+++ build/org/eclipse/cdt/ui/build/properties/BuildToolsSettingsStore.java 19 Aug 2003 22:44:42 -0000
@@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Map;
import java.util.StringTokenizer;
import org.eclipse.cdt.core.build.managed.BuildException;
@@ -30,7 +31,7 @@
// List of listeners on the property store
private ListenerList listenerList;
- private HashMap optionMap;
+ private Map optionMap;
private boolean dirtyFlag;
private IConfiguration owner;
@@ -55,13 +56,15 @@
* @see org.eclipse.jface.preference.IPreferenceStore#contains(java.lang.String)
*/
public boolean contains(String name) {
- return optionMap.containsKey(name);
+ return getOptionMap().containsKey(name);
}
/**
+ * Answers a <code>String</code> containing the strings passed in the
+ * argument separated by the DEFAULT_SEPERATOR
+ *
* @param items An array of strings
- * @return a String containing the strings passed in the argument separated by the
- * DEFAULT_SEPERATOR
+ * @return
*/
public static String createList(String[] items) {
StringBuffer path = new StringBuffer(""); //$NON-NLS-1$
@@ -95,7 +98,7 @@
* @see org.eclipse.jface.preference.IPreferenceStore#getBoolean(java.lang.String)
*/
public boolean getBoolean(String name) {
- Object b = optionMap.get(name);
+ Object b = getOptionMap().get(name);
if (b instanceof Boolean)
{
return ((Boolean)b).booleanValue();
@@ -173,6 +176,19 @@
return getDefaultLong(name);
}
+ /* (non-javadoc)
+ * Answers the map containing the strings associated with each option
+ * ID.
+ *
+ * @return
+ */
+ private Map getOptionMap() {
+ if (optionMap == null) {
+ optionMap = new HashMap();
+ }
+ return optionMap;
+ }
+
private void getOptionsForCategory(IOptionCategory cat) {
IOptionCategory [] children = cat.getChildCategories();
// If there are child categories, add their options
@@ -180,9 +196,6 @@
getOptionsForCategory(children[i]);
}
// Else get the options for this category and add them to the map
- if (optionMap == null) {
- optionMap = new HashMap();
- }
IOption [] options = cat.getOptions(owner);
for (int j = 0; j < options.length; ++j) {
IOption opt = options[j];
@@ -197,12 +210,12 @@
// Exception occurs if there's an option value type mismatch
break;
}
- optionMap.put(name, value);
+ getOptionMap().put(name, value);
break;
case IOption.ENUMERATED :
value = createList(opt.getApplicableValues());
- optionMap.put(name, value);
+ getOptionMap().put(name, value);
break;
case IOption.STRING :
@@ -211,7 +224,7 @@
} catch (BuildException e) {
break;
}
- optionMap.put(name, value);
+ getOptionMap().put(name, value);
break;
case IOption.STRING_LIST :
@@ -220,7 +233,7 @@
} catch (BuildException e) {
break;
}
- optionMap.put(name, value);
+ getOptionMap().put(name, value);
break;
case IOption.INCLUDE_PATH :
try {
@@ -228,7 +241,7 @@
} catch (BuildException e) {
break;
}
- optionMap.put(name, value);
+ getOptionMap().put(name, value);
break;
case IOption.PREPROCESSOR_SYMBOLS :
try {
@@ -236,7 +249,7 @@
} catch (BuildException e) {
break;
}
- optionMap.put(name, value);
+ getOptionMap().put(name, value);
break;
case IOption.LIBRARIES :
try {
@@ -244,7 +257,7 @@
} catch (BuildException e) {
break;
}
- optionMap.put(name, value);
+ getOptionMap().put(name, value);
break;
default :
break;
@@ -256,7 +269,7 @@
* @see org.eclipse.jface.preference.IPreferenceStore#getString(java.lang.String)
*/
public String getString(String name) {
- Object s = optionMap.get(name);
+ Object s = getOptionMap().get(name);
if ( s instanceof String )
{
@@ -297,7 +310,7 @@
for (int index = 0; index < tools.length; ++index) {
ITool tool = tools[index];
IOptionCategory cat = tool.getTopOptionCategory();
- getOptionsForCategory(cat);
+ getOptionsForCategory(cat);
}
}
@@ -305,10 +318,10 @@
* @see org.eclipse.jface.preference.IPreferenceStore#putValue(java.lang.String, java.lang.String)
*/
public void putValue(String name, String value) {
- Object oldValue = optionMap.get(name);
+ Object oldValue = getOptionMap().get(name);
if (oldValue == null || !oldValue.equals(value))
{
- optionMap.put(name, value);
+ getOptionMap().put(name, value);
setDirty(true);
}
}
@@ -397,7 +410,7 @@
Object oldValue = getString(name);
if (oldValue == null || !oldValue.equals(value))
{
- optionMap.put(name, value);
+ getOptionMap().put(name, value);
setDirty(true);
firePropertyChangeEvent(name, oldValue, value);
}
@@ -410,10 +423,11 @@
boolean oldValue = getBoolean(name);
if (oldValue != value)
{
- optionMap.put(name, new Boolean(value));
+ getOptionMap().put(name, new Boolean(value));
setDirty(true);
firePropertyChangeEvent(name, new Boolean(oldValue), new Boolean(value));
}
}
+
}