1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-09 19:43:27 +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$ MatchLocator.verbose("MatchLocator VM Error: "); //$NON-NLS-1$
vmErr.printStackTrace(); vmErr.printStackTrace();
} }
} finally {
scopeStack.clear();
resourceStack.clear();
lastDeclaration = null;
currentScope = null;
parser = null;
} }
AcceptMatchOperation acceptMatchOp = new AcceptMatchOperation( resultCollector, matchStorage ); if( matchStorage.size() > 0 ){
try { AcceptMatchOperation acceptMatchOp = new AcceptMatchOperation( resultCollector, matchStorage );
CCorePlugin.getWorkspace().run(acceptMatchOp,null); try {
} catch (CoreException e) {} 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) { public static IResource getResourceForFilename(String finalPath) {
IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspace workspace = ResourcesPlugin.getWorkspace();
if( workspace == null )
return null;
IPath path = new Path( finalPath ); IPath path = new Path( finalPath );
if( workspace.getRoot().getLocation().isPrefixOf( path ) ) if( workspace.getRoot().getLocation().isPrefixOf( path ) )

View file

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