From d35174e94de68c613cbacb30868581cdc3f71279 Mon Sep 17 00:00:00 2001 From: John Camelon Date: Sun, 30 Jan 2005 02:55:28 +0000 Subject: [PATCH] Patch for Devin Steffler. Further updates to DOM AST View. --- core/org.eclipse.cdt.ui.tests/plugin.xml | 5 + .../cdt/ui/testplugin/CTestPlugin.java | 5 + .../eclipse/cdt/ui/tests/DOMAST/DOMAST.java | 58 +++++-- .../eclipse/cdt/ui/tests/DOMAST/DOMQuery.java | 153 ++++++++++++++++++ .../cdt/ui/tests/DOMAST/TreeObject.java | 2 +- 5 files changed, 209 insertions(+), 14 deletions(-) create mode 100644 core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMQuery.java diff --git a/core/org.eclipse.cdt.ui.tests/plugin.xml b/core/org.eclipse.cdt.ui.tests/plugin.xml index a4871db38b2..ea39b4b3d58 100644 --- a/core/org.eclipse.cdt.ui.tests/plugin.xml +++ b/core/org.eclipse.cdt.ui.tests/plugin.xml @@ -18,6 +18,7 @@ + @@ -25,6 +26,10 @@ + + + + 0 && location[0] instanceof IASTFileLocation ) + fileName = ((IASTFileLocation)location[0]).getFileName(); // TODO Devin this is in two places now, put into one, and fix up the location[0] for things like macros + else + fileName = BLANK_STRING; + + path = new Path(fileName); + file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path); + start = names[i].getNodeLocations()[0].getNodeOffset(); + end = names[i].getNodeLocations()[0].getNodeOffset() + names[i].getNodeLocations()[0].getNodeLength(); + + collector.acceptMatch( createMatch(file, start, end, names[i], path ) ); + } + } catch (CoreException ce) {} + } + + mainSearchPM.done(); + collector.done(); + + return new Status(IStatus.OK, CTestPlugin.getPluginId(), 0, BLANK_STRING, null); //$NON-NLS-1$ + } + + public IMatch createMatch( Object fileResource, int start, int end, IASTName name, IPath referringElement ) { + BasicSearchMatch result = new BasicSearchMatch(); + if( fileResource instanceof IResource ) + result.resource = (IResource) fileResource; + else if( fileResource instanceof IPath ) + result.path = (IPath) fileResource; + + result.startOffset = start; + result.endOffset = end; + result.parentName = BLANK_STRING; //$NON-NLS-1$ + result.referringElement = referringElement; + + result.name = name.toString(); + + result.type = ICElement.C_FIELD; // TODO Devin static for now, want something like BasicSearchResultCollector#setElementInfo + result.visibility = ICElement.CPP_PUBLIC; // TODO Devin static for now, want something like BasicSearchResultCollector#setElementInfo + result.returnType = BLANK_STRING; + + return result; + } + + + /* (non-Javadoc) + * @see org.eclipse.search.ui.ISearchQuery#getLabel() + */ + public String getLabel() { + return queryLabel; + } + + /* (non-Javadoc) + * @see org.eclipse.search.ui.ISearchQuery#canRerun() + */ + public boolean canRerun() { + // TODO Auto-generated method stub + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.search.ui.ISearchQuery#canRunInBackground() + */ + public boolean canRunInBackground() { + // TODO Auto-generated method stub + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.search.ui.ISearchQuery#getSearchResult() + */ + public ISearchResult getSearchResult() { + if (_result == null) + _result= new CSearchResult(this); + return _result; + } + +} diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/TreeObject.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/TreeObject.java index 5f8e7f4cc2f..43ecfd0a532 100644 --- a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/TreeObject.java +++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/TreeObject.java @@ -65,7 +65,7 @@ public class TreeObject implements IAdaptable { } public String toString() { - if( node == null ) return BLANK_FILENAME; //$NON-NLS-1$ //TODO Devin is this the best way??? + if( node == null ) return BLANK_FILENAME; //$NON-NLS-1$ StringBuffer buffer = new StringBuffer(); Class[] classes = node.getClass().getInterfaces();