use of org.eclipse.core.runtime.preferences.DefaultScope in project webtools.sourceediting by eclipse.
the class HTMLCorePreferenceInitializer method initializeDefaultPreferences.
public void initializeDefaultPreferences() {
IEclipsePreferences node = new DefaultScope().getNode(HTMLCorePlugin.getDefault().getBundle().getSymbolicName());
// formatting preferences
node.putInt(HTMLCorePreferenceNames.LINE_WIDTH, 72);
node.putBoolean(HTMLCorePreferenceNames.CLEAR_ALL_BLANK_LINES, false);
node.put(HTMLCorePreferenceNames.INDENTATION_CHAR, HTMLCorePreferenceNames.TAB);
node.putInt(HTMLCorePreferenceNames.INDENTATION_SIZE, 1);
node.putBoolean(HTMLCorePreferenceNames.SPLIT_MULTI_ATTRS, false);
node.putBoolean(HTMLCorePreferenceNames.ALIGN_END_BRACKET, false);
// cleanup preferences
node.putInt(HTMLCorePreferenceNames.CLEANUP_TAG_NAME_CASE, HTMLCorePreferenceNames.ASIS);
node.putInt(HTMLCorePreferenceNames.CLEANUP_ATTR_NAME_CASE, HTMLCorePreferenceNames.ASIS);
// node.putBoolean(HTMLCorePreferenceNames.COMPRESS_EMPTY_ELEMENT_TAGS,
// true);
node.putBoolean(HTMLCorePreferenceNames.INSERT_REQUIRED_ATTRS, true);
node.putBoolean(HTMLCorePreferenceNames.INSERT_MISSING_TAGS, true);
node.putBoolean(HTMLCorePreferenceNames.QUOTE_ATTR_VALUES, true);
node.putBoolean(HTMLCorePreferenceNames.FORMAT_SOURCE, true);
node.putBoolean(HTMLCorePreferenceNames.CONVERT_EOL_CODES, false);
// code generation preferences
// $NON-NLS-1$
node.put(CommonEncodingPreferenceNames.INPUT_CODESET, "");
// $NON-NLS-1$
String defaultEnc = "UTF-8";
// $NON-NLS-1$
String systemEnc = System.getProperty("file.encoding");
if (systemEnc != null) {
// $NON-NLS-1$
defaultEnc = CommonCharsetNames.getPreferredDefaultIanaName(systemEnc, "UTF-8");
}
node.put(CommonEncodingPreferenceNames.OUTPUT_CODESET, defaultEnc);
// $NON-NLS-1$
node.put(CommonEncodingPreferenceNames.END_OF_LINE_CODE, "");
node.putInt(HTMLCorePreferenceNames.TAG_NAME_CASE, HTMLCorePreferenceNames.LOWER);
node.putInt(HTMLCorePreferenceNames.ATTR_NAME_CASE, HTMLCorePreferenceNames.LOWER);
// this could be made smarter by actually looking up the content
// type's valid extensions
// $NON-NLS-1$
node.put(HTMLCorePreferenceNames.DEFAULT_EXTENSION, "html");
node.put(HTMLCorePreferenceNames.INLINE_ELEMENTS, "a,abbr,acronym,b,basefont,big,br,cite,em,font,i,img,input,label,li,q,s,select,small,span,strike,strong,sub,sup,td,th,title,u");
initializeValidationPreferences(node);
}
use of org.eclipse.core.runtime.preferences.DefaultScope in project webtools.sourceediting by eclipse.
the class SyntaxValidator method getExcludedElementNames.
private Set getExcludedElementNames(IProject project) {
IScopeContext[] fLookupOrder = new IScopeContext[] { new InstanceScope(), new DefaultScope() };
if (project != null) {
ProjectScope projectScope = new ProjectScope(project);
if (projectScope.getNode(HTMLCorePlugin.getDefault().getBundle().getSymbolicName()).getBoolean(HTMLCorePreferenceNames.USE_PROJECT_SETTINGS, false))
fLookupOrder = new IScopeContext[] { projectScope, new InstanceScope(), new DefaultScope() };
}
Set result = new HashSet();
if (fPreferenceService.getBoolean(HTMLCorePlugin.getDefault().getBundle().getSymbolicName(), HTMLCorePreferenceNames.IGNORE_ELEMENT_NAMES, HTMLCorePreferenceNames.IGNORE_ELEMENT_NAMES_DEFAULT, fLookupOrder)) {
String ignoreList = fPreferenceService.getString(HTMLCorePlugin.getDefault().getBundle().getSymbolicName(), HTMLCorePreferenceNames.ELEMENT_NAMES_TO_IGNORE, HTMLCorePreferenceNames.ELEMENT_NAMES_TO_IGNORE_DEFAULT, fLookupOrder);
if (ignoreList.trim().length() == 0)
return result;
// $NON-NLS-1$
String[] names = ignoreList.split(",");
for (int i = 0; names != null && i < names.length; i++) {
String name = names[i] == null ? null : names[i].trim();
if (name != null && name.length() > 0)
result.add(name.toLowerCase());
}
}
return result;
}
use of org.eclipse.core.runtime.preferences.DefaultScope in project liferay-ide by liferay.
the class AbstractValidationSettingsPage method resetSeverities.
protected void resetSeverities() {
IEclipsePreferences defaultContext = new DefaultScope().getNode(getPreferenceNodeQualifier());
for (int i = 0; i < _fCombos.size(); i++) {
ComboData data = (ComboData) ((Combo) _fCombos.get(i)).getData();
int severity = defaultContext.getInt(data.getKey(), ValidationMessage.WARNING);
data.setSeverity(severity);
((Combo) _fCombos.get(i)).select(data.getIndex());
}
}
use of org.eclipse.core.runtime.preferences.DefaultScope in project xtext-xtend by eclipse.
the class JavaProjectPreferencesInitializer method addOwnFileExtensionsToJavaBuildResourceCopyFilter.
@SuppressWarnings("restriction")
@Inject
public void addOwnFileExtensionsToJavaBuildResourceCopyFilter(FileExtensionProvider extensionProvider) {
@SuppressWarnings("deprecation") IScopeContext defaultScope = new DefaultScope();
// The class org.eclipse.jdt.internal.launching.LaunchingPreferenceInitializer has this very nasty habit
// of replacing all RESOURCE_COPY_FILTERs with its own filter. Calling getNode(LaunchingPlugin.ID_PLUGIN)
// causes LaunchingPreferenceInitializer to be executed that afterwards we can append our filters safely.
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=395366
defaultScope.getNode(org.eclipse.jdt.internal.launching.LaunchingPlugin.ID_PLUGIN);
IEclipsePreferences dnode = defaultScope.getNode(JavaCore.PLUGIN_ID);
if (dnode == null)
return;
Set<String> filters = Sets.newLinkedHashSet();
for (String filter : dnode.get(JavaCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, "").split(",")) {
String trimmed = filter.trim();
if (!"".equals(trimmed))
filters.add(trimmed);
}
for (String ext : extensionProvider.getFileExtensions()) filters.add("*." + ext);
dnode.put(JavaCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, Joiner.on(", ").join(filters));
try {
dnode.flush();
} catch (BackingStoreException e) {
log.error("Error saving preferences", e);
}
}
Aggregations