mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 03:45:35 +02:00
Fix for [Bug 194757] Cannot replace environment variables in C/C++ Build/Environment
This commit is contained in:
parent
bf25f372b0
commit
7d05c2c4ea
1 changed files with 25 additions and 2 deletions
|
@ -31,6 +31,7 @@ import org.eclipse.cdt.internal.core.settings.model.ExceptionFactory;
|
||||||
public class StorableEnvironment /*implements Cloneable*/{
|
public class StorableEnvironment /*implements Cloneable*/{
|
||||||
public static final String ENVIRONMENT_ELEMENT_NAME = "environment"; //$NON-NLS-1$
|
public static final String ENVIRONMENT_ELEMENT_NAME = "environment"; //$NON-NLS-1$
|
||||||
private static final String ATTRIBUTE_APPEND = "append"; //$NON-NLS-1$
|
private static final String ATTRIBUTE_APPEND = "append"; //$NON-NLS-1$
|
||||||
|
private static final String ATTRIBUTE_APPEND_CONTRIBUTED = "appendContributed"; //$NON-NLS-1$
|
||||||
private static final boolean DEFAULT_APPEND = true;
|
private static final boolean DEFAULT_APPEND = true;
|
||||||
private HashMap fVariables;
|
private HashMap fVariables;
|
||||||
private boolean fIsDirty = false;
|
private boolean fIsDirty = false;
|
||||||
|
@ -58,6 +59,7 @@ public class StorableEnvironment /*implements Cloneable*/{
|
||||||
if(env.fVariables != null)
|
if(env.fVariables != null)
|
||||||
fVariables = (HashMap)env.fVariables.clone();
|
fVariables = (HashMap)env.fVariables.clone();
|
||||||
fAppend = env.fAppend;
|
fAppend = env.fAppend;
|
||||||
|
fAppendContributedEnv = env.fAppendContributedEnv;
|
||||||
fIsReadOnly = isReadOnly;
|
fIsReadOnly = isReadOnly;
|
||||||
fIsDirty = env.isDirty();
|
fIsDirty = env.isDirty();
|
||||||
}
|
}
|
||||||
|
@ -77,14 +79,20 @@ public class StorableEnvironment /*implements Cloneable*/{
|
||||||
}
|
}
|
||||||
|
|
||||||
String append = element.getAttribute(ATTRIBUTE_APPEND);
|
String append = element.getAttribute(ATTRIBUTE_APPEND);
|
||||||
fAppend = append != null ? Boolean.valueOf(element.getAttribute(ATTRIBUTE_APPEND)).booleanValue()
|
fAppend = append != null ? Boolean.valueOf(append).booleanValue()
|
||||||
: true;
|
: DEFAULT_APPEND;
|
||||||
|
|
||||||
|
append = element.getAttribute(ATTRIBUTE_APPEND_CONTRIBUTED);
|
||||||
|
fAppendContributedEnv = append != null ? Boolean.valueOf(append).booleanValue()
|
||||||
|
: DEFAULT_APPEND;
|
||||||
|
|
||||||
fIsDirty = false;
|
fIsDirty = false;
|
||||||
fIsChanged = false;
|
fIsChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void serialize(ICStorageElement element){
|
public void serialize(ICStorageElement element){
|
||||||
element.setAttribute(ATTRIBUTE_APPEND, Boolean.valueOf(fAppend).toString());
|
element.setAttribute(ATTRIBUTE_APPEND, Boolean.valueOf(fAppend).toString());
|
||||||
|
element.setAttribute(ATTRIBUTE_APPEND_CONTRIBUTED, Boolean.valueOf(fAppendContributedEnv).toString());
|
||||||
if(fVariables != null){
|
if(fVariables != null){
|
||||||
Iterator iter = fVariables.values().iterator();
|
Iterator iter = fVariables.values().iterator();
|
||||||
while(iter.hasNext()){
|
while(iter.hasNext()){
|
||||||
|
@ -93,6 +101,7 @@ public class StorableEnvironment /*implements Cloneable*/{
|
||||||
var.serialize(varEl);
|
var.serialize(varEl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fIsDirty = false;
|
fIsDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +297,14 @@ public class StorableEnvironment /*implements Cloneable*/{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAppendEnvironment(boolean append){
|
public void setAppendEnvironment(boolean append){
|
||||||
|
if(fAppend == append)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(fIsReadOnly)
|
||||||
|
throw ExceptionFactory.createIsReadOnlyException();
|
||||||
|
|
||||||
fAppend = append;
|
fAppend = append;
|
||||||
|
fIsDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean appendContributedEnvironment(){
|
public boolean appendContributedEnvironment(){
|
||||||
|
@ -296,7 +312,14 @@ public class StorableEnvironment /*implements Cloneable*/{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAppendContributedEnvironment(boolean append){
|
public void setAppendContributedEnvironment(boolean append){
|
||||||
|
if(fAppendContributedEnv == append)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(fIsReadOnly)
|
||||||
|
throw ExceptionFactory.createIsReadOnlyException();
|
||||||
|
|
||||||
fAppendContributedEnv = append;
|
fAppendContributedEnv = append;
|
||||||
|
fIsDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void restoreDefaults(){
|
public void restoreDefaults(){
|
||||||
|
|
Loading…
Add table
Reference in a new issue