mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Progress monitor support basis for the CProjectDescription operation
This commit is contained in:
parent
2c66e22885
commit
968559df5c
15 changed files with 442 additions and 175 deletions
|
@ -48,6 +48,7 @@ import org.eclipse.cdt.managedbuilder.internal.core.NotificationManager;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
|
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.QualifiedName;
|
import org.eclipse.core.runtime.QualifiedName;
|
||||||
import org.eclipse.core.runtime.content.IContentType;
|
import org.eclipse.core.runtime.content.IContentType;
|
||||||
|
|
||||||
|
@ -101,7 +102,8 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
public CConfigurationData applyConfiguration(
|
public CConfigurationData applyConfiguration(
|
||||||
ICConfigurationDescription des,
|
ICConfigurationDescription des,
|
||||||
ICConfigurationDescription baseDescription,
|
ICConfigurationDescription baseDescription,
|
||||||
CConfigurationData base)
|
CConfigurationData base,
|
||||||
|
IProgressMonitor monitor)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
if(des.isPreferenceConfiguration())
|
if(des.isPreferenceConfiguration())
|
||||||
return applyPreferences(des, base);
|
return applyPreferences(des, base);
|
||||||
|
@ -155,7 +157,8 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
public CConfigurationData createConfiguration(
|
public CConfigurationData createConfiguration(
|
||||||
ICConfigurationDescription des,
|
ICConfigurationDescription des,
|
||||||
ICConfigurationDescription baseDescription,
|
ICConfigurationDescription baseDescription,
|
||||||
CConfigurationData base, boolean clone)
|
CConfigurationData base, boolean clone,
|
||||||
|
IProgressMonitor monitor)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
if(des.isPreferenceConfiguration())
|
if(des.isPreferenceConfiguration())
|
||||||
return createPreferences(des, base);
|
return createPreferences(des, base);
|
||||||
|
@ -395,7 +398,8 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
return emptyPrefCfg;
|
return emptyPrefCfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CConfigurationData loadConfiguration(ICConfigurationDescription des)
|
public CConfigurationData loadConfiguration(ICConfigurationDescription des,
|
||||||
|
IProgressMonitor monitor)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
if(des.isPreferenceConfiguration())
|
if(des.isPreferenceConfiguration())
|
||||||
return loadPreferences(des);
|
return loadPreferences(des);
|
||||||
|
@ -425,7 +429,8 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
|
|
||||||
|
|
||||||
public void removeConfiguration(ICConfigurationDescription des,
|
public void removeConfiguration(ICConfigurationDescription des,
|
||||||
CConfigurationData data) {
|
CConfigurationData data,
|
||||||
|
IProgressMonitor monitor) {
|
||||||
IConfiguration cfg = ((BuildConfigurationData)data).getConfiguration();
|
IConfiguration cfg = ((BuildConfigurationData)data).getConfiguration();
|
||||||
ManagedBuildManager.performValueHandlerEvent(cfg, IManagedOptionValueHandler.EVENT_CLOSE);
|
ManagedBuildManager.performValueHandlerEvent(cfg, IManagedOptionValueHandler.EVENT_CLOSE);
|
||||||
IManagedBuildInfo info = getBuildInfo(des);
|
IManagedBuildInfo info = getBuildInfo(des);
|
||||||
|
|
|
@ -353,8 +353,9 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
try {
|
try {
|
||||||
discoveryPage = (org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage) fElement.createExecutableExtension("class"); //$NON-NLS-1$
|
discoveryPage = (org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage) fElement.createExecutableExtension("class"); //$NON-NLS-1$
|
||||||
} catch (CoreException e) {}
|
} catch (CoreException e) {}
|
||||||
if (discoveryPage == null)
|
if (discoveryPage == null) {
|
||||||
System.out.println(Messages.getString("DiscoveryTab.13") + fElement.getAttribute("class")); //$NON-NLS-1$ //$NON-NLS-2$
|
// System.out.println(Messages.getString("DiscoveryTab.13") + fElement.getAttribute("class")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
}
|
||||||
return discoveryPage;
|
return discoveryPage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -376,10 +377,11 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
try {
|
try {
|
||||||
cbi2.applyInfo(ic, bi1);
|
cbi2.applyInfo(ic, bi1);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
System.out.println(Messages.getString("DiscoveryTab.15") + e.getLocalizedMessage()); //$NON-NLS-1$
|
// System.out.println(Messages.getString("DiscoveryTab.15") + e.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
System.out.println(Messages.getString("DiscoveryTab.16")); //$NON-NLS-1$
|
// System.out.println(Messages.getString("DiscoveryTab.16")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,6 @@ DiscoveryTab.1=Per Resource type
|
||||||
DiscoveryTab.2=Configuration-wide
|
DiscoveryTab.2=Configuration-wide
|
||||||
DiscoveryTab.3=Unknown
|
DiscoveryTab.3=Unknown
|
||||||
DiscoveryTab.6=No profiles found
|
DiscoveryTab.6=No profiles found
|
||||||
DiscoveryTab.13=failed to create:
|
|
||||||
DiscoveryTab.15=applyInfo:
|
|
||||||
DiscoveryTab.16=applyInfo: context does not fit
|
|
||||||
ToolSelectionDialog.0=Select tools
|
ToolSelectionDialog.0=Select tools
|
||||||
ToolSelectionDialog.1=Available tools
|
ToolSelectionDialog.1=Available tools
|
||||||
ToolSelectionDialog.2=Used tools
|
ToolSelectionDialog.2=Used tools
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.eclipse.cdt.core.CCProjectNature;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.CProjectNature;
|
import org.eclipse.cdt.core.CProjectNature;
|
||||||
import org.eclipse.cdt.core.resources.IPathEntryStore;
|
import org.eclipse.cdt.core.resources.IPathEntryStore;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.WriteAccessException;
|
import org.eclipse.cdt.core.settings.model.WriteAccessException;
|
||||||
import org.eclipse.cdt.internal.core.model.APathEntry;
|
import org.eclipse.cdt.internal.core.model.APathEntry;
|
||||||
|
@ -1318,6 +1317,10 @@ public class CoreModel {
|
||||||
descriptionManager.setProjectDescription(project, des);
|
descriptionManager.setProjectDescription(project, des);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setProjectDescription(IProject project, ICProjectDescription des, boolean force, IProgressMonitor monitor) throws CoreException {
|
||||||
|
descriptionManager.setProjectDescription(project, des, force, monitor);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the project description associated with this project
|
* returns the project description associated with this project
|
||||||
*
|
*
|
||||||
|
|
|
@ -12,6 +12,7 @@ package org.eclipse.cdt.core.settings.model.extension;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the class is to be implemented by the Configuration data provider contributed via
|
* the class is to be implemented by the Configuration data provider contributed via
|
||||||
|
@ -22,7 +23,7 @@ public abstract class CConfigurationDataProvider {
|
||||||
/**
|
/**
|
||||||
* requests the Configuration Data to be loadded for the given ConfigurationDescription
|
* requests the Configuration Data to be loadded for the given ConfigurationDescription
|
||||||
*/
|
*/
|
||||||
public abstract CConfigurationData loadConfiguration(ICConfigurationDescription des) throws CoreException;
|
public abstract CConfigurationData loadConfiguration(ICConfigurationDescription des, IProgressMonitor monitor) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* requests the Configuration Data to be created for the given ConfigurationDescription
|
* requests the Configuration Data to be created for the given ConfigurationDescription
|
||||||
|
@ -42,7 +43,8 @@ public abstract class CConfigurationDataProvider {
|
||||||
*/
|
*/
|
||||||
public abstract CConfigurationData createConfiguration(ICConfigurationDescription des,
|
public abstract CConfigurationData createConfiguration(ICConfigurationDescription des,
|
||||||
ICConfigurationDescription baseDescription,
|
ICConfigurationDescription baseDescription,
|
||||||
CConfigurationData baseData, boolean clone) throws CoreException;
|
CConfigurationData baseData, boolean clone,
|
||||||
|
IProgressMonitor monitor) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called to notify the provider that the configuration is removed
|
* called to notify the provider that the configuration is removed
|
||||||
|
@ -50,7 +52,7 @@ public abstract class CConfigurationDataProvider {
|
||||||
* @param des
|
* @param des
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
public abstract void removeConfiguration(ICConfigurationDescription des, CConfigurationData data);
|
public abstract void removeConfiguration(ICConfigurationDescription des, CConfigurationData data, IProgressMonitor monitor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called during the setProjectDescription operation to notify the provider that the configuration data
|
* called during the setProjectDescription operation to notify the provider that the configuration data
|
||||||
|
@ -64,5 +66,6 @@ public abstract class CConfigurationDataProvider {
|
||||||
*/
|
*/
|
||||||
public abstract CConfigurationData applyConfiguration(ICConfigurationDescription des,
|
public abstract CConfigurationData applyConfiguration(ICConfigurationDescription des,
|
||||||
ICConfigurationDescription baseDescription,
|
ICConfigurationDescription baseDescription,
|
||||||
CConfigurationData baseData) throws CoreException;
|
CConfigurationData baseData,
|
||||||
|
IProgressMonitor monitor) throws CoreException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
|
||||||
if(baseData instanceof CConfigurationDescriptionCache){
|
if(baseData instanceof CConfigurationDescriptionCache){
|
||||||
baseData = ((CConfigurationDescriptionCache)baseData).getConfigurationData();
|
baseData = ((CConfigurationDescriptionCache)baseData).getConfigurationData();
|
||||||
}
|
}
|
||||||
setData(CProjectDescriptionManager.getInstance().createData(this, base, baseData, false));
|
setData(CProjectDescriptionManager.getInstance().createData(this, base, baseData, false, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -134,7 +134,7 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
|
||||||
fCfgSpecSettings.setId(id);
|
fCfgSpecSettings.setId(id);
|
||||||
fCfgSpecSettings.setName(name);
|
fCfgSpecSettings.setName(name);
|
||||||
fCfgSpecSettings.setBuildSystemId(bsId);
|
fCfgSpecSettings.setBuildSystemId(bsId);
|
||||||
setData(CProjectDescriptionManager.getInstance().loadData(this));
|
setData(CProjectDescriptionManager.getInstance().loadData(this, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
void doWritable() throws CoreException{
|
void doWritable() throws CoreException{
|
||||||
|
@ -142,7 +142,7 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
|
||||||
CConfigurationData data = getConfigurationData(false);
|
CConfigurationData data = getConfigurationData(false);
|
||||||
CConfigurationDescriptionCache cache = (CConfigurationDescriptionCache)data;
|
CConfigurationDescriptionCache cache = (CConfigurationDescriptionCache)data;
|
||||||
data = cache.getConfigurationData();
|
data = cache.getConfigurationData();
|
||||||
setData(CProjectDescriptionManager.getInstance().createData(this, cache, data, true));
|
setData(CProjectDescriptionManager.getInstance().createData(this, cache, data, true, null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
|
||||||
|
|
||||||
fDataLoadded = true;
|
fDataLoadded = true;
|
||||||
|
|
||||||
fData = CProjectDescriptionManager.getInstance().loadData(this);
|
fData = CProjectDescriptionManager.getInstance().loadData(this, null);
|
||||||
copySettingsFrom(fData, true);
|
copySettingsFrom(fData, true);
|
||||||
|
|
||||||
fSpecSettings.reconsileExtensionSettings(true);
|
fSpecSettings.reconsileExtensionSettings(true);
|
||||||
|
@ -125,7 +125,7 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
|
||||||
if(fBaseDescription == null)
|
if(fBaseDescription == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fData = CProjectDescriptionManager.getInstance().applyData(this, fBaseDescription, fData);
|
fData = CProjectDescriptionManager.getInstance().applyData(this, fBaseDescription, fData, null);
|
||||||
fDataLoadded = true;
|
fDataLoadded = true;
|
||||||
fName = fData.getName();
|
fName = fData.getName();
|
||||||
fId = fData.getId();
|
fId = fData.getId();
|
||||||
|
|
|
@ -47,8 +47,6 @@ import org.eclipse.cdt.core.model.ICElementDelta;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.model.ILanguageDescriptor;
|
import org.eclipse.cdt.core.model.ILanguageDescriptor;
|
||||||
import org.eclipse.cdt.core.model.LanguageManager;
|
import org.eclipse.cdt.core.model.LanguageManager;
|
||||||
import org.eclipse.cdt.core.settings.model.ICBuildSetting;
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference;
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICFileDescription;
|
import org.eclipse.cdt.core.settings.model.ICFileDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
|
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
|
||||||
|
@ -96,12 +94,12 @@ import org.eclipse.core.runtime.IExtension;
|
||||||
import org.eclipse.core.runtime.IExtensionPoint;
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.ISafeRunnable;
|
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.QualifiedName;
|
import org.eclipse.core.runtime.QualifiedName;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
import org.eclipse.core.runtime.content.IContentType;
|
import org.eclipse.core.runtime.content.IContentType;
|
||||||
import org.eclipse.core.runtime.content.IContentTypeManager;
|
import org.eclipse.core.runtime.content.IContentTypeManager;
|
||||||
import org.eclipse.core.runtime.content.IContentTypeSettings;
|
import org.eclipse.core.runtime.content.IContentTypeSettings;
|
||||||
|
@ -149,34 +147,74 @@ public class CProjectDescriptionManager {
|
||||||
private static final QualifiedName SCANNER_INFO_PROVIDER_PROPERTY = new QualifiedName(CCorePlugin.PLUGIN_ID, "scannerInfoProvider"); //$NON-NLS-1$
|
private static final QualifiedName SCANNER_INFO_PROVIDER_PROPERTY = new QualifiedName(CCorePlugin.PLUGIN_ID, "scannerInfoProvider"); //$NON-NLS-1$
|
||||||
private static final QualifiedName LOAD_FLAG = new QualifiedName(CCorePlugin.PLUGIN_ID, "descriptionLoadded"); //$NON-NLS-1$
|
private static final QualifiedName LOAD_FLAG = new QualifiedName(CCorePlugin.PLUGIN_ID, "descriptionLoadded"); //$NON-NLS-1$
|
||||||
|
|
||||||
private class CompositeSafeRunnable implements ISafeRunnable {
|
// private class CompositeSafeRunnable implements ISafeRunnable {
|
||||||
|
// private List fRunnables = new ArrayList();
|
||||||
|
// private boolean fStopOnErr;
|
||||||
|
//
|
||||||
|
// public void add(ISafeRunnable runnable){
|
||||||
|
// fRunnables.add(runnable);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void handleException(Throwable exception) {
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void run() throws Exception {
|
||||||
|
// for(Iterator iter = fRunnables.iterator(); iter.hasNext();){
|
||||||
|
// ISafeRunnable r = (ISafeRunnable)iter.next();
|
||||||
|
// try {
|
||||||
|
// r.run();
|
||||||
|
// } catch (Exception e){
|
||||||
|
// r.handleException(e);
|
||||||
|
// if(fStopOnErr)
|
||||||
|
// throw e;
|
||||||
|
// else
|
||||||
|
// r.handleException(e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
private class CompositeWorkspaceRunnable implements IWorkspaceRunnable {
|
||||||
private List fRunnables = new ArrayList();
|
private List fRunnables = new ArrayList();
|
||||||
|
private String fName;
|
||||||
private boolean fStopOnErr;
|
private boolean fStopOnErr;
|
||||||
|
|
||||||
public void add(ISafeRunnable runnable){
|
CompositeWorkspaceRunnable(String name){
|
||||||
|
if(name == null)
|
||||||
|
name = ""; //$NON-NLS-1$
|
||||||
|
fName = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(IWorkspaceRunnable runnable){
|
||||||
fRunnables.add(runnable);
|
fRunnables.add(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleException(Throwable exception) {
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
}
|
try {
|
||||||
|
monitor.beginTask(fName, fRunnables.size());
|
||||||
|
|
||||||
public void run() throws Exception {
|
for(Iterator iter = fRunnables.iterator(); iter.hasNext();){
|
||||||
for(Iterator iter = fRunnables.iterator(); iter.hasNext();){
|
IWorkspaceRunnable r = (IWorkspaceRunnable)iter.next();
|
||||||
ISafeRunnable r = (ISafeRunnable)iter.next();
|
IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
|
||||||
try {
|
try {
|
||||||
r.run();
|
r.run(subMonitor);
|
||||||
} catch (Exception e){
|
} catch (CoreException e){
|
||||||
r.handleException(e);
|
if(fStopOnErr)
|
||||||
if(fStopOnErr)
|
throw e;
|
||||||
throw e;
|
} catch (RuntimeException e) {
|
||||||
else
|
if(fStopOnErr)
|
||||||
r.handleException(e);
|
throw e;
|
||||||
|
} finally {
|
||||||
|
subMonitor.done();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
monitor.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DesSerializationRunnable implements ISafeRunnable {
|
private class DesSerializationRunnable implements IWorkspaceRunnable {
|
||||||
private ICProjectDescription fDes;
|
private ICProjectDescription fDes;
|
||||||
private ICStorageElement fElement;
|
private ICStorageElement fElement;
|
||||||
|
|
||||||
|
@ -185,10 +223,7 @@ public class CProjectDescriptionManager {
|
||||||
fElement = el;
|
fElement = el;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleException(Throwable exception) {
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
}
|
|
||||||
|
|
||||||
public void run() throws Exception {
|
|
||||||
serialize(fDes.getProject(), STORAGE_FILE_NAME, fElement);
|
serialize(fDes.getProject(), STORAGE_FILE_NAME, fElement);
|
||||||
((ContributedEnvironment)CCorePlugin.getDefault().getBuildEnvironmentManager().getContributedEnvironment()).serialize(fDes);
|
((ContributedEnvironment)CCorePlugin.getDefault().getBuildEnvironmentManager().getContributedEnvironment()).serialize(fDes);
|
||||||
}
|
}
|
||||||
|
@ -574,15 +609,12 @@ public class CProjectDescriptionManager {
|
||||||
private void saveConversion(final IProject proj,
|
private void saveConversion(final IProject proj,
|
||||||
final IProjectDescription eDes,
|
final IProjectDescription eDes,
|
||||||
CProjectDescription des,
|
CProjectDescription des,
|
||||||
final IProgressMonitor monitor) {
|
IProgressMonitor monitor) {
|
||||||
|
|
||||||
CompositeSafeRunnable r = new CompositeSafeRunnable();
|
CompositeWorkspaceRunnable r = new CompositeWorkspaceRunnable(null);
|
||||||
r.add(new ISafeRunnable(){
|
r.add(new IWorkspaceRunnable(){
|
||||||
|
|
||||||
public void handleException(Throwable exception) {
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
}
|
|
||||||
|
|
||||||
public void run() throws Exception {
|
|
||||||
proj.setDescription(eDes, monitor);
|
proj.setDescription(eDes, monitor);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -596,7 +628,7 @@ public class CProjectDescriptionManager {
|
||||||
runWspModification(r, monitor);
|
runWspModification(r, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Job runWspModification(final ISafeRunnable runnable, IProgressMonitor monitor){
|
public Job runWspModification(final IWorkspaceRunnable runnable, IProgressMonitor monitor){
|
||||||
final IWorkspace wsp = ResourcesPlugin.getWorkspace();
|
final IWorkspace wsp = ResourcesPlugin.getWorkspace();
|
||||||
boolean scheduleRule = true;
|
boolean scheduleRule = true;
|
||||||
if(!wsp.isTreeLocked()) {
|
if(!wsp.isTreeLocked()) {
|
||||||
|
@ -606,11 +638,12 @@ public class CProjectDescriptionManager {
|
||||||
mngr.beginRule(rule, monitor);
|
mngr.beginRule(rule, monitor);
|
||||||
scheduleRule = false;
|
scheduleRule = false;
|
||||||
|
|
||||||
runAtomic(runnable);
|
runAtomic(runnable, monitor);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
} finally {
|
} finally {
|
||||||
|
monitor.done();
|
||||||
mngr.endRule(rule);
|
mngr.endRule(rule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -619,10 +652,12 @@ public class CProjectDescriptionManager {
|
||||||
Job job = new Job(SettingsModelMessages.getString("CProjectDescriptionManager.12")){ //$NON-NLS-1$
|
Job job = new Job(SettingsModelMessages.getString("CProjectDescriptionManager.12")){ //$NON-NLS-1$
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
try {
|
try {
|
||||||
runAtomic(runnable);
|
runAtomic(runnable, monitor);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
return e.getStatus();
|
return e.getStatus();
|
||||||
|
} finally {
|
||||||
|
monitor.done();
|
||||||
}
|
}
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
|
@ -636,33 +671,76 @@ public class CProjectDescriptionManager {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runAtomic(final ISafeRunnable r) throws CoreException{
|
private void runAtomic(final IWorkspaceRunnable r, IProgressMonitor monitor) throws CoreException{
|
||||||
IWorkspace wsp = ResourcesPlugin.getWorkspace();
|
IWorkspace wsp = ResourcesPlugin.getWorkspace();
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
wsp.run(new IWorkspaceRunnable(){
|
wsp.run(new IWorkspaceRunnable(){
|
||||||
|
|
||||||
public void run(IProgressMonitor monitor) throws CoreException {
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
try {
|
try {
|
||||||
r.run();
|
r.run(monitor);
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, e.getMessage(), e));
|
CCorePlugin.log(e);
|
||||||
|
// throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, e.getMessage(), e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}, wsp.getRoot(), IWorkspace.AVOID_UPDATE, new NullProgressMonitor());
|
}, wsp.getRoot(), IWorkspace.AVOID_UPDATE, monitor);
|
||||||
} catch (CoreException e){
|
// } catch (CoreException e){
|
||||||
IStatus status = e.getStatus();
|
// IStatus status = e.getStatus();
|
||||||
if(CCorePlugin.PLUGIN_ID.equals(status.getPlugin())){
|
// if(!CCorePlugin.PLUGIN_ID.equals(status.getPlugin())){
|
||||||
Throwable t = status.getException();
|
// throw e;
|
||||||
if(t instanceof Exception){
|
// }
|
||||||
r.handleException((Exception)t);
|
//// Throwable t = status.getException();
|
||||||
return;
|
//// if(t instanceof Exception){
|
||||||
}
|
//// r.handleException((Exception)t);
|
||||||
}
|
//// return;
|
||||||
|
//// }
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// throw e;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
throw e;
|
public void updateProjectDescriptions(IProgressMonitor monitor) throws CoreException{
|
||||||
|
IWorkspace wsp = ResourcesPlugin.getWorkspace();
|
||||||
|
final IProject projects[] = wsp.getRoot().getProjects();
|
||||||
|
final ICProjectDescription dess[] = new ICProjectDescription[projects.length];
|
||||||
|
int num = 0;
|
||||||
|
for(int i = 0; i < projects.length; i++){
|
||||||
|
ICProjectDescription des = getProjectDescription(projects[i], false, true);
|
||||||
|
if(des != null)
|
||||||
|
dess[num++] = des;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(num != 0){
|
||||||
|
final int[] fi = new int[num];
|
||||||
|
runWspModification(new IWorkspaceRunnable(){
|
||||||
|
|
||||||
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
|
monitor.beginTask("Refreshing the project settings", fi[0]);
|
||||||
|
|
||||||
|
for(int i = 0; i < dess.length; i++){
|
||||||
|
ICProjectDescription des = dess[i];
|
||||||
|
if(des == null)
|
||||||
|
break;
|
||||||
|
IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
|
||||||
|
try {
|
||||||
|
setProjectDescription(des.getProject(), des, true, subMonitor);
|
||||||
|
} catch (CoreException e){
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
} finally {
|
||||||
|
subMonitor.done();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, new NullProgressMonitor());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
monitor.done();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICProjectConverter getConverter(IProject project, String oldOwnerId, ICProjectDescription des){
|
private ICProjectConverter getConverter(IProject project, String oldOwnerId, ICProjectDescription des){
|
||||||
|
@ -924,9 +1002,12 @@ public class CProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setProjectDescription(IProject project, ICProjectDescription des) throws CoreException {
|
public void setProjectDescription(IProject project, ICProjectDescription des) throws CoreException {
|
||||||
if(!des.isModified())
|
setProjectDescription(project, des, false, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProjectDescription(IProject project, ICProjectDescription des, boolean force, IProgressMonitor monitor) throws CoreException {
|
||||||
|
if(!force && !des.isModified())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(((CProjectDescription)des).isLoadding()){
|
if(((CProjectDescription)des).isLoadding()){
|
||||||
|
@ -941,11 +1022,14 @@ public class CProjectDescriptionManager {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(monitor == null)
|
||||||
|
monitor = new NullProgressMonitor();
|
||||||
|
|
||||||
CModelManager manager = CModelManager.getDefault();
|
CModelManager manager = CModelManager.getDefault();
|
||||||
ICProject cproject = manager.create(project);
|
ICProject cproject = manager.create(project);
|
||||||
|
|
||||||
SetCProjectDescriptionOperation op = new SetCProjectDescriptionOperation(cproject, (CProjectDescription)des);
|
SetCProjectDescriptionOperation op = new SetCProjectDescriptionOperation(cproject, (CProjectDescription)des);
|
||||||
op.runOperation(new NullProgressMonitor());
|
op.runOperation(monitor);
|
||||||
|
|
||||||
|
|
||||||
// CProjectDescription newDes = new CProjectDescription((CProjectDescription)des, true);
|
// CProjectDescription newDes = new CProjectDescription((CProjectDescription)des, true);
|
||||||
|
@ -970,10 +1054,10 @@ public class CProjectDescriptionManager {
|
||||||
// serialize(newDes);
|
// serialize(newDes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ISafeRunnable createDesSerializationRunnable(CProjectDescription des) throws CoreException{
|
private IWorkspaceRunnable createDesSerializationRunnable(CProjectDescription des) throws CoreException{
|
||||||
final ICStorageElement element = des.getRootStorageElement();
|
final ICStorageElement element = des.getRootStorageElement();
|
||||||
|
|
||||||
ISafeRunnable r = new DesSerializationRunnable(des, element);
|
IWorkspaceRunnable r = new DesSerializationRunnable(des, element);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1037,7 +1121,7 @@ public class CProjectDescriptionManager {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
void serialize(final CProjectDescription des) throws CoreException{
|
void serialize(final CProjectDescription des) throws CoreException{
|
||||||
ISafeRunnable r = createDesSerializationRunnable(des);
|
IWorkspaceRunnable r = createDesSerializationRunnable(des);
|
||||||
runWspModification(r, new NullProgressMonitor());
|
runWspModification(r, new NullProgressMonitor());
|
||||||
|
|
||||||
// IWorkspace wsp = ResourcesPlugin.getWorkspace();
|
// IWorkspace wsp = ResourcesPlugin.getWorkspace();
|
||||||
|
@ -1339,24 +1423,36 @@ public class CProjectDescriptionManager {
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
CConfigurationData loadData(ICConfigurationDescription des) throws CoreException{
|
CConfigurationData loadData(ICConfigurationDescription des, IProgressMonitor monitor) throws CoreException{
|
||||||
|
if(monitor == null)
|
||||||
|
monitor = new NullProgressMonitor();
|
||||||
|
|
||||||
CConfigurationDataProvider provider = getProvider(des);
|
CConfigurationDataProvider provider = getProvider(des);
|
||||||
return provider.loadConfiguration(des);
|
return provider.loadConfiguration(des, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
CConfigurationData applyData(ICConfigurationDescription des, ICConfigurationDescription baseDescription, CConfigurationData base) throws CoreException {
|
CConfigurationData applyData(ICConfigurationDescription des, ICConfigurationDescription baseDescription, CConfigurationData base, IProgressMonitor monitor) throws CoreException {
|
||||||
|
if(monitor == null)
|
||||||
|
monitor = new NullProgressMonitor();
|
||||||
|
|
||||||
CConfigurationDataProvider provider = getProvider(des);
|
CConfigurationDataProvider provider = getProvider(des);
|
||||||
return provider.applyConfiguration(des, baseDescription, base);
|
return provider.applyConfiguration(des, baseDescription, base, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeData(ICConfigurationDescription des, CConfigurationData data) throws CoreException{
|
void removeData(ICConfigurationDescription des, CConfigurationData data, IProgressMonitor monitor) throws CoreException{
|
||||||
|
if(monitor == null)
|
||||||
|
monitor = new NullProgressMonitor();
|
||||||
|
|
||||||
CConfigurationDataProvider provider = getProvider(des);
|
CConfigurationDataProvider provider = getProvider(des);
|
||||||
provider.removeConfiguration(des, data);
|
provider.removeConfiguration(des, data, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
CConfigurationData createData(ICConfigurationDescription des, ICConfigurationDescription baseDescription, CConfigurationData base, boolean clone) throws CoreException{
|
CConfigurationData createData(ICConfigurationDescription des, ICConfigurationDescription baseDescription, CConfigurationData base, boolean clone, IProgressMonitor monitor) throws CoreException{
|
||||||
|
if(monitor == null)
|
||||||
|
monitor = new NullProgressMonitor();
|
||||||
|
|
||||||
CConfigurationDataProvider provider = getProvider(des);
|
CConfigurationDataProvider provider = getProvider(des);
|
||||||
return provider.createConfiguration(des, baseDescription, base, clone);
|
return provider.createConfiguration(des, baseDescription, base, clone, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CConfigurationDataProvider getProvider(ICConfigurationDescription des) throws CoreException{
|
private CConfigurationDataProvider getProvider(ICConfigurationDescription des) throws CoreException{
|
||||||
|
@ -1620,14 +1716,14 @@ public class CProjectDescriptionManager {
|
||||||
} catch (CoreException e){
|
} catch (CoreException e){
|
||||||
//try refreshing
|
//try refreshing
|
||||||
final Throwable[] t = new Throwable[1];
|
final Throwable[] t = new Throwable[1];
|
||||||
Job job = runWspModification(new ISafeRunnable(){
|
Job job = runWspModification(new IWorkspaceRunnable(){
|
||||||
|
|
||||||
public void handleException(Throwable exception) {
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
t[0] = exception;
|
try {
|
||||||
}
|
rscFile.refreshLocal(IResource.DEPTH_ZERO, null);
|
||||||
|
} catch (Exception e){
|
||||||
public void run() throws Exception {
|
t[0] = e;
|
||||||
rscFile.refreshLocal(IResource.DEPTH_ZERO, null);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}, null);
|
}, null);
|
||||||
|
@ -2565,7 +2661,7 @@ public class CProjectDescriptionManager {
|
||||||
CConfigurationDescriptionCache des = (CConfigurationDescriptionCache)cfgDeltas[i].getOldSetting();
|
CConfigurationDescriptionCache des = (CConfigurationDescriptionCache)cfgDeltas[i].getOldSetting();
|
||||||
CConfigurationData data = des.getConfigurationData();
|
CConfigurationData data = des.getConfigurationData();
|
||||||
try {
|
try {
|
||||||
removeData(des, data);
|
removeData(des, data, null);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationDataProvider;
|
import org.eclipse.cdt.core.settings.model.extension.CConfigurationDataProvider;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultConfigurationData;
|
import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultConfigurationData;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
public class DefaultConfigurationDataProvider extends
|
public class DefaultConfigurationDataProvider extends
|
||||||
CConfigurationDataProvider {
|
CConfigurationDataProvider {
|
||||||
|
@ -22,7 +23,8 @@ public class DefaultConfigurationDataProvider extends
|
||||||
public CConfigurationData applyConfiguration(
|
public CConfigurationData applyConfiguration(
|
||||||
ICConfigurationDescription des,
|
ICConfigurationDescription des,
|
||||||
ICConfigurationDescription baseDescription,
|
ICConfigurationDescription baseDescription,
|
||||||
CConfigurationData base)
|
CConfigurationData base,
|
||||||
|
IProgressMonitor monitor)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
//TODO: implement load/store
|
//TODO: implement load/store
|
||||||
return base;
|
return base;
|
||||||
|
@ -32,13 +34,15 @@ public class DefaultConfigurationDataProvider extends
|
||||||
ICConfigurationDescription des,
|
ICConfigurationDescription des,
|
||||||
ICConfigurationDescription baseDescription,
|
ICConfigurationDescription baseDescription,
|
||||||
CConfigurationData base,
|
CConfigurationData base,
|
||||||
boolean clone) throws CoreException {
|
boolean clone,
|
||||||
|
IProgressMonitor monitor) throws CoreException {
|
||||||
//TODO: implement load/store
|
//TODO: implement load/store
|
||||||
CDefaultConfigurationData data = new CDefaultConfigurationData(des.getId(), des.getName(), base, null, clone);
|
CDefaultConfigurationData data = new CDefaultConfigurationData(des.getId(), des.getName(), base, null, clone);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CConfigurationData loadConfiguration(ICConfigurationDescription des)
|
public CConfigurationData loadConfiguration(ICConfigurationDescription des,
|
||||||
|
IProgressMonitor monitor)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
//TODO: implement load/store
|
//TODO: implement load/store
|
||||||
CDefaultConfigurationData data = new CDefaultConfigurationData(des.getId(), des.getName(), null);
|
CDefaultConfigurationData data = new CDefaultConfigurationData(des.getId(), des.getName(), null);
|
||||||
|
@ -47,7 +51,8 @@ public class DefaultConfigurationDataProvider extends
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeConfiguration(ICConfigurationDescription des,
|
public void removeConfiguration(ICConfigurationDescription des,
|
||||||
CConfigurationData data) {
|
CConfigurationData data,
|
||||||
|
IProgressMonitor monitor) {
|
||||||
//TODO: implement load/store
|
//TODO: implement load/store
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ import org.eclipse.cdt.internal.core.model.PathEntryManager;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
public class PathEntryConfigurationDataProvider extends
|
public class PathEntryConfigurationDataProvider extends
|
||||||
|
@ -222,7 +223,8 @@ public class PathEntryConfigurationDataProvider extends
|
||||||
public CConfigurationData applyConfiguration(
|
public CConfigurationData applyConfiguration(
|
||||||
ICConfigurationDescription des,
|
ICConfigurationDescription des,
|
||||||
ICConfigurationDescription baseDescription,
|
ICConfigurationDescription baseDescription,
|
||||||
CConfigurationData base)
|
CConfigurationData base,
|
||||||
|
IProgressMonitor monitor)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
//TODO: check external/reference info here as well.
|
//TODO: check external/reference info here as well.
|
||||||
if(!fFactory.isModified(base))
|
if(!fFactory.isModified(base))
|
||||||
|
@ -254,7 +256,8 @@ public class PathEntryConfigurationDataProvider extends
|
||||||
ICConfigurationDescription des,
|
ICConfigurationDescription des,
|
||||||
ICConfigurationDescription baseDescription,
|
ICConfigurationDescription baseDescription,
|
||||||
CConfigurationData base,
|
CConfigurationData base,
|
||||||
boolean clone) throws CoreException {
|
boolean clone,
|
||||||
|
IProgressMonitor monitor) throws CoreException {
|
||||||
CfgData copy = new CfgData(des.getId(), des.getName(), base, clone);
|
CfgData copy = new CfgData(des.getId(), des.getName(), base, clone);
|
||||||
copy.setModified(false);
|
copy.setModified(false);
|
||||||
return copy;
|
return copy;
|
||||||
|
@ -318,13 +321,15 @@ public class PathEntryConfigurationDataProvider extends
|
||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CConfigurationData loadConfiguration(ICConfigurationDescription des)
|
public CConfigurationData loadConfiguration(ICConfigurationDescription des,
|
||||||
|
IProgressMonitor monitor)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
return createData(des);
|
return createData(des);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeConfiguration(ICConfigurationDescription des,
|
public void removeConfiguration(ICConfigurationDescription des,
|
||||||
CConfigurationData data) {
|
CConfigurationData data,
|
||||||
|
IProgressMonitor monitor) {
|
||||||
//do nothing for now
|
//do nothing for now
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,10 @@ import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IResourceChangeEvent;
|
import org.eclipse.core.resources.IResourceChangeEvent;
|
||||||
import org.eclipse.core.resources.ISaveContext;
|
import org.eclipse.core.resources.ISaveContext;
|
||||||
import org.eclipse.core.resources.ISaveParticipant;
|
import org.eclipse.core.resources.ISaveParticipant;
|
||||||
|
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.ISafeRunnable;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
public class ResourceChangeHandler extends ResourceChangeHandlerBase implements ISaveParticipant {
|
public class ResourceChangeHandler extends ResourceChangeHandlerBase implements ISaveParticipant {
|
||||||
|
@ -153,13 +154,9 @@ public class ResourceChangeHandler extends ResourceChangeHandlerBase implements
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fProjDesMap.size() != 0){
|
if(fProjDesMap.size() != 0){
|
||||||
fMngr.runWspModification(new ISafeRunnable(){
|
fMngr.runWspModification(new IWorkspaceRunnable(){
|
||||||
|
|
||||||
public void handleException(Throwable exception) {
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
CCorePlugin.log(exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run() throws Exception {
|
|
||||||
for(Iterator iter = fProjDesMap.entrySet().iterator(); iter.hasNext();){
|
for(Iterator iter = fProjDesMap.entrySet().iterator(); iter.hasNext();){
|
||||||
Map.Entry entry = (Map.Entry)iter.next();
|
Map.Entry entry = (Map.Entry)iter.next();
|
||||||
IProject project = (IProject)entry.getKey();
|
IProject project = (IProject)entry.getKey();
|
||||||
|
|
|
@ -1179,6 +1179,10 @@ public class CCorePlugin extends Plugin {
|
||||||
fNewCProjectDescriptionManager.setProjectDescription(project, des);
|
fNewCProjectDescriptionManager.setProjectDescription(project, des);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setProjectDescription(IProject project, ICProjectDescription des, boolean force, IProgressMonitor monitor) throws CoreException {
|
||||||
|
fNewCProjectDescriptionManager.setProjectDescription(project, des, force, monitor);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the project description associated with this project
|
* returns the project description associated with this project
|
||||||
*
|
*
|
||||||
|
|
|
@ -141,13 +141,13 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
|
|
||||||
ICdtVariable macro = macros.createMacro(macroName,type,value);
|
ICdtVariable macro = macros.createMacro(macroName,type,value);
|
||||||
if(macros.isChanged()){
|
if(macros.isChanged()){
|
||||||
setRebuildStateForContext(contextType, contextData);
|
|
||||||
macros.setChanged(false);
|
macros.setChanged(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(macro != null){
|
if(macro != null){
|
||||||
VariableChangeEvent event = createVariableChangeEvent(macro, oldVar);
|
VariableChangeEvent event = createVariableChangeEvent(macro, oldVar);
|
||||||
if(event != null){
|
if(event != null){
|
||||||
|
// updateProjectInfo(contextType, contextData);
|
||||||
notifyListeners(event);
|
notifyListeners(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,13 +171,13 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
|
|
||||||
ICdtVariable macro = macros.createMacro(macroName,type,value);
|
ICdtVariable macro = macros.createMacro(macroName,type,value);
|
||||||
if(macros.isChanged()){
|
if(macros.isChanged()){
|
||||||
setRebuildStateForContext(contextType, contextData);
|
|
||||||
macros.setChanged(false);
|
macros.setChanged(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(macro != null){
|
if(macro != null){
|
||||||
VariableChangeEvent event = createVariableChangeEvent(macro, oldVar);
|
VariableChangeEvent event = createVariableChangeEvent(macro, oldVar);
|
||||||
if(event != null){
|
if(event != null){
|
||||||
|
// updateProjectInfo(contextType, contextData);
|
||||||
notifyListeners(event);
|
notifyListeners(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,13 +200,13 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
|
|
||||||
ICdtVariable macro = macros.createMacro(copy);
|
ICdtVariable macro = macros.createMacro(copy);
|
||||||
if(macros.isChanged()){
|
if(macros.isChanged()){
|
||||||
setRebuildStateForContext(contextType, contextData);
|
|
||||||
macros.setChanged(false);
|
macros.setChanged(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(macro != null){
|
if(macro != null){
|
||||||
VariableChangeEvent event = createVariableChangeEvent(macro, oldVar);
|
VariableChangeEvent event = createVariableChangeEvent(macro, oldVar);
|
||||||
if(event != null){
|
if(event != null){
|
||||||
|
// updateProjectInfo(contextType, contextData);
|
||||||
notifyListeners(event);
|
notifyListeners(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,10 +219,10 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
return null;
|
return null;
|
||||||
ICdtVariable macro = macros.deleteMacro(name);
|
ICdtVariable macro = macros.deleteMacro(name);
|
||||||
if(macro != null){
|
if(macro != null){
|
||||||
setRebuildStateForContext(contextType, contextData);
|
|
||||||
|
|
||||||
VariableChangeEvent event = createVariableChangeEvent(null, macro);
|
VariableChangeEvent event = createVariableChangeEvent(null, macro);
|
||||||
if(event != null){
|
if(event != null){
|
||||||
|
// updateProjectInfo(contextType, contextData);
|
||||||
notifyListeners(event);
|
notifyListeners(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,11 +238,13 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
|
|
||||||
ICdtVariable[] oldVars = macros.getMacros();
|
ICdtVariable[] oldVars = macros.getMacros();
|
||||||
|
|
||||||
if(macros.deleteAll())
|
if(macros.deleteAll()){
|
||||||
setRebuildStateForContext(contextType, contextData);
|
// setRebuildStateForContext(contextType, contextData);
|
||||||
|
}
|
||||||
|
|
||||||
VariableChangeEvent event = createVariableChangeEvent(null, oldVars);
|
VariableChangeEvent event = createVariableChangeEvent(null, oldVars);
|
||||||
if(event != null){
|
if(event != null){
|
||||||
|
// updateProjectInfo(contextType, contextData);
|
||||||
notifyListeners(event);
|
notifyListeners(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,11 +259,11 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
|
|
||||||
macros.setMacros(m);
|
macros.setMacros(m);
|
||||||
if(macros.isChanged()){
|
if(macros.isChanged()){
|
||||||
setRebuildStateForContext(contextType, contextData);
|
|
||||||
macros.setChanged(false);
|
macros.setChanged(false);
|
||||||
|
|
||||||
VariableChangeEvent event = createVariableChangeEvent(m, oldVars);
|
VariableChangeEvent event = createVariableChangeEvent(m, oldVars);
|
||||||
if(event != null){
|
if(event != null){
|
||||||
|
// updateProjectInfo(contextType, contextData);
|
||||||
notifyListeners(event);
|
notifyListeners(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,7 +452,7 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
return new StorableCdtVariables(vars, false);
|
return new StorableCdtVariables(vars, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWorkspaceVariables(StorableCdtVariables vars) throws CoreException{
|
public boolean setWorkspaceVariables(StorableCdtVariables vars) throws CoreException{
|
||||||
StorableCdtVariables old = getStorableMacros(ICoreVariableContextInfo.CONTEXT_WORKSPACE, null);
|
StorableCdtVariables old = getStorableMacros(ICoreVariableContextInfo.CONTEXT_WORKSPACE, null);
|
||||||
ICdtVariable[] oldVars = null;
|
ICdtVariable[] oldVars = null;
|
||||||
if(old != null)
|
if(old != null)
|
||||||
|
@ -462,10 +464,12 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
|
|
||||||
VariableChangeEvent event = createVariableChangeEvent(newVars, oldVars);
|
VariableChangeEvent event = createVariableChangeEvent(newVars, oldVars);
|
||||||
if(event != null){
|
if(event != null){
|
||||||
|
// updateProjectInfo(ICoreVariableContextInfo.CONTEXT_WORKSPACE, null);
|
||||||
notifyListeners(event);
|
notifyListeners(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
storeWorkspaceVariables(true);
|
storeWorkspaceVariables(true);
|
||||||
|
return event != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Preferences getWorkspaceNode(){
|
private Preferences getWorkspaceNode(){
|
||||||
|
@ -636,33 +640,8 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setRebuildStateForContext(int contextType, Object contextData){
|
// protected void updateProjectInfo(int type, Object context){
|
||||||
/*
|
// }
|
||||||
switch(contextType){
|
|
||||||
case DefaultMacroContextInfo.CONTEXT_CONFIGURATION:
|
|
||||||
if(contextData instanceof IConfiguration){
|
|
||||||
((IConfiguration)contextData).setRebuildState(true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case DefaultMacroContextInfo.CONTEXT_WORKSPACE:
|
|
||||||
if(contextData instanceof IWorkspace){
|
|
||||||
IProject projects[] = ((IWorkspace)contextData).getRoot().getProjects();
|
|
||||||
for(int i = 0; i < projects.length; i++){
|
|
||||||
if(ManagedBuildManager.manages(projects[i])){
|
|
||||||
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(projects[i]);
|
|
||||||
if(info != null){
|
|
||||||
IConfiguration cfgs[] = info.getManagedProject().getConfigurations();
|
|
||||||
for(int j = 0; j < cfgs.length; j++){
|
|
||||||
cfgs[j].setRebuildState(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addListener(ICdtVariableChangeListener listener){
|
public void addListener(ICdtVariableChangeListener listener){
|
||||||
fListeners.add(listener);
|
fListeners.add(listener);
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2005, 2007 Intel Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Intel Corporation - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.core.envvar;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
||||||
|
|
||||||
|
public class EnvironmentChangeEvent {
|
||||||
|
private static final IEnvironmentVariable[] EMPTY_VAR_ARRAY = new IEnvironmentVariable[0];
|
||||||
|
|
||||||
|
private IEnvironmentVariable[] fAddedVars, fRemovedVars, fChangedVars;
|
||||||
|
|
||||||
|
EnvironmentChangeEvent(IEnvironmentVariable[] addedVars, IEnvironmentVariable[] removedVars, IEnvironmentVariable[] changedVars){
|
||||||
|
fAddedVars = addedVars != null ? (IEnvironmentVariable[])addedVars.clone() : null;
|
||||||
|
fRemovedVars = removedVars != null ? (IEnvironmentVariable[])removedVars.clone() : null;
|
||||||
|
fChangedVars = changedVars != null ? (IEnvironmentVariable[])changedVars.clone() : null;
|
||||||
|
}
|
||||||
|
public IEnvironmentVariable[] getAddedVariables(){
|
||||||
|
return fAddedVars != null ? (IEnvironmentVariable[])fAddedVars.clone() : EMPTY_VAR_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnvironmentVariable[] getRemovedVariables(){
|
||||||
|
return fRemovedVars != null ? (IEnvironmentVariable[])fRemovedVars.clone() : EMPTY_VAR_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnvironmentVariable[] getChangedVariables(){
|
||||||
|
return fChangedVars != null ? (IEnvironmentVariable[])fChangedVars.clone() : EMPTY_VAR_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -10,10 +10,15 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.envvar;
|
package org.eclipse.cdt.internal.core.envvar;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.CConfigurationSpecSettings;
|
import org.eclipse.cdt.internal.core.settings.model.CConfigurationSpecSettings;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.IInternalCCfgInfo;
|
import org.eclipse.cdt.internal.core.settings.model.IInternalCCfgInfo;
|
||||||
import org.eclipse.cdt.utils.envvar.EnvVarOperationProcessor;
|
import org.eclipse.cdt.utils.envvar.EnvVarOperationProcessor;
|
||||||
|
@ -51,6 +56,81 @@ public class UserDefinedEnvironmentSupplier extends
|
||||||
*/
|
*/
|
||||||
private StorableEnvironment fWorkspaceVariables;
|
private StorableEnvironment fWorkspaceVariables;
|
||||||
|
|
||||||
|
|
||||||
|
static class VarKey {
|
||||||
|
private IEnvironmentVariable fVar;
|
||||||
|
private boolean fNameOnly;
|
||||||
|
private int fCode;
|
||||||
|
|
||||||
|
VarKey(IEnvironmentVariable var, boolean nameOnly){
|
||||||
|
fVar = var;
|
||||||
|
fNameOnly = nameOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnvironmentVariable getVariable(){
|
||||||
|
return fVar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if(obj == this)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if(!(obj instanceof VarKey))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
VarKey other = (VarKey)obj;
|
||||||
|
|
||||||
|
IEnvironmentVariable otherVar = other.fVar;
|
||||||
|
|
||||||
|
if(fVar == otherVar)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if(!CDataUtil.objectsEqual(fVar.getName(), otherVar.getName()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(fNameOnly)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if(fVar.getOperation() != otherVar.getOperation())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(!CDataUtil.objectsEqual(fVar.getValue(), otherVar.getValue()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(!CDataUtil.objectsEqual(fVar.getDelimiter(),otherVar.getDelimiter()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hashCode() {
|
||||||
|
int code = fCode;
|
||||||
|
if(code == 0){
|
||||||
|
code = 47;
|
||||||
|
|
||||||
|
String tmp = fVar.getName();
|
||||||
|
if(tmp != null)
|
||||||
|
code += tmp.hashCode();
|
||||||
|
|
||||||
|
if(fNameOnly)
|
||||||
|
return code;
|
||||||
|
|
||||||
|
code += fVar.getOperation();
|
||||||
|
|
||||||
|
tmp = fVar.getValue();
|
||||||
|
if(tmp != null)
|
||||||
|
code += tmp.hashCode();
|
||||||
|
|
||||||
|
tmp = fVar.getDelimiter();
|
||||||
|
if(tmp != null)
|
||||||
|
code += tmp.hashCode();
|
||||||
|
|
||||||
|
fCode = code;
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
protected StorableEnvironment getEnvironment(Object context){
|
protected StorableEnvironment getEnvironment(Object context){
|
||||||
return getEnvironment(context,true);
|
return getEnvironment(context,true);
|
||||||
}
|
}
|
||||||
|
@ -183,12 +263,86 @@ public class UserDefinedEnvironmentSupplier extends
|
||||||
return new StorableEnvironment(envVar, false);
|
return new StorableEnvironment(envVar, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWorkspaceEnvironment(StorableEnvironment env){
|
public boolean setWorkspaceEnvironment(StorableEnvironment env){
|
||||||
|
StorableEnvironment oldEnv = getEnvironment(null);
|
||||||
|
|
||||||
fWorkspaceVariables = new StorableEnvironment(env, false);
|
fWorkspaceVariables = new StorableEnvironment(env, false);
|
||||||
|
|
||||||
|
EnvironmentChangeEvent event = createEnvironmentChangeEvent(fWorkspaceVariables.getVariables(), oldEnv.getVariables());
|
||||||
|
|
||||||
storeWorkspaceEnvironment(true);
|
storeWorkspaceEnvironment(true);
|
||||||
|
|
||||||
|
// updateProjectInfo(null);
|
||||||
|
|
||||||
|
return event != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static EnvironmentChangeEvent createEnvironmentChangeEvent(IEnvironmentVariable[] newVars, IEnvironmentVariable[] oldVars){
|
||||||
|
IEnvironmentVariable[] addedVars = null, removedVars = null, changedVars = null;
|
||||||
|
|
||||||
|
if(oldVars == null || oldVars.length == 0){
|
||||||
|
if(newVars != null && newVars.length != 0)
|
||||||
|
addedVars = (IEnvironmentVariable[])newVars.clone() ;
|
||||||
|
} else if(newVars == null || newVars.length == 0){
|
||||||
|
removedVars = (IEnvironmentVariable[])oldVars.clone();
|
||||||
|
} else {
|
||||||
|
HashSet newSet = new HashSet(newVars.length);
|
||||||
|
HashSet oldSet = new HashSet(oldVars.length);
|
||||||
|
|
||||||
|
for(int i = 0; i < newVars.length; i++){
|
||||||
|
newSet.add(new VarKey(newVars[i], true));
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < oldVars.length; i++){
|
||||||
|
oldSet.add(new VarKey(oldVars[i], true));
|
||||||
|
}
|
||||||
|
|
||||||
|
HashSet newSetCopy = (HashSet)newSet.clone();
|
||||||
|
|
||||||
|
newSet.removeAll(oldSet);
|
||||||
|
oldSet.removeAll(newSetCopy);
|
||||||
|
|
||||||
|
if(newSet.size() != 0){
|
||||||
|
addedVars = varsFromKeySet(newSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(oldSet.size() != 0){
|
||||||
|
removedVars = varsFromKeySet(oldSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
newSetCopy.removeAll(newSet);
|
||||||
|
|
||||||
|
HashSet modifiedSet = new HashSet(newSetCopy.size());
|
||||||
|
for(Iterator iter = newSetCopy.iterator(); iter.hasNext();){
|
||||||
|
VarKey key = (VarKey)iter.next();
|
||||||
|
modifiedSet.add(new VarKey(key.getVariable(), false));
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < oldVars.length; i++){
|
||||||
|
modifiedSet.remove(new VarKey(oldVars[i], false));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(modifiedSet.size() != 0)
|
||||||
|
changedVars = varsFromKeySet(modifiedSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(addedVars != null || removedVars != null || changedVars != null)
|
||||||
|
return new EnvironmentChangeEvent(addedVars, removedVars, changedVars);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static IEnvironmentVariable[] varsFromKeySet(Set set){
|
||||||
|
IEnvironmentVariable vars[] = new IEnvironmentVariable[set.size()];
|
||||||
|
int i = 0;
|
||||||
|
for(Iterator iter = set.iterator(); iter.hasNext(); i++){
|
||||||
|
VarKey key = (VarKey)iter.next();
|
||||||
|
vars[i] = key.getVariable();
|
||||||
|
}
|
||||||
|
|
||||||
|
return vars;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void storeProjectEnvironment(ICProjectDescription des, boolean force){
|
public void storeProjectEnvironment(ICProjectDescription des, boolean force){
|
||||||
ICConfigurationDescription cfgs[] = des.getConfigurations();
|
ICConfigurationDescription cfgs[] = des.getConfigurations();
|
||||||
for(int i = 0; i < cfgs.length; i++){
|
for(int i = 0; i < cfgs.length; i++){
|
||||||
|
@ -242,7 +396,7 @@ public class UserDefinedEnvironmentSupplier extends
|
||||||
return null;
|
return null;
|
||||||
IEnvironmentVariable var = env.createVariable(name,value,op,delimiter);
|
IEnvironmentVariable var = env.createVariable(name,value,op,delimiter);
|
||||||
if(env.isChanged()){
|
if(env.isChanged()){
|
||||||
setRebuildStateForContext(context);
|
// updateProjectInfo(context);
|
||||||
env.setChanged(false);
|
env.setChanged(false);
|
||||||
}
|
}
|
||||||
return var;
|
return var;
|
||||||
|
@ -253,8 +407,9 @@ public class UserDefinedEnvironmentSupplier extends
|
||||||
if(env == null)
|
if(env == null)
|
||||||
return null;
|
return null;
|
||||||
IEnvironmentVariable var = env.deleteVariable(name);
|
IEnvironmentVariable var = env.deleteVariable(name);
|
||||||
if(var != null)
|
if(var != null){
|
||||||
setRebuildStateForContext(context);
|
// updateProjectInfo(context);
|
||||||
|
}
|
||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,8 +418,9 @@ public class UserDefinedEnvironmentSupplier extends
|
||||||
if(env == null)
|
if(env == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(env.deleteAll())
|
if(env.deleteAll()){
|
||||||
setRebuildStateForContext(context);
|
// updateProjectInfo(context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVariables(IEnvironmentVariable vars[], Object context){
|
public void setVariables(IEnvironmentVariable vars[], Object context){
|
||||||
|
@ -274,35 +430,13 @@ public class UserDefinedEnvironmentSupplier extends
|
||||||
|
|
||||||
env.setVariales(vars);
|
env.setVariales(vars);
|
||||||
if(env.isChanged()){
|
if(env.isChanged()){
|
||||||
setRebuildStateForContext(context);
|
// updateProjectInfo(context);
|
||||||
env.setChanged(false);
|
env.setChanged(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setRebuildStateForContext(Object context){
|
// protected void updateProjectInfo(Object context){
|
||||||
/* if(context == null)
|
// }
|
||||||
return;
|
|
||||||
if(context instanceof ICConfigurationDescription){
|
|
||||||
cfgVarsModified((ICConfigurationDescription)context);
|
|
||||||
} else if(context == null || context instanceof IWorkspace){
|
|
||||||
CoreModel model = CoreModel.getDefault();
|
|
||||||
IProject projects[] = ((IWorkspace)context).getRoot().getProjects();
|
|
||||||
for(int i = 0; i < projects.length; i++){
|
|
||||||
ICProjectDescription des = model.getProjectDescription(projects[i]);
|
|
||||||
|
|
||||||
// if(ManagedBuildManager.manages(projects[i])){
|
|
||||||
// IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(projects[i]);
|
|
||||||
if(des != null){
|
|
||||||
ICConfigurationDescription cfgs[] = des.getConfigurations();
|
|
||||||
for(int j = 0; j < cfgs.length; j++){
|
|
||||||
cfgVarsModified(cfgs[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
// protected void cfgVarsModified(ICConfigurationDescription cfg){
|
// protected void cfgVarsModified(ICConfigurationDescription cfg){
|
||||||
// cfg.setRebuildState(true);
|
// cfg.setRebuildState(true);
|
||||||
|
|
Loading…
Add table
Reference in a new issue