List of usage examples for org.eclipse.jface.preference IPreferenceStore getBoolean
boolean getBoolean(String name);
From source file:com.vectrace.MercurialEclipse.views.console.HgConsoleHolder.java
License:Open Source License
private HgConsoleHolder() { IPreferenceStore store = MercurialEclipsePlugin.getDefault().getPreferenceStore(); debugTimeEnabled = store.getBoolean(PREF_CONSOLE_DEBUG_TIME); debugEnabled = store.getBoolean(PREF_CONSOLE_DEBUG); }
From source file:com.vectrace.MercurialEclipse.views.console.HgConsoleHolder.java
License:Open Source License
/** * If force then instantiates {@link #console} if it is not already instantiated. Note: may be asynchronous. * * @param force Whether to instantiate {@link #console} if it is not already *//*from w ww .j a v a 2s. c o m*/ private void init(boolean force) { if (console != null || (bInitialized && !force)) { return; } synchronized (this) { if (console != null || (bInitialized && !force)) { return; } if (!bInitialized) { IPreferenceStore store = MercurialEclipsePlugin.getDefault().getPreferenceStore(); store.addPropertyChangeListener(this); showOnMessage = store.getBoolean(PREF_CONSOLE_SHOW_ON_MESSAGE); handleJavaHgLogging(); if (!PlatformUI.isWorkbenchRunning()) { showOnMessage = false; } bInitialized = true; } if (force && console == null) { // install font // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=298795 // we must run this stupid code in the UI thread if (Display.getCurrent() != null) { initConsole(); } else { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { initConsole(); } }); } } } }
From source file:com.vectrace.MercurialEclipse.views.console.HgConsoleHolder.java
License:Open Source License
public void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); IPreferenceStore store = MercurialEclipsePlugin.getDefault().getPreferenceStore(); if (PREF_CONSOLE_SHOW_ON_MESSAGE.equals(event.getProperty())) { showOnMessage = store.getBoolean(PREF_CONSOLE_SHOW_ON_MESSAGE); } else if (property.equals(PREF_CONSOLE_DEBUG_TIME)) { debugTimeEnabled = store.getBoolean(PREF_CONSOLE_DEBUG_TIME); } else if (property.equals(PREF_CONSOLE_DEBUG)) { debugEnabled = store.getBoolean(PREF_CONSOLE_DEBUG); } else if (console != null) { console.propertyChange(event);//from w w w. java 2 s . c o m } }
From source file:com.windowtester.runtime.swt.internal.preferences.PlaybackSettings.java
License:Open Source License
/** * Load values from workspace preferences. *//*from ww w. ja v a 2 s.com*/ 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)); }
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 va2 s . c om*/ 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.worldline.asciidoctools.editor.internal.AsciidocEditor.java
License:Open Source License
public void refreshLayout() { IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); boolean verticalSplit = preferenceStore.getBoolean("verticalSplit"); int editorRatio = preferenceStore.contains("editorRatio") ? preferenceStore.getInt("editorRatio") : 50; if (verticalSplit) { this.tiltButton.setToolTipText("Switch To Horizontal Split"); this.verticalScale.setVisible(false); this.verticalScale.setToolTipText(""); this.horizontalScale.setVisible(true); this.horizontalScale.setToolTipText(String.format("Edition Display Ratio: %s%%", editorRatio)); FormDataBuilder.on(tiltButton).bottom().left().top(editionZone); FormDataBuilder.on(refreshButton).bottom().right().top(editionZone); FormDataBuilder.on(horizontalScale).bottom().left(tiltButton).right(refreshButton); FormDataBuilder.on(editionZone).left().right(editorRatio).top().bottom(horizontalScale); FormDataBuilder.on(renderingZone).left(editorRatio).right().top().bottom(horizontalScale); } else {/*ww w . ja v a 2 s . co m*/ this.tiltButton.setToolTipText("Switch To Vertical Split"); this.verticalScale.setVisible(true); this.verticalScale.setToolTipText(String.format("Edition Display Ratio: %s%%", editorRatio)); this.horizontalScale.setVisible(false); this.horizontalScale.setToolTipText(""); FormDataBuilder.on(tiltButton).top().right().left(editionZone); FormDataBuilder.on(refreshButton).bottom().right().left(editionZone); FormDataBuilder.on(verticalScale).right().top(tiltButton).bottom(refreshButton); FormDataBuilder.on(editionZone).left().right(verticalScale).top().bottom(editorRatio); FormDataBuilder.on(renderingZone).left().right(verticalScale).bottom().top(editorRatio); } this.verticalScale.setSelection(editorRatio); this.horizontalScale.setSelection(editorRatio); // this.background.update(); this.background.layout(true); }
From source file:com.xored.glance.internal.ui.GlanceStartup.java
License:Open Source License
@Override public void earlyStartup() { IPreferenceStore store = GlancePlugin.getDefault().getPreferenceStore(); if (store.getBoolean(PANEL_STARTUP)) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override//from www . ja v a 2 s . c om public void run() { SearchManager.getIntance().startup(); } }); } }
From source file:com.zeus.eclipsePlugin.PreferenceManager.java
License:Open Source License
/** * Add listeners to all the preference stores we are interested in. Should be * called once on plug-in start./* w w w.j a v a 2s . c o m*/ */ public static void initialiseListeners() { ZDebug.print(3, "initialiseListeners()"); IPreferenceStore preferences = ZXTMPlugin.getDefault().getPreferenceStore(); // Perform updates on all the preferences this plugin uses to ensure all // the settings are pushed to the relevant classes. ZXTMPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(new PreferenceListener()); for (Preference pref : EnumSet.allOf(Preference.class)) { switch (pref.getFormat()) { case BOOLEAN: { update(pref, preferences.getBoolean(pref.getKey())); break; } case INT: case MILISECONDS: case POSITIVE_INT: { update(pref, preferences.getInt(pref.getKey())); break; } case STRING: case STRING_LIST: case COLOUR: { update(pref, preferences.getString(pref.getKey())); break; } default: { System.err.println("Preference " + pref + " format " + pref.getFormat() + " not updated."); } } } // Listen to the editors property changes IPreferenceStore editorPrefs = EditorsUI.getPreferenceStore(); editorPrefs.addPropertyChangeListener(new ExternalPreferenceListener(Source.CORE_EDITOR)); }
From source file:com.zeus.eclipsePlugin.PreferenceManager.java
License:Open Source License
/** * Convenience method to get a preference value for this plug-in. * @param pref The preference you want the value of. * @return The value of the preference as a boolean. *///from w ww.j a va 2 s . c o m public static Boolean getPreferenceBool(Preference pref) { if (ZXTMPlugin.getDefault() == null) { return (Boolean) pref.getDefault(); } IPreferenceStore preferences = ZXTMPlugin.getDefault().getPreferenceStore(); return preferences.getBoolean(pref.getKey()); }
From source file:cz.vutbr.fit.xhriba01.bc.jdt.ui.javaeditor.SemanticHighlightings.java
License:Open Source License
/** * Tests whether <code>event</code> in <code>store</code> affects the * enablement of semantic highlighting.//from ww w . j a v a 2 s .co m * * @param store the preference store where <code>event</code> was observed * @param event the property change under examination * @return <code>true</code> if <code>event</code> changed semantic * highlighting enablement, <code>false</code> if it did not * @since 3.1 */ public static boolean affectsEnablement(IPreferenceStore store, PropertyChangeEvent event) { String relevantKey = null; SemanticHighlighting[] highlightings = getSemanticHighlightings(); for (int i = 0; i < highlightings.length; i++) { if (event.getProperty().equals(getEnabledPreferenceKey(highlightings[i]))) { relevantKey = event.getProperty(); break; } } if (relevantKey == null) return false; for (int i = 0; i < highlightings.length; i++) { String key = getEnabledPreferenceKey(highlightings[i]); if (key.equals(relevantKey)) continue; if (store.getBoolean(key)) return false; // another is still enabled or was enabled before } // all others are disabled, so toggling relevantKey affects the enablement return true; }