mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-22 16:35:25 +02:00
Splits option to index all files, bug 266814.
This commit is contained in:
parent
3f794a608f
commit
eea82af3a1
25 changed files with 303 additions and 89 deletions
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Markus Schorn - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.index.tests;
|
package org.eclipse.cdt.internal.index.tests;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -62,6 +72,7 @@ public class Bug246129 extends IndexTestBase {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
if (fProject == null) {
|
if (fProject == null) {
|
||||||
|
@ -131,7 +142,7 @@ public class Bug246129 extends IndexTestBase {
|
||||||
fExternalIncludeFolder.getAbsolutePath() };
|
fExternalIncludeFolder.getAbsolutePath() };
|
||||||
|
|
||||||
IndexerPreferences.set(fProject.getProject(),
|
IndexerPreferences.set(fProject.getProject(),
|
||||||
IndexerPreferences.KEY_INDEX_ALL_FILES, "false");
|
IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, "false");
|
||||||
|
|
||||||
File falseFriendDirectory = new File(fWrapperIncludeFolder
|
File falseFriendDirectory = new File(fWrapperIncludeFolder
|
||||||
.getLocation().toOSString()
|
.getLocation().toOSString()
|
||||||
|
@ -145,6 +156,7 @@ public class Bug246129 extends IndexTestBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
fExternalWrapperHeader.delete();
|
fExternalWrapperHeader.delete();
|
||||||
fExternalWrapperIncludeFolder.delete();
|
fExternalWrapperIncludeFolder.delete();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2008 Symbian Software Systems and others.
|
* Copyright (c) 2006, 2009 Symbian Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -345,7 +345,6 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
pd.setReferencedProjects(refs);
|
pd.setReferencedProjects(refs);
|
||||||
cproject.getProject().setDescription(pd, new NullProgressMonitor());
|
cproject.getProject().setDescription(pd, new NullProgressMonitor());
|
||||||
|
|
||||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, "true");
|
|
||||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
||||||
CCorePlugin.getIndexManager().reindex(cproject);
|
CCorePlugin.getIndexManager().reindex(cproject);
|
||||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
||||||
|
@ -366,7 +365,6 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
String content = testData[0].toString();
|
String content = testData[0].toString();
|
||||||
IFile file = TestSourceReader.createFile(referenced.getProject(), new Path("header.h"), content);
|
IFile file = TestSourceReader.createFile(referenced.getProject(), new Path("header.h"), content);
|
||||||
|
|
||||||
IndexerPreferences.set(referenced.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, "true");
|
|
||||||
IndexerPreferences.set(referenced.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
IndexerPreferences.set(referenced.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
||||||
CCorePlugin.getIndexManager().reindex(referenced);
|
CCorePlugin.getIndexManager().reindex(referenced);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006, 2009 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -81,11 +81,11 @@ public class IndexIncludeTest extends IndexTestBase {
|
||||||
|
|
||||||
public void testFastIndexer() throws Exception {
|
public void testFastIndexer() throws Exception {
|
||||||
CCorePlugin.getIndexManager().setIndexerId(fProject, IPDOMManager.ID_FAST_INDEXER);
|
CCorePlugin.getIndexManager().setIndexerId(fProject, IPDOMManager.ID_FAST_INDEXER);
|
||||||
IndexerPreferences.set(fProject.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, "false");
|
IndexerPreferences.set(fProject.getProject(), IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, "false");
|
||||||
waitForIndexer();
|
waitForIndexer();
|
||||||
checkHeader(false);
|
checkHeader(false);
|
||||||
|
|
||||||
IndexerPreferences.set(fProject.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, "true");
|
IndexerPreferences.set(fProject.getProject(), IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, "true");
|
||||||
waitForIndexer();
|
waitForIndexer();
|
||||||
checkHeader(true);
|
checkHeader(true);
|
||||||
|
|
||||||
|
@ -98,11 +98,11 @@ public class IndexIncludeTest extends IndexTestBase {
|
||||||
|
|
||||||
public void testFullIndexer() throws Exception {
|
public void testFullIndexer() throws Exception {
|
||||||
CCorePlugin.getIndexManager().setIndexerId(fProject, IPDOMManager.ID_FULL_INDEXER);
|
CCorePlugin.getIndexManager().setIndexerId(fProject, IPDOMManager.ID_FULL_INDEXER);
|
||||||
IndexerPreferences.set(fProject.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, "false");
|
IndexerPreferences.set(fProject.getProject(), IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, "false");
|
||||||
waitForIndexer();
|
waitForIndexer();
|
||||||
checkHeader(false);
|
checkHeader(false);
|
||||||
|
|
||||||
IndexerPreferences.set(fProject.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, "true");
|
IndexerPreferences.set(fProject.getProject(), IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, "true");
|
||||||
waitForIndexer();
|
waitForIndexer();
|
||||||
checkHeader(true);
|
checkHeader(true);
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ public class IndexIncludeTest extends IndexTestBase {
|
||||||
TestSourceReader.createFile(fProject.getProject(), "included_20070404.h", content1);
|
TestSourceReader.createFile(fProject.getProject(), "included_20070404.h", content1);
|
||||||
TestSourceReader.createFile(fProject.getProject(), "notIncluded_20070404.h", "int notIncluded_20070404\n;");
|
TestSourceReader.createFile(fProject.getProject(), "notIncluded_20070404.h", "int notIncluded_20070404\n;");
|
||||||
TestSourceReader.createFile(fProject.getProject(), "includer_20070404.cpp", content3);
|
TestSourceReader.createFile(fProject.getProject(), "includer_20070404.cpp", content3);
|
||||||
IndexerPreferences.set(fProject.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, "false");
|
IndexerPreferences.set(fProject.getProject(), IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, "false");
|
||||||
CCorePlugin.getIndexManager().reindex(fProject);
|
CCorePlugin.getIndexManager().reindex(fProject);
|
||||||
waitForIndexer();
|
waitForIndexer();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2007 Symbian Software Systems and others.
|
* Copyright (c) 2006, 2009 Symbian Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -39,6 +39,7 @@ public class TrilogyPerformanceTest extends IndexTestBase {
|
||||||
super("TrilogyPerformance");
|
super("TrilogyPerformance");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
Bundle b = CTestPlugin.getDefault().getBundle();
|
Bundle b = CTestPlugin.getDefault().getBundle();
|
||||||
|
@ -47,6 +48,7 @@ public class TrilogyPerformanceTest extends IndexTestBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
cproject.getProject().delete(true, new NullProgressMonitor());
|
cproject.getProject().delete(true, new NullProgressMonitor());
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
|
@ -57,7 +59,7 @@ public class TrilogyPerformanceTest extends IndexTestBase {
|
||||||
if(Platform.getOS().equals(Platform.OS_WIN32)) {
|
if(Platform.getOS().equals(Platform.OS_WIN32)) {
|
||||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
||||||
TestScannerProvider.sIncludes = new String[]{EnvironmentReader.getEnvVar("INETSDK")+"\\Include"};
|
TestScannerProvider.sIncludes = new String[]{EnvironmentReader.getEnvVar("INETSDK")+"\\Include"};
|
||||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, "true");
|
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, "true");
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
CCorePlugin.getIndexManager().reindex(cproject);
|
CCorePlugin.getIndexManager().reindex(cproject);
|
||||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2008 Symbian Software Systems and others.
|
* Copyright (c) 2007, 2009 Symbian Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -64,7 +64,6 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
||||||
for(int i=0; i<contents.length; i++) {
|
for(int i=0; i<contents.length; i++) {
|
||||||
IFile file= TestSourceReader.createFile(cproject.getProject(), new Path("refs.cpp"), contents[i].toString());
|
IFile file= TestSourceReader.createFile(cproject.getProject(), new Path("refs.cpp"), contents[i].toString());
|
||||||
}
|
}
|
||||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, "true");
|
|
||||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
||||||
for(int i=0; i<5 && !CCoreInternals.getPDOMManager().isProjectRegistered(cproject); i++) {
|
for(int i=0; i<5 && !CCoreInternals.getPDOMManager().isProjectRegistered(cproject); i++) {
|
||||||
Thread.sleep(200);
|
Thread.sleep(200);
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
* Copyright (c) 2007, 2009 Symbian Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX - Initial implementation
|
* QNX - Initial implementation
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.pdom.tests;
|
package org.eclipse.cdt.internal.pdom.tests;
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@ public class CPPFunctionTemplateTests extends PDOMTestBase {
|
||||||
for(int i=0; i<contents.length; i++) {
|
for(int i=0; i<contents.length; i++) {
|
||||||
IFile file= TestSourceReader.createFile(cproject.getProject(), new Path("refs.cpp"), contents[i].toString());
|
IFile file= TestSourceReader.createFile(cproject.getProject(), new Path("refs.cpp"), contents[i].toString());
|
||||||
}
|
}
|
||||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, "true");
|
|
||||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
||||||
CCorePlugin.getIndexManager().reindex(cproject);
|
CCorePlugin.getIndexManager().reindex(cproject);
|
||||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005, 2007 IBM Corporation and others.
|
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -88,7 +88,7 @@ public class CProjectHelper {
|
||||||
IWorkspaceRoot root = ws.getRoot();
|
IWorkspaceRoot root = ws.getRoot();
|
||||||
IProject project = root.getProject(projectName);
|
IProject project = root.getProject(projectName);
|
||||||
if (indexerID != null) {
|
if (indexerID != null) {
|
||||||
IndexerPreferences.set(project, IndexerPreferences.KEY_INDEX_ALL_FILES, "true");
|
IndexerPreferences.set(project, IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, "true");
|
||||||
IndexerPreferences.set(project, IndexerPreferences.KEY_INDEXER_ID, indexerID);
|
IndexerPreferences.set(project, IndexerPreferences.KEY_INDEXER_ID, indexerID);
|
||||||
}
|
}
|
||||||
if (!project.exists()) {
|
if (!project.exists()) {
|
||||||
|
@ -169,7 +169,6 @@ public class CProjectHelper {
|
||||||
IWorkspaceRoot root = ws.getRoot();
|
IWorkspaceRoot root = ws.getRoot();
|
||||||
IProject project = root.getProject(projectName);
|
IProject project = root.getProject(projectName);
|
||||||
if (indexerID != null) {
|
if (indexerID != null) {
|
||||||
IndexerPreferences.set(project, IndexerPreferences.KEY_INDEX_ALL_FILES, "true");
|
|
||||||
IndexerPreferences.set(project, IndexerPreferences.KEY_INDEXER_ID, indexerID);
|
IndexerPreferences.set(project, IndexerPreferences.KEY_INDEXER_ID, indexerID);
|
||||||
}
|
}
|
||||||
if (!project.exists()) {
|
if (!project.exists()) {
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
* Copyright (c) 2007, 2009 Symbian Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Andrew Ferguson (Symbian) - Initial implementation
|
* Andrew Ferguson (Symbian) - Initial implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.index.export;
|
package org.eclipse.cdt.core.index.export;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import com.ibm.icu.text.DateFormat;
|
|
||||||
import com.ibm.icu.text.MessageFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
@ -21,6 +19,9 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ibm.icu.text.DateFormat;
|
||||||
|
import com.ibm.icu.text.MessageFormat;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||||
import org.eclipse.cdt.core.index.IIndexLocationConverter;
|
import org.eclipse.cdt.core.index.IIndexLocationConverter;
|
||||||
|
@ -154,8 +155,9 @@ public class ExternalExportProjectProvider extends AbstractExportProjectProvider
|
||||||
|
|
||||||
newProject[0]= cproject;
|
newProject[0]= cproject;
|
||||||
|
|
||||||
IndexerPreferences.set(newProject[0].getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, Boolean.TRUE.toString());
|
|
||||||
IndexerPreferences.set(newProject[0].getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_NO_INDEXER);
|
IndexerPreferences.set(newProject[0].getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_NO_INDEXER);
|
||||||
|
IndexerPreferences.set(newProject[0].getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, Boolean.TRUE.toString());
|
||||||
|
IndexerPreferences.set(newProject[0].getProject(), IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, Boolean.TRUE.toString());
|
||||||
}
|
}
|
||||||
}, null);
|
}, null);
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class StandaloneIndexerInputAdapter extends IndexerInputAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractLanguage[] getLanguages(Object tu) {
|
public AbstractLanguage[] getLanguages(Object tu, boolean bothForHeaders) {
|
||||||
ILanguage language = fIndexer.getLanguageMapper().getLanguage((String) tu);
|
ILanguage language = fIndexer.getLanguageMapper().getLanguage((String) tu);
|
||||||
if (language instanceof AbstractLanguage) {
|
if (language instanceof AbstractLanguage) {
|
||||||
return new AbstractLanguage[] {(AbstractLanguage) language};
|
return new AbstractLanguage[] {(AbstractLanguage) language};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006, 2009 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -9,10 +9,8 @@
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
* IBM Corporation
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.indexer;
|
package org.eclipse.cdt.internal.core.indexer;
|
||||||
|
|
||||||
import com.ibm.icu.text.MessageFormat;
|
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -29,6 +27,8 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
|
||||||
|
import com.ibm.icu.text.MessageFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A task for index updates.
|
* A task for index updates.
|
||||||
*
|
*
|
||||||
|
@ -58,11 +58,11 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
|
||||||
|
|
||||||
if (getIndexAllFiles()) {
|
if (getIndexAllFiles()) {
|
||||||
setIndexFilesWithoutBuildConfiguration(true);
|
setIndexFilesWithoutBuildConfiguration(true);
|
||||||
setIndexHeadersWithoutContext(true);
|
setIndexHeadersWithoutContext(UnusedHeaderStrategy.useDefaultLanguage);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setIndexFilesWithoutBuildConfiguration(false);
|
setIndexFilesWithoutBuildConfiguration(false);
|
||||||
setIndexHeadersWithoutContext(false);
|
setIndexHeadersWithoutContext(UnusedHeaderStrategy.skip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,10 @@ import org.eclipse.osgi.util.NLS;
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractIndexerTask extends PDOMWriter {
|
public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
|
protected static enum UnusedHeaderStrategy {
|
||||||
|
skip, useDefaultLanguage, useAlternateLanguage, useBoth
|
||||||
|
}
|
||||||
|
|
||||||
private static final int MAX_ERRORS = 500;
|
private static final int MAX_ERRORS = 500;
|
||||||
|
|
||||||
private static class FileKey {
|
private static class FileKey {
|
||||||
|
@ -157,7 +161,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
protected enum MessageKind {parsingFileTask, errorWhileParsing, tooManyIndexProblems}
|
protected enum MessageKind {parsingFileTask, errorWhileParsing, tooManyIndexProblems}
|
||||||
|
|
||||||
private int fUpdateFlags= IIndexManager.UPDATE_ALL;
|
private int fUpdateFlags= IIndexManager.UPDATE_ALL;
|
||||||
private boolean fIndexHeadersWithoutContext= true;
|
private UnusedHeaderStrategy fIndexHeadersWithoutContext= UnusedHeaderStrategy.useDefaultLanguage;
|
||||||
private boolean fIndexFilesWithoutConfiguration= true;
|
private boolean fIndexFilesWithoutConfiguration= true;
|
||||||
private HashMap<FileKey, FileContent> fFileInfos= new HashMap<FileKey, FileContent>();
|
private HashMap<FileKey, FileContent> fFileInfos= new HashMap<FileKey, FileContent>();
|
||||||
|
|
||||||
|
@ -180,12 +184,18 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
updateRequestedFiles(fFilesToUpdate.length + fFilesToRemove.size());
|
updateRequestedFiles(fFilesToUpdate.length + fFilesToRemove.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setIndexHeadersWithoutContext(boolean val) {
|
public final void setIndexHeadersWithoutContext(UnusedHeaderStrategy mode) {
|
||||||
fIndexHeadersWithoutContext= val;
|
fIndexHeadersWithoutContext= mode;
|
||||||
}
|
}
|
||||||
public final void setIndexFilesWithoutBuildConfiguration(boolean val) {
|
public final void setIndexFilesWithoutBuildConfiguration(boolean val) {
|
||||||
fIndexFilesWithoutConfiguration= val;
|
fIndexFilesWithoutConfiguration= val;
|
||||||
}
|
}
|
||||||
|
public UnusedHeaderStrategy getIndexHeadersWithoutContext() {
|
||||||
|
return fIndexHeadersWithoutContext;
|
||||||
|
}
|
||||||
|
public boolean indexFilesWithoutConfiguration() {
|
||||||
|
return fIndexFilesWithoutConfiguration;
|
||||||
|
}
|
||||||
public final void setUpdateFlags(int flags) {
|
public final void setUpdateFlags(int flags) {
|
||||||
fUpdateFlags= flags;
|
fUpdateFlags= flags;
|
||||||
}
|
}
|
||||||
|
@ -271,7 +281,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
|
|
||||||
public final void runTask(IProgressMonitor monitor) throws InterruptedException {
|
public final void runTask(IProgressMonitor monitor) throws InterruptedException {
|
||||||
if (!fIndexFilesWithoutConfiguration) {
|
if (!fIndexFilesWithoutConfiguration) {
|
||||||
fIndexHeadersWithoutContext= false;
|
fIndexHeadersWithoutContext= UnusedHeaderStrategy.skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
fIndex= createIndex();
|
fIndex= createIndex();
|
||||||
|
@ -334,9 +344,9 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
final boolean isExcludedSource= isSourceUnit && !fIndexFilesWithoutConfiguration && !fResolver.isFileBuildConfigured(tu);
|
final boolean isExcludedSource= isSourceUnit && !fIndexFilesWithoutConfiguration && !fResolver.isFileBuildConfigured(tu);
|
||||||
final IIndexFragmentFile[] indexFiles= fIndex.getWritableFiles(ifl);
|
final IIndexFragmentFile[] indexFiles= fIndex.getWritableFiles(ifl);
|
||||||
|
|
||||||
if ((isSourceUnit && !isExcludedSource) || fIndexHeadersWithoutContext) {
|
if ((isSourceUnit && !isExcludedSource) || fIndexHeadersWithoutContext != UnusedHeaderStrategy.skip) {
|
||||||
// headers or sources required with a specific linkage
|
// headers or sources required with a specific linkage
|
||||||
AbstractLanguage[] langs= fResolver.getLanguages(tu);
|
AbstractLanguage[] langs= fResolver.getLanguages(tu, fIndexHeadersWithoutContext==UnusedHeaderStrategy.useBoth);
|
||||||
for (AbstractLanguage lang : langs) {
|
for (AbstractLanguage lang : langs) {
|
||||||
int linkageID = lang.getLinkageID();
|
int linkageID = lang.getLinkageID();
|
||||||
IIndexFragmentFile ifile= getFile(linkageID, indexFiles);
|
IIndexFragmentFile ifile= getFile(linkageID, indexFiles);
|
||||||
|
@ -641,7 +651,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
private void parseFile(Object tu, int linkageID, IIndexFileLocation ifl, IScannerInfo scanInfo,
|
private void parseFile(Object tu, int linkageID, IIndexFileLocation ifl, IScannerInfo scanInfo,
|
||||||
IProgressMonitor pm) throws CoreException, InterruptedException {
|
IProgressMonitor pm) throws CoreException, InterruptedException {
|
||||||
IPath path= getPathForLabel(ifl);
|
IPath path= getPathForLabel(ifl);
|
||||||
AbstractLanguage[] langs= fResolver.getLanguages(tu);
|
AbstractLanguage[] langs= fResolver.getLanguages(tu, fIndexHeadersWithoutContext==UnusedHeaderStrategy.useBoth);
|
||||||
AbstractLanguage lang= null;
|
AbstractLanguage lang= null;
|
||||||
for (AbstractLanguage lang2 : langs) {
|
for (AbstractLanguage lang2 : langs) {
|
||||||
if (lang2.getLinkageID() == linkageID) {
|
if (lang2.getLinkageID() == linkageID) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -58,7 +58,7 @@ public abstract class IndexerInputAdapter extends ASTFilePathResolver {
|
||||||
/**
|
/**
|
||||||
* Obtains the languages the input file should be parsed with.
|
* Obtains the languages the input file should be parsed with.
|
||||||
*/
|
*/
|
||||||
public abstract AbstractLanguage[] getLanguages(Object tu);
|
public abstract AbstractLanguage[] getLanguages(Object tu, boolean bothForHeaders);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtains the scanner configuration for the input file.
|
* Obtains the scanner configuration for the input file.
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Markus Schorn - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.core.pdom;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
||||||
|
import org.eclipse.cdt.core.dom.IPDOMIndexerTask;
|
||||||
|
import org.eclipse.cdt.internal.core.model.CModelManager;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.ProjectScope;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
import org.eclipse.core.runtime.content.IContentType;
|
||||||
|
import org.eclipse.core.runtime.content.IContentTypeManager.ContentTypeChangeEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Task to notify the CModel manager of changes to the content types.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class NotifyCModelManagerTask implements IPDOMIndexerTask {
|
||||||
|
private final IProject fProject;
|
||||||
|
|
||||||
|
public NotifyCModelManagerTask(IProject prj) {
|
||||||
|
fProject= prj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IPDOMIndexer getIndexer() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexerProgress getProgressInformation() {
|
||||||
|
return new IndexerProgress();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run(IProgressMonitor monitor) throws InterruptedException {
|
||||||
|
IContentType ct1= Platform.getContentTypeManager().getContentType(CCorePlugin.CONTENT_TYPE_CXXHEADER);
|
||||||
|
IContentType ct2= Platform.getContentTypeManager().getContentType(CCorePlugin.CONTENT_TYPE_CXXSOURCE);
|
||||||
|
if (ct1 != null && ct2 != null) {
|
||||||
|
final ProjectScope scope = new ProjectScope(fProject);
|
||||||
|
CModelManager.getDefault().contentTypeChanged(new ContentTypeChangeEvent[] {
|
||||||
|
new ContentTypeChangeEvent(ct1, scope),
|
||||||
|
new ContentTypeChangeEvent(ct2, scope)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX - Initial API and implementation
|
* Doug Schaefer (QNX) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
|
@ -21,7 +21,6 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
import com.ibm.icu.text.MessageFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -33,6 +32,8 @@ import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.ibm.icu.text.MessageFormat;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.CCorePreferenceConstants;
|
import org.eclipse.cdt.core.CCorePreferenceConstants;
|
||||||
import org.eclipse.cdt.core.dom.ILinkage;
|
import org.eclipse.cdt.core.dom.ILinkage;
|
||||||
|
@ -73,6 +74,7 @@ import org.eclipse.cdt.internal.core.pdom.PDOM.IListener;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.ChunkCache;
|
import org.eclipse.cdt.internal.core.pdom.db.ChunkCache;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMLinkageFactory;
|
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMLinkageFactory;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMProjectIndexLocationConverter;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMProjectIndexLocationConverter;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.indexer.AbstractPDOMIndexer;
|
||||||
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
||||||
import org.eclipse.cdt.internal.core.pdom.indexer.PDOMNullIndexer;
|
import org.eclipse.cdt.internal.core.pdom.indexer.PDOMNullIndexer;
|
||||||
import org.eclipse.cdt.internal.core.pdom.indexer.PDOMRebuildTask;
|
import org.eclipse.cdt.internal.core.pdom.indexer.PDOMRebuildTask;
|
||||||
|
@ -113,8 +115,6 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChange
|
||||||
* The PDOM Provider. This is likely temporary since I hope
|
* The PDOM Provider. This is likely temporary since I hope
|
||||||
* to integrate the PDOM directly into the core once it has
|
* to integrate the PDOM directly into the core once it has
|
||||||
* stabilized.
|
* stabilized.
|
||||||
*
|
|
||||||
* @author Doug Schaefer
|
|
||||||
*/
|
*/
|
||||||
public class PDOMManager implements IWritableIndexManager, IListener {
|
public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
private static final class PerInstanceSchedulingRule implements ISchedulingRule {
|
private static final class PerInstanceSchedulingRule implements ISchedulingRule {
|
||||||
|
@ -483,6 +483,12 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
IPDOMIndexer indexer= createIndexer(cproject, newid, props);
|
IPDOMIndexer indexer= createIndexer(cproject, newid, props);
|
||||||
registerIndexer(cproject, indexer);
|
registerIndexer(cproject, indexer);
|
||||||
createPolicy(cproject).clearTUs();
|
createPolicy(cproject).clearTUs();
|
||||||
|
if (oldIndexer instanceof AbstractPDOMIndexer) {
|
||||||
|
if (IndexerPreferences.preferDefaultLanguage(((AbstractPDOMIndexer) oldIndexer).getProperties()) !=
|
||||||
|
IndexerPreferences.preferDefaultLanguage(props)) {
|
||||||
|
enqueue(new NotifyCModelManagerTask(cproject.getProject()));
|
||||||
|
}
|
||||||
|
}
|
||||||
enqueue(new PDOMRebuildTask(indexer));
|
enqueue(new PDOMRebuildTask(indexer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,9 @@ public abstract class AbstractPDOMIndexer implements IPDOMIndexer {
|
||||||
protected Properties fProperties= new Properties();
|
protected Properties fProperties= new Properties();
|
||||||
|
|
||||||
public AbstractPDOMIndexer() {
|
public AbstractPDOMIndexer() {
|
||||||
|
fProperties.put(IndexerPreferences.KEY_INDEX_ALL_FILES, String.valueOf(true));
|
||||||
|
fProperties.put(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, String.valueOf(false));
|
||||||
|
fProperties.put(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG, String.valueOf(false));
|
||||||
fProperties.put(IndexerPreferences.KEY_INDEX_ALL_FILES, String.valueOf(false));
|
fProperties.put(IndexerPreferences.KEY_INDEX_ALL_FILES, String.valueOf(false));
|
||||||
fProperties.put(IndexerPreferences.KEY_INCLUDE_HEURISTICS, String.valueOf(true));
|
fProperties.put(IndexerPreferences.KEY_INCLUDE_HEURISTICS, String.valueOf(true));
|
||||||
fProperties.put(IndexerPreferences.KEY_FILES_TO_PARSE_UP_FRONT, ""); //$NON-NLS-1$
|
fProperties.put(IndexerPreferences.KEY_FILES_TO_PARSE_UP_FRONT, ""); //$NON-NLS-1$
|
||||||
|
@ -60,6 +63,10 @@ public abstract class AbstractPDOMIndexer implements IPDOMIndexer {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Properties getProperties() {
|
||||||
|
return fProperties;
|
||||||
|
}
|
||||||
|
|
||||||
public void setProperties(Properties props) {
|
public void setProperties(Properties props) {
|
||||||
// only set relevant properties as initialized in the constructor
|
// only set relevant properties as initialized in the constructor
|
||||||
|
|
|
@ -45,6 +45,8 @@ public class IndexerPreferences {
|
||||||
|
|
||||||
public static final String KEY_INDEXER_ID= "indexerId"; //$NON-NLS-1$
|
public static final String KEY_INDEXER_ID= "indexerId"; //$NON-NLS-1$
|
||||||
public static final String KEY_INDEX_ALL_FILES= "indexAllFiles"; //$NON-NLS-1$
|
public static final String KEY_INDEX_ALL_FILES= "indexAllFiles"; //$NON-NLS-1$
|
||||||
|
public static final String KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG= "indexUnusedHeadersWithDefaultLang"; //$NON-NLS-1$
|
||||||
|
public static final String KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG= "indexUnusedHeadersWithAlternateLang"; //$NON-NLS-1$
|
||||||
public static final String KEY_INCLUDE_HEURISTICS= "useHeuristicIncludeResolution"; //$NON-NLS-1$
|
public static final String KEY_INCLUDE_HEURISTICS= "useHeuristicIncludeResolution"; //$NON-NLS-1$
|
||||||
public static final String KEY_FILES_TO_PARSE_UP_FRONT= "filesToParseUpFront"; //$NON-NLS-1$
|
public static final String KEY_FILES_TO_PARSE_UP_FRONT= "filesToParseUpFront"; //$NON-NLS-1$
|
||||||
public static final String KEY_SKIP_ALL_REFERENCES= "skipReferences"; //$NON-NLS-1$
|
public static final String KEY_SKIP_ALL_REFERENCES= "skipReferences"; //$NON-NLS-1$
|
||||||
|
@ -159,11 +161,23 @@ public class IndexerPreferences {
|
||||||
public static Properties getProperties(IProject project, int scope) {
|
public static Properties getProperties(IProject project, int scope) {
|
||||||
Preferences[] prefs= getPreferences(project, scope);
|
Preferences[] prefs= getPreferences(project, scope);
|
||||||
Properties props= new Properties();
|
Properties props= new Properties();
|
||||||
for (int i=prefs.length-1; i>=0; i--) {
|
for (int i=0; i<prefs.length; i++) {
|
||||||
readProperties(prefs[i], props);
|
readProperties(prefs[i], props);
|
||||||
|
if (i==0) {
|
||||||
|
migrateProperties(props);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void migrateProperties(Properties props) {
|
||||||
|
if (props.get(KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG) == null) {
|
||||||
|
// backward compatibility
|
||||||
|
if ("true".equals(props.get(KEY_INDEX_ALL_FILES))) { //$NON-NLS-1$
|
||||||
|
props.put(KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, "true"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static Properties getDefaultIndexerProperties() {
|
public static Properties getDefaultIndexerProperties() {
|
||||||
Preferences prefs= getDefaultPreferences();
|
Preferences prefs= getDefaultPreferences();
|
||||||
|
@ -289,9 +303,11 @@ public class IndexerPreferences {
|
||||||
String[] keys = preferences.keys();
|
String[] keys = preferences.keys();
|
||||||
for (int i=0; i < keys.length; i++) {
|
for (int i=0; i < keys.length; i++) {
|
||||||
String key= keys[i];
|
String key= keys[i];
|
||||||
String val= preferences.get(key, null);
|
if (props.get(key) == null) {
|
||||||
if (val != null) {
|
String val= preferences.get(key, null);
|
||||||
props.put(key, val);
|
if (val != null) {
|
||||||
|
props.put(key, val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (BackingStoreException e) {
|
} catch (BackingStoreException e) {
|
||||||
|
@ -301,7 +317,9 @@ public class IndexerPreferences {
|
||||||
public static void initializeDefaultPreferences(IEclipsePreferences defaultPreferences) {
|
public static void initializeDefaultPreferences(IEclipsePreferences defaultPreferences) {
|
||||||
Preferences prefs= defaultPreferences.node(INDEXER_NODE);
|
Preferences prefs= defaultPreferences.node(INDEXER_NODE);
|
||||||
prefs.put(KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
prefs.put(KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
||||||
prefs.putBoolean(KEY_INDEX_ALL_FILES, false);
|
prefs.putBoolean(KEY_INDEX_ALL_FILES, true);
|
||||||
|
prefs.putBoolean(KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, false);
|
||||||
|
prefs.putBoolean(KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG, false);
|
||||||
prefs.putBoolean(KEY_INCLUDE_HEURISTICS, true);
|
prefs.putBoolean(KEY_INCLUDE_HEURISTICS, true);
|
||||||
prefs.putBoolean(KEY_SKIP_ALL_REFERENCES, false);
|
prefs.putBoolean(KEY_SKIP_ALL_REFERENCES, false);
|
||||||
prefs.putBoolean(KEY_SKIP_IMPLICIT_REFERENCES, false);
|
prefs.putBoolean(KEY_SKIP_IMPLICIT_REFERENCES, false);
|
||||||
|
@ -399,4 +417,28 @@ public class IndexerPreferences {
|
||||||
}
|
}
|
||||||
return DEFAULT_UPDATE_POLICY;
|
return DEFAULT_UPDATE_POLICY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean preferDefaultLanguage(IProject project) {
|
||||||
|
IPreferencesService prefService = Platform.getPreferencesService();
|
||||||
|
Preferences[] prefs= IndexerPreferences.getPreferences(project);
|
||||||
|
if ("true".equals(prefService.get(KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG, null, prefs))) { //$NON-NLS-1$
|
||||||
|
if ("true".equals(prefService.get(KEY_INDEX_ALL_FILES, null, prefs))) { //$NON-NLS-1$
|
||||||
|
if (!"true".equals(prefService.get(KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, null, prefs))) { //$NON-NLS-1$
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean preferDefaultLanguage(Properties props) {
|
||||||
|
if ("true".equals(props.get(KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG))) { //$NON-NLS-1$
|
||||||
|
if ("true".equals(props.get(KEY_INDEX_ALL_FILES))) { //$NON-NLS-1$
|
||||||
|
if (!"true".equals(props.get(KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG))) { //$NON-NLS-1$
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@ package org.eclipse.cdt.internal.core.pdom.indexer;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ibm.icu.text.NumberFormat;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ILinkage;
|
import org.eclipse.cdt.core.dom.ILinkage;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
||||||
|
@ -44,8 +46,6 @@ import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.content.IContentType;
|
import org.eclipse.core.runtime.content.IContentType;
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
import com.ibm.icu.text.NumberFormat;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the abstract indexer task suitable for indexing projects.
|
* Configures the abstract indexer task suitable for indexing projects.
|
||||||
*/
|
*/
|
||||||
|
@ -82,13 +82,20 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
setSkipReferences(skipRefs);
|
setSkipReferences(skipRefs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getIndexAllFiles()) {
|
if (checkProperty(IndexerPreferences.KEY_INDEX_ALL_FILES)) {
|
||||||
setIndexFilesWithoutBuildConfiguration(true);
|
setIndexFilesWithoutBuildConfiguration(true);
|
||||||
setIndexHeadersWithoutContext(true);
|
boolean i1= checkProperty(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG);
|
||||||
}
|
boolean i2= checkProperty(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG);
|
||||||
else {
|
UnusedHeaderStrategy strategy;
|
||||||
|
if (i1) {
|
||||||
|
strategy= i2 ? UnusedHeaderStrategy.useBoth : UnusedHeaderStrategy.useDefaultLanguage;
|
||||||
|
} else {
|
||||||
|
strategy= i2 ? UnusedHeaderStrategy.useAlternateLanguage: UnusedHeaderStrategy.skip;
|
||||||
|
}
|
||||||
|
setIndexHeadersWithoutContext(strategy);
|
||||||
|
} else {
|
||||||
setIndexFilesWithoutBuildConfiguration(false);
|
setIndexFilesWithoutBuildConfiguration(false);
|
||||||
setIndexHeadersWithoutContext(false);
|
setIndexHeadersWithoutContext(UnusedHeaderStrategy.skip);
|
||||||
}
|
}
|
||||||
setUpdateFlags(IIndexManager.UPDATE_CHECK_TIMESTAMPS);
|
setUpdateFlags(IIndexManager.UPDATE_CHECK_TIMESTAMPS);
|
||||||
setForceFirstFiles(forceFiles.length);
|
setForceFirstFiles(forceFiles.length);
|
||||||
|
@ -127,10 +134,6 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
return internallyActivated || (trace != null && trace.equalsIgnoreCase(value));
|
return internallyActivated || (trace != null && trace.equalsIgnoreCase(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean getIndexAllFiles() {
|
|
||||||
return checkProperty(IndexerPreferences.KEY_INDEX_ALL_FILES);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean checkProperty(String key) {
|
private boolean checkProperty(String key) {
|
||||||
return TRUE.equals(getIndexer().getProperty(key));
|
return TRUE.equals(getIndexer().getProperty(key));
|
||||||
}
|
}
|
||||||
|
@ -253,14 +256,14 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
System.out.println("C/C++ Indexer: Project '" + getProject().getElementName() //$NON-NLS-1$
|
System.out.println("C/C++ Indexer: Project '" + getProject().getElementName() //$NON-NLS-1$
|
||||||
+ "' (" + info.fCompletedSources + " sources, " //$NON-NLS-1$//$NON-NLS-2$
|
+ "' (" + info.fCompletedSources + " sources, " //$NON-NLS-1$//$NON-NLS-2$
|
||||||
+ info.fCompletedHeaders + " headers)"); //$NON-NLS-1$
|
+ info.fCompletedHeaders + " headers)"); //$NON-NLS-1$
|
||||||
boolean allFiles= getIndexAllFiles();
|
|
||||||
boolean skipRefs= checkProperty(IndexerPreferences.KEY_SKIP_ALL_REFERENCES);
|
boolean skipRefs= checkProperty(IndexerPreferences.KEY_SKIP_ALL_REFERENCES);
|
||||||
boolean skipImplRefs= skipRefs || checkProperty(IndexerPreferences.KEY_SKIP_IMPLICIT_REFERENCES);
|
boolean skipImplRefs= skipRefs || checkProperty(IndexerPreferences.KEY_SKIP_IMPLICIT_REFERENCES);
|
||||||
boolean skipTypeRefs= skipRefs || checkProperty(IndexerPreferences.KEY_SKIP_TYPE_REFERENCES);
|
boolean skipTypeRefs= skipRefs || checkProperty(IndexerPreferences.KEY_SKIP_TYPE_REFERENCES);
|
||||||
boolean skipMacroRefs= skipRefs || checkProperty(IndexerPreferences.KEY_SKIP_MACRO_REFERENCES);
|
boolean skipMacroRefs= skipRefs || checkProperty(IndexerPreferences.KEY_SKIP_MACRO_REFERENCES);
|
||||||
System.out.println(ident + " Options: " //$NON-NLS-1$
|
System.out.println(ident + " Options: " //$NON-NLS-1$
|
||||||
+ "indexer='" + kind //$NON-NLS-1$
|
+ "indexer='" + kind //$NON-NLS-1$
|
||||||
+ "', parseAllFiles=" + allFiles //$NON-NLS-1$
|
+ "', parseAllFiles=" + indexFilesWithoutConfiguration() //$NON-NLS-1$
|
||||||
|
+ ", unusedHeaders=" + getIndexHeadersWithoutContext() //$NON-NLS-1$
|
||||||
+ ", skipReferences=" + skipRefs //$NON-NLS-1$
|
+ ", skipReferences=" + skipRefs //$NON-NLS-1$
|
||||||
+ ", skipImplicitReferences=" + skipImplRefs //$NON-NLS-1$
|
+ ", skipImplicitReferences=" + skipImplRefs //$NON-NLS-1$
|
||||||
+ ", skipTypeReferences=" + skipTypeRefs //$NON-NLS-1$
|
+ ", skipTypeReferences=" + skipTypeRefs //$NON-NLS-1$
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -101,7 +101,9 @@ public class PDOMRebuildTask implements IPDOMIndexerTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createDelegate(ICProject project, IProgressMonitor monitor) throws CoreException {
|
private void createDelegate(ICProject project, IProgressMonitor monitor) throws CoreException {
|
||||||
boolean allFiles= TRUE.equals(fIndexer.getProperty(IndexerPreferences.KEY_INDEX_ALL_FILES));
|
boolean allFiles =
|
||||||
|
TRUE.equals(fIndexer.getProperty(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG)) ||
|
||||||
|
TRUE.equals(fIndexer.getProperty(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG));
|
||||||
List<ITranslationUnit> sources= new ArrayList<ITranslationUnit>();
|
List<ITranslationUnit> sources= new ArrayList<ITranslationUnit>();
|
||||||
List<ITranslationUnit> headers= allFiles ? sources : null;
|
List<ITranslationUnit> headers= allFiles ? sources : null;
|
||||||
TranslationUnitCollector collector= new TranslationUnitCollector(sources, headers, monitor);
|
TranslationUnitCollector collector= new TranslationUnitCollector(sources, headers, monitor);
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.cdt.core.model.CoreModelUtil;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.model.ILanguage;
|
import org.eclipse.cdt.core.model.ILanguage;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
|
import org.eclipse.cdt.core.model.LanguageManager;
|
||||||
import org.eclipse.cdt.core.parser.CodeReader;
|
import org.eclipse.cdt.core.parser.CodeReader;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||||
import org.eclipse.cdt.core.parser.ScannerInfo;
|
import org.eclipse.cdt.core.parser.ScannerInfo;
|
||||||
|
@ -43,6 +44,8 @@ public class ProjectIndexerInputAdapter extends IndexerInputAdapter {
|
||||||
private final ICProject fCProject;
|
private final ICProject fCProject;
|
||||||
private final HashMap<String, IIndexFileLocation> fIflCache;
|
private final HashMap<String, IIndexFileLocation> fIflCache;
|
||||||
private final FileExistsCache fExistsCache;
|
private final FileExistsCache fExistsCache;
|
||||||
|
private AbstractLanguage fLangC;
|
||||||
|
private AbstractLanguage fLangCpp;
|
||||||
|
|
||||||
public ProjectIndexerInputAdapter(ICProject cproject) {
|
public ProjectIndexerInputAdapter(ICProject cproject) {
|
||||||
this(cproject, true);
|
this(cproject, true);
|
||||||
|
@ -53,11 +56,18 @@ public class ProjectIndexerInputAdapter extends IndexerInputAdapter {
|
||||||
if (useCache) {
|
if (useCache) {
|
||||||
fIflCache= new HashMap<String, IIndexFileLocation>();
|
fIflCache= new HashMap<String, IIndexFileLocation>();
|
||||||
fExistsCache= new FileExistsCache();
|
fExistsCache= new FileExistsCache();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
fIflCache= null;
|
fIflCache= null;
|
||||||
fExistsCache= null;
|
fExistsCache= null;
|
||||||
}
|
}
|
||||||
|
ILanguage l= LanguageManager.getInstance().getLanguageForContentTypeID(CCorePlugin.CONTENT_TYPE_CHEADER);
|
||||||
|
if (l instanceof AbstractLanguage) {
|
||||||
|
fLangC= (AbstractLanguage) l;
|
||||||
|
}
|
||||||
|
l= LanguageManager.getInstance().getLanguageForContentTypeID(CCorePlugin.CONTENT_TYPE_CXXHEADER);
|
||||||
|
if (l instanceof AbstractLanguage) {
|
||||||
|
fLangCpp= (AbstractLanguage) l;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -151,11 +161,22 @@ public class ProjectIndexerInputAdapter extends IndexerInputAdapter {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractLanguage[] getLanguages(Object tuo) {
|
public AbstractLanguage[] getLanguages(Object tuo, boolean bothForHeaders) {
|
||||||
ITranslationUnit tu= (ITranslationUnit) tuo;
|
ITranslationUnit tu= (ITranslationUnit) tuo;
|
||||||
try {
|
try {
|
||||||
ILanguage lang= tu.getLanguage();
|
ILanguage lang= tu.getLanguage();
|
||||||
if (lang instanceof AbstractLanguage) {
|
if (lang instanceof AbstractLanguage) {
|
||||||
|
if (bothForHeaders && tu.isHeaderUnit()) {
|
||||||
|
String filename= tu.getElementName();
|
||||||
|
if (filename.indexOf('.') >= 0) {
|
||||||
|
final String contentTypeId= tu.getContentTypeId();
|
||||||
|
if (contentTypeId.equals(CCorePlugin.CONTENT_TYPE_CXXHEADER) && fLangC != null) {
|
||||||
|
return new AbstractLanguage[] {(AbstractLanguage) lang, fLangC};
|
||||||
|
} else if (contentTypeId.equals(CCorePlugin.CONTENT_TYPE_CHEADER) && fLangCpp != null) {
|
||||||
|
return new AbstractLanguage[] {(AbstractLanguage) lang, fLangCpp};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return new AbstractLanguage[] {(AbstractLanguage) lang};
|
return new AbstractLanguage[] {(AbstractLanguage) lang};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006, 2009 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.ProjectScope;
|
import org.eclipse.core.resources.ProjectScope;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -52,7 +53,9 @@ public class CContentTypes {
|
||||||
if (usesProjectSpecificContentTypes(project)) {
|
if (usesProjectSpecificContentTypes(project)) {
|
||||||
scopeCtx= new ProjectScope(project);
|
scopeCtx= new ProjectScope(project);
|
||||||
}
|
}
|
||||||
preferCpp= CoreModel.hasCCNature(project) || !CoreModel.hasCNature(project);
|
if (CoreModel.hasCNature(project)) {
|
||||||
|
preferCpp= CoreModel.hasCCNature(project) == IndexerPreferences.preferDefaultLanguage(project);
|
||||||
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
// fallback to workspace wide definitions.
|
// fallback to workspace wide definitions.
|
||||||
matcher= Platform.getContentTypeManager();
|
matcher= Platform.getContentTypeManager();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006, 2009 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -23,8 +23,6 @@ import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.TestScannerProvider;
|
import org.eclipse.cdt.core.testplugin.TestScannerProvider;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
|
||||||
|
|
||||||
|
|
||||||
public class BasicIncludeBrowserTest extends IncludeBrowserBaseTest {
|
public class BasicIncludeBrowserTest extends IncludeBrowserBaseTest {
|
||||||
|
|
||||||
|
@ -74,7 +72,6 @@ public class BasicIncludeBrowserTest extends IncludeBrowserBaseTest {
|
||||||
public void testInclusionAccrossProjects() throws Exception {
|
public void testInclusionAccrossProjects() throws Exception {
|
||||||
ICProject op= CProjectHelper.createCCProject("__ibTest_other__", "bin", IPDOMManager.ID_FAST_INDEXER);
|
ICProject op= CProjectHelper.createCCProject("__ibTest_other__", "bin", IPDOMManager.ID_FAST_INDEXER);
|
||||||
try {
|
try {
|
||||||
IndexerPreferences.set(op.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, "true");
|
|
||||||
fIndex= CCorePlugin.getIndexManager().getIndex(new ICProject[] {getProject(), op});
|
fIndex= CCorePlugin.getIndexManager().getIndex(new ICProject[] {getProject(), op});
|
||||||
|
|
||||||
TestScannerProvider.sIncludes= new String[]{op.getProject().getLocation().toOSString()};
|
TestScannerProvider.sIncludes= new String[]{op.getProject().getLocation().toOSString()};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -79,7 +79,7 @@ import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
||||||
import org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable;
|
import org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable;
|
||||||
import org.eclipse.cdt.internal.core.model.ext.CElementHandleFactory;
|
import org.eclipse.cdt.internal.core.model.ext.CElementHandleFactory;
|
||||||
import org.eclipse.cdt.internal.core.model.ext.ICElementHandle;
|
import org.eclipse.cdt.internal.core.model.ext.ICElementHandle;
|
||||||
|
@ -429,7 +429,7 @@ public class IndexUI {
|
||||||
node= ((IASTFunctionDefinition) node).getDeclarator();
|
node= ((IASTFunctionDefinition) node).getDeclarator();
|
||||||
}
|
}
|
||||||
if (node instanceof IASTDeclarator) {
|
if (node instanceof IASTDeclarator) {
|
||||||
IASTDeclarator dtor= CPPVisitor.findTypeRelevantDeclarator((IASTDeclarator) node);
|
IASTDeclarator dtor= ASTQueries.findTypeRelevantDeclarator((IASTDeclarator) node);
|
||||||
name= dtor.getName();
|
name= dtor.getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -457,9 +457,11 @@ public class IndexUI {
|
||||||
IResource res= tu.getResource();
|
IResource res= tu.getResource();
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
Properties props= IndexerPreferences.getProperties(res.getProject());
|
Properties props= IndexerPreferences.getProperties(res.getProject());
|
||||||
if (props == null || !"true".equals(props.get(IndexerPreferences.KEY_INDEX_ALL_FILES))) { //$NON-NLS-1$
|
if (props == null || !"true".equals(props.get(IndexerPreferences.KEY_INDEX_ALL_FILES)) || //$NON-NLS-1$
|
||||||
|
(!"true".equals(props.get(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG)) && //$NON-NLS-1$
|
||||||
|
!"true".equals(props.get(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG)))) { //$NON-NLS-1$
|
||||||
msg= msg+ " " + Messages.IndexUI_infoSelectIndexAllFiles; //$NON-NLS-1$
|
msg= msg+ " " + Messages.IndexUI_infoSelectIndexAllFiles; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.model.CProject;
|
||||||
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +36,9 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
|
||||||
protected static final String INDEX_ALL_FILES = DialogsMessages.AbstractIndexerPage_indexAllFiles;
|
protected static final String INDEX_ALL_FILES = DialogsMessages.AbstractIndexerPage_indexAllFiles;
|
||||||
protected static final String TRUE = String.valueOf(true);
|
protected static final String TRUE = String.valueOf(true);
|
||||||
|
|
||||||
private Button fAllFiles;
|
private Button fAllSources;
|
||||||
|
private Button fAllHeadersDefault;
|
||||||
|
private Button fAllHeadersAlt;
|
||||||
private Button fIncludeHeuristics;
|
private Button fIncludeHeuristics;
|
||||||
private Text fFilesToParseUpFront;
|
private Text fFilesToParseUpFront;
|
||||||
private Button fSkipReferences;
|
private Button fSkipReferences;
|
||||||
|
@ -58,7 +61,14 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
|
||||||
@Override
|
@Override
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
Composite page = ControlFactory.createComposite(parent, 1);
|
Composite page = ControlFactory.createComposite(parent, 1);
|
||||||
fAllFiles= createAllFilesButton(page);
|
fAllSources= createAllFilesButton(page);
|
||||||
|
IProject prj= getCurrentProject();
|
||||||
|
if (prj == null || !CProject.hasCCNature(prj)) {
|
||||||
|
fAllHeadersDefault= createAllHeadersButton(page);
|
||||||
|
} else {
|
||||||
|
fAllHeadersDefault= createAllCppHeadersButton(page);
|
||||||
|
fAllHeadersAlt= createAllCHeadersButton(page);
|
||||||
|
}
|
||||||
fIncludeHeuristics= createIncludeHeuristicsButton(page);
|
fIncludeHeuristics= createIncludeHeuristicsButton(page);
|
||||||
fSkipReferences= createSkipReferencesButton(page);
|
fSkipReferences= createSkipReferencesButton(page);
|
||||||
fSkipImplicitReferences= createSkipImplicitReferencesButton(page);
|
fSkipImplicitReferences= createSkipImplicitReferencesButton(page);
|
||||||
|
@ -66,12 +76,14 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
|
||||||
fSkipMacroReferences= createSkipMacroReferencesButton(page);
|
fSkipMacroReferences= createSkipMacroReferencesButton(page);
|
||||||
fFilesToParseUpFront= createParseUpFrontTextField(page);
|
fFilesToParseUpFront= createParseUpFrontTextField(page);
|
||||||
|
|
||||||
fSkipReferences.addSelectionListener(new SelectionAdapter() {
|
final SelectionAdapter selectionListener = new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
updateEnablement();
|
updateEnablement();
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
fSkipReferences.addSelectionListener(selectionListener);
|
||||||
|
fAllSources.addSelectionListener(selectionListener);
|
||||||
setControl(page);
|
setControl(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,9 +93,17 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public void setProperties(Properties properties) {
|
public void setProperties(Properties properties) {
|
||||||
if (fAllFiles != null) {
|
if (fAllSources != null) {
|
||||||
boolean indexAllFiles= TRUE.equals(properties.get(IndexerPreferences.KEY_INDEX_ALL_FILES));
|
boolean indexAllFiles= TRUE.equals(properties.get(IndexerPreferences.KEY_INDEX_ALL_FILES));
|
||||||
fAllFiles.setSelection(indexAllFiles);
|
fAllSources.setSelection(indexAllFiles);
|
||||||
|
}
|
||||||
|
if (fAllHeadersDefault != null) {
|
||||||
|
boolean indexAllFiles= TRUE.equals(properties.get(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG));
|
||||||
|
fAllHeadersDefault.setSelection(indexAllFiles);
|
||||||
|
}
|
||||||
|
if (fAllHeadersAlt != null) {
|
||||||
|
boolean indexAllFiles= TRUE.equals(properties.get(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG));
|
||||||
|
fAllHeadersAlt.setSelection(indexAllFiles);
|
||||||
}
|
}
|
||||||
if (fIncludeHeuristics != null) {
|
if (fIncludeHeuristics != null) {
|
||||||
Object prop= properties.get(IndexerPreferences.KEY_INCLUDE_HEURISTICS);
|
Object prop= properties.get(IndexerPreferences.KEY_INCLUDE_HEURISTICS);
|
||||||
|
@ -119,8 +139,14 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
|
||||||
*/
|
*/
|
||||||
public Properties getProperties(){
|
public Properties getProperties(){
|
||||||
Properties props= new Properties();
|
Properties props= new Properties();
|
||||||
if (fAllFiles != null) {
|
if (fAllSources != null) {
|
||||||
props.put(IndexerPreferences.KEY_INDEX_ALL_FILES, String.valueOf(fAllFiles.getSelection()));
|
props.put(IndexerPreferences.KEY_INDEX_ALL_FILES, String.valueOf(fAllSources.getSelection()));
|
||||||
|
}
|
||||||
|
if (fAllHeadersDefault != null) {
|
||||||
|
props.put(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG, String.valueOf(fAllHeadersDefault.getSelection()));
|
||||||
|
}
|
||||||
|
if (fAllHeadersAlt != null) {
|
||||||
|
props.put(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG, String.valueOf(fAllHeadersAlt.getSelection()));
|
||||||
}
|
}
|
||||||
if (fIncludeHeuristics != null) {
|
if (fIncludeHeuristics != null) {
|
||||||
props.put(IndexerPreferences.KEY_INCLUDE_HEURISTICS, String.valueOf(fIncludeHeuristics.getSelection()));
|
props.put(IndexerPreferences.KEY_INCLUDE_HEURISTICS, String.valueOf(fIncludeHeuristics.getSelection()));
|
||||||
|
@ -172,6 +198,15 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
|
||||||
fSkipMacroReferences.setEnabled(!skipReferences);
|
fSkipMacroReferences.setEnabled(!skipReferences);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (fAllSources != null) {
|
||||||
|
final boolean all= fAllSources.getSelection();
|
||||||
|
if (fAllHeadersDefault != null) {
|
||||||
|
fAllHeadersDefault.setEnabled(all);
|
||||||
|
}
|
||||||
|
if (fAllHeadersAlt != null) {
|
||||||
|
fAllHeadersAlt.setEnabled(all);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getNotNull(Properties properties, String key) {
|
private String getNotNull(Properties properties, String key) {
|
||||||
|
@ -189,7 +224,19 @@ public abstract class AbstractIndexerPage extends AbstractCOptionPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Button createAllFilesButton(Composite page) {
|
private Button createAllFilesButton(Composite page) {
|
||||||
return ControlFactory.createCheckBox(page, INDEX_ALL_FILES);
|
return ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_indexAllFiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Button createAllHeadersButton(Composite page) {
|
||||||
|
return ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_indexAllHeaders);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Button createAllCHeadersButton(Composite page) {
|
||||||
|
return ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_indexAllHeadersC);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Button createAllCppHeadersButton(Composite page) {
|
||||||
|
return ControlFactory.createCheckBox(page, DialogsMessages.AbstractIndexerPage_indexAllHeadersCpp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Button createIncludeHeuristicsButton(Composite page) {
|
private Button createIncludeHeuristicsButton(Composite page) {
|
||||||
|
|
|
@ -23,6 +23,12 @@ public class DialogsMessages extends NLS {
|
||||||
/** @since 5.1 */
|
/** @since 5.1 */
|
||||||
public static String AbstractIndexerPage_heuristicIncludes;
|
public static String AbstractIndexerPage_heuristicIncludes;
|
||||||
public static String AbstractIndexerPage_indexAllFiles;
|
public static String AbstractIndexerPage_indexAllFiles;
|
||||||
|
/** @since 5.1 */
|
||||||
|
public static String AbstractIndexerPage_indexAllHeaders;
|
||||||
|
/** @since 5.1 */
|
||||||
|
public static String AbstractIndexerPage_indexAllHeadersC;
|
||||||
|
/** @since 5.1 */
|
||||||
|
public static String AbstractIndexerPage_indexAllHeadersCpp;
|
||||||
public static String AbstractIndexerPage_indexUpFront;
|
public static String AbstractIndexerPage_indexUpFront;
|
||||||
public static String AbstractIndexerPage_skipAllReferences;
|
public static String AbstractIndexerPage_skipAllReferences;
|
||||||
/** @since 5.1 */
|
/** @since 5.1 */
|
||||||
|
|
|
@ -14,7 +14,10 @@ PreferenceScopeBlock_enableProjectSettings=Enable project specific settings
|
||||||
PreferenceScopeBlock_storeWithProject=Store settings with project
|
PreferenceScopeBlock_storeWithProject=Store settings with project
|
||||||
PreferenceScopeBlock_preferenceLink=<a>Configure Workspace Settings...</a>
|
PreferenceScopeBlock_preferenceLink=<a>Configure Workspace Settings...</a>
|
||||||
AbstractIndexerPage_heuristicIncludes=Allow heuristic resolution of includes
|
AbstractIndexerPage_heuristicIncludes=Allow heuristic resolution of includes
|
||||||
AbstractIndexerPage_indexAllFiles=Index all files (files neither built nor included, also)
|
AbstractIndexerPage_indexAllFiles=Index all sources, including files that are not part of the build
|
||||||
|
AbstractIndexerPage_indexAllHeaders=Index unused headers
|
||||||
|
AbstractIndexerPage_indexAllHeadersC=Index unused headers as c-files
|
||||||
|
AbstractIndexerPage_indexAllHeadersCpp=Index unused headers as c++-files
|
||||||
AbstractIndexerPage_skipAllReferences=Skip all references (Call Hierarchy and Search will not work)
|
AbstractIndexerPage_skipAllReferences=Skip all references (Call Hierarchy and Search will not work)
|
||||||
AbstractIndexerPage_skipImplicitReferences=Skip implicit references (e.g. overloaded operators)
|
AbstractIndexerPage_skipImplicitReferences=Skip implicit references (e.g. overloaded operators)
|
||||||
AbstractIndexerPage_skipTypeReferences=Skip type references (Search for type references will not work)
|
AbstractIndexerPage_skipTypeReferences=Skip type references (Search for type references will not work)
|
||||||
|
|
Loading…
Add table
Reference in a new issue