Errors Displayed in Source and Markers Views. Figure 3. Properties Dialog - Validation. Figure 4. Properties Dialog - Expanded Validation. An array of instances of this type is passed into the IValidator 's validate method for processing.
Given an IFileDelta , an IValidator can perform validation on just the file which has changed, and perform the type of validation necessary, as indicated by the IFileDelta 's flag.
The only exception that an IValidator may create and throw is a ValidatorException. When the framework catches a ValidationException , the exception's IMessage will be extracted and shown to the user.
If an IValidator catches an unexpected exception, instead of propagating that exception up to the framework, the exception should be wrapped in a ValidatorException and the ValidatorException should be propagated up to the framework. If the framework imposes a limit on the number of validation messages which can be reported, then when that limit is reached, a MessageLimitException is thrown by the framework. IValidator s should not catch the MessageLimitException ; instead, they should let the exception propagate up to the framework and the framework will do whatever cleanup is necessary.
The validation framework provides, in addition to interfaces, some simple implementations of three interfaces: IFileDelta , IMessage , and IHelper. These classes are provided for convenience and it is not required that they be used. FileDelta Message PassthruHelper. IValidator An implementation of this interface validates a model.
An IFileDelta instance represents an object, usually a file, that has changed on the user's system and needs to be revalidated. If no IFileDelta instances are passed to the IValidator , the validator should revalidate everything. A ValidationException contains an IMessage instance that will be reported to the user, and this exception may wrap another exception. A MessageLimitException is thrown by the framework if the IValidator attempts to report a message when the maximum number of messages has already been reported.
MessageLimitException does not contain an IMessage to be reported to the user. The name of the resource bundle category which contains the string. The id of the message in the resource bundle; used to extract the message from the bundle. All custom validators developed extending the framework are registered on a IProject, when registered the project nature type is used for registration.
The registration ensures that the custom validator runs on only on projects with that project nature. This registration is done in the custom validator extension implementation.
The project level has the option to enable it even though it is diabled globally. By default all custom validators are enabled by default at project level and global level. There are more options on enablement Global Validation Preferences pagen and the Project Validation properties page that are self explaintory. The framework provides validation to be triggered manually on resources using the "Run Validation" pop up menu item that is available on resources.
The Run Validation runs all enabled validators registered on the resource. The manual validation provides an progress dialog to display the status of the validation. Incremental validation is provided by the framework using the core Incremental Builder technology. The framework defines a validation builder that is of a incremental builder type. The Valdiation Builder is added to the build spec of the project.
The builder triggers all enabled custom validators on a Auto Build in the workbench. The validation builder uses the core delta that is maintained by the eclipse Build Manager to determin the kind validation to be triggered on the resources that have custom valdators registered.
Asked By: Ritesh M Nayak. Answered By: Alexander Pogrebnyak. Answered By: Brad Marchesseault. Answered By: calraiden. Answered By: Redlab. Answered By: treociti.
0コメント