mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Initial check-in for the Option Value Handler functionality fixes
This commit is contained in:
parent
02eb2cab43
commit
d4bc99f45d
11 changed files with 255 additions and 98 deletions
|
@ -773,8 +773,9 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
try {
|
||||
//an option can be null in the case of calling this method from the environment
|
||||
//build path change listener
|
||||
if (option != null && !(option.getValueType() == IOption.INCLUDE_PATH
|
||||
|| option.getValueType() == IOption.PREPROCESSOR_SYMBOLS)) {
|
||||
if (config.isTemporary() ||
|
||||
(option != null && option.getValueType() != IOption.INCLUDE_PATH
|
||||
&& option.getValueType() != IOption.PREPROCESSOR_SYMBOLS)) {
|
||||
return;
|
||||
}
|
||||
} catch (BuildException e) {return;}
|
||||
|
@ -793,11 +794,12 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
|
||||
public static void initializePathEntries(IConfiguration config, IOption option){
|
||||
try{
|
||||
if(option != null
|
||||
if(config.isTemporary() ||
|
||||
(option != null
|
||||
&& option.getValueType() != IOption.INCLUDE_PATH
|
||||
&& option.getValueType() != IOption.PREPROCESSOR_SYMBOLS
|
||||
&& option.getValueType() != IOption.LIBRARIES
|
||||
)
|
||||
))
|
||||
return;
|
||||
} catch (BuildException e){
|
||||
return;
|
||||
|
@ -820,8 +822,9 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
private static void notifyListeners(IResourceConfiguration resConfig, IOption option) {
|
||||
// Continue if change is something that effect the scanreser
|
||||
try {
|
||||
if (!(option.getValueType() == IOption.INCLUDE_PATH
|
||||
|| option.getValueType() == IOption.PREPROCESSOR_SYMBOLS)) {
|
||||
if (resConfig.getParent().isTemporary() ||
|
||||
(option != null && option.getValueType() != IOption.INCLUDE_PATH
|
||||
&& option.getValueType() != IOption.PREPROCESSOR_SYMBOLS)) {
|
||||
return;
|
||||
}
|
||||
} catch (BuildException e) {return;}
|
||||
|
@ -846,7 +849,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
*/
|
||||
public static void setNewProjectVersion(IProject newProject) {
|
||||
// Get the build info for the argument
|
||||
ManagedBuildInfo info = findBuildInfo(newProject);
|
||||
ManagedBuildInfo info = findBuildInfo(newProject, true);
|
||||
info.setVersion(buildInfoVersion.toString());
|
||||
}
|
||||
|
||||
|
@ -869,8 +872,19 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
try {
|
||||
// Request a value change and set dirty if real change results
|
||||
retOpt = config.setOption(holder, option, value);
|
||||
initializePathEntries(config,option);
|
||||
notifyListeners(config, option);
|
||||
if (retOpt.getValueHandler().handleValue(
|
||||
config,
|
||||
holder,
|
||||
retOpt,
|
||||
retOpt.getValueHandlerExtraArgument(),
|
||||
IManagedOptionValueHandler.EVENT_APPLY)) {
|
||||
// TODO : Event is handled successfully and returned true.
|
||||
// May need to do something here say log a message.
|
||||
} else {
|
||||
// Event handling Failed.
|
||||
}
|
||||
initializePathEntries(config,retOpt);
|
||||
notifyListeners(config, retOpt);
|
||||
} catch (BuildException e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -896,8 +910,19 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
try {
|
||||
// Request a value change and set dirty if real change results
|
||||
retOpt = resConfig.setOption(holder, option, value);
|
||||
initializePathEntries(resConfig,option);
|
||||
notifyListeners(resConfig, option);
|
||||
if (retOpt.getValueHandler().handleValue(
|
||||
resConfig,
|
||||
holder,
|
||||
retOpt,
|
||||
retOpt.getValueHandlerExtraArgument(),
|
||||
IManagedOptionValueHandler.EVENT_APPLY)) {
|
||||
// TODO : Event is handled successfully and returned true.
|
||||
// May need to do something here say log a message.
|
||||
} else {
|
||||
// Event handling Failed.
|
||||
}
|
||||
initializePathEntries(resConfig,retOpt);
|
||||
notifyListeners(resConfig, retOpt);
|
||||
} catch (BuildException e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -921,8 +946,19 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
IOption retOpt;
|
||||
try {
|
||||
retOpt = config.setOption(holder, option, value);
|
||||
initializePathEntries(config,option);
|
||||
notifyListeners(config, option);
|
||||
if (retOpt.getValueHandler().handleValue(
|
||||
config,
|
||||
holder,
|
||||
retOpt,
|
||||
retOpt.getValueHandlerExtraArgument(),
|
||||
IManagedOptionValueHandler.EVENT_APPLY)) {
|
||||
// TODO : Event is handled successfully and returned true.
|
||||
// May need to do something here say log a message.
|
||||
} else {
|
||||
// Event handling Failed.
|
||||
}
|
||||
initializePathEntries(config,retOpt);
|
||||
notifyListeners(config, retOpt);
|
||||
} catch (BuildException e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -947,8 +983,19 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
IOption retOpt;
|
||||
try {
|
||||
retOpt = resConfig.setOption(holder, option, value);
|
||||
initializePathEntries(resConfig,option);
|
||||
notifyListeners(resConfig, option);
|
||||
if (retOpt.getValueHandler().handleValue(
|
||||
resConfig,
|
||||
holder,
|
||||
retOpt,
|
||||
retOpt.getValueHandlerExtraArgument(),
|
||||
IManagedOptionValueHandler.EVENT_APPLY)) {
|
||||
// TODO : Event is handled successfully and returned true.
|
||||
// May need to do something here say log a message.
|
||||
} else {
|
||||
// Event handling Failed.
|
||||
}
|
||||
initializePathEntries(resConfig,retOpt);
|
||||
notifyListeners(resConfig, retOpt);
|
||||
} catch (BuildException e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -972,8 +1019,19 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
IOption retOpt;
|
||||
try {
|
||||
retOpt = config.setOption(holder, option, value);
|
||||
initializePathEntries(config,option);
|
||||
notifyListeners(config, option);
|
||||
if (retOpt.getValueHandler().handleValue(
|
||||
config,
|
||||
holder,
|
||||
retOpt,
|
||||
retOpt.getValueHandlerExtraArgument(),
|
||||
IManagedOptionValueHandler.EVENT_APPLY)) {
|
||||
// TODO : Event is handled successfully and returned true.
|
||||
// May need to do something here say log a message.
|
||||
} else {
|
||||
// Event handling Failed.
|
||||
}
|
||||
initializePathEntries(config,retOpt);
|
||||
notifyListeners(config, retOpt);
|
||||
} catch (BuildException e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -998,8 +1056,19 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
IOption retOpt;
|
||||
try {
|
||||
retOpt = resConfig.setOption(holder, option, value);
|
||||
initializePathEntries(resConfig,option);
|
||||
notifyListeners(resConfig, option);
|
||||
if (retOpt.getValueHandler().handleValue(
|
||||
resConfig,
|
||||
holder,
|
||||
retOpt,
|
||||
retOpt.getValueHandlerExtraArgument(),
|
||||
IManagedOptionValueHandler.EVENT_APPLY)) {
|
||||
// TODO : Event is handled successfully and returned true.
|
||||
// May need to do something here say log a message.
|
||||
} else {
|
||||
// Event handling Failed.
|
||||
}
|
||||
initializePathEntries(resConfig,retOpt);
|
||||
notifyListeners(resConfig, retOpt);
|
||||
} catch (BuildException e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1167,9 +1236,20 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
* @param resource
|
||||
*/
|
||||
public static void removeBuildInfo(IResource resource) {
|
||||
try {
|
||||
resource.setSessionProperty(buildInfoProperty, null);
|
||||
} catch (CoreException e) {
|
||||
IManagedBuildInfo info = findBuildInfo(resource, false);
|
||||
if(info != null){
|
||||
IConfiguration[] configs = info.getManagedProject().getConfigurations();
|
||||
// Send an event to each configuration and if they exist, its resource configurations
|
||||
for (int i=0; i < configs.length; ++i) {
|
||||
ManagedBuildManager.performValueHandlerEvent(configs[i], IManagedOptionValueHandler.EVENT_CLOSE);
|
||||
}
|
||||
|
||||
info.setValid(false);
|
||||
|
||||
try {
|
||||
resource.setSessionProperty(buildInfoProperty, null);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1183,11 +1263,19 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
public static void resetConfiguration(IProject project, IConfiguration configuration) {
|
||||
// reset the configuration
|
||||
((Configuration)configuration).reset();
|
||||
|
||||
performValueHandlerEvent(configuration,
|
||||
IManagedOptionValueHandler.EVENT_SETDEFAULT, false);
|
||||
|
||||
}
|
||||
|
||||
public static void resetResourceConfiguration(IProject project, IResourceConfiguration resConfig) {
|
||||
// reset the configuration
|
||||
((ResourceConfiguration) resConfig).reset();
|
||||
|
||||
performValueHandlerEvent(resConfig,
|
||||
IManagedOptionValueHandler.EVENT_SETDEFAULT);
|
||||
|
||||
}
|
||||
/**
|
||||
* Adds a ProjectType that is is specified in the manifest to the
|
||||
|
@ -1450,7 +1538,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
|
||||
// Get the build info associated with this project for this session
|
||||
try {
|
||||
buildInfo = findBuildInfo(resource.getProject());
|
||||
buildInfo = findBuildInfo(resource.getProject(), true);
|
||||
initBuildInfoContainer(buildInfo);
|
||||
} catch (CoreException e) {
|
||||
return new Status(IStatus.ERROR,
|
||||
|
@ -1641,13 +1729,13 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
}
|
||||
}
|
||||
|
||||
// Finish up
|
||||
project.setSessionProperty(buildInfoProperty, buildInfo);
|
||||
IConfiguration[] configs = buildInfo.getManagedProject().getConfigurations();
|
||||
// Send an event to each configuration and if they exist, its resource configurations
|
||||
for (int i=0; i < configs.length; ++i) {
|
||||
ManagedBuildManager.performValueHandlerEvent(configs[i], IManagedOptionValueHandler.EVENT_OPEN);
|
||||
}
|
||||
// Finish up
|
||||
project.setSessionProperty(buildInfoProperty, buildInfo);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
|
@ -2083,18 +2171,10 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
* @param resource
|
||||
* @return
|
||||
*/
|
||||
private static ManagedBuildInfo findBuildInfo(IResource resource/*, boolean create*/) {
|
||||
private static ManagedBuildInfo findBuildInfo(IResource resource, boolean forceLoad) {
|
||||
|
||||
if (resource == null) return null;
|
||||
|
||||
// Make sure the extension information is loaded first
|
||||
try {
|
||||
loadExtensions();
|
||||
} catch (BuildException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
ManagedBuildInfo buildInfo = null;
|
||||
|
||||
// Check if there is any build info associated with this project for this session
|
||||
|
@ -2109,7 +2189,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
}
|
||||
|
||||
if (buildInfo == null && resource instanceof IProject)
|
||||
buildInfo = findBuildInfoSynchronized((IProject)resource);
|
||||
buildInfo = findBuildInfoSynchronized((IProject)resource, forceLoad);
|
||||
/*
|
||||
// Nothing in session store, so see if we can load it from cdtbuild
|
||||
if (buildInfo == null && resource instanceof IProject) {
|
||||
|
@ -2181,25 +2261,32 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
* @param resource
|
||||
* @return
|
||||
*/
|
||||
synchronized private static ManagedBuildInfo findBuildInfoSynchronized(IProject project/*, boolean create*/) {
|
||||
synchronized private static ManagedBuildInfo findBuildInfoSynchronized(IProject project, boolean forceLoad) {
|
||||
ManagedBuildInfo buildInfo = null;
|
||||
|
||||
// Check if there is any build info associated with this project for this session
|
||||
try {
|
||||
buildInfo = (ManagedBuildInfo)project.getSessionProperty(buildInfoProperty);
|
||||
// Make sure that if a project has build info, that the info is not corrupted
|
||||
if (buildInfo != null) {
|
||||
buildInfo.updateOwner(project);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
// return null;
|
||||
try {
|
||||
buildInfo = (ManagedBuildInfo)project.getSessionProperty(buildInfoProperty);
|
||||
// Make sure that if a project has build info, that the info is not corrupted
|
||||
if (buildInfo != null) {
|
||||
buildInfo.updateOwner(project);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
// return null;
|
||||
}
|
||||
|
||||
if(buildInfo == null && forceLoad){
|
||||
// Make sure the extension information is loaded first
|
||||
try {
|
||||
loadExtensions();
|
||||
} catch (BuildException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// Check weather getBuildInfo is called from converter
|
||||
if (buildInfo == null) {
|
||||
buildInfo = UpdateManagedProjectManager.getConvertedManagedBuildInfo(project);
|
||||
if (buildInfo != null) return buildInfo;
|
||||
}
|
||||
buildInfo = UpdateManagedProjectManager.getConvertedManagedBuildInfo(project);
|
||||
|
||||
// Nothing in session store, so see if we can load it from cdtbuild
|
||||
if (buildInfo == null) {
|
||||
|
@ -2220,7 +2307,9 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
|
||||
final Shell shell = window.getShell();
|
||||
final String exceptionMsg = e.getMessage();
|
||||
shell.getDisplay().syncExec( new Runnable() {
|
||||
//using syncExec could cause a dead-lock
|
||||
//that is why asyncExec is used
|
||||
shell.getDisplay().asyncExec( new Runnable() {
|
||||
public void run() {
|
||||
MessageDialog.openError(shell,
|
||||
ManagedMakeMessages.getResourceString("ManagedBuildManager.error.open_failed_title"), //$NON-NLS-1$
|
||||
|
@ -2229,17 +2318,18 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
if (buildInfo != null && !buildInfo.isContainerInited()) {
|
||||
// NOTE: If this is called inside the above rule, then an IllegalArgumentException can
|
||||
// occur when the CDT project file is saved - it uses the Workspace Root as the scheduling rule.
|
||||
//
|
||||
try {
|
||||
// Check if the project needs its container initialized
|
||||
initBuildInfoContainer(buildInfo);
|
||||
} catch (CoreException e) {
|
||||
// We can live without a path entry container if the build information is valid
|
||||
if (buildInfo != null && !buildInfo.isContainerInited()) {
|
||||
// NOTE: If this is called inside the above rule, then an IllegalArgumentException can
|
||||
// occur when the CDT project file is saved - it uses the Workspace Root as the scheduling rule.
|
||||
//
|
||||
try {
|
||||
// Check if the project needs its container initialized
|
||||
initBuildInfoContainer(buildInfo);
|
||||
} catch (CoreException e) {
|
||||
// We can live without a path entry container if the build information is valid
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2249,13 +2339,33 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
/**
|
||||
* Finds, but does not create, the managed build information for the
|
||||
* argument.
|
||||
* Loads the build info in case it is not currently loadded
|
||||
* Calling this method is the same as calling getBuildInfo(IResource resource, boolean forceLoad)
|
||||
* with the "forceLoad" argument set to true
|
||||
*
|
||||
*
|
||||
* @see ManagedBuildManager#initBuildInfo(IResource)
|
||||
* @param resource The resource to search for managed build information on.
|
||||
* @return IManagedBuildInfo The build information object for the resource.
|
||||
*/
|
||||
public static IManagedBuildInfo getBuildInfo(IResource resource) {
|
||||
return findBuildInfo(resource.getProject());
|
||||
return getBuildInfo(resource, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds, but does not create, the managed build information for the
|
||||
* argument.
|
||||
* If the build info is not currently loadded and "forceLoad" argument is set to true,
|
||||
* loads the build info from the .cdtbuild file
|
||||
* In case "forceLoad" is false, does not load the build info and returns null in case it is not loadded
|
||||
*
|
||||
* @see ManagedBuildManager#initBuildInfo(IResource)
|
||||
* @param resource The resource to search for managed build information on.
|
||||
* @param forceLoad specifies whether the build info should be loadded in case it is not loadded currently.
|
||||
* @return IManagedBuildInfo The build information object for the resource.
|
||||
*/
|
||||
public static IManagedBuildInfo getBuildInfo(IResource resource, boolean forceLoad) {
|
||||
return findBuildInfo(resource.getProject(), forceLoad);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2581,7 +2691,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
// Call the handler
|
||||
if (options[i].getValueHandler().handleValue(
|
||||
config,
|
||||
options[i].getOptionHolder(),
|
||||
toolChain,
|
||||
options[i],
|
||||
options[i].getValueHandlerExtraArgument(),
|
||||
event)) {
|
||||
|
@ -2603,7 +2713,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
// Call the handler
|
||||
if (toolOptions[j].getValueHandler().handleValue(
|
||||
config,
|
||||
toolOptions[j].getOptionHolder(),
|
||||
tools[i],
|
||||
toolOptions[j],
|
||||
toolOptions[j].getValueHandlerExtraArgument(),
|
||||
event)) {
|
||||
|
@ -2647,7 +2757,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
// Call the handler
|
||||
if (toolOptions[j].getValueHandler().handleValue(
|
||||
config,
|
||||
toolOptions[j].getOptionHolder(),
|
||||
tools[i],
|
||||
toolOptions[j],
|
||||
toolOptions[j].getValueHandlerExtraArgument(),
|
||||
event)) {
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.eclipse.cdt.managedbuilder.internal.core.ManagedMakeMessages;
|
|||
import org.eclipse.cdt.managedbuilder.internal.core.ResourceChangeHandler;
|
||||
import org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedBuildCPathEntryContainer;
|
||||
import org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedBuildPathEntryContainerInitializer;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResourceChangeEvent;
|
||||
import org.eclipse.core.resources.ISavedState;
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
|
@ -138,7 +139,11 @@ public class ManagedBuilderCorePlugin extends Plugin {
|
|||
ResourcesPlugin.getWorkspace().addSaveParticipant(ManagedBuilderCorePlugin.this, listener);
|
||||
|
||||
ResourcesPlugin.getWorkspace().addResourceChangeListener(
|
||||
listener, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_DELETE /*| IResourceChangeEvent.POST_BUILD*/);
|
||||
listener,
|
||||
IResourceChangeEvent.POST_CHANGE
|
||||
| IResourceChangeEvent.PRE_DELETE
|
||||
| IResourceChangeEvent.PRE_CLOSE
|
||||
/*| IResourceChangeEvent.POST_BUILD*/);
|
||||
|
||||
if (lastState != null) {
|
||||
lastState.processResourceChangeEvents(listener);
|
||||
|
@ -153,6 +158,10 @@ public class ManagedBuilderCorePlugin extends Plugin {
|
|||
// ResourceConfiguration elements up to date. It may also be needed by AdditionalInput
|
||||
// elements
|
||||
ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener);
|
||||
IProject projects[] = ResourcesPlugin.getWorkspace().getRoot().getProjects();
|
||||
for(int i = 0; i < projects.length; i++){
|
||||
listener.sendClose(projects[i]);
|
||||
}
|
||||
listener = null;
|
||||
super.stop(context);
|
||||
}
|
||||
|
|
|
@ -868,6 +868,8 @@ public class Configuration extends BuildObject implements IConfiguration {
|
|||
}
|
||||
|
||||
public void removeResourceConfiguration(IResourceConfiguration resConfig) {
|
||||
ManagedBuildManager.performValueHandlerEvent(resConfig,
|
||||
IManagedOptionValueHandler.EVENT_CLOSE);
|
||||
getResourceConfigurationList().remove(resConfig);
|
||||
getResourceConfigurationMap().remove(resConfig.getResourcePath());
|
||||
isDirty = true;
|
||||
|
@ -1391,7 +1393,7 @@ public class Configuration extends BuildObject implements IConfiguration {
|
|||
// Send out the event to notify the options that they are about to be removed.
|
||||
// Do not do this for the child resource configurations as they are handled when
|
||||
// the configuration itself is destroyed.
|
||||
ManagedBuildManager.performValueHandlerEvent(this, IManagedOptionValueHandler.EVENT_CLOSE, false);
|
||||
// ManagedBuildManager.performValueHandlerEvent(this, IManagedOptionValueHandler.EVENT_CLOSE, false);
|
||||
// Remove the configurations
|
||||
for (int i = 0; i < tools.length; i++) {
|
||||
ITool tool = tools[i];
|
||||
|
|
|
@ -311,6 +311,8 @@ public class ManagedProject extends BuildObject implements IManagedProject {
|
|||
}
|
||||
((IProject)proj).build(IncrementalProjectBuilder.CLEAN_BUILD, monitor);
|
||||
|
||||
ManagedBuildManager.performValueHandlerEvent(config,
|
||||
IManagedOptionValueHandler.EVENT_CLOSE);
|
||||
getConfigurationList().remove(config);
|
||||
getConfigurationMap().remove(removeId);
|
||||
|
||||
|
|
|
@ -1404,9 +1404,9 @@ public class Option extends BuildObject implements IOption {
|
|||
* @see org.eclipse.cdt.managedbuilder.core.IOption#setValue(boolean)
|
||||
*/
|
||||
public void setValue(boolean value) throws BuildException {
|
||||
if (!isExtensionElement() && getValueType() == BOOLEAN)
|
||||
if (/*!isExtensionElement() && */getValueType() == BOOLEAN){
|
||||
this.value = new Boolean(value);
|
||||
else {
|
||||
} else {
|
||||
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
|
||||
}
|
||||
setDirty(true);
|
||||
|
@ -1418,7 +1418,7 @@ public class Option extends BuildObject implements IOption {
|
|||
*/
|
||||
public void setValue(String value) throws BuildException {
|
||||
// Note that we can still set the human-readable value here
|
||||
if (!isExtensionElement() && (getValueType() == STRING || getValueType() == ENUMERATED)) {
|
||||
if (/*!isExtensionElement() && */(getValueType() == STRING || getValueType() == ENUMERATED)) {
|
||||
this.value = value;
|
||||
} else {
|
||||
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
|
||||
|
@ -1431,14 +1431,17 @@ public class Option extends BuildObject implements IOption {
|
|||
* @see org.eclipse.cdt.managedbuilder.core.IOption#setValue(String [])
|
||||
*/
|
||||
public void setValue(String [] value) throws BuildException {
|
||||
if (!isExtensionElement() &&
|
||||
if (/*!isExtensionElement() && */
|
||||
(getValueType() == STRING_LIST
|
||||
|| getValueType() == INCLUDE_PATH
|
||||
|| getValueType() == PREPROCESSOR_SYMBOLS
|
||||
|| getValueType() == LIBRARIES
|
||||
|| getValueType() == OBJECTS)) {
|
||||
// Just replace what the option reference is holding onto
|
||||
this.value = new ArrayList(Arrays.asList(value));
|
||||
// Just replace what the option reference is holding onto
|
||||
if(value == null)
|
||||
this.value = null;
|
||||
else
|
||||
this.value = new ArrayList(Arrays.asList(value));
|
||||
}
|
||||
else {
|
||||
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
|
||||
|
|
|
@ -201,7 +201,7 @@ public class ProjectType extends BuildObject implements IProjectType {
|
|||
*/
|
||||
public IConfiguration createConfiguration(IConfiguration parent, String id, String name) {
|
||||
Configuration config = new Configuration(this, parent, id, name);
|
||||
ManagedBuildManager.performValueHandlerEvent(config, IManagedOptionValueHandler.EVENT_OPEN);
|
||||
// ManagedBuildManager.performValueHandlerEvent(config, IManagedOptionValueHandler.EVENT_OPEN);
|
||||
return (IConfiguration)config;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.util.HashSet;
|
|||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
|
@ -73,6 +74,7 @@ public class ResourceChangeHandler implements IResourceChangeListener, ISavePart
|
|||
switch (delta.getKind()) {
|
||||
case IResourceDelta.REMOVED :
|
||||
if ((delta.getFlags() & IResourceDelta.MOVED_TO) == 0 && rcType == IResource.PROJECT) {
|
||||
sendClose((IProject)dResource);
|
||||
break;
|
||||
}
|
||||
case IResourceDelta.CHANGED :
|
||||
|
@ -278,6 +280,16 @@ public class ResourceChangeHandler implements IResourceChangeListener, ISavePart
|
|||
}
|
||||
}
|
||||
|
||||
public void sendClose(IProject project){
|
||||
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project,false);
|
||||
if(info != null){
|
||||
IConfiguration cfgs[] = info.getManagedProject().getConfigurations();
|
||||
|
||||
for(int i = 0; i < cfgs.length; i++)
|
||||
ManagedBuildManager.performValueHandlerEvent(cfgs[i], IManagedOptionValueHandler.EVENT_CLOSE, true);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* I R e s o u r c e C h a n g e L i s t e n e r
|
||||
*/
|
||||
|
@ -291,8 +303,13 @@ public class ResourceChangeHandler implements IResourceChangeListener, ISavePart
|
|||
*/
|
||||
public void resourceChanged(IResourceChangeEvent event) {
|
||||
if (event.getSource() instanceof IWorkspace) {
|
||||
|
||||
|
||||
switch (event.getType()) {
|
||||
case IResourceChangeEvent.PRE_CLOSE:
|
||||
IResource proj = event.getResource();
|
||||
if(proj instanceof IProject)
|
||||
sendClose((IProject)proj);
|
||||
break;
|
||||
case IResourceChangeEvent.POST_CHANGE :
|
||||
case IResourceChangeEvent.POST_BUILD :
|
||||
case IResourceChangeEvent.PRE_DELETE :
|
||||
|
|
|
@ -730,7 +730,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
|||
// We just need to remove all Options
|
||||
ITool[] tools = getTools();
|
||||
// Send out the event to notify the options that they are about to be removed
|
||||
ManagedBuildManager.performValueHandlerEvent(this, IManagedOptionValueHandler.EVENT_CLOSE);
|
||||
// ManagedBuildManager.performValueHandlerEvent(this, IManagedOptionValueHandler.EVENT_CLOSE);
|
||||
// Remove the configurations
|
||||
for (int i = 0; i < tools.length; i++) {
|
||||
ITool tool = tools[i];
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.eclipse.cdt.managedbuilder.core.BuildException;
|
|||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
|
||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
||||
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
||||
|
@ -500,7 +499,7 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
|
|||
* Call an MBS CallBack function to inform that default settings have been applied.
|
||||
* This has to be sent to all the Options associated with this configuration.
|
||||
*/
|
||||
private void performSetDefaultsEventCallBack() {
|
||||
/* private void performSetDefaultsEventCallBack() {
|
||||
|
||||
if ( element instanceof IProject) {
|
||||
// Do not send the event to the child resource configurations, as performDefaults
|
||||
|
@ -514,7 +513,7 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
|
|||
IManagedOptionValueHandler.EVENT_SETDEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults()
|
||||
|
@ -585,7 +584,7 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
|
|||
else
|
||||
ManagedBuildManager.resetConfiguration(parent.getProject(), parent.getSelectedConfiguration());
|
||||
|
||||
performSetDefaultsEventCallBack();
|
||||
// performSetDefaultsEventCallBack();
|
||||
|
||||
defaultNeeded = false;
|
||||
}
|
||||
|
@ -634,7 +633,7 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
|
|||
private void saveOption(IOption clonedOption, IHoldsOptions cloneHolder){
|
||||
IConfiguration realCfg = null;
|
||||
IResourceConfiguration realRcCfg = null;
|
||||
IBuildObject handler = null;
|
||||
// IBuildObject handler = null;
|
||||
IOption realOption;
|
||||
IHoldsOptions realHolder;
|
||||
|
||||
|
@ -643,12 +642,12 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
|
|||
realHolder = resParent.getRealHoldsOptions(cloneHolder);
|
||||
realRcCfg = (IResourceConfiguration)((ITool)realHolder).getParent();
|
||||
realCfg = realRcCfg.getParent();
|
||||
handler = realRcCfg;
|
||||
// handler = realRcCfg;
|
||||
} else {
|
||||
realOption = parent.getRealOption(clonedOption,cloneHolder);
|
||||
realHolder = parent.getRealHoldsOptions(cloneHolder);
|
||||
realCfg = parent.getConfigurationFromHoldsOptions(realHolder);
|
||||
handler = realCfg;
|
||||
// handler = realCfg;
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -729,7 +728,7 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
|
|||
if (setOption == null)
|
||||
setOption = realOption;
|
||||
|
||||
if (setOption.getValueHandler().handleValue(
|
||||
/* if (setOption.getValueHandler().handleValue(
|
||||
handler,
|
||||
setOption.getOptionHolder(),
|
||||
setOption,
|
||||
|
@ -739,7 +738,8 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
|
|||
// May need to do something here say log a message.
|
||||
} else {
|
||||
// Event handling Failed.
|
||||
}
|
||||
}
|
||||
*/
|
||||
} catch (BuildException e) {
|
||||
} catch (ClassCastException e) {
|
||||
}
|
||||
|
|
|
@ -326,7 +326,7 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
|||
if (setOption == null)
|
||||
setOption = realOption;
|
||||
|
||||
if (setOption.getValueHandler().handleValue(
|
||||
/* if (setOption.getValueHandler().handleValue(
|
||||
handler,
|
||||
setOption.getOptionHolder(),
|
||||
setOption,
|
||||
|
@ -336,7 +336,8 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
|||
// May need to do something here say log a message.
|
||||
} else {
|
||||
// Event handling Failed.
|
||||
}
|
||||
}
|
||||
*/
|
||||
} catch (BuildException e) {
|
||||
} catch (ClassCastException e) {
|
||||
}
|
||||
|
@ -448,9 +449,11 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
|||
if(fe instanceof StringFieldEditor){
|
||||
String val = ((StringFieldEditor)fe).getStringValue();
|
||||
if (isItResourceConfigPage) {
|
||||
newOption = clonedResConfig.setOption(changedHolder,changedOption,val);
|
||||
newOption = ManagedBuildManager.setOption(clonedResConfig,changedHolder,changedOption,val);
|
||||
// newOption = clonedResConfig.setOption(changedHolder,changedOption,val);
|
||||
} else {
|
||||
newOption = clonedConfig.setOption(changedHolder,changedOption,val);
|
||||
newOption = ManagedBuildManager.setOption(clonedConfig,changedHolder,changedOption,val);
|
||||
// newOption = clonedConfig.setOption(changedHolder,changedOption,val);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -458,9 +461,11 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
|||
if(fe instanceof BooleanFieldEditor){
|
||||
boolean val = ((BooleanFieldEditor)fe).getBooleanValue();
|
||||
if (isItResourceConfigPage) {
|
||||
newOption = clonedResConfig.setOption(changedHolder,changedOption,val);
|
||||
newOption = ManagedBuildManager.setOption(clonedResConfig,changedHolder,changedOption,val);
|
||||
// newOption = clonedResConfig.setOption(changedHolder,changedOption,val);
|
||||
} else {
|
||||
newOption = clonedConfig.setOption(changedHolder,changedOption,val);
|
||||
newOption = ManagedBuildManager.setOption(clonedConfig,changedHolder,changedOption,val);
|
||||
// newOption = clonedConfig.setOption(changedHolder,changedOption,val);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -469,11 +474,17 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
|||
String name = ((BuildOptionComboFieldEditor)fe).getSelection();
|
||||
String enumId = changedOption.getEnumeratedId(name);
|
||||
if(isItResourceConfigPage) {
|
||||
newOption = clonedResConfig.setOption(changedHolder, changedOption,
|
||||
newOption = ManagedBuildManager.setOption(clonedResConfig,changedHolder,changedOption,
|
||||
(enumId != null && enumId.length() > 0) ? enumId : name);
|
||||
|
||||
// newOption = clonedResConfig.setOption(changedHolder, changedOption,
|
||||
// (enumId != null && enumId.length() > 0) ? enumId : name);
|
||||
} else {
|
||||
newOption = clonedConfig.setOption(changedHolder, changedOption,
|
||||
newOption = ManagedBuildManager.setOption(clonedConfig,changedHolder,changedOption,
|
||||
(enumId != null && enumId.length() > 0) ? enumId : name);
|
||||
|
||||
// newOption = clonedConfig.setOption(changedHolder, changedOption,
|
||||
// (enumId != null && enumId.length() > 0) ? enumId : name);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -486,9 +497,11 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
|||
if(fe instanceof FileListControlFieldEditor){
|
||||
String val[] =((FileListControlFieldEditor)fe).getStringListValue();
|
||||
if (isItResourceConfigPage) {
|
||||
newOption = clonedResConfig.setOption(changedHolder,changedOption,val);
|
||||
newOption = ManagedBuildManager.setOption(clonedResConfig,changedHolder,changedOption,val);
|
||||
// newOption = clonedResConfig.setOption(changedHolder,changedOption,val);
|
||||
} else {
|
||||
newOption = clonedConfig.setOption(changedHolder,changedOption,val);
|
||||
newOption = ManagedBuildManager.setOption(clonedConfig,changedHolder,changedOption,val);
|
||||
// newOption = clonedConfig.setOption(changedHolder,changedOption,val);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -454,19 +454,19 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
|
|||
Object[][] clonedOptions;
|
||||
IResourceConfiguration realRcCfg = null;
|
||||
IConfiguration realCfg = null;
|
||||
IBuildObject handler = null;
|
||||
// IBuildObject handler = null;
|
||||
|
||||
if (isItResourceConfigPage){
|
||||
realRcCfg = buildPropPage.getRealRcConfig(clonedResConfig);
|
||||
if(realRcCfg == null)
|
||||
return false;
|
||||
handler = realRcCfg;
|
||||
// handler = realRcCfg;
|
||||
clonedOptions = clonedCategory.getOptions(clonedResConfig);
|
||||
} else {
|
||||
realCfg = buildPropPage.getRealConfig(clonedConfig);
|
||||
if(realCfg == null)
|
||||
return false;
|
||||
handler = realCfg;
|
||||
// handler = realCfg;
|
||||
clonedOptions = clonedCategory.getOptions(clonedConfig);
|
||||
}
|
||||
|
||||
|
@ -535,7 +535,7 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
|
|||
// press have been applied.
|
||||
if (setOption == null)
|
||||
setOption = realOption;
|
||||
|
||||
/*
|
||||
if (setOption.getValueHandler().handleValue(
|
||||
handler,
|
||||
setOption.getOptionHolder(),
|
||||
|
@ -546,7 +546,8 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
|
|||
// May need to do something here say log a message.
|
||||
} else {
|
||||
// Event handling Failed.
|
||||
}
|
||||
}
|
||||
*/
|
||||
} catch (BuildException e) {
|
||||
} catch (ClassCastException e) {
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue