use of org.eclipse.core.runtime.preferences.DefaultScope in project webtools.sourceediting by eclipse.
the class TaskTagPreferencePage method createCommonContents.
protected Control createCommonContents(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout compositeLayout = new GridLayout();
compositeLayout.marginLeft = 0;
compositeLayout.marginRight = 0;
composite.setLayout(compositeLayout);
IScopeContext[] preferenceScopes = createPreferenceScopes();
fOriginalEnableTaskTags = fEnableTaskTags = fPreferencesService.getBoolean(getPreferenceNodeQualifier(), TaskTagPreferenceKeys.TASK_TAG_ENABLE, false, preferenceScopes);
fEnableCheckbox = new Button(composite, SWT.CHECK);
fEnableCheckbox.setSelection(fEnableTaskTags);
// $NON-NLS-1$
fEnableCheckbox.setText(SSEUIMessages.TaskTagPreferenceTab_31);
fEnableCheckbox.setSelection(fEnableTaskTags);
fEnableCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_END, false, false, 1, 1));
fTabFolder = new TabFolder(composite, SWT.NONE);
fTabFolder.setLayout(new TabFolderLayout());
fTabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
TabItem taskItem = new TabItem(fTabFolder, SWT.NONE);
MainTab mainTab = new MainTab(this, fPreferencesService, preferenceScopes);
taskItem.setText(mainTab.getTitle());
final Control taskTagsControl = mainTab.createContents(fTabFolder);
taskItem.setControl(taskTagsControl);
TabItem exclusionItem = new TabItem(fTabFolder, SWT.NONE);
ExclusionsTab exclusionsTab = new ExclusionsTab(this, fPreferencesService, preferenceScopes);
exclusionItem.setText(exclusionsTab.getTitle());
final Control exclusionControl = exclusionsTab.createContents(fTabFolder);
exclusionItem.setControl(exclusionControl);
fTabs = new IPreferenceTab[] { mainTab, exclusionsTab };
fTabEnablementListener = new SelectionAdapter() {
ControlEnableState[] lastEnableStates = null;
public void widgetSelected(SelectionEvent e) {
fEnableTaskTags = fEnableCheckbox.getSelection();
if (fEnableTaskTags) {
if (lastEnableStates != null) {
for (int i = 0; i < lastEnableStates.length; i++) {
if (lastEnableStates[i] != null) {
lastEnableStates[i].restore();
}
}
lastEnableStates = null;
fTabFolder.redraw();
}
} else if (lastEnableStates == null) {
lastEnableStates = new ControlEnableState[fTabs.length + 1];
lastEnableStates[0] = ControlEnableState.disable(taskTagsControl);
lastEnableStates[1] = ControlEnableState.disable(exclusionControl);
if (fRedetectButton != null) {
lastEnableStates[2] = ControlEnableState.disable(fRedetectButton);
}
}
}
};
fTabEnablementListener.widgetSelected(null);
fEnableCheckbox.addSelectionListener(fTabEnablementListener);
// restore last selected tab
int activeTab = new DefaultScope().getNode(getPreferenceNodeQualifier()).getInt(TASK_TAG_LAST_TAB, 0);
if (activeTab > 0) {
fTabFolder.setSelection(activeTab);
}
SSEUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.PREFWEBX_TASKTAGS_HELPID);
return composite;
}
use of org.eclipse.core.runtime.preferences.DefaultScope in project webtools.sourceediting by eclipse.
the class JSONValidatorPreferencePage method performDefaultsForSyntaxValidationGroup.
// protected void performDefaultsForValidatingGroup() {
// IEclipsePreferences modelPreferences = new DefaultScope()
// .getNode(getPreferenceNodeQualifier());
// boolean useXIncludeButtonSelected = modelPreferences.getBoolean(
// JSONCorePreferenceNames.USE_XINCLUDE, false);
//
// if (fUseXinclude != null) {
// fUseXinclude.setSelection(useXIncludeButtonSelected);
// }
// boolean useHonourAllButtonSelected = modelPreferences.getBoolean(
// JSONCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS, true);
// if (fHonourAllSchemaLocations != null) {
// fHonourAllSchemaLocations.setSelection(useHonourAllButtonSelected);
// }
// }
protected void performDefaultsForSyntaxValidationGroup() {
IEclipsePreferences modelPreferences = new DefaultScope().getNode(getPreferenceNodeQualifier());
boolean useExtendedSyntaxValidation = modelPreferences.getBoolean(JSONCorePreferenceNames.SYNTAX_VALIDATION, false);
boolean useSchemaValidation = modelPreferences.getBoolean(JSONCorePreferenceNames.SCHEMA_VALIDATION, false);
if (fSchemaValidation != null) {
fSchemaValidation.setSelection(useSchemaValidation);
}
if (fExtendedSyntaxValidation != null) {
if (fExtendedSyntaxValidation.getSelection() != useExtendedSyntaxValidation) {
handleSyntaxSeveritySelection(useExtendedSyntaxValidation);
}
fExtendedSyntaxValidation.setSelection(useExtendedSyntaxValidation);
}
}
use of org.eclipse.core.runtime.preferences.DefaultScope in project webtools.sourceediting by eclipse.
the class DTDCorePreferenceInitializer method initializeDefaultPreferences.
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
*/
public void initializeDefaultPreferences() {
IEclipsePreferences node = new DefaultScope().getNode(DTDCorePlugin.getInstance().getBundle().getSymbolicName());
// this could be made smarter by actually looking up the content
// type's valid extensions
// $NON-NLS-1$
node.put(DTDCorePreferenceNames.DEFAULT_EXTENSION, "dtd");
}
use of org.eclipse.core.runtime.preferences.DefaultScope in project webtools.sourceediting by eclipse.
the class WorkspaceTaskScanner method init.
private boolean init(IResource resource) {
IProject project = getProject(resource);
IPreferencesService preferencesService = Platform.getPreferencesService();
IScopeContext[] lookupOrder = new IScopeContext[] { new ProjectScope(project), new InstanceScope(), new DefaultScope() };
boolean proceed = preferencesService.getBoolean(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_ENABLE, false, lookupOrder);
if (Logger.DEBUG_TASKSPREFS) {
// $NON-NLS-1$ //$NON-NLS-2$
System.out.println(getClass().getName() + " scan of " + resource.getFullPath() + ":" + proceed);
}
if (proceed) {
String[] tags = StringUtils.unpack(preferencesService.getString(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_TAGS, null, lookupOrder));
String[] priorities = StringUtils.unpack(preferencesService.getString(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_PRIORITIES, null, lookupOrder));
String[] currentIgnoreContentTypeIDs = StringUtils.unpack(preferencesService.getString(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED, null, lookupOrder));
if (Logger.DEBUG_TASKSPREFS) {
// $NON-NLS-1$
System.out.print(getClass().getName() + " tags: ");
for (int i = 0; i < tags.length; i++) {
if (i > 0) {
// $NON-NLS-1$
System.out.print(",");
}
System.out.print(tags[i]);
}
System.out.println();
// $NON-NLS-1$
System.out.print(getClass().getName() + " priorities: ");
for (int i = 0; i < priorities.length; i++) {
if (i > 0) {
// $NON-NLS-1$
System.out.print(",");
}
System.out.print(priorities[i]);
}
System.out.println();
// $NON-NLS-1$
System.out.print(getClass().getName() + " ignored content types: ");
for (int i = 0; i < currentIgnoreContentTypeIDs.length; i++) {
if (i > 0) {
// $NON-NLS-1$
System.out.print(",");
}
System.out.print(currentIgnoreContentTypeIDs[i]);
}
System.out.println();
}
fCurrentIgnoreContentTypes = new IContentType[currentIgnoreContentTypeIDs.length];
IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
for (int i = 0; i < currentIgnoreContentTypeIDs.length; i++) {
fCurrentIgnoreContentTypes[i] = contentTypeManager.getContentType(currentIgnoreContentTypeIDs[i]);
}
int max = Math.min(tags.length, priorities.length);
fCurrentTaskTags = new TaskTag[max];
for (int i = 0; i < max; i++) {
int priority = TaskTag.PRIORITY_NORMAL;
try {
priority = Integer.parseInt(priorities[i]);
} catch (NumberFormatException e) {
// default to normal priority
}
fCurrentTaskTags[i] = new TaskTag(tags[i], priority);
}
}
return proceed;
}
use of org.eclipse.core.runtime.preferences.DefaultScope in project webtools.sourceediting by eclipse.
the class JSPValidationPreferencePage method performDefaults.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.PreferencePage#performDefaults()
*/
protected void performDefaults() {
resetSeverities();
IEclipsePreferences defaultContext = new DefaultScope().getNode(getPreferenceNodeQualifier());
boolean validateFragments = defaultContext.getBoolean(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, true);
fValidateFragments.setSelection(validateFragments);
super.performDefaults();
}
Aggregations