From a39da76e9e4c41127bf22251c240625c5a5239ad Mon Sep 17 00:00:00 2001 From: Doug Schaefer Date: Mon, 28 Nov 2005 04:35:36 +0000 Subject: [PATCH] Working on getting language and type info into the bindings. Fixed up the name of the pdom.dom package. Pushed IOExceptions as low down as I could. --- .../cdt/internal/pdom/tests/DBTest.java | 6 +- .../org.eclipse.cdt.core/META-INF/MANIFEST.MF | 2 +- .../org/eclipse/cdt/core/dom/ILanguage.java | 12 +- .../cdt/core/dom/ast/gnu/c/GCCLanguage.java | 47 ++----- .../cdt/core/dom/ast/gnu/cpp/GPPLanguage.java | 60 ++++----- .../core/pdom/PDOMCodeReaderFactory.java | 4 +- .../cdt/internal/core/pdom/PDOMDatabase.java | 90 ++++--------- .../cdt/internal/core/pdom/PDOMManager.java | 3 +- .../cdt/internal/core/pdom/PDOMUpdator.java | 2 - .../cdt/internal/core/pdom/PDOMUtils.java | 7 +- .../cdt/internal/core/pdom/db/BTree.java | 93 ++------------ .../cdt/internal/core/pdom/db/Chunk.java | 12 +- .../cdt/internal/core/pdom/db/DBStatus.java} | 32 +++-- .../cdt/internal/core/pdom/db/Database.java | 108 +++++++++------- .../core/pdom/db/IBTreeComparator.java | 4 +- .../internal/core/pdom/db/IBTreeVisitor.java | 6 +- .../core/pdom/db/StringComparator.java | 4 +- .../internal/core/pdom/db/StringVisitor.java | 4 +- .../{ => core}/pdom/dom/PDOMBinding.java | 83 ++++++------ .../{ => core}/pdom/dom/PDOMFile.java | 28 ++--- .../{ => core}/pdom/dom/PDOMName.java | 71 +++++------ .../pdom/dom/PDOMNotImplementedError.java | 2 +- .../pdom/dom/PDOMTranslationUnit.java | 2 +- .../core/pdom/dom/cpp/PDOMCPPVariable.java | 86 +++++++++++++ core/org.eclipse.cdt.core/plugin.xml | 1 - .../schema/PDOMProvider.exsd | 119 ------------------ .../eclipse/cdt/core/dom/IPDOMProvider.java | 54 -------- .../src/org/eclipse/cdt/core/dom/PDOM.java | 39 +----- 28 files changed, 357 insertions(+), 624 deletions(-) rename core/org.eclipse.cdt.core/{src/org/eclipse/cdt/internal/core/dom/NullPDOMProvider.java => parser/org/eclipse/cdt/internal/core/pdom/db/DBStatus.java} (52%) rename core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/{ => core}/pdom/dom/PDOMBinding.java (64%) rename core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/{ => core}/pdom/dom/PDOMFile.java (80%) rename core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/{ => core}/pdom/dom/PDOMName.java (77%) rename core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/{ => core}/pdom/dom/PDOMNotImplementedError.java (93%) rename core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/{ => core}/pdom/dom/PDOMTranslationUnit.java (98%) create mode 100644 core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java delete mode 100644 core/org.eclipse.cdt.core/schema/PDOMProvider.exsd delete mode 100644 core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/dom/IPDOMProvider.java diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/DBTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/DBTest.java index 00af70b106f..e275269a850 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/DBTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/DBTest.java @@ -1,7 +1,6 @@ package org.eclipse.cdt.internal.pdom.tests; import java.io.File; -import java.io.IOException; import junit.framework.TestCase; @@ -10,6 +9,7 @@ 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.StringComparator; import org.eclipse.cdt.internal.core.pdom.db.StringVisitor; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; public class DBTest extends TestCase { @@ -79,12 +79,12 @@ public class DBTest extends TestCase { super(db, Database.INT_SIZE, key); } - public boolean visit(int record) throws IOException { + public boolean visit(int record) throws CoreException { this.record = record; return false; } - public int findIn(BTree btree) throws IOException { + public int findIn(BTree btree) throws CoreException { btree.visit(this); return record; } diff --git a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF index 0ce48740018..5e219c94127 100644 --- a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF +++ b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF @@ -56,6 +56,7 @@ Export-Package: ., org.eclipse.cdt.internal.core.parser.util, org.eclipse.cdt.internal.core.pdom, org.eclipse.cdt.internal.core.pdom.db, + org.eclipse.cdt.internal.core.pdom.dom, org.eclipse.cdt.internal.core.search, org.eclipse.cdt.internal.core.search.indexing, org.eclipse.cdt.internal.core.search.matching, @@ -64,7 +65,6 @@ Export-Package: ., org.eclipse.cdt.internal.core.util, org.eclipse.cdt.internal.errorparsers, org.eclipse.cdt.internal.formatter, - org.eclipse.cdt.internal.pdom.dom, org.eclipse.cdt.utils, org.eclipse.cdt.utils.coff, org.eclipse.cdt.utils.coff.parser, diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ILanguage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ILanguage.java index 3fa4923e21e..9df01bcf9b6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ILanguage.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ILanguage.java @@ -17,7 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.model.IWorkingCopy; import org.eclipse.cdt.internal.core.pdom.PDOMDatabase; -import org.eclipse.cdt.internal.pdom.dom.PDOMBinding; +import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; import org.eclipse.core.runtime.CoreException; /** @@ -92,14 +92,14 @@ public interface ILanguage { public PDOMBinding getPDOMBinding(PDOMDatabase pdom, IASTName name) throws CoreException; /** - * Return a new PDOM Binding that has the given language specific type. - * The type id is extracted from the PDOM Database. - * + * Creates a language specific binding given the generic binding extracted + * from the PDOM database. + * * @param pdom - * @param bindingType + * @param binding * * @return */ - public PDOMBinding createPDOMBinding(PDOMDatabase pdom, int bindingType); + public PDOMBinding getPDOMBinding(PDOMDatabase pdom, PDOMBinding binding) throws CoreException; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/c/GCCLanguage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/c/GCCLanguage.java index ae03937c234..de8c8ac9849 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/c/GCCLanguage.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/c/GCCLanguage.java @@ -15,12 +15,9 @@ import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.ICodeReaderFactory; import org.eclipse.cdt.core.dom.ILanguage; import org.eclipse.cdt.core.dom.ast.ASTCompletionNode; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.dom.ast.IScope; -import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.model.IWorkingCopy; import org.eclipse.cdt.core.parser.CodeReader; @@ -40,13 +37,10 @@ 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.IScannerExtensionConfiguration; import org.eclipse.cdt.internal.core.pdom.PDOMDatabase; -import org.eclipse.cdt.internal.pdom.dom.PDOMBinding; -import org.eclipse.cdt.internal.pdom.dom.PDOMName; +import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; /** * @author Doug Schaefer @@ -94,7 +88,7 @@ public class GCCLanguage implements ILanguage { if ((style & AST_USE_INDEX) != 0) ast.setIndex(tu.getCProject().getIndex()); - + return ast; } @@ -103,38 +97,15 @@ public class GCCLanguage implements ILanguage { } public PDOMBinding getPDOMBinding(PDOMDatabase pdom, IASTName name) throws CoreException { - try { - IBinding binding = name.resolveBinding(); - if (binding == null) - return null; - - IScope scope = binding.getScope(); - if (scope == null) - return null; - - PDOMBinding pdomBinding = null; - IASTName scopeName = scope.getScopeName(); - - if (scopeName == null) { - pdomBinding = new PDOMBinding(pdom, name, binding); - new PDOMName(pdom, name, pdomBinding); - } else { - IBinding scopeBinding = scopeName.resolveBinding(); - if (scopeBinding instanceof IType) { - pdomBinding = new PDOMBinding(pdom, name, binding); - new PDOMName(pdom, name, pdomBinding); - } - } + IBinding binding = name.resolveBinding(); + if (binding == null) return null; - } catch (DOMException e) { - throw new CoreException(new Status(IStatus.ERROR, - CCorePlugin.PLUGIN_ID, 0, "DOM Exception", e)); - } - } - - public PDOMBinding createPDOMBinding(PDOMDatabase pdom, int bindingType) { - // TODO Auto-generated method stub + return null; } + public PDOMBinding getPDOMBinding(PDOMDatabase pdom, PDOMBinding binding) throws CoreException { + return binding; + } + } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/GPPLanguage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/GPPLanguage.java index 6be4627967b..0754fbe33f6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/GPPLanguage.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/GPPLanguage.java @@ -15,12 +15,9 @@ import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.ICodeReaderFactory; import org.eclipse.cdt.core.dom.ILanguage; import org.eclipse.cdt.core.dom.ast.ASTCompletionNode; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.dom.ast.IScope; -import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.model.IWorkingCopy; import org.eclipse.cdt.core.parser.CodeReader; @@ -34,19 +31,18 @@ import org.eclipse.cdt.core.parser.ParserUtil; import org.eclipse.cdt.core.parser.ScannerInfo; import org.eclipse.cdt.internal.core.dom.SavedCodeReaderFactory; import org.eclipse.cdt.internal.core.dom.parser.ISourceCodeParser; +import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVariable; import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser; import org.eclipse.cdt.internal.core.dom.parser.cpp.GPPParserExtensionConfiguration; 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.IScannerExtensionConfiguration; import org.eclipse.cdt.internal.core.pdom.PDOMDatabase; -import org.eclipse.cdt.internal.pdom.dom.PDOMBinding; -import org.eclipse.cdt.internal.pdom.dom.PDOMName; +import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; +import org.eclipse.cdt.internal.core.pdom.dom.cpp.PDOMCPPVariable; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; /** * @author Doug Schaefer @@ -100,40 +96,28 @@ public class GPPLanguage implements ILanguage { int offset) { return null; } - + + // Binding types + public static final int CPPVARIABLE = 1; + public PDOMBinding getPDOMBinding(PDOMDatabase pdom, IASTName name) throws CoreException { - try { - IBinding binding = name.resolveBinding(); - if (binding == null) - return null; - - IScope scope = binding.getScope(); - if (scope == null) - return null; - - PDOMBinding pdomBinding = null; - IASTName scopeName = scope.getScopeName(); - - if (scopeName == null) { - pdomBinding = new PDOMBinding(pdom, name, binding); - new PDOMName(pdom, name, pdomBinding); - } else { - IBinding scopeBinding = scopeName.resolveBinding(); - if (scopeBinding instanceof IType) { - pdomBinding = new PDOMBinding(pdom, name, binding); - new PDOMName(pdom, name, pdomBinding); - } - } + IBinding binding = name.resolveBinding(); + if (binding == null) return null; - } catch (DOMException e) { - throw new CoreException(new Status(IStatus.ERROR, - CCorePlugin.PLUGIN_ID, 0, "DOM Exception", e)); - } - } - - public PDOMBinding createPDOMBinding(PDOMDatabase pdom, int bindingType) { - // TODO Auto-generated method stub + + if (binding instanceof CPPVariable) + return new PDOMCPPVariable(pdom, name, (CPPVariable)binding); + return null; } + public PDOMBinding getPDOMBinding(PDOMDatabase pdom, PDOMBinding binding) throws CoreException { + switch (binding.getBindingType()) { + case CPPVARIABLE: + return new PDOMCPPVariable(pdom, binding.getRecord()); + } + + return binding; + } + } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMCodeReaderFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMCodeReaderFactory.java index 46035fdcbde..473e85b6b70 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMCodeReaderFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMCodeReaderFactory.java @@ -22,7 +22,7 @@ import org.eclipse.cdt.core.model.IWorkingCopy; import org.eclipse.cdt.core.parser.CodeReader; import org.eclipse.cdt.core.parser.ICodeReaderCache; import org.eclipse.cdt.core.parser.ParserUtil; -import org.eclipse.cdt.internal.pdom.dom.PDOMFile; +import org.eclipse.cdt.internal.core.pdom.dom.PDOMFile; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -69,7 +69,7 @@ public class PDOMCodeReaderFactory implements ICodeReaderFactory { } if (PDOMFile.find(pdom, path) != null) return null; - } catch (IOException e) { + } catch (CoreException e) { CCorePlugin.log(new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, 0, "PDOM Exception", e))); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMDatabase.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMDatabase.java index d6a306c0059..f649cf9efa1 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMDatabase.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMDatabase.java @@ -10,32 +10,24 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.pdom; -import java.io.IOException; -import java.util.ArrayList; - import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.ICodeReaderFactory; import org.eclipse.cdt.core.dom.ILanguage; import org.eclipse.cdt.core.dom.IPDOM; import org.eclipse.cdt.core.dom.ast.ASTVisitor; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.dom.ast.IScope; -import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.model.IWorkingCopy; import org.eclipse.cdt.internal.core.pdom.db.BTree; import org.eclipse.cdt.internal.core.pdom.db.Database; -import org.eclipse.cdt.internal.pdom.dom.PDOMBinding; -import org.eclipse.cdt.internal.pdom.dom.PDOMName; +import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; +import org.eclipse.cdt.internal.core.pdom.dom.PDOMName; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.core.runtime.Status; /** @@ -46,13 +38,10 @@ import org.eclipse.core.runtime.Status; public class PDOMDatabase implements IPDOM { private final IPath dbPath; - private final Database db; + private Database db; private static final int VERSION = 0; - public static final int STRING_INDEX = Database.DATA_AREA + 0 * Database.INT_SIZE; - private BTree stringIndex; - public static final int FILE_INDEX = Database.DATA_AREA + 1 * Database.INT_SIZE; private BTree fileIndex; @@ -71,34 +60,25 @@ public class PDOMDatabase implements IPDOM { } dbPath = CCorePlugin.getDefault().getStateLocation().append(dbName); - - try { - db = new Database(dbPath.toOSString(), VERSION); - } catch (IOException e) { - throw new CoreException(new Status(IStatus.ERROR, - CCorePlugin.PLUGIN_ID, 0, "Failed to create database", e)); - } + db = new Database(dbPath.toOSString(), VERSION); } - public Database getDB() { + public Database getDB() throws CoreException { + if (db == null) + db = new Database(dbPath.toOSString(), VERSION); + return db; } - public BTree getStringIndex() { - if (stringIndex == null) - stringIndex = new BTree(db, STRING_INDEX); - return stringIndex; - } - - public BTree getFileIndex() { + public BTree getFileIndex() throws CoreException { if (fileIndex == null) - fileIndex = new BTree(db, FILE_INDEX); + fileIndex = new BTree(getDB(), FILE_INDEX); return fileIndex; } - public BTree getBindingIndex() { + public BTree getBindingIndex() throws CoreException { if (bindingIndex == null) - bindingIndex = new BTree(db, BINDING_INDEX); + bindingIndex = new BTree(getDB(), BINDING_INDEX); return bindingIndex; } @@ -119,8 +99,11 @@ public class PDOMDatabase implements IPDOM { public int visit(IASTName name) { try { - if (name.toCharArray().length > 0) - language.getPDOMBinding(PDOMDatabase.this, name); + if (name.toCharArray().length > 0) { + PDOMBinding binding = language.getPDOMBinding(PDOMDatabase.this, name); + if (binding != null) + new PDOMName(PDOMDatabase.this, name, binding); + } return PROCESS_CONTINUE; } catch (CoreException e) { CCorePlugin.log(e); @@ -135,7 +118,11 @@ public class PDOMDatabase implements IPDOM { } public void delete() throws CoreException { - // TODO Auto-generated method stub + db = null; + bindingIndex = null; + fileIndex = null; + System.gc(); + dbPath.toFile().delete(); } public ICodeReaderFactory getCodeReaderFactory() { @@ -154,45 +141,18 @@ public class PDOMDatabase implements IPDOM { return new IASTName[0]; return new IASTName[] { name }; } - } catch (IOException e) { + } catch (CoreException e) { CCorePlugin.log(e); } return new IASTName[0]; } public IBinding resolveBinding(IASTName name) { - try { - return new PDOMBinding(this, name, null); - } catch (CoreException e) { - CCorePlugin.log(e); - return null; - } + return null; } public IBinding[] resolvePrefix(IASTName name) { -// try { - final String prefix = new String(name.toCharArray()); - final ArrayList bindings = new ArrayList(); - -// getStringIndex().visit(new PDOMString.Visitor(db, prefix) { -// public boolean visit(int record) throws IOException { -// String value = new String(new PDOMString(PDOMDatabase.this, record).getString()); -// if (value.startsWith(prefix)) { -// PDOMBinding pdomBinding = PDOMBinding.find(PDOMDatabase.this, record); -// if (pdomBinding != null) -// bindings.add(pdomBinding); -// return true; -// } else -// return false; -// } -// }); - - return (IBinding[])bindings.toArray(new IBinding[bindings.size()]); -// } catch (IOException e) { -// PDOMCorePlugin.log(new CoreException(new Status(IStatus.ERROR, -// PDOMCorePlugin.ID, 0, "resolvePrefix", e))); -// return null; -// } + return new IBinding[0]; } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java index fc756e42245..431c1423fc7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java @@ -12,7 +12,6 @@ package org.eclipse.cdt.internal.core.pdom; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.IPDOM; -import org.eclipse.cdt.core.dom.IPDOMProvider; import org.eclipse.cdt.core.model.ElementChangedEvent; import org.eclipse.cdt.core.model.IElementChangedListener; import org.eclipse.core.resources.IProject; @@ -28,7 +27,7 @@ import org.eclipse.core.runtime.jobs.IJobChangeListener; * * @author Doug Schaefer */ -public class PDOMManager implements IPDOMProvider, IElementChangedListener, IJobChangeListener { +public class PDOMManager implements IElementChangedListener, IJobChangeListener { private static PDOMManager instance; private PDOMUpdator currJob; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMUpdator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMUpdator.java index aaa32fef9ef..c5fcb025796 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMUpdator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMUpdator.java @@ -15,10 +15,8 @@ import java.util.LinkedList; import java.util.List; import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.dom.ILanguage; import org.eclipse.cdt.core.dom.IPDOM; import org.eclipse.cdt.core.dom.PDOM; -import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElementDelta; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMUtils.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMUtils.java index 00ca46a4755..a37b775d149 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMUtils.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMUtils.java @@ -3,10 +3,9 @@ */ package org.eclipse.cdt.internal.core.pdom; -import java.io.IOException; - import org.eclipse.cdt.internal.core.pdom.db.Chunk; import org.eclipse.cdt.internal.core.pdom.db.Database; +import org.eclipse.core.runtime.CoreException; /** * @author dschaefer @@ -14,7 +13,7 @@ import org.eclipse.cdt.internal.core.pdom.db.Database; */ public class PDOMUtils { - public static int stringCompare(Database db, int record1, int record2) throws IOException { + public static int stringCompare(Database db, int record1, int record2) throws CoreException { Chunk chunk1 = db.getChunk(record1); Chunk chunk2 = db.getChunk(record2); @@ -43,7 +42,7 @@ public class PDOMUtils { return 1; } - public static int stringCompare(Database db, int record1, char[] record2) throws IOException { + public static int stringCompare(Database db, int record1, char[] record2) throws CoreException { Chunk chunk1 = db.getChunk(record1); int i1 = record1; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/BTree.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/BTree.java index e5e03da1c46..aa521cd9dfd 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/BTree.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/BTree.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.pdom.db; -import java.io.IOException; +import org.eclipse.core.runtime.CoreException; /** * @author Doug Schaefer @@ -37,7 +37,7 @@ public class BTree { this.rootPointer = rootPointer; } - protected int getRoot() throws IOException { + protected int getRoot() throws CoreException { return db.getInt(rootPointer); } @@ -65,7 +65,7 @@ public class BTree { * @param offset of the record * @return */ - public int insert(int record, IBTreeComparator comparator) throws IOException { + public int insert(int record, IBTreeComparator comparator) throws CoreException { int root = getRoot(); // is this our first time in @@ -77,7 +77,7 @@ public class BTree { return insert(null, 0, 0, root, record, comparator); } - private int insert(Chunk pChunk, int parent, int iParent, int node, int record, IBTreeComparator comparator) throws IOException { + private int insert(Chunk pChunk, int parent, int iParent, int node, int record, IBTreeComparator comparator) throws CoreException { Chunk chunk = db.getChunk(node); // if this node is full (last record isn't null), split it @@ -164,7 +164,7 @@ public class BTree { } } - private void firstInsert(int record) throws IOException { + private void firstInsert(int record) throws CoreException { // create the node and save it as root int root = allocateNode(); db.putInt(rootPointer, root); @@ -172,7 +172,7 @@ public class BTree { putRecord(db.getChunk(root), root, 0, record); } - private int allocateNode() throws IOException { + private int allocateNode() throws CoreException { return db.malloc((2 * NUM_RECORDS - 1) * Database.INT_SIZE); } @@ -191,11 +191,11 @@ public class BTree { * * @param visitor */ - public void visit(IBTreeVisitor visitor) throws IOException { + public void visit(IBTreeVisitor visitor) throws CoreException { visit(db.getInt(rootPointer), visitor, false); } - private boolean visit(int node, IBTreeVisitor visitor, boolean found) throws IOException { + private boolean visit(int node, IBTreeVisitor visitor, boolean found) throws CoreException { // if found is false, we are still in search mode // once found is true visit everything // return false when ready to quit @@ -246,81 +246,4 @@ public class BTree { return visit(getChild(chunk, node, i), visitor, found); } - public int getHeight() throws IOException { - int root = getRoot(); - - if (root == 0) - return 0; - - return getHeight(root); - } - - private int getHeight(int node) throws IOException { - int height = 0; - Chunk chunk = db.getChunk(node); - - for (int i = 0; i < NUM_CHILDREN; ++i) { - int child = getChild(chunk, node, i); - if (child == 0) - break; - int n = getHeight(child); - if (n == -1) - return -1; - if (height != 0 && height != n) - return -1; - height = n; - } - - return height + 1; - } - - public int getRecordCount() throws IOException { - int root = getRoot(); - - if (root == 0) - return 0; - - return getRecordCount(root); - } - - private int getRecordCount(int node) throws IOException { - Chunk chunk = db.getChunk(node); - - int count; - for (count = 0; count < NUM_RECORDS; ++count) - if (getRecord(chunk, node, count) == 0) - break; - - for (int i = 0; i < NUM_CHILDREN; ++i) { - int child = getChild(chunk, node, i); - if (child != 0) - count += getRecordCount(child); - } - - return count; - } - - public int getNodeCount() throws IOException { - int root = getRoot(); - - if (root == 0) - return 0; - - return getNodeCount(root); - } - - private int getNodeCount(int node) throws IOException { - Chunk chunk = db.getChunk(node); - - int count = 1; - - for (int i = 0; i < NUM_CHILDREN; ++i) { - int child = getChild(chunk, node, i); - if (child != 0) - count += getNodeCount(child); - } - - return count; - } - } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Chunk.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Chunk.java index 4fb13bc082d..25e7d6f85e1 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Chunk.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Chunk.java @@ -15,6 +15,8 @@ import java.io.RandomAccessFile; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel.MapMode; +import org.eclipse.core.runtime.CoreException; + /** * @author Doug Schaefer * @@ -29,9 +31,13 @@ public class Chunk { private Chunk prevChunk; private Chunk nextChunk; - Chunk(RandomAccessFile file, int offset) throws IOException { - index = offset / Database.CHUNK_SIZE; - buffer = file.getChannel().map(MapMode.READ_WRITE, offset, Database.CHUNK_SIZE); + Chunk(RandomAccessFile file, int offset) throws CoreException { + try { + index = offset / Database.CHUNK_SIZE; + buffer = file.getChannel().map(MapMode.READ_WRITE, offset, Database.CHUNK_SIZE); + } catch (IOException e) { + throw new CoreException(new DBStatus(e)); + } } public void putInt(int offset, int value) { diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/NullPDOMProvider.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/DBStatus.java similarity index 52% rename from core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/NullPDOMProvider.java rename to core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/DBStatus.java index f53c96267d9..34441deffd4 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/NullPDOMProvider.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/DBStatus.java @@ -8,30 +8,26 @@ * Contributors: * QNX - Initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.internal.core.dom; -import org.eclipse.cdt.core.dom.IPDOM; -import org.eclipse.cdt.core.dom.IPDOMProvider; -import org.eclipse.cdt.core.model.IElementChangedListener; -import org.eclipse.core.resources.IProject; +package org.eclipse.cdt.internal.core.pdom.db; + +import java.io.IOException; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; /** * @author Doug Schaefer * */ -public class NullPDOMProvider implements IPDOMProvider { +public class DBStatus extends Status { - public IPDOM getPDOM(IProject project) { - // by default return null. - return null; + /** + * @param exception + */ + public DBStatus(IOException exception) { + super(IStatus.ERROR, CCorePlugin.PLUGIN_ID, 0, "IOException", exception); } - - public IElementChangedListener getElementChangedListener() { - // here too - return null; - } - - public void deletePDOM(IProject project) { - } - + } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java index 3b09c2e925f..1ec77ad4e6a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/Database.java @@ -13,6 +13,8 @@ package org.eclipse.cdt.internal.core.pdom.db; import java.io.IOException; import java.io.RandomAccessFile; +import org.eclipse.core.runtime.CoreException; + /** * @author Doug Schaefer * @@ -37,33 +39,41 @@ public class Database { public static final int NEXT_OFFSET = INT_SIZE * 2; public static final int DATA_AREA = CHUNK_SIZE / MIN_SIZE * INT_SIZE + INT_SIZE; - public Database(String filename, int version) throws IOException { - file = new RandomAccessFile(filename, "rw"); //$NON-NLS-1$ - - // Allocate chunk table, make sure we have at least one - long nChunks = file.length() / CHUNK_SIZE; - if (nChunks == 0) { - create(); - ++nChunks; - } - - toc = new Chunk[(int)nChunks]; - - // Load in the magic chunk zero - toc[0] = new Chunk(file, 0); - int oldversion = toc[0].getInt(0); - if (oldversion != version) { - // Conversion? - toc[0].putInt(0, version); + public Database(String filename, int version) throws CoreException { + try { + file = new RandomAccessFile(filename, "rw"); //$NON-NLS-1$ + + // Allocate chunk table, make sure we have at least one + long nChunks = file.length() / CHUNK_SIZE; + if (nChunks == 0) { + create(); + ++nChunks; + } + + toc = new Chunk[(int)nChunks]; + + // Load in the magic chunk zero + toc[0] = new Chunk(file, 0); + int oldversion = toc[0].getInt(0); + if (oldversion != version) { + // Conversion? + toc[0].putInt(0, version); + } + } catch (IOException e) { + throw new CoreException(new DBStatus(e)); } } /** * Create the database, including chunk zero and the b-trees. */ - private void create() throws IOException { - file.seek(0); - file.write(new byte[CHUNK_SIZE]); // the header chunk + private void create() throws CoreException { + try { + file.seek(0); + file.write(new byte[CHUNK_SIZE]); // the header chunk + } catch (IOException e) { + throw new CoreException(new DBStatus(e)); + } } /** @@ -72,7 +82,7 @@ public class Database { * @param offset * @return */ - public Chunk getChunk(int offset) throws IOException { + public Chunk getChunk(int offset) throws CoreException { int index = offset / CHUNK_SIZE; Chunk chunk = toc[index]; if (chunk == null) { @@ -107,7 +117,7 @@ public class Database { * @param size * @return */ - public int malloc(int size) throws IOException { + public int malloc(int size) throws CoreException { // Which block size int freeblock = 0; int blocksize; @@ -146,16 +156,20 @@ public class Database { return freeblock + INT_SIZE; } - private int createChunk() throws IOException { - int offset = (int)file.length(); - file.seek(offset); - file.write(new byte[CHUNK_SIZE]); - Chunk[] oldtoc = toc; - int i = oldtoc.length; - toc = new Chunk[i + 1]; - System.arraycopy(oldtoc, 0, toc, 0, i); - toc[i] = new Chunk(file, offset); - return i; + private int createChunk() throws CoreException { + try { + int offset = (int)file.length(); + file.seek(offset); + file.write(new byte[CHUNK_SIZE]); + Chunk[] oldtoc = toc; + int i = oldtoc.length; + toc = new Chunk[i + 1]; + System.arraycopy(oldtoc, 0, toc, 0, i); + toc[i] = new Chunk(file, offset); + return i; + } catch (IOException e) { + throw new CoreException(new DBStatus(e)); + } } private int getFirstBlock(int blocksize) { @@ -166,7 +180,7 @@ public class Database { toc[0].putInt((blocksize / MIN_SIZE) * INT_SIZE, block); } - private void removeBlock(Chunk chunk, int blocksize, int block) throws IOException { + private void removeBlock(Chunk chunk, int blocksize, int block) throws CoreException { int prevblock = chunk.getInt(block + PREV_OFFSET); int nextblock = chunk.getInt(block + NEXT_OFFSET); if (prevblock != 0) @@ -178,7 +192,7 @@ public class Database { putInt(nextblock + PREV_OFFSET, prevblock); } - private void addBlock(Chunk chunk, int blocksize, int block) throws IOException { + private void addBlock(Chunk chunk, int blocksize, int block) throws CoreException { // Mark our size chunk.putInt(block, blocksize); @@ -196,7 +210,7 @@ public class Database { * * @param offset */ - public void free(int offset) throws IOException { + public void free(int offset) throws CoreException { // TODO - look for opportunities to merge blocks int block = offset - INT_SIZE; Chunk chunk = getChunk(block); @@ -204,32 +218,42 @@ public class Database { addBlock(chunk, blocksize, block); } - public void putInt(int offset, int value) throws IOException { + public void putInt(int offset, int value) throws CoreException { Chunk chunk = getChunk(offset); chunk.putInt(offset, value); } - public int getInt(int offset) throws IOException { + public int getInt(int offset) throws CoreException { Chunk chunk = getChunk(offset); return chunk.getInt(offset); } - public void putChars(int offset, char[] value) throws IOException { + public void putChar(int offset, char value) throws CoreException { + Chunk chunk = getChunk(offset); + chunk.putChar(offset, value); + } + + public char getChar(int offset) throws CoreException { + Chunk chunk = getChunk(offset); + return chunk.getChar(offset); + } + + public void putChars(int offset, char[] value) throws CoreException { Chunk chunk = getChunk(offset); chunk.putChars(offset, value); } - public char[] getChars(int offset) throws IOException { + public char[] getChars(int offset) throws CoreException { Chunk chunk = getChunk(offset); return chunk.getChars(offset); } - public void putString(int offset, String value) throws IOException { + public void putString(int offset, String value) throws CoreException { Chunk chunk = getChunk(offset); chunk.putString(offset, value); } - public String getString(int offset) throws IOException { + public String getString(int offset) throws CoreException { Chunk chunk = getChunk(offset); return chunk.getString(offset); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IBTreeComparator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IBTreeComparator.java index e418cb22e42..250e3715dea 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IBTreeComparator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IBTreeComparator.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.pdom.db; -import java.io.IOException; +import org.eclipse.core.runtime.CoreException; /** * @author Doug Schaefer @@ -26,6 +26,6 @@ public interface IBTreeComparator { * @return * @throws IOException */ - public abstract int compare(int record1, int record2) throws IOException; + public abstract int compare(int record1, int record2) throws CoreException; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IBTreeVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IBTreeVisitor.java index ccbd6a29ede..035601fef27 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IBTreeVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/IBTreeVisitor.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.pdom.db; -import java.io.IOException; +import org.eclipse.core.runtime.CoreException; /** * @author Doug Schaefer @@ -31,7 +31,7 @@ public interface IBTreeVisitor { * @return -1 if record < key, 0 if record == key, 1 if record > key * @throws IOException */ - public abstract int compare(int record) throws IOException; + public abstract int compare(int record) throws CoreException; /** * Visit a given record and return whether to continue or not. @@ -40,6 +40,6 @@ public interface IBTreeVisitor { * @return * @throws IOException */ - public abstract boolean visit(int record) throws IOException; + public abstract boolean visit(int record) throws CoreException; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/StringComparator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/StringComparator.java index 9446a149687..42d4e02b3b5 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/StringComparator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/StringComparator.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.pdom.db; -import java.io.IOException; +import org.eclipse.core.runtime.CoreException; /** * @author Doug Schaefer @@ -26,7 +26,7 @@ public class StringComparator implements IBTreeComparator { this.offset = offset; } - public int compare(int record1, int record2) throws IOException { + public int compare(int record1, int record2) throws CoreException { Chunk chunk1 = db.getChunk(record1); Chunk chunk2 = db.getChunk(record2); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/StringVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/StringVisitor.java index c5f990ab854..312c4dbdd96 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/StringVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/StringVisitor.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.pdom.db; -import java.io.IOException; +import org.eclipse.core.runtime.CoreException; /** * @author Doug Schaefer @@ -28,7 +28,7 @@ public abstract class StringVisitor implements IBTreeVisitor { this.key = key; } - public int compare(int record) throws IOException { + public int compare(int record) throws CoreException { Chunk chunk = db.getChunk(record); int i1 = record + offset; int i2 = 0; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/pdom/dom/PDOMBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java similarity index 64% rename from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/pdom/dom/PDOMBinding.java rename to core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java index c5c9dc6f8df..f4f6de66771 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/pdom/dom/PDOMBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java @@ -8,7 +8,7 @@ * Contributors: * QNX - Initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.internal.pdom.dom; +package org.eclipse.cdt.internal.core.pdom.dom; import java.io.IOException; @@ -55,9 +55,10 @@ public class PDOMBinding implements IBinding { this.db = db; } - public int compare(int record1, int record2) throws IOException { + public int compare(int record1, int record2) throws CoreException { int string1 = db.getInt(record1 + STRING_REC_OFFSET); int string2 = db.getInt(record2 + STRING_REC_OFFSET); + // Need to deal with language and type return PDOMUtils.stringCompare(db, string1, string2); } @@ -69,13 +70,14 @@ public class PDOMBinding implements IBinding { private Database db; private char[] key; - public Visitor(Database db, char[] key) { + public Visitor(Database db, char[] key, int language, int type) { this.db = db; this.key = key; } - public int compare(int record1) throws IOException { + public int compare(int record1) throws CoreException { int string1 = db.getInt(record1 + STRING_REC_OFFSET); + // Need to deal with language and type return PDOMUtils.stringCompare(db, string1, key); } @@ -86,44 +88,42 @@ public class PDOMBinding implements IBinding { private int record; - public FindVisitor(Database db, char[] stringKey) { - super(db, stringKey); + public FindVisitor(Database db, char[] stringKey, int language, int type) { + super(db, stringKey, language, type); } - public boolean visit(int record) throws IOException { + public boolean visit(int record) throws CoreException { this.record = record; return false; } - public int findIn(BTree btree) throws IOException { + public int findIn(BTree btree) throws CoreException { btree.visit(this); return record; } } - public PDOMBinding(PDOMDatabase pdom, IASTName name, IBinding binding) throws CoreException { - try { - this.pdom = pdom; + public PDOMBinding(PDOMDatabase pdom, IASTName name, int language, int type) throws CoreException { + this.pdom = pdom; - char[] namechars = name.toCharArray(); + char[] namechars = name.toCharArray(); - BTree index = pdom.getBindingIndex(); - record = new FindVisitor(pdom.getDB(), namechars).findIn(index); + BTree index = pdom.getBindingIndex(); + record = new FindVisitor(pdom.getDB(), namechars, language, type).findIn(index); - if (record == 0) { - Database db = pdom.getDB(); - record = db.malloc(getRecordSize()); + if (record == 0) { + Database db = pdom.getDB(); + record = db.malloc(getRecordSize()); + + db.putChar(record + LANGUAGE_OFFSET, (char)language); + db.putChar(record + TYPE_OFFSET, (char)type); - int stringRecord = db.malloc((namechars.length + 1) * Database.CHAR_SIZE); - db.putChars(stringRecord, namechars); + int stringRecord = db.malloc((namechars.length + 1) * Database.CHAR_SIZE); + db.putChars(stringRecord, namechars); - db.putInt(record + STRING_REC_OFFSET, stringRecord); - pdom.getBindingIndex().insert(record, new Comparator(db)); - } - } catch (IOException e) { - throw new CoreException(new Status(IStatus.ERROR, - CCorePlugin.PLUGIN_ID, 0, "Failed to allocate binding", e)); + db.putInt(record + STRING_REC_OFFSET, stringRecord); + pdom.getBindingIndex().insert(record, new Comparator(db)); } } @@ -136,7 +136,15 @@ public class PDOMBinding implements IBinding { return record; } - public void addDeclaration(PDOMName name) throws IOException { + public int getLanguage() throws CoreException { + return pdom.getDB().getChar(record + LANGUAGE_OFFSET); + } + + public int getBindingType() throws CoreException { + return pdom.getDB().getChar(record + TYPE_OFFSET); + } + + public void addDeclaration(PDOMName name) throws CoreException { PDOMName firstDeclaration = getFirstDeclaration(); if (firstDeclaration != null) { firstDeclaration.setPrevInBinding(name); @@ -145,9 +153,14 @@ public class PDOMBinding implements IBinding { pdom.getDB().putInt(record + FIRST_DECL_OFFSET, name.getRecord()); } - public PDOMName getFirstDeclaration() throws IOException { - int firstDeclRec = pdom.getDB().getInt(record + FIRST_DECL_OFFSET); - return firstDeclRec != 0 ? new PDOMName(pdom, firstDeclRec) : null; + public PDOMName getFirstDeclaration() throws CoreException { + try { + int firstDeclRec = pdom.getDB().getInt(record + FIRST_DECL_OFFSET); + return firstDeclRec != 0 ? new PDOMName(pdom, firstDeclRec) : null; + } catch (IOException e) { + throw new CoreException(new Status(IStatus.ERROR, + CCorePlugin.PLUGIN_ID, 0, "PDOM", e)); + } } public String getName() { @@ -155,10 +168,10 @@ public class PDOMBinding implements IBinding { Database db = pdom.getDB(); int stringRecord = db.getInt(record + STRING_REC_OFFSET); return db.getString(stringRecord); - } catch (IOException e) { + } catch (CoreException e) { CCorePlugin.log(e); - return ""; } + return ""; } public char[] getNameCharArray() { @@ -166,10 +179,10 @@ public class PDOMBinding implements IBinding { Database db = pdom.getDB(); int stringRecord = db.getInt(record + STRING_REC_OFFSET); return db.getChars(stringRecord); - } catch (IOException e) { + } catch (CoreException e) { CCorePlugin.log(e); - return new char[0]; } + return new char[0]; } public IScope getScope() throws DOMException { @@ -177,9 +190,9 @@ public class PDOMBinding implements IBinding { return null; } - public static PDOMBinding find(PDOMDatabase pdom, char[] name) throws IOException { + public static PDOMBinding find(PDOMDatabase pdom, char[] name, int language, int type) throws CoreException { BTree index = pdom.getBindingIndex(); - int bindingRecord = new FindVisitor(pdom.getDB(), name).findIn(index); + int bindingRecord = new FindVisitor(pdom.getDB(), name, language, type).findIn(index); if (bindingRecord != 0) return new PDOMBinding(pdom, bindingRecord); else diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/pdom/dom/PDOMFile.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMFile.java similarity index 80% rename from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/pdom/dom/PDOMFile.java rename to core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMFile.java index 80920a6191c..5b53cf74fb4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/pdom/dom/PDOMFile.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMFile.java @@ -8,19 +8,14 @@ * Contributors: * QNX - Initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.internal.pdom.dom; +package org.eclipse.cdt.internal.core.pdom.dom; -import java.io.IOException; - -import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.internal.core.pdom.PDOMDatabase; 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.StringComparator; import org.eclipse.cdt.internal.core.pdom.db.StringVisitor; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; /** * Represents a file containing names. @@ -58,19 +53,19 @@ public class PDOMFile { super(db, key); } - public boolean visit(int record) throws IOException { + public boolean visit(int record) throws CoreException { this.record = record; return false; } - public int findIn(BTree btree) throws IOException { + public int findIn(BTree btree) throws CoreException { btree.visit(this); return record; } } - public static PDOMFile insert(PDOMDatabase pdom, String filename) throws IOException { + public static PDOMFile insert(PDOMDatabase pdom, String filename) throws CoreException { BTree index = pdom.getFileIndex(); PDOMFile pdomFile = find(pdom, filename); if (pdomFile == null) { @@ -84,7 +79,7 @@ public class PDOMFile { return pdomFile; } - public static PDOMFile find(PDOMDatabase pdom, String filename) throws IOException { + public static PDOMFile find(PDOMDatabase pdom, String filename) throws CoreException { BTree index = pdom.getFileIndex(); int record = new FindVisitor(pdom.getDB(), filename).findIn(index); return (record != 0) ? new PDOMFile(pdom, record) : null; @@ -99,25 +94,20 @@ public class PDOMFile { return record; } - public String getFileName() throws IOException { + public String getFileName() throws CoreException { return pdom.getDB().getString(record + FILE_NAME_OFFSET); } - public int getFirstName() throws IOException { + public int getFirstName() throws CoreException { return pdom.getDB().getInt(record + FIRST_NAME_OFFSET); } - public void setFirstName(int firstName) throws IOException { + public void setFirstName(int firstName) throws CoreException { pdom.getDB().putInt(record + FIRST_NAME_OFFSET, firstName); } public void free() throws CoreException { - try { - pdom.getDB().free(record); - } catch (IOException e) { - throw new CoreException(new Status(IStatus.ERROR, - CCorePlugin.PLUGIN_ID, 0, "Failed to free string", e)); - } + pdom.getDB().free(record); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/pdom/dom/PDOMName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMName.java similarity index 77% rename from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/pdom/dom/PDOMName.java rename to core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMName.java index 5d4e37b4c20..17211e48f1c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/pdom/dom/PDOMName.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMName.java @@ -8,7 +8,7 @@ * Contributors: * QNX - Initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.internal.pdom.dom; +package org.eclipse.cdt.internal.core.pdom.dom; import java.io.IOException; @@ -25,8 +25,6 @@ import org.eclipse.cdt.core.dom.ast.IScope2; import org.eclipse.cdt.internal.core.pdom.PDOMDatabase; import org.eclipse.cdt.internal.core.pdom.db.Database; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; /** * @author Doug Schaefer @@ -49,36 +47,31 @@ public class PDOMName implements IASTName, IASTFileLocation { private static final int RECORD_SIZE = 8 * Database.INT_SIZE; public PDOMName(PDOMDatabase pdom, IASTName name, PDOMBinding binding) throws CoreException { - try { - this.pdom = pdom; - Database db = pdom.getDB(); - record = db.malloc(RECORD_SIZE); + this.pdom = pdom; + Database db = pdom.getDB(); + record = db.malloc(RECORD_SIZE); - // Hook us up to the binding - if (binding != null) { - db.putInt(record + BINDING_REC_OFFET, binding.getRecord()); - if (name.isDeclaration()) - binding.addDeclaration(this); - } - - // Hook us up the the liked name list from file - IASTFileLocation fileloc = name.getFileLocation(); - String filename = fileloc.getFileName(); - PDOMFile pdomFile = PDOMFile.insert(pdom, filename); - db.putInt(record + FILE_REC_OFFSET, pdomFile.getRecord()); - int firstName = pdomFile.getFirstName(); - if (firstName != 0) { - db.putInt(record + FILE_NEXT_OFFSET, firstName); - db.putInt(firstName + FILE_PREV_OFFSET, record); - } - pdomFile.setFirstName(record); - - db.putInt(record + NODE_OFFSET_OFFSET, fileloc.getNodeOffset()); - db.putInt(record + NODE_LENGTH_OFFSET, fileloc.getNodeLength()); - } catch (IOException e) { - throw new CoreException(new Status(IStatus.ERROR, - CCorePlugin.PLUGIN_ID, 0, "Failed to allocate name", e)); + // Hook us up to the binding + if (binding != null) { + db.putInt(record + BINDING_REC_OFFET, binding.getRecord()); + if (name.isDeclaration()) + binding.addDeclaration(this); } + + // Hook us up the the liked name list from file + IASTFileLocation fileloc = name.getFileLocation(); + String filename = fileloc.getFileName(); + PDOMFile pdomFile = PDOMFile.insert(pdom, filename); + db.putInt(record + FILE_REC_OFFSET, pdomFile.getRecord()); + int firstName = pdomFile.getFirstName(); + if (firstName != 0) { + db.putInt(record + FILE_NEXT_OFFSET, firstName); + db.putInt(firstName + FILE_PREV_OFFSET, record); + } + pdomFile.setFirstName(record); + + db.putInt(record + NODE_OFFSET_OFFSET, fileloc.getNodeOffset()); + db.putInt(record + NODE_LENGTH_OFFSET, fileloc.getNodeLength()); } public PDOMName(PDOMDatabase pdom, int nameRecord) throws IOException { @@ -90,15 +83,15 @@ public class PDOMName implements IASTName, IASTFileLocation { return record; } - public void setBinding(PDOMBinding binding) throws IOException { + public void setBinding(PDOMBinding binding) throws CoreException { pdom.getDB().putInt(record + BINDING_REC_OFFET, binding.getRecord()); } - public void setPrevInBinding(PDOMName prevName) throws IOException { + public void setPrevInBinding(PDOMName prevName) throws CoreException { pdom.getDB().putInt(record + BINDING_PREV_OFFSET, prevName.getRecord()); } - public void setNextInBinding(PDOMName nextName) throws IOException { + public void setNextInBinding(PDOMName nextName) throws CoreException { pdom.getDB().putInt(record + BINDING_NEXT_OFFSET, nextName.getRecord()); } @@ -106,7 +99,7 @@ public class PDOMName implements IASTName, IASTFileLocation { try { int bindingRecord = pdom.getDB().getInt(record + BINDING_REC_OFFET); return new PDOMBinding(pdom, bindingRecord); - } catch (IOException e) { + } catch (CoreException e) { CCorePlugin.log(e); return null; } @@ -132,7 +125,7 @@ public class PDOMName implements IASTName, IASTFileLocation { return null; return new PDOMBinding(pdom, bindingRec).getNameCharArray(); - } catch (IOException e) { + } catch (CoreException e) { CCorePlugin.log(e); return null; } @@ -198,7 +191,7 @@ public class PDOMName implements IASTName, IASTFileLocation { public String getFileName() { try { return new PDOMFile(pdom, pdom.getDB().getInt(record + FILE_REC_OFFSET)).getFileName(); - } catch (IOException e) { + } catch (CoreException e) { CCorePlugin.log(e); return null; } @@ -215,7 +208,7 @@ public class PDOMName implements IASTName, IASTFileLocation { public int getNodeLength() { try { return pdom.getDB().getInt(record + NODE_LENGTH_OFFSET); - } catch (IOException e) { + } catch (CoreException e) { CCorePlugin.log(e); return 0; } @@ -224,7 +217,7 @@ public class PDOMName implements IASTName, IASTFileLocation { public int getNodeOffset() { try { return pdom.getDB().getInt(record + NODE_OFFSET_OFFSET); - } catch (IOException e) { + } catch (CoreException e) { CCorePlugin.log(e); return 0; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/pdom/dom/PDOMNotImplementedError.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMNotImplementedError.java similarity index 93% rename from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/pdom/dom/PDOMNotImplementedError.java rename to core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMNotImplementedError.java index 68c6370a6e5..a27397f52bc 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/pdom/dom/PDOMNotImplementedError.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMNotImplementedError.java @@ -8,7 +8,7 @@ * Contributors: * QNX - Initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.internal.pdom.dom; +package org.eclipse.cdt.internal.core.pdom.dom; /** * @author Doug Schaefer diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/pdom/dom/PDOMTranslationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMTranslationUnit.java similarity index 98% rename from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/pdom/dom/PDOMTranslationUnit.java rename to core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMTranslationUnit.java index c2da38458e8..99a5b3ebaf0 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/pdom/dom/PDOMTranslationUnit.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMTranslationUnit.java @@ -8,7 +8,7 @@ * Contributors: * QNX - Initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.internal.pdom.dom; +package org.eclipse.cdt.internal.core.pdom.dom; import org.eclipse.cdt.core.dom.IPDOM; import org.eclipse.cdt.core.dom.ast.ASTNodeProperty; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java new file mode 100644 index 00000000000..8333a49cbe3 --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java @@ -0,0 +1,86 @@ +/******************************************************************************* + * 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.internal.core.pdom.dom.cpp; + +import org.eclipse.cdt.core.dom.ast.DOMException; +import org.eclipse.cdt.core.dom.ast.IASTName; +import org.eclipse.cdt.core.dom.ast.IType; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable; +import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage; +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.dom.PDOMBinding; +import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError; +import org.eclipse.core.runtime.CoreException; + +/** + * @author Doug Schaefer + * + */ +public class PDOMCPPVariable extends PDOMBinding implements ICPPVariable { + + /** + * @param pdom + * @param name + * @param binding + * @throws CoreException + */ + public PDOMCPPVariable(PDOMDatabase pdom, IASTName name, CPPVariable binding) + throws CoreException { + super(pdom, name, GPPLanguage.GPP_ID, GPPLanguage.CPPVARIABLE); + } + + /** + * @param pdom + * @param bindingRecord + */ + public PDOMCPPVariable(PDOMDatabase pdom, int bindingRecord) { + super(pdom, bindingRecord); + } + + public boolean isMutable() throws DOMException { + throw new PDOMNotImplementedError(); + } + + public IType getType() throws DOMException { + throw new PDOMNotImplementedError(); + } + + public boolean isAuto() throws DOMException { + throw new PDOMNotImplementedError(); + } + + public boolean isExtern() throws DOMException { + throw new PDOMNotImplementedError(); + } + + public boolean isRegister() throws DOMException { + throw new PDOMNotImplementedError(); + } + + public boolean isStatic() throws DOMException { + throw new PDOMNotImplementedError(); + } + + public String[] getQualifiedName() throws DOMException { + throw new PDOMNotImplementedError(); + } + + public char[][] getQualifiedNameCharArray() throws DOMException { + throw new PDOMNotImplementedError(); + } + + public boolean isGloballyQualified() throws DOMException { + throw new PDOMNotImplementedError(); + } + +} diff --git a/core/org.eclipse.cdt.core/plugin.xml b/core/org.eclipse.cdt.core/plugin.xml index 294bd2483a8..a2c12a91422 100644 --- a/core/org.eclipse.cdt.core/plugin.xml +++ b/core/org.eclipse.cdt.core/plugin.xml @@ -43,7 +43,6 @@ - diff --git a/core/org.eclipse.cdt.core/schema/PDOMProvider.exsd b/core/org.eclipse.cdt.core/schema/PDOMProvider.exsd deleted file mode 100644 index 2216f0e883e..00000000000 --- a/core/org.eclipse.cdt.core/schema/PDOMProvider.exsd +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - [Enter description of this extension point.] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [Enter the first release in which this extension point appears.] - - - - - - - - - [Enter extension point usage example here.] - - - - - - - - - [Enter API information here.] - - - - - - - - - [Enter information about supplied implementation of this extension point.] - - - - - - - - - - - - - diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/dom/IPDOMProvider.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/dom/IPDOMProvider.java deleted file mode 100644 index 1f00c91db52..00000000000 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/dom/IPDOMProvider.java +++ /dev/null @@ -1,54 +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.IElementChangedListener; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; - -/** - * @author Doug Schaefer - * - * This is the interface to a PDOM Provider. The provider manages the - * relationships between PDOMs and projects and provides implementations of - * the PDOM interfaces. - */ -public interface IPDOMProvider { - - public static final String ID - = CCorePlugin.PLUGIN_ID + ".PDOMProvider"; //$NON-NLS-1$ - - /** - * Get the PDOM for the given project. If the PDOM is unavailable for this - * project, null is returned. - * - * @param project - * @return the PDOM for the project - */ - public IPDOM getPDOM(IProject project); - - /** - * Delete the PDOM for the given project. - * - * @param project - */ - public void deletePDOM(IProject project) throws CoreException; - - /** - * Return the element changed listener that will handled change - * events that require the PDOM be updated. - * - * @return the element changed listener - */ - public IElementChangedListener getElementChangedListener(); - -} diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/dom/PDOM.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/dom/PDOM.java index 9980b39fdca..f7bf854259c 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/dom/PDOM.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/dom/PDOM.java @@ -13,15 +13,10 @@ 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.dom.NullPDOMProvider; 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.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.IScopeContext; import org.osgi.service.prefs.BackingStoreException; @@ -32,36 +27,6 @@ import org.osgi.service.prefs.BackingStoreException; */ public class PDOM { - private static IPDOMProvider pdomProvider; - - private static synchronized void initPDOMProvider() { - IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(IPDOMProvider.ID); - IExtension[] extensions = extensionPoint.getExtensions(); - if (extensions.length > 0) { - // For now just take the first one - IConfigurationElement[] elements= extensions[0].getConfigurationElements(); - if (elements.length > 0) { - // For now just take the first provider - try { - pdomProvider = (IPDOMProvider)elements[0].createExecutableExtension("class"); //$NON-NLS-1$ - return; - } catch (CoreException e) { - } - } - } - - // Couldn't find one - pdomProvider = new NullPDOMProvider(); - } - - private static IPDOMProvider getPDOMProvider() { - if (pdomProvider == null) { - initPDOMProvider(); - } - - return pdomProvider; - } - private static final String PDOM_NODE = CCorePlugin.PLUGIN_ID + ".pdom"; //$NON-NLS-1$ private static final String ENABLED_KEY = "enabled"; //$NON-NLS-1$ @@ -108,7 +73,7 @@ public class PDOM { public static void deletePDOM(IProject project) throws CoreException { if (isEnabled(project)) - getPDOMProvider().getPDOM(project).delete(); + PDOMManager.getInstance().getPDOM(project).delete(); } /** @@ -116,7 +81,7 @@ public class PDOM { * change events. */ public static void startup() { - IElementChangedListener listener = getPDOMProvider().getElementChangedListener(); + IElementChangedListener listener = PDOMManager.getInstance(); if (listener != null) { CoreModel.getDefault().addElementChangedListener(listener); }