Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 37456 Details for
Bug 132228
Provide support for alternate validator implementations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
DelegatingValidator patch
DelegatingValidatorPatch.txt (text/plain), 8.27 KB, created by
Valentin Baciu
on 2006-04-01 03:41:48 EST
(
hide
)
Description:
DelegatingValidator patch
Filename:
MIME Type:
Creator:
Valentin Baciu
Created:
2006-04-01 03:41:48 EST
Size:
8.27 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.validation >Index: validate/org/eclipse/wst/validation/internal/delegates/DelegatingValidator.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/validation/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/delegates/DelegatingValidator.java,v >retrieving revision 1.1 >diff -u -r1.1 DelegatingValidator.java >--- validate/org/eclipse/wst/validation/internal/delegates/DelegatingValidator.java 21 Mar 2006 19:44:33 -0000 1.1 >+++ validate/org/eclipse/wst/validation/internal/delegates/DelegatingValidator.java 1 Apr 2006 08:33:18 -0000 >@@ -15,6 +15,8 @@ > import java.util.List; > > import org.eclipse.core.resources.IProject; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.jobs.ISchedulingRule; > import org.eclipse.wst.validation.internal.ConfigurationManager; > import org.eclipse.wst.validation.internal.ProjectConfiguration; > import org.eclipse.wst.validation.internal.ResourceConstants; >@@ -28,6 +30,7 @@ > import org.eclipse.wst.validation.internal.provisional.core.IReporter; > import org.eclipse.wst.validation.internal.provisional.core.IValidationContext; > import org.eclipse.wst.validation.internal.provisional.core.IValidator; >+import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob; > > /** > * This class is to be used as a base class by clients who want to provide >@@ -75,56 +78,7 @@ > */ > public void validate(IValidationContext helper, IReporter reporter) throws ValidationException > { >- ValidatorMetaData vmd = ValidationRegistryReader.getReader().getValidatorMetaData(this); >- String validatorName = vmd.getValidatorDisplayName(); >- >- // We need to ensure that the context is an IProjectValidationContext. The >- // limitation of using an IValidationContext is that it does not readily >- // provide the project the validator is being invoked upon. >- >- if (!(helper instanceof IProjectValidationContext)) >- { >- throw new ValidationException(new LocalizedMessage(IMessage.HIGH_SEVERITY, ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_WRONG_CONTEXT_FOR_DELEGATE, new String[] { validatorName }))); >- } >- >- IProjectValidationContext projectContext = (IProjectValidationContext) helper; >- IProject project = projectContext.getProject(); >- >- ValidatorDelegateDescriptor delegateDescriptor = null; >- >- try >- { >- ProjectConfiguration projectConfig = ConfigurationManager.getManager().getProjectConfiguration(project); >- >- delegateDescriptor = projectConfig.getDelegateDescriptor(vmd); >- } >- catch (InvocationTargetException e) >- { >- // Already dealt with by the framework. >- } >- finally >- { >- if (delegateDescriptor == null) >- { >- throw new ValidationException(new LocalizedMessage(IMessage.HIGH_SEVERITY, ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_NO_DELEGATE, new String[] { vmd.getValidatorDisplayName() }))); >- } >- } >- >- IValidator delegate = delegateDescriptor.getValidator(); >- >- // We need to make it look like this validator is the one generating >- // messages so we wrap the reporter and use this validator as the source. >- // The validation framework does not recognize our validators because they >- // are not registered directly with the framework. >- // We could make them work like the aggregated validators but that would >- // create problems with markers not being cleaned up if someone switches >- // validators. >- // TODO : Maybe we could clear all the markers generated by a delegate when >- // the user chooses a different delegate implementation? >- >- DelegatingReporter delegatingReporter = new DelegatingReporter(this, reporter); >- >- delegate.validate(helper, delegatingReporter); >+ // Apparently this method will not be called on an IValidatorJob. > } > > /** >@@ -234,4 +188,76 @@ > delegatingReporter.removeMessageSubset(delegatingValidator, obj, groupName); > } > } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.wst.validation.internal.provisional.core.IValidatorJob#validateInJob(org.eclipse.wst.validation.internal.provisional.core.IValidationContext, >+ * org.eclipse.wst.validation.internal.provisional.core.IReporter) >+ */ >+ public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException >+ { >+ ValidatorMetaData vmd = ValidationRegistryReader.getReader().getValidatorMetaData(this); >+ String validatorName = vmd.getValidatorDisplayName(); >+ >+ // We need to ensure that the context is an IProjectValidationContext. The >+ // limitation of using an IValidationContext is that it does not readily >+ // provide the project the validator is being invoked upon. >+ >+ if (!(helper instanceof IProjectValidationContext)) >+ { >+ throw new ValidationException(new LocalizedMessage(IMessage.HIGH_SEVERITY, ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_WRONG_CONTEXT_FOR_DELEGATE, new String[] { validatorName }))); >+ } >+ >+ IProjectValidationContext projectContext = (IProjectValidationContext) helper; >+ IProject project = projectContext.getProject(); >+ >+ ValidatorDelegateDescriptor delegateDescriptor = null; >+ >+ try >+ { >+ ProjectConfiguration projectConfig = ConfigurationManager.getManager().getProjectConfiguration(project); >+ >+ delegateDescriptor = projectConfig.getDelegateDescriptor(vmd); >+ } >+ catch (InvocationTargetException e) >+ { >+ // Already dealt with by the framework. >+ } >+ finally >+ { >+ if (delegateDescriptor == null) >+ { >+ throw new ValidationException(new LocalizedMessage(IMessage.HIGH_SEVERITY, ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_NO_DELEGATE, new String[] { vmd.getValidatorDisplayName() }))); >+ } >+ } >+ >+ IValidatorJob delegate = (IValidatorJob)delegateDescriptor.getValidator(); >+ >+ // We need to make it look like this validator is the one generating >+ // messages so we wrap the reporter and use this validator as the source. >+ // The validation framework does not recognize our validators because they >+ // are not registered directly with the framework. >+ // We could make them work like the aggregated validators but that would >+ // create problems with markers not being cleaned up if someone switches >+ // validators. >+ // TODO : Maybe we could clear all the markers generated by a delegate when >+ // the user chooses a different delegate implementation? >+ >+ DelegatingReporter delegatingReporter = new DelegatingReporter(this, reporter); >+ >+ IStatus status = delegate.validateInJob(helper, delegatingReporter); >+ >+ return status; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.wst.validation.internal.provisional.core.IValidatorJob#getSchedulingRule(org.eclipse.wst.validation.internal.provisional.core.IValidationContext) >+ */ >+ public ISchedulingRule getSchedulingRule(IValidationContext helper) >+ { >+ return null; >+ } > } >Index: validate/org/eclipse/wst/validation/internal/delegates/IDelegatingValidator.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/validation/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/delegates/IDelegatingValidator.java,v >retrieving revision 1.1 >diff -u -r1.1 IDelegatingValidator.java >--- validate/org/eclipse/wst/validation/internal/delegates/IDelegatingValidator.java 21 Mar 2006 19:44:33 -0000 1.1 >+++ validate/org/eclipse/wst/validation/internal/delegates/IDelegatingValidator.java 1 Apr 2006 08:33:18 -0000 >@@ -11,7 +11,7 @@ > > package org.eclipse.wst.validation.internal.delegates; > >-import org.eclipse.wst.validation.internal.provisional.core.IValidator; >+import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob; > > /** > * A delegating validator delegates the actual validation work to a delegate >@@ -29,6 +29,6 @@ > * API will almost certainly be broken (repeatedly) as the API evolves. > * </p> > */ >-public interface IDelegatingValidator extends IValidator >+public interface IDelegatingValidator extends IValidatorJob > { > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 132228
:
36537
|
36538
|
36539
|
36540
|
36541
|
36631
|
36632
|
36671
| 37456