org.eclipse.xtext.preferences.IPreferenceValuesProvider Java Examples

The following examples show how to use org.eclipse.xtext.preferences.IPreferenceValuesProvider. 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: Formatter2Fragment.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Set<Binding> getGuiceBindingsRt(Grammar grammar) {
	StringBuilder cfg = new StringBuilder();
	cfg.append("binder.bind(");
	cfg.append(IPreferenceValuesProvider.class.getName());
	cfg.append(".class)");
	cfg.append(".annotatedWith(");
	cfg.append(FormatterPreferences.class.getName());
	cfg.append(".class)");
	cfg.append(".to(");
	cfg.append(FormatterPreferenceValuesProvider.class.getName());
	cfg.append(".class);");
	BindFactory bf = new BindFactory();
	bf.addTypeToType(IFormatter2.class.getName(), stubGenerator.getStubQualifiedName());
	bf.addConfiguredBinding(FormatterPreferences.class.getName(), cfg.toString());
	return bf.getBindings();
}
 
Example #2
Source File: ConfigurableIssueSeveritiesProvider.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
protected IPreferenceValuesProvider getValuesProvider() {
	final IPreferenceValuesProvider original = super.getValuesProvider();
	if (this.overridingSeverities.isEmpty()) {
		return original;
	}
	return new ConfigurableValueProvider(original, this.overridingSeverities);
}
 
Example #3
Source File: Formatter2Fragment2.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void generate() {
  boolean _isGenerateStub = this.isGenerateStub();
  boolean _not = (!_isGenerateStub);
  if (_not) {
    return;
  }
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("binder.bind(");
      _builder.append(IPreferenceValuesProvider.class);
      _builder.append(".class).annotatedWith(");
      _builder.append(FormatterPreferences.class);
      _builder.append(".class).to(");
      _builder.append(FormatterPreferenceValuesProvider.class);
      _builder.append(".class);");
    }
  };
  final StringConcatenationClient statement = _client;
  new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(IFormatter2.class), this.getFormatter2Stub(this.getLanguage().getGrammar())).addConfiguredBinding(FormatterPreferences.class.getSimpleName(), statement).contributeTo(this.getLanguage().getRuntimeGenModule());
  new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.formatting.IContentFormatterFactory"), 
    TypeReference.typeRef("org.eclipse.xtext.ui.editor.formatting2.ContentFormatterFactory")).contributeTo(this.getLanguage().getEclipsePluginGenModule());
  ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest();
  boolean _tripleNotEquals = (_manifest != null);
  if (_tripleNotEquals) {
    Set<String> _exportedPackages = this.getProjectConfig().getRuntime().getManifest().getExportedPackages();
    String _runtimeBasePackage = this._xtextGeneratorNaming.getRuntimeBasePackage(this.getGrammar());
    String _plus = (_runtimeBasePackage + ".formatting2");
    _exportedPackages.add(_plus);
  }
  this.doGenerateStubFile();
}
 
Example #4
Source File: Issue1161Test.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Injector createInjector() {
	XtextRuntimeModule module = new XtextRuntimeModule() {
		@SuppressWarnings("unused")
		public Class<? extends IPreferenceValuesProvider> bindIPreferenceValuesProvider() {
			return IPreferenceValuesProvider.SingletonPreferenceValuesProvider.class;
		}
	};
	return Guice.createInjector(module);
}
 
Example #5
Source File: PreferenceTaskTagProviderTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void test() {
	TaskTag taskTag1 = new TaskTag();
	taskTag1.setName("Foo");
	taskTag1.setPriority(Priority.LOW);
	TaskTag taskTag2 = new TaskTag();
	taskTag2.setName("BAR");
	taskTag2.setPriority(Priority.NORMAL);
	TaskTag taskTag3 = new TaskTag();
	taskTag3.setName("baZ");
	taskTag3.setPriority(Priority.HIGH);
	List<TaskTag> tags = Lists.newArrayList(taskTag1, taskTag2, taskTag3);
	String names = PreferenceTaskTagProvider.serializeTags(tags);
	String prios = PreferenceTaskTagProvider.serializePriorities(tags);
	IPreferenceValuesProvider.SingletonPreferenceValuesProvider valueProvider = new IPreferenceValuesProvider.SingletonPreferenceValuesProvider();
	MapBasedPreferenceValues values = valueProvider.getPreferenceValues(null);
	values.put(PreferenceTaskTagProvider.TAGS_KEY.getId(), names);
	values.put(PreferenceTaskTagProvider.PRIORITIES_KEY.getId(), prios);
	values.put(PreferenceTaskTagProvider.CASE_SENSITIVE_KEY.getId(), "false");
	PreferenceTaskTagProvider tagProvider = new PreferenceTaskTagProvider();
	tagProvider.setPreferenceValuesProvider(valueProvider);
	TaskTags parsedTags = tagProvider.getTaskTags(null);
	Assert.assertEquals(Boolean.valueOf(false), Boolean.valueOf(parsedTags.isCaseSensitive()));
	Assert.assertEquals(tags.size(), IterableExtensions.size(parsedTags));
	int _size = tags.size();
	for (int i = 0; i < _size; i++) {
		Assert.assertEquals(tags.get(i), Iterables.get(parsedTags, i));
	}
}
 
