description.setText(Messages.format(SearchMessages.ReplaceConfigurationPage_description_many_in_one,
arguments));
}
description.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1));
AbstractPythonSearchQuery 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 = PydevPlugin.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();
IContentProposalProvider replaceProposer = null;
//the code below is so that this works in Eclipse 3.3.
try {
//new FindReplaceDocumentAdapterContentProposalProvider(false);
Class<?> class1 = getClass().getClassLoader().loadClass(
"org.eclipse.jface.text.FindReplaceDocumentAdapterContentProposalProvider");
Constructor<?> constructor = class1.getConstructor(Boolean.class);
replaceProposer = (IContentProposalProvider) constructor.newInstance(false);
} catch (Throwable e) {
//just ignore it if we don't succeed
}
try {
fTextFieldContentAssist = new ContentAssistCommandAdapter(fTextField, contentAdapter, replaceProposer,
ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[] { '$', '\\' }, true);
} catch (Throwable e) {
// Not available in eclipse 3.2
fTextFieldContentAssist = new ContentAssistCommandAdapter(fTextField, contentAdapter, replaceProposer,
ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[] { '$', '\\' });
}
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);
}