use of org.eclipse.search.ui.IReplacePage in project eclipse.platform.text by eclipse.
the class SearchDialog method turnToPage.
private void turnToPage(SelectionEvent event) {
final CTabItem item = (CTabItem) event.item;
CTabFolder folder = item.getParent();
// $NON-NLS-1$
SearchPageDescriptor descriptor = (SearchPageDescriptor) item.getData("descriptor");
if (item.getControl() == null) {
item.setControl(createPageControl(folder, descriptor));
}
Control oldControl = folder.getItem(fCurrentIndex).getControl();
Point oldSize = oldControl.getSize();
Control newControl = item.getControl();
Point newSize = newControl.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
resizeDialogIfNeeded(oldSize, newSize);
ISearchPage oldPage = fCurrentPage;
if (oldPage != null) {
oldPage.setVisible(false);
}
fCurrentPage = descriptor.getPage();
fDialogSettings.put(STORE_PREVIOUS_PAGE, descriptor.getId());
fCurrentIndex = folder.getSelectionIndex();
setPerformActionEnabled(fCurrentPage != null);
if (fCurrentPage != null) {
fCurrentPage.setVisible(true);
Control pageControl = fCurrentPage.getControl();
if (pageControl instanceof Composite)
((Composite) pageControl).layout(false, true);
}
fReplaceButton.setVisible(fCurrentPage instanceof IReplacePage);
notifyPageChanged();
}
use of org.eclipse.search.ui.IReplacePage in project eclipse.platform.text by eclipse.
the class SearchDialog method createButtonBar.
@Override
protected Control createButtonBar(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
// create
layout.numColumns = 0;
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// create help control if needed
if (isHelpAvailable()) {
createHelpControl(composite);
}
fCustomizeButton = createButton(composite, CUSTOMIZE_ID, SearchMessages.SearchDialog_customize, true);
Label filler = new Label(composite, SWT.NONE);
filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
layout.numColumns++;
fReplaceButton = createActionButton(composite, REPLACE_ID, SearchMessages.SearchDialog_replaceAction, true);
fReplaceButton.setVisible(fCurrentPage instanceof IReplacePage);
Button searchButton = createActionButton(composite, SEARCH_ID, SearchMessages.SearchDialog_searchAction, true);
searchButton.setEnabled(fDescriptors.size() > 0);
// cancel button
super.createButtonsForButtonBar(composite);
return composite;
}
Aggregations