mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-13 20:15:22 +02:00
Commit for Leo Treggiari: fix for bugzilla 70577 and 71254
This commit is contained in:
parent
1d1df82897
commit
47cd4cbd24
6 changed files with 56 additions and 5 deletions
|
@ -129,6 +129,13 @@ public interface IOption extends IBuildObject {
|
|||
*/
|
||||
public String getEnumCommand (String id);
|
||||
|
||||
/**
|
||||
* Answers the "name" associated with the enumeration id.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getEnumName (String id);
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @return
|
||||
|
|
|
@ -267,6 +267,23 @@ public class Option extends BuildObject implements IOption {
|
|||
return cmd == null ? EMPTY_STRING : cmd;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IOption#getEnumName(java.lang.String)
|
||||
*/
|
||||
public String getEnumName(String id) {
|
||||
// Sanity
|
||||
if (id == null) return EMPTY_STRING;
|
||||
|
||||
// First check for the command in ID->name map
|
||||
String name = (String) getEnumNameMap().get(id);
|
||||
if (name == null) {
|
||||
// This may be a 1.2 project or plugin manifest. If so, the argument is the human readable
|
||||
// name of the enumeration.
|
||||
name = id;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* A memory-safe accessor to the map of enumerated option value IDs to the commands
|
||||
* that a tool understands.
|
||||
|
|
|
@ -286,12 +286,26 @@ public class OptionReference implements IOption {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IOption#getEnumCommand(java.lang.String)
|
||||
*/
|
||||
public String getEnumCommand(String name) {
|
||||
public String getEnumCommand(String id) {
|
||||
if (!resolved) {
|
||||
resolveReferences();
|
||||
}
|
||||
if (option != null) {
|
||||
return option.getEnumCommand(name);
|
||||
return option.getEnumCommand(id);
|
||||
} else {
|
||||
return new String();
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IOption#getEnumName(java.lang.String)
|
||||
*/
|
||||
public String getEnumName(String id) {
|
||||
if (!resolved) {
|
||||
resolveReferences();
|
||||
}
|
||||
if (option != null) {
|
||||
return option.getEnumName(id);
|
||||
} else {
|
||||
return new String();
|
||||
}
|
||||
|
|
|
@ -68,9 +68,11 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
|||
fieldsList.add(booleanField);
|
||||
break;
|
||||
case IOption.ENUMERATED :
|
||||
String selId;
|
||||
String sel;
|
||||
try {
|
||||
sel = opt.getSelectedEnum();
|
||||
selId = opt.getSelectedEnum();
|
||||
sel = opt.getEnumName(selId);
|
||||
} catch (BuildException e) {
|
||||
// If we get this exception, then the option type is
|
||||
// wrong
|
||||
|
|
|
@ -184,8 +184,15 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
|
|||
IOption option = options[k];
|
||||
switch (option.getValueType()) {
|
||||
case IOption.BOOLEAN :
|
||||
String boolCmd;
|
||||
if (getPreferenceStore().getBoolean(option.getId())) {
|
||||
buf.append(option.getCommand() + ITool.WHITE_SPACE);
|
||||
boolCmd = option.getCommand();
|
||||
} else {
|
||||
// Note: getCommandFalse is new with CDT 2.0
|
||||
boolCmd = option.getCommandFalse();
|
||||
}
|
||||
if (boolCmd != null && boolCmd.length() > 0) {
|
||||
buf.append(boolCmd + ITool.WHITE_SPACE);
|
||||
}
|
||||
break;
|
||||
case IOption.ENUMERATED :
|
||||
|
@ -199,10 +206,12 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
|
|||
}
|
||||
break;
|
||||
case IOption.STRING :
|
||||
String strCmd = option.getCommand();
|
||||
String val = getPreferenceStore().getString(option.getId());
|
||||
// add this string option value to the list
|
||||
stringOptionsMap.put(option, val);
|
||||
if (val.length() > 0) {
|
||||
if (strCmd != null) buf.append(strCmd);
|
||||
buf.append(val + ITool.WHITE_SPACE);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -232,7 +232,9 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
|
|||
|
||||
case IOption.ENUMERATED :
|
||||
try{
|
||||
value = opt.getSelectedEnum();
|
||||
String selId;
|
||||
selId = opt.getSelectedEnum();
|
||||
value = opt.getEnumName(selId);
|
||||
} catch (BuildException e) {
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue