[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] C Model Update - show the static elements in outline view
|
This patch updates the C Model to show the static icon decorator for static
elements.
Thanks
Hoda
Index: model/org/eclipse/cdt/core/model/ICFile.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICFile.java,v
retrieving revision 1.3
diff -u -r1.3 ICFile.java
--- model/org/eclipse/cdt/core/model/ICFile.java 23 Jan 2003 19:27:01 -0000 1.3
+++ model/org/eclipse/cdt/core/model/ICFile.java 26 Mar 2003 21:59:19 -0000
@@ -10,7 +10,7 @@
/**
* A C File Resource.
*/
-public interface ICFile extends IParent, ICResource {
+public interface ICFile extends ICResource {
public boolean isBinary();
Index: model/org/eclipse/cdt/core/model/ICFolder.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICFolder.java,v
retrieving revision 1.3
diff -u -r1.3 ICFolder.java
--- model/org/eclipse/cdt/core/model/ICFolder.java 23 Jan 2003 19:27:07 -0000 1.3
+++ model/org/eclipse/cdt/core/model/ICFolder.java 26 Mar 2003 21:59:19 -0000
@@ -10,7 +10,7 @@
/**
* A C Folder Resource.
*/
-public interface ICFolder extends IParent, ICResource {
+public interface ICFolder extends ICResource {
public IFolder getFolder();
}
Index: model/org/eclipse/cdt/core/model/ICProject.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICProject.java,v
retrieving revision 1.3
diff -u -r1.3 ICProject.java
--- model/org/eclipse/cdt/core/model/ICProject.java 23 Jan 2003 19:27:12 -0000 1.3
+++ model/org/eclipse/cdt/core/model/ICProject.java 26 Mar 2003 21:59:19 -0000
@@ -17,7 +17,7 @@
* @see CCore#create(org.eclipse.core.resources.IProject)
* @see IBuildEntry
*/
-public interface ICProject extends IParent, ICResource {
+public interface ICProject extends ICResource {
/**
* Returns the <code>ICElement</code> corresponding to the given
Index: model/org/eclipse/cdt/core/model/ICRoot.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICRoot.java,v
retrieving revision 1.3
diff -u -r1.3 ICRoot.java
--- model/org/eclipse/cdt/core/model/ICRoot.java 23 Jan 2003 19:27:17 -0000 1.3
+++ model/org/eclipse/cdt/core/model/ICRoot.java 26 Mar 2003 21:59:19 -0000
@@ -22,7 +22,7 @@
*
* @see CCore#create(org.eclipse.core.resources.IWorkspaceRoot)
*/
-public interface ICRoot extends IParent, ICResource {
+public interface ICRoot extends ICResource {
/**
* Copies the given elements to the specified container(s).
* If one container is specified, all elements are copied to that
Index: model/org/eclipse/cdt/core/model/IDeclaration.java
===================================================================
RCS file: model/org/eclipse/cdt/core/model/IDeclaration.java
diff -N model/org/eclipse/cdt/core/model/IDeclaration.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ model/org/eclipse/cdt/core/model/IDeclaration.java 26 Mar 2003 21:59:19 -0000
@@ -0,0 +1,28 @@
+package org.eclipse.cdt.core.model;
+
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * Rational Software - Initial API and implementation
+***********************************************************************/
+
+public interface IDeclaration extends ICElement, ISourceManipulation, ISourceReference {
+ boolean isStatic();
+ boolean isConst();
+ boolean isVolatile();
+
+ /**
+ * Returns the access Control of the member. The access qualifier
+ * can be examine using the AccessControl class.
+ *
+ * @exception CModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @see IAccessControl
+ */
+ int getAccessControl();
+}
Index: model/org/eclipse/cdt/core/model/IFunctionDeclaration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IFunctionDeclaration.java,v
retrieving revision 1.2
diff -u -r1.2 IFunctionDeclaration.java
--- model/org/eclipse/cdt/core/model/IFunctionDeclaration.java 26 Mar 2003 16:03:03 -0000 1.2
+++ model/org/eclipse/cdt/core/model/IFunctionDeclaration.java 26 Mar 2003 21:59:19 -0000
@@ -8,7 +8,7 @@
/**
* Represents a function
*/
-public interface IFunctionDeclaration extends ICElement, ISourceReference, ISourceManipulation {
+public interface IFunctionDeclaration extends IDeclaration {
/**
* Returns the type signatures of the exceptions this method throws,
@@ -63,14 +63,4 @@
* Returns the signature of the method.
*/
String getSignature();
-
- /**
- * Returns the access Control of the member. The access qualifier
- * can be examine using the AccessControl class.
- *
- * @exception CModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @see IAccessControl
- */
- int getAccessControl();
}
Index: model/org/eclipse/cdt/core/model/IMember.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMember.java,v
retrieving revision 1.2
diff -u -r1.2 IMember.java
--- model/org/eclipse/cdt/core/model/IMember.java 26 Mar 2003 16:03:03 -0000 1.2
+++ model/org/eclipse/cdt/core/model/IMember.java 26 Mar 2003 21:59:19 -0000
@@ -10,46 +10,12 @@
* This set consists of <code>IType</code>, <code>IMethod</code>,
* <code>IField</code>.
*/
-public interface IMember extends ICElement, ISourceReference, ISourceManipulation {
+public interface IMember extends IDeclaration {
static final int V_PUBLIC = 0;
static final int V_PROTECTED = 1;
static final int V_PRIVATE = 2;
-
- /**
- * Returns true if the member has class scope. For example static methods in
- * C++ have class scope
- *
- *
- * @exception CModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- */
- public boolean hasClassScope();
-
- /**
- * Returns whether this method/field is declared constant.
- *
- * @exception CModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- */
- public boolean isConst();
-
- /**
- * Returns if this member is volatile or not
- * @return boolean
- */
- public boolean isVolatile();
-
- /**
- * Returns the access Control of the member. The access qualifier
- * can be examine using the AccessControl class.
- *
- * @exception CModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @see IAccessControl
- */
- public int getAccessControl();
/**
* Returns the member's visibility
* V_PRIVATE = 0 V_PROTECTED = 1 V_PUBLIC = 2
Index: model/org/eclipse/cdt/core/model/IStructure.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java,v
retrieving revision 1.2
diff -u -r1.2 IStructure.java
--- model/org/eclipse/cdt/core/model/IStructure.java 23 Jan 2003 16:39:21 -0000 1.2
+++ model/org/eclipse/cdt/core/model/IStructure.java 26 Mar 2003 21:59:18 -0000
@@ -8,7 +8,7 @@
/**
* Represent struct(ure), class or union.
*/
-public interface IStructure extends IInheritance, IParent, ICElement, IVariableDeclaration {
+public interface IStructure extends IInheritance, IParent, IDeclaration {
//public String instantiatesTemplate();
public IField getField(String name);
Index: model/org/eclipse/cdt/core/model/IVariable.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IVariable.java,v
retrieving revision 1.2
diff -u -r1.2 IVariable.java
--- model/org/eclipse/cdt/core/model/IVariable.java 26 Mar 2003 16:03:03 -0000 1.2
+++ model/org/eclipse/cdt/core/model/IVariable.java 26 Mar 2003 21:59:18 -0000
@@ -8,9 +8,6 @@
/**
* Represents a global variable.
*/
-public interface IVariable extends ICElement , ISourceManipulation, ISourceReference {
- public String getTypeName();
- public void setTypeName(String type);
+public interface IVariable extends IVariableDeclaration {
public String getInitializer();
- public int getAccessControl() throws CModelException;
}
Index: model/org/eclipse/cdt/core/model/IVariableDeclaration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IVariableDeclaration.java,v
retrieving revision 1.3
diff -u -r1.3 IVariableDeclaration.java
--- model/org/eclipse/cdt/core/model/IVariableDeclaration.java 26 Mar 2003 16:03:03 -0000 1.3
+++ model/org/eclipse/cdt/core/model/IVariableDeclaration.java 26 Mar 2003 21:59:18 -0000
@@ -8,9 +8,7 @@
/**
* Represents the declaration of a variable.
*/
-public interface IVariableDeclaration extends ICElement, ISourceManipulation, ISourceReference {
-
+public interface IVariableDeclaration extends IDeclaration {
public String getTypeName();
public void setTypeName(String type);
- public int getAccessControl();
}
Index: model/org/eclipse/cdt/internal/core/model/Field.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Field.java,v
retrieving revision 1.3
diff -u -r1.3 Field.java
--- model/org/eclipse/cdt/internal/core/model/Field.java 26 Mar 2003 16:03:03 -0000 1.3
+++ model/org/eclipse/cdt/internal/core/model/Field.java 26 Mar 2003 21:59:20 -0000
@@ -22,8 +22,8 @@
return getFieldInfo().isMutable();
}
- public void setIsMutable(boolean mutable){
- getFieldInfo().setIsMutable(mutable);
+ public void setMutable(boolean mutable){
+ getFieldInfo().setMutable(mutable);
}
public String getTypeName() {
@@ -38,16 +38,24 @@
return getFieldInfo().isConst();
}
- public void setIsConst(boolean isConst) {
- getFieldInfo().setIsConst(isConst);
+ public void setConst(boolean isConst) {
+ getFieldInfo().setConst(isConst);
}
public boolean isVolatile() {
return getFieldInfo().isVolatile();
}
- public void setIsVolatile(boolean isVolatile) {
- getFieldInfo().setIsVolatile(isVolatile);
+ public void setVolatile(boolean isVolatile) {
+ getFieldInfo().setVolatile(isVolatile);
+ }
+
+ public boolean isStatic() {
+ return getFieldInfo().isStatic();
+ }
+
+ public void setStatic(boolean isStatic) {
+ getFieldInfo().setStatic(isStatic);
}
public int getVisibility() {
@@ -57,6 +65,7 @@
public void setVisibility(int visibility) {
getFieldInfo().setVisibility(visibility);
}
+
public FieldInfo getFieldInfo(){
return (FieldInfo) getElementInfo();
Index: model/org/eclipse/cdt/internal/core/model/FieldInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FieldInfo.java,v
retrieving revision 1.1
diff -u -r1.1 FieldInfo.java
--- model/org/eclipse/cdt/internal/core/model/FieldInfo.java 26 Mar 2003 16:03:03 -0000 1.1
+++ model/org/eclipse/cdt/internal/core/model/FieldInfo.java 26 Mar 2003 21:59:19 -0000
@@ -20,6 +20,7 @@
boolean isConst = false;
boolean isVolatile = false;
boolean isMutable = false;
+ boolean isStatic = false;
int visibility;
protected FieldInfo (CElement element) {
@@ -48,6 +49,7 @@
&& (isVolatile == otherInfo.isVolatile())
&& (isMutable == otherInfo.isMutable())
&& (visibility == otherInfo.getVisibility())
+ && (isStatic == otherInfo.isStatic())
)
return true;
else
@@ -66,7 +68,7 @@
return isConst;
}
- protected void setIsConst(boolean isConst){
+ protected void setConst(boolean isConst){
this.isConst = isConst;
}
@@ -74,15 +76,23 @@
return isVolatile;
}
- protected void setIsVolatile(boolean isVolatile){
+ protected void setVolatile(boolean isVolatile){
this.isVolatile = isVolatile;
}
+ public boolean isStatic() {
+ return isStatic;
+ }
+
+ public void setStatic(boolean isStatic) {
+ this.isStatic = isStatic;
+ }
+
protected boolean isMutable(){
return isMutable;
}
- protected void setIsMutable(boolean mutable){
+ protected void setMutable(boolean mutable){
this.isMutable = mutable;
}
/**
@@ -100,5 +110,4 @@
public void setVisibility(int visibility) {
this.visibility = visibility;
}
-
}
Index: model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java,v
retrieving revision 1.3
diff -u -r1.3 FunctionDeclaration.java
--- model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java 26 Mar 2003 16:10:35 -0000 1.3
+++ model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java 26 Mar 2003 21:59:19 -0000
@@ -51,9 +51,7 @@
}
public String getSignature(){
- String sig = getReturnType();
- sig += " ";
- sig += getElementName();
+ String sig = getElementName();
if(getNumberOfParameters() > 0){
sig += "(";
String[] paramTypes = getParameterTypes();
@@ -79,6 +77,7 @@
return getFunctionInfo().getAccessControl();
}
+
public String[] getExceptions(){
return new String[] {};
}
@@ -98,4 +97,44 @@
);
}
+ /**
+ * FunctionDeclarations and Functions can not be constant
+ * @see org.eclipse.cdt.core.model.IDeclaration#isConst()
+ */
+ public boolean isConst(){
+ return false;
+ }
+
+ /**
+ * Returns the isStatic.
+ * @return boolean
+ */
+ public boolean isStatic() {
+ return getFunctionInfo().isStatic();
+ }
+
+ /**
+ * Returns the isVolatile.
+ * @return boolean
+ */
+ public boolean isVolatile() {
+ return getFunctionInfo().isVolatile();
+ }
+
+ /**
+ * Sets the isStatic.
+ * @param isStatic The isStatic to set
+ */
+ public void setStatic(boolean isStatic) {
+ getFunctionInfo().setStatic(isStatic);
+ }
+
+ /**
+ * Sets the isVolatile.
+ * @param isVolatile The isVolatile to set
+ */
+ public void setVolatile(boolean isVolatile) {
+ getFunctionInfo().setVolatile(isVolatile);
+ }
+
}
Index: model/org/eclipse/cdt/internal/core/model/FunctionInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionInfo.java,v
retrieving revision 1.2
diff -u -r1.2 FunctionInfo.java
--- model/org/eclipse/cdt/internal/core/model/FunctionInfo.java 26 Mar 2003 16:03:03 -0000 1.2
+++ model/org/eclipse/cdt/internal/core/model/FunctionInfo.java 26 Mar 2003 21:59:19 -0000
@@ -10,6 +10,9 @@
protected int flags;
protected String returnType;
protected int numOfParams;
+ protected boolean isStatic;
+ protected boolean isVolatile;
+
protected FunctionInfo (CElement element) {
super(element);
@@ -31,4 +34,36 @@
protected void setReturnType(String type){
returnType = type;
}
+ /**
+ * Returns the isStatic.
+ * @return boolean
+ */
+ public boolean isStatic() {
+ return isStatic;
+ }
+
+ /**
+ * Returns the isVolatile.
+ * @return boolean
+ */
+ public boolean isVolatile() {
+ return isVolatile;
+ }
+
+ /**
+ * Sets the isStatic.
+ * @param isStatic The isStatic to set
+ */
+ public void setStatic(boolean isStatic) {
+ this.isStatic = isStatic;
+ }
+
+ /**
+ * Sets the isVolatile.
+ * @param isVolatile The isVolatile to set
+ */
+ public void setVolatile(boolean isVolatile) {
+ this.isVolatile = isVolatile;
+ }
+
}
Index: model/org/eclipse/cdt/internal/core/model/IWorkingCopy.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/IWorkingCopy.java,v
retrieving revision 1.1
diff -u -r1.1 IWorkingCopy.java
--- model/org/eclipse/cdt/internal/core/model/IWorkingCopy.java 19 Mar 2003 20:19:36 -0000 1.1
+++ model/org/eclipse/cdt/internal/core/model/IWorkingCopy.java 26 Mar 2003 21:59:20 -0000
@@ -13,7 +13,6 @@
import org.eclipse.cdt.core.model.CModelException;
-import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
Index: model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java,v
retrieving revision 1.1
diff -u -r1.1 MethodDeclaration.java
--- model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java 26 Mar 2003 16:03:03 -0000 1.1
+++ model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java 26 Mar 2003 21:59:19 -0000
@@ -16,6 +16,8 @@
public class MethodDeclaration extends FunctionDeclaration implements IMethodDeclaration{
+ boolean isConst;
+ boolean isVolatile;
public MethodDeclaration(ICElement parent, String name){
super(parent, name, CElement.C_METHOD_DECLARATION);
@@ -52,55 +54,49 @@
}
public void setIsAbstract(boolean isAbstract){
- getMethodInfo().setIsAbstract(isAbstract);
- }
-
- public boolean isStatic(){
- return getMethodInfo().isStatic();
- }
-
- public void setIsStatic(boolean isStatic){
- getMethodInfo().setIsStatic(isStatic);
+ getMethodInfo().setAbstract(isAbstract);
}
public boolean isInline(){
return getMethodInfo().isInline();
}
- public void setIsInline(boolean isInline){
- getMethodInfo().setIsInline(isInline);
+ public void setInline(boolean isInline){
+ getMethodInfo().setInline(isInline);
}
public boolean isVirtual(){
return getMethodInfo().isVirtual();
}
- public void setIsVirtual(boolean isVirtual){
- getMethodInfo().setIsVirtual(isVirtual);
+ public void setVirtual(boolean isVirtual){
+ getMethodInfo().setVirtual(isVirtual);
}
public boolean isFriend(){
return getMethodInfo().isFriend();
}
- public void setIsFriend(boolean isFriend){
- getMethodInfo().setIsFriend(isFriend);
+ public void setFriend(boolean isFriend){
+ getMethodInfo().setFriend(isFriend);
}
public boolean isConst(){
- return getMethodInfo().isConst();
+ return isConst;
}
- public void setIsConst(boolean isConst){
- getMethodInfo().setIsConst(isConst);
+ public void setConst(boolean isConst){
+ this.isConst = isConst;
+ getMethodInfo().setConst(isConst);
}
public boolean isVolatile(){
- return getMethodInfo().isVolatile();
+ return isVolatile;
}
- public void setIsVolatile(boolean isVolatile){
- getMethodInfo().setIsVolatile(isVolatile);
+ public void setVolatile(boolean isVolatile){
+ this.isVolatile = isVolatile;
+ getMethodInfo().setVolatile(isVolatile);
}
public int getVisibility(){
@@ -110,11 +106,6 @@
public void setVisibility(int visibility){
getMethodInfo().setVisibility(visibility);
}
- // do we need this one or not?
- // can we get this info from the parser or not?
- public boolean hasClassScope(){
- return false;
- }
protected CElementInfo createElementInfo () {
return new MethodInfo(this);
@@ -128,7 +119,10 @@
* See if we need anything else to put in equals here
*/
public boolean equals(Object other) {
- return ( super.equals(other) );
+ return ( super.equals(other)
+ && isConst() == ((MethodDeclaration)other).isConst()
+ && isVolatile() == ((MethodDeclaration)other).isVolatile()
+ );
}
}
Index: model/org/eclipse/cdt/internal/core/model/MethodInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodInfo.java,v
retrieving revision 1.1
diff -u -r1.1 MethodInfo.java
--- model/org/eclipse/cdt/internal/core/model/MethodInfo.java 26 Mar 2003 16:03:03 -0000 1.1
+++ model/org/eclipse/cdt/internal/core/model/MethodInfo.java 26 Mar 2003 21:59:20 -0000
@@ -16,12 +16,10 @@
public class MethodInfo extends FunctionInfo {
boolean isAbstract = false;
- boolean isStatic = false;
boolean isInline = false;
boolean isVirtual = false;
boolean isFriend = false;
boolean isConst = false;
- boolean isVolatile = false;
int visibility;
MethodInfo(CElement element) {
@@ -33,23 +31,15 @@
return isAbstract;
}
- public void setIsAbstract(boolean isAbstract){
+ public void setAbstract(boolean isAbstract){
this.isAbstract = isAbstract;
}
- public boolean isStatic(){
- return isStatic;
- }
-
- public void setIsStatic(boolean isStatic){
- this.isStatic = isStatic;
- }
-
public boolean isInline(){
return isInline;
}
- public void setIsInline(boolean isInline){
+ public void setInline(boolean isInline){
this.isInline = isInline;
}
@@ -57,7 +47,7 @@
return isVirtual;
}
- public void setIsVirtual(boolean isVirtual){
+ public void setVirtual(boolean isVirtual){
this.isVirtual = isVirtual;
}
@@ -65,7 +55,7 @@
return isFriend;
}
- public void setIsFriend(boolean isFriend){
+ public void setFriend(boolean isFriend){
this.isFriend = isFriend;
}
@@ -73,18 +63,9 @@
return isConst;
}
- public void setIsConst(boolean isConst){
+ public void setConst(boolean isConst){
this.isConst = isConst;
}
-
- public boolean isVolatile(){
- return isVolatile;
- }
-
- public void setIsVolatile(boolean isVolatile){
- this.isVolatile = isVolatile;
- }
-
/**
* Returns the visibility.
Index: model/org/eclipse/cdt/internal/core/model/Structure.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Structure.java,v
retrieving revision 1.3
diff -u -r1.3 Structure.java
--- model/org/eclipse/cdt/internal/core/model/Structure.java 26 Mar 2003 16:03:03 -0000 1.3
+++ model/org/eclipse/cdt/internal/core/model/Structure.java 26 Mar 2003 21:59:20 -0000
@@ -52,6 +52,9 @@
return false;
}
+ /**
+ * @see org.eclipse.cdt.core.model.IDeclaration#getAccessControl()
+ */
public int getAccessControl(){
return 0;
}
@@ -75,6 +78,30 @@
getStructureInfo().setTypeString(type);
}
+ public boolean isConst() {
+ return getStructureInfo().isConst();
+ }
+
+ public void setConst(boolean isConst) {
+ getStructureInfo().setConst(isConst);
+ }
+
+ public boolean isVolatile() {
+ return getStructureInfo().isVolatile();
+ }
+
+ public void setVolatile(boolean isVolatile) {
+ getStructureInfo().setVolatile(isVolatile);
+ }
+
+ public boolean isStatic() {
+ return getStructureInfo().isStatic();
+ }
+
+ public void setStatic(boolean isStatic) {
+ getStructureInfo().setStatic(isStatic);
+ }
+
public StructureInfo getStructureInfo(){
return (StructureInfo) getElementInfo();
}
@@ -92,6 +119,7 @@
baseTypes = newBase;
}
+
protected CElementInfo createElementInfo () {
return new StructureInfo(this);
}
@@ -101,14 +129,6 @@
* @IInheritance
*/
public int getAccessControl(int pos) throws CModelException {
- return 0;
- }
-
-
- /**
- * @see org.eclipse.cdt.core.model.IVariableDeclaration#getAccesControl()
- */
- public int getAccesControl() {
return 0;
}
Index: model/org/eclipse/cdt/internal/core/model/StructureInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/StructureInfo.java,v
retrieving revision 1.1
diff -u -r1.1 StructureInfo.java
--- model/org/eclipse/cdt/internal/core/model/StructureInfo.java 26 Mar 2003 16:03:03 -0000 1.1
+++ model/org/eclipse/cdt/internal/core/model/StructureInfo.java 26 Mar 2003 21:59:19 -0000
@@ -15,7 +15,10 @@
public class StructureInfo extends SourceManipulationInfo {
String type;
-
+ boolean isConst = false;
+ boolean isVolatile = false;
+ boolean isStatic = false;
+
protected StructureInfo (CElement element) {
super(element);
@@ -48,6 +51,54 @@
}
public boolean hasSameContentsAs( StructureInfo otherInfo){
return true;
+ }
+
+ /**
+ * Returns the isConst.
+ * @return boolean
+ */
+ public boolean isConst() {
+ return isConst;
+ }
+
+ /**
+ * Returns the isStatic.
+ * @return boolean
+ */
+ public boolean isStatic() {
+ return isStatic;
+ }
+
+ /**
+ * Returns the isVolatile.
+ * @return boolean
+ */
+ public boolean isVolatile() {
+ return isVolatile;
+ }
+
+ /**
+ * Sets the isConst.
+ * @param isConst The isConst to set
+ */
+ public void setConst(boolean isConst) {
+ this.isConst = isConst;
+ }
+
+ /**
+ * Sets the isStatic.
+ * @param isStatic The isStatic to set
+ */
+ public void setStatic(boolean isStatic) {
+ this.isStatic = isStatic;
+ }
+
+ /**
+ * Sets the isVolatile.
+ * @param isVolatile The isVolatile to set
+ */
+ public void setVolatile(boolean isVolatile) {
+ this.isVolatile = isVolatile;
}
}
Index: model/org/eclipse/cdt/internal/core/model/Variable.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Variable.java,v
retrieving revision 1.2
diff -u -r1.2 Variable.java
--- model/org/eclipse/cdt/internal/core/model/Variable.java 26 Mar 2003 16:03:03 -0000 1.2
+++ model/org/eclipse/cdt/internal/core/model/Variable.java 26 Mar 2003 21:59:20 -0000
@@ -21,6 +21,31 @@
public void setTypeName(String type){
getVariableInfo().setTypeName(type);
}
+
+ public boolean isConst() {
+ return getVariableInfo().isConst();
+ }
+
+ public void setConst(boolean isConst) {
+ getVariableInfo().setConst(isConst);
+ }
+
+ public boolean isVolatile() {
+ return getVariableInfo().isVolatile();
+ }
+
+ public void setVolatile(boolean isVolatile) {
+ getVariableInfo().setVolatile(isVolatile);
+ }
+
+ public boolean isStatic() {
+ return getVariableInfo().isStatic();
+ }
+
+ public void setStatic(boolean isStatic) {
+ getVariableInfo().setStatic(isStatic);
+ }
+
public String getInitializer() {
return "";
}
Index: model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java,v
retrieving revision 1.3
diff -u -r1.3 VariableDeclaration.java
--- model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java 26 Mar 2003 16:03:03 -0000 1.3
+++ model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java 26 Mar 2003 21:59:20 -0000
@@ -26,11 +26,35 @@
getVariableInfo().setTypeString(type);
}
+ public boolean isConst() {
+ return getVariableInfo().isConst();
+ }
+
+ public void setConst(boolean isConst) {
+ getVariableInfo().setConst(isConst);
+ }
+
+ public boolean isVolatile() {
+ return getVariableInfo().isVolatile();
+ }
+
+ public void setVolatile(boolean isVolatile) {
+ getVariableInfo().setVolatile(isVolatile);
+ }
+
+ public boolean isStatic() {
+ return getVariableInfo().isStatic();
+ }
+
+ public void setStatic(boolean isStatic) {
+ getVariableInfo().setStatic(isStatic);
+ }
+
public VariableInfo getVariableInfo(){
return (VariableInfo) getElementInfo();
}
protected CElementInfo createElementInfo () {
- return new SourceManipulationInfo(this);
+ return new VariableInfo(this);
}
}
Index: model/org/eclipse/cdt/internal/core/model/VariableInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableInfo.java,v
retrieving revision 1.2
diff -u -r1.2 VariableInfo.java
--- model/org/eclipse/cdt/internal/core/model/VariableInfo.java 26 Mar 2003 16:03:03 -0000 1.2
+++ model/org/eclipse/cdt/internal/core/model/VariableInfo.java 26 Mar 2003 21:59:20 -0000
@@ -9,6 +9,9 @@
protected int flags;
String typeStr;
+ boolean isConst = false;
+ boolean isVolatile = false;
+ boolean isStatic = false;
protected VariableInfo (CElement element) {
super(element);
@@ -41,4 +44,28 @@
protected void setTypeString(String type){
typeStr = type;
}
+ protected boolean isConst(){
+ return isConst;
+ }
+
+ protected void setConst(boolean isConst){
+ this.isConst = isConst;
+ }
+
+ protected boolean isVolatile(){
+ return isVolatile;
+ }
+
+ protected void setVolatile(boolean isVolatile){
+ this.isVolatile = isVolatile;
+ }
+
+ public boolean isStatic() {
+ return isStatic;
+ }
+
+ public void setStatic(boolean isStatic) {
+ this.isStatic = isStatic;
+ }
+
}
Index: parser/org/eclipse/cdt/internal/core/model/SimpleDeclarationWrapper.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/model/SimpleDeclarationWrapper.java,v
retrieving revision 1.11
diff -u -r1.11 SimpleDeclarationWrapper.java
--- parser/org/eclipse/cdt/internal/core/model/SimpleDeclarationWrapper.java 26 Mar 2003 16:27:44 -0000 1.11
+++ parser/org/eclipse/cdt/internal/core/model/SimpleDeclarationWrapper.java 26 Mar 2003 21:59:21 -0000
@@ -257,9 +257,11 @@
private CElement createField(CElement parent, String name){
Field newElement = new Field( parent, name );
newElement.setTypeName ( getTypeName() );
- newElement.setIsConst(isConst());
- newElement.setIsMutable(isMutable());
+ newElement.setMutable(isMutable());
newElement.setVisibility(this.getCurrentVisibility());
+ newElement.setConst(isConst());
+ newElement.setVolatile(isVolatile());
+ newElement.setStatic(isStatic());
return newElement;
}
@@ -272,6 +274,9 @@
private CElement createVariable(CElement parent, String name){
Variable newElement = new Variable( parent, name );
newElement.setTypeName ( getTypeName() );
+ newElement.setConst(isConst());
+ newElement.setVolatile(isVolatile());
+ newElement.setStatic(isStatic());
return newElement;
}
@@ -284,6 +289,9 @@
private CElement createVariableDeclaration(CElement parent, String name){
VariableDeclaration newElement = new VariableDeclaration( parent, name );
newElement.setTypeName ( getTypeName() );
+ newElement.setConst(isConst());
+ newElement.setVolatile(isVolatile());
+ newElement.setStatic(isStatic());
return newElement;
}
@@ -307,6 +315,8 @@
newElement.setParameterTypes(parameterTypes);
newElement.setReturnType( getTypeName() );
newElement.setVisibility(this.getCurrentVisibility());
+ newElement.setVolatile(isVolatile());
+ newElement.setStatic(isStatic());
return newElement;
}
@@ -329,6 +339,8 @@
newElement.setParameterTypes(parameterTypes);
newElement.setReturnType( getTypeName() );
newElement.setVisibility(this.getCurrentVisibility());
+ newElement.setVolatile(isVolatile());
+ newElement.setStatic(isStatic());
return newElement;
}
@@ -340,8 +352,18 @@
* @return CElement
*/
private CElement createFunctionDeclaration(CElement parent, String name, Parameter[] parameters){
+ String[] parameterTypes = new String[parameters.length];
+ for( int j = 0; j< parameters.length; ++j )
+ {
+ Parameter param = parameters[j];
+ parameterTypes[j] = new String(param.getTypeName());
+ }
+
FunctionDeclaration newElement = new FunctionDeclaration( parent, name );
+ newElement.setParameterTypes(parameterTypes);
newElement.setReturnType( getTypeName() );
+ newElement.setVolatile(isVolatile());
+ newElement.setStatic(isStatic());
return newElement;
}
@@ -353,8 +375,18 @@
* @return CElement
*/
private CElement createFunction(CElement parent, String name, Parameter[] parameters){
+ String[] parameterTypes = new String[parameters.length];
+ for( int j = 0; j< parameters.length; ++j )
+ {
+ Parameter param = parameters[j];
+ parameterTypes[j] = new String(param.getTypeName());
+ }
+
Function newElement = new Function( parent, name );
+ newElement.setParameterTypes(parameterTypes);
newElement.setReturnType( getTypeName() );
+ newElement.setVolatile(isVolatile());
+ newElement.setStatic(isStatic());
return newElement;
}
Index: src/org/eclipse/cdt/internal/ui/CElementImageProvider.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CElementImageProvider.java,v
retrieving revision 1.5
diff -u -r1.5 CElementImageProvider.java
--- src/org/eclipse/cdt/internal/ui/CElementImageProvider.java 26 Mar 2003 16:02:58 -0000 1.5
+++ src/org/eclipse/cdt/internal/ui/CElementImageProvider.java 26 Mar 2003 21:59:46 -0000
@@ -15,6 +15,7 @@
import org.eclipse.cdt.core.model.ICFile;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IMember;
+import org.eclipse.cdt.core.model.IDeclaration;
import org.eclipse.cdt.core.model.IMethodDeclaration;
import org.eclipse.cdt.internal.ui.util.ImageDescriptorRegistry;
import org.eclipse.cdt.ui.*;
@@ -285,28 +286,18 @@
int flags= computeBasicAdornmentFlags(element, renderFlags);
- /* if (showOverlayIcons(renderFlags) && element instanceof ISourceReference) {
- ISourceReference sourceReference= (ISourceReference)element;
- int modifiers= getModifiers(sourceReference);
-
- if (Flags.isAbstract(modifiers) && confirmAbstract((IMember) sourceReference))
- flags |= JavaElementImageDescriptor.ABSTRACT;
- if (Flags.isFinal(modifiers))
- flags |= JavaElementImageDescriptor.FINAL;
- if (Flags.isSynchronized(modifiers) && confirmSynchronized((IMember) sourceReference))
- flags |= JavaElementImageDescriptor.SYNCHRONIZED;
- if (Flags.isStatic(modifiers))
- flags |= JavaElementImageDescriptor.STATIC;
-
- if (sourceReference instanceof IType) {
- try {
- if (JavaModelUtil.hasMainMethod((IType)sourceReference))
- flags |= JavaElementImageDescriptor.RUNNABLE;
- } catch (JavaModelException e) {
- // do nothing. Can't compute runnable adornment.
- }
+ 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;
+ }
+ }
return flags;
}
Index: src/org/eclipse/cdt/ui/CElementImageDescriptor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementImageDescriptor.java,v
retrieving revision 1.1
diff -u -r1.1 CElementImageDescriptor.java
--- src/org/eclipse/cdt/ui/CElementImageDescriptor.java 6 Feb 2003 20:48:31 -0000 1.1
+++ src/org/eclipse/cdt/ui/CElementImageDescriptor.java 26 Mar 2003 21:59:45 -0000
@@ -33,11 +33,11 @@
/** Flag to render the abstract adornment */
public final static int ABSTRACT= 0x001;
- /** Flag to render the final adornment */
- public final static int FINAL= 0x002;
+ /** Flag to render the const adornment */
+ public final static int CONSTANT= 0x002;
- /** Flag to render the synchronized adornment */
- public final static int SYNCHRONIZED= 0x004;
+ /** Flag to render the volatile adornment */
+ public final static int VOLATILE= 0x004;
/** Flag to render the static adornment */
public final static int STATIC= 0x008;
@@ -160,8 +160,8 @@
}
private void drawTopRight() {
- //int x= getSize().x;
- //ImageData data= null;
+ int x= getSize().x;
+ ImageData data= null;
/* if ((fFlags & ABSTRACT) != 0) {
data= CPluginImages.DESC_OVR_ABSTRACT.getImageData();
x-= data.width;
@@ -171,19 +171,19 @@
data= CPluginImages.DESC_OVR_FINAL.getImageData();
x-= data.width;
drawImage(data, x, 0);
- }
+ }*/
if ((fFlags & STATIC) != 0) {
data= CPluginImages.DESC_OVR_STATIC.getImageData();
x-= data.width;
drawImage(data, x, 0);
- } */
+ }
}
private void drawBottomRight() {
//Point size= getSize();
//int x= size.x;
//ImageData data= null;
- /* if ((fFlags & SYNCHRONIZED) != 0) {
+ /*if ((fFlags & SYNCHRONIZED) != 0) {
data= CPluginImages.DESC_OVR_SYNCH.getImageData();
x-= data.width;
drawImage(data, x, size.y - data.height);
Index: src/org/eclipse/cdt/ui/CElementLabelProvider.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementLabelProvider.java,v
retrieving revision 1.3
diff -u -r1.3 CElementLabelProvider.java
--- src/org/eclipse/cdt/ui/CElementLabelProvider.java 26 Mar 2003 16:02:58 -0000 1.3
+++ src/org/eclipse/cdt/ui/CElementLabelProvider.java 26 Mar 2003 21:59:46 -0000
@@ -9,8 +9,6 @@
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICFile;
import org.eclipse.cdt.core.model.IFunctionDeclaration;
-import org.eclipse.cdt.core.model.IVariable;
-import org.eclipse.cdt.core.model.IVariableDeclaration;
import org.eclipse.cdt.internal.ui.CElementImageProvider;
import org.eclipse.cdt.internal.ui.ErrorTickAdornmentProvider;
import org.eclipse.cdt.internal.ui.IAdornmentProvider;
@@ -69,15 +67,6 @@
IFunctionDeclaration fdecl = (IFunctionDeclaration) celem;
name = fdecl.getSignature();
break;
- case ICElement.C_VARIABLE:
- IVariable var = (IVariable) celem;
- name = var.getTypeName() + " " + var.getElementName();
- break;
- case ICElement.C_VARIABLE_DECLARATION:
- case ICElement.C_FIELD:
- IVariableDeclaration vdecl = (IVariableDeclaration) celem;
- name = vdecl.getTypeName() + " " + vdecl.getElementName();
- break;
default:
name= celem.getElementName();
break;