List of usage examples for org.eclipse.jface.preference IPreferenceStore setValue
void setValue(String name, boolean value);
From source file:com.vectrace.MercurialEclipse.storage.HgRepositoryLocationManager.java
License:Open Source License
private void saveRepositories(String key, Set<IHgRepositoryLocation> locations) { if (locations == null || locations.isEmpty()) { return;/*from w w w . jav a 2 s .c o m*/ } IPreferenceStore store = MercurialEclipsePlugin.getDefault().getPreferenceStore(); StringBuilder sb = new StringBuilder(); for (IHgRepositoryLocation repo : locations) { String line = delegator.delegateCreate(repo); if (line != null) { sb.append(line); sb.append('|'); } } store.setValue(key, sb.toString()); }
From source file:com.windowtester.eclipse.ui.updater.EarlyStartupResponder.java
License:Open Source License
private void showDialog() { Display.getDefault().syncExec(new Runnable() { public void run() { dialog = new WTV5UpdateDialog(); dialog.open();/*from w w w. ja v a 2s. c o m*/ } }); final IPreferenceStore store = Activator.getDefault().getPreferenceStore(); final String key = WTUpdateConstants.P_SHOW_UPDATE_MSG; store.setValue(key, "seen"); }
From source file:com.windowtester.internal.runtime.preferences.PlaybackSettings.java
License:Open Source License
/** * Load values from workspace preferences. *///from w w w .java2s .co m // void loadFromWorkspace() { // IPreferenceStore store = RuntimePlugin.getDefault().getPreferenceStore(); // setDelayOn(store.getBoolean(DELAY_ON)); // setHiglightingOn(store.getBoolean(HIGHLIGHT_ON)); // setKeyClickDelay(store.getInt(KEY_CLICK_DELAY)); // setWidgetClickDelay(store.getInt(WIDGET_CLICK_DELAY)); // setHighlightColor(store.getString(HIGHLIGHT_COLOR)); // setHighlightDuration(store.getInt(HIGHLIGHT_DURATION)); // setMouseMoveDelay(store.getInt(MOUSE_MOVE_DELAY)); // setMouseButtonsRemapped(store.getBoolean(MOUSE_BUTTONS_REMAPPED)); // setExperimentalPlaybackOn(store.getBoolean(EXPERIMENTAL_RUNTIME)); // setShowNotesOn(store.getBoolean(HIGHLIGHT_SHOW_NOTES)); // } public void flushToPreferenceStore(IPreferenceStore store) { store.setValue(DELAY_ON, getDelayOn()); store.setValue(HIGHLIGHT_ON, getHighlightingOn()); store.setValue(KEY_CLICK_DELAY, getKeyClickDelay()); store.setValue(WIDGET_CLICK_DELAY, getWidgetClickDelay()); store.setValue(HIGHLIGHT_COLOR, StringConverter.asString(getHighlightColor())); store.setValue(HIGHLIGHT_DURATION, getHighlightDuration()); store.setValue(MOUSE_MOVE_DELAY, getMouseMoveDelay()); store.setValue(MOUSE_BUTTONS_REMAPPED, getMouseButtonsRemapped()); store.setValue(EXPERIMENTAL_RUNTIME, getExperimentalPlaybackOn()); store.setValue(HIGHLIGHT_SHOW_NOTES, getShowNotesOn()); }
From source file:com.windowtester.runtime.swt.internal.preferences.PlaybackSettings.java
License:Open Source License
public void flushToPreferenceStore(IPreferenceStore store) { store.setValue(DELAY_ON, getDelayOn()); store.setValue(HIGHLIGHT_ON, getHighlightingOn()); store.setValue(KEY_CLICK_DELAY, getKeyClickDelay()); store.setValue(WIDGET_CLICK_DELAY, getWidgetClickDelay()); store.setValue(HIGHLIGHT_COLOR, StringConverter.asString(getHighlightColor())); store.setValue(HIGHLIGHT_DURATION, getHighlightDuration()); store.setValue(MOUSE_MOVE_DELAY, getMouseMoveDelay()); store.setValue(MOUSE_BUTTONS_REMAPPED, getMouseButtonsRemapped()); store.setValue(EXPERIMENTAL_RUNTIME, getExperimentalPlaybackOn()); store.setValue(HIGHLIGHT_SHOW_NOTES, getShowNotesOn()); }
From source file:com.windowtester.runtime.swt.internal.preferences.PlaybackSettingsLoader.java
License:Open Source License
public static void loadFromDisk(IPreferenceStore store) { PlaybackSettings settings = PlaybackSettings.loadFromFile(); store.setValue(PlaybackSettings.DELAY_ON, settings.getDelayOn()); store.setValue(PlaybackSettings.HIGHLIGHT_ON, settings.getHighlightingOn()); store.setValue(PlaybackSettings.HIGHLIGHT_DURATION, settings.getHighlightDuration()); store.setValue(PlaybackSettings.KEY_CLICK_DELAY, settings.getKeyClickDelay()); store.setValue(PlaybackSettings.WIDGET_CLICK_DELAY, settings.getWidgetClickDelay()); store.setValue(PlaybackSettings.HIGHLIGHT_COLOR, settings .getPropertyOrDefault(PlaybackSettings.HIGHLIGHT_COLOR, PlaybackSettings.DEFAULT_RGB_STRING)); store.setValue(PlaybackSettings.MOUSE_MOVE_DELAY, settings .getIntPropertyOrDefault(PlaybackSettings.MOUSE_MOVE_DELAY, PlaybackSettings.DEFAULT_MOUSE_DELAY)); store.setValue(PlaybackSettings.MOUSE_BUTTONS_REMAPPED, settings.getPropertyOrDefault( PlaybackSettings.MOUSE_BUTTONS_REMAPPED, PlaybackSettings.DEFAULT_MOUSE_REMAP)); //store.setValue(PlaybackSettings.EXPERIMENTAL_RUNTIME, settings.getProperty(PlaybackSettings.EXPERIMENTAL_RUNTIME)); //store.setValue(PlaybackSettings.HIGHLIGHT_SHOW_NOTES, settings.getProperty(PlaybackSettings.HIGHLIGHT_SHOW_NOTES)); }
From source file:com.worldline.asciidoctools.editor.internal.AsciidocEditor.java
License:Open Source License
@Override public void createPartControl(Composite parent) { this.background = new Composite(parent, SWT.NONE); background.setLayout(new FormLayout()); this.editionZone = new Composite(background, SWT.BORDER); editionZone.setLayout(new FillLayout()); this.renderingZone = new Composite(background, SWT.BORDER); renderingZone.setLayout(new FillLayout()); super.createPartControl(editionZone); this.browser = new Browser(renderingZone, SWT.NONE); // Listener added to prevent navigation using hyperlinks this.browser.addLocationListener(new LocationAdapter() { @Override//from w w w .j a v a 2 s . c o m public void changing(LocationEvent event) { if (((Browser) event.getSource()).getUrl() != null && !"about:blank".equals(((Browser) event.getSource()).getUrl())) { try { URI realFileURI = new File(getDestinationFile().getLocation().toString()).toURI(); URI expectedFileURI = URI.create(event.location); event.doit = realFileURI.getPath().equals(expectedFileURI.getPath()); } catch (Exception e) { Activator.getDefault().getLog() .log(new Status(IStatus.WARNING, Activator.PLUGIN_ID, e.getMessage(), e)); } } } }); this.horizontalScale = new Scale(background, SWT.HORIZONTAL); this.horizontalScale.setMinimum(5); this.horizontalScale.setMaximum(95); this.horizontalScale.setIncrement(5); this.horizontalScale.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Scale scale = (Scale) e.getSource(); IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); if (scale.getSelection() != preferenceStore.getInt("editorRatio")) { preferenceStore.setValue("editorRatio", scale.getSelection()); refreshLayout(); } } }); this.verticalScale = new Scale(background, SWT.VERTICAL); this.verticalScale.setMinimum(5); this.verticalScale.setMaximum(95); this.verticalScale.setIncrement(5); this.verticalScale.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Scale scale = (Scale) e.getSource(); IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); if (scale.getSelection() != preferenceStore.getInt("editorRatio")) { preferenceStore.setValue("editorRatio", scale.getSelection()); refreshLayout(); } } }); this.tiltButton = new Button(background, SWT.PUSH); this.tiltButton.setImage(Activator.getDefault().getImage("icons/tilt_icon.gif")); this.tiltButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); boolean verticalSplit = preferenceStore.getBoolean("verticalSplit"); preferenceStore.setValue("verticalSplit", !verticalSplit); refreshLayout(); } }); this.refreshButton = new Button(background, SWT.PUSH); this.refreshButton.setImage(Activator.getDefault().getImage("icons/refresh_icon.gif")); this.refreshButton.setToolTipText("Refresh Rendering View"); this.refreshButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { refreshBrowser(getDestinationFile()); } }); // Mettre les images et les tooltips this.refreshLayout(); this.refreshBrowser(getDestinationFile()); // Workaround to find : disable the Ctrl+I binding for this editor ? // Add bold/italic shortcuts. this.getSourceViewer().getTextWidget().addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { if (e.keyCode == 'b' && (e.stateMask & SWT.CTRL) != 0) { toggleMarker(getSourceViewer(), "*"); } if (e.keyCode == 't' && (e.stateMask & SWT.CTRL) != 0) { toggleMarker(getSourceViewer(), "_"); } } private boolean toggleMarker(ISourceViewer sourceViewer, String marker) { try { Point selectedRange = sourceViewer.getSelectedRange(); String selection = sourceViewer.getDocument().get(selectedRange.x, selectedRange.y); String previous = sourceViewer.getDocument().get(selectedRange.x - 1, 1).trim(); String next = sourceViewer.getDocument().get(selectedRange.x + selectedRange.y, 1).trim(); if (previous.endsWith(marker) && next.startsWith(marker)) { sourceViewer.getDocument().replace(selectedRange.x - 1, selectedRange.y + 2, selection); } else { sourceViewer.getDocument().replace(selectedRange.x, selectedRange.y, marker + selection + marker); } return true; } catch (BadLocationException ble) { ble.printStackTrace(); } return false; } }); }
From source file:com.zeus.eclipsePlugin.PreferenceManager.java
License:Open Source License
/** * Set a string preference's value.//from w ww .j av a 2 s. c om * @param pref The preference to set. * @param value The new value of the preference. */ public static void setPreference(Preference pref, String value) { if (ZXTMPlugin.getDefault() == null) { return; } IPreferenceStore preferences = ZXTMPlugin.getDefault().getPreferenceStore(); preferences.setValue(pref.getKey(), value); }
From source file:com.zeus.eclipsePlugin.swt.ColourControl.java
License:Open Source License
/** * Commits the settings in the UI to the preference store. *///from w w w . j av a 2s. c o m public void updatePreferences() { for (ColourSetting setting : colourSettings) { Preference pref = setting.getPreference(); IPreferenceStore preferences = ZXTMPlugin.getDefault().getPreferenceStore(); if (setting.isDefault()) { preferences.setToDefault(pref.getKey()); } else { preferences.setValue(pref.getKey(), setting.toPreferenceString()); } } }
From source file:cz.vutbr.fit.xhriba01.bc.jdt.ui.javaeditor.SemanticHighlightings.java
License:Open Source License
/** * In 3.0, methods were highlighted by a rule-based word matcher that * matched any identifier that was followed by possibly white space and a * left parenthesis.// ww w . ja va 2 s . c o m * <p> * With generics, this does not work any longer for constructors of generic * types, and the highlighting has been moved to be a semantic highlighting. * Because different preference key naming schemes are used, we have to * migrate the old settings to the new ones, which is done here. Nothing * needs to be done if the old settings were set to the default values. * </p> * * @param store the preference store to migrate * @since 3.1 */ private static void convertMethodHighlightingPreferences(IPreferenceStore store) { String colorkey = PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + METHOD + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_COLOR_SUFFIX; String boldkey = PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + METHOD + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_BOLD_SUFFIX; String italickey = PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + METHOD + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ITALIC_SUFFIX; String enabledkey = PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + METHOD + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED_SUFFIX; @SuppressWarnings("deprecation") String oldColorkey = PreferenceConstants.EDITOR_JAVA_METHOD_NAME_COLOR; @SuppressWarnings("deprecation") String oldBoldkey = PreferenceConstants.EDITOR_JAVA_METHOD_NAME_BOLD; @SuppressWarnings("deprecation") String oldItalickey = PreferenceConstants.EDITOR_JAVA_METHOD_NAME_ITALIC; if (conditionalReset(store, oldColorkey, colorkey) || conditionalReset(store, oldBoldkey, boldkey) || conditionalReset(store, oldItalickey, italickey)) { store.setValue(enabledkey, true); } }
From source file:cz.vutbr.fit.xhriba01.bc.jdt.ui.javaeditor.SemanticHighlightings.java
License:Open Source License
/** * In 3.1, annotations were highlighted by a rule-based word matcher that matched any identifier * preceded by an '@' sign and possibly white space. * <p>//from w w w . j a v a 2s. c o m * This does not work when there is a comment between the '@' and the annotation, results in * stale highlighting if there is a new line between the '@' and the annotation, and does not * work for highlighting annotation declarations. Because different preference key naming * schemes are used, we have to migrate the old settings to the new ones, which is done here. * Nothing needs to be done if the old settings were set to the default values. * </p> * * @param store the preference store to migrate * @since 3.2 */ private static void convertAnnotationHighlightingPreferences(IPreferenceStore store) { String colorkey = PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + ANNOTATION + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_COLOR_SUFFIX; String boldkey = PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + ANNOTATION + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_BOLD_SUFFIX; String italickey = PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + ANNOTATION + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ITALIC_SUFFIX; String strikethroughKey = PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + ANNOTATION + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_STRIKETHROUGH_SUFFIX; String underlineKey = PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + ANNOTATION + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_UNDERLINE_SUFFIX; String enabledkey = PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + ANNOTATION + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED_SUFFIX; @SuppressWarnings("deprecation") String oldColorkey = PreferenceConstants.EDITOR_JAVA_ANNOTATION_COLOR; @SuppressWarnings("deprecation") String oldBoldkey = PreferenceConstants.EDITOR_JAVA_ANNOTATION_BOLD; @SuppressWarnings("deprecation") String oldItalickey = PreferenceConstants.EDITOR_JAVA_ANNOTATION_ITALIC; @SuppressWarnings("deprecation") String oldStrikethroughKey = PreferenceConstants.EDITOR_JAVA_ANNOTATION_STRIKETHROUGH; @SuppressWarnings("deprecation") String oldUnderlineKey = PreferenceConstants.EDITOR_JAVA_ANNOTATION_UNDERLINE; if (conditionalReset(store, oldColorkey, colorkey) || conditionalReset(store, oldBoldkey, boldkey) || conditionalReset(store, oldItalickey, italickey) || conditionalReset(store, oldStrikethroughKey, strikethroughKey) || conditionalReset(store, oldUnderlineKey, underlineKey)) { store.setValue(enabledkey, true); } }