List of usage examples for org.eclipse.jface.preference IPreferenceStore getDefaultInt
int getDefaultInt(String name);
From source file:org.caleydo.core.internal.cmd.ZoomHandler.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { String action = event.getParameter("action"); final boolean reset = StringUtils.equalsIgnoreCase(action, "reset"); final boolean increaseZoomFactor = StringUtils.containsIgnoreCase(action, "in"); final IPreferenceStore prefs = MyPreferences.prefs(); int current = prefs.getInt(MyPreferences.VIEW_ZOOM_FACTOR); int next;//w w w.j a va2 s. co m if (reset) next = prefs.getDefaultInt(MyPreferences.VIEW_ZOOM_FACTOR); else if (increaseZoomFactor) next = current + CHANGE; else next = Math.max(10, current - CHANGE); MyPreferences.prefs().setValue(MyPreferences.VIEW_ZOOM_FACTOR, next); return null; }
From source file:org.cfeclipse.cfml.preferences.OverlayPreferenceStore.java
License:Open Source License
private void loadProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target, boolean forceInitialization) { TypeDescriptor d = key.fDescriptor;//w w w. java 2s . c o m if (BOOLEAN == d) { if (forceInitialization) target.setValue(key.fKey, true); target.setValue(key.fKey, orgin.getBoolean(key.fKey)); target.setDefault(key.fKey, orgin.getDefaultBoolean(key.fKey)); } else if (DOUBLE == d) { if (forceInitialization) target.setValue(key.fKey, 1.0D); target.setValue(key.fKey, orgin.getDouble(key.fKey)); target.setDefault(key.fKey, orgin.getDefaultDouble(key.fKey)); } else if (FLOAT == d) { if (forceInitialization) target.setValue(key.fKey, 1.0F); target.setValue(key.fKey, orgin.getFloat(key.fKey)); target.setDefault(key.fKey, orgin.getDefaultFloat(key.fKey)); } else if (INT == d) { if (forceInitialization) target.setValue(key.fKey, 1); target.setValue(key.fKey, orgin.getInt(key.fKey)); target.setDefault(key.fKey, orgin.getDefaultInt(key.fKey)); } else if (LONG == d) { if (forceInitialization) target.setValue(key.fKey, 1L); target.setValue(key.fKey, orgin.getLong(key.fKey)); target.setDefault(key.fKey, orgin.getDefaultLong(key.fKey)); } else if (STRING == d) { if (forceInitialization) target.setValue(key.fKey, "1"); target.setValue(key.fKey, orgin.getString(key.fKey)); target.setDefault(key.fKey, orgin.getDefaultString(key.fKey)); } }
From source file:org.csstudio.diirt.util.preferences.DIIRTPreferencesPlugin.java
License:Open Source License
public static void copyChannelAccess(IPreferenceStore source, DIIRTPreferences destination) { destination.setDefaultBoolean(PREF_DBE_PROPERTY_SUPPORTED, source.getDefaultBoolean(PREF_DBE_PROPERTY_SUPPORTED)); destination.setDefaultBoolean(PREF_HONOR_ZERO_PRECISION, source.getDefaultBoolean(PREF_HONOR_ZERO_PRECISION)); destination.setDefaultString(PREF_MONITOR_MASK, source.getDefaultString(PREF_MONITOR_MASK)); destination.setDefaultInteger(PREF_CUSTOM_MASK, source.getDefaultInt(PREF_CUSTOM_MASK)); destination.setDefaultBoolean(PREF_VALUE_RTYP_MONITOR, source.getDefaultBoolean(PREF_VALUE_RTYP_MONITOR)); destination.setDefaultString(PREF_VARIABLE_LENGTH_ARRAY, source.getDefaultString(PREF_VARIABLE_LENGTH_ARRAY)); destination.setDefaultString(PREF_ADDR_LIST, source.getDefaultString(PREF_ADDR_LIST)); destination.setDefaultBoolean(PREF_AUTO_ADDR_LIST, source.getDefaultBoolean(PREF_AUTO_ADDR_LIST)); destination.setDefaultDouble(PREF_BEACON_PERIOD, source.getDefaultDouble(PREF_BEACON_PERIOD)); destination.setDefaultDouble(PREF_CONNECTION_TIMEOUT, source.getDefaultDouble(PREF_CONNECTION_TIMEOUT)); destination.setDefaultInteger(PREF_MAX_ARRAY_SIZE, source.getDefaultInt(PREF_MAX_ARRAY_SIZE)); destination.setDefaultInteger(PREF_REPEATER_PORT, source.getDefaultInt(PREF_REPEATER_PORT)); destination.setDefaultInteger(PREF_SERVER_PORT, source.getDefaultInt(PREF_SERVER_PORT)); destination.setBoolean(PREF_DBE_PROPERTY_SUPPORTED, source.getBoolean(PREF_DBE_PROPERTY_SUPPORTED)); destination.setBoolean(PREF_HONOR_ZERO_PRECISION, source.getBoolean(PREF_HONOR_ZERO_PRECISION)); destination.setString(PREF_MONITOR_MASK, source.getString(PREF_MONITOR_MASK)); destination.setInteger(PREF_CUSTOM_MASK, source.getInt(PREF_CUSTOM_MASK)); destination.setBoolean(PREF_VALUE_RTYP_MONITOR, source.getBoolean(PREF_VALUE_RTYP_MONITOR)); destination.setString(PREF_VARIABLE_LENGTH_ARRAY, source.getString(PREF_VARIABLE_LENGTH_ARRAY)); destination.setString(PREF_ADDR_LIST, source.getString(PREF_ADDR_LIST)); destination.setBoolean(PREF_AUTO_ADDR_LIST, source.getBoolean(PREF_AUTO_ADDR_LIST)); destination.setDouble(PREF_BEACON_PERIOD, source.getDouble(PREF_BEACON_PERIOD)); destination.setDouble(PREF_CONNECTION_TIMEOUT, source.getDouble(PREF_CONNECTION_TIMEOUT)); destination.setInteger(PREF_MAX_ARRAY_SIZE, source.getInt(PREF_MAX_ARRAY_SIZE)); destination.setInteger(PREF_REPEATER_PORT, source.getInt(PREF_REPEATER_PORT)); destination.setInteger(PREF_SERVER_PORT, source.getInt(PREF_SERVER_PORT)); }
From source file:org.dawnsci.plotting.jreality.print.JRealityPrintDialog.java
License:Open Source License
/** * PlotPrintPreviewDialog is listening to eventual property changes done through the Preference Page *///w ww . j a va 2 s . c o m private void addPropertyListeners() { store.addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); IPreferenceStore preferenceStore = store; if (property.equals(PRINTSETTINGS_PRINTER_NAME) || property.equals(PRINTSETTINGS_SCALE) || property.equals(PRINTSETTINGS_RESOLUTION) || property.equals(PRINTSETTINGS_ORIENTATION)) { int printerName; if (preferenceStore.isDefault(PRINTSETTINGS_PRINTER_NAME)) { printerName = preferenceStore.getDefaultInt(PRINTSETTINGS_PRINTER_NAME); } else { printerName = preferenceStore.getInt(PRINTSETTINGS_PRINTER_NAME); } printerNames = Printer.getPrinterList(); for (int i = 0; i < printerNames.length; i++) { if (i == printerName) { settings.setPrinterData(printerNames[i]); break; } } int scale; if (preferenceStore.isDefault(PRINTSETTINGS_SCALE)) { scale = preferenceStore.getDefaultInt(PRINTSETTINGS_SCALE); } else { scale = preferenceStore.getInt(PRINTSETTINGS_SCALE); } Scale[] scales = Scale.values(); for (int i = 0; i < scales.length; i++) { if (i == scale) { settings.setScale(scales[i]); break; } } int resolution; if (preferenceStore.isDefault(PRINTSETTINGS_RESOLUTION)) { resolution = preferenceStore.getDefaultInt(PRINTSETTINGS_RESOLUTION); } else { resolution = preferenceStore.getInt(PRINTSETTINGS_RESOLUTION); } Resolution[] resolutions = Resolution.values(); for (int i = 0; i < resolutions.length; i++) { if (i == resolution) { settings.setResolution(resolutions[i]); break; } } int orientation; if (preferenceStore.isDefault(PRINTSETTINGS_ORIENTATION)) { orientation = preferenceStore.getDefaultInt(PRINTSETTINGS_ORIENTATION); } else { orientation = preferenceStore.getInt(PRINTSETTINGS_ORIENTATION); } Orientation[] orientations = Orientation.values(); for (int i = 0; i < orientations.length; i++) { if (i == orientation) { settings.setOrientation(orientations[i]); break; } } } } }); }
From source file:org.dawnsci.plotting.jreality.print.JRealityPrintDialog.java
License:Open Source License
private int getPreferencePrinterName() { IPreferenceStore preferenceStore = store; return preferenceStore.isDefault(PRINTSETTINGS_PRINTER_NAME) ? preferenceStore.getDefaultInt(PRINTSETTINGS_PRINTER_NAME) : preferenceStore.getInt(PRINTSETTINGS_PRINTER_NAME); }
From source file:org.dawnsci.plotting.jreality.print.JRealityPrintDialog.java
License:Open Source License
private int getPreferencePrintScale() { IPreferenceStore preferenceStore = store; return preferenceStore.isDefault(PRINTSETTINGS_SCALE) ? preferenceStore.getDefaultInt(PRINTSETTINGS_SCALE) : preferenceStore.getInt(PRINTSETTINGS_SCALE); }
From source file:org.dawnsci.plotting.jreality.print.JRealityPrintDialog.java
License:Open Source License
private int getPreferencePrintResolution() { IPreferenceStore preferenceStore = store; return preferenceStore.isDefault(PRINTSETTINGS_RESOLUTION) ? preferenceStore.getDefaultInt(PRINTSETTINGS_RESOLUTION) : preferenceStore.getInt(PRINTSETTINGS_RESOLUTION); }
From source file:org.drools.eclipse.preferences.DroolsPreferencePage.java
License:Apache License
private void initializeDefaults() { IPreferenceStore store = getPreferenceStore(); buildAllCheckBox.setSelection(store.getDefaultBoolean(IDroolsConstants.BUILD_ALL)); collapseEditorCheckBox.setSelection(store.getDefaultBoolean(IDroolsConstants.EDITOR_FOLDING)); cacheParsedRulesCheckBox.setSelection(store.getDefaultBoolean(IDroolsConstants.CACHE_PARSED_RULES)); String skin = store.getDefaultString(IDroolsConstants.SKIN); int index = 0; if ("BPMN".equals(skin)) { index = 1;//from w w w . java 2 s. co m } processSkinCombo.select(index); allowNodeCustomizationCheckBox .setSelection(store.getDefaultBoolean(IDroolsConstants.ALLOW_NODE_CUSTOMIZATION)); internalAPICombo.select(store.getDefaultInt(IDroolsConstants.ALLOW_NODE_CUSTOMIZATION)); }
From source file:org.drools.eclipse.task.preferences.DroolsTaskPreferencePage.java
License:Apache License
private void initializeDefaults() { IPreferenceStore store = getPreferenceStore(); ipAddressText.setText(store.getDefaultString(DroolsTaskConstants.SERVER_IP_ADDRESS)); portText.setText(store.getDefaultInt(DroolsTaskConstants.SERVER_PORT) + ""); languageText.setText(store.getDefaultString(DroolsTaskConstants.LANGUAGE)); }
From source file:org.eclipse.cdt.dsf.debug.internal.ui.disassembly.preferences.DisassemblyPreferencePage.java
License:Open Source License
@Override protected void performDefaults() { IPreferenceStore store = getPreferenceStore(); for (Iterator<Button> iter = fCheckBoxes.iterator(); iter.hasNext();) { Button btn = iter.next(); btn.setSelection(store.getDefaultBoolean((String) btn.getData())); }/* w ww. j av a 2 s .c om*/ for (Iterator<Text> iter = fNumberFields.iterator(); iter.hasNext();) { Text field = iter.next(); long value = store.getDefaultLong((String) field.getData()); field.setText("0x" + Long.toHexString(value)); //$NON-NLS-1$ } for (Iterator<Combo> iter = fComboBoxes.iterator(); iter.hasNext();) { Combo combo = iter.next(); int value = store.getDefaultInt((String) combo.getData()); for (int i = 0; i < fcRadixValues.length; i++) { if (fcRadixValues[i] == value) { combo.select(i); } } } super.performDefaults(); }