List of usage examples for org.eclipse.jface.preference IPreferenceStore getInt
int getInt(String name);
From source file:com.twinsoft.convertigo.eclipse.ConvertigoPlugin.java
License:Open Source License
static public int getTraceplayerPort() { IPreferenceStore preferenceStore = ConvertigoPlugin.getDefault().getPreferenceStore(); return preferenceStore.getInt(ConvertigoPlugin.PREFERENCE_TRACEPLAYER_PORT); }
From source file:com.vectrace.MercurialEclipse.history.MercurialHistory.java
License:Open Source License
/** * Load more revisions./*from w ww . j a v a 2s . c o m*/ * * @param monitor * @param from Revision number. The batch of revisions before this revision are loaded. * @throws CoreException */ public void load(IProgressMonitor monitor, int from) throws CoreException { if (from < 0) { return; } if (from == Integer.MAX_VALUE) { // We're getting revisions up to the latest one available. // So clear out the cached list, as it may contain revisions // that no longer exist (e.g. after a strip/rollback). clear(); tags = null; lastReqRevision = 0; } // check if we have reached the bottom (initially = Integer.MAX_VALUE) if (from == lastReqRevision) { return; } final IPreferenceStore store = MercurialEclipsePlugin.getDefault().getPreferenceStore(); final int logBatchSize = store.getInt(LOG_BATCH_SIZE); final SortedSet<JHgChangeSet> changeSets = new TreeSet<JHgChangeSet>(CS_COMPARATOR); final IPath location; if (!isRootHistory()) { changeSets.addAll(HgLogClient.getResourceLog(hgRoot, resource, logBatchSize, from)); location = ResourceUtils.getPath(resource); } else { changeSets.addAll(HgLogClient.getRootLog(hgRoot, logBatchSize, from)); location = hgRoot.getIPath(); } // no result -> bottom reached if (changeSets.isEmpty()) { lastReqRevision = from; return; } if (revisions.size() < changeSets.size() // ^ ???? || !(location.equals(ResourceUtils.getPath(revisions.get(0).getResource())))) { clear(); } List<MercurialRevision> batch = createMercurialRevisions(changeSets); if (showGraph) { try { loadGraphData(batch, revisions.isEmpty() ? null : revisions.get(revisions.size() - 1)); } catch (Exception e) { // in some cases files that have been renamed cause loadGraphData to fail with an exception // catch it here so we can at least still display the non-graph revision info MercurialEclipsePlugin.logError("Failed to load graph data", e); } } if (!revisions.isEmpty()) { // in case of a particular data fetch before, we may still have some // temporary tags assigned to the last visible revision => cleanup it now MercurialRevision lastOne = revisions.get(revisions.size() - 1); lastOne.cleanupExtraTags(); } int i = revisions.size(); for (MercurialRevision rev : batch) { // When we follow renames, we are bound to have duplicate revisions (from both the new // and old names/paths). We make sure not to show the same revision several times. if (!revisions.contains(rev)) { if (layout != null) { rev.setGraphRow(layout.getRow(i)); } revisions.add(rev); i += 1; } } lastReqRevision = from; if (showTags) { if (!isRootHistory()) { if (tags == null) { fetchTags(); } assignTagsToRevisions(); } } }
From source file:com.vectrace.MercurialEclipse.team.cache.LocalChangesetCache.java
License:Open Source License
@Override protected void configureFromPreferences(IPreferenceStore store) { logBatchSize = store.getInt(MercurialPreferenceConstants.LOG_BATCH_SIZE); if (logBatchSize < 0) { logBatchSize = 2000;/* w w w . ja v a 2 s .c om*/ MercurialEclipsePlugin.logWarning(Messages.localChangesetCache_LogLimitNotCorrectlyConfigured, null); } }
From source file:com.vectrace.MercurialEclipse.views.console.HgConsole.java
License:Open Source License
private void initWrapSetting(IPreferenceStore store) { if (store.getBoolean(PREF_CONSOLE_WRAP)) { setConsoleWidth(store.getInt(PREF_CONSOLE_WIDTH)); } else {/*from ww w . ja va2 s. c o m*/ setConsoleWidth(-1); } }
From source file:com.vectrace.MercurialEclipse.views.console.HgConsole.java
License:Open Source License
private void initLimitOutput(IPreferenceStore store) { if (store.getBoolean(PREF_CONSOLE_LIMIT_OUTPUT)) { int highWaterMark = store.getInt(PREF_CONSOLE_HIGH_WATER_MARK); if (highWaterMark < 1000) { highWaterMark = 1000;//from ww w .j a v a 2s . c om } setWaterMarks(0, highWaterMark); } else { setWaterMarks(0, 1000); } }
From source file:com.windowtester.runtime.swt.internal.preferences.PlaybackSettings.java
License:Open Source License
/** * Load values from workspace preferences. *//*w ww . j a 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/* 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 {//w w w . j a v a2 s . c o 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.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.//from ww w . j a va 2s .com */ 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 an int. */// www. j av a2s .c o m public static int getPreferenceInt(Preference pref) { if (ZXTMPlugin.getDefault() == null) { return (Integer) pref.getDefault(); } IPreferenceStore preferences = ZXTMPlugin.getDefault().getPreferenceStore(); return preferences.getInt(pref.getKey()); }