Java Code Examples for org.eclipse.xtext.preferences.IPreferenceValuesProvider#SingletonPreferenceValuesProvider

The following examples show how to use org.eclipse.xtext.preferences.IPreferenceValuesProvider#SingletonPreferenceValuesProvider . 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: 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 2
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 3
Source File: CheckExceptionValidationTest.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public void setPreferences(IPreferenceValuesProvider.SingletonPreferenceValuesProvider prefProvider) {
	this.preferences = prefProvider.getPreferenceValues(null);
}
 
Example 4
Source File: CodeStyleValidationTest.java    From xtext-extras 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 5
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);
}