List of usage examples for org.eclipse.jface.fieldassist ComboContentAdapter ComboContentAdapter
ComboContentAdapter
From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.CodeChooserDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { GridLayout layout = new GridLayout(2, false); Composite body = new Composite(parent, SWT.NULL); body.setLayout(layout);/*w w w. jav a 2 s . com*/ body.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Label label = new Label(body, SWT.NULL); label.setText(Messages.getString("dialogs.CodeChooserDialog.code")); //$NON-NLS-1$ fCodeName = new Combo(body, SWT.BORDER | SWT.DROP_DOWN); fCodeName.setText(""); //$NON-NLS-1$ fCodeName.setLayoutData(new GridData(SWT.FILL, SWT.NULL, true, false)); label = new Label(body, SWT.NULL); label.setText(Messages.getString("dialogs.CodeChooserDialog.description")); //$NON-NLS-1$ fDescription = new StyledText(body, SWT.WRAP | SWT.BORDER); fDescription.setText(""); //$NON-NLS-1$ fDescription.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); fProposals = buildProposals(); for (String prop : fProposals) { fCodeName.add(prop); } @SuppressWarnings("unused") AutoCompleteField field = new AutoCompleteField(fCodeName, new ComboContentAdapter(), fProposals); fCodeName.addModifyListener(createModifyListener()); return parent; }
From source file:ch.unibe.iam.scg.archie.ui.views.SidebarView.java
License:Open Source License
/** * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) *//*www. j a va2 s .c om*/ @Override public void createPartControl(final Composite parent) { // create a new container for sidebar controls Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); container.setLayout(layout); // Create a simple field for auto complete. Group availableStatistics = new Group(container, SWT.NONE); availableStatistics.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); availableStatistics.setLayout(layout); availableStatistics.setText(Messages.STATISTICS_LIST_TITLE); // Create an auto-complete field TreeMap<String, AbstractDataProvider> providers = ArchieActivator.getInstance().getProviderTable(); String[] availableTitles = providers.keySet().toArray(new String[providers.size()]); this.list = new Combo(availableStatistics, SWT.BORDER | SWT.DROP_DOWN); this.list.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); this.autoComplete = new AutoCompleteField(this.list, new ComboContentAdapter(), availableTitles); this.list.setItems(availableTitles); // NOTE: Currently does not work on GTK, any maybe not even on OS X // TODO: Add value in Archie preference pane. this.list.setVisibleItemCount(5); // add listeners this.list.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String title = SidebarView.this.list.getText(); if (SidebarView.this.isValidProviderTitle(title)) { AbstractDataProvider provider = ArchieActivator.getInstance().getProviderTable().get(title); ProviderManager.getInstance().setProvider(provider); } else { SidebarView.this.details.reset(); } } }); // Add parameters group. Group statisticParameters = new Group(container, SWT.NONE); statisticParameters.setLayoutData(new GridData(GridData.FILL_BOTH)); statisticParameters.setLayout(layout); statisticParameters.setText(Messages.STATISTIC_PARAMETERS_TITLE); // Add details panel containing details and parameters. this.details = new DetailsPanel(statisticParameters, SWT.NONE); this.details.addPropertyChangeListener(this); // Disable by default if user has no access rights. this.setEnabled(ArchieACL.userHasAccess()); // Register this view for UserChanged events. ElexisEventDispatcher.getInstance().addListeners(eeli_user); }
From source file:ch.unibe.iam.scg.archie.ui.views.StatisticsSidebarView.java
License:Open Source License
/** * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) *///from ww w . j ava2 s . co m @Override public void createPartControl(final Composite parent) { // fill statistics table this.initializeAvailableStatistics(); // create a new container for sidebar controls Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); container.setLayout(layout); // Create a simple field for auto complete. Group availableStatistics = new Group(container, SWT.NONE); availableStatistics.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); availableStatistics.setLayout(layout); availableStatistics.setText(Messages.STATISTICS_LIST_TITLE); // Create an auto-complete field String[] availableTitles = this.providers.keySet().toArray(new String[this.providers.size()]); this.list = new Combo(availableStatistics, SWT.BORDER | SWT.DROP_DOWN); this.list.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); this.autoComplete = new AutoCompleteField(this.list, new ComboContentAdapter(), availableTitles); this.list.setItems(availableTitles); // add listeners this.list.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String title = StatisticsSidebarView.this.list.getText(); if (StatisticsSidebarView.this.isValidProviderTitle(title)) { AbstractDataProvider provider = StatisticsSidebarView.this.providers.get(title); ProviderManager.getInstance().setProvider(provider); } else { StatisticsSidebarView.this.details.reset(); } } }); // Add parameters group. Group statisticParameters = new Group(container, SWT.NONE); statisticParameters.setLayoutData(new GridData(GridData.FILL_BOTH)); statisticParameters.setLayout(layout); statisticParameters.setText(Messages.STATISTIC_PARAMETERS_TITLE); // Add details panel containing details and parameters. this.details = new DetailsPanel(statisticParameters, SWT.NONE); this.details.addPropertyChangeListener(this); // Disable by default if user has no access rights. this.setEnabled(ArchieACL.userHasAccess()); // Register this view for UserChanged events. GlobalEvents.getInstance().addUserListener(this); }
From source file:codemirror.eclipse.swt.search.FindReplaceDialog.java
License:Open Source License
/** * Creates the panel where the user specifies the text to search * for and the optional replacement text. * * @param parent the parent composite//from w ww. j ava 2s . c om * @return the input panel */ private Composite createInputPanel(Composite parent) { ModifyListener listener = new ModifyListener() { public void modifyText(ModifyEvent e) { updateButtonState(); } }; Composite panel = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 2; panel.setLayout(layout); Label findLabel = new Label(panel, SWT.LEFT); // findLabel.setText(EditorMessages.FindReplace_Find_label); findLabel.setText("&Find:"); setGridData(findLabel, SWT.LEFT, false, SWT.CENTER, false); // Create the find content assist field ComboContentAdapter contentAdapter = new ComboContentAdapter(); //FindReplaceDocumentAdapterContentProposalProvider findProposer= new FindReplaceDocumentAdapterContentProposalProvider(true); fFindField = new Combo(panel, SWT.DROP_DOWN | SWT.BORDER); /*fContentAssistFindField= new ContentAssistCommandAdapter( fFindField, contentAdapter, findProposer, ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[0], true);*/ setGridData(fFindField, SWT.FILL, true, SWT.CENTER, false); addDecorationMargin(fFindField); fFindField.addModifyListener(fFindModifyListener); fReplaceLabel = new Label(panel, SWT.LEFT); // fReplaceLabel.setText(EditorMessages.FindReplace_Replace_label); fReplaceLabel.setText("R&eplace with:"); setGridData(fReplaceLabel, SWT.LEFT, false, SWT.CENTER, false); // Create the replace content assist field //FindReplaceDocumentAdapterContentProposalProvider replaceProposer= new FindReplaceDocumentAdapterContentProposalProvider(false); fReplaceField = new Combo(panel, SWT.DROP_DOWN | SWT.BORDER); /*fContentAssistReplaceField= new ContentAssistCommandAdapter( fReplaceField, contentAdapter, replaceProposer, ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[0], true);*/ setGridData(fReplaceField, SWT.FILL, true, SWT.CENTER, false); addDecorationMargin(fReplaceField); fReplaceField.addModifyListener(listener); return panel; }
From source file:com.aptana.git.ui.dialogs.CompareWithDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); // The explanatory message Label description = new Label(composite, SWT.WRAP); description.setText(Messages.CompareWithDialog_Message); description.setLayoutData(GridDataFactory.fillDefaults().hint(250, 70).create()); // A label and combo with CA for choosing the ref to compare with Composite group = new Composite(composite, SWT.NONE); group.setLayout(new GridLayout(2, false)); group.setLayoutData(GridDataFactory.swtDefaults().align(SWT.FILL, SWT.BEGINNING).hint(250, 30).create()); Label label = new Label(group, SWT.NONE); label.setText(Messages.CompareWithDialog_Ref_label); refText = new Combo(group, SWT.SINGLE | SWT.BORDER | SWT.DROP_DOWN); refText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); refText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { refValue = refText.getText(); // In case they picked a commit, grab only the SHA (shortened) int index = refValue.indexOf(' '); if (index != -1) { refValue = refValue.substring(0, index); }/*from w w w. j av a2s . co m*/ validate(); } }); // populate possible common values: HEAD, branches, tags, commits refText.add(GitRepository.HEAD); for (GitRef ref : simpleRefs) { refText.add(ref.shortName()); } for (GitCommit commit : commits) { refText.add(commitMessage(commit)); } // set default value of HEAD refText.setText(refValue = GitRepository.HEAD); SearchingContentProposalProvider proposalProvider = new SearchingContentProposalProvider(); ContentProposalAdapter adapter = new ContentProposalAdapter(refText, new ComboContentAdapter(), proposalProvider, KeyStroke.getInstance(SWT.CONTROL, ' '), null); adapter.setPropagateKeys(true); adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); ControlDecoration decoration = new ControlDecoration(refText, SWT.LEFT); decoration.setImage(FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage()); updateStatus(Status.OK_STATUS); return composite; }
From source file:com.aptana.git.ui.dialogs.CreateTagDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); Label tagNameLabel = new Label(composite, SWT.NONE); tagNameLabel.setText(Messages.CreateTagDialog_Message); tagNameText = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL); tagNameText.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(300, 100).create()); tagNameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { tagName = tagNameText.getText(); validate();/*from w ww . j a v a 2s. c om*/ } }); Label tagMessageLabel = new Label(composite, SWT.NONE); tagMessageLabel.setText(Messages.CreateTagDialog_Message_label); messageText = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL); messageText.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(300, 100).create()); messageText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { message = messageText.getText(); validate(); } }); // TODO Add a minimize/maximize button for the advanced section Group group = new Group(composite, SWT.DEFAULT); group.setText(Messages.CreateTagDialog_AdvancedOptions_label); group.setLayout(new GridLayout(1, false)); group.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); Label tagRevLabel = new Label(group, SWT.NONE); tagRevLabel.setText(Messages.CreateTagDialog_StartPoint_label); startPointText = new Combo(group, SWT.SINGLE | SWT.BORDER | SWT.DROP_DOWN); startPointText.setText(startPoint = GitRepository.HEAD); startPointText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); startPointText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { startPoint = startPointText.getText(); // In case they picked a commit, grab only the SHA (shortened) int index = startPoint.indexOf(' '); if (index != -1) { startPoint = startPoint.substring(0, index); } validate(); } }); for (GitCommit commit : commits) { startPointText.add(commitMessage(commit)); } SearchingContentProposalProvider proposalProvider = new SearchingContentProposalProvider(commits); ContentProposalAdapter adapter = new ContentProposalAdapter(startPointText, new ComboContentAdapter(), proposalProvider, KeyStroke.getInstance(SWT.CONTROL, ' '), null); adapter.setPropagateKeys(true); adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); ControlDecoration decoration = new ControlDecoration(startPointText, SWT.LEFT); decoration.setImage(FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage()); return composite; }
From source file:com.aptana.ide.search.epl.filesystem.ui.text.FileSystemReplaceConfigurationPage.java
License:Open Source License
/** * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) *//*from www . ja v a 2 s . co m*/ public void createControl(Composite parent) { Composite result = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); result.setLayout(layout); Label description = new Label(result, SWT.NONE); int numberOfMatches = fReplaceRefactoring.getNumberOfMatches(); int numberOfFiles = fReplaceRefactoring.getNumberOfFiles(); String[] arguments = { String.valueOf(numberOfMatches), String.valueOf(numberOfFiles) }; if (numberOfMatches > 1 && numberOfFiles > 1) { description.setText( Messages.format(SearchMessages.ReplaceConfigurationPage_description_many_in_many, arguments)); } else if (numberOfMatches == 1) { description.setText(SearchMessages.ReplaceConfigurationPage_description_one_in_one); } else { description.setText( Messages.format(SearchMessages.ReplaceConfigurationPage_description_many_in_one, arguments)); } description.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); FileSearchQuery query = fReplaceRefactoring.getQuery(); Label label1 = new Label(result, SWT.NONE); label1.setText(SearchMessages.ReplaceConfigurationPage_replace_label); Text clabel = new Text(result, SWT.BORDER | SWT.READ_ONLY); clabel.setText(query.getSearchString()); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = convertWidthInCharsToPixels(50); clabel.setLayoutData(gd); Label label2 = new Label(result, SWT.NONE); label2.setText(SearchMessages.ReplaceConfigurationPage_with_label); fTextField = new Combo(result, SWT.DROP_DOWN); gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = convertWidthInCharsToPixels(50); fTextField.setLayoutData(gd); fTextField.setFocus(); fTextField.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { updateOKStatus(); } }); IDialogSettings settings = SearchPlugin.getDefault().getDialogSettings().getSection(SETTINGS_GROUP); if (settings != null) { String[] previousReplaceWith = settings.getArray(SETTINGS_REPLACE_WITH); if (previousReplaceWith != null) { fTextField.setItems(previousReplaceWith); fTextField.select(0); } } ComboContentAdapter contentAdapter = new ComboContentAdapter(); FindReplaceDocumentAdapterContentProposalProvider replaceProposer = new FindReplaceDocumentAdapterContentProposalProvider( false); fTextFieldContentAssist = new ContentAssistCommandAdapter(fTextField, contentAdapter, replaceProposer, ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[] { '$', '\\' }, true); new Label(result, SWT.NONE); fReplaceWithRegex = new Button(result, SWT.CHECK); fReplaceWithRegex.setText(SearchMessages.ReplaceConfigurationPage_isRegex_label); fReplaceWithRegex.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { setContentAssistsEnablement(fReplaceWithRegex.getSelection()); } }); if (query.isRegexSearch()) { fReplaceWithRegex.setSelection(true); } else { fReplaceWithRegex.setSelection(false); fReplaceWithRegex.setEnabled(false); } fStatusLabel = new Label(result, SWT.NULL); gd = new GridData(GridData.FILL_HORIZONTAL); gd.verticalAlignment = SWT.BOTTOM; gd.horizontalSpan = 2; fStatusLabel.setLayoutData(gd); setContentAssistsEnablement(fReplaceWithRegex.getSelection()); setControl(result); Dialog.applyDialogFont(result); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), ISearchHelpContextIds.REPLACE_DIALOG); }
From source file:com.bdaum.zoom.ui.internal.dialogs.RegExDialog.java
License:Open Source License
@SuppressWarnings("unused") @Override/*from ww w . j ava 2s . c o m*/ protected Control createDialogArea(Composite parent) { ModifyListener listener = new ModifyListener() { public void modifyText(ModifyEvent e) { validate(); evaluateTargetPath(); } }; Composite area = (Composite) super.createDialogArea(parent); Composite composite = new Composite(area, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); composite.setLayout(new GridLayout(2, false)); new Label(composite, SWT.NONE).setText(Messages.RegExDialog_source_pattern); // Create the source content assist field ComboContentAdapter contentAdapter = new ComboContentAdapter(); fSourceField = new Combo(composite, SWT.DROP_DOWN | SWT.BORDER); fSourceField.setEnabled(!targetOnly); fSourceField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); if (!targetOnly) { FindReplaceDocumentAdapterContentProposalProvider findProposer = new FindReplaceDocumentAdapterContentProposalProvider( true, false); new ContentAssistCommandAdapter(fSourceField, contentAdapter, findProposer, CONTENT_ASSIST_PROPOSALS, new char[0], true); fSourceField.addModifyListener(listener); } new Label(composite, SWT.NONE).setText(Messages.RegExDialog_target_pattern); // Create the target content assist field FindReplaceDocumentAdapterContentProposalProvider replaceProposer = new FindReplaceDocumentAdapterContentProposalProvider( false, false); fTargetField = new Combo(composite, SWT.DROP_DOWN | SWT.BORDER); new ContentAssistCommandAdapter(fTargetField, contentAdapter, replaceProposer, CONTENT_ASSIST_PROPOSALS, new char[0], true); fTargetField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); fTargetField.addModifyListener(listener); if (winTarget) { new Label(composite, SWT.NONE).setText(Messages.RegExDialog_target_volume_name); volumeField = new Combo(composite, SWT.DROP_DOWN | SWT.BORDER); volumeField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); volumeField.addModifyListener(listener); } // Test area CGroup testGroup = new CGroup(composite, SWT.NONE); testGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); testGroup.setLayout(new GridLayout(3, false)); testGroup.setText(Messages.RegExDialog_test_area); new Label(testGroup, SWT.NONE).setText(Messages.RegExDialog_source_path); sourcePathLabel = new Label(testGroup, SWT.NONE); sourcePathLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); Button testButton = new Button(testGroup, SWT.PUSH); testButton.setText(Messages.RegExDialog_browse); testButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(getShell(), SWT.OPEN); dialog.setText(Messages.RegExDialog_select_source_file); if (testPath != null) dialog.setFilterPath(testPath); else if (defPath != null) dialog.setFilterPath(defPath); String path = dialog.open(); if (path != null) { testPath = path; if (Constants.WIN32) { int i = path.indexOf(':'); if (i == 1) { String volume = Core.getCore().getVolumeManager().getVolumeForFile(new File(path)); if (volume != null) testPath = volume + path.substring(1); } } sourcePathLabel.setText(testPath); evaluateTargetPath(); } } }); new Label(testGroup, SWT.NONE).setText(Messages.RegExDialog_target_path); targetPathLabel = new Label(testGroup, SWT.NONE); targetPathLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); new Label(testGroup, SWT.NONE).setText(Messages.RegExDialog_target_volume); targetVolumeLabel = new Label(testGroup, SWT.NONE); targetVolumeLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); new Label(composite, SWT.NONE); return area; }
From source file:com.codenvy.eclipse.ui.widgets.ComboAutoCompleteField.java
License:Open Source License
/** * Constructs an instance of {@link ComboAutoCompleteField} * //from w ww . j ava2s. c om * @param combo the {@link Combo} to auto-complete. * @throws NullPointerException if combo parameter is {@code null} */ public ComboAutoCompleteField(Combo combo) { this.combo = checkNotNull(combo); this.adapter = new ContentProposalAdapter(combo, new ComboContentAdapter(), getProposalProvider(), null, null); this.adapter.setPropagateKeys(true); this.adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); this.proposalStrings = null; }
From source file:com.google.dart.tools.search.internal.ui.text.ReplaceConfigurationPage.java
License:Open Source License
@Override public void createControl(Composite parent) { Composite result = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); result.setLayout(layout);// w ww . j a va 2 s . co m Label description = new Label(result, SWT.NONE); int numberOfMatches = fReplaceRefactoring.getNumberOfMatches(); int numberOfFiles = fReplaceRefactoring.getNumberOfFiles(); String[] arguments = { String.valueOf(numberOfMatches), String.valueOf(numberOfFiles) }; if (numberOfMatches > 1 && numberOfFiles > 1) { description.setText( Messages.format(SearchMessages.ReplaceConfigurationPage_description_many_in_many, arguments)); } else if (numberOfMatches == 1) { description.setText(SearchMessages.ReplaceConfigurationPage_description_one_in_one); } else { description.setText( Messages.format(SearchMessages.ReplaceConfigurationPage_description_many_in_one, arguments)); } description.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); FileSearchQuery query = fReplaceRefactoring.getQuery(); Label label1 = new Label(result, SWT.NONE); label1.setText(SearchMessages.ReplaceConfigurationPage_replace_label); Text clabel = new Text(result, SWT.BORDER | SWT.READ_ONLY); clabel.setText(query.getSearchString()); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = convertWidthInCharsToPixels(50); clabel.setLayoutData(gd); Label label2 = new Label(result, SWT.NONE); label2.setText(SearchMessages.ReplaceConfigurationPage_with_label); fTextField = new Combo(result, SWT.DROP_DOWN); gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = convertWidthInCharsToPixels(50); fTextField.setLayoutData(gd); fTextField.setFocus(); fTextField.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { updateOKStatus(); } }); IDialogSettings settings = SearchPlugin.getDefault().getDialogSettings().getSection(SETTINGS_GROUP); if (settings != null) { String[] previousReplaceWith = settings.getArray(SETTINGS_REPLACE_WITH); if (previousReplaceWith != null) { fTextField.setItems(previousReplaceWith); fTextField.select(0); } } ComboContentAdapter contentAdapter = new ComboContentAdapter(); FindReplaceDocumentAdapterContentProposalProvider replaceProposer = new FindReplaceDocumentAdapterContentProposalProvider( false); fTextFieldContentAssist = new ContentAssistCommandAdapter(fTextField, contentAdapter, replaceProposer, ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[0], true); new Label(result, SWT.NONE); fReplaceWithRegex = new Button(result, SWT.CHECK); fReplaceWithRegex.setText(SearchMessages.ReplaceConfigurationPage_isRegex_label); fReplaceWithRegex.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setContentAssistsEnablement(fReplaceWithRegex.getSelection()); } }); if (query.isRegexSearch()) { fReplaceWithRegex.setSelection(true); } else { fReplaceWithRegex.setSelection(false); fReplaceWithRegex.setEnabled(false); } fStatusLabel = new Label(result, SWT.NULL); gd = new GridData(GridData.FILL_HORIZONTAL); gd.verticalAlignment = SWT.BOTTOM; gd.horizontalSpan = 2; fStatusLabel.setLayoutData(gd); setContentAssistsEnablement(fReplaceWithRegex.getSelection()); setControl(result); Dialog.applyDialogFont(result); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), ISearchHelpContextIds.REPLACE_DIALOG); }