Java Code Examples for org.eclipse.jface.dialogs.IDialogSettings#getInt()
The following examples show how to use
org.eclipse.jface.dialogs.IDialogSettings#getInt() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseDialog.java From birt with Eclipse Public License 1.0 | 6 votes |
protected Point getInitialSize( ) { try { IDialogSettings setting = getDialogBoundsSettings( ); if ( setting != null ) { int width = setting.getInt( DIALOG_WIDTH ); int height = setting.getInt( DIALOG_HEIGHT ); return new Point( width, height ); } } catch ( NumberFormatException e ) { } return getDefaultSize( ); }
Example 2
Source File: GoSearchPage.java From goclipse with Eclipse Public License 1.0 | 6 votes |
/** * Initializes itself from the stored page settings. */ private void readConfiguration() { IDialogSettings s = getDialogSettings(); fIsCaseSensitive = s.getBoolean(STORE_CASE_SENSITIVE); fIsRegExSearch = s.getBoolean(STORE_IS_REG_EX_SEARCH); try { int historySize = s.getInt(STORE_HISTORY_SIZE); for (int i = 0; i < historySize; i++) { IDialogSettings histSettings = s.getSection(STORE_HISTORY + i); if (histSettings != null) { SearchPatternData data = SearchPatternData.create(histSettings); if (data != null) { fPreviousSearchPatterns.add(data); } } } } catch (NumberFormatException e) { // ignore } }
Example 3
Source File: AbstractConversionTable.java From sarl with Apache License 2.0 | 6 votes |
/** * Restores the column widths from dialog settings. * * @param settings the settings to read. */ private void restoreColumnWidths(IDialogSettings settings) { final int columnCount = this.table.getColumnCount(); for (int i = 0; i < columnCount; i++) { int width = -1; try { width = settings.getInt(getPreferenceContainerID() + getColumnWidthDialogSettingsKey() + i); } catch (NumberFormatException exception) { // } if ((width <= 0) || (i == this.table.getColumnCount() - 1)) { this.table.getColumn(i).pack(); } else { this.table.getColumn(i).setWidth(width); } } }
Example 4
Source File: SREsPreferencePage.java From sarl with Apache License 2.0 | 6 votes |
/** * Restores the column widths from dialog settings. * * @param settings the settings to read. */ private void restoreColumnWidths(IDialogSettings settings) { final int columnCount = this.sreTable.getColumnCount(); for (int i = 0; i < columnCount; i++) { int width = -1; try { width = settings.getInt(ID + ".columnWidth" + i); //$NON-NLS-1$ } catch (NumberFormatException exception) { // } if ((width <= 0) || (i == this.sreTable.getColumnCount() - 1)) { this.sreTable.getColumn(i).pack(); } else { this.sreTable.getColumn(i).setWidth(width); } } }
Example 5
Source File: PackageSelectionDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Initializes itself from the dialog settings with the same state * as at the previous invocation. */ private void readSettings() { IDialogSettings s= getDialogSettings(); try { int x= s.getInt("x"); //$NON-NLS-1$ int y= s.getInt("y"); //$NON-NLS-1$ fLocation= new Point(x, y); int width= s.getInt("width"); //$NON-NLS-1$ int height= s.getInt("height"); //$NON-NLS-1$ fSize= new Point(width, height); } catch (NumberFormatException e) { fLocation= null; fSize= null; } }
Example 6
Source File: JavaSearchPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Initializes itself from the stored page settings. */ private void readConfiguration() { IDialogSettings s= getDialogSettings(); fIsCaseSensitive= s.getBoolean(STORE_CASE_SENSITIVE); try { int historySize= s.getInt(STORE_HISTORY_SIZE); for (int i= 0; i < historySize; i++) { IDialogSettings histSettings= s.getSection(STORE_HISTORY + i); if (histSettings != null) { SearchPatternData data= SearchPatternData.create(histSettings); if (data != null) { fPreviousSearchPatterns.add(data); } } } } catch (NumberFormatException e) { // ignore } }
Example 7
Source File: SearchIndexDataHistory.java From Pydev with Eclipse Public License 1.0 | 6 votes |
/** * Initializes itself from the stored page settings. */ public void readConfiguration() { try { IDialogSettings s = settings; int historySize = s.getInt(STORE_HISTORY_SIZE); for (int i = 0; i < historySize; i++) { IDialogSettings histSettings = s.getSection(STORE_HISTORY + i); if (histSettings != null) { SearchIndexData data = SearchIndexData.create(histSettings); if (data != null) { last = data; fPreviousSearchPatterns.add(data); } } } } catch (NumberFormatException e) { // ignore } }
Example 8
Source File: SavedConfigManager.java From JAADAS with GNU General Public License v3.0 | 5 votes |
private void add(String name, ArrayList val){ IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); int count = 0; try { count = settings.getInt("config_count"); } catch(NumberFormatException e) { } count++; settings.put("config_count", count); settings.put("soot_run_config_"+count, name); update(name, val); }
Example 9
Source File: GoSearchPage.java From goclipse with Eclipse Public License 1.0 | 5 votes |
public static SearchPatternData create(IDialogSettings settings) { String textPattern = settings.get("textPattern"); //$NON-NLS-1$ String[] wsIds = settings.getArray("workingSets"); //$NON-NLS-1$ IWorkingSet[] workingSets = null; if (wsIds != null && wsIds.length > 0) { IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager(); workingSets = new IWorkingSet[wsIds.length]; for (int i = 0; workingSets != null && i < wsIds.length; i++) { workingSets[i] = workingSetManager.getWorkingSet(wsIds[i]); if (workingSets[i] == null) { workingSets = null; } } } String[] fileNamePatterns = settings.getArray("fileNamePatterns"); //$NON-NLS-1$ if (fileNamePatterns == null) { fileNamePatterns = new String[0]; } try { int scope = settings.getInt("scope"); //$NON-NLS-1$ boolean isRegExSearch = settings.getBoolean("isRegExSearch"); //$NON-NLS-1$ boolean ignoreCase = settings.getBoolean("ignoreCase"); //$NON-NLS-1$ return new SearchPatternData(textPattern, !ignoreCase, isRegExSearch, fileNamePatterns, scope, workingSets); } catch (NumberFormatException e) { return null; } }
Example 10
Source File: MainProjectWizardPage.java From sarl with Apache License 2.0 | 5 votes |
private int getLastSelectedJREKind() { final IDialogSettings settings = JavaPlugin.getDefault().getDialogSettings(); if (settings.get(LAST_SELECTED_JRE_KIND2) == null) { return EE_JRE; } return settings.getInt(LAST_SELECTED_JRE_KIND2); }
Example 11
Source File: NewJavaProjectWizardPageOne.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private int getLastSelectedJREKind() { IDialogSettings settings= JavaPlugin.getDefault().getDialogSettings(); if (settings.get(LAST_SELECTED_JRE_KIND2) == null) return EE_JRE; return settings.getInt(LAST_SELECTED_JRE_KIND2); }
Example 12
Source File: RenameInformationPopup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void restoreSnapPosition() { IDialogSettings settings= getDialogSettings(); try { fSnapPosition= settings.getInt(SNAP_POSITION_KEY); } catch (NumberFormatException e) { // default: fSnapPosition= SNAP_POSITION_UNDER_LEFT_FIELD; } fSnapPositionChanged= true; }
Example 13
Source File: RenameInformationPopup.java From typescript.java with MIT License | 5 votes |
private void restoreSnapPosition() { IDialogSettings settings= getDialogSettings(); try { fSnapPosition= settings.getInt(SNAP_POSITION_KEY); } catch (NumberFormatException e) { // default: fSnapPosition= SNAP_POSITION_UNDER_LEFT_FIELD; } fSnapPositionChanged= true; }
Example 14
Source File: SootConfigManagerDialog.java From JAADAS with GNU General Public License v3.0 | 5 votes |
private void clonePressed(){ if (getSelected() == null) return; String result = this.getSelected(); IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); // gets current number of configurations int config_count = 0; try { config_count = settings.getInt(Messages.getString("SootConfigManagerDialog.config_count")); //$NON-NLS-1$ } catch (NumberFormatException e) { } ArrayList currentNames = new ArrayList(); for (int i = 1; i <= config_count; i++) { currentNames.add(settings.get(Messages.getString("SootConfigManagerDialog.soot_run_config")+i)); //$NON-NLS-1$ } // sets validator to know about already used names SootConfigNameInputValidator validator = new SootConfigNameInputValidator(); validator.setAlreadyUsed(currentNames); InputDialog nameDialog = new InputDialog(this.getShell(), Messages.getString("SootConfigManagerDialog.Clone_Saved_Configuration"), Messages.getString("SootConfigManagerDialog.Enter_new_name"), result, validator); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ nameDialog.open(); if (nameDialog.getReturnCode() == Dialog.OK){ config_count++; settings.put(Messages.getString("SootConfigManagerDialog.soot_run_config")+config_count, nameDialog.getValue()); //$NON-NLS-1$ settings.put(nameDialog.getValue(), settings.getArray(result)); settings.put(Messages.getString("SootConfigManagerDialog.config_count"), config_count); //$NON-NLS-1$ getTreeRoot().addChild(new SootConfiguration(nameDialog.getValue())); saveMainClass(nameDialog.getValue(), settings.get(result+"_mainClass")); } refreshTree(); }
Example 15
Source File: SootConfigManagerDialog.java From JAADAS with GNU General Public License v3.0 | 5 votes |
private void renamePressed(){ if (getSelected() == null) return; String result = this.getSelected(); IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); // gets current number of configurations int config_count = 0; int oldNameCount = 0; try { config_count = settings.getInt(Messages.getString("SootConfigManagerDialog.config_count")); //$NON-NLS-1$ } catch (NumberFormatException e) { } ArrayList currentNames = new ArrayList(); for (int i = 1; i <= config_count; i++) { currentNames.add(settings.get(Messages.getString("SootConfigManagerDialog.soot_run_config")+i)); //$NON-NLS-1$ if (((String)currentNames.get(i-1)).equals(result)){ oldNameCount = i; } } // sets validator to know about already used names SootConfigNameInputValidator validator = new SootConfigNameInputValidator(); validator.setAlreadyUsed(currentNames); InputDialog nameDialog = new InputDialog(this.getShell(), Messages.getString("SootConfigManagerDialog.Rename_Saved_Configuration"), Messages.getString("SootConfigManagerDialog.Enter_new_name"), "", validator); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ nameDialog.open(); if (nameDialog.getReturnCode() == Dialog.OK){ settings.put(Messages.getString("SootConfigManagerDialog.soot_run_config")+oldNameCount, nameDialog.getValue()); //$NON-NLS-1$ settings.put(nameDialog.getValue(), settings.getArray(result)); getTreeRoot().renameChild(result, nameDialog.getValue()); saveMainClass(nameDialog.getValue(), settings.get(result+"_mainClass")); } refreshTree(); }
Example 16
Source File: SavedConfigManager.java From JAADAS with GNU General Public License v3.0 | 5 votes |
private void add(String name, String val) { IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); int count = 0; try { count = settings.getInt("config_count"); } catch(NumberFormatException e) { } count++; settings.put("config_count", count); settings.put("soot_run_config_"+count, name); update(name, val); }
Example 17
Source File: SavedConfigManager.java From JAADAS with GNU General Public License v3.0 | 5 votes |
private boolean alreadyInList(String name) { IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); int count = 0; try { count = settings.getInt("config_count"); } catch (NumberFormatException e){ } for (int i = 1; i <= count; i++){ if (settings.get("soot_run_config_"+i).equals(name)){ return true; } } return false; }
Example 18
Source File: FatJarPackageWizardPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override protected void restoreWidgetValues() { // restore JARPACKAGEDATA from SETTINGS and set widgets IDialogSettings settings= getDialogSettings(); if (settings != null) { // SAVE ANT SCRIPT fAntScriptSaveCheckbox.setSelection(settings.getBoolean(STORE_ANTSCRIPT_SAVE)); // ANT SCRIPT LOCATION String antScriptLocation= settings.get(STORE_ANTSCRIPT_LOCATION); if (antScriptLocation != null) { fAntScriptLocation= Path.fromOSString(antScriptLocation); if (fAntScriptLocation.isEmpty()) { fAntScriptNamesCombo.setText(""); //$NON-NLS-1$ } else { fAntScriptNamesCombo.setText(fAntScriptLocation.toOSString()); } } // ANT SCRIPT LOCATION HISTORY String[] directoryNames= settings.getArray(STORE_ANTSCRIPT_LOCATION_HISTORY); if (directoryNames != null) { if (!fAntScriptNamesCombo.getText().equals(directoryNames[0])) fAntScriptNamesCombo.add(fAntScriptNamesCombo.getText()); for (int i= 0; i < directoryNames.length; i++) fAntScriptNamesCombo.add(directoryNames[i]); } // LIBRARY HANDLING int libraryHandling= ExtractLibraryHandler.ID; // default value for migrated (Eclipse 3.4) settings try { libraryHandling= settings.getInt(STORE_LIBRARY_HANDLING); } catch (NumberFormatException ignore) { // also thrown if no value was stored (null) } setLibraryHandler(createLibraryHandlerById(libraryHandling)); // LAUNCH CONFIG String name= settings.get(STORE_LAUNCH_CONFIGURATION_SELECTION_NAME); if (name != null) { String[] items= fLaunchConfigurationCombo.getItems(); for (int i= 0; i < items.length; i++) { if (name.equals(items[i])) { fLaunchConfigurationCombo.select(i); } } } // DESTINATION String destinationPath= settings.get(STORE_DESTINATION_ELEMENT); if (destinationPath != null && destinationPath.length() > 0) { fJarPackage.setJarLocation(Path.fromOSString(destinationPath)); } } super.restoreWidgetValues(); }
Example 19
Source File: FixedFatJarExportPage.java From sarl with Apache License 2.0 | 4 votes |
@Override protected void restoreWidgetValues() { // restore JARPACKAGEDATA from SETTINGS and set widgets IDialogSettings settings= getDialogSettings(); if (settings != null) { // SAVE ANT SCRIPT fAntScriptSaveCheckbox.setSelection(settings.getBoolean(STORE_ANTSCRIPT_SAVE)); // ANT SCRIPT LOCATION String antScriptLocation= settings.get(STORE_ANTSCRIPT_LOCATION); if (antScriptLocation != null) { fAntScriptLocation= Path.fromOSString(antScriptLocation); if (fAntScriptLocation.isEmpty()) { fAntScriptNamesCombo.setText(""); //$NON-NLS-1$ } else { fAntScriptNamesCombo.setText(fAntScriptLocation.toOSString()); } } // ANT SCRIPT LOCATION HISTORY String[] directoryNames= settings.getArray(STORE_ANTSCRIPT_LOCATION_HISTORY); if (directoryNames != null) { if (!fAntScriptNamesCombo.getText().equals(directoryNames[0])) fAntScriptNamesCombo.add(fAntScriptNamesCombo.getText()); for (int i= 0; i < directoryNames.length; i++) fAntScriptNamesCombo.add(directoryNames[i]); } // LIBRARY HANDLING int libraryHandling= ExtractLibraryHandler.ID; // default value for migrated (Eclipse 3.4) settings try { libraryHandling= settings.getInt(STORE_LIBRARY_HANDLING); } catch (NumberFormatException ignore) { // also thrown if no value was stored (null) } setLibraryHandler(createLibraryHandlerById(libraryHandling)); // LAUNCH CONFIG String name= settings.get(STORE_LAUNCH_CONFIGURATION_SELECTION_NAME); if (name != null) { String[] items= fLaunchConfigurationCombo.getItems(); for (int i= 0; i < items.length; i++) { if (name.equals(items[i])) { fLaunchConfigurationCombo.select(i); } } } // DESTINATION String destinationPath= settings.get(STORE_DESTINATION_ELEMENT); if (destinationPath != null && destinationPath.length() > 0) { fJarPackage.setJarLocation(Path.fromOSString(destinationPath)); } } super.restoreWidgetValues(); }
Example 20
Source File: SootConfigManagerDialog.java From JAADAS with GNU General Public License v3.0 | 4 votes |
private void newPressed() { IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); // gets current number of configurations before adding any int config_count = 0; try { config_count = settings.getInt(Messages.getString("SootConfigManagerDialog.config_count")); //$NON-NLS-1$ } catch (NumberFormatException e) { } ArrayList currentNames = new ArrayList(); for (int i = 1; i <= config_count; i++) { currentNames.add(settings.get(Messages.getString("SootConfigManagerDialog.soot_run_config")+i)); //$NON-NLS-1$ } // sets validator to know about already used names - but it doesn't use // them because then editing a file cannot use same file name SootConfigNameInputValidator validator = new SootConfigNameInputValidator(); validator.setAlreadyUsed(currentNames); // create dialog to get name InputDialog nameDialog = new InputDialog(this.getShell(), Messages.getString("SootConfigManagerDialog.Saving_Configuration_Name"), Messages.getString("SootConfigManagerDialog.Enter_name_to_save_configuration_with"), "", validator); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ nameDialog.open(); if (nameDialog.getReturnCode() == Dialog.OK) { setEditDefs(null); int returnCode = displayOptions(nameDialog.getValue(), "soot.Main"); //handle selection of main class here if (returnCode != Dialog.CANCEL) { getTreeRoot().addChild(new SootConfiguration(nameDialog.getValue())); refreshTree(); } } else { // cancel and do nothing } }