Java Code Examples for org.eclipse.xtext.Constants#LANGUAGE_NAME

The following examples show how to use org.eclipse.xtext.Constants#LANGUAGE_NAME . 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 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-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 3
Source File: XtextTemplateStore.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Inject
public XtextTemplateStore(ContextTypeRegistry registry, IPreferenceStore store, @Named(Constants.LANGUAGE_NAME) String key,
		AbstractUIPlugin plugin) {
	super(registry, store, key + ".templates");
	res = getTemplateFileURL(plugin);
	try {
		load();
	} catch (IOException e) {
		log.error(e.getMessage(), e);
	}
}
 
Example 4
Source File: AbstractValidPreferencePage.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Instantiates a new valid preference page for a given Xtext language.
 *
 * @param languageName
 *          the language name
 * @param fileExtensions
 *          the file extensions
 */
@Inject
public AbstractValidPreferencePage(@Named(Constants.LANGUAGE_NAME) final String languageName, @Named(Constants.FILE_EXTENSIONS) final String fileExtensions) {
  super();
  this.languageName = languageName;
  this.fileExtensions = fileExtensions;

  preferences = new ScopedPreferenceStore(InstanceScope.INSTANCE, getPreferenceStoreName());
  setPreferenceStore(preferences);
}
 
Example 5
Source File: ConfigurableTemplateStore.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings("PMD.ConstructorCallsOverridableMethod")
@Inject
public ConfigurableTemplateStore(final ContextTypeRegistry registry, final IPreferenceStore store, @Named(Constants.LANGUAGE_NAME) final String key, final AbstractUIPlugin plugin) {
  super(registry, store, key + ".templates"); //$NON-NLS-1$
  this.res = getTemplateFileURL(plugin);
  this.preferenceStore = store;
  this.key = key + ".sharedTemplates"; //$NON-NLS-1$
  try {
    load();
  } catch (IOException e) {
    LOG.error(e.getMessage(), e);
  }
}
 
Example 6
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 7
Source File: TaskTagConfigurationBlock.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public TaskTagConfigurationBlock(@Named(Constants.LANGUAGE_NAME) String languageName) {
	super();
	initialize();
}
 
Example 8
Source File: TaskTagPreferencePage.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public void setLanguageName(@Named(Constants.LANGUAGE_NAME) String languageName) {
	this.languageName = languageName;
}
 
Example 9
Source File: XtextEditor.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public void setLanguageName(@Named(Constants.LANGUAGE_NAME) String name) {
	this.languageName = name;
}
 
Example 10
Source File: PreferenceStoreAccessImpl.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public void setLanguageNameAsQualifier(@Named(Constants.LANGUAGE_NAME) String languageName) {
	this.qualifier = languageName;
}
 
Example 11
Source File: PreferenceStoreAccessor.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public PreferenceStoreAccessor(@Named(Constants.LANGUAGE_NAME) String languageName, IPreferenceStoreAccess scopedAccessor) {
	PREFERENCE_TAG = tokenTypeTag(languageName) + SEPARATOR;
	this.scopedAccessor = scopedAccessor;
}
 
Example 12
Source File: BuilderPreferencePage.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public void setLanguageName(@Named(Constants.LANGUAGE_NAME) String languageName) {
	this.languageName = languageName;
}
 
Example 13
Source File: GrammarProvider.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public GrammarProvider(@Named(Constants.LANGUAGE_NAME) String languageName, Provider<XtextResourceSet> resourceSetProvider) {
	this.languageName = languageName;
	this.resourceSetProvider = resourceSetProvider;
}
 
Example 14
Source File: AbstractExtraLanguagePropertyPage.java    From sarl with Apache License 2.0 4 votes vote down vote up
/** Set the language name.
 *
 * @param languageName the name.
 */
@Inject
public void setLanguageName(@Named(Constants.LANGUAGE_NAME) String languageName) {
	this.languageName = languageName;
}