org.eclipse.xtext.validation.EValidatorRegistrar Java Examples
The following examples show how to use
org.eclipse.xtext.validation.EValidatorRegistrar.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ValidatorTester.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Inject public ValidatorTester(T validator, EValidatorRegistrar registrar, @Named(Constants.LANGUAGE_NAME) final String languageName) { this.validator = validator; EValidator.Registry originalRegistry = registrar.getRegistry(); EValidatorRegistryImpl newRegistry = new EValidatorRegistryImpl(); registrar.setRegistry(newRegistry); this.validator.register(registrar); diagnostician = new Diagnostician(newRegistry) { @Override public java.util.Map<Object,Object> createDefaultContext() { java.util.Map<Object,Object> map = super.createDefaultContext(); map.put(AbstractInjectableValidator.CURRENT_LANGUAGE_NAME, languageName); return map; } }; registrar.setRegistry(originalRegistry); validatorCalled = false; }
Example #2
Source File: N4JSStandaloneRegistrationHelper.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** Registration method that is executed on injector instantiation. */ @Inject public void registerServiceProvider(Injector injector) { // register N4JS resource service providers new N4JSStandaloneSetup().register(injector); final N4JSValidator validator = injector.getInstance(N4JSValidator.class); final EValidatorRegistrar registrar = injector.getInstance(EValidatorRegistrar.class); // clear list of existing N4JS-package validators (removes obsolete validators originating from other injectors) EValidator.Registry.INSTANCE.remove(N4JSPackage.eINSTANCE); // re-register N4JSValidator validator.register(registrar); }
Example #3
Source File: SGraphJavaValidatorTester.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@Inject public SGraphJavaValidatorTester(T validator, EValidatorRegistrar registrar, String languageName) { super(validator, registrar, languageName); EValidatorRegistryImpl newRegistry = new EValidatorRegistryImpl(); newRegistry.put(SGraphPackage.eINSTANCE, validator); diagnostician = new Diagnostician(newRegistry); }
Example #4
Source File: UniqueClassNameValidator.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Inject protected void register(EValidatorRegistrar registrar, IGrammarAccess grammarAccess) { AbstractRule entryRule = Iterables.getFirst(grammarAccess.getGrammar().getRules(), null); if (entryRule instanceof ParserRule) { registrar.register(((ParserRule) entryRule).getType().getClassifier().getEPackage(), this); } }
Example #5
Source File: ExtraLanguageValidatorSupport.java From sarl with Apache License 2.0 | 4 votes |
@Override public void register(EValidatorRegistrar registrar) { // }
Example #6
Source File: AbstractSGraphValidator.java From statecharts with Eclipse Public License 1.0 | 4 votes |
@Override @Inject public void register(EValidatorRegistrar registrar) { // Do not register because this validator is only a composite #398987 }
Example #7
Source File: FormalParameterCheckBase.java From dsl-devkit with Eclipse Public License 1.0 | 4 votes |
@Override public void register(final EValidatorRegistrar registrar) { // do nothing }
Example #8
Source File: ClasspathBasedChecks.java From dsl-devkit with Eclipse Public License 1.0 | 4 votes |
@Override public void register(final EValidatorRegistrar registrar) { // do nothing }
Example #9
Source File: ApiAccessChecks.java From dsl-devkit with Eclipse Public License 1.0 | 4 votes |
@Override public void register(final EValidatorRegistrar registrar) { // do nothing }
Example #10
Source File: ValidatorTester.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public ValidatorTester(T validator, Injector injector) { this(validator, injector.getInstance(EValidatorRegistrar.class), injector.getInstance(Key.get(String.class, Names.named(Constants.LANGUAGE_NAME)))); }
Example #11
Source File: EarlyExitValidator.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
@Override public void register(EValidatorRegistrar registrar) { // do nothing }
Example #12
Source File: UniqueClassNameValidator.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
@Override public void register(EValidatorRegistrar registrar) { }
Example #13
Source File: AbstractPackageJSONValidatorExtension.java From n4js with Eclipse Public License 1.0 | 4 votes |
@Override public void register(EValidatorRegistrar registrar) { // do not register with EMF registry (uses designated extension points instead) }
Example #14
Source File: N4JSMemberRedefinitionValidator.java From n4js with Eclipse Public License 1.0 | 4 votes |
/** * NEEDED, when removed check methods will be called twice once by N4JSValidator, and once by * AbstractDeclarativeN4JSValidator */ @Override public void register(EValidatorRegistrar registrar) { // nop }
Example #15
Source File: PackageJsonXpectInjectorSetup.java From n4js with Eclipse Public License 1.0 | 4 votes |
@Creates public Injector createInjector() { // if the Eclipse Platform Runtime is available, there is no need for a custom // injector setup if (Platform.isRunning()) { throw new IllegalStateException( "Detected use of the PackageJsonXpectInjectorSetup although the Eclipse Platform is running." + " Do not use this injector setup for Plug-In UI Tests."); } // obtain JSON injector using the super method final Injector jsonInjector = super.createInjector(); // obtain N4JS-specific package.json validator extensions final AbstractPackageJSONValidatorExtension packageJsonValidatorExtension = n4jsInjector.get() .getInstance(PackageJsonValidatorExtension.class); final AbstractPackageJSONValidatorExtension projectSetupValidatorExtension = n4jsInjector.get() .getInstance(N4JSProjectSetupJsonValidatorExtension.class); // obtain JSON validation extension registry final JSONExtensionRegistry extensionRegistry = jsonInjector.getInstance(JSONExtensionRegistry.class); // X!PECTs injector initialization causes an invalid state of the EValidator // registry in which the registered validators use a different injector than the // rest of the language infrastructure (see // https://github.com/eclipse/Xpect/issues/233). Therefore, at this point we // clear the validator registry and re-initialize it to restore a consistent // state. final Registry validatorRegistry = EValidator.Registry.INSTANCE; validatorRegistry.remove(JSONPackage.eINSTANCE); // register the correct instance of the generic JSON validator as sole validator // for the JSON package final JSONValidator jsonValidator = jsonInjector.getInstance(JSONValidator.class); jsonValidator.register(jsonInjector.getInstance(EValidatorRegistrar.class)); // finally, manually register the N4JS package.json validation extensions extensionRegistry.register(packageJsonValidatorExtension); extensionRegistry.register(projectSetupValidatorExtension); // TODO re-think this approach In order for the FileBasedWorkspace to correctly // detect the test data as valid N4JS projects, (cf. // FileBasedWorkspace#tryFindProjectRecursivelyByManifest) we must explicitly // register the JSONFactory as resource factory for '*.xt' as otherwise, EMF // will fall-back to its XMI parser for 'package.json.xt' resources. Map<String, Object> factoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); Object jsonFactory = factoryMap.get("json"); factoryMap.put("xt", jsonFactory); return jsonInjector; }
Example #16
Source File: N4JSNameValidator.java From n4js with Eclipse Public License 1.0 | 2 votes |
/** * NEEEDED * * when removed check methods will be called twice once by N4JSValidator, and once by * AbstractDeclarativeN4JSValidator */ @Override public void register(EValidatorRegistrar registrar) { // nop }
Example #17
Source File: N4JSLambdaValidator.java From n4js with Eclipse Public License 1.0 | 2 votes |
/** * NEEEDED * * when removed check methods will be called twice once by N4JSValidator, and once by * AbstractDeclarativeN4JSValidator */ @Override public void register(EValidatorRegistrar registrar) { // nop }
Example #18
Source File: DefaultCheckValidator.java From dsl-devkit with Eclipse Public License 1.0 | 2 votes |
/** * Override with empty implementation since indirectly referenced {@link #grammarAccess} has not been injected at this point. {@inheritDoc} */ @Override public void register(final EValidatorRegistrar registrar) {}
Example #19
Source File: DefaultCheckValidator.java From dsl-devkit with Eclipse Public License 1.0 | 2 votes |
/** * At this point, {@link #grammarAccess} has been injected. See {@link #register(EValidatorRegistrar)}. * * @param registrar * the validator registrar */ @Inject public void register2(final EValidatorRegistrar registrar) { super.register(registrar); }
Example #20
Source File: N4JSEnumValidator.java From n4js with Eclipse Public License 1.0 | 2 votes |
/** * NEEEDED * * when removed check methods will be called twice once by N4JSValidator, and once by * AbstractDeclarativeN4JSValidator */ @Override public void register(EValidatorRegistrar registrar) { /* nop */ }
Example #21
Source File: N4JSSyntaxValidator.java From n4js with Eclipse Public License 1.0 | 2 votes |
/** * NEEDED * * when removed check methods will be called twice once by N4JSValidator, and once by * AbstractDeclarativeN4JSValidator */ @Override public void register(EValidatorRegistrar registrar) { // nop }
Example #22
Source File: N4JSFlowgraphValidator.java From n4js with Eclipse Public License 1.0 | 2 votes |
/** * NEEEDED * * when removed check methods will be called twice once by N4JSValidator, and once by * AbstractDeclarativeN4JSValidator */ @Override public void register(EValidatorRegistrar registrar) { // nop }
Example #23
Source File: N4JSStatementValidator.java From n4js with Eclipse Public License 1.0 | 2 votes |
/** * NEEEDED * * when removed check methods will be called twice once by N4JSValidator, and once by * AbstractDeclarativeN4JSValidator */ @Override public void register(EValidatorRegistrar registrar) { // nop }