Search in sources :

Example 1 with IReplacePage

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();
}
Also used : Control(org.eclipse.swt.widgets.Control) CTabFolder(org.eclipse.swt.custom.CTabFolder) Composite(org.eclipse.swt.widgets.Composite) IReplacePage(org.eclipse.search.ui.IReplacePage) Point(org.eclipse.swt.graphics.Point) CTabItem(org.eclipse.swt.custom.CTabItem) ISearchPage(org.eclipse.search.ui.ISearchPage)

Example 2 with IReplacePage

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;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) IReplacePage(org.eclipse.search.ui.IReplacePage)

Aggregations

IReplacePage (org.eclipse.search.ui.IReplacePage)2 Composite (org.eclipse.swt.widgets.Composite)2 ISearchPage (org.eclipse.search.ui.ISearchPage)1 CTabFolder (org.eclipse.swt.custom.CTabFolder)1 CTabItem (org.eclipse.swt.custom.CTabItem)1 Point (org.eclipse.swt.graphics.Point)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Control (org.eclipse.swt.widgets.Control)1 Label (org.eclipse.swt.widgets.Label)1