mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 14:55:41 +02:00
SCD profiles: integration with CPathEntry framework.
Added generation of path entry change deltas for per file discovery profile.
This commit is contained in:
parent
5e2403f3f3
commit
d6508107f7
6 changed files with 47 additions and 28 deletions
|
@ -9,9 +9,9 @@
|
|||
package org.eclipse.cdt.make.core.scannerconfig;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
@ -84,14 +84,8 @@ public interface IDiscoveredPathManager {
|
|||
|
||||
IDiscoveredPathInfo getDiscoveredInfo(IProject project) throws CoreException;
|
||||
void removeDiscoveredInfo(IProject project);
|
||||
void updateDiscoveredInfo(IDiscoveredPathInfo info) throws CoreException;
|
||||
/**
|
||||
* @param project
|
||||
* @param profileScope
|
||||
* @throws CModelException
|
||||
* @throws CoreException
|
||||
*/
|
||||
void changeDiscoveredContainer(IProject project, ScannerConfigScope profileScope);
|
||||
void updateDiscoveredInfo(IDiscoveredPathInfo info, List changedResources) throws CoreException;
|
||||
void changeDiscoveredContainer(IProject project, ScannerConfigScope profileScope, List changedResources);
|
||||
|
||||
void addDiscoveredInfoListener(IDiscoveredInfoListener listener);
|
||||
void removeDiscoveredInfoListener(IDiscoveredInfoListener listener);
|
||||
|
|
|
@ -11,6 +11,7 @@ package org.eclipse.cdt.make.internal.core.scannerconfig;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -18,6 +19,7 @@ import org.eclipse.cdt.core.CCorePlugin;
|
|||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.PathEntryContainerChanged;
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
||||
|
@ -34,6 +36,7 @@ import org.eclipse.core.resources.IResourceChangeListener;
|
|||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.ISafeRunnable;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
@ -116,7 +119,10 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
}
|
||||
}
|
||||
|
||||
public void updateDiscoveredInfo(IDiscoveredPathInfo info) throws CoreException {
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager#updateDiscoveredInfo(org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo, java.util.List)
|
||||
*/
|
||||
public void updateDiscoveredInfo(IDiscoveredPathInfo info, List changedResources) throws CoreException {
|
||||
if (fDiscoveredMap.get(info.getProject()) != null) {
|
||||
IDiscoveredScannerInfoSerializable serializable = info.getSerializable();
|
||||
if (serializable != null) {
|
||||
|
@ -133,7 +139,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
String profileId = buildInfo.getSelectedProfileId();
|
||||
ScannerConfigScope profileScope = ScannerConfigProfileManager.getInstance().
|
||||
getSCProfileConfiguration(profileId).getProfileScope();
|
||||
changeDiscoveredContainer(project, profileScope);
|
||||
changeDiscoveredContainer(project, profileScope, changedResources);
|
||||
}
|
||||
else {
|
||||
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
|
||||
|
@ -145,7 +151,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager#changeDiscoveredContainer(org.eclipse.core.resources.IProject, java.lang.String)
|
||||
*/
|
||||
public void changeDiscoveredContainer(IProject project, ScannerConfigScope profileScope) {
|
||||
public void changeDiscoveredContainer(IProject project, ScannerConfigScope profileScope, List changedResources) {
|
||||
// order here is of essence
|
||||
// 1. clear DiscoveredPathManager's path info cache
|
||||
IDiscoveredPathInfo oldInfo = (IDiscoveredPathInfo) fDiscoveredMap.remove(project);
|
||||
|
@ -158,8 +164,19 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
new DiscoveredPathContainer(project), null);
|
||||
}
|
||||
else if (ScannerConfigScope.FILE_SCOPE.equals(profileScope)) {
|
||||
PerFileDiscoveredPathContainer container = new PerFileDiscoveredPathContainer(project);
|
||||
CoreModel.setPathEntryContainer(new ICProject[]{cProject},
|
||||
new PerFileDiscoveredPathContainer(project), null);
|
||||
container, null);
|
||||
if (changedResources != null) {
|
||||
List changeDelta = new ArrayList(changedResources.size());
|
||||
for (Iterator i = changedResources.iterator(); i.hasNext(); ) {
|
||||
IPath path = (IPath) i.next();
|
||||
changeDelta.add(new PathEntryContainerChanged(path, 3)); // both include paths and symbols changed
|
||||
}
|
||||
CoreModel.pathEntryContainerUpdates(container,
|
||||
(PathEntryContainerChanged[]) changeDelta.toArray(new PathEntryContainerChanged[changeDelta.size()]),
|
||||
null);
|
||||
}
|
||||
}
|
||||
else {
|
||||
MakeCorePlugin.log(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), 1,
|
||||
|
|
|
@ -289,8 +289,9 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
|
|||
if (change) {
|
||||
sid.fileToCommandIdMap.put(file, commandId);
|
||||
// TODO generate change event for this resource
|
||||
if (!siChangedForFileList.contains(file)) {
|
||||
siChangedForFileList.add(file);
|
||||
IPath path = file.getFullPath();
|
||||
if (!siChangedForFileList.contains(path)) {
|
||||
siChangedForFileList.add(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -341,18 +342,22 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
|
|||
monitor.beginTask(MakeMessages.getString("ScannerInfoCollector.Processing"), 100); //$NON-NLS-1$
|
||||
removeUnusedCommands();
|
||||
monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Processing")); //$NON-NLS-1$
|
||||
MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(project);
|
||||
if (!siChangedForFileList.isEmpty()) {
|
||||
// MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(project);
|
||||
// DiscoveredScannerInfoStore.getInstance().loadDiscoveredScannerInfoFromState(project, this);
|
||||
monitor.worked(50);
|
||||
monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Updating") + project.getName()); //$NON-NLS-1$
|
||||
try {
|
||||
// update scanner configuration
|
||||
MakeCorePlugin.getDefault().getDiscoveryManager().updateDiscoveredInfo(createPathInfoObject());
|
||||
// DiscoveredScannerInfoStore.getInstance().saveDiscoveredScannerInfoToState(project, this);
|
||||
MakeCorePlugin.getDefault().getDiscoveryManager().
|
||||
updateDiscoveredInfo(createPathInfoObject(), siChangedForFileList);
|
||||
// DiscoveredScannerInfoStore.getInstance().saveDiscoveredScannerInfoToState(project, this);
|
||||
monitor.worked(50);
|
||||
} catch (CoreException e) {
|
||||
MakeCorePlugin.log(e);
|
||||
}
|
||||
siChangedForFileList.clear();
|
||||
}
|
||||
monitor.done();
|
||||
}
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ public class PerProjectSICollector implements IScannerInfoCollector2, IScannerIn
|
|||
monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Updating") + project.getName()); //$NON-NLS-1$
|
||||
try {
|
||||
// update scanner configuration
|
||||
MakeCorePlugin.getDefault().getDiscoveryManager().updateDiscoveredInfo(pathInfo);
|
||||
MakeCorePlugin.getDefault().getDiscoveryManager().updateDiscoveredInfo(pathInfo, null);
|
||||
monitor.worked(50);
|
||||
} catch (CoreException e) {
|
||||
MakeCorePlugin.log(e);
|
||||
|
|
|
@ -205,7 +205,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
|
||||
try {
|
||||
// update scanner configuration
|
||||
MakeCorePlugin.getDefault().getDiscoveryManager().updateDiscoveredInfo(info);
|
||||
MakeCorePlugin.getDefault().getDiscoveryManager().updateDiscoveredInfo(info, null);
|
||||
return true;
|
||||
} catch (CoreException e) {
|
||||
MakeCorePlugin.log(e);
|
||||
|
|
|
@ -22,8 +22,8 @@ import org.eclipse.cdt.core.model.IPathEntry;
|
|||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.cdt.make.core.MakeProjectNature;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigScope;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigNature;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigScope;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathContainer;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
|
||||
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||
|
@ -331,7 +331,10 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
|
|||
String profileId = getBuildInfo().getSelectedProfileId();
|
||||
ScannerConfigScope profileScope = ScannerConfigProfileManager.getInstance().
|
||||
getSCProfileConfiguration(profileId).getProfileScope();
|
||||
MakeCorePlugin.getDefault().getDiscoveryManager().changeDiscoveredContainer(project, profileScope);
|
||||
List changedResources = new ArrayList();
|
||||
changedResources.add(project.getFullPath());
|
||||
MakeCorePlugin.getDefault().getDiscoveryManager().changeDiscoveredContainer(
|
||||
project, profileScope, changedResources);
|
||||
}
|
||||
|
||||
private void populateBuildInfo(IScannerConfigBuilderInfo2 buildInfo) {
|
||||
|
|
Loading…
Add table
Reference in a new issue