protected Control createContents()

in application/org.openjdk.jmc.flightrecorder.ui/src/main/java/org/openjdk/jmc/flightrecorder/ui/preferences/GeneralPage.java [98:210]


	protected Control createContents(Composite parent) {
		Composite container = new Composite(parent, SWT.NONE);
		container.setLayout(new GridLayout());

		Button removeRecordingsCheckbox = createRemoveRecordingsCheckBox(container);
		removeRecordingsCheckbox.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
		Button confirmRemoveTemplateCheckbox = createConfirmRemoveTemplateCheckBox(container);
		confirmRemoveTemplateCheckbox.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
		Button showMonitoringWarningCheckbox = createShowMonitoringWarningCheckBox(container);
		showMonitoringWarningCheckbox.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
		Button enableAnalysisCheckbox = createEnableAnalysisCheckBox(container);
		enableAnalysisCheckbox.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
		Button includeExperimental = createIncludeExperimentalEventsAndFieldsCheckBox(container);
		includeExperimental.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
		Button allowIncompleteRecording = createAllowIncompleteRecordingFileCheckBox(container);
		allowIncompleteRecording.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));

		Group dumpDefaultGroup = new Group(container, SWT.NONE);
		dumpDefaultGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
		dumpDefaultGroup.setText(Messages.DUMP_RECORDING_DEFAULT_TIMESPAN_TO_DUMP);
		dumpDefaultGroup.setLayout(new GridLayout());

		noDefaultRadio = new Button(dumpDefaultGroup, SWT.RADIO);
		noDefaultRadio.setText(Messages.DUMP_RECORDING_NO_DEFAULT);
		wholeRadio = new Button(dumpDefaultGroup, SWT.RADIO);
		wholeRadio.setText(Messages.DUMP_RECORDING_WHOLE);
		timespanRadio = new Button(dumpDefaultGroup, SWT.RADIO);
		timespanRadio.setText(Messages.DUMP_RECORDING_TIMESPAN);

		// If we have several text fields then we want them to be in the same container with a shared GridLayout so that
		// they become aligned. Since we only have one text field in this preference page then we can use a custom
		// container with its own layout.
		Composite defaultTimespanContainer = new Composite(container, SWT.NONE);
		defaultTimespanContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
		defaultTimespanContainer.setLayout(new GridLayout(2, false));

		Label timespanLabel = new Label(defaultTimespanContainer, SWT.NONE);
		timespanLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
		timespanLabel.setText(Messages.DUMP_RECORDING_TIMESPAN_VALUE);
		timespanValue = new Text(defaultTimespanContainer, SWT.BORDER);
		timespanValue.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
		QuantityKindProposal.install(timespanValue, UnitLookup.TIMESPAN);

		Label selectionStoreLabel = new Label(defaultTimespanContainer, SWT.NONE);
		selectionStoreLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
		selectionStoreLabel.setText(Messages.STORED_SELECTIONS_SIZE_PREF);
		selectionStoreValue = new Text(defaultTimespanContainer, SWT.BORDER);
		selectionStoreValue.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
		QuantityKindProposal.install(selectionStoreValue, UnitLookup.NUMBER);

		Label itemListLabel = new Label(defaultTimespanContainer, SWT.NONE);
		itemListLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
		itemListLabel.setText(Messages.ITEM_LIST_SIZE_PREF);
		itemListLabel.setToolTipText(Messages.ITEM_LIST_SIZE_PREF_TOOLTIP);
		itemListValue = new Text(defaultTimespanContainer, SWT.BORDER);
		itemListValue.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
		QuantityKindProposal.install(itemListValue, UnitLookup.NUMBER);

		Label propertiesArrayStringSizeLabel = new Label(defaultTimespanContainer, SWT.NONE);
		propertiesArrayStringSizeLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
		propertiesArrayStringSizeLabel.setText(Messages.PREFERENCES_PROPERTIES_ARRAY_STRING_SIZE_TEXT);
		propertiesArrayStringSizeLabel.setToolTipText(Messages.PREFERENCES_PROPERTIES_ARRAY_STRING_SIZE_TOOLTIP);
		propertiesArrayStringSizeValue = new Text(defaultTimespanContainer, SWT.BORDER);
		propertiesArrayStringSizeValue.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
		QuantityKindProposal.install(propertiesArrayStringSizeValue, UnitLookup.NUMBER);

		Label editorRuleEvaluationThreadsLabel = new Label(defaultTimespanContainer, SWT.NONE);
		editorRuleEvaluationThreadsLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
		editorRuleEvaluationThreadsLabel.setText(Messages.PREFERENCES_EVALUATION_THREAD_NUMBER_TEXT);
		editorRuleEvaluationThreadsLabel.setToolTipText(Messages.PREFERENCES_EVALUATION_THREAD_NUMBER_TOOLTIP);
		editorRuleEvaluationThreadsValue = new Text(defaultTimespanContainer, SWT.BORDER);
		editorRuleEvaluationThreadsValue.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
		QuantityKindProposal.install(editorRuleEvaluationThreadsValue, UnitLookup.NUMBER);

		loadDumpTypeFromPrefStore(false);
		loadTimespanFromPrefStore(false);
		loadSelectionStoreSizeFromPrefStore(false);
		loadItemListSizeFromPrefStore(false);
		loadPropertiesArrayStringSizeFromPrefStore(false);
		loadEditorRuleEvaluationThreadsFromPrefStore(false);
		timespanValue.addModifyListener(new ModifyListener() {
			@Override
			public void modifyText(ModifyEvent e) {
				validatePage();
			}
		});
		selectionStoreValue.addModifyListener(new ModifyListener() {
			@Override
			public void modifyText(ModifyEvent e) {
				validatePage();
			}
		});
		itemListValue.addModifyListener(new ModifyListener() {
			@Override
			public void modifyText(ModifyEvent e) {
				validatePage();
			}
		});
		propertiesArrayStringSizeValue.addModifyListener(new ModifyListener() {
			@Override
			public void modifyText(ModifyEvent e) {
				validatePage();
			}
		});
		editorRuleEvaluationThreadsValue.addModifyListener(new ModifyListener() {
			@Override
			public void modifyText(ModifyEvent e) {
				validatePage();
			}
		});

		return container;
	}