1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 08:55:25 +02:00
- fix out of memory exception while searching.
- fix hierarchical search view issues when offsets are off
This commit is contained in:
Andrew Niefer 2004-06-24 18:58:03 +00:00
parent 78cc9ee282
commit 0bf2405b42
3 changed files with 22 additions and 7 deletions

View file

@ -490,12 +490,22 @@ public class MatchLocator implements IMatchLocator{
MatchLocator.verbose("MatchLocator VM Error: "); //$NON-NLS-1$
vmErr.printStackTrace();
}
} finally {
scopeStack.clear();
resourceStack.clear();
lastDeclaration = null;
currentScope = null;
parser = null;
}
AcceptMatchOperation acceptMatchOp = new AcceptMatchOperation( resultCollector, matchStorage );
try {
CCorePlugin.getWorkspace().run(acceptMatchOp,null);
} catch (CoreException e) {}
if( matchStorage.size() > 0 ){
AcceptMatchOperation acceptMatchOp = new AcceptMatchOperation( resultCollector, matchStorage );
try {
CCorePlugin.getWorkspace().run(acceptMatchOp,null);
} catch (CoreException e) {}
matchStorage.clear();
}
}
}

View file

@ -94,6 +94,8 @@ public class ParserUtil
*/
public static IResource getResourceForFilename(String finalPath) {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
if( workspace == null )
return null;
IPath path = new Path( finalPath );
if( workspace.getRoot().getLocation().isPrefixOf( path ) )

View file

@ -62,7 +62,7 @@ public class LevelTreeContentProvider extends CSearchContentProvider implements
}
public Object getParent(Object child) {
Object possibleParent= null;
if (child instanceof BasicSearchMatch){
BasicSearchMatch tempMatch = (BasicSearchMatch)child;
ICElement cTransUnit = CCorePlugin.getDefault().getCoreModel().create(tempMatch.getResource());
@ -72,10 +72,13 @@ public class LevelTreeContentProvider extends CSearchContentProvider implements
child = ((ITranslationUnit) cTransUnit).getElementAtOffset(tempMatch.startOffset);
} catch (CModelException e) {}
}
if( child == null ){
possibleParent = cTransUnit;
}
}
Object possibleParent= internalGetParent(child);
if( child != null )
possibleParent = internalGetParent(child);
if (possibleParent instanceof ICElement) {
ICElement cElement= (ICElement) possibleParent;