List of usage examples for org.eclipse.jface.preference IPreferenceStore getInt
int getInt(String name);
From source file:ccw.preferences.OverlayPreferenceStore.java
License:Open Source License
private void loadProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target, boolean forceInitialization) { TypeDescriptor d = key.fDescriptor;/*from w w w . j a v a 2s.co 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"); //$NON-NLS-1$ target.setValue(key.fKey, orgin.getString(key.fKey)); target.setDefault(key.fKey, orgin.getDefaultString(key.fKey)); } }
From source file:ch.elexis.omnivore.views.Preferences.java
License:Open Source License
/** * Returns a currently value from the preference store, observing default settings and min/max * settings for that parameter/*from ww w. j a va 2s.com*/ * * Can be called with an already available preferenceStore. If none is passed, one will be * temporarily instantiated on the fly. * * @return The requested integer parameter * * @author Joerg Sigle */ public static Integer getOmnivoreMax_Filename_Length() { IPreferenceStore preferenceStore = new SettingsPreferenceStore(CoreHub.localCfg); int ret = preferenceStore.getInt(PREF_MAX_FILENAME_LENGTH); if (ret == 0) { ret = OmnivoreMax_Filename_Length_Default; } return ret; }
From source file:ch.qos.logback.beagle.view.TableMediator.java
License:Open Source License
int getPreferredBufferSize() { int result = BeaglePreferencesPage.BUFFER_SIZE_PREFERENCE_DEFAULT_VALUE; if (Activator.INSTANCE != null) { IPreferenceStore pStore = Activator.INSTANCE.getPreferenceStore(); result = pStore.getInt(BeaglePreferencesPage.BUFFER_SIZE_PREFERENCE); }/*from ww w. j a v a2 s .c o m*/ return result; }
From source file:ch.unibe.iam.scg.archie.ui.charts.AgeHistogrammChart.java
License:Open Source License
/** * Set cohort size according to preferences, if set, else return default * value.//from w w w . j a va2 s .co m */ private int getCohortSize() { IPreferenceStore preferences = ArchieActivator.getInstance().getPreferenceStore(); if (preferences.getInt(PreferenceConstants.P_COHORT_SIZE) > 0) { return preferences.getInt(PreferenceConstants.P_COHORT_SIZE); } return PreferenceConstants.DEFAULT_COHORT_SIZE; }
From source file:com.aerospike.aql.plugin.actions.GenerateSource.java
License:Apache License
public void run(IAction action) { if (selection != null && selection instanceof TreeSelection) { TreeSelection ts = (TreeSelection) selection; Object element = ts.getFirstElement(); if (element instanceof IFile && ((IFile) element).getFileExtension().equalsIgnoreCase("aql")) { final IFile sqlFile = (IFile) element; if (sqlFile == null) return; try { final List<String> errorList = new ArrayList<String>(); final String actionID = action.getId(); final AQLResult results = new AQLResult(); // find the Aerospike console and display it IWorkbench wb = PlatformUI.getWorkbench(); IWorkbenchWindow win = wb.getActiveWorkbenchWindow(); IWorkbenchPage page = win.getActivePage(); IConsoleView view = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW); view.display(results.getConsole()); // set generation language String extension; final com.aerospike.aql.AQL.Language language; if (actionID.equals("com.aerospike.aql.plugin.actions.GenerateSource.java.popup")) { language = com.aerospike.aql.AQL.Language.JAVA; extension = ".java"; } else if (actionID.equals("com.aerospike.aql.plugin.actions.GenerateSource.c.popup")) { language = com.aerospike.aql.AQL.Language.C; extension = ".c"; } else if (actionID.equals("com.aerospike.aql.plugin.actions.GenerateSource.csharp.popup")) { language = com.aerospike.aql.AQL.Language.CSHARP; extension = ".csharp"; } else { return; }//from ww w.jav a 2 s . com IProject project = sqlFile.getProject(); IPath outputPath; String sqlFileName = sqlFile.getName(); String outputFileName = sqlFileName.substring(0, sqlFileName.lastIndexOf('.')) + extension; final AsCluster cluster = (AsCluster) project .getSessionProperty(CoreActivator.CLUSTER_PROPERTY); String outputDirectoryString = project .getPersistentProperty(CoreActivator.AQL_GENERATION_DIRECTORY); if (outputDirectoryString == null || outputDirectoryString.isEmpty()) { outputPath = project.getLocation().append(outputFileName); } else { IPath dirPath = project.getLocation().append(outputDirectoryString); if (!dirPath.toFile().exists()) dirPath.toFile().mkdirs(); outputPath = dirPath.append(outputFileName); } final File outputFile = outputPath.toFile(); IPath location = sqlFile.getLocation(); final File file = location.toFile(); final IFile outputIFile = project.getWorkspace().getRoot().getFileForLocation(outputPath); Job job = new Job("Generate source code from AQL: " + sqlFile.getName()) { @Override protected IStatus run(IProgressMonitor monitor) { AQL aql = new AQL(); try { String seedNode = ""; int port = 3000; if (cluster != null) { seedNode = cluster.getSeedHost(); port = cluster.getPort(); } else { IPreferenceStore store = CoreActivator.getDefault().getPreferenceStore(); seedNode = store.getString(PreferenceConstants.SEED_NODE); port = store.getInt(PreferenceConstants.PORT); } aql.compileAndGenerate(file, outputFile, language, seedNode, port); results.report("Completed generation for " + sqlFile.getName()); outputIFile.getParent().refreshLocal(IResource.DEPTH_ONE, null); return Status.OK_STATUS; } catch (Exception e) { CoreActivator.showError(e, COULD_NOT_GENERATE_CODE_FROM_SQL_FILE + sqlFile.getName()); return Status.CANCEL_STATUS; } } }; job.setUser(true); job.schedule(); } catch (PartInitException e) { CoreActivator.showError(e, COULD_NOT_GENERATE_CODE_FROM_SQL_FILE + sqlFile.getName()); } catch (CoreException e) { CoreActivator.showError(e, COULD_NOT_GENERATE_CODE_FROM_SQL_FILE + sqlFile.getName()); } } } }
From source file:com.amazonaws.eclipse.core.AWSClientFactory.java
License:Apache License
private static ClientConfiguration createClientConfiguration(String secureEndpoint) { ClientConfiguration config = new ClientConfiguration(); IPreferenceStore preferences = AwsToolkitCore.getDefault().getPreferenceStore(); int connectionTimeout = preferences.getInt(PreferenceConstants.P_CONNECTION_TIMEOUT); int socketTimeout = preferences.getInt(PreferenceConstants.P_SOCKET_TIMEOUT); config.setConnectionTimeout(connectionTimeout); config.setSocketTimeout(socketTimeout); config.setUserAgent(/*ww w . j a v a 2s.c o m*/ AwsClientUtils.formatUserAgentString("AWS-Toolkit-For-Eclipse", AwsToolkitCore.getDefault())); AwsToolkitCore plugin = AwsToolkitCore.getDefault(); if (plugin != null) { IProxyService proxyService = AwsToolkitCore.getDefault().getProxyService(); if (proxyService.isProxiesEnabled()) { try { IProxyData[] proxyData; proxyData = proxyService.select(new URI(secureEndpoint)); if (proxyData.length > 0) { config.setProxyHost(proxyData[0].getHost()); config.setProxyPort(proxyData[0].getPort()); if (proxyData[0].isRequiresAuthentication()) { config.setProxyUsername(proxyData[0].getUserId()); config.setProxyPassword(proxyData[0].getPassword()); } } } catch (URISyntaxException e) { plugin.getLog().log(new Status(Status.ERROR, AwsToolkitCore.PLUGIN_ID, e.getMessage(), e)); } } } return config; }
From source file:com.amazonaws.eclipse.core.HttpClientFactory.java
License:Apache License
public static DefaultHttpClient create(Plugin plugin, String url) { HttpParams httpClientParams = new BasicHttpParams(); IPreferenceStore preferences = AwsToolkitCore.getDefault().getPreferenceStore(); int connectionTimeout = preferences.getInt(PreferenceConstants.P_CONNECTION_TIMEOUT); int socketTimeout = preferences.getInt(PreferenceConstants.P_SOCKET_TIMEOUT); HttpConnectionParams.setConnectionTimeout(httpClientParams, connectionTimeout); HttpConnectionParams.setSoTimeout(httpClientParams, socketTimeout); HttpProtocolParams.setUserAgent(httpClientParams, AwsClientUtils.formatUserAgentString("AWS-Toolkit-For-Eclipse", plugin)); DefaultHttpClient httpclient = new DefaultHttpClient(httpClientParams); configureProxy(httpclient, url);/*from w w w. j a va 2s .co m*/ return httpclient; }
From source file:com.amazonaws.eclipse.dynamodb.testtool.StartTestToolConfigurationWizardPage.java
License:Apache License
/** * Create the wizard page's controls./* w ww .j av a 2 s . co m*/ * * @param parent the parent composite to hang the controls on */ public void createControl(final Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); composite.setLayout(new GridLayout(2, false)); Label label = new Label(composite, SWT.NONE); label.setText("Port: "); portInput = new Text(composite, SWT.BORDER); GridDataFactory.fillDefaults().grab(true, false).applyTo(portInput); // TODO: Would be nice to drive this off of the manifest.xml for the // chosen version, in case future versions of the test tool support // additional options. bindInputs(); IPreferenceStore preferences = DynamoDBPlugin.getDefault().getPreferenceStore(); if (preferences.contains(TestToolPreferencePage.DEFAULT_PORT_PREFERENCE_NAME)) { portValue.setValue( Integer.toString(preferences.getInt(TestToolPreferencePage.DEFAULT_PORT_PREFERENCE_NAME))); context.updateTargets(); } setControl(composite); }
From source file:com.android.ddmuilib.AllocationPanel.java
License:Apache License
/** * Create our control(s)./*from ww w . j a va2 s.c o m*/ */ @Override protected Control createControl(Composite parent) { final IPreferenceStore store = DdmUiPreferences.getStore(); Display display = parent.getDisplay(); // get some images mSortUpImg = ImageLoader.getDdmUiLibLoader().loadImage("sort_up.png", display); mSortDownImg = ImageLoader.getDdmUiLibLoader().loadImage("sort_down.png", display); // base composite for selected client with enabled thread update. mAllocationBase = new Composite(parent, SWT.NONE); mAllocationBase.setLayout(new FormLayout()); // table above the sash Composite topParent = new Composite(mAllocationBase, SWT.NONE); topParent.setLayout(new GridLayout(6, false)); mEnableButton = new Button(topParent, SWT.PUSH); mEnableButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Client current = getCurrentClient(); AllocationTrackingStatus status = current.getClientData().getAllocationStatus(); if (status == AllocationTrackingStatus.ON) { current.enableAllocationTracker(false); } else { current.enableAllocationTracker(true); } current.requestAllocationStatus(); } }); mRequestButton = new Button(topParent, SWT.PUSH); mRequestButton.setText("Get Allocations"); mRequestButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { getCurrentClient().requestAllocationDetails(); } }); setUpButtons(false /* enabled */, AllocationTrackingStatus.OFF); GridData gridData; Composite spacer = new Composite(topParent, SWT.NONE); spacer.setLayoutData(gridData = new GridData(GridData.FILL_HORIZONTAL)); new Label(topParent, SWT.NONE).setText("Filter:"); final Text filterText = new Text(topParent, SWT.BORDER); filterText.setLayoutData(gridData = new GridData(GridData.FILL_HORIZONTAL)); gridData.widthHint = 200; filterText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { mFilterText = filterText.getText().trim(); mAllocationViewer.refresh(); } }); mTraceFilterCheck = new Button(topParent, SWT.CHECK); mTraceFilterCheck.setText("Inc. trace"); mTraceFilterCheck.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { mAllocationViewer.refresh(); } }); mAllocationTable = new Table(topParent, SWT.MULTI | SWT.FULL_SELECTION); mAllocationTable.setLayoutData(gridData = new GridData(GridData.FILL_BOTH)); gridData.horizontalSpan = 6; mAllocationTable.setHeaderVisible(true); mAllocationTable.setLinesVisible(true); final TableColumn numberCol = TableHelper.createTableColumn(mAllocationTable, "Alloc Order", SWT.RIGHT, "Alloc Order", //$NON-NLS-1$ PREFS_ALLOC_COL_NUMBER, store); numberCol.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { setSortColumn(numberCol, SortMode.NUMBER); } }); final TableColumn sizeCol = TableHelper.createTableColumn(mAllocationTable, "Allocation Size", SWT.RIGHT, "888", //$NON-NLS-1$ PREFS_ALLOC_COL_SIZE, store); sizeCol.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { setSortColumn(sizeCol, SortMode.SIZE); } }); final TableColumn classCol = TableHelper.createTableColumn(mAllocationTable, "Allocated Class", SWT.LEFT, "Allocated Class", //$NON-NLS-1$ PREFS_ALLOC_COL_CLASS, store); classCol.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { setSortColumn(classCol, SortMode.CLASS); } }); final TableColumn threadCol = TableHelper.createTableColumn(mAllocationTable, "Thread Id", SWT.LEFT, "999", //$NON-NLS-2$ PREFS_ALLOC_COL_THREAD, store); threadCol.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { setSortColumn(threadCol, SortMode.THREAD); } }); final TableColumn inClassCol = TableHelper.createTableColumn(mAllocationTable, "Allocated in", SWT.LEFT, "utime", //$NON-NLS-1$ PREFS_ALLOC_COL_TRACE_CLASS, store); inClassCol.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { setSortColumn(inClassCol, SortMode.IN_CLASS); } }); final TableColumn inMethodCol = TableHelper.createTableColumn(mAllocationTable, "Allocated in", SWT.LEFT, "utime", //$NON-NLS-1$ PREFS_ALLOC_COL_TRACE_METHOD, store); inMethodCol.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { setSortColumn(inMethodCol, SortMode.IN_METHOD); } }); // init the default sort colum switch (mSorter.getSortMode()) { case SIZE: mSortColumn = sizeCol; break; case CLASS: mSortColumn = classCol; break; case THREAD: mSortColumn = threadCol; break; case IN_CLASS: mSortColumn = inClassCol; break; case IN_METHOD: mSortColumn = inMethodCol; break; } mSortColumn.setImage(mSorter.isDescending() ? mSortDownImg : mSortUpImg); mAllocationViewer = new TableViewer(mAllocationTable); mAllocationViewer.setContentProvider(new AllocationContentProvider()); mAllocationViewer.setLabelProvider(new AllocationLabelProvider()); mAllocationViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { AllocationInfo selectedAlloc = getAllocationSelection(event.getSelection()); updateAllocationStackTrace(selectedAlloc); } }); // the separating sash final Sash sash = new Sash(mAllocationBase, SWT.HORIZONTAL); Color darkGray = parent.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY); sash.setBackground(darkGray); // the UI below the sash mStackTracePanel = new StackTracePanel(); mStackTraceTable = mStackTracePanel.createPanel(mAllocationBase, PREFS_STACK_COLUMN, store); // now setup the sash. // form layout data FormData data = new FormData(); data.top = new FormAttachment(0, 0); data.bottom = new FormAttachment(sash, 0); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(100, 0); topParent.setLayoutData(data); final FormData sashData = new FormData(); if (store != null && store.contains(PREFS_ALLOC_SASH)) { sashData.top = new FormAttachment(0, store.getInt(PREFS_ALLOC_SASH)); } else { sashData.top = new FormAttachment(50, 0); // 50% across } sashData.left = new FormAttachment(0, 0); sashData.right = new FormAttachment(100, 0); sash.setLayoutData(sashData); data = new FormData(); data.top = new FormAttachment(sash, 0); data.bottom = new FormAttachment(100, 0); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(100, 0); mStackTraceTable.setLayoutData(data); // allow resizes, but cap at minPanelWidth sash.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { Rectangle sashRect = sash.getBounds(); Rectangle panelRect = mAllocationBase.getClientArea(); int bottom = panelRect.height - sashRect.height - 100; e.y = Math.max(Math.min(e.y, bottom), 100); if (e.y != sashRect.y) { sashData.top = new FormAttachment(0, e.y); store.setValue(PREFS_ALLOC_SASH, e.y); mAllocationBase.layout(); } } }); return mAllocationBase; }
From source file:com.android.ddmuilib.log.event.EventDisplayOptions.java
License:Apache License
private void createLeftPanel(Composite leftPanel) { final IPreferenceStore store = DdmUiPreferences.getStore(); GridLayout gl;// w w w.ja v a2 s . c o m leftPanel.setLayoutData(new GridData(GridData.FILL_VERTICAL)); leftPanel.setLayout(gl = new GridLayout(1, false)); gl.verticalSpacing = 1; mEventDisplayList = new List(leftPanel, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL | SWT.FULL_SELECTION); mEventDisplayList.setLayoutData(new GridData(GridData.FILL_BOTH)); mEventDisplayList.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleEventDisplaySelection(); } }); Composite bottomControls = new Composite(leftPanel, SWT.NONE); bottomControls.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); bottomControls.setLayout(gl = new GridLayout(5, false)); gl.marginHeight = gl.marginWidth = 0; gl.verticalSpacing = 0; gl.horizontalSpacing = 0; ImageLoader loader = ImageLoader.getDdmUiLibLoader(); mEventDisplayNewButton = new Button(bottomControls, SWT.PUSH | SWT.FLAT); mEventDisplayNewButton.setImage(loader.loadImage("add.png", //$NON-NLS-1$ leftPanel.getDisplay())); mEventDisplayNewButton.setToolTipText("Adds a new event display"); mEventDisplayNewButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); mEventDisplayNewButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { createNewEventDisplay(); } }); mEventDisplayDeleteButton = new Button(bottomControls, SWT.PUSH | SWT.FLAT); mEventDisplayDeleteButton.setImage(loader.loadImage("delete.png", //$NON-NLS-1$ leftPanel.getDisplay())); mEventDisplayDeleteButton.setToolTipText("Deletes the selected event display"); mEventDisplayDeleteButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); mEventDisplayDeleteButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { deleteEventDisplay(); } }); mEventDisplayUpButton = new Button(bottomControls, SWT.PUSH | SWT.FLAT); mEventDisplayUpButton.setImage(loader.loadImage("up.png", //$NON-NLS-1$ leftPanel.getDisplay())); mEventDisplayUpButton.setToolTipText("Moves the selected event display up"); mEventDisplayUpButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // get current selection. int selection = mEventDisplayList.getSelectionIndex(); if (selection > 0) { // update the list of EventDisplay. EventDisplay display = mDisplayList.remove(selection); mDisplayList.add(selection - 1, display); // update the list widget mEventDisplayList.remove(selection); mEventDisplayList.add(display.getName(), selection - 1); // update the selection and reset the ui. mEventDisplayList.select(selection - 1); handleEventDisplaySelection(); mEventDisplayList.showSelection(); setModified(); } } }); mEventDisplayDownButton = new Button(bottomControls, SWT.PUSH | SWT.FLAT); mEventDisplayDownButton.setImage(loader.loadImage("down.png", //$NON-NLS-1$ leftPanel.getDisplay())); mEventDisplayDownButton.setToolTipText("Moves the selected event display down"); mEventDisplayDownButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // get current selection. int selection = mEventDisplayList.getSelectionIndex(); if (selection != -1 && selection < mEventDisplayList.getItemCount() - 1) { // update the list of EventDisplay. EventDisplay display = mDisplayList.remove(selection); mDisplayList.add(selection + 1, display); // update the list widget mEventDisplayList.remove(selection); mEventDisplayList.add(display.getName(), selection + 1); // update the selection and reset the ui. mEventDisplayList.select(selection + 1); handleEventDisplaySelection(); mEventDisplayList.showSelection(); setModified(); } } }); Group sizeGroup = new Group(leftPanel, SWT.NONE); sizeGroup.setText("Display Size:"); sizeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); sizeGroup.setLayout(new GridLayout(2, false)); Label l = new Label(sizeGroup, SWT.NONE); l.setText("Width:"); mDisplayWidthText = new Text(sizeGroup, SWT.LEFT | SWT.SINGLE | SWT.BORDER); mDisplayWidthText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); mDisplayWidthText.setText(Integer.toString(store.getInt(EventLogPanel.PREFS_DISPLAY_WIDTH))); mDisplayWidthText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { String text = mDisplayWidthText.getText().trim(); try { store.setValue(EventLogPanel.PREFS_DISPLAY_WIDTH, Integer.parseInt(text)); setModified(); } catch (NumberFormatException nfe) { // do something? } } }); l = new Label(sizeGroup, SWT.NONE); l.setText("Height:"); mDisplayHeightText = new Text(sizeGroup, SWT.LEFT | SWT.SINGLE | SWT.BORDER); mDisplayHeightText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); mDisplayHeightText.setText(Integer.toString(store.getInt(EventLogPanel.PREFS_DISPLAY_HEIGHT))); mDisplayHeightText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { String text = mDisplayHeightText.getText().trim(); try { store.setValue(EventLogPanel.PREFS_DISPLAY_HEIGHT, Integer.parseInt(text)); setModified(); } catch (NumberFormatException nfe) { // do something? } } }); }