org.eclipse.jdt.internal.compiler.problem
Class DefaultProblemFactory

java.lang.Object
  extended by org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory
All Implemented Interfaces:
IProblemFactory
Direct Known Subclasses:
CancelableProblemFactory, CompletionEngine.CompletionProblemFactory, ProblemFactory

public class DefaultProblemFactory
extends java.lang.Object
implements IProblemFactory


Field Summary
 HashtableOfInt messageTemplates
           
 
Constructor Summary
DefaultProblemFactory()
           
DefaultProblemFactory(java.util.Locale loc)
           
 
Method Summary
 CategorizedProblem createProblem(char[] originatingFileName, int problemId, java.lang.String[] problemArguments, int elaborationId, java.lang.String[] messageArguments, int severity, int startPosition, int endPosition, int lineNumber, int columnNumber)
          Answer a new IProblem created according to the parameters values.
 CategorizedProblem createProblem(char[] originatingFileName, int problemId, java.lang.String[] problemArguments, java.lang.String[] messageArguments, int severity, int startPosition, int endPosition, int lineNumber, int columnNumber)
          Answer a new IProblem created according to the parameters value originatingFileName the name of the file name from which the problem is originated problemId the problem id problemArguments the fully qualified arguments recorded inside the problem messageArguments the arguments needed to set the error message (shorter names than problemArguments ones) severity the severity of the problem startPosition the starting position of the problem endPosition the end position of the problem lineNumber the line on which the problem occured
 java.util.Locale getLocale()
          Answer the locale used to retrieve the error messages
 java.lang.String getLocalizedMessage(int id, int elaborationId, java.lang.String[] problemArguments)
          Inject the supplied message arguments into a localized template elaborated from the supplied problem id and an optional elaboration id and return the resulting message.
 java.lang.String getLocalizedMessage(int id, java.lang.String[] problemArguments)
           
static HashtableOfInt loadMessageTemplates(java.util.Locale loc)
          This method initializes the MessageTemplates class variable according to the current Locale.
 java.lang.String localizedMessage(CategorizedProblem problem)
           
 void setLocale(java.util.Locale locale)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messageTemplates

public HashtableOfInt messageTemplates
Constructor Detail

DefaultProblemFactory

public DefaultProblemFactory()

DefaultProblemFactory

public DefaultProblemFactory(java.util.Locale loc)
Parameters:
loc - the locale used to get the right message
Method Detail

createProblem

public CategorizedProblem createProblem(char[] originatingFileName,
                                        int problemId,
                                        java.lang.String[] problemArguments,
                                        java.lang.String[] messageArguments,
                                        int severity,
                                        int startPosition,
                                        int endPosition,
                                        int lineNumber,
                                        int columnNumber)
Answer a new IProblem created according to the parameters value

Specified by:
createProblem in interface IProblemFactory
Parameters:
originatingFileName - char[]
problemId - int
problemArguments - String[]
messageArguments - String[]
severity - int
startPosition - int
endPosition - int
lineNumber - int
Returns:
CategorizedProblem

createProblem

public CategorizedProblem createProblem(char[] originatingFileName,
                                        int problemId,
                                        java.lang.String[] problemArguments,
                                        int elaborationId,
                                        java.lang.String[] messageArguments,
                                        int severity,
                                        int startPosition,
                                        int endPosition,
                                        int lineNumber,
                                        int columnNumber)
Description copied from interface: IProblemFactory
Answer a new IProblem created according to the parameters values.

Specified by:
createProblem in interface IProblemFactory
Parameters:
originatingFileName - the name of the file from which the problem is originated
problemId - the problem id
problemArguments - the fully qualified arguments recorded inside the problem
elaborationId - the message elaboration id (0 for problems that have no message elaboration)
messageArguments - the arguments needed to set the error message (shorter names than problemArguments ones)
severity - the severity of the problem
startPosition - the start position of the problem
endPosition - the end position of the problem
lineNumber - the line on which the problem occurred
Returns:
a new IProblem created according to the parameters values.

getLocale

public java.util.Locale getLocale()
Answer the locale used to retrieve the error messages

Specified by:
getLocale in interface IProblemFactory
Returns:
java.util.Locale

setLocale

public void setLocale(java.util.Locale locale)

getLocalizedMessage

public final java.lang.String getLocalizedMessage(int id,
                                                  java.lang.String[] problemArguments)
Specified by:
getLocalizedMessage in interface IProblemFactory

getLocalizedMessage

public final java.lang.String getLocalizedMessage(int id,
                                                  int elaborationId,
                                                  java.lang.String[] problemArguments)
Description copied from interface: IProblemFactory
Inject the supplied message arguments into a localized template elaborated from the supplied problem id and an optional elaboration id and return the resulting message. The arguments number should match the highest placeholder index in the template. When an elaboration id is used, the template matching that elaboration id replaces '{0}' into the template matching the problem id before the message arguments are injected.

Specified by:
getLocalizedMessage in interface IProblemFactory
Parameters:
id - the problem id taken from IProblem constants
elaborationId - 0 if the considered problem has no elaboration, a valid elaboration id else
problemArguments - the arguments to inject into the template
Returns:
a localized message elaborated from the supplied problem id, elaboration id and message parameters

localizedMessage

public final java.lang.String localizedMessage(CategorizedProblem problem)
Parameters:
problem - CategorizedProblem
Returns:
String

loadMessageTemplates

public static HashtableOfInt loadMessageTemplates(java.util.Locale loc)
This method initializes the MessageTemplates class variable according to the current Locale.

Parameters:
loc - Locale
Returns:
HashtableOfInt