1 11 12 package org.eclipse.debug.internal.ui.views.memory.renderings; 13 14 import org.eclipse.debug.internal.ui.DebugUIMessages; 15 import org.eclipse.debug.internal.ui.DebugUIPlugin; 16 import org.eclipse.debug.internal.ui.views.memory.MemoryViewUtil; 17 import org.eclipse.debug.ui.IDebugUIConstants; 18 import org.eclipse.jface.dialogs.Dialog; 19 import org.eclipse.jface.preference.StringFieldEditor; 20 import org.eclipse.swt.SWT; 21 import org.eclipse.swt.layout.GridData; 22 import org.eclipse.swt.layout.GridLayout; 23 import org.eclipse.swt.widgets.Composite; 24 import org.eclipse.swt.widgets.Control; 25 import org.eclipse.swt.widgets.Label; 26 import org.eclipse.swt.widgets.Shell; 27 import org.eclipse.ui.PlatformUI; 28 29 34 public class SetPaddedStringDialog extends Dialog { 35 36 private StringFieldEditor fPaddedString; 37 38 39 protected SetPaddedStringDialog(Shell parentShell) { 40 super(parentShell); 41 setShellStyle(getShellStyle() | SWT.RESIZE); 42 } 43 44 protected Control createDialogArea(Composite parent) { 45 PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IDebugUIConstants.PLUGIN_ID + ".SetPaddedStrDialog_context"); 47 getShell().setText(DebugUIMessages.SetPaddedStringDialog_0); 49 Composite content = (Composite) super.createDialogArea(parent); 50 GridLayout layout = new GridLayout(); 51 layout.numColumns = 1; 52 content.setLayout(layout); 53 54 GridData contentData = new GridData(SWT.FILL); 55 content.setLayoutData(contentData); 56 57 Label textLabel = new Label(content, SWT.NONE); 58 textLabel.setText(DebugUIMessages.SetPaddedStringDialog_1); 60 GridData textLayout = new GridData(); 61 textLabel.setLayoutData(textLayout); 62 63 fPaddedString = new StringFieldEditor(IDebugUIConstants.PREF_PADDED_STR, "",content ); fPaddedString.fillIntoGrid(content, 2); 65 fPaddedString.setPreferenceStore(DebugUIPlugin.getDefault().getPreferenceStore()); 66 fPaddedString.load(); 67 68 return content; 69 } 70 71 protected void okPressed() { 72 String str = fPaddedString.getStringValue(); 73 74 if (str == null || str.length() == 0) 75 { 76 MemoryViewUtil.openError(DebugUIMessages.SetPaddedStringDialog_3, DebugUIMessages.SetPaddedStringDialog_4, null); return; 78 } 79 80 fPaddedString.store(); 81 82 super.okPressed(); 83 84 } 85 86 } 87 | Popular Tags |