List of usage examples for org.eclipse.jface.preference IPreferenceStore getInt
int getInt(String name);
From source file:net.sourceforge.eclipsetrader.core.ui.preferences.DataPreferencesPage.java
License:Open Source License
protected Control createContents(Composite parent) { Composite content = new Composite(parent, SWT.NONE); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 3;//from ww w. j a va 2 s. c o m gridLayout.marginWidth = gridLayout.marginHeight = 0; content.setLayout(gridLayout); IPreferenceStore preferences = CorePlugin.getDefault().getPreferenceStore(); Label label = new Label(content, SWT.NONE); label.setText(Messages.DataPreferencesPage_HistoryRange); label.setLayoutData(new GridData(200, SWT.DEFAULT)); securityHistoryRange = new Spinner(content, SWT.BORDER); securityHistoryRange.setMinimum(1); securityHistoryRange.setMaximum(50); securityHistoryRange.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); securityHistoryRange.setToolTipText(Messages.DataPreferencesPage_HistoryRangeTooltip); securityHistoryRange.setSelection(preferences.getInt(CorePlugin.PREFS_HISTORICAL_PRICE_RANGE)); label = new Label(content, SWT.NONE); label.setText(Messages.DataPreferencesPage_Years); deleteCanceledOrders = new Button(content, SWT.CHECK); deleteCanceledOrders.setText(Messages.DataPreferencesPage_DeleteCanceledOrders); deleteCanceledOrders.setSelection(preferences.getBoolean(CorePlugin.PREFS_DELETE_CANCELED_ORDERS)); deleteCanceledOrders.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { canceledOrdersDays.setEnabled(deleteCanceledOrders.getSelection()); } }); canceledOrdersDays = new Spinner(content, SWT.BORDER); canceledOrdersDays.setMinimum(1); canceledOrdersDays.setMaximum(365); canceledOrdersDays.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); canceledOrdersDays.setSelection(preferences.getInt(CorePlugin.PREFS_DELETE_CANCELED_ORDERS_DAYS)); canceledOrdersDays.setEnabled(deleteCanceledOrders.getSelection()); label = new Label(content, SWT.NONE); label.setText(Messages.DataPreferencesPage_Days); deleteFilledOrders = new Button(content, SWT.CHECK); deleteFilledOrders.setText(Messages.DataPreferencesPage_DeleteFilledOrders); deleteFilledOrders.setSelection(preferences.getBoolean(CorePlugin.PREFS_DELETE_FILLED_ORDERS)); deleteFilledOrders.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { filledOrdersDays.setEnabled(deleteFilledOrders.getSelection()); } }); filledOrdersDays = new Spinner(content, SWT.BORDER); filledOrdersDays.setMinimum(1); filledOrdersDays.setMaximum(365); filledOrdersDays.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); filledOrdersDays.setSelection(preferences.getInt(CorePlugin.PREFS_DELETE_FILLED_ORDERS_DAYS)); filledOrdersDays.setEnabled(deleteFilledOrders.getSelection()); label = new Label(content, SWT.NONE); label.setText(Messages.DataPreferencesPage_Days); return content; }
From source file:net.sourceforge.eclipsetrader.news.preferences.NewsPreferencesPage.java
License:Open Source License
protected Control createContents(Composite parent) { Composite content = new Composite(parent, SWT.NONE); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2;// w w w . j a va 2s .c o m gridLayout.marginWidth = gridLayout.marginHeight = 0; content.setLayout(gridLayout); updateStartup = new Button(content, SWT.CHECK); updateStartup.setText(Messages.NewsPreferencesPage_StartupUpdate); updateStartup.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1)); followQuoteFeed = new Button(content, SWT.CHECK); followQuoteFeed.setText(Messages.NewsPreferencesPage_FollowQuoteFeed); followQuoteFeed.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1)); Label label = new Label(content, SWT.NONE); label.setText(Messages.NewsPreferencesPage_DaysToKeep); daysToKeep = new Spinner(content, SWT.BORDER); daysToKeep.setMinimum(1); daysToKeep.setMaximum(9999); table = new Table(content, SWT.FULL_SELECTION | SWT.SINGLE | SWT.CHECK); table.setHeaderVisible(true); table.setLinesVisible(false); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1); gridData.heightHint = 250; table.setLayoutData(gridData); TableColumn column = new TableColumn(table, SWT.NONE); column.setText(Messages.NewsPreferencesPage_Provider); IPreferenceStore store = NewsPlugin.getDefault().getPreferenceStore(); updateStartup.setSelection(store.getBoolean(NewsPlugin.PREFS_UPDATE_ON_STARTUP)); followQuoteFeed.setSelection(store.getBoolean(NewsPlugin.PREFS_FOLLOW_QUOTE_FEED)); daysToKeep.setSelection(store.getInt(CorePlugin.PREFS_NEWS_DATE_RANGE)); IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint extensionPoint = registry.getExtensionPoint(NewsPlugin.PROVIDER_EXTENSION_POINT); if (extensionPoint != null) { IConfigurationElement[] elements = extensionPoint.getConfigurationElements(); for (int i = 0; i < elements.length; i++) { String id = elements[i].getAttribute("id"); //$NON-NLS-1$ TableItem tableItem = new TableItem(table, SWT.NONE); tableItem.setText(elements[i].getAttribute("name")); //$NON-NLS-1$ tableItem.setChecked(store.getBoolean(id)); tableItem.setData(id); } } table.getColumn(0).pack(); return content; }
From source file:net.sourceforge.eclipsetrader.TraderPresentationFactory.java
License:Open Source License
public StackPresentation createViewPresentation(Composite parent, IStackPresentationSite site) { int viewTabPosition = WorkbenchPlugin.getDefault().getPreferenceStore() .getInt(IPreferenceConstants.VIEW_TAB_POSITION); DefaultTabFolder folder = new DefaultTabFolder(parent, viewTabPosition | SWT.BORDER, site.supportsState(IStackPresentationSite.STATE_MINIMIZED), site.supportsState(IStackPresentationSite.STATE_MAXIMIZED)); final IPreferenceStore store = PlatformUI.getPreferenceStore(); final int minimumCharacters = store.getInt(IWorkbenchPreferenceConstants.VIEW_MINIMUM_CHARACTERS); if (minimumCharacters >= 0) folder.setMinimumCharacters(minimumCharacters); PresentablePartFolder partFolder = new PresentablePartFolder(folder); folder.setUnselectedCloseVisible(true); folder.setUnselectedImageVisible(true); TabbedStackPresentation result = new TabbedStackPresentation(site, partFolder, new StandardViewSystemMenu(site)); DefaultThemeListener themeListener = new DefaultThemeListener(folder, result.getTheme()); result.getTheme().addListener(themeListener); new DefaultSimpleTabListener(result.getApiPreferences(), IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS, folder); return result; }
From source file:net.sourceforge.eclipsetrader.trading.internal.OrdersCleanupJob.java
License:Open Source License
protected IStatus run(IProgressMonitor monitor) { IPreferenceStore preferences = CorePlugin.getDefault().getPreferenceStore(); log.debug("Start orders cleanup"); Date today = Calendar.getInstance().getTime(); Order[] orders = (Order[]) CorePlugin.getRepository().allOrders().toArray(new Order[0]); for (int i = 0; i < orders.length; i++) { if (orders[i].getStatus().equals(OrderStatus.CANCELED) || orders[i].getStatus().equals(OrderStatus.REJECTED)) { long diff = (today.getTime() - orders[i].getDate().getTime()) / (1000 * 60 * 60 * 24); if (preferences.getBoolean(CorePlugin.PREFS_DELETE_CANCELED_ORDERS) && diff >= preferences.getInt(CorePlugin.PREFS_DELETE_CANCELED_ORDERS_DAYS)) { if (orders[i].getProvider() != null) log.info("Deleting order " + CorePlugin.getPluginName(CorePlugin.TRADING_PROVIDERS_EXTENSION_POINT, orders[i].getPluginId()) + " / " + orders[i].getOrderId()); else log.info("Deleting order " + orders[i].getOrderId()); CorePlugin.getRepository().delete(orders[i]); }//w ww . j av a 2 s . c om } else if (orders[i].getStatus().equals(OrderStatus.FILLED)) { long diff = (today.getTime() - orders[i].getDate().getTime()) / (1000 * 60 * 60 * 24); if (preferences.getBoolean(CorePlugin.PREFS_DELETE_FILLED_ORDERS) && diff >= preferences.getInt(CorePlugin.PREFS_DELETE_FILLED_ORDERS_DAYS)) { if (orders[i].getProvider() != null) log.info("Deleting order " + CorePlugin.getPluginName(CorePlugin.TRADING_PROVIDERS_EXTENSION_POINT, orders[i].getPluginId()) + " / " + orders[i].getOrderId()); else log.info("Deleting order " + orders[i].getOrderId()); CorePlugin.getRepository().delete(orders[i]); } } } log.debug("Orders cleanup completed"); return Status.OK_STATUS; }
From source file:net.sourceforge.javahexeditor.plugin.editors.HexEditorPreferences.java
License:Open Source License
/** * Gets font data information common to all plugin editors. Data comes from * the preferences store./* www. j a va2 s . com*/ * * @return Font data to be used by plugin editors, not <code>null</code>. */ public static FontData getFontData() { IPreferenceStore store = HexEditorPlugin.getDefault().getPreferenceStore(); String name = store.getString(Preferences.FONT_NAME); int style = store.getInt(Preferences.FONT_STYLE); int size = store.getInt(Preferences.FONT_SIZE); FontData fontData = null; if (name != null && !name.isEmpty() && size > 0) { fontData = new FontData(name, size, style); } else { fontData = Preferences.getDefaultFontData(); } return fontData; }
From source file:net.tourbook.common.util.Util.java
License:Open Source License
public static int getPrefixPrefInt(final IPreferenceStore prefStore, final String prefPrefix, final String prefKey) { int prefValue; if (prefStore.contains(prefPrefix + prefKey)) { prefValue = prefStore.getInt(prefPrefix + prefKey); } else {//from w w w . j a v a 2 s .c o m prefValue = prefStore.getDefaultInt(prefKey); } return prefValue; }
From source file:net.tourbook.device.garmin.GarminSAXHandler.java
License:Open Source License
/** * Set the notes into the description and/or title field * //from w w w .ja va2 s.c o m * @param tourData */ private void setTourNotes(final TourData tourData) { if (_tourNotes == null || _tourNotes.length() == 0) { return; } final IPreferenceStore store = Activator.getDefault().getPreferenceStore(); final boolean isDescriptionField = store.getBoolean(IPreferences.IS_IMPORT_INTO_DESCRIPTION_FIELD); final boolean isTitleField = store.getBoolean(IPreferences.IS_IMPORT_INTO_TITLE_FIELD); if (isDescriptionField) { tourData.setTourDescription(new String(_tourNotes)); } if (isTitleField) { final boolean isImportAll = store.getBoolean(IPreferences.IS_TITLE_IMPORT_ALL); final int titleCharacters = store.getInt(IPreferences.NUMBER_OF_TITLE_CHARACTERS); if (isImportAll) { tourData.setTourTitle(new String(_tourNotes)); } else { final int endIndex = Math.min(_tourNotes.length(), titleCharacters); tourData.setTourTitle(_tourNotes.substring(0, endIndex)); } } }
From source file:net.tourbook.map2.view.TourMapPropertyView.java
License:Open Source License
private void restoreSettings() { final IPreferenceStore store = TourbookPlugin.getDefault().getPreferenceStore(); // get values from pref store // tile info/border _chkTileInfo.setSelection(store.getBoolean(Map2View.PREF_SHOW_TILE_INFO)); _chkTileBorder.setSelection(store.getBoolean(Map2View.PREF_SHOW_TILE_BORDER)); // dim map/* w ww. j a v a 2 s. co m*/ _scaleDimMap.setSelection(store.getInt(Map2View.PREF_DEBUG_MAP_DIM_LEVEL)); }
From source file:net.tourbook.mapping.TourMapPropertyView.java
License:Open Source License
private void restoreSettings() { final IPreferenceStore store = TourbookPlugin.getDefault().getPreferenceStore(); // get values from pref store // tile info/border _chkTileInfo.setSelection(store.getBoolean(TourMapView.PREF_SHOW_TILE_INFO)); _chkTileBorder.setSelection(store.getBoolean(TourMapView.PREF_SHOW_TILE_BORDER)); // dim map//from w ww . j a va2s .c om _scaleDimMap.setSelection(store.getInt(TourMapView.PREF_DEBUG_MAP_DIM_LEVEL)); }
From source file:net.tourbook.mapping.TourPainter.java
License:Open Source License
private static void getTourPainterSettings() { final IPreferenceStore prefStore = TourbookPlugin.getDefault().getPreferenceStore(); final String drawSymbol = prefStore.getString(ITourbookPreferences.MAP_LAYOUT_SYMBOL); _prefIsDrawLine = drawSymbol.equals(PrefPageAppearanceMap.MAP_TOUR_SYMBOL_LINE); _prefIsDrawSquare = drawSymbol.equals(PrefPageAppearanceMap.MAP_TOUR_SYMBOL_SQUARE); _prefLineWidth = prefStore.getInt(ITourbookPreferences.MAP_LAYOUT_SYMBOL_WIDTH); _prefWithBorder = prefStore.getBoolean(ITourbookPreferences.MAP_LAYOUT_PAINT_WITH_BORDER); _prefBorderWidth = prefStore.getInt(ITourbookPreferences.MAP_LAYOUT_BORDER_WIDTH); }