From 9eab565dd05330a91cce4beb3dc751f49b8dc5da Mon Sep 17 00:00:00 2001 From: John Camelon Date: Tue, 23 Sep 2003 15:17:20 +0000 Subject: [PATCH] Patch for Bogdan Gheorghe Fixed Bug 42685, Bug 43474. This patch: - removes the old CTags Indexer - removes the remaining Indexer block UI item under Project Properties - enables the Indexer on all projects --- core/org.eclipse.cdt.core.tests/ChangeLog | 6 + .../core/indexer/tests/IndexManagerTests.java | 132 ++++---- .../tests/CompletionProposalsTest.java | 2 +- .../cdt/core/search/tests/BaseSearchTest.java | 15 +- core/org.eclipse.cdt.core/ChangeLog | 8 +- .../org.eclipse.cdt.core/dependency/ChangeLog | 3 + .../sourcedependency/DependencyManager.java | 88 ++--- core/org.eclipse.cdt.core/index/ChangeLog | 23 ++ .../org/eclipse/cdt/core/index/ITagEntry.java | 78 ----- .../eclipse/cdt/core/index/IndexModel.java | 119 ------- .../org/eclipse/cdt/core/index/TagFlags.java | 179 ---------- .../cdt/internal/core/index/CTagsCmd.java | 84 ----- .../cdt/internal/core/index/CTagsEntry.java | 291 ----------------- .../internal/core/index/CTagsFileReader.java | 62 ---- .../internal/core/index/CTagsFileWriter.java | 61 ---- .../cdt/internal/core/index/CTagsHeader.java | 96 ------ .../cdt/internal/core/index/CTagsRunner.java | 74 ----- .../cdt/internal/core/index/IndexManager.java | 309 ------------------ .../cdt/internal/core/index/RequestList.java | 61 ---- .../core/search/indexing/IndexAllProject.java | 8 +- .../core/search/indexing/IndexManager.java | 90 ++--- .../src/org/eclipse/cdt/core/CCorePlugin.java | 16 +- core/org.eclipse.cdt.ui/ChangeLog | 23 +- core/org.eclipse.cdt.ui/plugin.xml | 40 +-- .../ui/editor/DefaultCEditorTextHover.java | 183 +++++------ .../ui/preferences/CProjectOptionBlock.java | 2 +- .../ui/preferences/CProjectPropertyPage.java | 2 +- .../ui/text/CCompletionProcessor.java | 1 + .../eclipse/cdt/ui/dialogs/IndexerBlock.java | 47 +-- .../eclipse/cdt/ui/wizards/IndexerBlock.java | 128 -------- 30 files changed, 320 insertions(+), 1911 deletions(-) delete mode 100644 core/org.eclipse.cdt.core/index/org/eclipse/cdt/core/index/ITagEntry.java delete mode 100644 core/org.eclipse.cdt.core/index/org/eclipse/cdt/core/index/IndexModel.java delete mode 100644 core/org.eclipse.cdt.core/index/org/eclipse/cdt/core/index/TagFlags.java delete mode 100644 core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/CTagsCmd.java delete mode 100644 core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/CTagsEntry.java delete mode 100644 core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/CTagsFileReader.java delete mode 100644 core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/CTagsFileWriter.java delete mode 100644 core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/CTagsHeader.java delete mode 100644 core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/CTagsRunner.java delete mode 100644 core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IndexManager.java delete mode 100644 core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/RequestList.java delete mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/IndexerBlock.java diff --git a/core/org.eclipse.cdt.core.tests/ChangeLog b/core/org.eclipse.cdt.core.tests/ChangeLog index 1456cef4e1f..aa1fb33a822 100644 --- a/core/org.eclipse.cdt.core.tests/ChangeLog +++ b/core/org.eclipse.cdt.core.tests/ChangeLog @@ -1,3 +1,9 @@ +2003-09-22 Bogdan Gheorghe + - modified CompletionProposalsTests, BaseSearchTest + to avoid using isEnabled for the IndexManager + - Reordered the IndexManagerTests suite to allow all + tests to be run + 2003-09-22 Andrew Niefer - modified resources/cfiles/CompletionProposalsTestStart.cpp - modified CompletionProposalsTest.testCompletionProposals diff --git a/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/IndexManagerTests.java b/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/IndexManagerTests.java index 25132cc0b7c..7c2ced80298 100644 --- a/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/IndexManagerTests.java +++ b/core/org.eclipse.cdt.core.tests/indexer/org/eclipse/cdt/core/indexer/tests/IndexManagerTests.java @@ -17,6 +17,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; +import java.util.Set; import junit.framework.Test; import junit.framework.TestCase; @@ -25,6 +26,10 @@ import junit.framework.TestSuite; import org.eclipse.cdt.core.CCProjectNature; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.search.ICSearchConstants; +import org.eclipse.cdt.core.search.ICSearchPattern; +import org.eclipse.cdt.core.search.ICSearchResultCollector; +import org.eclipse.cdt.core.search.ICSearchScope; +import org.eclipse.cdt.core.search.SearchEngine; import org.eclipse.cdt.internal.core.index.IEntryResult; import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.cdt.internal.core.index.IQueryResult; @@ -33,6 +38,7 @@ import org.eclipse.cdt.internal.core.search.indexing.IIndexConstants; import org.eclipse.cdt.internal.core.search.indexing.IndexManager; import org.eclipse.cdt.internal.core.sourcedependency.DependencyManager; import org.eclipse.cdt.internal.core.sourcedependency.DependencyQueryJob; +import org.eclipse.cdt.internal.ui.search.CSearchResultCollector; import org.eclipse.core.internal.resources.ResourceException; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; @@ -52,13 +58,13 @@ import org.eclipse.core.runtime.Platform; * @author bgheorgh */ public class IndexManagerTests extends TestCase { - IFile file; - IFileDocument fileDoc; - IProject testProject; - NullProgressMonitor monitor; - IndexManager indexManager; - - public static final int TIMEOUT = 10000; + IFile file; + IFileDocument fileDoc; + IProject testProject; + NullProgressMonitor monitor; + IndexManager indexManager; + + public static final int TIMEOUT = 5000; /** * Constructor for IndexManagerTest. * @param name @@ -78,8 +84,9 @@ public class IndexManagerTests extends TestCase { testProject = createProject("IndexerTestProject"); if (testProject==null) fail("Unable to create project"); - - + + indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager(); + indexManager.reset(); } /* * @see TestCase#tearDown() @@ -103,17 +110,18 @@ public class IndexManagerTests extends TestCase { TestSuite suite = new TestSuite(IndexManagerTests.class.getName()); suite.addTest(new IndexManagerTests("testAddNewFileToIndex")); - suite.addTest(new IndexManagerTests("testRemoveProjectFromIndex")); - suite.addTest(new IndexManagerTests("testRefs")); - suite.addTest(new IndexManagerTests("testMacros")); suite.addTest(new IndexManagerTests("testForwardDeclarations")); - //suite.addTest(new IndexManagerTests("testIndexContents")); - //suite.addTest(new IndexManagerTests("testIndexAll")); - suite.addTest(new IndexManagerTests("testDependencyTree")); + suite.addTest(new IndexManagerTests("testIndexAll")); + suite.addTest(new IndexManagerTests("testIndexContents")); + suite.addTest(new IndexManagerTests("testMacros")); + suite.addTest(new IndexManagerTests("testRefs")); + suite.addTest(new IndexManagerTests("testRemoveFileFromIndex")); + suite.addTest(new IndexManagerTests("testRemoveProjectFromIndex")); suite.addTest(new IndexManagerTests("testIndexShutdown")); - + suite.addTest(new IndexManagerTests("testDependencyTree")); + return suite; - // return new TestSuite(IndexManagerTests.class); + } /* * Utils @@ -127,13 +135,13 @@ public class IndexManagerTests extends TestCase { if (!project.exists()) { project.create(null); } else { - project.refreshLocal(IResource.DEPTH_INFINITE, null); + project.refreshLocal(IResource.DEPTH_INFINITE, null); } if (!project.isOpen()) { project.open(null); } - //Fill out a project description + //Fill out a project description IPath defaultPath = Platform.getLocation(); IPath newPath = project.getFullPath(); if (defaultPath.equals(newPath)) @@ -159,7 +167,7 @@ public class IndexManagerTests extends TestCase { private IFile importFile(String fileName, String resourceLocation)throws Exception{ //Obtain file handle - file = testProject.getProject().getFile(fileName); + file = testProject.getProject().getFile(fileName); String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile(); //Create file input stream monitor = new NullProgressMonitor(); @@ -185,11 +193,7 @@ public class IndexManagerTests extends TestCase { public void testIndexAll() throws Exception { //Add a file to the project importFile("mail.cpp","resources/indexer/mail.cpp"); - //Enable indexing on the created project - //By doing this, we force the Index Manager to indexAll() - indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager(); - indexManager.setEnabled(testProject,true); - Thread.sleep(1500); + Thread.sleep(5000); IIndex ind = indexManager.getIndex(testProject.getFullPath(),true,true); assertTrue("Index exists for project",ind != null); @@ -201,7 +205,7 @@ public class IndexManagerTests extends TestCase { assertTrue("Entry Results exist", eresults != null); String [] queryResultModel = {"IndexedFile(1: /IndexerTestProject/mail.cpp)"}; - String [] entryResultModel ={"EntryResult: word=typeDecl/C/Mail, refs={ 1 }", "EntryResult: word=typeDecl/C/Unknown, refs={ 1 }", "EntryResult: word=typeDecl/C/container, refs={ 1 }", "EntryResult: word=typeDecl/C/first_class, refs={ 1 }", "EntryResult: word=typeDecl/C/postcard, refs={ 1 }", "EntryResult: word=typeDecl/V/PO_Box, refs={ 1 }", "EntryResult: word=typeDecl/V/x, refs={ 1 }"}; + String [] entryResultModel ={"EntryResult: word=typeDecl/C/Mail, refs={ 1 }", "EntryResult: word=typeDecl/C/Unknown, refs={ 1 }", "EntryResult: word=typeDecl/C/container, refs={ 1 }", "EntryResult: word=typeDecl/C/first_class, refs={ 1 }", "EntryResult: word=typeDecl/C/postcard, refs={ 1 }", "EntryResult: word=typeDecl/V/PO_Box, refs={ 1 }", "EntryResult: word=typeDecl/V/size, refs={ 1 }", "EntryResult: word=typeDecl/V/temp, refs={ 1 }", "EntryResult: word=typeDecl/V/x, refs={ 1 }"}; if (qresults.length != queryResultModel.length) fail("Query Result length different from model"); @@ -225,9 +229,8 @@ public class IndexManagerTests extends TestCase { importFile("mail.cpp","resources/indexer/mail.cpp"); //Enable indexing on the created project //By doing this, we force the Index Manager to indexAll() - indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager(); - indexManager.setEnabled(testProject,true); - Thread.sleep(TIMEOUT); + + Thread.sleep(10000); //Make sure project got added to index IPath testProjectPath = testProject.getFullPath(); IIndex ind = indexManager.getIndex(testProjectPath,true,true); @@ -235,6 +238,7 @@ public class IndexManagerTests extends TestCase { //Add a new file to the project, give it some time to index importFile("DocumentManager.h","resources/indexer/DocumentManager.h"); importFile("DocumentManager.cpp","resources/indexer/DocumentManager.cpp"); + Thread.sleep(10000); ind = indexManager.getIndex(testProjectPath,true,true); @@ -256,10 +260,7 @@ public class IndexManagerTests extends TestCase { public void testRemoveProjectFromIndex() throws Exception{ //Add a file to the project importFile("mail.cpp","resources/indexer/mail.cpp"); - //Enable indexing on the created project - //By doing this, we force the Index Manager to indexAll() - indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager(); - indexManager.setEnabled(testProject,true); + Thread.sleep(TIMEOUT); //Make sure project got added to index IPath testProjectPath = testProject.getFullPath(); @@ -289,10 +290,7 @@ public class IndexManagerTests extends TestCase { public void testRemoveFileFromIndex() throws Exception{ //Add a file to the project importFile("mail.cpp","resources/indexer/mail.cpp"); - //Enable indexing on the created project - //By doing this, we force the Index Manager to indexAll() - indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager(); - indexManager.setEnabled(testProject,true); + Thread.sleep(TIMEOUT); //Make sure project got added to index IPath testProjectPath = testProject.getFullPath(); @@ -300,6 +298,7 @@ public class IndexManagerTests extends TestCase { assertTrue("Index exists for project",ind != null); //Add a new file to the project importFile("DocumentManager.h","resources/indexer/DocumentManager.h"); + importFile("DocumentManager.cpp","resources/indexer/DocumentManager.cpp"); Thread.sleep(10000); //Do a "before" deletion comparison ind = indexManager.getIndex(testProjectPath,true,true); @@ -307,7 +306,7 @@ public class IndexManagerTests extends TestCase { IEntryResult[] eresults = ind.queryEntries(prefix); assertTrue("Entry result found for typdeDecl/", eresults != null); - String [] entryResultBeforeModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 1 }", "EntryResult: word=typeDecl/C/Mail, refs={ 2 }", "EntryResult: word=typeDecl/C/Unknown, refs={ 2 }", "EntryResult: word=typeDecl/C/container, refs={ 2 }", "EntryResult: word=typeDecl/C/first_class, refs={ 2 }", "EntryResult: word=typeDecl/C/postcard, refs={ 2 }"}; + String [] entryResultBeforeModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 1 }", "EntryResult: word=typeDecl/C/Mail, refs={ 2 }", "EntryResult: word=typeDecl/C/Unknown, refs={ 2 }", "EntryResult: word=typeDecl/C/container, refs={ 2 }", "EntryResult: word=typeDecl/C/first_class, refs={ 2 }", "EntryResult: word=typeDecl/C/postcard, refs={ 2 }", "EntryResult: word=typeDecl/V/PO_Box, refs={ 2 }", "EntryResult: word=typeDecl/V/size, refs={ 2 }", "EntryResult: word=typeDecl/V/temp, refs={ 2 }", "EntryResult: word=typeDecl/V/x, refs={ 2 }"}; if (eresults.length != entryResultBeforeModel.length) fail("Entry Result length different from model"); @@ -329,7 +328,7 @@ public class IndexManagerTests extends TestCase { fail("Entry Result length different from model"); for (int i=0;i this.jobStart) { // check if a job to index the project is not already in the queue @@ -321,10 +321,10 @@ public class IndexManager extends JobManager implements IIndexConstants { if (target instanceof IProject) { IProject p = (IProject) target; /****** - *TODO: Remove these methods once the new indexer is + *TODO: BOG Remove these methods once the new indexer is *fully integrated */ - if (!isEnabled(p)) return; +// if (!isEnabled(p)) return; //if (JavaProject.hasJavaNature(p)) request = new IndexAllProject(p, this); @@ -410,10 +410,10 @@ public class IndexManager extends JobManager implements IIndexConstants { public void removeSourceFolderFromIndex(CProject javaProject, IPath sourceFolder, char[][] exclusionPatterns) { IProject project = javaProject.getProject(); /****** - *TODO: Remove these methods once the new indexer is + *TODO: BOG Remove these methods once the new indexer is *fully integrated */ - if (!isEnabled(project)) return; +// if (!isEnabled(project)) return; if (this.jobEnd > this.jobStart) { // check if a job to index the project is not already in the queue @@ -599,43 +599,43 @@ public class IndexManager extends JobManager implements IIndexConstants { } /************* - *TODO: Remove these methods once the new indexer is + *TODO: BOG Remove these methods once the new indexer is *fully integrated * START OF TEMP INDEXER ENABLE SECTION */ - final static String INDEX_MODEL_ID = CCorePlugin.PLUGIN_ID + ".newindexmodel"; - final static String ACTIVATION = "enable"; - - static QualifiedName activationKey = new QualifiedName(INDEX_MODEL_ID, ACTIVATION); - - public boolean isEnabled(IProject project) { - String prop = null; - try { - if (project != null) { - prop = project.getPersistentProperty(activationKey); - } - } catch (CoreException e) { - } - return ((prop != null) && prop.equalsIgnoreCase("true")); - } - - public void setEnabled(IProject project, boolean on) { - try { - if (project != null) { - Boolean newValue = new Boolean(on); - Boolean oldValue = new Boolean(isEnabled(project)); - if (!oldValue.equals(newValue)) { - project.setPersistentProperty(activationKey, newValue.toString()); - if (on) { - indexAll(project); - } else { - //remove(project); - } - } - } - } catch (CoreException e) { - } - } +// final static String INDEX_MODEL_ID = CCorePlugin.PLUGIN_ID + ".newindexmodel"; +// final static String ACTIVATION = "enable"; +// +// static QualifiedName activationKey = new QualifiedName(INDEX_MODEL_ID, ACTIVATION); +// +// public boolean isEnabled(IProject project) { +// String prop = null; +// try { +// if (project != null) { +// prop = project.getPersistentProperty(activationKey); +// } +// } catch (CoreException e) { +// } +// return ((prop != null) && prop.equalsIgnoreCase("true")); +// } +// +// public void setEnabled(IProject project, boolean on) { +// try { +// if (project != null) { +// Boolean newValue = new Boolean(on); +// Boolean oldValue = new Boolean(isEnabled(project)); +// if (!oldValue.equals(newValue)) { +// project.setPersistentProperty(activationKey, newValue.toString()); +// if (on) { +// indexAll(project); +// } else { +// //remove(project); +// } +// } +// } +// } catch (CoreException e) { +// } +// } /************ * END OF TEMP INDEXER ENABLE SECTION diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java index f7474c0e53b..15679be822d 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java @@ -16,7 +16,6 @@ import java.util.Map; import java.util.MissingResourceException; import java.util.ResourceBundle; -import org.eclipse.cdt.core.index.IndexModel; import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.parser.IScannerInfoProvider; import org.eclipse.cdt.core.resources.IConsole; @@ -122,7 +121,6 @@ public class CCorePlugin extends Plugin { private CDescriptorManager fDescriptorManager; private CoreModel fCoreModel; - private IndexModel fIndexModel; // -------- static methods -------- @@ -210,9 +208,7 @@ public class CCorePlugin extends Plugin { if (fDescriptorManager != null) { fDescriptorManager.shutdown(); } - if (fIndexModel != null) { - fIndexModel.shutdown(); - } + if (fCoreModel != null) { fCoreModel.shutdown(); } @@ -231,11 +227,7 @@ public class CCorePlugin extends Plugin { fCoreModel = CoreModel.getDefault(); fCoreModel.startup(); - // Fired up the indexer. It should delay itself for 10 seconds - fIndexModel = IndexModel.getDefault(); - fIndexModel.startup(); - - //Fired up the new indexer + //Fired up the indexer fCoreModel.startIndexing(); //Fire up dependency manager @@ -517,10 +509,6 @@ public class CCorePlugin extends Plugin { return fCoreModel; } - public IndexModel getIndexModel() { - return fIndexModel; - } - public ICDescriptor getCProjectDescription(IProject project) throws CoreException { return fDescriptorManager.getDescriptor(project); } diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog index bcf30ea6dce..14a83559492 100644 --- a/core/org.eclipse.cdt.ui/ChangeLog +++ b/core/org.eclipse.cdt.ui/ChangeLog @@ -1,14 +1,27 @@ -<<<<<<< ChangeLog -<<<<<<< ChangeLog -2003-09-19 Hoda Amer +2003-09-22 Bogdan Gheorghe + Got rid of the C/C++ Project property page (only the indexer tab + was left). Here are the changes: + + Modified: + * plugin.xml + * org.eclipse.cdt.internal.ui.text.CCompletionProcessor + * org.eclipse.cdt.internal.ui.editor.DefaultCEditorTextHover + + Deleted: + * org.eclipse.cdt.ui.wizards.IndexerBlock + + Slated for deletion before 1.2 GA: + * org.eclipse.cdt.internal.ui.preferences.CProjectPropertyPage + * org.eclipse.cdt.internal.ui.preferences.CProjectOptionBlock + * org.eclipse.cdt.ui.dialogs.IndexerBlock + +2003-09-22 Hoda Amer Solutions to bug#43162 : Code Assist not showing the right return value Bug#43145 : foo function still showing in Code Assist even if "f" is deleted Bug#42810 : Code Assist adding characters after pressing Bug#42861 : Code Assist should be case insensitive. -======= -======= 2003-09-22 Andrew Niefer fix for bug 43327 Code Complete finds local variables - update calls to SearchEngine.search. CodeCompletion passes true for excludeLocalDeclarations diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml index 879a034ebf3..a9cf2a0fecf 100644 --- a/core/org.eclipse.cdt.ui/plugin.xml +++ b/core/org.eclipse.cdt.ui/plugin.xml @@ -27,9 +27,9 @@ - - + + @@ -130,8 +130,8 @@ id="org.eclipse.cdt.ui.CView"> - + - - - - - - - - diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DefaultCEditorTextHover.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DefaultCEditorTextHover.java index b04b7c5ef0e..e8057f45896 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DefaultCEditorTextHover.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DefaultCEditorTextHover.java @@ -18,9 +18,7 @@ import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IFileEditorInput; -import org.eclipse.cdt.core.index.ITagEntry; -import org.eclipse.cdt.core.index.IndexModel; -import org.eclipse.cdt.core.index.TagFlags; + import org.eclipse.cdt.internal.ui.CCompletionContributorManager; import org.eclipse.cdt.internal.ui.text.CWordFinder; import org.eclipse.cdt.internal.ui.text.HTMLPrinter; @@ -43,88 +41,88 @@ public class DefaultCEditorTextHover implements ITextHover */ public String getHoverInfo( ITextViewer viewer, IRegion region ) { - String expression = null; - - if(fEditor == null) - return null; - try - { - expression = viewer.getDocument().get( region.getOffset(), region.getLength() ); - expression = expression.trim(); - if ( expression.length() == 0 ) - return null; - - StringBuffer buffer = new StringBuffer(); - - // We are just doing some C, call the Help to get info - - IFunctionSummary fs = CCompletionContributorManager.getDefault().getFunctionInfo(expression); - if(fs != null) { - buffer.append(""); - buffer.append(HTMLPrinter.convertToHTMLContent(fs.getName())); - buffer.append("()"); - buffer.append(HTMLPrinter.convertToHTMLContent(fs.getPrototype().getPrototypeString(false))); - if(fs.getDescription() != null) { - buffer.append("

"); - buffer.append(HTMLPrinter.convertToHTMLContent(fs.getDescription())); - } - int i; - for(i = 0; i < buffer.length(); i++) { - if(buffer.charAt(i) == '\\') { - if((i + 1 < buffer.length()) && buffer.charAt(i+1) == 'n') { - buffer.replace(i, i + 2, "
"); - } - } - } - } else { - // Query the C model - IndexModel model = IndexModel.getDefault(); - IEditorInput input = fEditor.getEditorInput(); - if(input instanceof IFileEditorInput) { - IProject project = ((IFileEditorInput)input).getFile().getProject(); - - // Bail out quickly, if the project was deleted. - if (!project.exists()) - throw new CoreException(new Status(0, "", 0, "", null)); - - IProject[] refs = project.getReferencedProjects(); - - ITagEntry[] tags= model.query(project, expression, false, true); - - if(tags == null || tags.length == 0) { - for ( int j= 0; j < refs.length; j++ ) { - if (!refs[j].exists()) - continue; - tags= model.query(refs[j], expression, false, true); - if(tags != null && tags.length > 0) - break; - } - } - - if(tags != null && tags.length > 0) { - ITagEntry selectedTag = selectTag(tags); - // Show only the first element - buffer.append(" " + TagFlags.value(selectedTag.getKind()) + " " + HTMLPrinter.convertToHTMLContent(expression) + - " - " + selectedTag.getIFile().getFullPath().toString() + "[" + selectedTag.getLineNumber()+"]" ); - // Now add the pattern - buffer.append("

" + HTMLPrinter.convertToHTMLContent(selectedTag.getPattern())); - } - } - } - if (buffer.length() > 0) { - HTMLPrinter.insertPageProlog(buffer, 0); - HTMLPrinter.addPageEpilog(buffer); - return buffer.toString(); - } - } - catch( BadLocationException x ) - { - // ignore - } - catch( CoreException x ) - { - // ignore - } +// String expression = null; +// +// if(fEditor == null) +// return null; +// try +// { +// expression = viewer.getDocument().get( region.getOffset(), region.getLength() ); +// expression = expression.trim(); +// if ( expression.length() == 0 ) +// return null; +// +// StringBuffer buffer = new StringBuffer(); +// +// // We are just doing some C, call the Help to get info +// +// IFunctionSummary fs = CCompletionContributorManager.getDefault().getFunctionInfo(expression); +// if(fs != null) { +// buffer.append(""); +// buffer.append(HTMLPrinter.convertToHTMLContent(fs.getName())); +// buffer.append("()"); +// buffer.append(HTMLPrinter.convertToHTMLContent(fs.getPrototype().getPrototypeString(false))); +// if(fs.getDescription() != null) { +// buffer.append("

"); +// buffer.append(HTMLPrinter.convertToHTMLContent(fs.getDescription())); +// } +// int i; +// for(i = 0; i < buffer.length(); i++) { +// if(buffer.charAt(i) == '\\') { +// if((i + 1 < buffer.length()) && buffer.charAt(i+1) == 'n') { +// buffer.replace(i, i + 2, "
"); +// } +// } +// } +// } else { +// // Query the C model +// IndexModel model = IndexModel.getDefault(); +// IEditorInput input = fEditor.getEditorInput(); +// if(input instanceof IFileEditorInput) { +// IProject project = ((IFileEditorInput)input).getFile().getProject(); +// +// // Bail out quickly, if the project was deleted. +// if (!project.exists()) +// throw new CoreException(new Status(0, "", 0, "", null)); +// +// IProject[] refs = project.getReferencedProjects(); +// +// ITagEntry[] tags= model.query(project, expression, false, true); +// +// if(tags == null || tags.length == 0) { +// for ( int j= 0; j < refs.length; j++ ) { +// if (!refs[j].exists()) +// continue; +// tags= model.query(refs[j], expression, false, true); +// if(tags != null && tags.length > 0) +// break; +// } +// } +// +// if(tags != null && tags.length > 0) { +// ITagEntry selectedTag = selectTag(tags); +// // Show only the first element +// buffer.append(" " + TagFlags.value(selectedTag.getKind()) + " " + HTMLPrinter.convertToHTMLContent(expression) + +// " - " + selectedTag.getIFile().getFullPath().toString() + "[" + selectedTag.getLineNumber()+"]" ); +// // Now add the pattern +// buffer.append("

" + HTMLPrinter.convertToHTMLContent(selectedTag.getPattern())); +// } +// } +// } +// if (buffer.length() > 0) { +// HTMLPrinter.insertPageProlog(buffer, 0); +// HTMLPrinter.addPageEpilog(buffer); +// return buffer.toString(); +// } +// } +// catch( BadLocationException x ) +// { +// // ignore +// } +// catch( CoreException x ) +// { +// // ignore +// } return null; } @@ -144,20 +142,5 @@ public class DefaultCEditorTextHover implements ITextHover return null; } - private ITagEntry selectTag(ITagEntry[] tags) { - // Rules are to return a function prototype/declaration, and if - // not found first entry - for(int i = 0; i < tags.length; i++) { - if(tags[i].getKind() == TagFlags.T_PROTOTYPE) { - return tags[i]; - } - } - for(int i = 0; i < tags.length; i++) { - if(tags[i].getKind() == TagFlags.T_FUNCTION) { - return tags[i]; - } - } - return tags[0]; - } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CProjectOptionBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CProjectOptionBlock.java index 79177dc6cef..f3b50c037a1 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CProjectOptionBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CProjectOptionBlock.java @@ -11,7 +11,7 @@ package org.eclipse.cdt.internal.ui.preferences; import org.eclipse.cdt.ui.dialogs.ICOptionContainer; import org.eclipse.cdt.ui.dialogs.IndexerBlock; import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock; - +//TODO: BOG UI Get rid before final 1.2 public class CProjectOptionBlock extends TabFolderOptionBlock { public CProjectOptionBlock(ICOptionContainer parent) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CProjectPropertyPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CProjectPropertyPage.java index 1132d8208c5..69a3962bb04 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CProjectPropertyPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CProjectPropertyPage.java @@ -21,7 +21,7 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation; import org.eclipse.ui.dialogs.PropertyPage; - +//TODO: BOG UI Get rid before final 1.2 public class CProjectPropertyPage extends PropertyPage implements ICOptionContainer { private CProjectOptionBlock fOptionBlock; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCompletionProcessor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCompletionProcessor.java index 90be1ba5947..872a484f83a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCompletionProcessor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCompletionProcessor.java @@ -601,4 +601,5 @@ public class CCompletionProcessor implements IContentAssistProcessor { proposal.setAdditionalProposalInfo(infoString.toString()); } } + } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/IndexerBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/IndexerBlock.java index 7c584041077..241b50165e8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/IndexerBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/IndexerBlock.java @@ -11,7 +11,6 @@ package org.eclipse.cdt.ui.dialogs; ***********************************************************************/ import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.index.IndexModel; import org.eclipse.cdt.internal.core.search.indexing.IndexManager; import org.eclipse.cdt.internal.core.sourcedependency.DependencyManager; import org.eclipse.cdt.ui.CUIPlugin; @@ -22,13 +21,12 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; - +//TODO: BOG UI Get rid before final 1.2 public class IndexerBlock extends AbstractCOptionPage { private static final String PREFIX = "IndexerBlock"; // $NON-NLS-1$ private static final String LABEL = PREFIX + ".label"; // $NON-NLS-1$ private static final String DESC = PREFIX + ".desc"; // $NON-NLS-1$ - private Button indexerSwitch; private Button indexerSwitch2; private Button dTreeSwitch; @@ -43,10 +41,6 @@ public class IndexerBlock extends AbstractCOptionPage { grid.numColumns = 1; composite.setLayout(grid); - indexerSwitch = new Button(composite, SWT.CHECK | SWT.RIGHT); - indexerSwitch.setAlignment(SWT.LEFT); - indexerSwitch.setText("Enable CTAGS indexing service for this project"); - indexerSwitch2 = new Button(composite, SWT.CHECK | SWT.RIGHT); indexerSwitch2.setAlignment(SWT.LEFT); indexerSwitch2.setText("Enable NEW indexing service for this project"); @@ -57,23 +51,18 @@ public class IndexerBlock extends AbstractCOptionPage { IProject project = getContainer().getProject(); if (project != null) { - IndexModel indexer = CCorePlugin.getDefault().getIndexModel(); - IndexManager newIndexer = CCorePlugin.getDefault().getCoreModel().getIndexManager(); - if (indexerSwitch != null) { - //indexerSwitch.setAlignment(SWT.LEFT); - //indexerSwitch.setText("Enable indexing service for this project"); - indexerSwitch.setSelection(indexer.isEnabled(project)); - } + +// IndexManager newIndexer = CCorePlugin.getDefault().getCoreModel().getIndexManager(); +// +// if (indexerSwitch2 != null) { +// indexerSwitch2.setSelection(newIndexer.isEnabled(project)); +// } - if (indexerSwitch2 != null) { - indexerSwitch2.setSelection(newIndexer.isEnabled(project)); - } - - DependencyManager depManager = CCorePlugin.getDefault().getCoreModel().getDependencyManager(); - - if (dTreeSwitch != null) { - dTreeSwitch.setSelection(depManager.isEnabled(project)); - } +// DependencyManager depManager = CCorePlugin.getDefault().getCoreModel().getDependencyManager(); +// +// if (dTreeSwitch != null) { +// dTreeSwitch.setSelection(depManager.isEnabled(project)); +// } } setControl(composite); } @@ -81,20 +70,16 @@ public class IndexerBlock extends AbstractCOptionPage { public void performApply(IProgressMonitor monitor) throws CoreException { IProject project = getContainer().getProject(); if (project != null) { - IndexModel indexer = CCorePlugin.getDefault().getIndexModel(); - indexer.setEnabled(project, indexerSwitch.getSelection()); +// IndexManager newIndexer = CCorePlugin.getDefault().getCoreModel().getIndexManager(); +// newIndexer.setEnabled(project, indexerSwitch2.getSelection()); - IndexManager newIndexer = CCorePlugin.getDefault().getCoreModel().getIndexManager(); - newIndexer.setEnabled(project, indexerSwitch2.getSelection()); - - DependencyManager depManager = CCorePlugin.getDefault().getCoreModel().getDependencyManager(); - depManager.setEnabled(project, dTreeSwitch.getSelection()); +// DependencyManager depManager = CCorePlugin.getDefault().getCoreModel().getDependencyManager(); +// depManager.setEnabled(project, dTreeSwitch.getSelection()); } } public void performDefaults() { if (getContainer().getProject() != null) { - indexerSwitch.setSelection(false); indexerSwitch2.setSelection(false); dTreeSwitch.setSelection(false); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/IndexerBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/IndexerBlock.java deleted file mode 100644 index 1d09f8ac68a..00000000000 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/IndexerBlock.java +++ /dev/null @@ -1,128 +0,0 @@ -package org.eclipse.cdt.ui.wizards; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.index.IndexModel; -import org.eclipse.cdt.internal.core.search.indexing.IndexManager; -import org.eclipse.cdt.internal.core.sourcedependency.DependencyManager; -import org.eclipse.cdt.utils.ui.swt.IValidation; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -/** - * @deprecated - */ - -public class IndexerBlock implements IWizardTab { - private Button indexerSwitch; - private Button indexerSwitch2; - private Button dTreeSwitch; - IProject project; - IValidation page; - - public IndexerBlock(IValidation valid, IProject p) { - page = valid; - project = p; - } - - /** - * @see org.eclipse.cdt.ui.wizards.IWizardTab#getControl(Composite) - */ - public Composite getControl(Composite parent) { - Composite composite= new Composite(parent, SWT.NONE); - GridLayout grid = new GridLayout(); - grid.numColumns = 1; - composite.setLayout(grid); - - IndexModel indexer = CCorePlugin.getDefault().getIndexModel(); - - indexerSwitch = new Button(composite, SWT.CHECK | SWT.RIGHT); - indexerSwitch.setAlignment(SWT.LEFT); - indexerSwitch.setText("Enable CTAGS indexing service for this project"); - indexerSwitch.setSelection(indexer.isEnabled(project)); - - indexerSwitch2 = new Button(composite, SWT.CHECK | SWT.RIGHT); - indexerSwitch2.setAlignment(SWT.LEFT); - indexerSwitch2.setText("Enable NEW indexing service for this project"); - indexerSwitch2.setSelection(false); - - dTreeSwitch = new Button(composite, SWT.CHECK | SWT.RIGHT); - dTreeSwitch.setAlignment(SWT.LEFT); - dTreeSwitch.setText("Enable dependency tree service for this project"); - dTreeSwitch.setSelection(false); - - return composite; - } - - /** - * @see org.eclipse.cdt.ui.wizards.IWizardTab#doRun(IProject, IProgressMonitor) - */ - public void doRun(IProject project, IProgressMonitor monitor) { - IndexModel indexer = CCorePlugin.getDefault().getIndexModel(); - indexer.setEnabled(project, indexerSwitch.getSelection()); - - IndexManager newIndexer = CCorePlugin.getDefault().getCoreModel().getIndexManager(); - newIndexer.setEnabled(project, indexerSwitch2.getSelection()); - - DependencyManager depManager = CCorePlugin.getDefault().getCoreModel().getDependencyManager(); - depManager.setEnabled(project, dTreeSwitch.getSelection()); - } - - - /** - * @see org.eclipse.cdt.ui.wizards.IWizardTab#getImage() - */ - public Image getImage() { - return null; - } - - /** - * @see org.eclipse.cdt.ui.wizards.IWizardTab#getLabel() - */ - public String getLabel() { - return "Indexer"; - } - - /** - * @see org.eclipse.cdt.ui.wizards.IWizardTab#isValid() - */ - public boolean isValid() { - return true; - } - - /** - * @see org.eclipse.cdt.ui.wizards.IWizardTab#setVisible(boolean) - */ - public void setVisible(boolean visible) { - IndexModel indexer = CCorePlugin.getDefault().getIndexModel(); - IndexManager newIndexer = CCorePlugin.getDefault().getCoreModel().getIndexManager(); - - if (indexerSwitch != null) { - //indexerSwitch.setAlignment(SWT.LEFT); - //indexerSwitch.setText("Enable indexing service for this project"); - indexerSwitch.setSelection(indexer.isEnabled(project)); - } - - if (indexerSwitch2 != null) { - indexerSwitch2.setSelection(newIndexer.isEnabled(project)); - } - - DependencyManager depManager = CCorePlugin.getDefault().getCoreModel().getDependencyManager(); - - if (dTreeSwitch != null) { - dTreeSwitch.setSelection(depManager.isEnabled(project)); - } - - - } - -}