1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Fix for 67656: [Indexer] getting called twice after creating a project with a file system

This commit is contained in:
Bogdan Gheorghe 2004-06-29 06:42:47 +00:00
parent 79ddb1f030
commit c59364cdd5
9 changed files with 39 additions and 27 deletions

View file

@ -221,7 +221,7 @@ import org.eclipse.core.runtime.Platform;
PathCollector pathCollector = new PathCollector();
getTableRefs(dH, pathCollector);
String[] dHModel = {IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest2.cpp", IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest.cpp"};
String[] dHModel = {IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest2.cpp", IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest.cpp", IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest2.h"};
String[] iPath = pathCollector.getPaths();
if (dHModel.length != iPath.length)
@ -238,7 +238,7 @@ import org.eclipse.core.runtime.Platform;
pathCollector = new PathCollector();
getTableRefs(Inc1H, pathCollector);
String[] Inc1HModel = {IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest.cpp"};
String[] Inc1HModel = {IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest.cpp",IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest.h"};
iPath = pathCollector.getPaths();
if (Inc1HModel.length != iPath.length)
@ -283,22 +283,23 @@ import org.eclipse.core.runtime.Platform;
getTableRefs(Inc1H, pathCollector);
iPath = pathCollector.getPaths();
compareArrays(iPath,beforeModel);
String[] inc1Model = {Path.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest.cpp",Path.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest.h"};
compareArrays(iPath,inc1Model);
pathCollector = new PathCollector();
getTableRefs(aH, pathCollector);
iPath = pathCollector.getPaths();
compareArrays(iPath,beforeModel);
compareArrays(iPath,inc1Model);
pathCollector = new PathCollector();
getTableRefs(cH, pathCollector);
iPath = pathCollector.getPaths();
compareArrays(iPath,beforeModel);
String[] cHModel = {Path.SEPARATOR + "DepTestProject" + Path.SEPARATOR + "Inc1.h", Path.SEPARATOR + "DepTestProject" + Path.SEPARATOR + "DepTest.cpp", Path.SEPARATOR + "DepTestProject" + Path.SEPARATOR + "a.h", Path.SEPARATOR + "DepTestProject" + Path.SEPARATOR + "DepTest.h"};
compareArrays(iPath,cHModel);
editCode(depTestC,"#include \"DepTest.h\"","//#include \"DepTest.h\"");
@ -324,7 +325,7 @@ import org.eclipse.core.runtime.Platform;
iPath = pathCollector.getPaths();
if (iPath.length != 0)
if (iPath.length != 1)
fail("Number of included files differs from model");
pathCollector = new PathCollector();
@ -332,7 +333,7 @@ import org.eclipse.core.runtime.Platform;
iPath = pathCollector.getPaths();
if (iPath.length != 0)
if (iPath.length != 1)
fail("Number of included files differs from model");
@ -341,7 +342,7 @@ import org.eclipse.core.runtime.Platform;
iPath = pathCollector.getPaths();
if (iPath.length != 0)
if (iPath.length != 3)
fail("Number of included files differs from model");
}
@ -492,7 +493,8 @@ import org.eclipse.core.runtime.Platform;
IFile depTest3C = importFile("DepTest3.cpp","resources/dependency/DepTest3.cpp");
String[] beforeModel = {Path.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest3.cpp"};
String[] cHModel = {Path.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest3.cpp", IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "a.h", IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest3.h"};
String[] aHModel = {Path.SEPARATOR + "DepTestProject" + Path.SEPARATOR + "DepTest3.cpp", Path.SEPARATOR + "DepTestProject" + Path.SEPARATOR + "DepTest3.h"};
PathCollector pathCollector = new PathCollector();
getTableRefs(depTest3H, pathCollector);
@ -505,14 +507,14 @@ import org.eclipse.core.runtime.Platform;
iPath = pathCollector.getPaths();
compareArrays(iPath,beforeModel);
compareArrays(iPath,cHModel);
pathCollector = new PathCollector();
getTableRefs(aH, pathCollector);
iPath = pathCollector.getPaths();
compareArrays(iPath,beforeModel);
compareArrays(iPath,aHModel);
editCode(aH,"#include \"c.h\"","//#include \"c.h\"");
@ -537,7 +539,7 @@ import org.eclipse.core.runtime.Platform;
iPath = pathCollector.getPaths();
compareArrays(iPath,beforeModel);
compareArrays(iPath,aHModel);
}
@ -579,7 +581,7 @@ import org.eclipse.core.runtime.Platform;
resultSet = resultCollector.getSearchResults();
if (resultSet.size() != 0)
if (resultSet.size() != 1)
fail("Expected no matches");
}

