in eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/DateTimeEditor.java [60:143]
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
GridData parentLayoutData = new GridData(GridData.FILL_BOTH);
parentLayoutData.widthHint = 280;
parentLayoutData.heightHint = 280;
composite.setLayoutData(parentLayoutData);
GridLayout parentLayout = (GridLayout) composite.getLayout();
parentLayout.numColumns = 2;
Label label = new Label(composite, SWT.WRAP);
label.setText("Modify property "+property.getName()+":");
GridData data = new GridData(GridData.GRAB_HORIZONTAL
| GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
| GridData.VERTICAL_ALIGN_CENTER);
data.horizontalSpan = 2;
data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
label.setLayoutData(data);
label.setFont(parent.getFont());
Label hline = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
layoutData.horizontalSpan = 2;
hline.setLayoutData(layoutData);
Label dateLabel = new Label(composite, SWT.WRAP);
dateLabel.setText("Date:");
layoutData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
layoutData.widthHint = 80;
dateLabel.setLayoutData(layoutData);
dateLabel.setFont(parent.getFont());
calendar = new DateTime(composite, SWT.CALENDAR);
layoutData = new GridData(GridData.FILL_VERTICAL | GridData.HORIZONTAL_ALIGN_BEGINNING);
layoutData.horizontalSpan = 1;
calendar.setLayoutData(layoutData);
calendar.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateSelection();
}
});
Label timeLabel = new Label(composite, SWT.WRAP);
timeLabel.setText("Time:");
layoutData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
layoutData.widthHint = 80;
timeLabel.setLayoutData(layoutData);
timeLabel.setFont(parent.getFont());
time = new DateTime(composite, SWT.TIME);
layoutData = new GridData(GridData.FILL_VERTICAL | GridData.HORIZONTAL_ALIGN_BEGINNING);
layoutData.horizontalSpan = 1;
time.setLayoutData(layoutData);
time.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateSelection();
}
});
hline = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
layoutData = new GridData(GridData.FILL_HORIZONTAL);
layoutData.horizontalSpan = 2;
hline.setLayoutData(layoutData);
result = new Label(composite, SWT.WRAP);
result.setText("Foo");
data = new GridData(GridData.GRAB_HORIZONTAL
| GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
| GridData.VERTICAL_ALIGN_CENTER);
data.horizontalSpan = 2;
result.setLayoutData(data);
result.setFont(parent.getFont());
// initialize value
dateAsString = property.getValueAsString();
c = DateTimeSupport.parseAsCalendar(dateAsString);
calendar.setDate(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH));
time.setTime(c.get(Calendar.HOUR_OF_DAY), c.get(Calendar.MINUTE), c.get(Calendar.SECOND));
updateSelection();
return composite;
}