@Override protected void performDefaults() { fDateTimeFields.loadDefault(); fSSecFields.loadDefault(); fDateFieldDelim.loadDefault(); fTimeFieldDelim.loadDefault(); fSSecFieldDelim.loadDefault(); fCombo.loadDefault(); fPreferenceMap = TmfTimePreferences.getDefaultPreferenceMap(); displayExample(); }
@Override protected void performApply() { fDateTimeFields.store(); fSSecFields.store(); fDateFieldDelim.store(); fTimeFieldDelim.store(); fSSecFieldDelim.store(); fCombo.store(); TmfTimestampFormat.updateDefaultFormats(); TmfSignalManager.dispatchSignal(new TmfTimestampFormatUpdateSignal(null)); displayExample(); }
@Override protected Control createContents(Composite parent) { // Overall preference page layout GridLayout gl = new GridLayout(); gl.marginHeight = 0; gl.marginWidth = 0; parent.setLayout(gl); fPage = new Composite(parent, SWT.NONE); fPage.setLayout(new GridLayout()); fPage.setLayoutData( new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL)); // Example section fExampleSection = new Composite(fPage, SWT.NONE); fExampleSection.setLayout(new GridLayout(2, false)); fExampleSection.setLayoutData(new GridData(GridData.FILL_BOTH)); Label patternLabel = new Label(fExampleSection, SWT.HORIZONTAL); patternLabel.setText("Current Format: "); // $NON-NLS-1$ fPatternDisplay = new Text(fExampleSection, SWT.BORDER | SWT.READ_ONLY); fPatternDisplay.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label exampleLabel = new Label(fExampleSection, SWT.NONE); exampleLabel.setText("Sample Display: "); // $NON-NLS-1$ fExampleDisplay = new Text(fExampleSection, SWT.BORDER | SWT.READ_ONLY); fExampleDisplay.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label separator = new Label(fPage, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE); separator.setLayoutData( new GridData( GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL)); // Time Zones String[][] timeZoneIntervals = new String[timeZones.length][2]; timeZoneIntervals[0][0] = timeZones[0]; timeZoneIntervals[0][1] = fPreferenceStore.getDefaultString(ITmfTimePreferencesConstants.TIME_ZONE); for (int i = 1; i < timeZones.length; i++) { TimeZone tz = null; try { tz = TimeZone.getTimeZone(timeZones[i]); timeZoneIntervals[i][0] = tz.getDisplayName(); timeZoneIntervals[i][1] = tz.getID(); } catch (NullPointerException e) { Activator.getDefault() .logError( "TimeZone " + timeZones[i] + " does not exist.", e); // $NON-NLS-1$ //$NON-NLS-2$ } } fCombo = new ComboFieldEditor( ITmfTimePreferencesConstants.TIME_ZONE, "Time Zone", timeZoneIntervals, fPage); //$NON-NLS-1$ fCombo.setPreferenceStore(fPreferenceStore); fCombo.load(); fCombo.setPropertyChangeListener(this); // Date and Time section fDateTimeFields = new RadioGroupFieldEditor( ITmfTimePreferencesConstants.DATIME, "Date and Time format", 3, fDateTimeFormats, fPage, true); //$NON-NLS-1$ fDateTimeFields.setPreferenceStore(fPreferenceStore); fDateTimeFields.load(); fDateTimeFields.setPropertyChangeListener(this); // Sub-second section fSSecFields = new RadioGroupFieldEditor( ITmfTimePreferencesConstants.SUBSEC, "Sub-second format", 3, fSubSecondFormats, fPage, true); //$NON-NLS-1$ fSSecFields.setPreferenceStore(fPreferenceStore); fSSecFields.load(); fSSecFields.setPropertyChangeListener(this); // Separators section fDateFieldDelim = new RadioGroupFieldEditor( ITmfTimePreferencesConstants.DATE_DELIMITER, "Date delimiter", 5, fDateTimeDelimiters, fPage, true); //$NON-NLS-1$ fDateFieldDelim.setPreferenceStore(fPreferenceStore); fDateFieldDelim.load(); fDateFieldDelim.setPropertyChangeListener(this); fTimeFieldDelim = new RadioGroupFieldEditor( ITmfTimePreferencesConstants.TIME_DELIMITER, "Time delimiter", 5, fDateTimeDelimiters, fPage, true); //$NON-NLS-1$ fTimeFieldDelim.setPreferenceStore(fPreferenceStore); fTimeFieldDelim.load(); fTimeFieldDelim.setPropertyChangeListener(this); fSSecFieldDelim = new RadioGroupFieldEditor( ITmfTimePreferencesConstants.SSEC_DELIMITER, "Sub-Second Delimiter", 5, fSubSecondDelimiters, fPage, true); //$NON-NLS-1$ fSSecFieldDelim.setPreferenceStore(fPreferenceStore); fSSecFieldDelim.load(); fSSecFieldDelim.setPropertyChangeListener(this); refresh(); return fPage; }