View file

@ -206,7 +206,7 @@ public class IndexManagerTests extends TestCase {
ind = indexManager.getIndex(testProjectPath,true,true);
char[] prefix = "typeDecl/C/CDocumentManager".toCharArray();
String [] entryResultModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 1 }"};
String [] entryResultModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 1, 2 }"};
IEntryResult[] eresults =ind.queryEntries(prefix);
assertTrue("Entry Result exists", eresults != null);
@ -271,7 +271,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 }", "EntryResult: word=typeDecl/D/Mail, refs={ 2 }", "EntryResult: word=typeDecl/D/first_class, refs={ 2 }", "EntryResult: word=typeDecl/D/postcard, refs={ 2 }", "EntryResult: word=typeDecl/V/, refs={ 1 }", "EntryResult: word=typeDecl/V/PO_Box, refs={ 2 }", "EntryResult: word=typeDecl/V/index, refs={ 2 }", "EntryResult: word=typeDecl/V/mail, refs={ 2 }", "EntryResult: word=typeDecl/V/size, refs={ 2 }", "EntryResult: word=typeDecl/V/temp, refs={ 2 }", "EntryResult: word=typeDecl/V/x, refs={ 2 }"};
String [] entryResultBeforeModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 1, 2 }", "EntryResult: word=typeDecl/C/Mail, refs={ 3 }", "EntryResult: word=typeDecl/C/Unknown, refs={ 3 }", "EntryResult: word=typeDecl/C/container, refs={ 3 }", "EntryResult: word=typeDecl/C/first_class, refs={ 3 }", "EntryResult: word=typeDecl/C/postcard, refs={ 3 }", "EntryResult: word=typeDecl/D/Mail, refs={ 3 }", "EntryResult: word=typeDecl/D/first_class, refs={ 3 }", "EntryResult: word=typeDecl/D/postcard, refs={ 3 }", "EntryResult: word=typeDecl/V/, refs={ 1, 2 }", "EntryResult: word=typeDecl/V/PO_Box, refs={ 3 }", "EntryResult: word=typeDecl/V/index, refs={ 3 }", "EntryResult: word=typeDecl/V/mail, refs={ 3 }", "EntryResult: word=typeDecl/V/size, refs={ 3 }", "EntryResult: word=typeDecl/V/temp, refs={ 3 }", "EntryResult: word=typeDecl/V/x, refs={ 3 }"};
if (eresults.length != entryResultBeforeModel.length)
fail("Entry Result length different from model");
@ -291,7 +291,7 @@ public class IndexManagerTests extends TestCase {
eresults = ind.queryEntries(prefix);
assertTrue("Entry exists", eresults != null);
String [] entryResultAfterModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 1 }", "EntryResult: word=typeDecl/V/, refs={ 1 }"};
String [] entryResultAfterModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 1, 2 }", "EntryResult: word=typeDecl/V/, refs={ 1, 2 }"};
if (eresults.length != entryResultAfterModel.length)
fail("Entry Result length different from model");

View file

@ -1,3 +1,6 @@
2004-06-28 Bogdan Gheorghe
Fix for 67656: [Indexer] getting called twice after creating a project with a file system
* model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java
2004-06-28 Alain Magloire
Possible fix for 68665

