@Override public void createControl(final Composite parent) { final Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(LayoutUtil.applyDialogDefaults(new GridLayout(), 2)); setControl(composite); final int count = getRefactoring().getAllOccurrencesCount(); { final Label label = new Label(composite, SWT.NONE); label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); label.setText(Messages.ExtractTemp_Wizard_header); label.setFont(JFaceResources.getBannerFont()); } LayoutUtil.addSmallFiller(composite, false); { final Label label = new Label(composite, SWT.NONE); label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); label.setText(Messages.ExtractTemp_Wizard_VariableName_label); fVariableNameControl = new Text(composite, SWT.BORDER); fVariableNameControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); fVariableNameControl.setFont(JFaceResources.getTextFont()); } LayoutUtil.addSmallFiller(composite, false); { if (count > 0) { final Label label = new Label(composite, SWT.WRAP); label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); if (count == 1) { label.setText("No other occurrences of the selected expression found."); } else { label.setText( NLS.bind("{0} other occurrences of the selected expression found.", count - 1)); } } fReplaceAllControl = new Button(composite, SWT.CHECK); fReplaceAllControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); fReplaceAllControl.setText(Messages.ExtractTemp_Wizard_ReplaceAll_label); if (count <= 1) { fReplaceAllControl.setEnabled(false); } } LayoutUtil.addSmallFiller(composite, false); Dialog.applyDialogFont(composite); initBindings(); // PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),); }
@Override protected Control createDialogArea(final Composite parent) { final Composite area = new Composite(parent, SWT.NONE); area.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true)); area.setLayout(LayoutUtil.applyDialogDefaults(new GridLayout(), 1)); final Composite checkboxComposite = createCheckboxComposite(area, "&R projects:"); checkboxComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); applyDialogFont(area); return area; }
@Override protected Control createDialogArea(final Composite parent) { final Composite area = new Composite(parent, SWT.NONE); final Layouter layouter = new Layouter(area, LayoutUtil.applyDialogDefaults(new GridLayout(), 2)); area.setLayoutData(new GridData(GridData.FILL_BOTH)); this.keywordControl = layouter.addLabeledTextControl(Messages.TaskTags_InputDialog_Name_label); ((GridData) this.keywordControl.getLayoutData()).widthHint = new PixelConverter(this.keywordControl).convertWidthInCharsToPixels(45); this.keywordControl.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { TaskTagsInputDialog.this.keyword = TaskTagsInputDialog.this.keywordControl.getText(); doValidation(); }; }); final String[] items = new String[] { StatetMessages.TaskPriority_High, StatetMessages.TaskPriority_Normal, StatetMessages.TaskPriority_Low, }; this.priorityControl = layouter.addLabeledComboControl(Messages.TaskTags_InputDialog_Priority_label, items); this.priorityControl.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { switch (TaskTagsInputDialog.this.priorityControl.getSelectionIndex()) { case 0: TaskTagsInputDialog.this.priority = TaskPriority.HIGH; break; case 2: TaskTagsInputDialog.this.priority = TaskPriority.LOW; break; default: TaskTagsInputDialog.this.priority = TaskPriority.NORMAL; break; } }; }); // Init Fields if (this.keyword != null) { this.keywordControl.setText(this.keyword); switch (this.priority) { case HIGH: this.priorityControl.select(0); break; case LOW: this.priorityControl.select(2); break; default: // NORMAL this.priorityControl.select(1); break; } } else { this.priorityControl.select(1); } final Display display = parent.getDisplay(); if (display != null) { display.asyncExec( new Runnable() { @Override public void run() { TaskTagsInputDialog.this.keywordControl.setFocus(); } }); } LayoutUtil.addSmallFiller(area, true); applyDialogFont(area); return area; }