1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-01 21:35:40 +02:00

Updating the file to reflect changes in IPathContainerExtension

This commit is contained in:
Alain Magloire 2005-03-30 16:39:36 +00:00
parent 520d41403e
commit 77df20e6f9

View file

@ -13,13 +13,13 @@ package org.eclipse.cdt.make.internal.core.scannerconfig;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IIncludeEntry; import org.eclipse.cdt.core.model.IIncludeEntry;
import org.eclipse.cdt.core.model.IMacroEntry; import org.eclipse.cdt.core.model.IMacroEntry;
import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.core.model.IPathEntryContainerExtension; import org.eclipse.cdt.core.model.IPathEntryContainerExtension;
import org.eclipse.cdt.make.core.MakeCorePlugin; import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigScope; import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigScope;
@ -32,8 +32,6 @@ import org.eclipse.core.runtime.Path;
public class PerFileDiscoveredPathContainer extends AbstractDiscoveredPathContainer public class PerFileDiscoveredPathContainer extends AbstractDiscoveredPathContainer
implements IPathEntryContainerExtension { implements IPathEntryContainerExtension {
private static final IIncludeEntry[] NO_INCLUDENTRIES = new IIncludeEntry[0];
private static final IMacroEntry[] NO_SYMBOLENTRIES = new IMacroEntry[0];
static Map fgPathEntries; static Map fgPathEntries;
@ -68,42 +66,46 @@ public class PerFileDiscoveredPathContainer extends AbstractDiscoveredPathContai
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.model.IPathEntryContainerExtension#getIncludeEntries(org.eclipse.core.runtime.IPath) * @see org.eclipse.cdt.core.model.IPathEntryContainerExtension#getPathEntries(org.eclipse.core.runtime.IPath, int)
*/ */
public IIncludeEntry[] getIncludeEntries(IPath path) { public IPathEntry[] getPathEntries(IPath path, int mask) {
IDiscoveredPathInfo info; IDiscoveredPathInfo info;
try { ArrayList entries = new ArrayList();
info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fProject); if ((mask & IPathEntry.CDT_INCLUDE_FILE) != 0) {
IPath[] includes = info.getIncludePaths(path); // TODO: not implemented
List entries = new ArrayList(includes.length); }
for (int i = 0; i < includes.length; i++) { if ((mask & IPathEntry.CDT_INCLUDE) != 0) {
entries.add(CoreModel.newIncludeEntry(path, Path.EMPTY, includes[i])); //$NON-NLS-1$ //$NON-NLS-2$ // TODO: Vlad how do we differentiate local includes from system includes
} try {
return (IIncludeEntry[])entries.toArray(new IIncludeEntry[entries.size()]); info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fProject);
} IPath[] includes = info.getIncludePaths(path);
catch (CoreException e) { for (int i = 0; i < includes.length; i++) {
return NO_INCLUDENTRIES; entries.add(CoreModel.newIncludeEntry(path, Path.EMPTY, includes[i], true));
} }
} return (IIncludeEntry[])entries.toArray(new IIncludeEntry[entries.size()]);
}
/* (non-Javadoc) catch (CoreException e) {
* @see org.eclipse.cdt.core.model.IPathEntryContainerExtension#getMacroEntries(org.eclipse.core.runtime.IPath) //
*/ }
public IMacroEntry[] getMacroEntries(IPath path) { }
IDiscoveredPathInfo info; if ((mask & IPathEntry.CDT_MACRO_FILE) != 0) {
try { // TODO: not implemented
info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fProject); }
Map syms = info.getSymbols(path); if ((mask & IPathEntry.CDT_MACRO) != 0) {
List entries = new ArrayList(syms.size()); try {
for (Iterator iter = syms.entrySet().iterator(); iter.hasNext(); ) { info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fProject);
Entry entry = (Entry)iter.next(); Map syms = info.getSymbols(path);
entries.add(CoreModel.newMacroEntry(path, (String)entry.getKey(), (String)entry.getValue())); //$NON-NLS-1$ for (Iterator iter = syms.entrySet().iterator(); iter.hasNext(); ) {
} Entry entry = (Entry)iter.next();
return (IMacroEntry[])entries.toArray(new IMacroEntry[entries.size()]); entries.add(CoreModel.newMacroEntry(path, (String)entry.getKey(), (String)entry.getValue())); //$NON-NLS-1$
} }
catch (CoreException e) { return (IMacroEntry[])entries.toArray(new IMacroEntry[entries.size()]);
return NO_SYMBOLENTRIES; }
} catch (CoreException e) {
//
}
}
return (IPathEntry[]) entries.toArray(new IPathEntry[entries.size()]);
} }
/* (non-Javadoc) /* (non-Javadoc)