mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 02:36:01 +02:00
toString method.
This commit is contained in:
parent
0c6ec32e51
commit
cba049ddbe
1 changed files with 37 additions and 31 deletions
|
@ -39,24 +39,24 @@ import org.eclipse.core.runtime.PlatformObject;
|
||||||
*/
|
*/
|
||||||
public class ProblemBinding extends PlatformObject implements IProblemBinding, IType, IScope, IASTInternalScope {
|
public class ProblemBinding extends PlatformObject implements IProblemBinding, IType, IScope, IASTInternalScope {
|
||||||
protected final int id;
|
protected final int id;
|
||||||
protected final char [] arg;
|
protected final char[] arg;
|
||||||
protected IASTNode node;
|
protected IASTNode node;
|
||||||
private String message = null;
|
private String message = null;
|
||||||
|
|
||||||
public ProblemBinding( IASTNode node, int id, char [] arg ){
|
public ProblemBinding(IASTNode node, int id, char[] arg) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.arg = arg;
|
this.arg = arg;
|
||||||
this.node = node;
|
this.node = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTNode getASTNode(){
|
public IASTNode getASTNode() {
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final static String PROBLEM_PATTERN = "BaseProblemFactory.problemPattern"; //$NON-NLS-1$
|
protected final static String PROBLEM_PATTERN = "BaseProblemFactory.problemPattern"; //$NON-NLS-1$
|
||||||
protected static final String [] errorMessages;
|
protected static final String[] errorMessages;
|
||||||
static {
|
static {
|
||||||
errorMessages = new String [ IProblemBinding.LAST_PROBLEM ];
|
errorMessages = new String[IProblemBinding.LAST_PROBLEM];
|
||||||
errorMessages[SEMANTIC_NAME_NOT_FOUND - 1] = ParserMessages.getString("ASTProblemFactory.error.semantic.nameNotFound"); //$NON-NLS-1$
|
errorMessages[SEMANTIC_NAME_NOT_FOUND - 1] = ParserMessages.getString("ASTProblemFactory.error.semantic.nameNotFound"); //$NON-NLS-1$
|
||||||
errorMessages[SEMANTIC_AMBIGUOUS_LOOKUP - 1] = ParserMessages.getString("ASTProblemFactory.error.semantic.pst.ambiguousLookup"); //$NON-NLS-1$
|
errorMessages[SEMANTIC_AMBIGUOUS_LOOKUP - 1] = ParserMessages.getString("ASTProblemFactory.error.semantic.pst.ambiguousLookup"); //$NON-NLS-1$
|
||||||
errorMessages[SEMANTIC_INVALID_TYPE - 1] = ParserMessages.getString("ASTProblemFactory.error.semantic.pst.invalidType"); //$NON-NLS-1$
|
errorMessages[SEMANTIC_INVALID_TYPE - 1] = ParserMessages.getString("ASTProblemFactory.error.semantic.pst.invalidType"); //$NON-NLS-1$
|
||||||
|
@ -87,7 +87,7 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
||||||
if (message != null)
|
if (message != null)
|
||||||
return message;
|
return message;
|
||||||
|
|
||||||
String msg = ( id >= 0 && id <= LAST_PROBLEM ) ? errorMessages[ id - 1 ] : ""; //$NON-NLS-1$
|
String msg = (id >= 0 && id <= LAST_PROBLEM) ? errorMessages[id - 1] : ""; //$NON-NLS-1$
|
||||||
|
|
||||||
if (arg != null) {
|
if (arg != null) {
|
||||||
msg = MessageFormat.format(msg, new Object[] { new String(arg) });
|
msg = MessageFormat.format(msg, new Object[] { new String(arg) });
|
||||||
|
@ -95,6 +95,7 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
|
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
|
||||||
*/
|
*/
|
||||||
|
@ -113,7 +114,7 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
|
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
|
||||||
*/
|
*/
|
||||||
public IScope getScope() throws DOMException {
|
public IScope getScope() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -124,24 +125,23 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone(){
|
public Object clone() {
|
||||||
//don't clone problems
|
// Don't clone problems
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getParent()
|
* @see org.eclipse.cdt.core.dom.ast.IScope#getParent()
|
||||||
*/
|
*/
|
||||||
public IScope getParent() throws DOMException {
|
public IScope getParent() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
|
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public IBinding[] find( String name ) throws DOMException {
|
public IBinding[] find(String name) throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -154,59 +154,60 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#addName(org.eclipse.cdt.core.dom.ast.IASTName)
|
* @see org.eclipse.cdt.core.dom.ast.IScope#addName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
*/
|
*/
|
||||||
public void addName( IASTName name ) throws DOMException {
|
public void addName(IASTName name) throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#removeBinding(org.eclipse.cdt.core.dom.ast.IBinding)
|
* @see org.eclipse.cdt.core.dom.ast.IScope#removeBinding(org.eclipse.cdt.core.dom.ast.IBinding)
|
||||||
*/
|
*/
|
||||||
public void removeBinding( IBinding binding ) throws DOMException {
|
public void removeBinding(IBinding binding) throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean)
|
* @see org.eclipse.cdt.core.dom.ast.IScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean)
|
||||||
*/
|
*/
|
||||||
public IBinding getBinding( IASTName name, boolean resolve ) throws DOMException {
|
public IBinding getBinding(IASTName name, boolean resolve) throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final IBinding[] getBindings(IASTName name, boolean resolve, boolean prefix) throws DOMException {
|
public final IBinding[] getBindings(IASTName name, boolean resolve, boolean prefix)
|
||||||
throw new DOMException( this );
|
throws DOMException {
|
||||||
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean)
|
* @see org.eclipse.cdt.core.dom.ast.IScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean)
|
||||||
*/
|
*/
|
||||||
public IBinding getBinding( IASTName name, boolean resolve, IIndexFileSet fileSet ) throws DOMException {
|
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean)
|
* @see org.eclipse.cdt.core.dom.ast.IScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean)
|
||||||
*/
|
*/
|
||||||
public IBinding[] getBindings( IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet ) throws DOMException {
|
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#setFullyCached(boolean)
|
* @see org.eclipse.cdt.core.dom.ast.IScope#setFullyCached(boolean)
|
||||||
*/
|
*/
|
||||||
public void setFullyCached( boolean b ) {
|
public void setFullyCached(boolean b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#isFullyCached()
|
* @see org.eclipse.cdt.core.dom.ast.IScope#isFullyCached()
|
||||||
*/
|
*/
|
||||||
public boolean isFullyCached() throws DOMException {
|
public boolean isFullyCached() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
|
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
|
||||||
*/
|
*/
|
||||||
public boolean isSameType( IType type ) {
|
public boolean isSameType(IType type) {
|
||||||
return type == this;
|
return type == this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,14 +215,14 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFileName() {
|
public String getFileName() {
|
||||||
if( node != null )
|
if (node != null)
|
||||||
return node.getContainingFilename();
|
return node.getContainingFilename();
|
||||||
|
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLineNumber() {
|
public int getLineNumber() {
|
||||||
if( node != null ){
|
if (node != null) {
|
||||||
IASTFileLocation fileLoc = node.getFileLocation();
|
IASTFileLocation fileLoc = node.getFileLocation();
|
||||||
return fileLoc.getStartingLineNumber();
|
return fileLoc.getStartingLineNumber();
|
||||||
}
|
}
|
||||||
|
@ -229,10 +230,15 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBinding(IBinding binding) throws DOMException {
|
public void addBinding(IBinding binding) throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ILinkage getLinkage() {
|
public ILinkage getLinkage() {
|
||||||
return Linkage.NO_LINKAGE;
|
return Linkage.NO_LINKAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return getMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue