mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +02:00
68409
- fix out of memory exception while searching. - fix hierarchical search view issues when offsets are off
This commit is contained in:
parent
78cc9ee282
commit
0bf2405b42
3 changed files with 22 additions and 7 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 ) )
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue