List of usage examples for org.eclipse.jface.preference PreferenceStore setValue
@Override public void setValue(String name, boolean value)
From source file:org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor.java
License:Open Source License
/** * Adds the default preferences to the specified preference store. * /*ww w . ja v a2 s. c o m*/ * @param store * store to use * @param preferencesHint * The preference hint that is to be used to find the appropriate * preference store from which to retrieve diagram preference * values. The preference hint is mapped to a preference store in * the preference registry <@link DiagramPreferencesRegistry>. */ public static void addDefaultPreferences(PreferenceStore store, PreferencesHint preferencesHint) { store.setValue(WorkspaceViewerProperties.ZOOM, 1.0); store.setValue(WorkspaceViewerProperties.VIEWPAGEBREAKS, false); IPreferenceStore globalPreferenceStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); // Initialize with the global settings boolean viewGrid = globalPreferenceStore.getBoolean(IPreferenceConstants.PREF_SHOW_GRID); boolean snapToGrid = globalPreferenceStore.getBoolean(IPreferenceConstants.PREF_SNAP_TO_GRID); boolean snapToGeometry = globalPreferenceStore.getBoolean(IPreferenceConstants.PREF_SNAP_TO_GEOMETRY); boolean viewRulers = globalPreferenceStore.getBoolean(IPreferenceConstants.PREF_SHOW_RULERS); // Set defaults for Grid store.setValue(WorkspaceViewerProperties.VIEWGRID, viewGrid); store.setValue(WorkspaceViewerProperties.SNAPTOGRID, snapToGrid); store.setValue(WorkspaceViewerProperties.SNAPTOGEOMETRY, snapToGeometry); // Set defaults for Rulers store.setValue(WorkspaceViewerProperties.VIEWRULERS, viewRulers); // Initialize printing defaults from the workspace preferences IPreferenceStore workspacePreferences = (IPreferenceStore) preferencesHint.getPreferenceStore(); store.setValue(WorkspaceViewerProperties.PREF_USE_WORKSPACE_SETTINGS, workspacePreferences.getBoolean(WorkspaceViewerProperties.PREF_USE_WORKSPACE_SETTINGS)); store.setValue(WorkspaceViewerProperties.PREF_USE_DIAGRAM_SETTINGS, workspacePreferences.getBoolean(WorkspaceViewerProperties.PREF_USE_WORKSPACE_SETTINGS)); store.setValue(WorkspaceViewerProperties.PREF_USE_INCHES, workspacePreferences.getBoolean(WorkspaceViewerProperties.PREF_USE_INCHES)); store.setValue(WorkspaceViewerProperties.PREF_USE_MILLIM, workspacePreferences.getBoolean(WorkspaceViewerProperties.PREF_USE_MILLIM)); store.setValue(WorkspaceViewerProperties.PREF_USE_PORTRAIT, workspacePreferences.getBoolean(WorkspaceViewerProperties.PREF_USE_PORTRAIT)); store.setValue(WorkspaceViewerProperties.PREF_USE_LANDSCAPE, workspacePreferences.getBoolean(WorkspaceViewerProperties.PREF_USE_LANDSCAPE)); store.setValue(WorkspaceViewerProperties.PREF_PAGE_SIZE, workspacePreferences.getString(WorkspaceViewerProperties.PREF_PAGE_SIZE)); store.setValue(WorkspaceViewerProperties.PREF_PAGE_WIDTH, workspacePreferences.getDouble(WorkspaceViewerProperties.PREF_PAGE_WIDTH)); store.setValue(WorkspaceViewerProperties.PREF_PAGE_HEIGHT, workspacePreferences.getDouble(WorkspaceViewerProperties.PREF_PAGE_HEIGHT)); store.setValue(WorkspaceViewerProperties.PREF_MARGIN_TOP, workspacePreferences.getDouble(WorkspaceViewerProperties.PREF_MARGIN_TOP)); store.setValue(WorkspaceViewerProperties.PREF_MARGIN_BOTTOM, workspacePreferences.getDouble(WorkspaceViewerProperties.PREF_MARGIN_BOTTOM)); store.setValue(WorkspaceViewerProperties.PREF_MARGIN_LEFT, workspacePreferences.getDouble(WorkspaceViewerProperties.PREF_MARGIN_LEFT)); store.setValue(WorkspaceViewerProperties.PREF_MARGIN_RIGHT, workspacePreferences.getDouble(WorkspaceViewerProperties.PREF_MARGIN_RIGHT)); }
From source file:org.eclipse.jdt.internal.ui.preferences.formatter.JavaPreview.java
License:Open Source License
public JavaPreview(Map<String, String> workingValues, Composite parent) { JavaTextTools tools = JavaPlugin.getDefault().getJavaTextTools(); fPreviewDocument = new Document(); fWorkingValues = workingValues;//from w w w . j a v a 2s . c o m tools.setupJavaDocumentPartitioner(fPreviewDocument, IJavaPartitions.JAVA_PARTITIONING); PreferenceStore prioritizedSettings = new PreferenceStore(); HashMap<String, String> complianceOptions = new HashMap<String, String>(); JavaModelUtil.setComplianceOptions(complianceOptions, JavaModelUtil.VERSION_LATEST); for (Entry<String, String> complianceOption : complianceOptions.entrySet()) { prioritizedSettings.setValue(complianceOption.getKey(), complianceOption.getValue()); } IPreferenceStore[] chain = { prioritizedSettings, JavaPlugin.getDefault().getCombinedPreferenceStore() }; fPreferenceStore = new ChainedPreferenceStore(chain); fSourceViewer = new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, fPreferenceStore); fSourceViewer.setEditable(false); Cursor arrowCursor = fSourceViewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW); fSourceViewer.getTextWidget().setCursor(arrowCursor); // Don't set caret to 'null' as this causes https://bugs.eclipse.org/293263 // fSourceViewer.getTextWidget().setCaret(null); fViewerConfiguration = new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), fPreferenceStore, null, IJavaPartitions.JAVA_PARTITIONING, true); fSourceViewer.configure(fViewerConfiguration); fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); fMarginPainter = new MarginPainter(fSourceViewer); final RGB rgb = PreferenceConverter.getColor(fPreferenceStore, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR); fMarginPainter.setMarginRulerColor(tools.getColorManager().getColor(rgb)); fSourceViewer.addPainter(fMarginPainter); new JavaSourcePreviewerUpdater(); fSourceViewer.setDocument(fPreviewDocument); }
From source file:org.eclipse.titan.designer.properties.pages.CCompilerOptionsPage.java
License:Open Source License
@Override public void copyPropertyStore(final IProject project, final PreferenceStore tempStorage) { String temp = null;/* w ww . j ava2 s . co m*/ try { temp = project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, CCompilerOptionsData.CXX_COMPILER_PROPERTY)); } catch (CoreException ce) { ErrorReporter.logExceptionStackTrace(ce); } if (temp != null) { tempStorage.setValue(CCompilerOptionsData.CXX_COMPILER_PROPERTY, temp); } }
From source file:org.eclipse.titan.designer.properties.pages.COptimalizationOptionsPage.java
License:Open Source License
@Override public void copyPropertyStore(final IProject project, final PreferenceStore tempStorage) { String temp = null;/*from www .j a v a2 s. c om*/ for (int i = 0; i < COptimalizationOptionsData.PROPERTIES.length; i++) { try { temp = project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, COptimalizationOptionsData.PROPERTIES[i])); if (temp != null) { tempStorage.setValue(COptimalizationOptionsData.PROPERTIES[i], temp); } } catch (CoreException ce) { ErrorReporter.logExceptionStackTrace(ce); } } }
From source file:org.eclipse.titan.designer.properties.pages.LinkerFlagsOptionsPage.java
License:Open Source License
@Override public void copyPropertyStore(final IProject project, final PreferenceStore tempStorage) { String temp = null;/* w w w . java 2 s. co m*/ for (int i = 0; i < LinkerFlagsOptionsData.PROPERTIES.length; i++) { try { temp = project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, LinkerFlagsOptionsData.PROPERTIES[i])); if (temp != null) { tempStorage.setValue(LinkerFlagsOptionsData.PROPERTIES[i], temp); } } catch (CoreException ce) { ErrorReporter.logExceptionStackTrace(ce); } } }
From source file:org.eclipse.titan.designer.properties.pages.LinkerLibrariesOptionsPage.java
License:Open Source License
@Override public void copyPropertyStore(final IProject project, final PreferenceStore tempStorage) { String temp = null;//from w w w . ja v a 2 s. co m for (int i = 0; i < LinkerLibrariesOptionsData.PROPERTIES.length; i++) { try { temp = project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, LinkerLibrariesOptionsData.PROPERTIES[i])); if (temp != null) { tempStorage.setValue(LinkerLibrariesOptionsData.PROPERTIES[i], temp); } } catch (CoreException ce) { ErrorReporter.logExceptionStackTrace(ce); } } }
From source file:org.eclipse.titan.designer.properties.pages.MakeAttributesTab.java
License:Open Source License
/** * Copies the actual values into the provided preference storage. * //from www.j a v a2s. c om * @param project * the actual project (the real preference store). * @param tempStorage * the temporal store to copy the values to. * */ public void copyPropertyStore(final IProject project, final PreferenceStore tempStorage) { String temp = null; try { temp = project.getPersistentProperty( new QualifiedName(ProjectBuildPropertyData.QUALIFIER, MakeAttributesData.BUILD_LEVEL_PROPERTY)); temp = MakeAttributesData.getBuildLevel(temp); tempStorage.setValue(MakeAttributesData.BUILD_LEVEL_PROPERTY, temp); temp = project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, MakeAttributesData.TEMPORAL_MAKEFILE_SCRIPT_PROPERTY)); if (temp != null) { tempStorage.setValue(MakeAttributesData.TEMPORAL_MAKEFILE_SCRIPT_PROPERTY, temp); } temp = project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, MakeAttributesData.TEMPORAL_MAKEFILE_FLAGS_PROPERTY)); if (temp != null) { tempStorage.setValue(MakeAttributesData.TEMPORAL_MAKEFILE_FLAGS_PROPERTY, temp); } temp = project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, MakeAttributesData.TEMPORAL_WORKINGDIRECTORY_PROPERTY)); if (temp != null) { tempStorage.setValue(MakeAttributesData.TEMPORAL_WORKINGDIRECTORY_PROPERTY, temp); } } catch (CoreException ce) { ErrorReporter.logExceptionStackTrace(ce); } }
From source file:org.eclipse.titan.designer.properties.pages.MakefileCreationTab.java
License:Open Source License
/** * Copies the actual values into the provided preference storage. * //from w w w . j a v a2 s . c o m * @param project * the actual project (the real preference store). * @param tempStorage * the temporal store to copy the values to. * */ public void copyPropertyStore(final IProject project, final PreferenceStore tempStorage) { String temp = null; try { temp = project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, MakefileCreationData.USE_ABSOLUTEPATH_PROPERTY)); if (temp != null) { tempStorage.setValue(MakefileCreationData.USE_ABSOLUTEPATH_PROPERTY, temp); } temp = project.getPersistentProperty( new QualifiedName(ProjectBuildPropertyData.QUALIFIER, MakefileCreationData.GNU_MAKE_PROPERTY)); if (temp != null) { tempStorage.setValue(MakefileCreationData.GNU_MAKE_PROPERTY, temp); } temp = project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, MakefileCreationData.INCREMENTAL_DEPENDENCY_PROPERTY)); if (temp != null) { tempStorage.setValue(MakefileCreationData.INCREMENTAL_DEPENDENCY_PROPERTY, temp); } temp = project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, MakefileCreationData.DYNAMIC_LINKING_PROPERTY)); if (temp != null) { tempStorage.setValue(MakefileCreationData.DYNAMIC_LINKING_PROPERTY, temp); } temp = project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, MakefileCreationData.FUNCTIONTESTRUNTIME_PROPERTY)); if (temp != null) { tempStorage.setValue(MakefileCreationData.FUNCTIONTESTRUNTIME_PROPERTY, temp); } temp = project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, MakefileCreationData.SINGLEMODE_PROPERTY)); if (temp != null) { tempStorage.setValue(MakefileCreationData.SINGLEMODE_PROPERTY, temp); } temp = project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, MakefileCreationData.CODE_SPLITTING_PROPERTY)); if (temp != null) { tempStorage.setValue(MakefileCreationData.CODE_SPLITTING_PROPERTY, temp); } temp = project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, MakefileCreationData.DEFAULT_TARGET_PROPERTY)); if (temp != null) { tempStorage.setValue(MakefileCreationData.DEFAULT_TARGET_PROPERTY, temp); } temp = project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, MakefileCreationData.TARGET_EXECUTABLE_PROPERTY)); if (temp != null) { tempStorage.setValue(MakefileCreationData.TARGET_EXECUTABLE_PROPERTY, temp); } } catch (CoreException ce) { ErrorReporter.logExceptionStackTrace(ce); } }
From source file:org.eclipse.titan.designer.properties.pages.PlatformSpecificLibrariesOptionsPage.java
License:Open Source License
@Override public void copyPropertyStore(final IProject project, final PreferenceStore tempStorage) { String temp = ResourceUtils.getPersistentProperty(project, ProjectBuildPropertyData.QUALIFIER, platform + PlatformSpecificLibrariesOptionsData.SPECIFIC_LIBRARIES_PROPERTY); if (temp != null) { tempStorage.setValue(platform + PlatformSpecificLibrariesOptionsData.SPECIFIC_LIBRARIES_PROPERTY, temp); }//from w w w . j a v a 2 s . co m }
From source file:org.eclipse.titan.designer.properties.pages.PreprocessorIncludedOptionsPage.java
License:Open Source License
@Override public void copyPropertyStore(final IProject project, final PreferenceStore tempStorage) { String property = preprocessor ? PreprocessorIncludedOptionsData.TTCN3_PREPROCESSOR_INCLUDES_PROPERTY : PreprocessorIncludedOptionsData.PREPROCESSOR_INCLUDES_PROPERTY; String temp = null;//from w w w. j av a 2 s . co m try { temp = project.getPersistentProperty(new QualifiedName(ProjectBuildPropertyData.QUALIFIER, property)); } catch (CoreException ce) { ErrorReporter.logExceptionStackTrace(ce); } if (temp != null) { tempStorage.setValue(property, temp); } }