public AptConfigurationBlock( IStatusChangeListener context, IProject project, IWorkbenchPreferenceContainer container) { super(context, project, getAllKeys(), container); fJProj = JavaCore.create(project); UpdateAdapter adapter = new UpdateAdapter(); if (fJProj != null) { fAptEnabledField = new SelectionButtonDialogField(SWT.CHECK); fAptEnabledField.setDialogFieldListener(adapter); fAptEnabledField.setLabelText(Messages.AptConfigurationBlock_enable); } else { fAptEnabledField = null; } fReconcileEnabledField = new SelectionButtonDialogField(SWT.CHECK); fReconcileEnabledField.setDialogFieldListener(adapter); fReconcileEnabledField.setLabelText(Messages.AptConfigurationBlock_enableReconcileProcessing); fGenSrcDirField = new StringDialogField(); fGenSrcDirField.setDialogFieldListener(adapter); fGenSrcDirField.setLabelText(Messages.AptConfigurationBlock_generatedSrcDir); String[] buttons = new String[] { Messages.AptConfigurationBlock_add, Messages.AptConfigurationBlock_edit, Messages.AptConfigurationBlock_remove }; ProcessorOptionsAdapter optionsAdapter = new ProcessorOptionsAdapter(); fProcessorOptionsField = new ListDialogField<>(optionsAdapter, buttons, new ProcessorOptionsLabelProvider()); fProcessorOptionsField.setDialogFieldListener(optionsAdapter); fProcessorOptionsField.setRemoveButtonIndex(IDX_REMOVE); String[] columnHeaders = new String[] {Messages.AptConfigurationBlock_key, Messages.AptConfigurationBlock_value}; fProcessorOptionsField.setTableColumns( new ListDialogField.ColumnsDescription(columnHeaders, true)); fProcessorOptionsField.setViewerComparator(new ProcessorOptionSorter()); fProcessorOptionsField.setLabelText(Messages.AptConfigurationBlock_options); updateControls(); if (fProcessorOptionsField.getSize() > 0) { fProcessorOptionsField.selectFirstElement(); } else { fProcessorOptionsField.enableButton(IDX_EDIT, false); } }
/* (non-Javadoc) * @see org.eclipse.jface.dialogs.IconAndMessageDialog#createMessageArea(org.eclipse.swt.widgets.Composite) */ @Override protected Control createMessageArea(Composite parent) { initializeDialogUnits(parent); Composite messageComposite = new Composite(parent, SWT.NONE); messageComposite.setFont(parent.getFont()); GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); messageComposite.setLayout(layout); messageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); createLinkControl(messageComposite); int indent = convertWidthInCharsToPixels(3); fNotSortAllRadio.doFillIntoGrid(messageComposite, 1); LayoutUtil.setHorizontalIndent(fNotSortAllRadio.getSelectionButton(null), indent); fSortAllRadio.doFillIntoGrid(messageComposite, 1); LayoutUtil.setHorizontalIndent(fSortAllRadio.getSelectionButton(null), indent); final Composite warningComposite = new Composite(messageComposite, SWT.NONE); layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = 0; layout.marginHeight = 0; warningComposite.setLayout(layout); warningComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); warningComposite.setFont(messageComposite.getFont()); Image image = Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); final Label imageLabel1 = new Label(warningComposite, SWT.LEFT | SWT.WRAP); imageLabel1.setImage(image); imageLabel1.setLayoutData( new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1)); final Label label = new Label(warningComposite, SWT.WRAP); label.setText(DialogsMessages.SortMembersMessageDialog_sort_warning_label); GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1); gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); label.setLayoutData(gridData); label.setFont(warningComposite.getFont()); fNotSortAllRadio.setDialogFieldListener( new IDialogFieldListener() { public void dialogFieldChanged(DialogField field) { imageLabel1.setEnabled(!fNotSortAllRadio.isSelected()); label.setEnabled(!fNotSortAllRadio.isSelected()); } }); imageLabel1.setEnabled(!fNotSortAllRadio.isSelected()); label.setEnabled(!fNotSortAllRadio.isSelected()); return messageComposite; }
public LocationGroup() { fWorkspaceRadio = new SelectionButtonDialogField(SWT.RADIO); fWorkspaceRadio.setDialogFieldListener(this); fWorkspaceRadio.setLabelText("Use &default location"); fExternalRadio = new SelectionButtonDialogField(SWT.RADIO); fExternalRadio.setLabelText("Use &external location"); fLocation = new StringButtonDialogField(this); fLocation.setDialogFieldListener(this); fLocation.setLabelText( NewWizardMessages.NewJavaProjectWizardPageOne_LocationGroup_locationLabel_desc); fLocation.setButtonLabel( NewWizardMessages.NewJavaProjectWizardPageOne_LocationGroup_browseButton_desc); fExternalRadio.attachDialogField(fLocation); fWorkspaceRadio.setSelection(true); fExternalRadio.setSelection(false); fPreviousExternalLocation = ""; // $NON-NLS-1$ }