Search in sources :

Example 1 with TaskTag

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

the class DefaultTaskFinderTest method test.

@Test
public void test() {
    try {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("//TODO foo");
        _builder.newLine();
        _builder.append("/*");
        _builder.newLine();
        _builder.append(" ");
        _builder.append("* FIXME bar");
        _builder.newLine();
        _builder.append(" ");
        _builder.append("* Fixme no match");
        _builder.newLine();
        _builder.append(" ");
        _builder.append("* FOO also no match");
        _builder.newLine();
        _builder.append(" ");
        _builder.append("*/");
        _builder.newLine();
        _builder.append("/* TODO Get rid of this */");
        _builder.newLine();
        _builder.append("Hello notATODO!");
        _builder.newLine();
        Task _task = new Task();
        final Procedure1<Task> _function = (Task it) -> {
            TaskTag _taskTag = new TaskTag();
            final Procedure1<TaskTag> _function_1 = (TaskTag it_1) -> {
                it_1.setName("TODO");
                it_1.setPriority(Priority.NORMAL);
            };
            TaskTag _doubleArrow = ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag, _function_1);
            it.setTag(_doubleArrow);
            it.setDescription(" foo");
            it.setOffset(2);
            it.setLineNumber(1);
        };
        Task _doubleArrow = ObjectExtensions.<Task>operator_doubleArrow(_task, _function);
        Task _task_1 = new Task();
        final Procedure1<Task> _function_1 = (Task it) -> {
            TaskTag _taskTag = new TaskTag();
            final Procedure1<TaskTag> _function_2 = (TaskTag it_1) -> {
                it_1.setName("FIXME");
                it_1.setPriority(Priority.HIGH);
            };
            TaskTag _doubleArrow_1 = ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag, _function_2);
            it.setTag(_doubleArrow_1);
            it.setDescription(" bar");
            it.setOffset(17);
            it.setLineNumber(3);
        };
        Task _doubleArrow_1 = ObjectExtensions.<Task>operator_doubleArrow(_task_1, _function_1);
        Task _task_2 = new Task();
        final Procedure1<Task> _function_2 = (Task it) -> {
            TaskTag _taskTag = new TaskTag();
            final Procedure1<TaskTag> _function_3 = (TaskTag it_1) -> {
                it_1.setName("TODO");
                it_1.setPriority(Priority.NORMAL);
            };
            TaskTag _doubleArrow_2 = ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag, _function_3);
            it.setTag(_doubleArrow_2);
            it.setDescription(" Get rid of this ");
            it.setOffset(73);
            it.setLineNumber(7);
        };
        Task _doubleArrow_2 = ObjectExtensions.<Task>operator_doubleArrow(_task_2, _function_2);
        this.assertContainsTasks(this.getResourceFromString(LineDelimiters.toUnix(_builder.toString())), Collections.<Task>unmodifiableList(CollectionLiterals.<Task>newArrayList(_doubleArrow, _doubleArrow_1, _doubleArrow_2)));
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : Task(org.eclipse.xtext.tasks.Task) TaskTag(org.eclipse.xtext.tasks.TaskTag) Procedure1(org.eclipse.xtext.xbase.lib.Procedures.Procedure1) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test)

Example 2 with TaskTag

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

the class DefaultTaskTagProvider method getTaskTags.

@Override
public TaskTags getTaskTags(final Resource resouce) {
    TaskTags _taskTags = new TaskTags();
    final Procedure1<TaskTags> _function = (TaskTags it) -> {
        it.setCaseSensitive(true);
        List<TaskTag> _taskTags_1 = it.getTaskTags();
        TaskTag _taskTag = new TaskTag();
        final Procedure1<TaskTag> _function_1 = (TaskTag it_1) -> {
            it_1.setName("TODO");
            it_1.setPriority(Priority.NORMAL);
        };
        TaskTag _doubleArrow = ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag, _function_1);
        TaskTag _taskTag_1 = new TaskTag();
        final Procedure1<TaskTag> _function_2 = (TaskTag it_1) -> {
            it_1.setName("FIXME");
            it_1.setPriority(Priority.HIGH);
        };
        TaskTag _doubleArrow_1 = ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag_1, _function_2);
        TaskTag _taskTag_2 = new TaskTag();
        final Procedure1<TaskTag> _function_3 = (TaskTag it_1) -> {
            it_1.setName("XXX");
            it_1.setPriority(Priority.NORMAL);
        };
        TaskTag _doubleArrow_2 = ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag_2, _function_3);
        Iterables.<TaskTag>addAll(_taskTags_1, Collections.<TaskTag>unmodifiableList(CollectionLiterals.<TaskTag>newArrayList(_doubleArrow, _doubleArrow_1, _doubleArrow_2)));
    };
    return ObjectExtensions.<TaskTags>operator_doubleArrow(_taskTags, _function);
}
Also used : TaskTag(org.eclipse.xtext.tasks.TaskTag) Procedure1(org.eclipse.xtext.xbase.lib.Procedures.Procedure1) TaskTags(org.eclipse.xtext.tasks.TaskTags) List(java.util.List)

