org.eclipse.xtext.preferences.IPreferenceValues Java Examples
The following examples show how to use
org.eclipse.xtext.preferences.IPreferenceValues.
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: SarlTaskTagProvider.java From sarl with Apache License 2.0 | 6 votes |
@Override public TaskTags getTaskTags(Resource resource) { final IPreferenceValues prefs = this.preferenceValuesProvider.getPreferenceValues(resource); final String namePref = prefs.getPreference(new PreferenceKey( JavaCore.COMPILER_TASK_TAGS, "TODO,FIXME,XXX")); //$NON-NLS-1$ final String prioritiesPref = prefs.getPreference(new PreferenceKey( JavaCore.COMPILER_TASK_PRIORITIES, "NORMAL,HIGH,NORMAL")); //$NON-NLS-1$ final String caseSensitivePref = prefs.getPreference(new PreferenceKey( JavaCore.COMPILER_TASK_CASE_SENSITIVE, JavaCore.ENABLED)); final List<TaskTag> tags = PreferenceTaskTagProvider.parseTags(namePref, prioritiesPref); final TaskTags taskTags = new TaskTags(); taskTags.setCaseSensitive(caseSensitivePref.equals(JavaCore.ENABLED)); taskTags.getTaskTags().addAll(tags); return taskTags; }
Example #2
Source File: FormatterPreferenceValuesProvider.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@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); } }; }
Example #3
Source File: N4JSSimpleFormattingPreferenceProvider.java From n4js with Eclipse Public License 1.0 | 6 votes |
@Override public IPreferenceValues getPreferenceValues(Resource context) { final IPreferenceValues preferenceValues = super.getPreferenceValues(context); return new IPreferenceValues() { @Override public String getPreference(PreferenceKey key) { if (key == N4JSFormatterPreferenceKeys.FORMAT_PARENTHESIS) { return Boolean.TRUE.toString(); // TODO make this configurable, see super-class } if (key == N4JSFormatterPreferenceKeys.FORMAT_SURROUND_PAREN_CONTENT_WITH_SPACE) { return Boolean.FALSE.toString(); // TODO make this configurable, see super-class } return preferenceValues.getPreference(key); } }; }
Example #4
Source File: XtendTaskTagProvider.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@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; }
Example #5
Source File: ImportSpacerUserPreferenceHelper.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** Compute user preference regarding space between import specifiers and curly brace. */ public String getSpacingPreference(Resource resource) { IPreferenceValues prefValues = formattingPreferenceProvider.getPreferenceValues(resource); String spacePreference = prefValues.getPreference( N4JSFormatterPreferenceKeys.FORMAT_SURROUND_IMPORT_LIST_WITH_SPACE); return Boolean.valueOf(spacePreference) ? " " : ""; }
Example #6
Source File: FormattingUserPreferenceHelper.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** Compute user preference regarding space between import specifiers and curly brace. */ public String getSpacingPreference(Resource resource) { IPreferenceValues prefValues = formattingPreferenceProvider.getPreferenceValues(resource); String spacePreference = prefValues.getPreference( N4JSFormatterPreferenceKeys.FORMAT_SURROUND_IMPORT_LIST_WITH_SPACE); return Boolean.valueOf(spacePreference) ? " " : ""; }
Example #7
Source File: PreferenceTaskTagProvider.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override public TaskTags getTaskTags(Resource resource) { IPreferenceValues prefs = this.preferenceValuesProvider.getPreferenceValues(resource); String names = prefs.getPreference(PreferenceTaskTagProvider.TAGS_KEY); String priorities = prefs.getPreference(PreferenceTaskTagProvider.PRIORITIES_KEY); TaskTags taskTags = new TaskTags(); taskTags.setCaseSensitive(Boolean.valueOf(prefs.getPreference(PreferenceTaskTagProvider.CASE_SENSITIVE_KEY))); List<TaskTag> tags = PreferenceTaskTagProvider.parseTags(names, priorities); taskTags.getTaskTags().addAll(tags); return taskTags; }
Example #8
Source File: EclipsePreferencesProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public IPreferenceValues getPreferenceValues(Resource context) { final IProject project = getProject(context); final IPreferenceStore store = project != null ? access.getContextPreferenceStore(project) : access.getPreferenceStore(); final Map<String, String> preferenceCache = Maps.newHashMap(); return new IPreferenceValues() { @Override public String getPreference(PreferenceKey key) { try { String id = key.getId(); String string = preferenceCache.get(id); if (string == null) { string = store.getString(id); preferenceCache.put(id, string); } return org.eclipse.jface.preference.IPreferenceStore.STRING_DEFAULT_DEFAULT.equals(string) ? key.getDefaultValue() : string; } catch (Exception e) { log.error("Error getting preference for key '"+key.getId()+"'.", e); return key.getDefaultValue(); } } }; }
Example #9
Source File: ContentFormatter.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected void initRequest(IXtextDocument document, IRegion region, XtextResource resource, FormatterRequest request) { ITextRegion textRegion = new TextRegion(region.getOffset(), region.getLength()); request.setAllowIdentityEdits(false); request.setFormatUndefinedHiddenRegionsOnly(false); request.setRegions(singletonList(textRegion)); ITextRegionAccess tokenAccess = regionBuilder.forNodeModel(resource).create(); IPreferenceValues preferenceValues = preferencesProvider.getPreferenceValues(resource); request.setPreferences(TypedPreferenceValues.castOrWrap(preferenceValues)); request.setTextRegionAccess(tokenAccess); if (tokenAccess.hasSyntaxError()) request.setExceptionHandler(ExceptionAcceptor.IGNORING); else request.setExceptionHandler(ExceptionAcceptor.LOGGING); }
Example #10
Source File: SemverIssueSeveritiesProvider.java From n4js with Eclipse Public License 1.0 | 4 votes |
@Override public SemverIssueSeverities getIssueSeverities(Resource context) { IPreferenceValues preferenceValues = new MapBasedPreferenceValues(Maps.<String, String> newLinkedHashMap()); Map<String, PreferenceKey> issueCodes = issueCodesProvider.getConfigurableIssueCodes(); return new SemverIssueSeverities(preferenceValues, issueCodes, severityConverter); }
Example #11
Source File: ConfigurableIssueSeveritiesProvider.java From sarl with Apache License 2.0 | 4 votes |
@Override public IPreferenceValues getPreferenceValues(Resource context) { final IPreferenceValues values = this.original.getPreferenceValues(context); return new ConfigurableValues(values, this.overridingSeverities); }
Example #12
Source File: FormatterPreferenceValuesProvider.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected IPreferenceValues internalGetRawPreferenceValues(final Resource resource) { return valuesProvider.getPreferenceValues(resource); }
Example #13
Source File: IssueSeveritiesProvider.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public IssueSeverities getIssueSeverities(Resource context) { IPreferenceValues preferenceValues = getValuesProvider().getPreferenceValues(context); return new IssueSeverities(preferenceValues, issueCodesProvider.getConfigurableIssueCodes(), severityConverter); }
Example #14
Source File: IssueSeverities.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public IssueSeverities(IPreferenceValues preferenceValues, Map<String, PreferenceKey> configurableIssueCodes, SeverityConverter converter) { this.preferenceValues = preferenceValues; this.configurableIssueCodes = configurableIssueCodes; this.converter = converter; }
Example #15
Source File: FormattingPreferenceValues.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
public FormattingPreferenceValues(IPreferenceValues values) { super(); this.values = values; }
Example #16
Source File: JSONIssueSeveritiesProvider.java From n4js with Eclipse Public License 1.0 | 4 votes |
@Override public JSONIssueSeverities getIssueSeverities(Resource context) { IPreferenceValues preferenceValues = valuesProvider.getPreferenceValues(context); return new JSONIssueSeverities(preferenceValues, issueCodesProvider.getConfigurableIssueCodes(), severityConverter); }
Example #17
Source File: JSONIssueSeverities.java From n4js with Eclipse Public License 1.0 | 4 votes |
@SuppressWarnings("javadoc") public JSONIssueSeverities(IPreferenceValues preferenceValues, Map<String, PreferenceKey> configurableIssueCodes, SeverityConverter converter) { super(preferenceValues, configurableIssueCodes, converter); this.configurableIssueCodes = configurableIssueCodes; }
Example #18
Source File: N4JSIssueSeveritiesProvider.java From n4js with Eclipse Public License 1.0 | 4 votes |
@Override public N4JSIssueSeverities getIssueSeverities(Resource context) { IPreferenceValues preferenceValues = valuesProvider.getPreferenceValues(context); return new N4JSIssueSeverities(preferenceValues, issueCodesProvider.getConfigurableIssueCodes(), severityConverter); }
Example #19
Source File: N4JSIssueSeverities.java From n4js with Eclipse Public License 1.0 | 4 votes |
@SuppressWarnings("javadoc") public N4JSIssueSeverities(IPreferenceValues preferenceValues, Map<String, PreferenceKey> configurableIssueCodes, SeverityConverter converter) { super(preferenceValues, configurableIssueCodes, converter); this.configurableIssueCodes = configurableIssueCodes; }
Example #20
Source File: SemverIssueSeverities.java From n4js with Eclipse Public License 1.0 | 4 votes |
@SuppressWarnings("javadoc") public SemverIssueSeverities(IPreferenceValues preferenceValues, Map<String, PreferenceKey> configurableIssueCodes, SeverityConverter converter) { super(preferenceValues, configurableIssueCodes, converter); this.configurableIssueCodes = configurableIssueCodes; }
Example #21
Source File: N4JSPreferenceAccess.java From n4js with Eclipse Public License 1.0 | 3 votes |
/** * @param resource * the current resource, this will be used to calculate the preference store to access (e.g. if there are * project specific preferences configured). * @param compilerID * the compiler id * @param compilerProperty * the compiler property to ask for * @param defaultDescriptor * the descriptor containing the default values to be used as fall back if there isn't a value in the * preference store * @return the preference value found in the preference store or any other values provider or the default value out * of the default descriptor */ public String getPreference(Resource resource, String compilerID, CompilerProperties compilerProperty, CompilerDescriptor defaultDescriptor) { IPreferenceValues preferences = valuesProvider.getPreferenceValues(resource); PreferenceKey key = new PreferenceKey(compilerProperty.getKey(compilerID), String.valueOf(compilerProperty.getValueInCompilerDescriptor(defaultDescriptor, compilerID))); return preferences.getPreference(key); }
Example #22
Source File: ConfigurableIssueSeveritiesProvider.java From sarl with Apache License 2.0 | 2 votes |
/** Constructor. * * @param original the original values. * @param overridingSeverities the overridings. */ public ConfigurableValues(IPreferenceValues original, Map<String, Severity> overridingSeverities) { this.original = original; this.overridingSeverities = overridingSeverities; }