private void save() { try { VMOptions.writeXmx(Integer.parseInt(myHeapSizeField.getText())); } catch (NumberFormatException ignored) { } try { VMOptions.writeMaxPermGen(Integer.parseInt(myPermGenSizeField.getText())); } catch (NumberFormatException ignored) { } try { VMOptions.writeCodeCache(Integer.parseInt(myCodeCacheSizeField.getText())); } catch (NumberFormatException ignored) { } }
public OutOfMemoryDialog(MemoryKind memoryKind) { super(false); myMemoryKind = memoryKind; setTitle(DiagnosticBundle.message("diagnostic.out.of.memory.title")); myMessageLabel.setIcon(Messages.getErrorIcon()); myMessageLabel.setText( DiagnosticBundle.message( "diagnostic.out.of.memory.error", memoryKind == MemoryKind.HEAP ? VMOptions.XMX_OPTION_NAME : memoryKind == MemoryKind.PERM_GEN ? VMOptions.PERM_GEN_OPTION_NAME : VMOptions.CODE_CACHE_OPTION_NAME, ApplicationNamesInfo.getInstance().getProductName())); final String path = VMOptions.getSettingsFilePath(); if (path != null) { mySettingsFileHintLabel.setText( DiagnosticBundle.message("diagnostic.out.of.memory.willBeSavedTo", path)); } else { mySettingsFileHintLabel.setVisible(false); } myIgnoreAction = new AbstractAction(DiagnosticBundle.message("diagnostic.out.of.memory.ignore")) { public void actionPerformed(ActionEvent e) { save(); close(0); } }; myShutdownAction = new AbstractAction(DiagnosticBundle.message("diagnostic.out.of.memory.shutdown")) { public void actionPerformed(ActionEvent e) { save(); System.exit(0); } }; myShutdownAction.putValue(DialogWrapper.DEFAULT_ACTION, true); configControls( VMOptions.XMX_OPTION_NAME, VMOptions.readXmx(), memoryKind == MemoryKind.HEAP, myHeapSizeLabel, myHeapSizeField, myHeapUnitsLabel, myHeapCurrentValueLabel); configControls( VMOptions.PERM_GEN_OPTION_NAME, VMOptions.readMaxPermGen(), memoryKind == MemoryKind.PERM_GEN, myPermGenSizeLabel, myPermGenSizeField, myPermGenUnitsLabel, myPermGenCurrentValueLabel); configControls( VMOptions.CODE_CACHE_OPTION_NAME, VMOptions.readCodeCache(), memoryKind == MemoryKind.CODE_CACHE, myCodeCacheSizeLabel, myCodeCacheSizeField, myCodeCacheUnitsLabel, myCodeCacheCurrentValueLabel); init(); }