Example 3 with TaskTag

use of org.eclipse.xtext.tasks.TaskTag in project xtext-xtend by eclipse.

the class XtendTaskTagProvider method getTaskTags.

@Override
public TaskTags getTaskTags(final Resource resource) {
    TaskTags _xblockexpression = null;
    {
        final IPreferenceValues prefs = this.preferenceValuesProvider.getPreferenceValues(resource);
        PreferenceKey _preferenceKey = new PreferenceKey(JavaCore.COMPILER_TASK_TAGS, "TODO,FIXME,XXX");
        final String namePref = prefs.getPreference(_preferenceKey);
        PreferenceKey _preferenceKey_1 = new PreferenceKey(JavaCore.COMPILER_TASK_PRIORITIES, "NORMAL,HIGH,NORMAL");
        final String prioritiesPref = prefs.getPreference(_preferenceKey_1);
        PreferenceKey _preferenceKey_2 = new PreferenceKey(JavaCore.COMPILER_TASK_CASE_SENSITIVE, JavaCore.ENABLED);
        final String caseSensitivePref = prefs.getPreference(_preferenceKey_2);
        final List<TaskTag> tags = PreferenceTaskTagProvider.parseTags(namePref, prioritiesPref);
        TaskTags _taskTags = new TaskTags();
        final Procedure1<TaskTags> _function = (TaskTags it) -> {
            List<TaskTag> _taskTags_1 = it.getTaskTags();
            Iterables.<TaskTag>addAll(_taskTags_1, tags);
            it.setCaseSensitive(caseSensitivePref.equals(JavaCore.ENABLED));
        };
        _xblockexpression = ObjectExtensions.<TaskTags>operator_doubleArrow(_taskTags, _function);
    }
    return _xblockexpression;
}
Also used : TaskTag(org.eclipse.xtext.tasks.TaskTag) IPreferenceValues(org.eclipse.xtext.preferences.IPreferenceValues) Procedure1(org.eclipse.xtext.xbase.lib.Procedures.Procedure1) TaskTags(org.eclipse.xtext.tasks.TaskTags) PreferenceKey(org.eclipse.xtext.preferences.PreferenceKey) List(java.util.List)

Example 4 with TaskTag

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

the class DefaultTaskFinderTest method testSpecialEndTag.

@Test
public void testSpecialEndTag() {
    try {
        this.with(DefaultTaskFinderTest.NoJdtTestLanguageStandaloneSetupCustom.class);
        this.finder = this.<DefaultTaskFinder>get(DefaultTaskFinder.class);
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("/* TODO Get rid of this ***/");
        _builder.newLine();
        _builder.append("Hello notATODO!");
        _builder.newLine();
        Task _task = new Task();
        final Procedure1<Task> _function = (Task it) -> {
            TaskTag _taskTag = new TaskTag();
            final Procedure1<TaskTag> _function_1 = (TaskTag it_1) -> {
                it_1.setName("TODO");
                it_1.setPriority(Priority.NORMAL);
            };
            TaskTag _doubleArrow = ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag, _function_1);
            it.setTag(_doubleArrow);
            it.setDescription(" Get rid of this ");
            it.setOffset(3);
            it.setLineNumber(1);
        };
        Task _doubleArrow = ObjectExtensions.<Task>operator_doubleArrow(_task, _function);
        this.assertContainsTasks(this.getResourceFromString(LineDelimiters.toUnix(_builder.toString())), Collections.<Task>unmodifiableList(CollectionLiterals.<Task>newArrayList(_doubleArrow)));
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : DefaultTaskFinder(org.eclipse.xtext.tasks.DefaultTaskFinder) Task(org.eclipse.xtext.tasks.Task) TaskTag(org.eclipse.xtext.tasks.TaskTag) Procedure1(org.eclipse.xtext.xbase.lib.Procedures.Procedure1) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test)

