org.eclipse.xtext.Constants Java Examples

The following examples show how to use org.eclipse.xtext.Constants. 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-core with Eclipse Public License 2.0 6 votes vote down vote up
@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: ValidatorTester.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@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 #3
Source File: XtextEditorPropertyTester.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
	if (Constants.LANGUAGE_NAME.equals(property)) {
		XtextEditor xtextEditor = Adapters.adapt(receiver, XtextEditor.class);
		if (xtextEditor != null) {
			return xtextEditor.getLanguageName().equals(expectedValue);
		}
	}
	return false;
}
 
Example #4
Source File: SarlDocumentationParser.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Change the name of the language.
 *
 * @param outputLanguage the language name, or {@code null} for ignoring the language name.
 */
@Inject
public void setOutputLanguage(@Named(Constants.LANGUAGE_NAME) String outputLanguage) {
	if (!Strings.isNullOrEmpty(outputLanguage)) {
		final String[] parts = outputLanguage.split("\\.+"); //$NON-NLS-1$
		if (parts.length > 0) {
			final String simpleName = parts[parts.length - 1];
			if (!Strings.isNullOrEmpty(simpleName)) {
				this.languageName = simpleName;
				return;
			}
		}
	}
	this.languageName = null;
}
 
Example #5
Source File: AbstractContentAssistTestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFileExtensions(Binder binder) {
	if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null)
		binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("typesAssistTest");
}
 
Example #6
Source File: AbstractNoJdtTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureLanguageName(Binder binder) {
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.testlanguages.noJdt.NoJdtTestLanguage");
}
 
Example #7
Source File: AbstractFragmentTestLanguageExRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureLanguageName(Binder binder) {
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.parser.fragments.FragmentTestLanguageEx");
}
 
Example #8
Source File: AbstractRenameTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureLanguageName(Binder binder) {
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.ide.tests.testlanguage.RenameTestLanguage");
}
 
Example #9
Source File: AbstractBug377311TestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFileExtensions(Binder binder) {
	if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null)
		binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("bug377311testlanguage");
}
 
Example #10
Source File: AbstractBuilderTestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureLanguageName(Binder binder) {
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.builder.tests.BuilderTestLanguage");
}
 
Example #11
Source File: AbstractBug288734TestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureLanguageName(Binder binder) {
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.ui.tests.editor.contentassist.Bug288734TestLanguage");
}
 
Example #12
Source File: AbstractBug332217TestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureLanguageName(Binder binder) {
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.ui.tests.editor.contentassist.Bug332217TestLanguage");
}
 
Example #13
Source File: AbstractBug304681TestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFileExtensions(Binder binder) {
	if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null)
		binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("bug304681testlanguage");
}
 
Example #14
Source File: AbstractOptionalEmptyTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFileExtensions(Binder binder) {
	if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null)
		binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("optionalemptytestlanguage");
}
 
Example #15
Source File: AbstractSimpleBacktrackingBug325745TestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureLanguageName(Binder binder) {
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.parser.unorderedGroups.SimpleBacktrackingBug325745TestLanguage");
}
 
Example #16
Source File: AbstractBug303200TestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFileExtensions(Binder binder) {
	if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null)
		binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("bug303200testlanguage");
}
 
Example #17
Source File: AbstractEntitiesRuntimeModule.java    From xtext-web with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFileExtensions(Binder binder) {
	if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null)
		binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("entities");
}
 
Example #18
Source File: AbstractSyntacticSequencerTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureLanguageName(Binder binder) {
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.serializer.SyntacticSequencerTestLanguage");
}
 
Example #19
Source File: AbstractUnorderedGroupsTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureLanguageName(Binder binder) {
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.parser.unorderedGroups.UnorderedGroupsTestLanguage");
}
 
Example #20
Source File: AbstractStatemachineRuntimeModule.java    From xtext-web with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFileExtensions(Binder binder) {
	if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null)
		binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("statemachine");
}
 
Example #21
Source File: AbstractOptionalEmptyTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureLanguageName(Binder binder) {
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.testlanguages.OptionalEmptyTestLanguage");
}
 
Example #22
Source File: AbstractXtextTests.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
protected String getCurrentFileExtension() {
	String instance = getInjector().getInstance(Key.get(String.class,Names.named(Constants.FILE_EXTENSIONS)));
	if (instance.indexOf(',')==-1)
		return instance;
	return instance.split(",")[0];
}
 
Example #23
Source File: AbstractBug297105TestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureLanguageName(Binder binder) {
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.parser.terminalrules.Bug297105TestLanguage");
}
 
Example #24
Source File: AbstractContentAssistContextTestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureLanguageName(Binder binder) {
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.ui.tests.editor.contentassist.ContentAssistContextTestLanguage");
}
 
Example #25
Source File: AbstractFormatterTestLanguage2RuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFileExtensions(Binder binder) {
	if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null)
		binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("formattertestlanguage2");
}
 
Example #26
Source File: AbstractBacktrackingLexerTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFileExtensions(Binder binder) {
	if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null)
		binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("backtrackinglexertestlanguage");
}
 
Example #27
Source File: AbstractExUnorderedGroupsTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureLanguageName(Binder binder) {
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.parser.unorderedGroups.ExUnorderedGroupsTestLanguage");
}
 
Example #28
Source File: AbstractEnumRulesTestLanguageRuntimeModule.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public void configureLanguageName(Binder binder) {
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.enumrules.EnumRulesTestLanguage");
}
 
Example #29
Source File: AbstractIgnoreCaseLexerTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFileExtensions(Binder binder) {
	if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null)
		binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("ignorecaselexertestlanguage");
}
 
Example #30
Source File: AbstractBug305397RuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFileExtensions(Binder binder) {
	if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null)
		binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("bug305397");
}