1 11 package org.eclipse.debug.internal.ui.views.variables; 12 13 import org.eclipse.debug.internal.ui.DebugUIPlugin; 14 import org.eclipse.debug.ui.IDebugUIConstants; 15 import org.eclipse.jface.dialogs.IInputValidator; 16 import org.eclipse.jface.dialogs.InputDialog; 17 import org.eclipse.swt.widgets.Shell; 18 19 public class MaxDetailsLengthDialog extends InputDialog { 20 21 26 public MaxDetailsLengthDialog(Shell parent) { 27 super(parent, VariablesViewMessages.MaxDetailsLengthDialog_0, VariablesViewMessages.MaxDetailsLengthDialog_1, 28 Integer.toString(DebugUIPlugin.getDefault().getPreferenceStore().getInt(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH)), 29 new IInputValidator() { 30 public String isValid(String newText) { 31 try { 32 int num = Integer.parseInt(newText); 33 if (num < 0) { 34 return VariablesViewMessages.MaxDetailsLengthDialog_2; 35 } 36 } catch (NumberFormatException e) { 37 return VariablesViewMessages.MaxDetailsLengthDialog_3; 38 } 39 return null; 40 } 41 42 }); 43 } 44 45 48 protected void okPressed() { 49 String text = getValue(); 50 try { 51 int max = Integer.parseInt(text); 52 DebugUIPlugin.getDefault().getPreferenceStore().setValue(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH, max); 53 } catch (NumberFormatException e) { 54 } 55 super.okPressed(); 56 } 57 58 59 60 } 61 | Popular Tags |