View file

@ -1,3 +1,6 @@
2004-06-28 Bogdan Gheorghe
Fix for Bug 60948: indexer should pick up all headers in include path
2004-06-25 Bogdan Gheorghe
Indirect fix for Bug 65551: [Search] Search for Variable references should not include parameters
Instead of excluding parameter references from searches, added parm declarations to the index (for

View file

@ -468,10 +468,12 @@ public abstract class AbstractIndexer implements IIndexer, IIndexConstants, ICSe
public boolean shouldIndex(IFile fileToBeIndexed) {
if (fileToBeIndexed != null){
ICFileType type = CCorePlugin.getDefault().getFileType(fileToBeIndexed.getProject(),fileToBeIndexed.getName());
if (type.isSource()){
if (type.isSource() || type.isHeader()){
String id = type.getId();
if (id.equals(AbstractIndexer.C_SOURCE_ID) ||
id.equals(AbstractIndexer.CPP_SOURCE_ID))
id.equals(AbstractIndexer.CPP_SOURCE_ID) ||
id.equals(AbstractIndexer.C_HEADER_ID) ||
id.equals(AbstractIndexer.CPP_HEADER_ID))
return true;
}
}
@ -566,7 +568,7 @@ public abstract class AbstractIndexer implements IIndexer, IIndexConstants, ICSe
}
else {
//Definitions
return "noEnumtorDefs".toCharArray();
return "noEnumtorDefs".toCharArray(); //$NON-NLS-1$
}
return bestPrefix( prefix, (char)0, enumeratorName, containingTypes, matchMode, isCaseSensitive );

View file

@ -499,6 +499,9 @@ public class DeltaProcessor {
if (element != null) {
updateIndexAddResource(element, delta);
elementAdded(element, delta);
//If new project has been added, don't need to add the children
//as the indexing job will do that for us
if (element.getElementType() == ICElement.C_PROJECT) return false;
}
return true;

View file

@ -105,7 +105,7 @@ public class CSearchPreferencePage extends PreferencePage
}
});
fExternLinks = createComboBox(group,PreferencesMessages.getString("CSearchPreferences.ExternalSearchLinks.EnableMarkerLinkType"),new String[]{PreferencesMessages.getString("CSearchPreferences.ExternalSearchLinks.Visible"),PreferencesMessages.getString("CSearchPreferences.ExternalSearchLinks.Invisible")},PreferencesMessages.getString("CSearchPreferences.ExternalSearchLinks.Invisible")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
fExternLinks = createComboBox(group,PreferencesMessages.getString("CSearchPreferences.ExternalSearchLinks.EnableMarkerLinkType"),new String[]{PreferencesMessages.getString("CSearchPreferences.ExternalSearchLinks.Invisible")},PreferencesMessages.getString("CSearchPreferences.ExternalSearchLinks.Invisible")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
fExternLinks.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}

View file

@ -39,7 +39,6 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.search.ui.IContextMenuConstants;
import org.eclipse.search.ui.NewSearchUI;
import org.eclipse.search.ui.SearchUI;
import org.eclipse.search.ui.text.AbstractTextSearchViewPage;
import org.eclipse.search.ui.text.Match;
import org.eclipse.swt.widgets.Composite;
@ -264,6 +263,9 @@ public class CSearchResultPage extends AbstractTextSearchViewPage {
private IFile getCanonicalFile(IFile originalFile){
if (originalFile == null)
return null;
File tempFile = originalFile.getRawLocation().toFile();
String canonicalPath = null;
try {

View file

@ -100,9 +100,6 @@ public class NewSearchResultCollector extends BasicSearchResultCollector {
linksFile.createLink(externalMatchLocation,IResource.NONE,null);
int number = store.getInt(CSearchPage.EXTERNALMATCH_VISIBLE);
if (number==0){
linksFile.setDerived(true);
}
else{
linksFile.setTeamPrivateMember(true);
}