use of org.eclipse.core.runtime.preferences.InstanceScope in project webtools.sourceediting by eclipse.
the class AbstractDocumentLoader method getPlatformLineDelimiterPreference.
/**
* Returns the default line delimiter preference for the given file.
*
* @param file
* the file
* @return the default line delimiter
* @since 3.1
*/
private String getPlatformLineDelimiterPreference(IFile file) {
IScopeContext[] scopeContext;
if (file != null && file.getProject() != null) {
// project preference
scopeContext = new IScopeContext[] { new ProjectScope(file.getProject()) };
String lineDelimiter = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext);
if (lineDelimiter != null)
return lineDelimiter;
}
// workspace preference
scopeContext = new IScopeContext[] { new InstanceScope() };
return Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext);
}
use of org.eclipse.core.runtime.preferences.InstanceScope in project webtools.sourceediting by eclipse.
the class JSPELTranslator method getScopeContexts.
private IScopeContext[] getScopeContexts(IStructuredDocument document) {
IScopeContext[] scopes = new IScopeContext[] { new InstanceScope(), new DefaultScope() };
final IFile file = getFile(document);
if (file != null && file.exists()) {
final IProject project = file.getProject();
if (project.exists()) {
ProjectScope projectScope = new ProjectScope(project);
if (projectScope.getNode(PREFERENCE_NODE_QUALIFIER).getBoolean(JSPCorePreferenceNames.VALIDATION_USE_PROJECT_SETTINGS, false)) {
scopes = new IScopeContext[] { projectScope, new InstanceScope(), new DefaultScope() };
}
}
}
return scopes;
}
use of org.eclipse.core.runtime.preferences.InstanceScope in project webtools.sourceediting by eclipse.
the class JSPDirectiveValidator method loadPreferences.
private void loadPreferences(IFile file) {
fScopes = new IScopeContext[] { new InstanceScope(), new DefaultScope() };
fPreferencesService = Platform.getPreferencesService();
if (file != null && file.isAccessible()) {
ProjectScope projectScope = new ProjectScope(file.getProject());
if (projectScope.getNode(PREFERENCE_NODE_QUALIFIER).getBoolean(JSPCorePreferenceNames.VALIDATION_USE_PROJECT_SETTINGS, false)) {
fScopes = new IScopeContext[] { projectScope, new InstanceScope(), new DefaultScope() };
}
}
fSeverityIncludeFileMissing = getMessageSeverity(JSPCorePreferenceNames.VALIDATION_DIRECTIVE_INCLUDE_FILE_NOT_FOUND);
fSeverityIncludeFileNotSpecified = getMessageSeverity(JSPCorePreferenceNames.VALIDATION_DIRECTIVE_INCLUDE_NO_FILE_SPECIFIED);
fSeverityTaglibDuplicatePrefixWithDifferentURIs = getMessageSeverity(JSPCorePreferenceNames.VALIDATION_DIRECTIVE_TAGLIB_DUPLICATE_PREFIXES_DIFFERENT_URIS);
fSeverityTaglibDuplicatePrefixWithSameURIs = getMessageSeverity(JSPCorePreferenceNames.VALIDATION_DIRECTIVE_TAGLIB_DUPLICATE_PREFIXES_SAME_URIS);
fSeverityTaglibMissingPrefix = getMessageSeverity(JSPCorePreferenceNames.VALIDATION_DIRECTIVE_TAGLIB_MISSING_PREFIX);
fSeverityTaglibMissingURI = getMessageSeverity(JSPCorePreferenceNames.VALIDATION_DIRECTIVE_TAGLIB_MISSING_URI_OR_TAGDIR);
fSeverityTaglibUnresolvableURI = getMessageSeverity(JSPCorePreferenceNames.VALIDATION_DIRECTIVE_TAGLIB_UNRESOLVABLE_URI_OR_TAGDIR);
fSeverityTagdirUnresolvableURI = getMessageSeverity(JSPCorePreferenceNames.VALIDATION_DIRECTIVE_TAGLIB_UNRESOLVABLE_URI_OR_TAGDIR);
fSeveritySuperClassNotFound = getMessageSeverity(JSPCorePreferenceNames.VALIDATION_DIRECTIVE_PAGE_SUPERCLASS_NOT_FOUND);
fSeverityDuplicateAttributeName = getMessageSeverity(JSPCorePreferenceNames.VALIDATION_DIRECTIVE_ATTRIBUTE_DUPLICATE_NAME);
}
use of org.eclipse.core.runtime.preferences.InstanceScope in project webtools.sourceediting by eclipse.
the class NewTagWizard method applyLineDelimiter.
private String applyLineDelimiter(IFile file, String text) {
// $NON-NLS-1$
String lineDelimiter = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, System.getProperty("line.separator"), new IScopeContext[] { new ProjectScope(file.getProject()), new InstanceScope() });
String convertedText = StringUtils.replace(text, "\r\n", "\n");
convertedText = StringUtils.replace(convertedText, "\r", "\n");
convertedText = StringUtils.replace(convertedText, "\n", lineDelimiter);
return convertedText;
}
use of org.eclipse.core.runtime.preferences.InstanceScope in project webtools.sourceediting by eclipse.
the class HTMLCorePreferencesTest method testPluginSetPreferences.
/**
* Tests setting preference values by setting preference value to be a
* certain value, then getting the preference value to verify it was set.
*/
public void testPluginSetPreferences() {
IEclipsePreferences node = new InstanceScope().getNode(HTMLCorePlugin.getDefault().getBundle().getSymbolicName());
pluginSetPreferenceBoolean(node, HTMLCorePreferenceNames.SPLIT_MULTI_ATTRS);
pluginSetPreferenceString(node, HTMLCorePreferenceNames.TAG_NAME_CASE);
}
Aggregations