Search in sources :

Example 1 with PreferenceTaskTagProvider

use of org.eclipse.xtext.tasks.PreferenceTaskTagProvider in project xtext-core by eclipse.

the class PreferenceTaskTagProviderTest method test.

@Test
public void test() {
    TaskTag _taskTag = new TaskTag();
    final Procedure1<TaskTag> _function = (TaskTag it) -> {
        it.setName("Foo");
        it.setPriority(Priority.LOW);
    };
    TaskTag _doubleArrow = ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag, _function);
    TaskTag _taskTag_1 = new TaskTag();
    final Procedure1<TaskTag> _function_1 = (TaskTag it) -> {
        it.setName("BAR");
        it.setPriority(Priority.NORMAL);
    };
    TaskTag _doubleArrow_1 = ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag_1, _function_1);
    TaskTag _taskTag_2 = new TaskTag();
    final Procedure1<TaskTag> _function_2 = (TaskTag it) -> {
        it.setName("baZ");
        it.setPriority(Priority.HIGH);
    };
    TaskTag _doubleArrow_2 = ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag_2, _function_2);
    final List<TaskTag> tags = Collections.<TaskTag>unmodifiableList(CollectionLiterals.<TaskTag>newArrayList(_doubleArrow, _doubleArrow_1, _doubleArrow_2));
    final String names = PreferenceTaskTagProvider.serializeTags(tags);
    final String prios = PreferenceTaskTagProvider.serializePriorities(tags);
    final IPreferenceValuesProvider.SingletonPreferenceValuesProvider valueProvider = new IPreferenceValuesProvider.SingletonPreferenceValuesProvider();
    final 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");
    final PreferenceTaskTagProvider tagProvider = new PreferenceTaskTagProvider();
    tagProvider.setPreferenceValuesProvider(valueProvider);
    final 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();
    ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
    for (final Integer i : _doubleDotLessThan) {
        TaskAssert.assertExactMatch(tags.get((i).intValue()), ((TaskTag[]) Conversions.unwrapArray(parsedTags, TaskTag.class))[(i).intValue()]);
    }
}
Also used : TaskTag(org.eclipse.xtext.tasks.TaskTag) MapBasedPreferenceValues(org.eclipse.xtext.preferences.MapBasedPreferenceValues) ExclusiveRange(org.eclipse.xtext.xbase.lib.ExclusiveRange) IPreferenceValuesProvider(org.eclipse.xtext.preferences.IPreferenceValuesProvider) PreferenceTaskTagProvider(org.eclipse.xtext.tasks.PreferenceTaskTagProvider) TaskTags(org.eclipse.xtext.tasks.TaskTags) Test(org.junit.Test)

Aggregations

IPreferenceValuesProvider (org.eclipse.xtext.preferences.IPreferenceValuesProvider)1 MapBasedPreferenceValues (org.eclipse.xtext.preferences.MapBasedPreferenceValues)1 PreferenceTaskTagProvider (org.eclipse.xtext.tasks.PreferenceTaskTagProvider)1 TaskTag (org.eclipse.xtext.tasks.TaskTag)1 TaskTags (org.eclipse.xtext.tasks.TaskTags)1 ExclusiveRange (org.eclipse.xtext.xbase.lib.ExclusiveRange)1 Test (org.junit.Test)1