diff options
author | Andrew Niefer | 2004-06-24 18:58:03 +0000 |
---|---|---|
committer | Andrew Niefer | 2004-06-24 18:58:03 +0000 |
commit | 0bf2405b4208876cb52e2599ca059615a9af29ba (patch) | |
tree | cc3c8ecbe689a3879f82b9af45fa28b7c3d546b0 | |
parent | 78cc9ee282073eada44cfa1be8a24b28c14d59b2 (diff) | |
download | org.eclipse.cdt-0bf2405b4208876cb52e2599ca059615a9af29ba.tar.gz org.eclipse.cdt-0bf2405b4208876cb52e2599ca059615a9af29ba.tar.xz org.eclipse.cdt-0bf2405b4208876cb52e2599ca059615a9af29ba.zip |
68409
- fix out of memory exception while searching.
- fix hierarchical search view issues when offsets are off
3 files changed, 22 insertions, 7 deletions
diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java index a08fec88dad..d7b4bd9fe0b 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java @@ -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(); + } } } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserUtil.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserUtil.java index 0e1dbf2503e..15f9ac1c6db 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserUtil.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserUtil.java @@ -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 ) ) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LevelTreeContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LevelTreeContentProvider.java index a344ff27f70..f342a652df7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LevelTreeContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LevelTreeContentProvider.java @@ -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; |