Example 5 with TaskTag

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

the class DefaultTaskParserTest method testCaseSensitve.

@Test
public void testCaseSensitve() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("/* TODO this is a task");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("* FIXME this cannot work");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("* XXX: god, this is bad");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("* TODO");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("* FixMe this should not match");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("*/");
    _builder.newLine();
    Task _task = new Task();
    final Procedure1<Task> _function = (Task it) -> {
        TaskTag _taskTag = new TaskTag();
        final Procedure1<TaskTag> _function_1 = (TaskTag it_1) -> {
            it_1.setName("TODO");
            it_1.setPriority(Priority.NORMAL);
        };
        TaskTag _doubleArrow = ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag, _function_1);
        it.setTag(_doubleArrow);
        it.setDescription(" this is a task");
        it.setLineNumber(1);
        it.setOffset(3);
    };
    Task _doubleArrow = ObjectExtensions.<Task>operator_doubleArrow(_task, _function);
    Task _task_1 = new Task();
    final Procedure1<Task> _function_1 = (Task it) -> {
        TaskTag _taskTag = new TaskTag();
        final Procedure1<TaskTag> _function_2 = (TaskTag it_1) -> {
            it_1.setName("FIXME");
            it_1.setPriority(Priority.HIGH);
        };
        TaskTag _doubleArrow_1 = ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag, _function_2);
        it.setTag(_doubleArrow_1);
        it.setDescription(" this cannot work");
        it.setLineNumber(2);
        it.setOffset(26);
    };
    Task _doubleArrow_1 = ObjectExtensions.<Task>operator_doubleArrow(_task_1, _function_1);
    Task _task_2 = new Task();
    final Procedure1<Task> _function_2 = (Task it) -> {
        TaskTag _taskTag = new TaskTag();
        final Procedure1<TaskTag> _function_3 = (TaskTag it_1) -> {
            it_1.setName("XXX");
            it_1.setPriority(Priority.NORMAL);
        };
        TaskTag _doubleArrow_2 = ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag, _function_3);
        it.setTag(_doubleArrow_2);
        it.setDescription(": god, this is bad");
        it.setLineNumber(3);
        it.setOffset(52);
    };
    Task _doubleArrow_2 = ObjectExtensions.<Task>operator_doubleArrow(_task_2, _function_2);
    Task _task_3 = new Task();
    final Procedure1<Task> _function_3 = (Task it) -> {
        TaskTag _taskTag = new TaskTag();
        final Procedure1<TaskTag> _function_4 = (TaskTag it_1) -> {
            it_1.setName("TODO");
            it_1.setPriority(Priority.NORMAL);
        };
        TaskTag _doubleArrow_3 = ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag, _function_4);
        it.setTag(_doubleArrow_3);
        it.setDescription("");
        it.setLineNumber(4);
        it.setOffset(77);
    };
    Task _doubleArrow_3 = ObjectExtensions.<Task>operator_doubleArrow(_task_3, _function_3);
    this.assertContainsTasks(_builder, Collections.<Task>unmodifiableList(CollectionLiterals.<Task>newArrayList(_doubleArrow, _doubleArrow_1, _doubleArrow_2, _doubleArrow_3)));
}
Also used : Task(org.eclipse.xtext.tasks.Task) TaskTag(org.eclipse.xtext.tasks.TaskTag) Procedure1(org.eclipse.xtext.xbase.lib.Procedures.Procedure1) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test)

Aggregations

TaskTag (org.eclipse.xtext.tasks.TaskTag)8 Procedure1 (org.eclipse.xtext.xbase.lib.Procedures.Procedure1)7 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)5 Task (org.eclipse.xtext.tasks.Task)5 Test (org.junit.Test)5 List (java.util.List)2 TaskTags (org.eclipse.xtext.tasks.TaskTags)2 XtendFile (org.eclipse.xtend.core.xtend.XtendFile)1 IPreferenceValues (org.eclipse.xtext.preferences.IPreferenceValues)1 PreferenceKey (org.eclipse.xtext.preferences.PreferenceKey)1 DefaultTaskFinder (org.eclipse.xtext.tasks.DefaultTaskFinder)1