diff --git a/core/org.eclipse.cdt.core.tests/ChangeLog b/core/org.eclipse.cdt.core.tests/ChangeLog
index 3d5dd1cb31f..f4f239e6510 100644
--- a/core/org.eclipse.cdt.core.tests/ChangeLog
+++ b/core/org.eclipse.cdt.core.tests/ChangeLog
@@ -1,3 +1,6 @@
+2004-04-20 David Inglis
+ The CoreModel interfaces throw much more exception, we need to log them for errors.
+
2004-04-19 Alain Magloire
The CoreModel interfaces throw much more exception, we need to log them for errors.
diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/CModelElementsTests.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/CModelElementsTests.java
index 7b7f281fc49..d756c457c23 100644
--- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/CModelElementsTests.java
+++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/CModelElementsTests.java
@@ -502,7 +502,7 @@ public class CModelElementsTests extends TestCase {
assertEquals(startLine, element.getStartLine());
assertEquals(endLine, element.getEndLine());
}
- private void checkElementOffset(CElement element){
+ private void checkElementOffset(CElement element) throws CModelException{
if(element.getElementName().length() > 0 ){
assertTrue (element.getStartPos() <= element.getIdStartPos());
assertEquals (element.getIdLength(), element.getElementName().length());
diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java
index 87c68f34f37..f13b6b4e898 100644
--- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java
+++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java
@@ -208,7 +208,7 @@ public class IStructureTests extends IntegratedCModelTest {
}
}
- public void testIsUnion() {
+ public void testIsUnion() throws CModelException {
ITranslationUnit tu = getTU();
ICElement myElementUnion = null;
ICElement myElementNonUnion = null;
@@ -232,7 +232,7 @@ public class IStructureTests extends IntegratedCModelTest {
assertNotNull( myStructNonUnion );
assertFalse( myStructNonUnion.isUnion() );
}
- public void testIsStruct() {
+ public void testIsStruct() throws CModelException {
ITranslationUnit tu = getTU();
ICElement myElementStruct = null;
ICElement myElementNonStruct = null;
@@ -257,7 +257,7 @@ public class IStructureTests extends IntegratedCModelTest {
assertFalse( myStructNonStruct.isStruct() );
}
- public void testIsClass() {
+ public void testIsClass() throws CModelException {
ITranslationUnit tu = getTU();
ICElement myElementClass = null;
ICElement myElementNonClass = null;
diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog
index 68372d871fa..2d5f05a03dc 100644
--- a/core/org.eclipse.cdt.core/ChangeLog
+++ b/core/org.eclipse.cdt.core/ChangeLog
@@ -1,3 +1,10 @@
+2004-04-20 David Inglis
+
+ Added more CModelException throwing in model essentially if the model fails to create
+ a info an exception is thrown, it we *not* return null.
+
+ to many files changes to list here.....
+
2004-04-20 Alain Magloire
Fix for PR 59081
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICProject.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICProject.java
index 559a67a104f..f98c4d5bfe5 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICProject.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICProject.java
@@ -35,13 +35,17 @@ public interface ICProject extends IParent, IOpenable, ICElement {
/**
* Return the ArchiveContainer of this Project.
+ * @return
+ * @throws CModelException
*/
- IArchiveContainer getArchiveContainer();
+ IArchiveContainer getArchiveContainer() throws CModelException;
/**
* Return the BinaryContainer of this Project.
+ * @return
+ * @throws CModelException
*/
- IBinaryContainer getBinaryContainer();
+ IBinaryContainer getBinaryContainer() throws CModelException;
/**
* Returns the source root folders of the project.
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IDeclaration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IDeclaration.java
index 2acb4ace4f2..94d98d61603 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IDeclaration.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IDeclaration.java
@@ -12,7 +12,25 @@ package org.eclipse.cdt.core.model;
***********************************************************************/
public interface IDeclaration extends ICElement, ISourceManipulation, ISourceReference {
- boolean isStatic();
- boolean isConst();
- boolean isVolatile();
+
+ /**
+ *
+ * @return
+ * @throws CModelException
+ */
+ boolean isStatic() throws CModelException;
+
+ /**
+ *
+ * @return
+ * @throws CModelException
+ */
+ boolean isConst() throws CModelException;
+
+ /**
+ *
+ * @return
+ * @throws CModelException
+ */
+ boolean isVolatile() throws CModelException;
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IField.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IField.java
index b44451e71db..db776726bad 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IField.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IField.java
@@ -16,5 +16,5 @@ public interface IField extends IMember, IVariableDeclaration {
* @exception CModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
*/
- public boolean isMutable();
+ public boolean isMutable() throws CModelException;
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IFunctionDeclaration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IFunctionDeclaration.java
index 3c92553b850..7b1d76c95ec 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IFunctionDeclaration.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IFunctionDeclaration.java
@@ -62,5 +62,5 @@ public interface IFunctionDeclaration extends IDeclaration {
/**
* Returns the signature of the method.
*/
- String getSignature();
+ String getSignature() throws CModelException;
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMember.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMember.java
index d5aa4477ec0..fd33790de38 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMember.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMember.java
@@ -19,6 +19,6 @@ public interface IMember extends IDeclaration {
* V_PRIVATE = 0 V_PROTECTED = 1 V_PUBLIC = 2
* @return int
*/
- public ASTAccessVisibility getVisibility();
+ public ASTAccessVisibility getVisibility() throws CModelException;
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMethodDeclaration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMethodDeclaration.java
index 35eb830805d..0ec007f761e 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMethodDeclaration.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMethodDeclaration.java
@@ -16,7 +16,7 @@ public interface IMethodDeclaration extends IMember, IFunctionDeclaration {
* @exception CModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
*/
- boolean isConstructor();
+ boolean isConstructor() throws CModelException;
/**
* Returns whether this method is a destructor.
@@ -24,7 +24,7 @@ public interface IMethodDeclaration extends IMember, IFunctionDeclaration {
* @exception CModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
*/
- boolean isDestructor();
+ boolean isDestructor() throws CModelException;
/**
* Returns whether this method is an operator method.
@@ -32,7 +32,7 @@ public interface IMethodDeclaration extends IMember, IFunctionDeclaration {
* @exception CModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
*/
- boolean isOperator();
+ boolean isOperator() throws CModelException;
/**
* Returns whether this method is declared pure virtual.
@@ -42,19 +42,19 @@ public interface IMethodDeclaration extends IMember, IFunctionDeclaration {
* @exception CModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
*/
- boolean isPureVirtual();
+ boolean isPureVirtual() throws CModelException;
/**
* Returns if this method is static or not
* @return boolean
*/
- public boolean isStatic();
+ public boolean isStatic() throws CModelException;
/**
* Returns if this method is inline or not
* @return boolean
*/
- public boolean isInline();
+ public boolean isInline() throws CModelException;
/**
* Returns whether this method is declared virtual.
@@ -62,11 +62,11 @@ public interface IMethodDeclaration extends IMember, IFunctionDeclaration {
* @exception CModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
*/
- boolean isVirtual();
+ boolean isVirtual() throws CModelException;
/**
* return true if the member is a friend.
*/
- public boolean isFriend();
+ public boolean isFriend() throws CModelException;
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceReference.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceReference.java
index daa5f1f21ee..a84e5b36471 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceReference.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceReference.java
@@ -46,6 +46,8 @@ public interface ISourceReference {
/**
* Returns the translation unit in which this member is declared, or null
* if this member is not declared in a translation unit (for example, a binary type).
+ * @return
+ * @throws CModelException
*/
ITranslationUnit getTranslationUnit();
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java
index 10538941574..c839e0caad6 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java
@@ -28,11 +28,26 @@ public interface IStructure extends IInheritance, IParent, IVariableDeclaration
*/
public IMethodDeclaration [] getMethods() throws CModelException;
- public boolean isUnion();
+ /**
+ *
+ * @return
+ * @throws CModelException
+ */
+ public boolean isUnion() throws CModelException;
- public boolean isClass();
+ /**
+ *
+ * @return
+ * @throws CModelException
+ */
+ public boolean isClass() throws CModelException;
- public boolean isStruct();
+ /**
+ *
+ * @return
+ * @throws CModelException
+ */
+ public boolean isStruct() throws CModelException;
/**
*
@@ -40,5 +55,4 @@ public interface IStructure extends IInheritance, IParent, IVariableDeclaration
* @throws CModelException
*/
public boolean isAbstract() throws CModelException;
-
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITemplate.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITemplate.java
index a288c9b13ec..b38b8668d54 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITemplate.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITemplate.java
@@ -23,8 +23,9 @@ public interface ITemplate extends IDeclaration {
/**
* Returns the template signature
* @return String
+ * @throws CModelException
*/
- String getTemplateSignature();
+ String getTemplateSignature() throws CModelException;
/**
* Returns the number of template parameters
* @return int
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IVariableDeclaration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IVariableDeclaration.java
index 664327a2fcf..66527043741 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IVariableDeclaration.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IVariableDeclaration.java
@@ -9,6 +9,17 @@ package org.eclipse.cdt.core.model;
* Represents the declaration of a variable.
*/
public interface IVariableDeclaration extends IDeclaration {
- public String getTypeName();
- public void setTypeName(String type);
+ /**
+ *
+ * @return
+ * @throws CModelException
+ */
+ public String getTypeName() throws CModelException;
+
+ /**
+ *
+ * @param type
+ * @throws CModelException
+ */
+ public void setTypeName(String type) throws CModelException;
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Archive.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Archive.java
index 34c126ecb3c..558e6574d4a 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Archive.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Archive.java
@@ -50,7 +50,7 @@ public class Archive extends Openable implements IArchive {
return new ArchiveInfo(this);
}
- protected ArchiveInfo getArchiveInfo() {
+ protected ArchiveInfo getArchiveInfo() throws CModelException {
return (ArchiveInfo)getElementInfo();
}
/* (non-Javadoc)
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Binary.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Binary.java
index f33f0acbe41..ae839c623a0 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Binary.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Binary.java
@@ -219,7 +219,7 @@ public class Binary extends Openable implements IBinary {
}
- boolean computeChildren(OpenableInfo info, IResource res) {
+ boolean computeChildren(OpenableInfo info, IResource res) throws CModelException {
boolean ok = false;
if (isObject() || isExecutable() || isSharedLib()) {
Map hash = new HashMap();
@@ -243,7 +243,7 @@ public class Binary extends Openable implements IBinary {
return ok;
}
- private void addFunction(OpenableInfo info, ISymbol symbol, Map hash) {
+ private void addFunction(OpenableInfo info, ISymbol symbol, Map hash) throws CModelException {
IPath filename = filename = symbol.getFilename();
BinaryFunction function = null;
@@ -273,7 +273,7 @@ public class Binary extends Openable implements IBinary {
// }
}
- private void addVariable(OpenableInfo info, ISymbol symbol, Map hash) {
+ private void addVariable(OpenableInfo info, ISymbol symbol, Map hash) throws CModelException {
IPath filename = filename = symbol.getFilename();
BinaryVariable variable = null;
if (filename != null) {
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryRunner.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryRunner.java
index 7b0c8165186..5cbb4e52517 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryRunner.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryRunner.java
@@ -43,17 +43,18 @@ public class BinaryRunner {
if (cproject == null || monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
- BinaryContainer vbin = (BinaryContainer) cproject.getBinaryContainer();
- ArchiveContainer vlib = (ArchiveContainer) cproject.getArchiveContainer();
- vlib.removeChildren();
- vbin.removeChildren();
try {
+ BinaryContainer vbin = (BinaryContainer) cproject.getBinaryContainer();
+ ArchiveContainer vlib = (ArchiveContainer) cproject.getArchiveContainer();
+
+ vlib.removeChildren();
+ vbin.removeChildren();
cproject.getProject().accept(new Visitor(BinaryRunner.this, monitor));
+ fireEvents(cproject, vbin);
+ fireEvents(cproject, vlib);
} catch (CoreException e) {
return e.getStatus();
}
- fireEvents(cproject, vbin);
- fireEvents(cproject, vlib);
return Status.OK_STATUS;
}
};
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CContainer.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CContainer.java
index 8f5eeac0ad9..5272dd86fa8 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CContainer.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CContainer.java
@@ -220,7 +220,7 @@ public class CContainer extends Openable implements ICContainer {
return true;
}
- protected ICElement computeChild(IResource resource, ICProject cproject) {
+ protected ICElement computeChild(IResource resource, ICProject cproject) throws CModelException {
ICElement celement = null;
switch (resource.getType()) {
case IResource.FILE :
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElement.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElement.java
index d3b70bf779a..f324310042e 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElement.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElement.java
@@ -78,7 +78,11 @@ public abstract class CElement extends PlatformObject implements ICElement {
}
public boolean exists() {
- return getElementInfo() != null;
+ try {
+ return getElementInfo() != null;
+ } catch (CModelException e) {
+ return false;
+ }
}
/**
@@ -143,7 +147,7 @@ public abstract class CElement extends PlatformObject implements ICElement {
return null;
}
- protected void addChild(ICElement e) {
+ protected void addChild(ICElement e) throws CModelException {
}
public void setPos(int startPos, int length) {
@@ -225,22 +229,18 @@ public abstract class CElement extends PlatformObject implements ICElement {
return false;
}
- public CElementInfo getElementInfo () {
- try {
- CModelManager manager;
- synchronized(manager = CModelManager.getDefault()){
- Object info = manager.getInfo(this);
+ public CElementInfo getElementInfo () throws CModelException {
+ CModelManager manager;
+ synchronized(manager = CModelManager.getDefault()){
+ Object info = manager.getInfo(this);
+ if (info == null) {
+ openHierarchy();
+ info= manager.getInfo(this);
if (info == null) {
- openHierarchy();
- info= manager.getInfo(this);
- if (info == null) {
- throw newNotPresentException();
- }
+ throw newNotPresentException();
}
- return (CElementInfo)info;
}
- } catch(CModelException e) {
- return null;
+ return (CElementInfo)info;
}
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDeltaBuilder.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDeltaBuilder.java
index 579ef48f8e5..063caee1b7d 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDeltaBuilder.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDeltaBuilder.java
@@ -15,6 +15,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICElementDelta;
import org.eclipse.cdt.core.model.IParent;
@@ -125,7 +126,7 @@ private void added(ICElement element) {
* Builds the C element deltas between the old content of the translation unit
* and its new content.
*/
-public void buildDeltas() {
+public void buildDeltas() throws CModelException {
this.recordNewPositions(this.cElement, 0);
this.findAdditions(this.cElement, 0);
this.findDeletions();
@@ -135,7 +136,7 @@ public void buildDeltas() {
/**
* Finds elements which have been added or changed.
*/
-private void findAdditions(ICElement newElement, int depth) {
+private void findAdditions(ICElement newElement, int depth) throws CModelException {
CElementInfo oldInfo = this.getElementInfo(newElement);
if (oldInfo == null && depth < this.maxDepth) {
this.delta.added(newElement);
@@ -169,7 +170,7 @@ private void findAdditions(ICElement newElement, int depth) {
/**
* Looks for changed positioning of elements.
*/
-private void findChangesInPositioning(ICElement element, int depth) {
+private void findChangesInPositioning(ICElement element, int depth) throws CModelException {
if (depth >= this.maxDepth || this.added.contains(element) || this.removed.contains(element))
return;
@@ -340,7 +341,7 @@ private void recordElementInfo(ICElement element, int depth) {
/**
* Fills the newPositions hashtable with the new position information
*/
-private void recordNewPositions(ICElement newElement, int depth) {
+private void recordNewPositions(ICElement newElement, int depth) throws CModelException {
if (depth < this.maxDepth && newElement instanceof IParent) {
CElementInfo info = null;
info = ((CElement)newElement).getElementInfo();
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java
index a1bb176662e..3af2e3d9a48 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java
@@ -183,7 +183,7 @@ public class CModelBuilder {
}
- private void generateModelElements(){
+ private void generateModelElements() throws CModelException{
Iterator i = quickParseCallback.iterateOffsetableElements();
while (i.hasNext()){
IASTOffsetableElement offsetable = (IASTOffsetableElement)i.next();
@@ -201,7 +201,7 @@ public class CModelBuilder {
}
}
- private void generateModelElements (Parent parent, IASTDeclaration declaration) throws ASTNotImplementedException
+ private void generateModelElements (Parent parent, IASTDeclaration declaration) throws CModelException, ASTNotImplementedException
{
if(declaration instanceof IASTNamespaceDefinition ) {
generateModelElements(parent, (IASTNamespaceDefinition) declaration);
@@ -222,7 +222,7 @@ public class CModelBuilder {
createSimpleElement(parent, declaration, false);
}
- private void generateModelElements (Parent parent, IASTNamespaceDefinition declaration) throws ASTNotImplementedException{
+ private void generateModelElements (Parent parent, IASTNamespaceDefinition declaration) throws CModelException, ASTNotImplementedException{
// IASTNamespaceDefinition
IParent namespace = createNamespace(parent, declaration);
Iterator nsDecls = declaration.getDeclarations();
@@ -232,13 +232,13 @@ public class CModelBuilder {
}
}
- private void generateModelElements (Parent parent, IASTAbstractTypeSpecifierDeclaration abstractDeclaration) throws ASTNotImplementedException
+ private void generateModelElements (Parent parent, IASTAbstractTypeSpecifierDeclaration abstractDeclaration) throws CModelException, ASTNotImplementedException
{
// IASTAbstractTypeSpecifierDeclaration
CElement element = createAbstractElement(parent, abstractDeclaration, false);
}
- private void generateModelElements (Parent parent, IASTTemplateDeclaration templateDeclaration) throws ASTNotImplementedException
+ private void generateModelElements (Parent parent, IASTTemplateDeclaration templateDeclaration) throws CModelException, ASTNotImplementedException
{
// Template Declaration
IASTDeclaration declaration = (IASTDeclaration)templateDeclaration.getOwnedDeclaration();
@@ -269,14 +269,14 @@ public class CModelBuilder {
}
}
- private void generateModelElements (Parent parent, IASTTypedefDeclaration declaration) throws ASTNotImplementedException
+ private void generateModelElements (Parent parent, IASTTypedefDeclaration declaration) throws CModelException, ASTNotImplementedException
{
TypeDef typeDef = createTypeDef(parent, declaration);
IASTAbstractDeclaration abstractDeclaration = declaration.getAbstractDeclarator();
CElement element = createAbstractElement(parent, abstractDeclaration, false);
}
- private CElement createAbstractElement(Parent parent, IASTTypeSpecifierOwner abstractDeclaration, boolean isTemplate)throws ASTNotImplementedException{
+ private CElement createAbstractElement(Parent parent, IASTTypeSpecifierOwner abstractDeclaration, boolean isTemplate)throws ASTNotImplementedException, CModelException{
CElement element = null;
if(abstractDeclaration != null){
IASTTypeSpecifier typeSpec = abstractDeclaration.getTypeSpecifier();
@@ -306,7 +306,7 @@ public class CModelBuilder {
return element;
}
- private CElement createSimpleElement(Parent parent, IASTDeclaration declaration, boolean isTemplate)throws ASTNotImplementedException{
+ private CElement createSimpleElement(Parent parent, IASTDeclaration declaration, boolean isTemplate)throws CModelException, ASTNotImplementedException{
CElement element = null;
if (declaration instanceof IASTVariable)
@@ -321,7 +321,7 @@ public class CModelBuilder {
return element;
}
- private Include createInclusion(Parent parent, IASTInclusion inclusion){
+ private Include createInclusion(Parent parent, IASTInclusion inclusion) throws CModelException{
// create element
Include element = new Include((CElement)parent, inclusion.getName(), !inclusion.isLocal());
element.setFullPathName(inclusion.getFullFileName());
@@ -335,7 +335,7 @@ public class CModelBuilder {
return element;
}
- private Macro createMacro(Parent parent, IASTMacro macro){
+ private Macro createMacro(Parent parent, IASTMacro macro) throws CModelException{
// create element
org.eclipse.cdt.internal.core.model.Macro element = new Macro(parent, macro.getName());
// add to parent
@@ -349,7 +349,7 @@ public class CModelBuilder {
}
- private Namespace createNamespace(Parent parent, IASTNamespaceDefinition nsDef){
+ private Namespace createNamespace(Parent parent, IASTNamespaceDefinition nsDef) throws CModelException{
// create element
String type = "namespace"; //$NON-NLS-1$
String nsName = (nsDef.getName() == null )
@@ -368,7 +368,7 @@ public class CModelBuilder {
return element;
}
- private Enumeration createEnumeration(Parent parent, IASTEnumerationSpecifier enumSpecifier){
+ private Enumeration createEnumeration(Parent parent, IASTEnumerationSpecifier enumSpecifier) throws CModelException{
// create element
String type = "enum"; //$NON-NLS-1$
String enumName = (enumSpecifier.getName() == null )
@@ -394,7 +394,7 @@ public class CModelBuilder {
return element;
}
- private Enumerator createEnumerator(Parent enum, IASTEnumerator enumDef){
+ private Enumerator createEnumerator(Parent enum, IASTEnumerator enumDef) throws CModelException{
Enumerator element = new Enumerator (enum, enumDef.getName().toString());
IASTExpression initialValue = enumDef.getInitialValue();
if(initialValue != null){
@@ -413,7 +413,7 @@ public class CModelBuilder {
return element;
}
- private Structure createClass(Parent parent, IASTClassSpecifier classSpecifier, boolean isTemplate){
+ private Structure createClass(Parent parent, IASTClassSpecifier classSpecifier, boolean isTemplate) throws CModelException{
// create element
String className = ""; //$NON-NLS-1$
String type = ""; //$NON-NLS-1$
@@ -482,7 +482,7 @@ public class CModelBuilder {
return element;
}
- private TypeDef createTypeDef(Parent parent, IASTTypedefDeclaration typeDefDeclaration){
+ private TypeDef createTypeDef(Parent parent, IASTTypedefDeclaration typeDefDeclaration) throws CModelException{
// create the element
String name = typeDefDeclaration.getName();
@@ -502,7 +502,7 @@ public class CModelBuilder {
return element;
}
- private VariableDeclaration createVariableSpecification(Parent parent, IASTVariable varDeclaration, boolean isTemplate)throws ASTNotImplementedException
+ private VariableDeclaration createVariableSpecification(Parent parent, IASTVariable varDeclaration, boolean isTemplate)throws CModelException, ASTNotImplementedException
{
String variableName = varDeclaration.getName();
if((variableName == null) || (variableName.length() <= 0)){
@@ -558,7 +558,7 @@ public class CModelBuilder {
return element;
}
- private FunctionDeclaration createFunctionSpecification(Parent parent, IASTFunction functionDeclaration, boolean isTemplate)
+ private FunctionDeclaration createFunctionSpecification(Parent parent, IASTFunction functionDeclaration, boolean isTemplate) throws CModelException
{
String name = functionDeclaration.getName();
if ((name == null) || (name.length() <= 0)) {
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProject.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProject.java
index 2559b5944de..97800c0de92 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProject.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProject.java
@@ -53,11 +53,11 @@ public class CProject extends Openable implements ICProject {
super(parent, project, CElement.C_PROJECT);
}
- public IBinaryContainer getBinaryContainer() {
+ public IBinaryContainer getBinaryContainer() throws CModelException {
return ((CProjectInfo) getElementInfo()).getBinaryContainer();
}
- public IArchiveContainer getArchiveContainer() {
+ public IArchiveContainer getArchiveContainer() throws CModelException {
return ((CProjectInfo) getElementInfo()).getArchiveContainer();
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java
index 82a0816d087..134147a8f3b 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java
@@ -87,52 +87,54 @@ public class DeltaProcessor {
// BUG 36424:
// The Binary may only be visible in the BinaryContainers
-
- if (celement == null && resource.getType() == IResource.FILE) {
- ICElement[] children;
- ICProject cproj = manager.create(resource.getProject());
- if (cproj != null && cproj.isOpen()) {
- IBinaryContainer bin = cproj.getBinaryContainer();
- if (bin.isOpen()) {
- children = ((CElement)bin).getElementInfo().getChildren();
- for (int i = 0; i < children.length; i++) {
- IResource res = children[i].getResource();
- if (resource.equals(res)) {
- celement = children[i];
- break;
+ try {
+ if (celement == null && resource.getType() == IResource.FILE) {
+ ICElement[] children;
+ ICProject cproj = manager.create(resource.getProject());
+ if (cproj != null && cproj.isOpen()) {
+ IBinaryContainer bin = cproj.getBinaryContainer();
+ if (bin.isOpen()) {
+ children = ((CElement)bin).getElementInfo().getChildren();
+ for (int i = 0; i < children.length; i++) {
+ IResource res = children[i].getResource();
+ if (resource.equals(res)) {
+ celement = children[i];
+ break;
+ }
}
}
}
}
- }
- // BUG 36424:
- // The Archive may only be visible in the ArchiveContainers
- if (celement == null && resource.getType() == IResource.FILE) {
- ICElement[] children;
- ICProject cproj = manager.create(resource.getProject());
- if (cproj != null && cproj.isOpen()) {
- IArchiveContainer ar = cproj.getArchiveContainer();
- if (ar.isOpen()) {
- children = ((CElement)ar).getElementInfo().getChildren();
- for (int i = 0; i < children.length; i++) {
- IResource res = children[i].getResource();
- if (resource.equals(res)) {
- celement = children[i];
- break;
+ // BUG 36424:
+ // The Archive may only be visible in the ArchiveContainers
+ if (celement == null && resource.getType() == IResource.FILE) {
+ ICElement[] children;
+ ICProject cproj = manager.create(resource.getProject());
+ if (cproj != null && cproj.isOpen()) {
+ IArchiveContainer ar = cproj.getArchiveContainer();
+ if (ar.isOpen()) {
+ children = ((CElement)ar).getElementInfo().getChildren();
+ for (int i = 0; i < children.length; i++) {
+ IResource res = children[i].getResource();
+ if (resource.equals(res)) {
+ celement = children[i];
+ break;
+ }
}
}
- }
- }
- }
-
- // It is not a C resource if the parent is a Binary/ArchiveContainer
- // But we have to release too.
- if (celement != null && resource.getType() == IResource.FILE) {
- ICElement parent = celement.getParent();
- if (parent instanceof IArchiveContainer || parent instanceof IBinaryContainer) {
- releaseCElement(celement);
- celement = null;
+ }
}
+ // It is not a C resource if the parent is a Binary/ArchiveContainer
+ // But we have to release too.
+ if (celement != null && resource.getType() == IResource.FILE) {
+ ICElement parent = celement.getParent();
+ if (parent instanceof IArchiveContainer || parent instanceof IBinaryContainer) {
+ releaseCElement(celement);
+ celement = null;
+ }
+ }
+ } catch (CModelException e) {
+ return null;
}
return celement;
}
@@ -140,7 +142,7 @@ public class DeltaProcessor {
/**
* Adds the given child handle to its parent's cache of children.
*/
- protected void addToParentInfo(Openable child) {
+ protected void addToParentInfo(Openable child) throws CModelException {
Openable parent = (Openable) child.getParent();
if (parent != null && parent.isOpen()) {
CElementInfo info = parent.getElementInfo();
@@ -153,7 +155,7 @@ public class DeltaProcessor {
* element does not have a parent, or the parent is not currently open,
* this has no effect.
*/
- private void removeFromParentInfo(ICElement child) {
+ private void removeFromParentInfo(ICElement child) throws CModelException {
CModelManager factory = CModelManager.getDefault();
// Remove the child from the parent list.
@@ -166,7 +168,7 @@ public class DeltaProcessor {
/**
* Release the Element and cleaning.
*/
- protected void releaseCElement(ICElement celement) {
+ protected void releaseCElement(ICElement celement) throws CModelException {
CModelManager factory = CModelManager.getDefault();
int type = celement.getElementType();
if (type == ICElement.C_ARCHIVE) {
@@ -184,27 +186,21 @@ public class DeltaProcessor {
CProjectInfo pinfo = (CProjectInfo)factory.peekAtInfo(cproject);
if (pinfo != null && pinfo.vBin != null) {
if (factory.peekAtInfo(pinfo.vBin) != null) {
- try {
- ICElement[] bins = pinfo.vBin.getChildren();
- for (int i = 0; i < bins.length; i++) {
- if (celement.getPath().isPrefixOf(bins[i].getPath())) {
- fCurrentDelta.changed(pinfo.vBin, ICElementDelta.CHANGED);
- }
+ ICElement[] bins = pinfo.vBin.getChildren();
+ for (int i = 0; i < bins.length; i++) {
+ if (celement.getPath().isPrefixOf(bins[i].getPath())) {
+ fCurrentDelta.changed(pinfo.vBin, ICElementDelta.CHANGED);
}
- } catch (CModelException e) {
}
}
}
if (pinfo != null && pinfo.vLib != null) {
if (factory.peekAtInfo(pinfo.vLib) != null) {
- try {
- ICElement[] ars = pinfo.vLib.getChildren();
- for (int i = 0; i < ars.length; i++) {
- if (celement.getPath().isPrefixOf(ars[i].getPath())) {
- fCurrentDelta.changed(pinfo.vBin, ICElementDelta.CHANGED);
- }
+ ICElement[] ars = pinfo.vLib.getChildren();
+ for (int i = 0; i < ars.length; i++) {
+ if (celement.getPath().isPrefixOf(ars[i].getPath())) {
+ fCurrentDelta.changed(pinfo.vBin, ICElementDelta.CHANGED);
}
- } catch (CModelException e) {
}
}
}
@@ -230,7 +226,7 @@ public class DeltaProcessor {
* basicElementAdded
.
*
*/
- protected void elementAdded(ICElement element, IResourceDelta delta) {
+ protected void elementAdded(ICElement element, IResourceDelta delta) throws CModelException {
if (element instanceof Openable) {
addToParentInfo((Openable)element);
@@ -258,7 +254,7 @@ public class DeltaProcessor {
* a resource is closed, the platform reports all children as removed. This
* would effectively delete the classpath if we processed children.
*/
- protected void elementClosed(ICElement element, IResourceDelta delta) {
+ protected void elementClosed(ICElement element, IResourceDelta delta) throws CModelException {
if (element.getElementType() == ICElement.C_PROJECT) {
// treat project closing as removal
@@ -278,7 +274,7 @@ public class DeltaProcessor {
* as a the element being opened (CHANGED + F_CLOSED).
*
*/
- protected void elementOpened(ICElement element, IResourceDelta delta) {
+ protected void elementOpened(ICElement element, IResourceDelta delta) throws CModelException {
if (element.getElementType() == ICElement.C_PROJECT) {
// treat project opening as addition
@@ -325,7 +321,7 @@ public class DeltaProcessor {
*
Add a REMOVED entry in the delta
*
*/
- protected void elementRemoved(ICElement element, IResourceDelta delta) {
+ protected void elementRemoved(ICElement element, IResourceDelta delta) throws CModelException {
if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0) {
IPath movedToPath = delta.getMovedToPath();
// create the moved to element
@@ -445,7 +441,7 @@ public class DeltaProcessor {
* @param parent
* @param delta
*/
- protected void nonCResourcesChanged(ICElement parent, IResourceDelta delta) {
+ protected void nonCResourcesChanged(ICElement parent, IResourceDelta delta) throws CModelException {
if (parent instanceof Openable && ((Openable)parent).isOpen()) {
CElementInfo info = ((Openable)parent).getElementInfo();
switch (parent.getElementType()) {
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Enumeration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Enumeration.java
index cca67d8fa7a..344e5c6c6e1 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Enumeration.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Enumeration.java
@@ -11,6 +11,7 @@ package org.eclipse.cdt.internal.core.model;
* Rational Software - Initial API and implementation
***********************************************************************/
+import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IEnumeration;
@@ -24,7 +25,7 @@ public class Enumeration extends SourceManipulation implements IEnumeration{
return new EnumerationInfo(this);
}
- private EnumerationInfo getEnumerationInfo(){
+ private EnumerationInfo getEnumerationInfo() throws CModelException{
return (EnumerationInfo) getElementInfo();
}
/**
@@ -37,35 +38,35 @@ public class Enumeration extends SourceManipulation implements IEnumeration{
/**
* @see org.eclipse.cdt.core.model.IVariableDeclaration#getTypeName()
*/
- public String getTypeName() {
+ public String getTypeName() throws CModelException {
return getEnumerationInfo().getTypeName();
}
/**
* @see org.eclipse.cdt.core.model.IVariableDeclaration#setTypeName(java.lang.String)
*/
- public void setTypeName(String type) {
+ public void setTypeName(String type) throws CModelException {
getEnumerationInfo().setTypeName(type);
}
/**
* @see org.eclipse.cdt.core.model.IDeclaration#isConst()
*/
- public boolean isConst() {
+ public boolean isConst() throws CModelException {
return getEnumerationInfo().isConst();
}
/**
* @see org.eclipse.cdt.core.model.IDeclaration#isStatic()
*/
- public boolean isStatic() {
+ public boolean isStatic() throws CModelException {
return getEnumerationInfo().isStatic();
}
/**
* @see org.eclipse.cdt.core.model.IDeclaration#isVolatile()
*/
- public boolean isVolatile() {
+ public boolean isVolatile() throws CModelException {
return getEnumerationInfo().isVolatile();
}
@@ -73,7 +74,7 @@ public class Enumeration extends SourceManipulation implements IEnumeration{
* Sets the isConst.
* @param isConst The isConst to set
*/
- public void setConst(boolean isConst) {
+ public void setConst(boolean isConst) throws CModelException {
getEnumerationInfo().setConst(isConst);
}
@@ -81,7 +82,7 @@ public class Enumeration extends SourceManipulation implements IEnumeration{
* Sets the isStatic.
* @param isStatic The isStatic to set
*/
- public void setStatic(boolean isStatic) {
+ public void setStatic(boolean isStatic) throws CModelException {
getEnumerationInfo().setStatic( isStatic);
}
@@ -89,7 +90,7 @@ public class Enumeration extends SourceManipulation implements IEnumeration{
* Sets the isVolatile.
* @param isVolatile The isVolatile to set
*/
- public void setVolatile(boolean isVolatile) {
+ public void setVolatile(boolean isVolatile) throws CModelException {
getEnumerationInfo().setVolatile(isVolatile);
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Field.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Field.java
index 59c62ca3b8f..3f052de88f6 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Field.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Field.java
@@ -5,6 +5,7 @@ package org.eclipse.cdt.internal.core.model;
* All Rights Reserved.
*/
+import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IField;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
@@ -15,55 +16,55 @@ public class Field extends VariableDeclaration implements IField {
super(parent, name, CElement.C_FIELD);
}
- public boolean isMutable(){
+ public boolean isMutable() throws CModelException{
return getFieldInfo().isMutable();
}
- public void setMutable(boolean mutable){
+ public void setMutable(boolean mutable) throws CModelException{
getFieldInfo().setMutable(mutable);
}
- public String getTypeName() {
+ public String getTypeName() throws CModelException {
return getFieldInfo().getTypeName();
}
- public void setTypeName(String type) {
+ public void setTypeName(String type) throws CModelException {
getFieldInfo().setTypeName(type);
}
- public boolean isConst() {
+ public boolean isConst() throws CModelException {
return getFieldInfo().isConst();
}
- public void setConst(boolean isConst) {
+ public void setConst(boolean isConst) throws CModelException {
getFieldInfo().setConst(isConst);
}
- public boolean isVolatile() {
+ public boolean isVolatile() throws CModelException {
return getFieldInfo().isVolatile();
}
- public void setVolatile(boolean isVolatile) {
+ public void setVolatile(boolean isVolatile) throws CModelException {
getFieldInfo().setVolatile(isVolatile);
}
- public boolean isStatic() {
+ public boolean isStatic() throws CModelException {
return getFieldInfo().isStatic();
}
- public void setStatic(boolean isStatic) {
+ public void setStatic(boolean isStatic) throws CModelException {
getFieldInfo().setStatic(isStatic);
}
- public ASTAccessVisibility getVisibility() {
+ public ASTAccessVisibility getVisibility() throws CModelException {
return getFieldInfo().getVisibility();
}
- public void setVisibility(ASTAccessVisibility visibility) {
+ public void setVisibility(ASTAccessVisibility visibility) throws CModelException {
getFieldInfo().setVisibility(visibility);
}
- public FieldInfo getFieldInfo(){
+ public FieldInfo getFieldInfo() throws CModelException{
return (FieldInfo) getElementInfo();
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java
index 66d24080d41..d857c4657c0 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java
@@ -5,6 +5,7 @@ package org.eclipse.cdt.internal.core.model;
* All Rights Reserved.
*/
+import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IFunctionDeclaration;
@@ -49,13 +50,14 @@ public class FunctionDeclaration extends SourceManipulation implements IFunction
fParameterTypes = parameterTypes;
}
- public String getSignature(){
+ public String getSignature() throws CModelException{
StringBuffer sig = new StringBuffer(getElementName());
sig.append(getParameterClause());
if(isConst())
sig.append(" const"); //$NON-NLS-1$
- if(isVolatile())
+ if(isVolatile()) {
sig.append(" volatile"); //$NON-NLS-1$
+ }
return sig.toString();
}
@@ -91,7 +93,7 @@ public class FunctionDeclaration extends SourceManipulation implements IFunction
return new FunctionInfo(this);
}
- protected FunctionInfo getFunctionInfo(){
+ protected FunctionInfo getFunctionInfo() throws CModelException{
return (FunctionInfo) getElementInfo();
}
@@ -110,11 +112,11 @@ public class FunctionDeclaration extends SourceManipulation implements IFunction
* FunctionDeclarations and Functions can not be constant
* @see org.eclipse.cdt.core.model.IDeclaration#isConst()
*/
- public boolean isConst(){
+ public boolean isConst() throws CModelException{
return getFunctionInfo().isConst();
}
- public void setConst(boolean isConst){
+ public void setConst(boolean isConst) throws CModelException{
getFunctionInfo().setConst(isConst);
}
@@ -122,7 +124,7 @@ public class FunctionDeclaration extends SourceManipulation implements IFunction
* Returns the isStatic.
* @return boolean
*/
- public boolean isStatic() {
+ public boolean isStatic() throws CModelException {
return getFunctionInfo().isStatic();
}
@@ -130,7 +132,7 @@ public class FunctionDeclaration extends SourceManipulation implements IFunction
* Returns the isVolatile.
* @return boolean
*/
- public boolean isVolatile() {
+ public boolean isVolatile() throws CModelException {
return getFunctionInfo().isVolatile();
}
@@ -138,7 +140,7 @@ public class FunctionDeclaration extends SourceManipulation implements IFunction
* Sets the isStatic.
* @param isStatic The isStatic to set
*/
- public void setStatic(boolean isStatic) {
+ public void setStatic(boolean isStatic) throws CModelException {
getFunctionInfo().setStatic(isStatic);
}
@@ -146,7 +148,7 @@ public class FunctionDeclaration extends SourceManipulation implements IFunction
* Sets the isVolatile.
* @param isVolatile The isVolatile to set
*/
- public void setVolatile(boolean isVolatile) {
+ public void setVolatile(boolean isVolatile) throws CModelException {
getFunctionInfo().setVolatile(isVolatile);
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionTemplate.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionTemplate.java
index fd4c8270449..3c734d33532 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionTemplate.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionTemplate.java
@@ -11,6 +11,7 @@ package org.eclipse.cdt.internal.core.model;
* Rational Software - Initial API and implementation
***********************************************************************/
+import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ITemplate;
@@ -58,7 +59,7 @@ public class FunctionTemplate extends FunctionDeclaration implements ITemplate{
* normal parameter list, then a colon then the function's
* return type.
*/
- public String getTemplateSignature() {
+ public String getTemplateSignature() throws CModelException {
StringBuffer sig = new StringBuffer(getElementName());
if(getNumberOfTemplateParameters() > 0){
sig.append("<"); //$NON-NLS-1$
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java
index 368bf635d9f..f64950dbcce 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java
@@ -11,6 +11,7 @@ package org.eclipse.cdt.internal.core.model;
* Rational Software - Initial API and implementation
***********************************************************************/
+import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IMethodDeclaration;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
@@ -53,35 +54,35 @@ public class MethodDeclaration extends FunctionDeclaration implements IMethodDec
return getElementName().startsWith("operator"); //$NON-NLS-1$
}
- public boolean isPureVirtual(){
+ public boolean isPureVirtual() throws CModelException{
return getMethodInfo().isPureVirtual();
}
- public void setPureVirtual(boolean isPureVirtual){
+ public void setPureVirtual(boolean isPureVirtual) throws CModelException{
getMethodInfo().setPureVirtual(isPureVirtual);
}
- public boolean isInline(){
+ public boolean isInline() throws CModelException{
return getMethodInfo().isInline();
}
- public void setInline(boolean isInline){
+ public void setInline(boolean isInline) throws CModelException{
getMethodInfo().setInline(isInline);
}
- public boolean isVirtual(){
+ public boolean isVirtual() throws CModelException{
return getMethodInfo().isVirtual();
}
- public void setVirtual(boolean isVirtual){
+ public void setVirtual(boolean isVirtual) throws CModelException{
getMethodInfo().setVirtual(isVirtual);
}
- public boolean isFriend(){
+ public boolean isFriend() throws CModelException{
return getMethodInfo().isFriend();
}
- public void setFriend(boolean isFriend){
+ public void setFriend(boolean isFriend) throws CModelException{
getMethodInfo().setFriend(isFriend);
}
@@ -89,16 +90,16 @@ public class MethodDeclaration extends FunctionDeclaration implements IMethodDec
return isConst;
}
- public void setConst(boolean isConst){
+ public void setConst(boolean isConst) throws CModelException{
this.isConst = isConst;
getMethodInfo().setConst(isConst);
}
- public ASTAccessVisibility getVisibility(){
+ public ASTAccessVisibility getVisibility() throws CModelException{
return getMethodInfo().getVisibility();
}
- public void setVisibility(ASTAccessVisibility visibility){
+ public void setVisibility(ASTAccessVisibility visibility) throws CModelException{
getMethodInfo().setVisibility(visibility);
}
@@ -106,7 +107,7 @@ public class MethodDeclaration extends FunctionDeclaration implements IMethodDec
return new MethodInfo(this);
}
- private MethodInfo getMethodInfo(){
+ private MethodInfo getMethodInfo() throws CModelException{
return (MethodInfo) getElementInfo();
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodTemplate.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodTemplate.java
index 1309f098d68..9901c881a9a 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodTemplate.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodTemplate.java
@@ -11,6 +11,7 @@ package org.eclipse.cdt.internal.core.model;
* Rational Software - Initial API and implementation
***********************************************************************/
+import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ITemplate;
@@ -59,7 +60,7 @@ public class MethodTemplate extends MethodDeclaration implements ITemplate{
* return type.
*/
- public String getTemplateSignature() {
+ public String getTemplateSignature() throws CModelException {
StringBuffer sig = new StringBuffer(getElementName());
if(getNumberOfTemplateParameters() > 0){
sig.append("<"); //$NON-NLS-1$
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Parent.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Parent.java
index 6aef45375a0..83fee9283fc 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Parent.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Parent.java
@@ -23,7 +23,7 @@ public abstract class Parent extends CElement {
* Adds a child to the current element.
* Implementations override this method to support children
*/
- public void addChild(ICElement member) {
+ public void addChild(ICElement member) throws CModelException {
getElementInfo().addChild(member);
}
@@ -31,11 +31,11 @@ public abstract class Parent extends CElement {
* Removes a child to the current element.
* Implementations override this method to support children
*/
- public void removeChild(ICElement member) {
+ public void removeChild(ICElement member) throws CModelException {
getElementInfo().removeChild(member);
}
- public void removeChildren () {
+ public void removeChildren () throws CModelException {
getElementInfo().removeChildren();
}
@@ -71,15 +71,27 @@ public abstract class Parent extends CElement {
}
public boolean hasChildren () {
- return getElementInfo().hasChildren();
+ try {
+ return getElementInfo().hasChildren();
+ } catch (CModelException e) {
+ return false;
+ }
}
protected void setChanged () {
- getElementInfo().setChanged();
+ try {
+ getElementInfo().setChanged();
+ } catch (CModelException e) {
+ // ignore
+ }
}
protected boolean hasChanged () {
- return getElementInfo().hasChanged();
+ try {
+ return getElementInfo().hasChanged();
+ } catch (CModelException e) {
+ return false;
+ }
}
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceManipulation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceManipulation.java
index 45890e46573..19080530a4c 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceManipulation.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceManipulation.java
@@ -92,7 +92,11 @@ public class SourceManipulation extends Parent implements ISourceManipulation, I
* @see IMember
*/
public ITranslationUnit getTranslationUnit() {
- return getSourceManipulationInfo().getTranslationUnit();
+ try {
+ return getSourceManipulationInfo().getTranslationUnit();
+ } catch (CModelException e) {
+ return null;
+ }
}
/**
@@ -149,11 +153,11 @@ public class SourceManipulation extends Parent implements ISourceManipulation, I
return new SourceManipulationInfo(this);
}
- protected SourceManipulationInfo getSourceManipulationInfo() {
+ protected SourceManipulationInfo getSourceManipulationInfo() throws CModelException {
return (SourceManipulationInfo)getElementInfo();
}
- public boolean isIdentical(SourceManipulation other){
+ public boolean isIdentical(SourceManipulation other) throws CModelException{
return (this.equals(other)
&& (this.getSourceManipulationInfo().hasSameContentsAs(other.getSourceManipulationInfo())));
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Structure.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Structure.java
index c9ba018890d..d08f79cf701 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Structure.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Structure.java
@@ -66,15 +66,15 @@ public class Structure extends SourceManipulation implements IStructure {
return null;
}
- public boolean isUnion() {
+ public boolean isUnion() throws CModelException {
return getStructureInfo().isUnion();
}
- public boolean isClass() {
+ public boolean isClass() throws CModelException {
return getStructureInfo().isClass();
}
- public boolean isStruct() {
+ public boolean isStruct() throws CModelException {
return getStructureInfo().isStruct();
}
@@ -96,39 +96,39 @@ public class Structure extends SourceManipulation implements IStructure {
return (ASTAccessVisibility)superClassesNames.get(name);
}
- public String getTypeName() {
+ public String getTypeName() throws CModelException {
return getStructureInfo().getTypeName();
}
- public void setTypeName(String type){
+ public void setTypeName(String type) throws CModelException{
getStructureInfo().setTypeString(type);
}
- public boolean isConst() {
+ public boolean isConst() throws CModelException {
return getStructureInfo().isConst();
}
- public void setConst(boolean isConst) {
+ public void setConst(boolean isConst) throws CModelException {
getStructureInfo().setConst(isConst);
}
- public boolean isVolatile() {
+ public boolean isVolatile() throws CModelException {
return getStructureInfo().isVolatile();
}
- public void setVolatile(boolean isVolatile) {
+ public void setVolatile(boolean isVolatile) throws CModelException {
getStructureInfo().setVolatile(isVolatile);
}
- public boolean isStatic() {
+ public boolean isStatic() throws CModelException {
return getStructureInfo().isStatic();
}
- public void setStatic(boolean isStatic) {
+ public void setStatic(boolean isStatic) throws CModelException {
getStructureInfo().setStatic(isStatic);
}
- public StructureInfo getStructureInfo(){
+ public StructureInfo getStructureInfo() throws CModelException{
return (StructureInfo) getElementInfo();
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java
index 00926096992..362e27b5498 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java
@@ -212,7 +212,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
return getSourceManipulationInfo().getSourceRange();
}
- protected TranslationUnitInfo getTranslationUnitInfo() {
+ protected TranslationUnitInfo getTranslationUnitInfo() throws CModelException {
return (TranslationUnitInfo)getElementInfo();
}
@@ -296,7 +296,11 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
* @param element
*/
private void getNewElements(Map newElements, CElement element){
- Object info = element.getElementInfo();
+ Object info = null;
+ try {
+ info = element.getElementInfo();
+ } catch (CModelException e) {
+ }
if(info != null){
if(element instanceof IParent){
ICElement[] children = ((CElementInfo)info).getChildren();
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java
index 10caa7f4836..924c2cd01b5 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java
@@ -5,6 +5,7 @@ package org.eclipse.cdt.internal.core.model;
* All Rights Reserved.
*/
+import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IVariableDeclaration;
@@ -18,39 +19,39 @@ public class VariableDeclaration extends SourceManipulation implements IVariable
super(parent, name, type);
}
- public String getTypeName() {
+ public String getTypeName() throws CModelException {
return getVariableInfo().getTypeName();
}
- public void setTypeName(String type) {
+ public void setTypeName(String type) throws CModelException {
getVariableInfo().setTypeString(type);
}
- public boolean isConst() {
+ public boolean isConst() throws CModelException {
return getVariableInfo().isConst();
}
- public void setConst(boolean isConst) {
+ public void setConst(boolean isConst) throws CModelException {
getVariableInfo().setConst(isConst);
}
- public boolean isVolatile() {
+ public boolean isVolatile() throws CModelException {
return getVariableInfo().isVolatile();
}
- public void setVolatile(boolean isVolatile) {
+ public void setVolatile(boolean isVolatile) throws CModelException {
getVariableInfo().setVolatile(isVolatile);
}
- public boolean isStatic() {
+ public boolean isStatic() throws CModelException {
return getVariableInfo().isStatic();
}
- public void setStatic(boolean isStatic) {
+ public void setStatic(boolean isStatic) throws CModelException {
getVariableInfo().setStatic(isStatic);
}
- public VariableInfo getVariableInfo(){
+ public VariableInfo getVariableInfo() throws CModelException{
return (VariableInfo) getElementInfo();
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableTemplate.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableTemplate.java
index b22876a8c94..f7e0d4b7d0b 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableTemplate.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableTemplate.java
@@ -9,6 +9,7 @@ package org.eclipse.cdt.internal.core.model;
* Contributors:
* Rational Software - Initial API and implementation
***********************************************************************/
+import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ITemplate;
@@ -46,7 +47,7 @@ public class VariableTemplate extends Variable implements ITemplate {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ITemplate#getTemplateSignature()
*/
- public String getTemplateSignature() {
+ public String getTemplateSignature() throws CModelException {
StringBuffer sig = new StringBuffer(getElementName());
if(getNumberOfTemplateParameters() > 0){
sig.append("<"); //$NON-NLS-1$
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/WorkingCopy.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/WorkingCopy.java
index 3e33f348bbd..25545a32a70 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/WorkingCopy.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/WorkingCopy.java
@@ -208,9 +208,13 @@ public class WorkingCopy extends TranslationUnit implements IWorkingCopy {
if (this.useCount == 0) {
return false;
}
- // if resource got deleted, then #getModificationStamp() will answer IResource.NULL_STAMP, which is always different from the cached
- // timestamp
- return ((TranslationUnitInfo) getElementInfo()).fTimestamp == ((IFile) resource).getModificationStamp();
+ try {
+ // if resource got deleted, then #getModificationStamp() will answer IResource.NULL_STAMP, which is always different from the cached
+ // timestamp
+ return ((TranslationUnitInfo) getElementInfo()).fTimestamp == ((IFile) resource).getModificationStamp();
+ } catch (CModelException e) {
+ return false;
+ }
}
/**
* @see org.eclipse.cdt.core.model.ITranslationUnit#isWorkingCopy()
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
index 1d54e952236..110228da934 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
@@ -525,6 +525,7 @@ public class CCorePlugin extends Plugin {
}
} catch (CoreException e) {
log(e);
+ // ignore
}
}
if (configs == null) {
@@ -584,7 +585,7 @@ public class CCorePlugin extends Plugin {
list.toArray(parsers);
}
} catch (CoreException e) {
- log(e);
+ // ignore since we fall back to a default....
}
}
if (parsers == null) {
diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog
index c628384746c..9f50784d4c6 100644
--- a/core/org.eclipse.cdt.ui/ChangeLog
+++ b/core/org.eclipse.cdt.ui/ChangeLog
@@ -1,3 +1,14 @@
+2004-04-20 David Inglis
+
+ More of the model throws CModeLException.
+
+ * refactor/org/eclipse/cdt/internal/corext/refactoring/rename/RenameElementProcessor.java
+ * src/org/eclipse/cdt/internal/ui/CElementImageProvider.java
+ * src/org/eclipse/cdt/internal/ui/search/CElementLabels.java
+ * src/org/eclipse/cdt/internal/ui/viewsupport/MemberFilter.java
+ * src/org/eclipse/cdt/ui/CElementContentProvider.java
+ * src/org/eclipse/cdt/ui/CElementLabelProvider.java
+
2004-04-20 Alain Magloire
Fix for PR 59081
@@ -5,7 +16,7 @@
* src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java
* src/org/eclipse/cdt/internal/ui/editor/CEditor.java
* src/org/eclipse/cdt/internal/ui/editor/DocumentAdapter.java
-
+
2004-04-20 David Inglis
Enable wraping for build console
diff --git a/core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/rename/RenameElementProcessor.java b/core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/rename/RenameElementProcessor.java
index 6959701096b..29e3b253cfb 100644
--- a/core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/rename/RenameElementProcessor.java
+++ b/core/org.eclipse.cdt.ui/refactor/org/eclipse/cdt/internal/corext/refactoring/rename/RenameElementProcessor.java
@@ -151,7 +151,7 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
return ((CElement)fCElement).getIdStartPos();
}
- public String getElementQualifiedName(ICElement element){
+ public String getElementQualifiedName(ICElement element) throws CModelException{
if(!eligibleForRefactoring(element)){
return "";
} else {
@@ -172,7 +172,7 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
return name.toString();
}
}
- public RefactoringStatus checkNewElementName(String newName){
+ public RefactoringStatus checkNewElementName(String newName) throws CModelException{
if (!eligibleForRefactoring(fCElement)) {
return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.getString("RenameTypeRefactoring.wrong_element")); //$NON-NLS-1$
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CElementImageProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CElementImageProvider.java
index 017dac9aa94..d1c0b05efc1 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CElementImageProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CElementImageProvider.java
@@ -5,6 +5,7 @@ package org.eclipse.cdt.internal.ui;
* All Rights Reserved.
*/
+import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.IBinaryModule;
@@ -339,21 +340,25 @@ public class CElementImageProvider {
return getEnumeratorImageDescriptor();
case ICElement.C_FIELD:
- {
+ try {
IField field = (IField)celement;
ASTAccessVisibility visibility = field.getVisibility();
return getFieldImageDescriptor(visibility);
+ } catch (CModelException e) {
+ return null;
}
case ICElement.C_METHOD:
case ICElement.C_METHOD_DECLARATION:
case ICElement.C_TEMPLATE_METHOD:
- {
+ try {
+
IMethodDeclaration md= (IMethodDeclaration)celement;
ASTAccessVisibility visibility =md.getVisibility();
return getMethodImageDescriptor(visibility);
+ } catch (CModelException e) {
+ return null;
}
-
case ICElement.C_VARIABLE:
case ICElement.C_TEMPLATE_VARIABLE:
return getVariableImageDescriptor();
@@ -387,21 +392,24 @@ public class CElementImageProvider {
private int computeCAdornmentFlags(ICElement element, int renderFlags) {
int flags= computeBasicAdornmentFlags(element, renderFlags);
-
- if (showOverlayIcons(renderFlags) && element instanceof IDeclaration) {
- IDeclaration decl = (IDeclaration) element;
- if(decl.isStatic()){
- flags |= CElementImageDescriptor.STATIC;
- }
- if(decl.isConst()){
- flags |= CElementImageDescriptor.CONSTANT;
- }
- if(decl.isVolatile()){
- flags |= CElementImageDescriptor.VOLATILE;
- }
- if(element instanceof ITemplate){
- flags |= CElementImageDescriptor.TEMPLATE;
+
+ try {
+ if (showOverlayIcons(renderFlags) && element instanceof IDeclaration) {
+ IDeclaration decl = (IDeclaration) element;
+ if(decl.isStatic()){
+ flags |= CElementImageDescriptor.STATIC;
+ }
+ if(decl.isConst()){
+ flags |= CElementImageDescriptor.CONSTANT;
+ }
+ if(decl.isVolatile()){
+ flags |= CElementImageDescriptor.VOLATILE;
+ }
+ if(element instanceof ITemplate){
+ flags |= CElementImageDescriptor.TEMPLATE;
+ }
}
+ } catch (CModelException e) {
}
return flags;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CElementLabels.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CElementLabels.java
index 7e153b251f7..f33cec321f2 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CElementLabels.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CElementLabels.java
@@ -13,9 +13,11 @@
*/
package org.eclipse.cdt.internal.ui.search;
+import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IMethod;
import org.eclipse.cdt.core.model.IStructure;
+import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.ui.model.IWorkbenchAdapter;
@@ -280,6 +282,7 @@ public class CElementLabels {
}
public static void getMethodLabel( IMethod method, int flags, StringBuffer buf ) {
+ try {
//return type
if( getFlag( flags, M_PRE_RETURNTYPE ) && method.exists() && !method.isConstructor() ) {
buf.append( method.getReturnType() );
@@ -346,7 +349,10 @@ public class CElementLabels {
if( getFlag(flags, M_POST_QUALIFIED)) {
buf.append( CONCAT_STRING );
getTypeLabel( method.getParent(), T_FULLY_QUALIFIED | (flags & P_COMPRESSED), buf );
- }
+ }
+ } catch (CModelException e) {
+ CUIPlugin.getDefault().log(e);
+ }
}
public static void getTypeLabel(ICElement type, int flags, StringBuffer buf) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/MemberFilter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/MemberFilter.java
index b92122dbd83..239e52a07c0 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/MemberFilter.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/MemberFilter.java
@@ -10,6 +10,7 @@
******************************************************************************/
package org.eclipse.cdt.internal.ui.viewsupport;
+import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.IDeclaration;
import org.eclipse.cdt.core.model.IField;
import org.eclipse.cdt.core.model.IMember;
@@ -61,19 +62,23 @@ public class MemberFilter extends ViewerFilter{
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
if(element instanceof IDeclaration){
- IDeclaration declaration = (IDeclaration) element;
- if (hasFilter(FILTER_STATIC) && (declaration.isStatic()) ) {
- return false;
- }
- if (element instanceof IMember) {
- IMember member= (IMember)element;
- if (hasFilter(FILTER_NONPUBLIC) && (member.getVisibility() != ASTAccessVisibility.PUBLIC)) {
+ try {
+ IDeclaration declaration = (IDeclaration) element;
+ if (hasFilter(FILTER_STATIC) && (declaration.isStatic()) ) {
return false;
}
-
- if (hasFilter(FILTER_FIELDS) && element instanceof IField) {
- return false;
- }
+ if (element instanceof IMember) {
+ IMember member= (IMember)element;
+ if (hasFilter(FILTER_NONPUBLIC) && (member.getVisibility() != ASTAccessVisibility.PUBLIC)) {
+ return false;
+ }
+
+ if (hasFilter(FILTER_FIELDS) && element instanceof IField) {
+ return false;
+ }
+ }
+ } catch (CModelException e) {
+ // ignore
}
}
return true;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementContentProvider.java
index 89e910fd20c..d1dbb27d290 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementContentProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementContentProvider.java
@@ -206,7 +206,7 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
}
}
- private boolean updateContainer(ICElement cfile) {
+ private boolean updateContainer(ICElement cfile) throws CModelException {
IParent container = null;
ICProject cproject = null;
if (cfile instanceof IBinary) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementLabelProvider.java
index db08e6f0942..cd2820e463a 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementLabelProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementLabelProvider.java
@@ -5,6 +5,7 @@ package org.eclipse.cdt.ui;
* All Rights Reserved.
*/
+import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IFunctionDeclaration;
@@ -117,77 +118,81 @@ public class CElementLabelProvider extends LabelProvider {
*/
public String getText(Object element) {
if (element instanceof ICElement) {
- ICElement celem= (ICElement)element;
-
- StringBuffer name = new StringBuffer();
- switch(celem.getElementType()){
- case ICElement.C_FIELD:
- case ICElement.C_VARIABLE:
- case ICElement.C_VARIABLE_DECLARATION:
- IVariableDeclaration vDecl = (IVariableDeclaration) celem;
+ try {
+ ICElement celem= (ICElement)element;
+
+ StringBuffer name = new StringBuffer();
+ switch(celem.getElementType()){
+ case ICElement.C_FIELD:
+ case ICElement.C_VARIABLE:
+ case ICElement.C_VARIABLE_DECLARATION:
+ IVariableDeclaration vDecl = (IVariableDeclaration) celem;
name.append(vDecl.getElementName());
if((vDecl.getTypeName() != null) &&(vDecl.getTypeName().length() > 0)){
name.append(" : "); //$NON-NLS-1$
name.append(vDecl.getTypeName());
}
- break;
- case ICElement.C_FUNCTION:
- case ICElement.C_FUNCTION_DECLARATION:
- case ICElement.C_METHOD:
- case ICElement.C_METHOD_DECLARATION:
- IFunctionDeclaration fDecl = (IFunctionDeclaration) celem;
+ break;
+ case ICElement.C_FUNCTION:
+ case ICElement.C_FUNCTION_DECLARATION:
+ case ICElement.C_METHOD:
+ case ICElement.C_METHOD_DECLARATION:
+ IFunctionDeclaration fDecl = (IFunctionDeclaration) celem;
name.append(fDecl.getSignature());
if((fDecl.getReturnType() != null) &&(fDecl.getReturnType().length() > 0)){
name.append(" : "); //$NON-NLS-1$
name.append(fDecl.getReturnType());
}
- break;
- case ICElement.C_STRUCT:
- case ICElement.C_UNION:
- case ICElement.C_ENUMERATION:
- if((celem.getElementName() != null) && (celem.getElementName().length() > 0)){
- name.append(celem.getElementName());
- } else if (celem instanceof IVariableDeclaration) {
- IVariableDeclaration varDecl = (IVariableDeclaration) celem;
- name.append(varDecl.getTypeName());
- }
- break;
- case ICElement.C_TYPEDEF:
- ITypeDef tDecl = (ITypeDef) celem;
+ break;
+ case ICElement.C_STRUCT:
+ case ICElement.C_UNION:
+ case ICElement.C_ENUMERATION:
+ if((celem.getElementName() != null) && (celem.getElementName().length() > 0)){
+ name.append(celem.getElementName());
+ } else if (celem instanceof IVariableDeclaration) {
+ IVariableDeclaration varDecl = (IVariableDeclaration) celem;
+ name.append(varDecl.getTypeName());
+ }
+ break;
+ case ICElement.C_TYPEDEF:
+ ITypeDef tDecl = (ITypeDef) celem;
name.append(tDecl.getElementName());
if((tDecl.getTypeName() != null) &&(tDecl.getTypeName().length() > 0)){
name.append(" : "); //$NON-NLS-1$
name.append(tDecl.getTypeName());
}
- break;
- case ICElement.C_NAMESPACE:
- if((celem.getElementName() != null) && (celem.getElementName().length() > 0)){
- name.append(celem.getElementName());
- } else if (celem instanceof INamespace) {
- INamespace nDecl = (INamespace) celem;
- name.append(nDecl.getTypeName());
- }
- break;
- case ICElement.C_TEMPLATE_CLASS:
- case ICElement.C_TEMPLATE_FUNCTION:
- case ICElement.C_TEMPLATE_METHOD:
- case ICElement.C_TEMPLATE_STRUCT:
- case ICElement.C_TEMPLATE_UNION:
- case ICElement.C_TEMPLATE_VARIABLE:
- ITemplate template = (ITemplate) celem;
+ break;
+ case ICElement.C_NAMESPACE:
+ if((celem.getElementName() != null) && (celem.getElementName().length() > 0)){
+ name.append(celem.getElementName());
+ } else if (celem instanceof INamespace) {
+ INamespace nDecl = (INamespace) celem;
+ name.append(nDecl.getTypeName());
+ }
+ break;
+ case ICElement.C_TEMPLATE_CLASS:
+ case ICElement.C_TEMPLATE_FUNCTION:
+ case ICElement.C_TEMPLATE_METHOD:
+ case ICElement.C_TEMPLATE_STRUCT:
+ case ICElement.C_TEMPLATE_UNION:
+ case ICElement.C_TEMPLATE_VARIABLE:
+ ITemplate template = (ITemplate) celem;
String signature = template.getTemplateSignature();
name.append(signature);
- break;
- default:
- name.append(celem.getElementName());
- break;
+ break;
+ default:
+ name.append(celem.getElementName());
+ break;
+ }
+
+ if (celem instanceof IBinary) {
+ IBinary bin = (IBinary)celem;
+ name.append(" - [" + bin.getCPU() + (bin.isLittleEndian() ? "le" : "be") + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+ return name.toString();
+ } catch (CModelException e) {
+ CUIPlugin.getDefault().log(e);
}
-
- if (celem instanceof IBinary) {
- IBinary bin = (IBinary)celem;
- name.append(" - [" + bin.getCPU() + (bin.isLittleEndian() ? "le" : "be") + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- return name.toString();
}
return fWorkbenchLabelProvider.getText(element);
}