mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
Integrated indexing into PDOM. Also change the names of a couple of things, such as PDOM which used to be PDOMDatabase. Cleaned up the indexing setting so that it is a ProjectScope preference instead of a ICExtension. Conversion should happen automagically.
This commit is contained in:
parent
b224117ea2
commit
487aa70ebc
61 changed files with 522 additions and 467 deletions
|
@ -121,7 +121,7 @@ import org.eclipse.core.runtime.Platform;
|
||||||
if (testProject==null)
|
if (testProject==null)
|
||||||
fail("Unable to create project");
|
fail("Unable to create project");
|
||||||
|
|
||||||
resetIndexer(CCorePlugin.DEFAULT_INDEXER_UNIQ_ID);
|
resetIndexer(DOMSourceIndexer.ID);
|
||||||
//The DOM Source Indexer checks to see if a file has any scanner info
|
//The DOM Source Indexer checks to see if a file has any scanner info
|
||||||
//set prior to indexing it in order to increase efficiency. We need to let it know
|
//set prior to indexing it in order to increase efficiency. We need to let it know
|
||||||
//that it is running in test mode in order to allow for this scanner info test to be skipped
|
//that it is running in test mode in order to allow for this scanner info test to be skipped
|
||||||
|
|
|
@ -71,6 +71,7 @@ public class BaseSearchTest extends TestCase implements ICSearchConstants {
|
||||||
try {
|
try {
|
||||||
//Create temp project
|
//Create temp project
|
||||||
testProject = createProject("SearchTestProject");
|
testProject = createProject("SearchTestProject");
|
||||||
|
resetIndexer(DOMSourceIndexer.ID);
|
||||||
|
|
||||||
testProject.setSessionProperty(DOMSourceIndexer.activationKey,new Boolean(true));
|
testProject.setSessionProperty(DOMSourceIndexer.activationKey,new Boolean(true));
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,6 @@ import junit.framework.Test;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.cdescriptor.tests.CDescriptorTests;
|
import org.eclipse.cdt.core.cdescriptor.tests.CDescriptorTests;
|
||||||
import org.eclipse.cdt.core.indexer.tests.DependencyTests;
|
|
||||||
import org.eclipse.cdt.core.indexer.tests.DOMSourceIndexerTests;
|
|
||||||
import org.eclipse.cdt.core.model.tests.AllCoreTests;
|
import org.eclipse.cdt.core.model.tests.AllCoreTests;
|
||||||
import org.eclipse.cdt.core.model.tests.BinaryTests;
|
import org.eclipse.cdt.core.model.tests.BinaryTests;
|
||||||
import org.eclipse.cdt.core.model.tests.ElementDeltaTests;
|
import org.eclipse.cdt.core.model.tests.ElementDeltaTests;
|
||||||
|
@ -30,8 +28,6 @@ import org.eclipse.cdt.core.parser.failedTests.ASTFailedTests;
|
||||||
import org.eclipse.cdt.core.parser.failedTests.FailedCompleteParseASTTest;
|
import org.eclipse.cdt.core.parser.failedTests.FailedCompleteParseASTTest;
|
||||||
import org.eclipse.cdt.core.parser.failedTests.STLFailedTests;
|
import org.eclipse.cdt.core.parser.failedTests.STLFailedTests;
|
||||||
import org.eclipse.cdt.core.parser.tests.ParserTestSuite;
|
import org.eclipse.cdt.core.parser.tests.ParserTestSuite;
|
||||||
import org.eclipse.cdt.core.search.tests.SearchTestSuite;
|
|
||||||
import org.eclipse.cdt.core.tests.RegressionTestSuite;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author vhirsl
|
* @author vhirsl
|
||||||
|
@ -66,12 +62,15 @@ public class AutomatedIntegrationSuite extends TestSuite {
|
||||||
suite.addTest(BinaryTests.suite());
|
suite.addTest(BinaryTests.suite());
|
||||||
suite.addTest(ElementDeltaTests.suite());
|
suite.addTest(ElementDeltaTests.suite());
|
||||||
suite.addTest(WorkingCopyTests.suite());
|
suite.addTest(WorkingCopyTests.suite());
|
||||||
suite.addTest(SearchTestSuite.suite());
|
|
||||||
suite.addTest(DependencyTests.suite());
|
// TODO turning off indexer/search tests until the PDOM
|
||||||
suite.addTest(RegressionTestSuite.suite());
|
// settles. These'll probably have to be rewritten anyway.
|
||||||
|
// suite.addTest(SearchTestSuite.suite());
|
||||||
|
// suite.addTest(DependencyTests.suite());
|
||||||
|
// suite.addTest(RegressionTestSuite.suite());
|
||||||
//Indexer Tests need to be run after any indexer client tests
|
//Indexer Tests need to be run after any indexer client tests
|
||||||
//as the last test shuts down the indexing thread
|
//as the last test shuts down the indexing thread
|
||||||
suite.addTest(DOMSourceIndexerTests.suite());
|
// suite.addTest(DOMSourceIndexerTests.suite());
|
||||||
// Last test to trigger report generation
|
// Last test to trigger report generation
|
||||||
|
|
||||||
// Add all failed tests
|
// Add all failed tests
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.eclipse.cdt.core.ICExtensionReference;
|
||||||
import org.eclipse.cdt.core.IBinaryParser.IBinaryArchive;
|
import org.eclipse.cdt.core.IBinaryParser.IBinaryArchive;
|
||||||
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
|
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
|
||||||
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
|
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
|
||||||
import org.eclipse.cdt.core.dom.PDOM;
|
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ElementChangedEvent;
|
import org.eclipse.cdt.core.model.ElementChangedEvent;
|
||||||
|
@ -1139,7 +1138,7 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
|
||||||
this.getIndexManager().discardJobs(project.getName());
|
this.getIndexManager().discardJobs(project.getName());
|
||||||
// delete the PDOM for this project
|
// delete the PDOM for this project
|
||||||
try {
|
try {
|
||||||
PDOM.deletePDOM(project);
|
CCorePlugin.getPDOMManager().deletePDOM(project);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,6 @@ import org.eclipse.cdt.core.model.IOutputEntry;
|
||||||
import org.eclipse.cdt.core.model.IPathEntry;
|
import org.eclipse.cdt.core.model.IPathEntry;
|
||||||
import org.eclipse.cdt.core.model.ISourceEntry;
|
import org.eclipse.cdt.core.model.ISourceEntry;
|
||||||
import org.eclipse.cdt.core.model.ISourceRoot;
|
import org.eclipse.cdt.core.model.ISourceRoot;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMManager;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -698,7 +697,7 @@ public class CProject extends Openable implements ICProject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPDOM getIndex() {
|
public IPDOM getIndex() {
|
||||||
return PDOMManager.getInstance().getPDOM(getProject());
|
return CCorePlugin.getPDOMManager().getPDOM(getProject());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -687,7 +687,8 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
||||||
|
|
||||||
// Special magic for C/C++ header files
|
// Special magic for C/C++ header files
|
||||||
if (language == null && isHeaderUnit()) {
|
if (language == null && isHeaderUnit()) {
|
||||||
contentType = CoreModel.hasCCNature(getResource().getProject())
|
IResource resource = getResource();
|
||||||
|
contentType = resource != null && CoreModel.hasCCNature(resource.getProject())
|
||||||
? manager.getContentType(CCorePlugin.CONTENT_TYPE_CXXSOURCE)
|
? manager.getContentType(CCorePlugin.CONTENT_TYPE_CXXSOURCE)
|
||||||
: manager.getContentType(CCorePlugin.CONTENT_TYPE_CSOURCE);
|
: manager.getContentType(CCorePlugin.CONTENT_TYPE_CSOURCE);
|
||||||
language = LanguageManager.getInstance().getLanguage(contentType);
|
language = LanguageManager.getInstance().getLanguage(contentType);
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
|
@ -22,7 +23,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
* It provides services to allow access to DOM information
|
* It provides services to allow access to DOM information
|
||||||
* persisted between parses.
|
* persisted between parses.
|
||||||
*/
|
*/
|
||||||
public interface IPDOM {
|
public interface IPDOM extends IAdaptable {
|
||||||
|
|
||||||
public IBinding resolveBinding(IASTName name);
|
public IBinding resolveBinding(IASTName name);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006 QNX Software Systems 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:
|
||||||
|
* QNX - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.core.dom;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Doug Schaefer
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IPDOMManager {
|
||||||
|
|
||||||
|
// Getting and deleting a PDOM for a project
|
||||||
|
public IPDOM getPDOM(IProject project);
|
||||||
|
public void deletePDOM(IProject project) throws CoreException;
|
||||||
|
|
||||||
|
// Getting and setting indexer Ids
|
||||||
|
public String getDefaultIndexerId();
|
||||||
|
public void setDefaultIndexerId(String indexerId);
|
||||||
|
|
||||||
|
public String getIndexerId(IProject project);
|
||||||
|
public void setIndexerId(IProject project, String indexerId);
|
||||||
|
}
|
|
@ -13,8 +13,6 @@ package org.eclipse.cdt.core.dom.ast.gnu.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
||||||
import org.eclipse.cdt.core.dom.IPDOM;
|
|
||||||
import org.eclipse.cdt.core.dom.PDOM;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.model.IContributedModelBuilder;
|
import org.eclipse.cdt.core.model.IContributedModelBuilder;
|
||||||
|
@ -37,8 +35,8 @@ import org.eclipse.cdt.internal.core.dom.parser.c.GNUCSourceParser;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.DOMScanner;
|
import org.eclipse.cdt.internal.core.parser.scanner2.DOMScanner;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.GCCScannerExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.GCCScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerExtensionConfiguration;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMCodeReaderFactory;
|
import org.eclipse.cdt.internal.core.pdom.PDOMCodeReaderFactory;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
|
||||||
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.c.PDOMCLinkageFactory;
|
import org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCLinkageFactory;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
|
@ -97,10 +95,10 @@ public class GCCLanguage extends PlatformObject implements ILanguage {
|
||||||
scanInfo = new ScannerInfo();
|
scanInfo = new ScannerInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
IPDOM pdom = PDOM.getPDOM(project);
|
PDOM pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project).getAdapter(PDOM.class);
|
||||||
ICodeReaderFactory fileCreator;
|
ICodeReaderFactory fileCreator;
|
||||||
if ((style & ILanguage.AST_SKIP_INDEXED_HEADERS) != 0)
|
if ((style & ILanguage.AST_SKIP_INDEXED_HEADERS) != 0)
|
||||||
fileCreator = new PDOMCodeReaderFactory((PDOMDatabase)pdom);
|
fileCreator = new PDOMCodeReaderFactory(pdom);
|
||||||
else
|
else
|
||||||
fileCreator = SavedCodeReaderFactory.getInstance();
|
fileCreator = SavedCodeReaderFactory.getInstance();
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,6 @@ package org.eclipse.cdt.core.dom.ast.gnu.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
||||||
import org.eclipse.cdt.core.dom.IPDOM;
|
|
||||||
import org.eclipse.cdt.core.dom.PDOM;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.model.IContributedModelBuilder;
|
import org.eclipse.cdt.core.model.IContributedModelBuilder;
|
||||||
|
@ -37,8 +35,8 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.GPPParserExtensionConfigurat
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.DOMScanner;
|
import org.eclipse.cdt.internal.core.parser.scanner2.DOMScanner;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.GPPScannerExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.GPPScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerExtensionConfiguration;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMCodeReaderFactory;
|
import org.eclipse.cdt.internal.core.pdom.PDOMCodeReaderFactory;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
|
||||||
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.cpp.PDOMCPPLinkageFactory;
|
import org.eclipse.cdt.internal.core.pdom.dom.cpp.PDOMCPPLinkageFactory;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
|
@ -96,10 +94,10 @@ public class GPPLanguage extends PlatformObject implements ILanguage {
|
||||||
scanInfo = new ScannerInfo();
|
scanInfo = new ScannerInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
IPDOM pdom = PDOM.getPDOM(project);
|
PDOM pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project).getAdapter(PDOM.class);
|
||||||
ICodeReaderFactory fileCreator;
|
ICodeReaderFactory fileCreator;
|
||||||
if ((style & ILanguage.AST_SKIP_INDEXED_HEADERS) != 0)
|
if ((style & ILanguage.AST_SKIP_INDEXED_HEADERS) != 0)
|
||||||
fileCreator = new PDOMCodeReaderFactory((PDOMDatabase)pdom);
|
fileCreator = new PDOMCodeReaderFactory(pdom);
|
||||||
else
|
else
|
||||||
fileCreator = SavedCodeReaderFactory.getInstance();
|
fileCreator = SavedCodeReaderFactory.getInstance();
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import java.util.List;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
||||||
import org.eclipse.cdt.core.dom.IPDOM;
|
import org.eclipse.cdt.core.dom.IPDOM;
|
||||||
|
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
|
@ -37,17 +38,20 @@ import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.PlatformObject;
|
||||||
import org.eclipse.core.runtime.QualifiedName;
|
import org.eclipse.core.runtime.QualifiedName;
|
||||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||||
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The PDOM Database.
|
* The PDOM Database.
|
||||||
*
|
*
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
public class PDOMDatabase implements IPDOM {
|
public class PDOM extends PlatformObject implements IPDOM {
|
||||||
|
|
||||||
private final IProject project;
|
private final IProject project;
|
||||||
|
private IPDOMIndexer indexer;
|
||||||
|
|
||||||
private final IPath dbPath;
|
private final IPath dbPath;
|
||||||
private Database db;
|
private Database db;
|
||||||
|
@ -62,25 +66,40 @@ public class PDOMDatabase implements IPDOM {
|
||||||
private static final QualifiedName dbNameProperty
|
private static final QualifiedName dbNameProperty
|
||||||
= new QualifiedName(CCorePlugin.PLUGIN_ID, "dbName"); //$NON-NLS-1$
|
= new QualifiedName(CCorePlugin.PLUGIN_ID, "dbName"); //$NON-NLS-1$
|
||||||
|
|
||||||
public PDOMDatabase(IProject project, PDOMManager manager) throws CoreException {
|
public PDOM(IProject project, IPDOMIndexer indexer) throws CoreException {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
|
this.indexer = indexer;
|
||||||
|
|
||||||
|
// Load up the database
|
||||||
String dbName = project.getPersistentProperty(dbNameProperty);
|
String dbName = project.getPersistentProperty(dbNameProperty);
|
||||||
if (dbName == null) {
|
if (dbName == null) {
|
||||||
dbName = project.getName() + "_"
|
dbName = project.getName() + "_"
|
||||||
+ System.currentTimeMillis() + ".pdom";
|
+ System.currentTimeMillis() + ".pdom";
|
||||||
project.setPersistentProperty(dbNameProperty, dbName);
|
project.setPersistentProperty(dbNameProperty, dbName);
|
||||||
}
|
}
|
||||||
|
|
||||||
dbPath = CCorePlugin.getDefault().getStateLocation().append(dbName);
|
dbPath = CCorePlugin.getDefault().getStateLocation().append(dbName);
|
||||||
db = new Database(dbPath.toOSString(), VERSION);
|
db = new Database(dbPath.toOSString(), VERSION);
|
||||||
|
|
||||||
|
// Create the appropriate indexer
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getAdapter(Class adapter) {
|
||||||
|
if (adapter == PDOM.class)
|
||||||
|
return this;
|
||||||
|
else
|
||||||
|
return super.getAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IProject getProject() {
|
public IProject getProject() {
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IPDOMIndexer getIndexer() {
|
||||||
|
return indexer;
|
||||||
|
}
|
||||||
|
|
||||||
public static interface IListener {
|
public static interface IListener {
|
||||||
public void handleChange(PDOMDatabase pdom);
|
public void handleChange(PDOM pdom);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List listeners;
|
private List listeners;
|
||||||
|
@ -97,7 +116,7 @@ public class PDOMDatabase implements IPDOM {
|
||||||
listeners.remove(listener);
|
listeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fireChange() {
|
public void fireChange() {
|
||||||
if (listeners == null)
|
if (listeners == null)
|
||||||
return;
|
return;
|
||||||
Iterator i = listeners.iterator();
|
Iterator i = listeners.iterator();
|
||||||
|
@ -118,6 +137,9 @@ public class PDOMDatabase implements IPDOM {
|
||||||
return fileIndex;
|
return fileIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
public void addSymbols(ITranslationUnit tu) throws CoreException {
|
public void addSymbols(ITranslationUnit tu) throws CoreException {
|
||||||
final ILanguage language = tu.getLanguage();
|
final ILanguage language = tu.getLanguage();
|
||||||
if (language == null)
|
if (language == null)
|
||||||
|
@ -154,6 +176,31 @@ public class PDOMDatabase implements IPDOM {
|
||||||
fireChange();
|
fireChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addSymbols(ILanguage language, IASTTranslationUnit ast) throws CoreException {
|
||||||
|
final PDOMLinkage linkage = getLinkage(language);
|
||||||
|
if (linkage == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ast.accept(new ASTVisitor() {
|
||||||
|
{
|
||||||
|
shouldVisitNames = true;
|
||||||
|
shouldVisitDeclarations = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int visit(IASTName name) {
|
||||||
|
try {
|
||||||
|
linkage.addName(name);
|
||||||
|
return PROCESS_CONTINUE;
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
return PROCESS_ABORT;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});;
|
||||||
|
|
||||||
|
fireChange();
|
||||||
|
}
|
||||||
|
|
||||||
public void removeSymbols(ITranslationUnit tu) throws CoreException {
|
public void removeSymbols(ITranslationUnit tu) throws CoreException {
|
||||||
String filename = ((IFile)tu.getResource()).getLocation().toOSString();
|
String filename = ((IFile)tu.getResource()).getLocation().toOSString();
|
||||||
PDOMFile file = PDOMFile.find(this, filename);
|
PDOMFile file = PDOMFile.find(this, filename);
|
||||||
|
@ -251,7 +298,7 @@ public class PDOMDatabase implements IPDOM {
|
||||||
|
|
||||||
// Read-write lock rules. Readers don't conflict with other readers,
|
// Read-write lock rules. Readers don't conflict with other readers,
|
||||||
// Writers conflict with readers, and everyone conflicts with writers.
|
// Writers conflict with readers, and everyone conflicts with writers.
|
||||||
private class ReaderLockRule implements ISchedulingRule {
|
private final ISchedulingRule readerLockRule = new ISchedulingRule() {
|
||||||
public boolean isConflicting(ISchedulingRule rule) {
|
public boolean isConflicting(ISchedulingRule rule) {
|
||||||
if (rule == this)
|
if (rule == this)
|
||||||
return false;
|
return false;
|
||||||
|
@ -263,9 +310,9 @@ public class PDOMDatabase implements IPDOM {
|
||||||
public boolean contains(ISchedulingRule rule) {
|
public boolean contains(ISchedulingRule rule) {
|
||||||
return rule == this;
|
return rule == this;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
private class WriterLockRule implements ISchedulingRule {
|
private final ISchedulingRule writerLockRule = new ISchedulingRule() {
|
||||||
public boolean isConflicting(ISchedulingRule rule) {
|
public boolean isConflicting(ISchedulingRule rule) {
|
||||||
if (rule == this || rule == getReaderLockRule())
|
if (rule == this || rule == getReaderLockRule())
|
||||||
return true;
|
return true;
|
||||||
|
@ -275,10 +322,7 @@ public class PDOMDatabase implements IPDOM {
|
||||||
public boolean contains(ISchedulingRule rule) {
|
public boolean contains(ISchedulingRule rule) {
|
||||||
return rule == this;
|
return rule == this;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
private ReaderLockRule readerLockRule = new ReaderLockRule();
|
|
||||||
private WriterLockRule writerLockRule = new WriterLockRule();
|
|
||||||
|
|
||||||
public ISchedulingRule getReaderLockRule() {
|
public ISchedulingRule getReaderLockRule() {
|
||||||
return readerLockRule;
|
return readerLockRule;
|
||||||
|
@ -288,4 +332,7 @@ public class PDOMDatabase implements IPDOM {
|
||||||
return writerLockRule;
|
return writerLockRule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These are really only recommendations
|
||||||
|
public static final int READER_PRIORITY = Job.SHORT;
|
||||||
|
public static final int WRITER_PRIORITY = Job.LONG;
|
||||||
}
|
}
|
|
@ -33,14 +33,14 @@ import org.eclipse.core.runtime.Status;
|
||||||
*/
|
*/
|
||||||
public class PDOMCodeReaderFactory implements ICodeReaderFactory {
|
public class PDOMCodeReaderFactory implements ICodeReaderFactory {
|
||||||
|
|
||||||
private final PDOMDatabase pdom;
|
private final PDOM pdom;
|
||||||
private List workingCopies;
|
private List workingCopies;
|
||||||
|
|
||||||
public PDOMCodeReaderFactory(PDOMDatabase pdom) {
|
public PDOMCodeReaderFactory(PDOM pdom) {
|
||||||
this.pdom = pdom;
|
this.pdom = pdom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCodeReaderFactory(PDOMDatabase pdom, IWorkingCopy workingCopy) {
|
public PDOMCodeReaderFactory(PDOM pdom, IWorkingCopy workingCopy) {
|
||||||
this(pdom);
|
this(pdom);
|
||||||
workingCopies = new ArrayList(1);
|
workingCopies = new ArrayList(1);
|
||||||
workingCopies.add(workingCopy);
|
workingCopies.add(workingCopy);
|
||||||
|
|
|
@ -20,19 +20,19 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
*/
|
*/
|
||||||
public class PDOMLanguage {
|
public class PDOMLanguage {
|
||||||
|
|
||||||
private PDOMDatabase pdom;
|
private PDOM pdom;
|
||||||
private int record;
|
private int record;
|
||||||
|
|
||||||
private static final int NEXT = 0; // int
|
private static final int NEXT = 0; // int
|
||||||
private static final int ID = 4; // char
|
private static final int ID = 4; // char
|
||||||
private static final int NAME = 6; // string
|
private static final int NAME = 6; // string
|
||||||
|
|
||||||
public PDOMLanguage(PDOMDatabase pdom, int record) {
|
public PDOMLanguage(PDOM pdom, int record) {
|
||||||
this.pdom = pdom;
|
this.pdom = pdom;
|
||||||
this.record = record;
|
this.record = record;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMLanguage(PDOMDatabase pdom, String name, int id, int next) throws CoreException {
|
public PDOMLanguage(PDOM pdom, String name, int id, int next) throws CoreException {
|
||||||
this.pdom = pdom;
|
this.pdom = pdom;
|
||||||
Database db = pdom.getDB();
|
Database db = pdom.getDB();
|
||||||
record = db.malloc(6 + (name.length() + 1) * 2);
|
record = db.malloc(6 + (name.length() + 1) * 2);
|
||||||
|
|
|
@ -11,14 +11,29 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom;
|
package org.eclipse.cdt.internal.core.pdom;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.ICDescriptor;
|
||||||
|
import org.eclipse.cdt.core.ICExtensionReference;
|
||||||
import org.eclipse.cdt.core.dom.IPDOM;
|
import org.eclipse.cdt.core.dom.IPDOM;
|
||||||
|
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
||||||
|
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||||
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ElementChangedEvent;
|
import org.eclipse.cdt.core.model.ElementChangedEvent;
|
||||||
import org.eclipse.cdt.core.model.IElementChangedListener;
|
import org.eclipse.cdt.core.model.IElementChangedListener;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.ProjectScope;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
|
import org.eclipse.core.runtime.IExtension;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.QualifiedName;
|
import org.eclipse.core.runtime.QualifiedName;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
||||||
import org.eclipse.core.runtime.jobs.IJobChangeListener;
|
import org.eclipse.core.runtime.jobs.IJobChangeListener;
|
||||||
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||||
|
import org.eclipse.core.runtime.preferences.IPreferencesService;
|
||||||
|
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||||
|
import org.osgi.service.prefs.BackingStoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The PDOM Provider. This is likely temporary since I hope
|
* The PDOM Provider. This is likely temporary since I hope
|
||||||
|
@ -27,26 +42,19 @@ import org.eclipse.core.runtime.jobs.IJobChangeListener;
|
||||||
*
|
*
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
public class PDOMManager implements IElementChangedListener, IJobChangeListener {
|
public class PDOMManager implements IPDOMManager, IElementChangedListener, IJobChangeListener {
|
||||||
|
|
||||||
private static PDOMManager instance;
|
|
||||||
private PDOMUpdator currJob;
|
private PDOMUpdator currJob;
|
||||||
|
|
||||||
private static final QualifiedName pdomProperty
|
private static final QualifiedName pdomProperty
|
||||||
= new QualifiedName(CCorePlugin.PLUGIN_ID, "pdom"); //$NON-NLS-1$
|
= new QualifiedName(CCorePlugin.PLUGIN_ID, "pdom"); //$NON-NLS-1$
|
||||||
|
|
||||||
public static PDOMManager getInstance() {
|
|
||||||
if (instance == null)
|
|
||||||
instance = new PDOMManager();
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IPDOM getPDOM(IProject project) {
|
public IPDOM getPDOM(IProject project) {
|
||||||
try {
|
try {
|
||||||
IPDOM pdom = (IPDOM)project.getSessionProperty(pdomProperty);
|
IPDOM pdom = (IPDOM)project.getSessionProperty(pdomProperty);
|
||||||
|
|
||||||
if (pdom == null) {
|
if (pdom == null) {
|
||||||
pdom = new PDOMDatabase(project, this);
|
pdom = new PDOM(project, createIndexer(project));
|
||||||
project.setSessionProperty(pdomProperty, pdom);
|
project.setSessionProperty(pdomProperty, pdom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,4 +105,86 @@ public class PDOMManager implements IElementChangedListener, IJobChangeListener
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String INDEXER_ID_KEY = "indexerId"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public String getDefaultIndexerId() {
|
||||||
|
IPreferencesService prefService = Platform.getPreferencesService();
|
||||||
|
return prefService.getString(CCorePlugin.PLUGIN_ID, INDEXER_ID_KEY,
|
||||||
|
CCorePlugin.DEFAULT_INDEXER_UNIQ_ID, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultIndexerId(String indexerId) {
|
||||||
|
IEclipsePreferences prefs = new InstanceScope().getNode(CCorePlugin.PLUGIN_ID);
|
||||||
|
if (prefs == null)
|
||||||
|
return; // TODO why would this be null?
|
||||||
|
|
||||||
|
prefs.put(INDEXER_ID_KEY, indexerId);
|
||||||
|
try {
|
||||||
|
prefs.flush();
|
||||||
|
} catch (BackingStoreException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIndexerId(IProject project) {
|
||||||
|
IEclipsePreferences prefs = new ProjectScope(project).getNode(CCorePlugin.PLUGIN_ID);
|
||||||
|
if (prefs == null)
|
||||||
|
return getDefaultIndexerId();
|
||||||
|
|
||||||
|
String indexerId = prefs.get(INDEXER_ID_KEY, null);
|
||||||
|
if (indexerId == null) {
|
||||||
|
// See if it is in the ICDescriptor
|
||||||
|
try {
|
||||||
|
ICDescriptor desc = CCorePlugin.getDefault().getCProjectDescription(project, true);
|
||||||
|
ICExtensionReference[] ref = desc.get(CCorePlugin.INDEXER_UNIQ_ID);
|
||||||
|
if (ref != null && ref.length > 0) {
|
||||||
|
indexerId = ref[0].getID();
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (indexerId == null)
|
||||||
|
// make it the default
|
||||||
|
indexerId = getDefaultIndexerId();
|
||||||
|
|
||||||
|
setIndexerId(project, indexerId);
|
||||||
|
}
|
||||||
|
return indexerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndexerId(IProject project, String indexerId) {
|
||||||
|
IEclipsePreferences prefs = new ProjectScope(project).getNode(CCorePlugin.PLUGIN_ID);
|
||||||
|
if (prefs == null)
|
||||||
|
return; // TODO why would this be null?
|
||||||
|
|
||||||
|
prefs.put(INDEXER_ID_KEY, indexerId);
|
||||||
|
try {
|
||||||
|
prefs.flush();
|
||||||
|
} catch (BackingStoreException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IPDOMIndexer createIndexer(IProject project) throws CoreException {
|
||||||
|
String indexerId = getIndexerId(project);
|
||||||
|
|
||||||
|
// Look up in extension point
|
||||||
|
IExtension indexerExt = Platform.getExtensionRegistry()
|
||||||
|
.getExtension(CCorePlugin.INDEXER_UNIQ_ID, indexerId);
|
||||||
|
IConfigurationElement[] elements = indexerExt.getConfigurationElements();
|
||||||
|
for (int i = 0; i < elements.length; ++i) {
|
||||||
|
IConfigurationElement element = elements[i];
|
||||||
|
if ("run".equals(element.getName())) //$NON-NLS-1$
|
||||||
|
return (IPDOMIndexer)element.createExecutableExtension("class"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID,
|
||||||
|
0, CCorePlugin.getResourceString("indexer.notFound"), null)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Startup the PDOM. This mainly sets us up to handle model
|
||||||
|
* change events.
|
||||||
|
*/
|
||||||
|
public void startup() {
|
||||||
|
CoreModel.getDefault().addElementChangedListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IPDOM;
|
import org.eclipse.cdt.core.dom.IPDOM;
|
||||||
import org.eclipse.cdt.core.dom.PDOM;
|
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ICElementDelta;
|
import org.eclipse.cdt.core.model.ICElementDelta;
|
||||||
|
@ -141,7 +140,7 @@ public class PDOMUpdator extends Job {
|
||||||
private void processDelta(ICElementDelta delta) {
|
private void processDelta(ICElementDelta delta) {
|
||||||
// First make sure this project is PDOMable
|
// First make sure this project is PDOMable
|
||||||
ICElement element = delta.getElement();
|
ICElement element = delta.getElement();
|
||||||
if (element instanceof ICProject && PDOM.getPDOM(((ICProject)element).getProject()) == null)
|
if (element instanceof ICProject && CCorePlugin.getPDOMManager().getPDOM(((ICProject)element).getProject()) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// process the children first
|
// process the children first
|
||||||
|
@ -184,8 +183,6 @@ public class PDOMUpdator extends Job {
|
||||||
|
|
||||||
private void processNewProject(final ICProject project) {
|
private void processNewProject(final ICProject project) {
|
||||||
try {
|
try {
|
||||||
if (!PDOM.isEnabled(project.getProject()))
|
|
||||||
return;
|
|
||||||
project.getProject().accept(new IResourceProxyVisitor() {
|
project.getProject().accept(new IResourceProxyVisitor() {
|
||||||
public boolean visit(IResourceProxy proxy) throws CoreException {
|
public boolean visit(IResourceProxy proxy) throws CoreException {
|
||||||
if (proxy.getType() == IResource.FILE) {
|
if (proxy.getType() == IResource.FILE) {
|
||||||
|
@ -215,30 +212,30 @@ public class PDOMUpdator extends Job {
|
||||||
|
|
||||||
private void processAddedTU(ITranslationUnit tu) throws CoreException {
|
private void processAddedTU(ITranslationUnit tu) throws CoreException {
|
||||||
IPDOM pdom = tu.getCProject().getIndex();
|
IPDOM pdom = tu.getCProject().getIndex();
|
||||||
if (pdom == null || !(pdom instanceof PDOMDatabase))
|
if (pdom == null || !(pdom instanceof PDOM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PDOMDatabase mypdom = (PDOMDatabase)pdom;
|
PDOM mypdom = (PDOM)pdom;
|
||||||
mypdom.addSymbols(tu);
|
mypdom.addSymbols(tu);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processRemovedTU(ITranslationUnit tu) throws CoreException {
|
private void processRemovedTU(ITranslationUnit tu) throws CoreException {
|
||||||
IProject project = tu.getCProject().getProject();
|
IProject project = tu.getCProject().getProject();
|
||||||
IPDOM pdom = PDOM.getPDOM(project);
|
IPDOM pdom = CCorePlugin.getPDOMManager().getPDOM(project);
|
||||||
if (pdom == null || !(pdom instanceof PDOMDatabase))
|
if (pdom == null || !(pdom instanceof PDOM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PDOMDatabase mypdom = (PDOMDatabase)pdom;
|
PDOM mypdom = (PDOM)pdom;
|
||||||
mypdom.removeSymbols(tu);
|
mypdom.removeSymbols(tu);
|
||||||
// TODO delete the file itself from the database
|
// TODO delete the file itself from the database
|
||||||
// the removeSymbols only removes the names in the file
|
// the removeSymbols only removes the names in the file
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processChangedTU(ITranslationUnit tu) throws CoreException {
|
private void processChangedTU(ITranslationUnit tu) throws CoreException {
|
||||||
IPDOM pdom = PDOM.getPDOM(tu.getCProject().getProject());
|
IPDOM pdom = CCorePlugin.getPDOMManager().getPDOM(tu.getCProject().getProject());
|
||||||
if (pdom == null || !(pdom instanceof PDOMDatabase))
|
if (pdom == null || !(pdom instanceof PDOM))
|
||||||
return;
|
return;
|
||||||
PDOMDatabase mypdom = (PDOMDatabase)pdom;
|
PDOM mypdom = (PDOM)pdom;
|
||||||
|
|
||||||
mypdom.removeSymbols(tu);
|
mypdom.removeSymbols(tu);
|
||||||
mypdom.addSymbols(tu);
|
mypdom.addSymbols(tu);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,8 +20,8 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
*/
|
*/
|
||||||
public interface IPDOMLinkageFactory {
|
public interface IPDOMLinkageFactory {
|
||||||
|
|
||||||
public PDOMLinkage getLinkage(PDOMDatabase pdom, int record);
|
public PDOMLinkage getLinkage(PDOM pdom, int record);
|
||||||
|
|
||||||
public PDOMLinkage createLinkage(PDOMDatabase pdom) throws CoreException;
|
public PDOMLinkage createLinkage(PDOM pdom) throws CoreException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ public abstract class PDOMBinding extends PDOMNode implements IBinding {
|
||||||
|
|
||||||
protected static final int RECORD_SIZE = PDOMNode.RECORD_SIZE + 20;
|
protected static final int RECORD_SIZE = PDOMNode.RECORD_SIZE + 20;
|
||||||
|
|
||||||
protected PDOMBinding(PDOMDatabase pdom, PDOMNode parent, IASTName name, int type) throws CoreException {
|
protected PDOMBinding(PDOM pdom, PDOMNode parent, IASTName name, int type) throws CoreException {
|
||||||
super(pdom, parent, name.toCharArray());
|
super(pdom, parent, name.toCharArray());
|
||||||
Database db = pdom.getDB();
|
Database db = pdom.getDB();
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public abstract class PDOMBinding extends PDOMNode implements IBinding {
|
||||||
db.putInt(record + BINDING_TYPE_OFFSET, type);
|
db.putInt(record + BINDING_TYPE_OFFSET, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMBinding(PDOMDatabase pdom, int record) {
|
public PDOMBinding(PDOM pdom, int record) {
|
||||||
super(pdom, record);
|
super(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public abstract class PDOMBinding extends PDOMNode implements IBinding {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getBindingType(PDOMDatabase pdom, int record) throws CoreException {
|
public static int getBindingType(PDOM pdom, int record) throws CoreException {
|
||||||
return pdom.getDB().getInt(record + BINDING_TYPE_OFFSET);
|
return pdom.getDB().getInt(record + BINDING_TYPE_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ public abstract class PDOMBinding extends PDOMNode implements IBinding {
|
||||||
* @return
|
* @return
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public static boolean isOrphaned(PDOMDatabase pdom, int record) throws CoreException {
|
public static boolean isOrphaned(PDOM pdom, int record) throws CoreException {
|
||||||
Database db = pdom.getDB();
|
Database db = pdom.getDB();
|
||||||
return db.getInt(record + FIRST_DECL_OFFSET) == 0
|
return db.getInt(record + FIRST_DECL_OFFSET) == 0
|
||||||
&& db.getInt(record + FIRST_DEF_OFFSET) == 0
|
&& db.getInt(record + FIRST_DEF_OFFSET) == 0
|
||||||
|
|
|
@ -13,12 +13,11 @@ package org.eclipse.cdt.internal.core.pdom.dom;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IPDOM;
|
import org.eclipse.cdt.core.dom.IPDOM;
|
||||||
import org.eclipse.cdt.core.dom.PDOM;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IAdapterFactory;
|
import org.eclipse.core.runtime.IAdapterFactory;
|
||||||
|
|
||||||
|
@ -36,11 +35,11 @@ public class PDOMBindingAdapterFactory implements IAdapterFactory {
|
||||||
IBinding binding = (IBinding)adaptableObject;
|
IBinding binding = (IBinding)adaptableObject;
|
||||||
ICProject[] projects = CoreModel.getDefault().getCModel().getCProjects();
|
ICProject[] projects = CoreModel.getDefault().getCModel().getCProjects();
|
||||||
for (int i = 0; i < projects.length; ++i) {
|
for (int i = 0; i < projects.length; ++i) {
|
||||||
IPDOM ipdom = PDOM.getPDOM(projects[i].getProject());
|
IPDOM ipdom = CCorePlugin.getPDOMManager().getPDOM(projects[i].getProject());
|
||||||
|
|
||||||
if (ipdom == null || !(ipdom instanceof PDOMDatabase))
|
if (ipdom == null || !(ipdom instanceof PDOM))
|
||||||
continue;
|
continue;
|
||||||
PDOMDatabase pdom = (PDOMDatabase)ipdom;
|
PDOM pdom = (PDOM)ipdom;
|
||||||
|
|
||||||
for (PDOMLinkage linkage = pdom.getFirstLinkage(); linkage != null; linkage = linkage.getNextLinkage()) {
|
for (PDOMLinkage linkage = pdom.getFirstLinkage(); linkage != null; linkage = linkage.getNextLinkage()) {
|
||||||
PDOMBinding pdomBinding = linkage.adaptBinding(binding);
|
PDOMBinding pdomBinding = linkage.adaptBinding(binding);
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.BTree;
|
import org.eclipse.cdt.internal.core.pdom.db.BTree;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.IBTreeComparator;
|
import org.eclipse.cdt.internal.core.pdom.db.IBTreeComparator;
|
||||||
|
@ -25,7 +25,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
*/
|
*/
|
||||||
public class PDOMFile {
|
public class PDOMFile {
|
||||||
|
|
||||||
private PDOMDatabase pdom;
|
private PDOM pdom;
|
||||||
private int record;
|
private int record;
|
||||||
|
|
||||||
private static final int FIRST_NAME_OFFSET = 0;
|
private static final int FIRST_NAME_OFFSET = 0;
|
||||||
|
@ -77,7 +77,7 @@ public class PDOMFile {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PDOMFile insert(PDOMDatabase pdom, String filename) throws CoreException {
|
public static PDOMFile insert(PDOM pdom, String filename) throws CoreException {
|
||||||
BTree index = pdom.getFileIndex();
|
BTree index = pdom.getFileIndex();
|
||||||
PDOMFile pdomFile = find(pdom, filename);
|
PDOMFile pdomFile = find(pdom, filename);
|
||||||
if (pdomFile == null) {
|
if (pdomFile == null) {
|
||||||
|
@ -91,13 +91,13 @@ public class PDOMFile {
|
||||||
return pdomFile;
|
return pdomFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PDOMFile find(PDOMDatabase pdom, String filename) throws CoreException {
|
public static PDOMFile find(PDOM pdom, String filename) throws CoreException {
|
||||||
BTree index = pdom.getFileIndex();
|
BTree index = pdom.getFileIndex();
|
||||||
int record = new FindVisitor(pdom.getDB(), filename).findIn(index);
|
int record = new FindVisitor(pdom.getDB(), filename).findIn(index);
|
||||||
return (record != 0) ? new PDOMFile(pdom, record) : null;
|
return (record != 0) ? new PDOMFile(pdom, record) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMFile(PDOMDatabase pdom, int record) {
|
public PDOMFile(PDOM pdom, int record) {
|
||||||
this.pdom = pdom;
|
this.pdom = pdom;
|
||||||
this.record = record;
|
this.record = record;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.BTree;
|
import org.eclipse.cdt.internal.core.pdom.db.BTree;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.IBTreeVisitor;
|
import org.eclipse.cdt.internal.core.pdom.db.IBTreeVisitor;
|
||||||
|
@ -32,11 +32,11 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
public abstract class PDOMLinkage extends PDOMNode {
|
public abstract class PDOMLinkage extends PDOMNode {
|
||||||
|
|
||||||
protected static final class MatchBinding implements IBTreeVisitor {
|
protected static final class MatchBinding implements IBTreeVisitor {
|
||||||
private final PDOMDatabase pdom;
|
private final PDOM pdom;
|
||||||
private final List bindings;
|
private final List bindings;
|
||||||
private final Pattern pattern;
|
private final Pattern pattern;
|
||||||
|
|
||||||
public MatchBinding(PDOMDatabase pdom, String pattern, List bindings) {
|
public MatchBinding(PDOM pdom, String pattern, List bindings) {
|
||||||
this.pdom = pdom;
|
this.pdom = pdom;
|
||||||
this.bindings = bindings;
|
this.bindings = bindings;
|
||||||
this.pattern = Pattern.compile(pattern);
|
this.pattern = Pattern.compile(pattern);
|
||||||
|
@ -66,11 +66,11 @@ public abstract class PDOMLinkage extends PDOMNode {
|
||||||
|
|
||||||
protected static final int RECORD_SIZE = PDOMNode.RECORD_SIZE + 12;
|
protected static final int RECORD_SIZE = PDOMNode.RECORD_SIZE + 12;
|
||||||
|
|
||||||
public PDOMLinkage(PDOMDatabase pdom, int record) {
|
public PDOMLinkage(PDOM pdom, int record) {
|
||||||
super(pdom, record);
|
super(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PDOMLinkage(PDOMDatabase pdom, String languageId, char[] name) throws CoreException {
|
protected PDOMLinkage(PDOM pdom, String languageId, char[] name) throws CoreException {
|
||||||
super(pdom, null, name);
|
super(pdom, null, name);
|
||||||
Database db = pdom.getDB();
|
Database db = pdom.getDB();
|
||||||
|
|
||||||
|
@ -85,13 +85,13 @@ public abstract class PDOMLinkage extends PDOMNode {
|
||||||
return RECORD_SIZE;
|
return RECORD_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getId(PDOMDatabase pdom, int record) throws CoreException {
|
public static String getId(PDOM pdom, int record) throws CoreException {
|
||||||
Database db = pdom.getDB();
|
Database db = pdom.getDB();
|
||||||
int namerec = db.getInt(record + ID_OFFSET);
|
int namerec = db.getInt(record + ID_OFFSET);
|
||||||
return db.getString(namerec);
|
return db.getString(namerec);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getNextLinkageRecord(PDOMDatabase pdom, int record) throws CoreException {
|
public static int getNextLinkageRecord(PDOM pdom, int record) throws CoreException {
|
||||||
return pdom.getDB().getInt(record + NEXT_OFFSET);
|
return pdom.getDB().getInt(record + NEXT_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.cpp.PDOMCPPClassType;
|
import org.eclipse.cdt.internal.core.pdom.dom.cpp.PDOMCPPClassType;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
@ -28,12 +28,12 @@ public abstract class PDOMMember extends PDOMBinding {
|
||||||
|
|
||||||
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 12;
|
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 12;
|
||||||
|
|
||||||
public PDOMMember(PDOMDatabase pdom, PDOMMemberOwner parent, IASTName name, int type) throws CoreException {
|
public PDOMMember(PDOM pdom, PDOMMemberOwner parent, IASTName name, int type) throws CoreException {
|
||||||
super(pdom, parent, name, type);
|
super(pdom, parent, name, type);
|
||||||
parent.addMember(this);
|
parent.addMember(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMMember(PDOMDatabase pdom, int record) {
|
public PDOMMember(PDOM pdom, int record) {
|
||||||
super(pdom, record);
|
super(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ package org.eclipse.cdt.internal.core.pdom.dom;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,12 +28,12 @@ public class PDOMMemberOwner extends PDOMBinding {
|
||||||
|
|
||||||
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 8;
|
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 8;
|
||||||
|
|
||||||
public PDOMMemberOwner(PDOMDatabase pdom, PDOMNode parent, IASTName name,
|
public PDOMMemberOwner(PDOM pdom, PDOMNode parent, IASTName name,
|
||||||
int type) throws CoreException {
|
int type) throws CoreException {
|
||||||
super(pdom, parent, name, type);
|
super(pdom, parent, name, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMMemberOwner(PDOMDatabase pdom, int record) {
|
public PDOMMemberOwner(PDOM pdom, int record) {
|
||||||
super(pdom, record);
|
super(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope2;
|
import org.eclipse.cdt.core.dom.ast.IScope2;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
*/
|
*/
|
||||||
public class PDOMName implements IASTName, IASTFileLocation {
|
public class PDOMName implements IASTName, IASTFileLocation {
|
||||||
|
|
||||||
private final PDOMDatabase pdom;
|
private final PDOM pdom;
|
||||||
private final int record;
|
private final int record;
|
||||||
|
|
||||||
private static final int FILE_REC_OFFSET = 0;
|
private static final int FILE_REC_OFFSET = 0;
|
||||||
|
@ -50,7 +50,7 @@ public class PDOMName implements IASTName, IASTFileLocation {
|
||||||
private static final int IS_REFERENCE = 3;
|
private static final int IS_REFERENCE = 3;
|
||||||
|
|
||||||
|
|
||||||
public PDOMName(PDOMDatabase pdom, IASTName name, PDOMBinding binding) throws CoreException {
|
public PDOMName(PDOM pdom, IASTName name, PDOMBinding binding) throws CoreException {
|
||||||
this.pdom = pdom;
|
this.pdom = pdom;
|
||||||
Database db = pdom.getDB();
|
Database db = pdom.getDB();
|
||||||
record = db.malloc(RECORD_SIZE);
|
record = db.malloc(RECORD_SIZE);
|
||||||
|
@ -98,7 +98,7 @@ public class PDOMName implements IASTName, IASTFileLocation {
|
||||||
db.putInt(record + NODE_LENGTH_OFFSET, fileloc.getNodeLength());
|
db.putInt(record + NODE_LENGTH_OFFSET, fileloc.getNodeLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMName(PDOMDatabase pdom, int nameRecord) {
|
public PDOMName(PDOM pdom, int nameRecord) {
|
||||||
this.pdom = pdom;
|
this.pdom = pdom;
|
||||||
this.record = nameRecord;
|
this.record = nameRecord;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.IBTreeComparator;
|
import org.eclipse.cdt.internal.core.pdom.db.IBTreeComparator;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.IBTreeVisitor;
|
import org.eclipse.cdt.internal.core.pdom.db.IBTreeVisitor;
|
||||||
|
@ -31,15 +31,15 @@ public abstract class PDOMNode {
|
||||||
|
|
||||||
protected static final int RECORD_SIZE = 8;
|
protected static final int RECORD_SIZE = 8;
|
||||||
|
|
||||||
protected final PDOMDatabase pdom;
|
protected final PDOM pdom;
|
||||||
protected final int record;
|
protected final int record;
|
||||||
|
|
||||||
protected PDOMNode(PDOMDatabase pdom, int record) {
|
protected PDOMNode(PDOM pdom, int record) {
|
||||||
this.pdom = pdom;
|
this.pdom = pdom;
|
||||||
this.record = record;
|
this.record = record;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PDOMNode(PDOMDatabase pdom, PDOMNode parent, char[] name) throws CoreException {
|
protected PDOMNode(PDOM pdom, PDOMNode parent, char[] name) throws CoreException {
|
||||||
this.pdom = pdom;
|
this.pdom = pdom;
|
||||||
Database db = pdom.getDB();
|
Database db = pdom.getDB();
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ public abstract class PDOMNode {
|
||||||
|
|
||||||
protected abstract int getRecordSize();
|
protected abstract int getRecordSize();
|
||||||
|
|
||||||
public PDOMDatabase getPDOM() {
|
public PDOM getPDOM() {
|
||||||
return pdom;
|
return pdom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ public abstract class PDOMNode {
|
||||||
return getLinkage(pdom, record);
|
return getLinkage(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PDOMLinkage getLinkage(PDOMDatabase pdom, int record) throws CoreException {
|
public static PDOMLinkage getLinkage(PDOM pdom, int record) throws CoreException {
|
||||||
Database db = pdom.getDB();
|
Database db = pdom.getDB();
|
||||||
int linkagerec = record;
|
int linkagerec = record;
|
||||||
int parentrec = db.getInt(linkagerec + PARENT_OFFSET);
|
int parentrec = db.getInt(linkagerec + PARENT_OFFSET);
|
||||||
|
@ -121,9 +121,9 @@ public abstract class PDOMNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract static class NodeVisitor implements IBTreeVisitor {
|
public abstract static class NodeVisitor implements IBTreeVisitor {
|
||||||
protected final PDOMDatabase pdom;
|
protected final PDOM pdom;
|
||||||
protected final char[] name;
|
protected final char[] name;
|
||||||
protected NodeVisitor(PDOMDatabase pdom, char [] name) {
|
protected NodeVisitor(PDOM pdom, char [] name) {
|
||||||
this.pdom = pdom;
|
this.pdom = pdom;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IField;
|
import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMember;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMember;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMemberOwner;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMemberOwner;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
||||||
|
@ -27,11 +27,11 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
*/
|
*/
|
||||||
public class PDOMCField extends PDOMMember implements IField {
|
public class PDOMCField extends PDOMMember implements IField {
|
||||||
|
|
||||||
public PDOMCField(PDOMDatabase pdom, PDOMMemberOwner parent, IASTName name) throws CoreException {
|
public PDOMCField(PDOM pdom, PDOMMemberOwner parent, IASTName name) throws CoreException {
|
||||||
super(pdom, parent, name, PDOMCLinkage.CFIELD);
|
super(pdom, parent, name, PDOMCLinkage.CFIELD);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCField(PDOMDatabase pdom, int record) {
|
public PDOMCField(PDOM pdom, int record) {
|
||||||
super(pdom, record);
|
super(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
||||||
|
@ -29,11 +29,11 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
*/
|
*/
|
||||||
public class PDOMCFunction extends PDOMBinding implements IFunction {
|
public class PDOMCFunction extends PDOMBinding implements IFunction {
|
||||||
|
|
||||||
public PDOMCFunction(PDOMDatabase pdom, PDOMNode parent, IASTName name) throws CoreException {
|
public PDOMCFunction(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||||
super(pdom, parent, name, PDOMCLinkage.CFUNCTION);
|
super(pdom, parent, name, PDOMCLinkage.CFUNCTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCFunction(PDOMDatabase pdom, int record) {
|
public PDOMCFunction(PDOM pdom, int record) {
|
||||||
super(pdom, record);
|
super(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.c.GCCLanguage;
|
import org.eclipse.cdt.core.dom.ast.gnu.c.GCCLanguage;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMember;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMember;
|
||||||
|
@ -43,11 +43,11 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
*/
|
*/
|
||||||
public class PDOMCLinkage extends PDOMLinkage {
|
public class PDOMCLinkage extends PDOMLinkage {
|
||||||
|
|
||||||
public PDOMCLinkage(PDOMDatabase pdom, int record) {
|
public PDOMCLinkage(PDOM pdom, int record) {
|
||||||
super(pdom, record);
|
super(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCLinkage(PDOMDatabase pdom) throws CoreException {
|
public PDOMCLinkage(PDOM pdom) throws CoreException {
|
||||||
super(pdom, GCCLanguage.ID, "C".toCharArray());
|
super(pdom, GCCLanguage.ID, "C".toCharArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ public class PDOMCLinkage extends PDOMLinkage {
|
||||||
private static final class FindBinding extends PDOMNode.NodeVisitor {
|
private static final class FindBinding extends PDOMNode.NodeVisitor {
|
||||||
PDOMBinding pdomBinding;
|
PDOMBinding pdomBinding;
|
||||||
final int desiredType;
|
final int desiredType;
|
||||||
public FindBinding(PDOMDatabase pdom, char[] name, int desiredType) {
|
public FindBinding(PDOM pdom, char[] name, int desiredType) {
|
||||||
super(pdom, name);
|
super(pdom, name);
|
||||||
this.desiredType = desiredType;
|
this.desiredType = desiredType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
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.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -21,11 +21,11 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
*/
|
*/
|
||||||
public class PDOMCLinkageFactory implements IPDOMLinkageFactory {
|
public class PDOMCLinkageFactory implements IPDOMLinkageFactory {
|
||||||
|
|
||||||
public PDOMLinkage getLinkage(PDOMDatabase pdom, int record) {
|
public PDOMLinkage getLinkage(PDOM pdom, int record) {
|
||||||
return new PDOMCLinkage(pdom, record);
|
return new PDOMCLinkage(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMLinkage createLinkage(PDOMDatabase pdom) throws CoreException {
|
public PDOMLinkage createLinkage(PDOM pdom) throws CoreException {
|
||||||
return new PDOMCLinkage(pdom);
|
return new PDOMCLinkage(pdom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IField;
|
import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMember;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMember;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMemberOwner;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMemberOwner;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
|
@ -31,11 +31,11 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
*/
|
*/
|
||||||
public class PDOMCStructure extends PDOMMemberOwner implements ICompositeType {
|
public class PDOMCStructure extends PDOMMemberOwner implements ICompositeType {
|
||||||
|
|
||||||
public PDOMCStructure(PDOMDatabase pdom, PDOMNode parent, IASTName name) throws CoreException {
|
public PDOMCStructure(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||||
super(pdom, parent, name, PDOMCLinkage.CSTRUCTURE);
|
super(pdom, parent, name, PDOMCLinkage.CSTRUCTURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCStructure(PDOMDatabase pdom, int record) {
|
public PDOMCStructure(PDOM pdom, int record) {
|
||||||
super(pdom, record);
|
super(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.c.CVariable;
|
import org.eclipse.cdt.internal.core.dom.parser.c.CVariable;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
||||||
|
@ -29,13 +29,13 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
*/
|
*/
|
||||||
public class PDOMCVariable extends PDOMBinding implements IVariable {
|
public class PDOMCVariable extends PDOMBinding implements IVariable {
|
||||||
|
|
||||||
public PDOMCVariable(PDOMDatabase pdom, PDOMNode parent, IASTName name) throws CoreException {
|
public PDOMCVariable(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||||
super(pdom, parent, name, PDOMCLinkage.CVARIABLE);
|
super(pdom, parent, name, PDOMCLinkage.CVARIABLE);
|
||||||
CVariable binding = (CVariable)name.getBinding();
|
CVariable binding = (CVariable)name.getBinding();
|
||||||
IType type = binding.getType();
|
IType type = binding.getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCVariable(PDOMDatabase pdom, int record) {
|
public PDOMCVariable(PDOM pdom, int record) {
|
||||||
super(pdom, record);
|
super(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMember;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMember;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMemberOwner;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMemberOwner;
|
||||||
|
@ -41,11 +41,11 @@ public class PDOMCPPClassType extends PDOMMemberOwner implements ICPPClassType,
|
||||||
|
|
||||||
protected static final int RECORD_SIZE = PDOMMemberOwner.RECORD_SIZE + 0;
|
protected static final int RECORD_SIZE = PDOMMemberOwner.RECORD_SIZE + 0;
|
||||||
|
|
||||||
public PDOMCPPClassType(PDOMDatabase pdom, PDOMNode parent, IASTName name) throws CoreException {
|
public PDOMCPPClassType(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||||
super(pdom, parent, name, PDOMCPPLinkage.CPPCLASSTYPE);
|
super(pdom, parent, name, PDOMCPPLinkage.CPPCLASSTYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPClassType(PDOMDatabase pdom, int bindingRecord) {
|
public PDOMCPPClassType(PDOM pdom, int bindingRecord) {
|
||||||
super(pdom, bindingRecord);
|
super(pdom, bindingRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMember;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMember;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -29,12 +29,12 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
*/
|
*/
|
||||||
public class PDOMCPPField extends PDOMMember implements ICPPField {
|
public class PDOMCPPField extends PDOMMember implements ICPPField {
|
||||||
|
|
||||||
public PDOMCPPField(PDOMDatabase pdom, PDOMCPPClassType parent, IASTName name)
|
public PDOMCPPField(PDOM pdom, PDOMCPPClassType parent, IASTName name)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
super(pdom, parent, name, PDOMCPPLinkage.CPPFIELD);
|
super(pdom, parent, name, PDOMCPPLinkage.CPPFIELD);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPField(PDOMDatabase pdom, int bindingRecord) {
|
public PDOMCPPField(PDOM pdom, int bindingRecord) {
|
||||||
super(pdom, bindingRecord);
|
super(pdom, bindingRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunction;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunction;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
||||||
|
@ -30,11 +30,11 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
*/
|
*/
|
||||||
public class PDOMCPPFunction extends PDOMBinding implements ICPPFunction {
|
public class PDOMCPPFunction extends PDOMBinding implements ICPPFunction {
|
||||||
|
|
||||||
public PDOMCPPFunction(PDOMDatabase pdom, PDOMNode parent, IASTName name) throws CoreException {
|
public PDOMCPPFunction(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||||
super(pdom, parent, name, PDOMCPPLinkage.CPPFUNCTION);
|
super(pdom, parent, name, PDOMCPPLinkage.CPPFUNCTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPFunction(PDOMDatabase pdom, int bindingRecord) {
|
public PDOMCPPFunction(PDOM pdom, int bindingRecord) {
|
||||||
super(pdom, bindingRecord);
|
super(pdom, bindingRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPMethod;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPNamespace;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPNamespace;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPNamespaceAlias;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPNamespaceAlias;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVariable;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVariable;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMember;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMember;
|
||||||
|
@ -54,11 +54,11 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
*/
|
*/
|
||||||
public class PDOMCPPLinkage extends PDOMLinkage {
|
public class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
|
|
||||||
public PDOMCPPLinkage(PDOMDatabase pdom, int record) {
|
public PDOMCPPLinkage(PDOM pdom, int record) {
|
||||||
super(pdom, record);
|
super(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPLinkage(PDOMDatabase pdom)
|
public PDOMCPPLinkage(PDOM pdom)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
super(pdom, GPPLanguage.ID, "C++".toCharArray());
|
super(pdom, GPPLanguage.ID, "C++".toCharArray());
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
private static final class FindBinding extends PDOMNode.NodeVisitor {
|
private static final class FindBinding extends PDOMNode.NodeVisitor {
|
||||||
PDOMBinding pdomBinding;
|
PDOMBinding pdomBinding;
|
||||||
final int desiredType;
|
final int desiredType;
|
||||||
public FindBinding(PDOMDatabase pdom, char[] name, int desiredType) {
|
public FindBinding(PDOM pdom, char[] name, int desiredType) {
|
||||||
super(pdom, name);
|
super(pdom, name);
|
||||||
this.desiredType = desiredType;
|
this.desiredType = desiredType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
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.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -22,11 +22,11 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
*/
|
*/
|
||||||
public class PDOMCPPLinkageFactory implements IPDOMLinkageFactory {
|
public class PDOMCPPLinkageFactory implements IPDOMLinkageFactory {
|
||||||
|
|
||||||
public PDOMLinkage getLinkage(PDOMDatabase pdom, int record) {
|
public PDOMLinkage getLinkage(PDOM pdom, int record) {
|
||||||
return new PDOMCPPLinkage(pdom, record);
|
return new PDOMCPPLinkage(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMLinkage createLinkage(PDOMDatabase pdom) throws CoreException {
|
public PDOMLinkage createLinkage(PDOM pdom) throws CoreException {
|
||||||
return new PDOMCPPLinkage(pdom);
|
return new PDOMCPPLinkage(pdom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMember;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMember;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMemberOwner;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMemberOwner;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
||||||
|
@ -31,11 +31,11 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
*/
|
*/
|
||||||
public class PDOMCPPMethod extends PDOMMember implements ICPPMethod {
|
public class PDOMCPPMethod extends PDOMMember implements ICPPMethod {
|
||||||
|
|
||||||
public PDOMCPPMethod(PDOMDatabase pdom, PDOMMemberOwner parent, IASTName name) throws CoreException {
|
public PDOMCPPMethod(PDOM pdom, PDOMMemberOwner parent, IASTName name) throws CoreException {
|
||||||
super(pdom, parent, name, PDOMCPPLinkage.CPPMETHOD);
|
super(pdom, parent, name, PDOMCPPLinkage.CPPMETHOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPMethod(PDOMDatabase pdom, int record) {
|
public PDOMCPPMethod(PDOM pdom, int record) {
|
||||||
super(pdom, record);
|
super(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.BTree;
|
import org.eclipse.cdt.internal.core.pdom.db.BTree;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
|
@ -41,11 +41,11 @@ public class PDOMCPPNamespace extends PDOMBinding
|
||||||
|
|
||||||
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 4;
|
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 4;
|
||||||
|
|
||||||
public PDOMCPPNamespace(PDOMDatabase pdom, PDOMNode parent, IASTName name) throws CoreException {
|
public PDOMCPPNamespace(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||||
super(pdom, parent, name, PDOMCPPLinkage.CPPNAMESPACE);
|
super(pdom, parent, name, PDOMCPPLinkage.CPPNAMESPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPNamespace(PDOMDatabase pdom, int record) {
|
public PDOMCPPNamespace(PDOM pdom, int record) {
|
||||||
super(pdom, record);
|
super(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ public class PDOMCPPNamespace extends PDOMBinding
|
||||||
private static final class FindBinding extends PDOMNode.NodeVisitor {
|
private static final class FindBinding extends PDOMNode.NodeVisitor {
|
||||||
PDOMBinding pdomBinding;
|
PDOMBinding pdomBinding;
|
||||||
final int desiredType;
|
final int desiredType;
|
||||||
public FindBinding(PDOMDatabase pdom, char[] name, int desiredType) {
|
public FindBinding(PDOM pdom, char[] name, int desiredType) {
|
||||||
super(pdom, name);
|
super(pdom, name);
|
||||||
this.desiredType = desiredType;
|
this.desiredType = desiredType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
||||||
|
@ -29,12 +29,12 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
public class PDOMCPPNamespaceAlias extends PDOMBinding implements
|
public class PDOMCPPNamespaceAlias extends PDOMBinding implements
|
||||||
ICPPNamespaceAlias {
|
ICPPNamespaceAlias {
|
||||||
|
|
||||||
public PDOMCPPNamespaceAlias(PDOMDatabase pdom, PDOMNode parent,
|
public PDOMCPPNamespaceAlias(PDOM pdom, PDOMNode parent,
|
||||||
IASTName name) throws CoreException {
|
IASTName name) throws CoreException {
|
||||||
super(pdom, parent, name, PDOMCPPLinkage.CPPNAMESPACEALIAS);
|
super(pdom, parent, name, PDOMCPPLinkage.CPPNAMESPACEALIAS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPNamespaceAlias(PDOMDatabase pdom, int record) {
|
public PDOMCPPNamespaceAlias(PDOM pdom, int record) {
|
||||||
super(pdom, record);
|
super(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
||||||
|
@ -36,7 +36,7 @@ public class PDOMCPPVariable extends PDOMBinding implements ICPPVariable {
|
||||||
|
|
||||||
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 4;
|
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 4;
|
||||||
|
|
||||||
public PDOMCPPVariable(PDOMDatabase pdom, PDOMNode parent, IASTName name) throws CoreException {
|
public PDOMCPPVariable(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||||
super(pdom, parent, name, PDOMCPPLinkage.CPPVARIABLE);
|
super(pdom, parent, name, PDOMCPPLinkage.CPPVARIABLE);
|
||||||
|
|
||||||
// Find the type record
|
// Find the type record
|
||||||
|
@ -52,7 +52,7 @@ public class PDOMCPPVariable extends PDOMBinding implements ICPPVariable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPVariable(PDOMDatabase pdom, int record) {
|
public PDOMCPPVariable(PDOM pdom, int record) {
|
||||||
super(pdom, record);
|
super(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,11 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom.indexer.fast;
|
package org.eclipse.cdt.internal.core.pdom.indexer.fast;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.IPDOM;
|
import org.eclipse.cdt.core.dom.IPDOM;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
|
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.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
@ -27,18 +30,35 @@ import org.eclipse.core.runtime.jobs.Job;
|
||||||
public class PDOMFastAddTU extends Job {
|
public class PDOMFastAddTU extends Job {
|
||||||
|
|
||||||
private final ITranslationUnit tu;
|
private final ITranslationUnit tu;
|
||||||
private final IPDOM pdom;
|
private final PDOM pdom;
|
||||||
|
|
||||||
public PDOMFastAddTU(IPDOM pdom, ITranslationUnit tu) {
|
public PDOMFastAddTU(IPDOM pdom, ITranslationUnit tu) {
|
||||||
super("PDOM Fast Add TU");
|
super("PDOM Fast Add TU");
|
||||||
this.pdom = pdom;
|
this.pdom = (pdom instanceof PDOM) ? (PDOM)pdom : null;
|
||||||
this.tu = tu;
|
this.tu = tu;
|
||||||
|
setPriority(PDOM.WRITER_PRIORITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
|
if (pdom == null)
|
||||||
|
return Status.CANCEL_STATUS;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
PDOMDatabase mypdom = (PDOMDatabase)pdom;
|
ILanguage language = tu.getLanguage();
|
||||||
mypdom.addSymbols(tu);
|
if (language == null)
|
||||||
|
return Status.CANCEL_STATUS;
|
||||||
|
|
||||||
|
// get the AST in a "Fast" way
|
||||||
|
IASTTranslationUnit ast = language.getTranslationUnit((IFile)tu.getResource(),
|
||||||
|
ILanguage.AST_USE_INDEX |
|
||||||
|
ILanguage.AST_SKIP_INDEXED_HEADERS |
|
||||||
|
ILanguage.AST_SKIP_IF_NO_BUILD_INFO);
|
||||||
|
if (ast == null)
|
||||||
|
return Status.CANCEL_STATUS;
|
||||||
|
|
||||||
|
getJobManager().beginRule(pdom.getWriterLockRule(), monitor);
|
||||||
|
pdom.addSymbols(language, ast);
|
||||||
|
getJobManager().endRule(pdom.getWriterLockRule());
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return e.getStatus();
|
return e.getStatus();
|
||||||
|
|
|
@ -12,8 +12,11 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom.indexer.fast;
|
package org.eclipse.cdt.internal.core.pdom.indexer.fast;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.IPDOM;
|
import org.eclipse.cdt.core.dom.IPDOM;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
|
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.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
@ -26,20 +29,35 @@ import org.eclipse.core.runtime.jobs.Job;
|
||||||
*/
|
*/
|
||||||
public class PDOMFastChangeTU extends Job {
|
public class PDOMFastChangeTU extends Job {
|
||||||
|
|
||||||
private final IPDOM pdom;
|
private final PDOM pdom;
|
||||||
private final ITranslationUnit tu;
|
private final ITranslationUnit tu;
|
||||||
|
|
||||||
public PDOMFastChangeTU(IPDOM pdom, ITranslationUnit tu) {
|
public PDOMFastChangeTU(IPDOM pdom, ITranslationUnit tu) {
|
||||||
super("PDOM Fast Change TU");
|
super("PDOM Fast Change TU");
|
||||||
this.pdom = pdom;
|
this.pdom = (pdom instanceof PDOM) ? (PDOM)pdom : null;
|
||||||
this.tu = tu;
|
this.tu = tu;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
|
if (pdom == null)
|
||||||
|
return Status.CANCEL_STATUS;
|
||||||
try {
|
try {
|
||||||
PDOMDatabase mypdom = (PDOMDatabase)pdom;
|
ILanguage language = tu.getLanguage();
|
||||||
mypdom.removeSymbols(tu);
|
if (language == null)
|
||||||
mypdom.addSymbols(tu);
|
return Status.CANCEL_STATUS;
|
||||||
|
|
||||||
|
// get the AST in a "Fast" way
|
||||||
|
IASTTranslationUnit ast = language.getTranslationUnit((IFile)tu.getResource(),
|
||||||
|
ILanguage.AST_USE_INDEX |
|
||||||
|
ILanguage.AST_SKIP_INDEXED_HEADERS |
|
||||||
|
ILanguage.AST_SKIP_IF_NO_BUILD_INFO);
|
||||||
|
if (ast == null)
|
||||||
|
return Status.CANCEL_STATUS;
|
||||||
|
|
||||||
|
getJobManager().beginRule(pdom.getWriterLockRule(), monitor);
|
||||||
|
pdom.removeSymbols(tu);
|
||||||
|
pdom.addSymbols(language, ast);
|
||||||
|
getJobManager().endRule(pdom.getWriterLockRule());
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return e.getStatus();
|
return e.getStatus();
|
||||||
|
|
|
@ -18,14 +18,13 @@ import java.util.List;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IPDOM;
|
import org.eclipse.cdt.core.dom.IPDOM;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
||||||
import org.eclipse.cdt.core.dom.PDOM;
|
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ElementChangedEvent;
|
import org.eclipse.cdt.core.model.ElementChangedEvent;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ICElementDelta;
|
import org.eclipse.cdt.core.model.ICElementDelta;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IResourceProxy;
|
import org.eclipse.core.resources.IResourceProxy;
|
||||||
|
@ -44,11 +43,19 @@ import org.eclipse.core.runtime.jobs.Job;
|
||||||
*/
|
*/
|
||||||
public class PDOMFastIndexer implements IPDOMIndexer {
|
public class PDOMFastIndexer implements IPDOMIndexer {
|
||||||
|
|
||||||
private PDOMDatabase pdom;
|
private PDOM pdom;
|
||||||
|
|
||||||
public void setPDOM(IPDOM pdom) {
|
public void setPDOM(IPDOM pdom) {
|
||||||
if (pdom instanceof PDOMDatabase)
|
if (pdom instanceof PDOM)
|
||||||
this.pdom = (PDOMDatabase)pdom;
|
this.pdom = (PDOM)pdom;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IProgressMonitor progressGroup;
|
||||||
|
|
||||||
|
private IProgressMonitor getProgressGroup() {
|
||||||
|
if (progressGroup == null)
|
||||||
|
progressGroup = Platform.getJobManager().createProgressGroup();
|
||||||
|
return progressGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ChangeHandler extends Job {
|
private class ChangeHandler extends Job {
|
||||||
|
@ -130,7 +137,7 @@ public class PDOMFastIndexer implements IPDOMIndexer {
|
||||||
private void processDelta(ICElementDelta delta) {
|
private void processDelta(ICElementDelta delta) {
|
||||||
// First make sure this project is PDOMable
|
// First make sure this project is PDOMable
|
||||||
ICElement element = delta.getElement();
|
ICElement element = delta.getElement();
|
||||||
if (element instanceof ICProject && PDOM.getPDOM(((ICProject)element).getProject()) == null)
|
if (element instanceof ICProject && CCorePlugin.getPDOMManager().getPDOM(((ICProject)element).getProject()) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// process the children first
|
// process the children first
|
||||||
|
@ -173,8 +180,6 @@ public class PDOMFastIndexer implements IPDOMIndexer {
|
||||||
|
|
||||||
private void processNewProject(final ICProject project) {
|
private void processNewProject(final ICProject project) {
|
||||||
try {
|
try {
|
||||||
if (!PDOM.isEnabled(project.getProject()))
|
|
||||||
return;
|
|
||||||
project.getProject().accept(new IResourceProxyVisitor() {
|
project.getProject().accept(new IResourceProxyVisitor() {
|
||||||
public boolean visit(IResourceProxy proxy) throws CoreException {
|
public boolean visit(IResourceProxy proxy) throws CoreException {
|
||||||
if (proxy.getType() == IResource.FILE) {
|
if (proxy.getType() == IResource.FILE) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.internal.core.pdom.indexer.fast;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.IPDOM;
|
import org.eclipse.cdt.core.dom.IPDOM;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
@ -26,22 +26,24 @@ import org.eclipse.core.runtime.jobs.Job;
|
||||||
*/
|
*/
|
||||||
public class PDOMFastRemoveTU extends Job {
|
public class PDOMFastRemoveTU extends Job {
|
||||||
|
|
||||||
private final IPDOM pdom;
|
private final PDOM pdom;
|
||||||
private final ITranslationUnit tu;
|
private final ITranslationUnit tu;
|
||||||
|
|
||||||
public PDOMFastRemoveTU(IPDOM pdom, ITranslationUnit tu) {
|
public PDOMFastRemoveTU(IPDOM pdom, ITranslationUnit tu) {
|
||||||
super("PDOM Fast Remove TU");
|
super("PDOM Fast Remove TU");
|
||||||
this.pdom = pdom;
|
this.pdom = (pdom instanceof PDOM) ? (PDOM)pdom : null;
|
||||||
this.tu = tu;
|
this.tu = tu;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
|
if (pdom == null)
|
||||||
|
return Status.CANCEL_STATUS;
|
||||||
try {
|
try {
|
||||||
PDOMDatabase mypdom = (PDOMDatabase)pdom;
|
getJobManager().beginRule(pdom.getWriterLockRule(), monitor);
|
||||||
mypdom.removeSymbols(tu);
|
pdom.removeSymbols(tu);
|
||||||
// TODO delete the file itself from the database
|
// TODO delete the file itself from the database
|
||||||
// the removeSymbols only removes the names in the file
|
// the removeSymbols only removes the names in the file
|
||||||
// TODO Auto-generated method stub
|
getJobManager().endRule(pdom.getWriterLockRule());
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return e.getStatus();
|
return e.getStatus();
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006 QNX Software Systems 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:
|
||||||
|
* QNX - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.internal.core.pdom.indexer.nulli;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.IPDOM;
|
||||||
|
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
||||||
|
import org.eclipse.cdt.core.model.ElementChangedEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Doug Schaefer
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class PDOMNullIndexer implements IPDOMIndexer {
|
||||||
|
|
||||||
|
public void setPDOM(IPDOM pdom) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reindex() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void elementChanged(ElementChangedEvent event) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -72,4 +72,6 @@ cdt_pathentry_var.description=CDT PathEntry Variable
|
||||||
|
|
||||||
PDOMProviderName=PDOM Provider
|
PDOMProviderName=PDOM Provider
|
||||||
|
|
||||||
|
fastIndexer.name=Fast Indexer
|
||||||
|
|
||||||
language.name=Language
|
language.name=Language
|
|
@ -540,6 +540,7 @@
|
||||||
class="org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexer">
|
class="org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexer">
|
||||||
</run>
|
</run>
|
||||||
</cextension>
|
</cextension>
|
||||||
|
<run class="org.eclipse.cdt.internal.core.pdom.indexer.nulli.PDOMNullIndexer"/>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
id="ctagsindexer"
|
id="ctagsindexer"
|
||||||
|
@ -550,6 +551,7 @@
|
||||||
class="org.eclipse.cdt.internal.core.index.ctagsindexer.CTagsIndexer">
|
class="org.eclipse.cdt.internal.core.index.ctagsindexer.CTagsIndexer">
|
||||||
</run>
|
</run>
|
||||||
</cextension>
|
</cextension>
|
||||||
|
<run class="org.eclipse.cdt.internal.core.pdom.indexer.nulli.PDOMNullIndexer"/>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
id="nullindexer"
|
id="nullindexer"
|
||||||
|
@ -560,6 +562,18 @@
|
||||||
class="org.eclipse.cdt.internal.core.index.nullindexer.NullIndexer">
|
class="org.eclipse.cdt.internal.core.index.nullindexer.NullIndexer">
|
||||||
</run>
|
</run>
|
||||||
</cextension>
|
</cextension>
|
||||||
|
<run class="org.eclipse.cdt.internal.core.pdom.indexer.nulli.PDOMNullIndexer"/>
|
||||||
|
</extension>
|
||||||
|
<extension
|
||||||
|
id="fastIndexer"
|
||||||
|
name="%fastIndexer.name"
|
||||||
|
point="org.eclipse.cdt.core.CIndexer">
|
||||||
|
<run class="org.eclipse.cdt.internal.core.pdom.indexer.fast.PDOMFastIndexer"/>
|
||||||
|
<cextension>
|
||||||
|
<run
|
||||||
|
class="org.eclipse.cdt.internal.core.index.nullindexer.NullIndexer">
|
||||||
|
</run>
|
||||||
|
</cextension>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.core.variables.dynamicVariables">
|
point="org.eclipse.core.variables.dynamicVariables">
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<element name="extension">
|
<element name="extension">
|
||||||
<complexType>
|
<complexType>
|
||||||
<sequence>
|
<sequence>
|
||||||
<element ref="indexer"/>
|
<element ref="run"/>
|
||||||
</sequence>
|
</sequence>
|
||||||
<attribute name="point" type="string" use="required">
|
<attribute name="point" type="string" use="required">
|
||||||
<annotation>
|
<annotation>
|
||||||
|
@ -39,6 +39,21 @@
|
||||||
</complexType>
|
</complexType>
|
||||||
</element>
|
</element>
|
||||||
|
|
||||||
|
<element name="run">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="class" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.attribute kind="java" basedOn="org.eclipse.cdt.core.dom.IPDOMIndexer"/>
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
<annotation>
|
<annotation>
|
||||||
<appInfo>
|
<appInfo>
|
||||||
<meta.section type="since"/>
|
<meta.section type="since"/>
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.util.MissingResourceException;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.CDOM;
|
import org.eclipse.cdt.core.dom.CDOM;
|
||||||
import org.eclipse.cdt.core.dom.PDOM;
|
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
||||||
|
@ -41,6 +41,7 @@ import org.eclipse.cdt.internal.core.model.CModelManager;
|
||||||
import org.eclipse.cdt.internal.core.model.DeltaProcessor;
|
import org.eclipse.cdt.internal.core.model.DeltaProcessor;
|
||||||
import org.eclipse.cdt.internal.core.model.IBufferFactory;
|
import org.eclipse.cdt.internal.core.model.IBufferFactory;
|
||||||
import org.eclipse.cdt.internal.core.model.Util;
|
import org.eclipse.cdt.internal.core.model.Util;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.PDOMManager;
|
||||||
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
||||||
import org.eclipse.cdt.internal.core.search.matching.MatchLocator;
|
import org.eclipse.cdt.internal.core.search.matching.MatchLocator;
|
||||||
import org.eclipse.cdt.internal.core.search.processing.JobManager;
|
import org.eclipse.cdt.internal.core.search.processing.JobManager;
|
||||||
|
@ -88,8 +89,9 @@ public class CCorePlugin extends Plugin {
|
||||||
public static final String INDEXER_UNIQ_ID = PLUGIN_ID + "." + INDEXER_SIMPLE_ID; //$NON-NLS-1$
|
public static final String INDEXER_UNIQ_ID = PLUGIN_ID + "." + INDEXER_SIMPLE_ID; //$NON-NLS-1$
|
||||||
public final static String PREF_INDEXER = "indexer"; //$NON-NLS-1$
|
public final static String PREF_INDEXER = "indexer"; //$NON-NLS-1$
|
||||||
public final static String USE_PDOM_PREF = "usePDOM"; //$NON-NLS-1$
|
public final static String USE_PDOM_PREF = "usePDOM"; //$NON-NLS-1$
|
||||||
public final static String DEFAULT_INDEXER_SIMPLE_ID = "domsourceindexer"; //$NON-NLS-1$
|
|
||||||
public final static String NULL_INDEXER_SIMPLE_ID = "nullindexer"; //$NON-NLS-1$
|
public final static String NULL_INDEXER_SIMPLE_ID = "nullindexer"; //$NON-NLS-1$
|
||||||
|
// public final static String DEFAULT_INDEXER_SIMPLE_ID = "domsourceindexer"; //$NON-NLS-1$
|
||||||
|
public final static String DEFAULT_INDEXER_SIMPLE_ID = NULL_INDEXER_SIMPLE_ID; //$NON-NLS-1$
|
||||||
public final static String NULL_INDEXER_UNIQUE_ID = PLUGIN_ID + "." + NULL_INDEXER_SIMPLE_ID ; //$NON-NLS-1$
|
public final static String NULL_INDEXER_UNIQUE_ID = PLUGIN_ID + "." + NULL_INDEXER_SIMPLE_ID ; //$NON-NLS-1$
|
||||||
public final static String DEFAULT_INDEXER_UNIQ_ID = PLUGIN_ID + "." + DEFAULT_INDEXER_SIMPLE_ID; //$NON-NLS-1$
|
public final static String DEFAULT_INDEXER_UNIQ_ID = PLUGIN_ID + "." + DEFAULT_INDEXER_SIMPLE_ID; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -159,6 +161,8 @@ public class CCorePlugin extends Plugin {
|
||||||
|
|
||||||
private CoreModel fCoreModel;
|
private CoreModel fCoreModel;
|
||||||
|
|
||||||
|
private PDOMManager pdomManager;
|
||||||
|
|
||||||
private PathEntryVariableManager fPathEntryVariableManager;
|
private PathEntryVariableManager fPathEntryVariableManager;
|
||||||
|
|
||||||
// -------- static methods --------
|
// -------- static methods --------
|
||||||
|
@ -295,7 +299,8 @@ public class CCorePlugin extends Plugin {
|
||||||
fCoreModel.startIndexing();
|
fCoreModel.startIndexing();
|
||||||
|
|
||||||
// Fire up the PDOM
|
// Fire up the PDOM
|
||||||
PDOM.startup();
|
pdomManager = new PDOMManager();
|
||||||
|
pdomManager.startup();
|
||||||
|
|
||||||
// Set the default for using the structual parse mode to build the CModel
|
// Set the default for using the structual parse mode to build the CModel
|
||||||
getPluginPreferences().setDefault(PREF_USE_STRUCTURAL_PARSE_MODE, false);
|
getPluginPreferences().setDefault(PREF_USE_STRUCTURAL_PARSE_MODE, false);
|
||||||
|
@ -617,6 +622,10 @@ public class CCorePlugin extends Plugin {
|
||||||
return fCoreModel;
|
return fCoreModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IPDOMManager getPDOMManager() {
|
||||||
|
return getDefault().pdomManager;
|
||||||
|
}
|
||||||
|
|
||||||
public IPathEntryVariableManager getPathEntryVariableManager() {
|
public IPathEntryVariableManager getPathEntryVariableManager() {
|
||||||
return fPathEntryVariableManager;
|
return fPathEntryVariableManager;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2005 QNX Software Systems 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:
|
|
||||||
* QNX - Initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.core.dom;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
|
||||||
import org.eclipse.cdt.core.model.IElementChangedListener;
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMManager;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.core.resources.ProjectScope;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
|
||||||
import org.eclipse.core.runtime.preferences.IScopeContext;
|
|
||||||
import org.osgi.service.prefs.BackingStoreException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Doug Schaefer
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class PDOM {
|
|
||||||
|
|
||||||
private static final String PDOM_NODE = CCorePlugin.PLUGIN_ID + ".pdom"; //$NON-NLS-1$
|
|
||||||
private static final String ENABLED_KEY = "enabled"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
private static IEclipsePreferences getPreferences(IProject project) {
|
|
||||||
IScopeContext projectScope = new ProjectScope(project);
|
|
||||||
if (projectScope == null)
|
|
||||||
return null;
|
|
||||||
else
|
|
||||||
return projectScope.getNode(PDOM_NODE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isEnabled(IProject project) {
|
|
||||||
IEclipsePreferences prefs = getPreferences(project);
|
|
||||||
if (prefs == null)
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
return prefs.getBoolean(ENABLED_KEY, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setEnabled(IProject project, boolean enabled) {
|
|
||||||
IEclipsePreferences prefs = getPreferences(project);
|
|
||||||
if (prefs == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
prefs.putBoolean(ENABLED_KEY, enabled);
|
|
||||||
try {
|
|
||||||
prefs.flush();
|
|
||||||
} catch (BackingStoreException e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isInitialized(IProject project) {
|
|
||||||
return getPreferences(project) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the PDOM for the given project.
|
|
||||||
*
|
|
||||||
* @param project
|
|
||||||
* @return the PDOM for the project
|
|
||||||
*/
|
|
||||||
public static IPDOM getPDOM(IProject project) {
|
|
||||||
if (isEnabled(project))
|
|
||||||
return PDOMManager.getInstance().getPDOM(project);
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void deletePDOM(IProject project) throws CoreException {
|
|
||||||
if (isEnabled(project))
|
|
||||||
PDOMManager.getInstance().getPDOM(project).delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Startup the PDOM. This mainly sets us up to handle model
|
|
||||||
* change events.
|
|
||||||
*/
|
|
||||||
public static void startup() {
|
|
||||||
IElementChangedListener listener = PDOMManager.getInstance();
|
|
||||||
if (listener != null) {
|
|
||||||
CoreModel.getDefault().addElementChangedListener(listener);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -70,3 +70,4 @@ CTagsIndexMarker.CTagsMissing=CTags not installed or not in path
|
||||||
DOMIndexerMarker.EmptyScannerInfo=File not indexed because it was not built
|
DOMIndexerMarker.EmptyScannerInfo=File not indexed because it was not built
|
||||||
|
|
||||||
dom.languageError=Language not found
|
dom.languageError=Language not found
|
||||||
|
indexer.notFound = Indexer not found
|
|
@ -325,6 +325,7 @@ indexerPrefName=Indexer
|
||||||
CDTIndexer.domsourceindexer=Full C/C++ Indexer (declarations and cross references)
|
CDTIndexer.domsourceindexer=Full C/C++ Indexer (declarations and cross references)
|
||||||
CDTIndexer.ctagsindexer=CTags Indexer (declarations only)
|
CDTIndexer.ctagsindexer=CTags Indexer (declarations only)
|
||||||
CDTIndexer.nullindexer=No Indexer (search-based features will not work correctly)
|
CDTIndexer.nullindexer=No Indexer (search-based features will not work correctly)
|
||||||
|
CDTIndexer.fastindexer=Fast C/C++ Indexer (declarations and cross references)
|
||||||
|
|
||||||
IndexView.name=C/C++ Index
|
IndexView.name=C/C++ Index
|
||||||
UpdateIndex.name=Update Index
|
UpdateIndex.name=Update Index
|
||||||
|
|
|
@ -1367,6 +1367,11 @@
|
||||||
id="org.eclipse.cdt.ui.DOMASTSourceIndexerUI"
|
id="org.eclipse.cdt.ui.DOMASTSourceIndexerUI"
|
||||||
indexerID="org.eclipse.cdt.core.domsourceindexer"
|
indexerID="org.eclipse.cdt.core.domsourceindexer"
|
||||||
name="%CDTIndexer.domsourceindexer"/>
|
name="%CDTIndexer.domsourceindexer"/>
|
||||||
|
<indexerUI
|
||||||
|
class="org.eclipse.cdt.ui.dialogs.NullIndexerBlock"
|
||||||
|
id="org.eclipse.cdt.ui.fastIndexer"
|
||||||
|
indexerID="org.eclipse.cdt.core.fastIndexer"
|
||||||
|
name="%CDTIndexer.fastindexer"/>
|
||||||
|
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.eclipse.cdt.internal.ui.actions;
|
package org.eclipse.cdt.internal.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.PDOM;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMUpdator;
|
import org.eclipse.cdt.internal.core.pdom.PDOMUpdator;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
@ -36,7 +36,7 @@ public class PDOMUpdateProjectAction implements IObjectActionDelegate {
|
||||||
|
|
||||||
ICProject cproject = (ICProject)objs[i];
|
ICProject cproject = (ICProject)objs[i];
|
||||||
try {
|
try {
|
||||||
PDOM.deletePDOM(cproject.getProject());
|
CCorePlugin.getPDOMManager().deletePDOM(cproject.getProject());
|
||||||
PDOMUpdator job = new PDOMUpdator(cproject, null);
|
PDOMUpdator job = new PDOMUpdator(cproject, null);
|
||||||
job.schedule();
|
job.schedule();
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui.indexview;
|
package org.eclipse.cdt.internal.ui.indexview;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IPDOM;
|
import org.eclipse.cdt.core.dom.IPDOM;
|
||||||
import org.eclipse.cdt.core.dom.PDOM;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
|
@ -24,7 +24,7 @@ import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ICModel;
|
import org.eclipse.cdt.core.model.ICModel;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.IBTreeVisitor;
|
import org.eclipse.cdt.internal.core.pdom.db.IBTreeVisitor;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
|
@ -68,7 +68,7 @@ import org.eclipse.ui.part.ViewPart;
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class IndexView extends ViewPart implements PDOMDatabase.IListener {
|
public class IndexView extends ViewPart implements PDOM.IListener {
|
||||||
|
|
||||||
private TreeViewer viewer;
|
private TreeViewer viewer;
|
||||||
// private DrillDownAdapter drillDownAdapter;
|
// private DrillDownAdapter drillDownAdapter;
|
||||||
|
@ -139,8 +139,8 @@ public class IndexView extends ViewPart implements PDOMDatabase.IListener {
|
||||||
}
|
}
|
||||||
private static class Counter implements IBTreeVisitor {
|
private static class Counter implements IBTreeVisitor {
|
||||||
int count;
|
int count;
|
||||||
PDOMDatabase pdom;
|
PDOM pdom;
|
||||||
public Counter(PDOMDatabase pdom) {
|
public Counter(PDOM pdom) {
|
||||||
this.pdom = pdom;
|
this.pdom = pdom;
|
||||||
}
|
}
|
||||||
public int compare(int record) throws CoreException {
|
public int compare(int record) throws CoreException {
|
||||||
|
@ -154,11 +154,11 @@ public class IndexView extends ViewPart implements PDOMDatabase.IListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Children implements IBTreeVisitor {
|
private static class Children implements IBTreeVisitor {
|
||||||
final PDOMDatabase pdom;
|
final PDOM pdom;
|
||||||
final PDOMBinding[] bindings;
|
final PDOMBinding[] bindings;
|
||||||
final Filter filter;
|
final Filter filter;
|
||||||
int index;
|
int index;
|
||||||
public Children(PDOMDatabase pdom, PDOMBinding[] bindings, Filter filter) {
|
public Children(PDOM pdom, PDOMBinding[] bindings, Filter filter) {
|
||||||
this.pdom = pdom;
|
this.pdom = pdom;
|
||||||
this.bindings = bindings;
|
this.bindings = bindings;
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
|
@ -263,7 +263,7 @@ public class IndexView extends ViewPart implements PDOMDatabase.IListener {
|
||||||
public Object[] getChildren(Object parentElement) {
|
public Object[] getChildren(Object parentElement) {
|
||||||
if (parentElement instanceof ICProject) {
|
if (parentElement instanceof ICProject) {
|
||||||
try {
|
try {
|
||||||
PDOMDatabase pdom = (PDOMDatabase)PDOM.getPDOM(((ICProject)parentElement).getProject());
|
PDOM pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(((ICProject)parentElement).getProject());
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (PDOMLinkage linkage = pdom.getFirstLinkage(); linkage != null; linkage = linkage.getNextLinkage())
|
for (PDOMLinkage linkage = pdom.getFirstLinkage(); linkage != null; linkage = linkage.getNextLinkage())
|
||||||
++n;
|
++n;
|
||||||
|
@ -278,7 +278,7 @@ public class IndexView extends ViewPart implements PDOMDatabase.IListener {
|
||||||
} else if (parentElement instanceof PDOMLinkage) {
|
} else if (parentElement instanceof PDOMLinkage) {
|
||||||
try {
|
try {
|
||||||
PDOMLinkage linkage = (PDOMLinkage)parentElement;
|
PDOMLinkage linkage = (PDOMLinkage)parentElement;
|
||||||
PDOMDatabase pdom = linkage.getPDOM();
|
PDOM pdom = linkage.getPDOM();
|
||||||
Counter counter = new Counter(pdom);
|
Counter counter = new Counter(pdom);
|
||||||
linkage.getIndex().visit(counter);
|
linkage.getIndex().visit(counter);
|
||||||
PDOMBinding[] bindings = new PDOMBinding[counter.count];
|
PDOMBinding[] bindings = new PDOMBinding[counter.count];
|
||||||
|
@ -291,7 +291,7 @@ public class IndexView extends ViewPart implements PDOMDatabase.IListener {
|
||||||
} else if (parentElement instanceof PDOMCPPNamespace) {
|
} else if (parentElement instanceof PDOMCPPNamespace) {
|
||||||
try {
|
try {
|
||||||
PDOMCPPNamespace namespace = (PDOMCPPNamespace)parentElement;
|
PDOMCPPNamespace namespace = (PDOMCPPNamespace)parentElement;
|
||||||
PDOMDatabase pdom = namespace.getPDOM();
|
PDOM pdom = namespace.getPDOM();
|
||||||
Counter counter = new Counter(pdom);
|
Counter counter = new Counter(pdom);
|
||||||
namespace.getIndex().visit(counter);
|
namespace.getIndex().visit(counter);
|
||||||
PDOMBinding[] bindings = new PDOMBinding[counter.count];
|
PDOMBinding[] bindings = new PDOMBinding[counter.count];
|
||||||
|
@ -325,12 +325,12 @@ public class IndexView extends ViewPart implements PDOMDatabase.IListener {
|
||||||
|
|
||||||
public boolean hasChildren(Object element) {
|
public boolean hasChildren(Object element) {
|
||||||
if (element instanceof ICProject) {
|
if (element instanceof ICProject) {
|
||||||
IPDOM ipdom = PDOM.getPDOM(((ICProject)element).getProject());
|
IPDOM ipdom = CCorePlugin.getPDOMManager().getPDOM(((ICProject)element).getProject());
|
||||||
if (ipdom == null || !(ipdom instanceof PDOMDatabase))
|
if (ipdom == null || !(ipdom instanceof PDOM))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
PDOMDatabase pdom = (PDOMDatabase)ipdom;
|
PDOM pdom = (PDOM)ipdom;
|
||||||
return pdom.getFirstLinkage() != null;
|
return pdom.getFirstLinkage() != null;
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CUIPlugin.getDefault().log(e);
|
CUIPlugin.getDefault().log(e);
|
||||||
|
@ -432,7 +432,7 @@ public class IndexView extends ViewPart implements PDOMDatabase.IListener {
|
||||||
ICProject[] cprojects = model.getCProjects();
|
ICProject[] cprojects = model.getCProjects();
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (int i = 0; i < cprojects.length; ++i) {
|
for (int i = 0; i < cprojects.length; ++i) {
|
||||||
PDOMDatabase pdom = (PDOMDatabase)PDOM.getPDOM(cprojects[i].getProject());
|
PDOM pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(cprojects[i].getProject());
|
||||||
if (pdom != null) {
|
if (pdom != null) {
|
||||||
++n;
|
++n;
|
||||||
pdom.addListener(this);
|
pdom.addListener(this);
|
||||||
|
@ -534,7 +534,7 @@ public class IndexView extends ViewPart implements PDOMDatabase.IListener {
|
||||||
viewer.getControl().setFocus();
|
viewer.getControl().setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleChange(PDOMDatabase pdom) {
|
public void handleChange(PDOM pdom) {
|
||||||
viewer.getControl().getDisplay().asyncExec(new Runnable() {
|
viewer.getControl().getDisplay().asyncExec(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
viewer.refresh();
|
viewer.refresh();
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui.indexview;
|
package org.eclipse.cdt.internal.ui.indexview;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.IBTreeVisitor;
|
import org.eclipse.cdt.internal.core.pdom.db.IBTreeVisitor;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
|
@ -23,14 +23,14 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
*/
|
*/
|
||||||
public class LinkageCache {
|
public class LinkageCache {
|
||||||
|
|
||||||
private final PDOMDatabase pdom;
|
private final PDOM pdom;
|
||||||
private final PDOMLinkage linkage;
|
private final PDOMLinkage linkage;
|
||||||
private int[] cache;
|
private int[] cache;
|
||||||
|
|
||||||
private static class Counter implements IBTreeVisitor {
|
private static class Counter implements IBTreeVisitor {
|
||||||
int count;
|
int count;
|
||||||
PDOMDatabase pdom;
|
PDOM pdom;
|
||||||
public Counter(PDOMDatabase pdom) {
|
public Counter(PDOM pdom) {
|
||||||
this.pdom = pdom;
|
this.pdom = pdom;
|
||||||
}
|
}
|
||||||
public int compare(int record) throws CoreException {
|
public int compare(int record) throws CoreException {
|
||||||
|
@ -44,10 +44,10 @@ public class LinkageCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class FillCache implements IBTreeVisitor {
|
private static class FillCache implements IBTreeVisitor {
|
||||||
final PDOMDatabase pdom;
|
final PDOM pdom;
|
||||||
final int[] cache;
|
final int[] cache;
|
||||||
int index;
|
int index;
|
||||||
public FillCache(PDOMDatabase pdom, int [] cache) {
|
public FillCache(PDOM pdom, int [] cache) {
|
||||||
this.pdom = pdom;
|
this.pdom = pdom;
|
||||||
this.cache = cache;
|
this.cache = cache;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public class LinkageCache {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinkageCache(PDOMDatabase pdom, PDOMLinkage linkage) throws CoreException {
|
public LinkageCache(PDOM pdom, PDOMLinkage linkage) throws CoreException {
|
||||||
this.pdom = pdom;
|
this.pdom = pdom;
|
||||||
this.linkage = linkage;
|
this.linkage = linkage;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui.indexview;
|
package org.eclipse.cdt.internal.ui.indexview;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.PDOM;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMUpdator;
|
import org.eclipse.cdt.internal.core.pdom.PDOMUpdator;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
@ -43,7 +43,7 @@ public class RebuildIndexAction extends IndexAction {
|
||||||
|
|
||||||
ICProject cproject = (ICProject)objs[i];
|
ICProject cproject = (ICProject)objs[i];
|
||||||
try {
|
try {
|
||||||
PDOM.deletePDOM(cproject.getProject());
|
CCorePlugin.getPDOMManager().deletePDOM(cproject.getProject());
|
||||||
PDOMUpdator job = new PDOMUpdator(cproject, null);
|
PDOMUpdator job = new PDOMUpdator(cproject, null);
|
||||||
job.schedule();
|
job.schedule();
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
|
|
@ -15,9 +15,9 @@ import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.PDOM;
|
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.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
@ -93,7 +93,7 @@ public class PDOMSearchPatternQuery extends PDOMSearchQuery {
|
||||||
// Not a CDT project
|
// Not a CDT project
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PDOMDatabase pdom = (PDOMDatabase)PDOM.getPDOM(project);
|
PDOM pdom = (PDOM)CCorePlugin.getPDOMManager().getPDOM(project);
|
||||||
PDOMBinding[] bindings = pdom.findBindings(pattern);
|
PDOMBinding[] bindings = pdom.findBindings(pattern);
|
||||||
|
|
||||||
for (int i = 0; i < bindings.length; ++i) {
|
for (int i = 0; i < bindings.length; ++i) {
|
||||||
|
|
|
@ -14,10 +14,10 @@ package org.eclipse.cdt.internal.ui.search.actions;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.CDOM;
|
import org.eclipse.cdt.core.dom.CDOM;
|
||||||
import org.eclipse.cdt.core.dom.IASTServiceProvider;
|
import org.eclipse.cdt.core.dom.IASTServiceProvider;
|
||||||
import org.eclipse.cdt.core.dom.IPDOM;
|
import org.eclipse.cdt.core.dom.IPDOM;
|
||||||
import org.eclipse.cdt.core.dom.PDOM;
|
|
||||||
import org.eclipse.cdt.core.dom.IASTServiceProvider.UnsupportedDialectException;
|
import org.eclipse.cdt.core.dom.IASTServiceProvider.UnsupportedDialectException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
@ -127,7 +127,7 @@ public class OpenDeclarationsAction extends SelectionParseAction implements IUpd
|
||||||
IWorkingCopy workingCopy = (IWorkingCopy)fEditor.getInputCElement();
|
IWorkingCopy workingCopy = (IWorkingCopy)fEditor.getInputCElement();
|
||||||
IFile resourceFile = (IFile)workingCopy.getResource();
|
IFile resourceFile = (IFile)workingCopy.getResource();
|
||||||
project = new CProject(null, resourceFile.getProject());
|
project = new CProject(null, resourceFile.getProject());
|
||||||
IPDOM pdom = PDOM.getPDOM(resourceFile.getProject());
|
IPDOM pdom = CCorePlugin.getPDOMManager().getPDOM(resourceFile.getProject());
|
||||||
try {
|
try {
|
||||||
if (pdom != null) {
|
if (pdom != null) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -13,10 +13,10 @@ package org.eclipse.cdt.internal.ui.text.contentassist;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.CDOM;
|
import org.eclipse.cdt.core.dom.CDOM;
|
||||||
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
||||||
import org.eclipse.cdt.core.dom.IPDOM;
|
import org.eclipse.cdt.core.dom.IPDOM;
|
||||||
import org.eclipse.cdt.core.dom.PDOM;
|
|
||||||
import org.eclipse.cdt.core.dom.IASTServiceProvider.UnsupportedDialectException;
|
import org.eclipse.cdt.core.dom.IASTServiceProvider.UnsupportedDialectException;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||||
|
@ -83,7 +83,7 @@ public class CCompletionProcessor2 implements IContentAssistProcessor {
|
||||||
IFile file = (IFile)workingCopy.getResource();
|
IFile file = (IFile)workingCopy.getResource();
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
IProject project = file.getProject();
|
IProject project = file.getProject();
|
||||||
IPDOM pdom = PDOM.getPDOM(project);
|
IPDOM pdom = CCorePlugin.getPDOMManager().getPDOM(project);
|
||||||
ICodeReaderFactory readerFactory;
|
ICodeReaderFactory readerFactory;
|
||||||
if (pdom != null)
|
if (pdom != null)
|
||||||
readerFactory = pdom.getCodeReaderFactory(workingCopy);
|
readerFactory = pdom.getCodeReaderFactory(workingCopy);
|
||||||
|
@ -93,7 +93,7 @@ public class CCompletionProcessor2 implements IContentAssistProcessor {
|
||||||
} else if (editor.getEditorInput() instanceof ExternalEditorInput) {
|
} else if (editor.getEditorInput() instanceof ExternalEditorInput) {
|
||||||
IStorage storage = ((ExternalEditorInput)(editor.getEditorInput())).getStorage();
|
IStorage storage = ((ExternalEditorInput)(editor.getEditorInput())).getStorage();
|
||||||
IProject project = workingCopy.getCProject().getProject();
|
IProject project = workingCopy.getCProject().getProject();
|
||||||
IPDOM pdom = PDOM.getPDOM(project);
|
IPDOM pdom = CCorePlugin.getPDOMManager().getPDOM(project);
|
||||||
ICodeReaderFactory readerFactory;
|
ICodeReaderFactory readerFactory;
|
||||||
if (pdom != null)
|
if (pdom != null)
|
||||||
readerFactory = pdom.getCodeReaderFactory(workingCopy);
|
readerFactory = pdom.getCodeReaderFactory(workingCopy);
|
||||||
|
|
|
@ -16,10 +16,6 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.ICDescriptor;
|
|
||||||
import org.eclipse.cdt.core.ICDescriptorOperation;
|
|
||||||
import org.eclipse.cdt.core.dom.PDOM;
|
|
||||||
import org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexer;
|
|
||||||
import org.eclipse.cdt.internal.core.index.nullindexer.NullIndexer;
|
import org.eclipse.cdt.internal.core.index.nullindexer.NullIndexer;
|
||||||
import org.eclipse.cdt.internal.ui.CUIMessages;
|
import org.eclipse.cdt.internal.ui.CUIMessages;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
@ -33,17 +29,12 @@ import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.QualifiedName;
|
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
|
||||||
import org.eclipse.swt.SWT;
|
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.events.SelectionListener;
|
|
||||||
import org.eclipse.swt.graphics.Font;
|
import org.eclipse.swt.graphics.Font;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Button;
|
|
||||||
import org.eclipse.swt.widgets.Combo;
|
import org.eclipse.swt.widgets.Combo;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Group;
|
import org.eclipse.swt.widgets.Group;
|
||||||
|
@ -60,19 +51,10 @@ import org.eclipse.swt.widgets.Group;
|
||||||
|
|
||||||
public class IndexerBlock extends AbstractCOptionPage {
|
public class IndexerBlock extends AbstractCOptionPage {
|
||||||
|
|
||||||
public final static String INDEX_UI_ID = CUIPlugin.PLUGIN_ID + ".cdtindexers"; //$NON-NLS-1$
|
|
||||||
public final static String INDEXERUIID = "indexerUIID"; //$NON-NLS-1$
|
|
||||||
public final static QualifiedName indexerUIIDKey = new QualifiedName(INDEX_UI_ID, INDEXERUIID);
|
|
||||||
|
|
||||||
public static final String INDEXER_UI = "indexerUI"; //$NON-NLS-1$
|
|
||||||
public static final String INDEXER_UI_VALUE = "indexerUIValue"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
private static final String INDEXER_LABEL = CUIPlugin.getResourceString("BaseIndexerBlock.label" ); //$NON-NLS-1$
|
private static final String INDEXER_LABEL = CUIPlugin.getResourceString("BaseIndexerBlock.label" ); //$NON-NLS-1$
|
||||||
private static final String INDEXER_DESCRIPTION = CUIPlugin.getResourceString("BaseIndexerBlock.desc"); //$NON-NLS-1$
|
private static final String INDEXER_DESCRIPTION = CUIPlugin.getResourceString("BaseIndexerBlock.desc"); //$NON-NLS-1$
|
||||||
private static final String INDEXER_COMBO_LABEL = CUIPlugin.getResourceString("BaseIndexerBlock.comboLabel"); //$NON-NLS-1$
|
private static final String INDEXER_COMBO_LABEL = CUIPlugin.getResourceString("BaseIndexerBlock.comboLabel"); //$NON-NLS-1$
|
||||||
private static final String INDEXER_USE_PDOM = CUIPlugin.getResourceString("BaseIndexerBlock.usePDOM"); //$NON-NLS-1$
|
|
||||||
|
|
||||||
private Button indexerUsePDOM;
|
|
||||||
private Combo indexersComboBox;
|
private Combo indexersComboBox;
|
||||||
private HashMap indexerPageMap;
|
private HashMap indexerPageMap;
|
||||||
private List indexerPageList;
|
private List indexerPageList;
|
||||||
|
@ -83,10 +65,6 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
int nullIndexerIndex;
|
int nullIndexerIndex;
|
||||||
|
|
||||||
String initialSelected;
|
String initialSelected;
|
||||||
private IPreferenceStore prefStore=CUIPlugin.getDefault().getPreferenceStore();
|
|
||||||
|
|
||||||
boolean initialPDOMChecked;
|
|
||||||
boolean pdomChecked;
|
|
||||||
|
|
||||||
public IndexerBlock(){
|
public IndexerBlock(){
|
||||||
super(INDEXER_LABEL);
|
super(INDEXER_LABEL);
|
||||||
|
@ -122,7 +100,6 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
|
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
|
|
||||||
|
|
||||||
Composite composite = ControlFactory.createComposite(parent, 1);
|
Composite composite = ControlFactory.createComposite(parent, 1);
|
||||||
Font font = parent.getFont();
|
Font font = parent.getFont();
|
||||||
GridLayout layout= ((GridLayout)composite.getLayout());
|
GridLayout layout= ((GridLayout)composite.getLayout());
|
||||||
|
@ -211,29 +188,6 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private boolean createIndexerControls(Composite parent) {
|
private boolean createIndexerControls(Composite parent) {
|
||||||
// PDOM selection
|
|
||||||
indexerUsePDOM = new Button(parent, SWT.CHECK);
|
|
||||||
indexerUsePDOM.setText(INDEXER_USE_PDOM);
|
|
||||||
indexerUsePDOM.addSelectionListener(new SelectionListener() {
|
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
|
||||||
}
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
|
||||||
if (indexerUsePDOM.getSelection()) {
|
|
||||||
pdomChecked = true;
|
|
||||||
indexersComboBox.select(nullIndexerIndex);
|
|
||||||
setPage();
|
|
||||||
indexersComboBox.setEnabled(false);
|
|
||||||
} else {
|
|
||||||
pdomChecked = false;
|
|
||||||
indexersComboBox.setEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
pdomChecked = initialPDOMChecked = prefStore.getBoolean(CCorePlugin.USE_PDOM_PREF);
|
|
||||||
indexerUsePDOM.setSelection(initialPDOMChecked);
|
|
||||||
//TODO: Put in some logic to deal with old CDT project: upgrade old projects
|
|
||||||
//to use the Classic CDT Indexer
|
|
||||||
|
|
||||||
Group group= ControlFactory.createGroup(parent,INDEXER_COMBO_LABEL,2);
|
Group group= ControlFactory.createGroup(parent,INDEXER_COMBO_LABEL,2);
|
||||||
|
|
||||||
// Add discovered indexers combo box
|
// Add discovered indexers combo box
|
||||||
|
@ -259,14 +213,8 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
//See what the preferred indexer is
|
//See what the preferred indexer is
|
||||||
String indexerId=prefStore.getString(CCorePlugin.PREF_INDEXER);
|
String indexerId = CCorePlugin.getPDOMManager().getDefaultIndexerId();
|
||||||
String preferredIndexer=null;
|
String preferredIndexer = getIndexerPageName(indexerId);
|
||||||
if (indexerId.equals("")) { //$NON-NLS-1$
|
|
||||||
preferredIndexer=getIndexerPageName(DOMSourceIndexer.ID);
|
|
||||||
} else {
|
|
||||||
preferredIndexer=getIndexerPageName(indexerId);
|
|
||||||
}
|
|
||||||
|
|
||||||
String[] indexerList = indexersComboBox.getItems();
|
String[] indexerList = indexersComboBox.getItems();
|
||||||
int selectedIndex = 0;
|
int selectedIndex = 0;
|
||||||
for (int i=0; i<indexerList.length; i++){
|
for (int i=0; i<indexerList.length; i++){
|
||||||
|
@ -392,26 +340,10 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
: ((AbstractIndexerPage) currentPage).getCurrentProject();
|
: ((AbstractIndexerPage) currentPage).getCurrentProject();
|
||||||
|
|
||||||
if ( project != null) {
|
if ( project != null) {
|
||||||
ICDescriptorOperation op = new ICDescriptorOperation() {
|
CCorePlugin.getPDOMManager().setIndexerId(project, indexerID);
|
||||||
|
if (currentPage != null && currentPage.getControl() != null) {
|
||||||
public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
|
currentPage.performApply(new SubProgressMonitor(monitor, 1));
|
||||||
if (initialPDOMChecked != pdomChecked)
|
|
||||||
PDOM.setEnabled(project, pdomChecked);
|
|
||||||
if (initialSelected == null || !selected.equals(initialSelected)) {
|
|
||||||
descriptor.remove(CCorePlugin.INDEXER_UNIQ_ID);
|
|
||||||
descriptor.create(CCorePlugin.INDEXER_UNIQ_ID,indexerID);
|
|
||||||
}
|
}
|
||||||
monitor.worked(1);
|
|
||||||
// Give a chance to the contributions to save.
|
|
||||||
// We have to do it last to make sure the indexer id
|
|
||||||
// is saved in .cdtproject
|
|
||||||
ICOptionPage page = currentPage; //egetBinaryParserPage(((BinaryParserConfiguration) selected.get(i)).getID());
|
|
||||||
if (page != null && page.getControl() != null) {
|
|
||||||
page.performApply(new SubProgressMonitor(monitor, 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(project, op, monitor);
|
|
||||||
//Only send out an index changed notification if the indexer has actually changed
|
//Only send out an index changed notification if the indexer has actually changed
|
||||||
if (initialSelected == null || !selected.equals(initialSelected)) {
|
if (initialSelected == null || !selected.equals(initialSelected)) {
|
||||||
CCorePlugin.getDefault().getCoreModel().getIndexManager().indexerChangeNotification(project);
|
CCorePlugin.getDefault().getCoreModel().getIndexManager().indexerChangeNotification(project);
|
||||||
|
@ -419,16 +351,13 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
} else {
|
} else {
|
||||||
if (initialSelected == null || !selected.equals(initialSelected)) {
|
if (initialSelected == null || !selected.equals(initialSelected)) {
|
||||||
|
|
||||||
if (prefStore != null) {
|
|
||||||
prefStore.setValue(CCorePlugin.USE_PDOM_PREF, pdomChecked);
|
|
||||||
// First clean out the old indexer settings
|
// First clean out the old indexer settings
|
||||||
String indexerId=prefStore.getString(CCorePlugin.PREF_INDEXER);
|
String oldId = CCorePlugin.getPDOMManager().getDefaultIndexerId();
|
||||||
ICOptionPage tempPage = getIndexerPage(indexerId);
|
ICOptionPage tempPage = getIndexerPage(oldId);
|
||||||
if (tempPage instanceof AbstractIndexerPage)
|
if (tempPage instanceof AbstractIndexerPage)
|
||||||
((AbstractIndexerPage) tempPage).removePreferences();
|
((AbstractIndexerPage) tempPage).removePreferences();
|
||||||
|
|
||||||
prefStore.setValue(CCorePlugin.PREF_INDEXER, indexerID);
|
CCorePlugin.getPDOMManager().setDefaultIndexerId(indexerID);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
monitor.worked(1);
|
monitor.worked(1);
|
||||||
// Give a chance to the contributions to save.
|
// Give a chance to the contributions to save.
|
||||||
|
@ -483,10 +412,6 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
* @param project
|
* @param project
|
||||||
*/
|
*/
|
||||||
public void setIndexerID(String indexerID, IProject project) {
|
public void setIndexerID(String indexerID, IProject project) {
|
||||||
if (PDOM.isInitialized(project)) {
|
|
||||||
initialPDOMChecked = pdomChecked = PDOM.isEnabled(project);
|
|
||||||
indexerUsePDOM.setSelection(initialPDOMChecked);
|
|
||||||
}
|
|
||||||
//Get the corresponding text for the given indexer id
|
//Get the corresponding text for the given indexer id
|
||||||
selectedIndexerId = getIndexerPageName(indexerID);
|
selectedIndexerId = getIndexerPageName(indexerID);
|
||||||
//Store the currently selected indexer id
|
//Store the currently selected indexer id
|
||||||
|
@ -507,7 +432,6 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getSelectedIndexerID(){
|
public String getSelectedIndexerID(){
|
||||||
String indexerID = null;
|
String indexerID = null;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2005 IBM Corporation and others.
|
* Copyright (c) 2004, 2006 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
|
||||||
|
@ -12,9 +12,6 @@
|
||||||
package org.eclipse.cdt.ui.dialogs;
|
package org.eclipse.cdt.ui.dialogs;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.ICDescriptor;
|
|
||||||
import org.eclipse.cdt.core.ICExtensionReference;
|
|
||||||
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
|
||||||
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -25,27 +22,17 @@ import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
import org.eclipse.ui.dialogs.PropertyPage;
|
import org.eclipse.ui.dialogs.PropertyPage;
|
||||||
import org.w3c.dom.Element;
|
|
||||||
import org.w3c.dom.Node;
|
|
||||||
|
|
||||||
|
|
||||||
public class IndexerOptionPropertyPage extends PropertyPage {
|
public class IndexerOptionPropertyPage extends PropertyPage {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private IndexerBlock optionPage;
|
private IndexerBlock optionPage;
|
||||||
private String oldIndexerID;
|
private String oldIndexerID;
|
||||||
|
|
||||||
private boolean requestedIndexAll;
|
|
||||||
|
|
||||||
public IndexerOptionPropertyPage(){
|
public IndexerOptionPropertyPage(){
|
||||||
super();
|
super();
|
||||||
optionPage = new IndexerBlock();
|
optionPage = new IndexerBlock();
|
||||||
requestedIndexAll = false;
|
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
|
|
||||||
*/
|
|
||||||
protected Control createContents(Composite parent) {
|
protected Control createContents(Composite parent) {
|
||||||
Composite composite = new Composite(parent, SWT.NONE);
|
Composite composite = new Composite(parent, SWT.NONE);
|
||||||
composite.setLayout(new FillLayout());
|
composite.setLayout(new FillLayout());
|
||||||
|
@ -57,7 +44,6 @@ public class IndexerOptionPropertyPage extends PropertyPage {
|
||||||
return composite;
|
return composite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void performDefaults() {
|
protected void performDefaults() {
|
||||||
IProject tempProject = getProject();
|
IProject tempProject = getProject();
|
||||||
optionPage.resetIndexerPageSettings(tempProject);
|
optionPage.resetIndexerPageSettings(tempProject);
|
||||||
|
@ -65,22 +51,11 @@ public class IndexerOptionPropertyPage extends PropertyPage {
|
||||||
|
|
||||||
private void initialize(){
|
private void initialize(){
|
||||||
IProject project = getProject();
|
IProject project = getProject();
|
||||||
|
oldIndexerID = CCorePlugin.getPDOMManager().getIndexerId(project);
|
||||||
try {
|
|
||||||
oldIndexerID = getIndexerID(project);
|
|
||||||
|
|
||||||
} catch (CoreException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
optionPage.setIndexerID(oldIndexerID, project);
|
optionPage.setIndexerID(oldIndexerID, project);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see IPreferencePage#performOk()
|
|
||||||
*/
|
|
||||||
public boolean performOk() {
|
public boolean performOk() {
|
||||||
|
|
||||||
IProject tempProject = getProject();
|
IProject tempProject = getProject();
|
||||||
try {
|
try {
|
||||||
optionPage.persistIndexerSettings(tempProject, new NullProgressMonitor());
|
optionPage.persistIndexerSettings(tempProject, new NullProgressMonitor());
|
||||||
|
@ -98,41 +73,4 @@ public class IndexerOptionPropertyPage extends PropertyPage {
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIndexerID(IProject project) throws CoreException {
|
|
||||||
|
|
||||||
|
|
||||||
ICDescriptor desc = CCorePlugin.getDefault().getCProjectDescription(project, true);
|
|
||||||
ICExtensionReference[] ref = desc.get(CCorePlugin.INDEXER_UNIQ_ID);
|
|
||||||
String indexerID = null;
|
|
||||||
for (int i = 0; i < ref.length; i++) {
|
|
||||||
indexerID = ref[i].getID();
|
|
||||||
}
|
|
||||||
|
|
||||||
return indexerID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads indexerID from .cdtproject file
|
|
||||||
* @param project
|
|
||||||
* @param includes
|
|
||||||
* @param symbols
|
|
||||||
* @throws CoreException
|
|
||||||
*/
|
|
||||||
private String loadIndexerIDFromCDescriptor(IProject project) throws CoreException {
|
|
||||||
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project, true);
|
|
||||||
|
|
||||||
Node child = descriptor.getProjectData(IndexManager.CDT_INDEXER).getFirstChild();
|
|
||||||
|
|
||||||
String indexerID = ""; //$NON-NLS-1$
|
|
||||||
|
|
||||||
while (child != null) {
|
|
||||||
if (child.getNodeName().equals(IndexerBlock.INDEXER_UI))
|
|
||||||
indexerID = ((Element)child).getAttribute(IndexerBlock.INDEXER_UI_VALUE);
|
|
||||||
|
|
||||||
child = child.getNextSibling();
|
|
||||||
}
|
|
||||||
|
|
||||||
return indexerID;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue