[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| Re: [nebula-dev] CDateTime | 
public class DateTimeEditComposite extends Composite {
	
	private SelectionListener dateChooserListener;
	private TimeZoneOptions local;
	private GregorianCalendar localDateTime;
	private CDateTime dateTimeChooser;
	public DateTimeEditComposite(Composite parent, int style, String label) {
		super(parent, style);
		local = RMPSDateTime.getLocalTimeZone();
		localDateTime = new GregorianCalendar(local.timeZone);
		setLayout(new FillLayout());
		
		String sampleDateTime = RMPSDateTime.formatDateTime(localDateTime);
		super.setLayoutData(new GridData(RMPSUIUtilities.getTextWidth(this, sampleDateTime.length()+3), SWT.DEFAULT));
		dateTimeChooser = new CDateTime(this, CDT.DROP_DOWN | CDT.DATE_SHORT | CDT.TIME_SHORT | CDT.CLOCK_24_HOUR);
		dateTimeChooser.setPattern(RMPSDateTime.getDateTimeFormat());
		dateTimeChooser.setTimeZone(local.getTimeZone());
		dateTimeChooser.setSelection(localDateTime.getTime());
		dateChooserListener = new SelectionListener() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				CDateTime dateTime = (CDateTime) e.widget;
				localDateTime.setTimeInMillis(dateTime.getSelection().getTime());
			}
			@Override
			public void widgetDefaultSelected(SelectionEvent e) {
				widgetSelected(e);
			}
		};
		dateTimeChooser.addSelectionListener(dateChooserListener);
	}
The DateTimeEditComposite is created as a sub-composite of a composite in the method "createSubPartControl(Composite parent)", 
which is a subclass of org.eclipse.ui.part.ViewPart.
>    From: Wim Jongman <wim.jongman@xxxxxxxxx>
>      Date: Tue, 19 Aug 2014 20:48:32 +0200
>      Delivered-to: nebula-dev@xxxxxxxxxxx
>  
>  Hi Glenn,
>  
>  I think it is the way you instantiate the widget. Can you send a snippet of code that uses CDateTime and causes this problem?
>  
>  Cheers,
>  
>  Wim