Example #6
Source File: UIConfigurableIssueSeveritiesProvider.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
protected IPreferenceValuesProvider getValuesProvider() {
	final IPreferenceValuesProvider original = super.getValuesProvider();
	if (this.overridingSeverities.isEmpty()) {
		return original;
	}
	return new ConfigurableValueProvider(original, this.overridingSeverities);
}
 
Example #7
Source File: N4JSRuntimeModule.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/** Configures the formatter preference value provider */
@Override
public void configureFormatterPreferences(Binder binder) {
	binder
			.bind(IPreferenceValuesProvider.class)
			.annotatedWith(FormatterPreferences.class)
			.to(N4JSSimpleFormattingPreferenceProvider.class);
}
 
Example #8
Source File: SemverIssueSeveritiesProvider.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected IPreferenceValuesProvider getValuesProvider() {
	return valuesProvider;
}
 
Example #9
Source File: XbaseInjectorProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPreferenceValuesProvider> bindIPreferenceValuesProvider() {
	return SingletonPreferenceValuesProvider.class;
}
 
Example #10
Source File: RuntimeTestSetup.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPreferenceValuesProvider> bindIPreferenceValuesProvider() {
	return SingletonPreferenceValuesProvider.class;
}
 
Example #11
Source File: RuntimeTestSetup.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IPreferenceValuesProvider> bindIPreferenceValuesProvider() {
	return SingletonPreferenceValuesProvider.class;
}
 
Example #12
Source File: ValidationIssue397Test.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public MapBasedPreferenceValues setPreferences(final IPreferenceValuesProvider.SingletonPreferenceValuesProvider prefProvider) {
  return this.preferences = prefProvider.getPreferenceValues(null);
}
 
Example #13
Source File: AbstractXtendRuntimeModule.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFormatterPreferences(Binder binder) {
	binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class);
}
 
Example #14
Source File: IssueSeveritiesProvider.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
protected IPreferenceValuesProvider getValuesProvider() {
	return valuesProvider;
}
 
Example #15
Source File: PreferenceTaskTagProvider.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public void setPreferenceValuesProvider(IPreferenceValuesProvider preferenceValuesProvider) {
	this.preferenceValuesProvider = preferenceValuesProvider;
}
 
Example #16
Source File: AbstractPartialSerializationTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFormatterPreferences(Binder binder) {
	binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class);
}
 
Example #17
Source File: AbstractFileAwareTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFormatterPreferences(Binder binder) {
	binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class);
}
 
Example #18
Source File: AbstractSimpleBeeLangTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFormatterPreferences(Binder binder) {
	binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class);
}
 
Example #19
Source File: AbstractSARLRuntimeModule.java    From sarl with Apache License 2.0 4 votes vote down vote up
public void configureFormatterPreferences(Binder binder) {
	binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class);
}
 
Example #20
Source File: AbstractBeeLangTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFormatterPreferences(Binder binder) {
	binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class);
}
 
Example #21
Source File: AbstractExBeeLangTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFormatterPreferences(Binder binder) {
	binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class);
}
 
Example #22
Source File: AbstractNoJdtTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFormatterPreferences(Binder binder) {
	binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class);
}
 
Example #23
Source File: Issue1161Test.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Before
public void setPreferences() {
	preferences = get(IPreferenceValuesProvider.SingletonPreferenceValuesProvider.class).getPreferenceValues(null);
}
 
Example #24
Source File: ContentFormatter.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public IPreferenceValuesProvider getPreferencesProvider() {
	return preferencesProvider;
}
 
Example #25
Source File: AbstractTypeExpressionsRuntimeModule.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
public void configureFormatterPreferences(Binder binder) {
	binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class);
}
 
Example #26
Source File: AbstractN4JSRuntimeModule.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
public void configureFormatterPreferences(Binder binder) {
	binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class);
}
 
Example #27
Source File: N4JSIssueSeveritiesProvider.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected IPreferenceValuesProvider getValuesProvider() {
	return valuesProvider;
}
 
Example #28
Source File: AbstractJSONRuntimeModule.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
public void configureFormatterPreferences(Binder binder) {
	binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class);
}
 
Example #29
Source File: JSONIssueSeveritiesProvider.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected IPreferenceValuesProvider getValuesProvider() {
	return valuesProvider;
}
 
Example #30
Source File: AbstractPureXbaseRuntimeModule.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public void configureFormatterPreferences(Binder binder) {
	binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class);
}