mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cleaned up the PDOM stuff, we'll put it in it's own plugin to make it optional.
This commit is contained in:
parent
f31b6c334c
commit
4db06ada35
9 changed files with 1 additions and 419 deletions
|
@ -10,6 +10,5 @@
|
||||||
<classpathentry kind="src" path="browser"/>
|
<classpathentry kind="src" path="browser"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="src" path="pdom"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,27 +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.pdom;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.core.runtime.QualifiedName;
|
|
||||||
|
|
||||||
public interface IPDOMDatabaseProvider {
|
|
||||||
|
|
||||||
public static final QualifiedName dbNameKey
|
|
||||||
= new QualifiedName(CCorePlugin.PLUGIN_ID, "pdomDBName");
|
|
||||||
|
|
||||||
Connection getDatabase(String dbName, boolean create);
|
|
||||||
|
|
||||||
void shutdownDatabase(String dbName);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,134 +0,0 @@
|
||||||
package org.eclipse.cdt.core.pdom;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
|
||||||
import org.eclipse.core.runtime.IExtension;
|
|
||||||
import org.eclipse.core.runtime.IExtensionPoint;
|
|
||||||
import org.eclipse.core.runtime.Platform;
|
|
||||||
|
|
||||||
public class PDOM {
|
|
||||||
|
|
||||||
// The DOM hash map
|
|
||||||
private static Map pdomMap = new HashMap();
|
|
||||||
|
|
||||||
private Connection dbConn;
|
|
||||||
|
|
||||||
private PDOM(Connection conn) {
|
|
||||||
dbConn = conn;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Look up the name from the DOM in the PDOM and return the PDOM
|
|
||||||
* version of the Binding.
|
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
* @return binding
|
|
||||||
*/
|
|
||||||
public IBinding resolveBinding(IASTName name) {
|
|
||||||
// look up the name in the PDOM
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return all bindings that have this name as a prefix.
|
|
||||||
* This is used for content assist.
|
|
||||||
*
|
|
||||||
* @param prefix
|
|
||||||
* @return bindings
|
|
||||||
*/
|
|
||||||
public IBinding[] resolvePrefix(IASTName name) {
|
|
||||||
return new IBinding[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the name to the PDOM. This will also add the binding to the
|
|
||||||
* PDOM if it is not already there.
|
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
*/
|
|
||||||
public void addName(IASTName name) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all names stored in the PDOM for a given binding.
|
|
||||||
*
|
|
||||||
* @param binding
|
|
||||||
* @return declarations
|
|
||||||
*/
|
|
||||||
public Iterator getDeclarations(IBinding binding) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all names in the PDOM that refer to a given binding.
|
|
||||||
* @param binding
|
|
||||||
* @return references
|
|
||||||
*/
|
|
||||||
public Iterator getReferences(IBinding binding) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear all names from the PDOM that appear in the given file.
|
|
||||||
* This is used when reparsing a file.
|
|
||||||
*
|
|
||||||
* @param filename
|
|
||||||
*/
|
|
||||||
public void clearNamesInFile(String filename) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the PDOM for the given project
|
|
||||||
*
|
|
||||||
* @param project
|
|
||||||
* @return the PDOM for the project
|
|
||||||
* @throws CoreException
|
|
||||||
*/
|
|
||||||
public static PDOM getPDOM(IProject project) throws CoreException {
|
|
||||||
// Get the name for the db
|
|
||||||
boolean create = false;
|
|
||||||
String dbName = project.getPersistentProperty(IPDOMDatabaseProvider.dbNameKey);
|
|
||||||
if (dbName == null) {
|
|
||||||
// New database
|
|
||||||
create = true;
|
|
||||||
// TODO - the name shouldn't be the project name in case the
|
|
||||||
// user changes it and creates a new one with the old name
|
|
||||||
dbName = project.getName();
|
|
||||||
project.setPersistentProperty(IPDOMDatabaseProvider.dbNameKey, dbName);
|
|
||||||
} else {
|
|
||||||
// See if we got one already
|
|
||||||
PDOM pdom = (PDOM)pdomMap.get(dbName);
|
|
||||||
if (pdom != null)
|
|
||||||
return pdom;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find our database provider
|
|
||||||
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, "PDOMDatabaseProvider"); //$NON-NLS-1$
|
|
||||||
IExtension[] extensions = extensionPoint.getExtensions();
|
|
||||||
|
|
||||||
if (extensions.length == 0)
|
|
||||||
// No DB providers
|
|
||||||
return null;
|
|
||||||
|
|
||||||
// For now pick the first one. In the future we may want to support more
|
|
||||||
IConfigurationElement[] elements = extensions[0].getConfigurationElements();
|
|
||||||
IPDOMDatabaseProvider dbProvider
|
|
||||||
= (IPDOMDatabaseProvider)elements[0].createExecutableExtension("class"); //$NON-NLS-1$
|
|
||||||
|
|
||||||
// create the PDOM
|
|
||||||
PDOM pdom = new PDOM(dbProvider.getDatabase(dbName, create));
|
|
||||||
pdomMap.put(dbName, pdom);
|
|
||||||
return pdom;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,59 +0,0 @@
|
||||||
package org.eclipse.cdt.core.pdom;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.IASTServiceProvider;
|
|
||||||
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
|
||||||
import org.eclipse.cdt.core.dom.IParserConfiguration;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
|
||||||
import org.eclipse.core.resources.IFile;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.core.resources.IStorage;
|
|
||||||
|
|
||||||
public class PDOMASTServiceProvider implements IASTServiceProvider {
|
|
||||||
|
|
||||||
public IASTTranslationUnit getTranslationUnit(IFile fileToParse)
|
|
||||||
throws UnsupportedDialectException {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IASTTranslationUnit getTranslationUnit(IStorage fileToParse,
|
|
||||||
IProject project, ICodeReaderFactory fileCreator)
|
|
||||||
throws UnsupportedDialectException {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IASTTranslationUnit getTranslationUnit(IStorage fileToParse,
|
|
||||||
IProject project) throws UnsupportedDialectException {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IASTTranslationUnit getTranslationUnit(IFile fileToParse,
|
|
||||||
ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IASTTranslationUnit getTranslationUnit(IFile fileToParse,
|
|
||||||
ICodeReaderFactory fileCreator, IParserConfiguration configuration)
|
|
||||||
throws UnsupportedDialectException {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ASTCompletionNode getCompletionNode(IFile fileToParse, int offset,
|
|
||||||
ICodeReaderFactory fileCreator) throws UnsupportedDialectException {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ASTCompletionNode getCompletionNode(IStorage fileToParse,
|
|
||||||
IProject project, int offset, ICodeReaderFactory fileCreator)
|
|
||||||
throws UnsupportedDialectException {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
package org.eclipse.cdt.core.pdom;
|
|
||||||
|
|
||||||
|
|
||||||
public class PDOMUnimplementedException extends Error {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 99L;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,87 +0,0 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
|
||||||
import org.eclipse.cdt.core.pdom.PDOMUnimplementedException;
|
|
||||||
|
|
||||||
public class PCASTName implements IASTName {
|
|
||||||
|
|
||||||
public IBinding resolveBinding() {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IBinding getBinding() {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBinding(IBinding binding) {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IBinding[] resolvePrefix() {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public char[] toCharArray() {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDeclaration() {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isReference() {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDefinition() {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IASTTranslationUnit getTranslationUnit() {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IASTNodeLocation[] getNodeLocations() {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IASTFileLocation getFileLocation() {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContainingFilename() {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IASTNode getParent() {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setParent(IASTNode node) {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ASTNodeProperty getPropertyInParent() {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPropertyInParent(ASTNodeProperty property) {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean accept(ASTVisitor visitor) {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRawSignature() {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,59 +0,0 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICBasicType;
|
|
||||||
import org.eclipse.cdt.core.pdom.PDOMUnimplementedException;
|
|
||||||
|
|
||||||
public class PCBasicType implements ICBasicType {
|
|
||||||
|
|
||||||
public Object clone() {
|
|
||||||
try {
|
|
||||||
return super.clone();
|
|
||||||
} catch (CloneNotSupportedException e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isComplex() {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isImaginary() {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isLongLong() throws DOMException {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getType() throws DOMException {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IASTExpression getValue() throws DOMException {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSigned() throws DOMException {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isUnsigned() throws DOMException {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isShort() throws DOMException {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isLong() throws DOMException {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSameType(IType type) {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
|
||||||
import org.eclipse.cdt.core.pdom.PDOMUnimplementedException;
|
|
||||||
|
|
||||||
public class PCVariable implements IVariable {
|
|
||||||
|
|
||||||
public IType getType() throws DOMException {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isStatic() throws DOMException {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isExtern() throws DOMException {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAuto() throws DOMException {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isRegister() throws DOMException {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public char[] getNameCharArray() {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IScope getScope() throws DOMException {
|
|
||||||
throw new PDOMUnimplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -33,7 +33,7 @@ public interface IASTServiceProvider {
|
||||||
*/
|
*/
|
||||||
public static class UnsupportedDialectException extends Exception
|
public static class UnsupportedDialectException extends Exception
|
||||||
{
|
{
|
||||||
|
public static final long serialVersionUID = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue