Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 144936
Collapse All | Expand All

(-)src/org/eclipse/hyades/statistical/ui/internal/views/linegraph/ConfigureVerticalSlider.java (-29 / +56 lines)
Lines 11-16 Link Here
11
 **********************************************************************/
11
 **********************************************************************/
12
package org.eclipse.hyades.statistical.ui.internal.views.linegraph;
12
package org.eclipse.hyades.statistical.ui.internal.views.linegraph;
13
13
14
import java.text.NumberFormat;
15
import java.text.ParseException;
16
14
import org.eclipse.hyades.statistical.ui.StatisticalMessages;
17
import org.eclipse.hyades.statistical.ui.StatisticalMessages;
15
import org.eclipse.hyades.ui.widgets.zoomslider.ZoomSlider;
18
import org.eclipse.hyades.ui.widgets.zoomslider.ZoomSlider;
16
import org.eclipse.jface.dialogs.IDialogConstants;
19
import org.eclipse.jface.dialogs.IDialogConstants;
Lines 108-117 Link Here
108
    
111
    
109
    public void addPickers(Composite composite)
112
    public void addPickers(Composite composite)
110
    {
113
    {
111
/*    	double maxLimit = slider.getMaxLimit();
114
    	
112
    	double minLimit = slider.getMinLimit();
115
    	/* Format the numbers based on the current locale */
113
*/    	double maxVisible = slider.getMaxVisible();
116
    	NumberFormat numFormat = NumberFormat.getInstance();
114
    	double minVisible = slider.getMinVisible();
117
    	String maxVisible = numFormat.format( slider.getMaxVisible() );
118
    	String minVisible = numFormat.format( slider.getMinVisible() );
115
    	
119
    	
116
    	GridLayout layout = new GridLayout();
120
    	GridLayout layout = new GridLayout();
117
    	composite.setLayout(layout);
121
    	composite.setLayout(layout);
Lines 147-153 Link Here
147
	    	data.horizontalAlignment = SWT.FILL;
151
	    	data.horizontalAlignment = SWT.FILL;
148
	    	data.verticalAlignment = SWT.CENTER;
152
	    	data.verticalAlignment = SWT.CENTER;
149
	    	minVisibleText.setLayoutData(data);
153
	    	minVisibleText.setLayoutData(data);
150
	    	minVisibleText.setText(Double.toString(minVisible));
154
	    	minVisibleText.setText( minVisible );
151
	        
155
	        
152
	    	label = new Label(visibleGroup, SWT.NONE);
156
	    	label = new Label(visibleGroup, SWT.NONE);
153
	    	label.setText(StatisticalMessages.VISIBLE_END_LABEL);
157
	    	label.setText(StatisticalMessages.VISIBLE_END_LABEL);
Lines 167-173 Link Here
167
	    	data.verticalAlignment = SWT.CENTER;
171
	    	data.verticalAlignment = SWT.CENTER;
168
	    	data.widthHint = 50;
172
	    	data.widthHint = 50;
169
	    	maxVisibleText.setLayoutData(data);
173
	    	maxVisibleText.setLayoutData(data);
170
	    	maxVisibleText.setText(Double.toString(maxVisible));
174
	    	maxVisibleText.setText( maxVisible );
171
175
172
	    			    			    	
176
	    			    			    	
173
/*	    Group limitGroup = new Group(composite, SWT.NONE);
177
/*	    Group limitGroup = new Group(composite, SWT.NONE);
Lines 238-245 Link Here
238
    protected void okPressed()
242
    protected void okPressed()
239
    {    	
243
    {    	
240
    	title = titleText.getText();
244
    	title = titleText.getText();
241
    	maxVisible =  Double.parseDouble(maxVisibleText.getText());
245
    	
242
    	minVisible =  Double.parseDouble(minVisibleText.getText());
246
    	NumberFormat numFormat = NumberFormat.getInstance();
247
        try {
248
       	 	Number maxNum = numFormat.parse( maxVisibleText.getText() );
249
       	 	Number minNum = numFormat.parse( minVisibleText.getText() );
250
        	maxVisible = maxNum.doubleValue();
251
        	minVisible = minNum.doubleValue();	 	
252
        } catch (ParseException e) { 
253
        	/* handle exception case */
254
        	maxVisible = slider.getMaxVisible();
255
        	minVisible = slider.getMinVisible();
256
        }
257
243
/*    	maxLimit = Double.parseDouble(maxLimitText.getText());
258
/*    	maxLimit = Double.parseDouble(maxLimitText.getText());
244
    	minLimit = Double.parseDouble(minLimitText.getText());
259
    	minLimit = Double.parseDouble(minLimitText.getText());
245
*/    	super.okPressed();
260
*/    	super.okPressed();
Lines 273-297 Link Here
273
288
274
	public void modifyText(ModifyEvent e) 
289
	public void modifyText(ModifyEvent e) 
275
	{
290
	{
276
		try
291
		/* Attempt to verify the max number to ensure it valides
277
		{			
292
		 * against the locale */
278
			maxVisible =  Double.parseDouble(maxVisibleText.getText());
293
    	NumberFormat numFormat = NumberFormat.getInstance();
279
		}
294
        try {
280
		catch (NumberFormatException ex)
295
       	 	Number maxNum = numFormat.parse( maxVisibleText.getText() );
281
		{
296
        	maxVisible = maxNum.doubleValue();
297
        } catch (ParseException pe) { 
298
			setErrorMessage(StatisticalMessages.ERROR_MAXVISIBLE);
299
			return;
300
        } catch (NumberFormatException ex) 	{
282
			setErrorMessage(StatisticalMessages.ERROR_MAXVISIBLE);
301
			setErrorMessage(StatisticalMessages.ERROR_MAXVISIBLE);
283
			return;
302
			return;
284
		}
303
		}
285
		try
304
286
		{
305
		/* Attempt to verify the min number to ensure it valides
287
			minVisible =  Double.parseDouble(minVisibleText.getText());
306
		 * against the locale */
288
		}
307
        try {
289
		catch (NumberFormatException ex)
308
       	 	Number minNum = numFormat.parse( minVisibleText.getText() );
290
		{
309
        	minVisible = minNum.doubleValue();
310
        } catch (ParseException pe) { 
291
			setErrorMessage(StatisticalMessages.ERROR_MINVISIBLE);
311
			setErrorMessage(StatisticalMessages.ERROR_MINVISIBLE);
292
			return;			
312
			return;
313
        } catch (NumberFormatException ex) 	{
314
			setErrorMessage(StatisticalMessages.ERROR_MINVISIBLE);
315
			return;
293
		}
316
		}
294
317
        
295
/*		try
318
/*		try
296
		{
319
		{
297
		   	maxLimit = Double.parseDouble(maxLimitText.getText());
320
		   	maxLimit = Double.parseDouble(maxLimitText.getText());
Lines 336-349 Link Here
336
		if (newString.trim().equals("-"))
359
		if (newString.trim().equals("-"))
337
			return;
360
			return;
338
				
361
				
339
		try
362
		/* Attempt to parse the number to verify that it validates with the
340
		{
363
		 * current locale settings */		
341
			Double.parseDouble(newString);
364
    	NumberFormat numFormat = NumberFormat.getInstance();
342
		}
365
        try {
343
		catch (Exception ex)
366
       	 	Number num = numFormat.parse( newString );
344
		{
367
        	double con = num.doubleValue();
345
			e.doit = false;
368
        } catch (ParseException pe) { 
369
        	e.doit = false;
370
        } catch (NumberFormatException ex) 	{
371
        	e.doit = false;
346
		}
372
		}
373
347
	}
374
	}
348
	
375
	
349
	private String checkConfiguration(double minVisible, double maxVisible, double resolution)
376
	private String checkConfiguration(double minVisible, double maxVisible, double resolution)

Return to bug 144936