mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +02:00
Patch for Hoda Amer:
- The static sign will show if the parser sets isStatic() to true for any element. For now, I am just saving this info in the element info. We could change it later if we need another icon for variables and functions.
This commit is contained in:
parent
a48cbb43a0
commit
679b7c8db3
20 changed files with 376 additions and 160 deletions
|
@ -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();
|
||||
}
|
|
@ -8,7 +8,7 @@ package org.eclipse.cdt.core.model;
|
|||
/**
|
||||
* 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 @@ public interface IFunctionDeclaration extends ICElement, ISourceReference, ISour
|
|||
* 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();
|
||||
}
|
||||
|
|
|
@ -10,46 +10,12 @@ package org.eclipse.cdt.core.model;
|
|||
* 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
|
||||
|
|
|
@ -8,7 +8,7 @@ package org.eclipse.cdt.core.model;
|
|||
/**
|
||||
* 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);
|
||||
|
|
|
@ -8,9 +8,6 @@ package org.eclipse.cdt.core.model;
|
|||
/**
|
||||
* 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;
|
||||
}
|
||||
|
|
|
@ -8,9 +8,7 @@ package org.eclipse.cdt.core.model;
|
|||
/**
|
||||
* 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();
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ public class Field extends SourceManipulation implements IField {
|
|||
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 @@ public class Field extends SourceManipulation implements IField {
|
|||
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() {
|
||||
|
@ -58,6 +66,7 @@ public class Field extends SourceManipulation implements IField {
|
|||
getFieldInfo().setVisibility(visibility);
|
||||
}
|
||||
|
||||
|
||||
public FieldInfo getFieldInfo(){
|
||||
return (FieldInfo) getElementInfo();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ public class FieldInfo extends SourceManipulationInfo {
|
|||
boolean isConst = false;
|
||||
boolean isVolatile = false;
|
||||
boolean isMutable = false;
|
||||
boolean isStatic = false;
|
||||
int visibility;
|
||||
|
||||
protected FieldInfo (CElement element) {
|
||||
|
@ -48,6 +49,7 @@ public class FieldInfo extends SourceManipulationInfo {
|
|||
&& (isVolatile == otherInfo.isVolatile())
|
||||
&& (isMutable == otherInfo.isMutable())
|
||||
&& (visibility == otherInfo.getVisibility())
|
||||
&& (isStatic == otherInfo.isStatic())
|
||||
)
|
||||
return true;
|
||||
else
|
||||
|
@ -66,7 +68,7 @@ public class FieldInfo extends SourceManipulationInfo {
|
|||
return isConst;
|
||||
}
|
||||
|
||||
protected void setIsConst(boolean isConst){
|
||||
protected void setConst(boolean isConst){
|
||||
this.isConst = isConst;
|
||||
}
|
||||
|
||||
|
@ -74,15 +76,23 @@ public class FieldInfo extends SourceManipulationInfo {
|
|||
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 class FieldInfo extends SourceManipulationInfo {
|
|||
public void setVisibility(int visibility) {
|
||||
this.visibility = visibility;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,9 +51,7 @@ public class FunctionDeclaration extends SourceManipulation implements IFunction
|
|||
}
|
||||
|
||||
public String getSignature(){
|
||||
String sig = getReturnType();
|
||||
sig += " ";
|
||||
sig += getElementName();
|
||||
String sig = getElementName();
|
||||
if(getNumberOfParameters() > 0){
|
||||
sig += "(";
|
||||
String[] paramTypes = getParameterTypes();
|
||||
|
@ -79,6 +77,7 @@ public class FunctionDeclaration extends SourceManipulation implements IFunction
|
|||
return getFunctionInfo().getAccessControl();
|
||||
}
|
||||
|
||||
|
||||
public String[] getExceptions(){
|
||||
return new String[] {};
|
||||
}
|
||||
|
@ -98,4 +97,44 @@ 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(){
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,9 @@ class FunctionInfo extends SourceManipulationInfo {
|
|||
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 @@ class FunctionInfo extends SourceManipulationInfo {
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ import org.eclipse.cdt.core.model.IMethodDeclaration;
|
|||
|
||||
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 class MethodDeclaration extends FunctionDeclaration implements IMethodDec
|
|||
}
|
||||
|
||||
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 class MethodDeclaration extends FunctionDeclaration implements IMethodDec
|
|||
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 @@ public class MethodDeclaration extends FunctionDeclaration implements IMethodDec
|
|||
* 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()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,12 +16,10 @@ import org.eclipse.cdt.core.model.IMember;
|
|||
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 @@ public class MethodInfo extends FunctionInfo {
|
|||
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 @@ public class MethodInfo extends FunctionInfo {
|
|||
return isVirtual;
|
||||
}
|
||||
|
||||
public void setIsVirtual(boolean isVirtual){
|
||||
public void setVirtual(boolean isVirtual){
|
||||
this.isVirtual = isVirtual;
|
||||
}
|
||||
|
||||
|
@ -65,7 +55,7 @@ public class MethodInfo extends FunctionInfo {
|
|||
return isFriend;
|
||||
}
|
||||
|
||||
public void setIsFriend(boolean isFriend){
|
||||
public void setFriend(boolean isFriend){
|
||||
this.isFriend = isFriend;
|
||||
}
|
||||
|
||||
|
@ -73,18 +63,9 @@ public class MethodInfo extends FunctionInfo {
|
|||
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.
|
||||
|
|
|
@ -52,6 +52,9 @@ public class Structure extends SourceManipulation implements IStructure {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.model.IDeclaration#getAccessControl()
|
||||
*/
|
||||
public int getAccessControl(){
|
||||
return 0;
|
||||
}
|
||||
|
@ -75,6 +78,30 @@ public class Structure extends SourceManipulation implements IStructure {
|
|||
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 @@ public class Structure extends SourceManipulation implements IStructure {
|
|||
baseTypes = newBase;
|
||||
}
|
||||
|
||||
|
||||
protected CElementInfo createElementInfo () {
|
||||
return new StructureInfo(this);
|
||||
}
|
||||
|
@ -104,12 +132,4 @@ public class Structure extends SourceManipulation implements IStructure {
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.model.IVariableDeclaration#getAccesControl()
|
||||
*/
|
||||
public int getAccesControl() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,10 @@ import org.eclipse.cdt.core.model.ICElement;
|
|||
public class StructureInfo extends SourceManipulationInfo {
|
||||
|
||||
String type;
|
||||
|
||||
boolean isConst = false;
|
||||
boolean isVolatile = false;
|
||||
boolean isStatic = false;
|
||||
|
||||
protected StructureInfo (CElement element) {
|
||||
super(element);
|
||||
|
||||
|
@ -50,5 +53,53 @@ public class StructureInfo extends SourceManipulationInfo {
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,31 @@ public class Variable extends SourceManipulation implements IVariable {
|
|||
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 "";
|
||||
}
|
||||
|
|
|
@ -26,11 +26,35 @@ public class VariableDeclaration extends SourceManipulation implements IVariable
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,9 @@ class VariableInfo extends SourceManipulationInfo {
|
|||
|
||||
protected int flags;
|
||||
String typeStr = "";
|
||||
boolean isConst = false;
|
||||
boolean isVolatile = false;
|
||||
boolean isStatic = false;
|
||||
|
||||
protected VariableInfo (CElement element) {
|
||||
super(element);
|
||||
|
@ -41,4 +44,28 @@ class VariableInfo extends SourceManipulationInfo {
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -257,9 +257,11 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
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 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
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 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
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 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
newElement.setParameterTypes(parameterTypes);
|
||||
newElement.setReturnType( getTypeName() );
|
||||
newElement.setVisibility(this.getCurrentVisibility());
|
||||
newElement.setVolatile(isVolatile());
|
||||
newElement.setStatic(isStatic());
|
||||
return newElement;
|
||||
}
|
||||
|
||||
|
@ -329,6 +339,8 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
newElement.setParameterTypes(parameterTypes);
|
||||
newElement.setReturnType( getTypeName() );
|
||||
newElement.setVisibility(this.getCurrentVisibility());
|
||||
newElement.setVolatile(isVolatile());
|
||||
newElement.setStatic(isStatic());
|
||||
return newElement;
|
||||
}
|
||||
|
||||
|
@ -340,8 +352,18 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
* @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 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
* @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;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.eclipse.cdt.core.model.ICElement;
|
|||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.IMember;
|
||||
import org.eclipse.cdt.core.model.IMethodDeclaration;
|
||||
import org.eclipse.cdt.core.model.IDeclaration;
|
||||
import org.eclipse.cdt.internal.ui.util.ImageDescriptorRegistry;
|
||||
import org.eclipse.cdt.ui.CElementImageDescriptor;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
@ -281,28 +282,18 @@ public class CElementImageProvider {
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,11 +33,11 @@ public class CElementImageDescriptor extends CompositeImageDescriptor {
|
|||
/** 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 @@ public class CElementImageDescriptor extends CompositeImageDescriptor {
|
|||
}
|
||||
|
||||
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 @@ public class CElementImageDescriptor extends CompositeImageDescriptor {
|
|||
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);
|
||||
|
|
Loading…
Add table
Reference in a new issue