10 package com.generalrobotix.ui.view.graph;
12 import org.eclipse.jface.dialogs.Dialog;
13 import org.eclipse.jface.dialogs.IDialogConstants;
14 import org.eclipse.jface.dialogs.MessageDialog;
15 import org.eclipse.swt.SWT;
16 import org.eclipse.swt.events.KeyEvent;
17 import org.eclipse.swt.events.KeyListener;
18 import org.eclipse.swt.layout.RowLayout;
19 import org.eclipse.swt.widgets.Composite;
20 import org.eclipse.swt.widgets.Control;
21 import org.eclipse.swt.widgets.Label;
22 import org.eclipse.swt.widgets.Shell;
23 import org.eclipse.swt.widgets.Text;
63 super.configureShell(newShell);
68 Composite composite = (Composite)super.createDialogArea(parent);
69 composite.setLayout(
new RowLayout(SWT.VERTICAL));
70 Composite comp0 =
new Composite(composite, SWT.NONE);
71 comp0.setLayout(
new RowLayout());
73 Label label1 =
new Label(comp0, SWT.NONE);
76 minField_ =
new Text(comp0, SWT.BORDER);
77 minField_.setText(String.format(
"%10.3f", base_));
79 minField_.addKeyListener(
new KeyListener(){
80 public void keyPressed(KeyEvent e) {
82 minField_.setText(
"");
87 public void keyReleased(KeyEvent e) {
95 minUnitLabel_ =
new Label(comp0, SWT.NONE);
96 minUnitLabel_.setText(unit_);
98 Composite comp1 =
new Composite(composite, SWT.NONE);
99 comp1.setLayout(
new RowLayout());
101 Label label3 =
new Label(comp1, SWT.NONE);
103 maxField_ =
new Text(comp1, SWT.BORDER);
104 maxField_.setText(String.format(
"%10.3f", base_+extent_));
106 maxField_.addKeyListener(
new KeyListener(){
107 public void keyPressed(KeyEvent e) {
109 maxField_.setText(
"");
114 public void keyReleased(KeyEvent e) {
121 maxUnitLabel_ =
new Label(comp1, SWT.NONE);
122 maxUnitLabel_.setText(unit_);
129 if (buttonId == IDialogConstants.OK_ID) {
132 min = Double.parseDouble(minField_.getText());
133 max = Double.parseDouble(maxField_.getText());
134 }
catch (NumberFormatException ex) {
135 MessageDialog.openError(shell_,
138 minField_.setFocus();
143 MessageDialog.openError(shell_,
146 minField_.setFocus();
159 setReturnCode(buttonId);
161 super.buttonPressed(buttonId);
static final String get(String key)
void setUnit(String unit)
static int min(int a, int b)
void setExtent(double extent)
Control createDialogArea(Composite parent)
void setBase(double base)
VRangeDialog(Shell shell)
void buttonPressed(int buttonId)
static int max(int a, int b)
void configureShell(Shell newShell)