Search in sources :

Example 1 with PreferenceKey

use of org.eclipse.xtext.preferences.PreferenceKey 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 2 with PreferenceKey

use of org.eclipse.xtext.preferences.PreferenceKey in project xtext-core by eclipse.

the class FormatterPreferenceValuesProvider method getPreferenceValues.

@Override
public IPreferenceValues getPreferenceValues(final Resource resource) {
    final IPreferenceValues preferenceValues = internalGetRawPreferenceValues(resource);
    final String indent = whitespaceInfo.getIndentationInformation(resource.getURI()).getIndentString();
    final String lineSep = whitespaceInfo.getLineSeparatorInformation(resource.getURI()).getLineSeparator();
    return new IPreferenceValues() {

        @Override
        public String getPreference(PreferenceKey key) {
            if (key == FormatterPreferenceKeys.indentation) {
                return indent;
            }
            if (key == FormatterPreferenceKeys.lineSeparator) {
                return lineSep;
            }
            return preferenceValues.getPreference(key);
        }
    };
}
Also used : IPreferenceValues(org.eclipse.xtext.preferences.IPreferenceValues) PreferenceKey(org.eclipse.xtext.preferences.PreferenceKey)

Aggregations

IPreferenceValues (org.eclipse.xtext.preferences.IPreferenceValues)2 PreferenceKey (org.eclipse.xtext.preferences.PreferenceKey)2 List (java.util.List)1 TaskTag (org.eclipse.xtext.tasks.TaskTag)1 TaskTags (org.eclipse.xtext.tasks.TaskTags)1 Procedure1 (org.eclipse.xtext.xbase.lib.Procedures.Procedure1)1