Search in sources :

Example 16 with GridData

use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.

the class ProgressPageControl method hideControls.

private void hideControls(boolean showDefaultControls) {
    if (searchControlsComposite == null || searchControlsComposite.isDisposed()) {
        return;
    }
    searchControlsComposite.getParent().setRedraw(false);
    try {
        // Delete all controls created in searchControlsComposite
        for (Control child : searchControlsComposite.getChildren()) {
            child.dispose();
        }
        // Nullify all controls
        progressBar = null;
        searchText = null;
        // Create default controls toolbar
        if (showDefaultControls) {
            ((GridLayout) searchControlsComposite.getLayout()).numColumns = 2;
            defaultToolbarManager.removeAll();
            if (isSearchPossible() && isSearchEnabled()) {
                defaultToolbarManager.add(ActionUtils.makeCommandContribution(PlatformUI.getWorkbench(), IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE, CoreMessages.controls_progress_page_toolbar_title, UIIcon.SEARCH));
            }
            Label phLabel = new Label(searchControlsComposite, SWT.NONE);
            //$NON-NLS-1$
            phLabel.setText("");
            phLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            ToolBar defaultToolbar = defaultToolbarManager.createControl(searchControlsComposite);
            defaultToolbar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END));
            // Recreate custom controls
            for (Control child : customControlsComposite.getChildren()) {
                child.dispose();
            }
            customToolbarManager.removeAll();
            fillCustomActions(customToolbarManager);
            if (!customToolbarManager.isEmpty()) {
                ToolBar toolbar = customToolbarManager.createControl(customControlsComposite);
                toolbar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END));
            }
        }
        searchControlsComposite.getParent().layout();
    //customControlsComposite.layout();
    } finally {
        searchControlsComposite.getParent().setRedraw(true);
    }
}
Also used : GridData(org.eclipse.swt.layout.GridData)

Example 17 with GridData

use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.

the class ProgressPageControl method createContentContainer.

public Composite createContentContainer() {
    Composite container = new Composite(this, (getStyle() & SWT.SHEET) == SWT.SHEET ? SWT.NONE : SWT.BORDER);
    container.setLayout(new FillLayout());
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.horizontalIndent = 0;
    gd.verticalIndent = 0;
    container.setLayoutData(gd);
    return container;
}
Also used : GridData(org.eclipse.swt.layout.GridData) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 18 with GridData

use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.

the class ProgressPageControl method createSearchControls.

private void createSearchControls() {
    if (searchText != null) {
        return;
    }
    hideControls(false);
    ((GridLayout) searchControlsComposite.getLayout()).numColumns = 2;
    searchText = new Text(searchControlsComposite, SWT.BORDER);
    UIUtils.addFocusTracker(DBeaverUI.getActiveWorkbenchWindow(), UIUtils.INLINE_WIDGET_EDITOR_ID, this.searchText);
    if (curSearchText != null) {
        searchText.setText(curSearchText);
        searchText.setSelection(curSearchText.length());
    }
    //searchText.setBackground(searchNotFoundColor);
    searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    searchText.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            switch(e.keyCode) {
                case SWT.ESC:
                    cancelSearch(true);
                    break;
                case SWT.CR:
                case SWT.ARROW_UP:
                case SWT.ARROW_DOWN:
                    if (childPageControl != null) {
                        childPageControl.setFocus();
                    }
                    e.doit = false;
                    //performSearch(SearchType.NEXT);
                    break;
            }
        }
    });
    searchText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            curSearchText = searchText.getText();
            if (curSearchJob == null) {
                curSearchJob = new UIJob(CoreMessages.controls_progress_page_job_search) {

                    @Override
                    public IStatus runInUIThread(IProgressMonitor monitor) {
                        if (monitor.isCanceled()) {
                            return Status.CANCEL_STATUS;
                        }
                        performSearch(SearchType.NEXT);
                        curSearchJob = null;
                        return Status.OK_STATUS;
                    }
                };
                curSearchJob.schedule(200);
            }
        }
    });
    //ToolBar searchTools = new ToolBar(searchControlsComposite, SWT.HORIZONTAL);
    if (searchToolbarManager == null) {
        searchToolbarManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
        // Do not add prev/next buttons - they doesn't make sense now.
        // Keep code just in case
        /*
            searchToolbarManager.add(ActionUtils.makeCommandContribution(
                    PlatformUI.getWorkbench(),
                    IWorkbenchActionDefinitionIds.FIND_NEXT,
                    null,
                    UIIcon.ARROW_DOWN));
            searchToolbarManager.add(ActionUtils.makeCommandContribution(
                    PlatformUI.getWorkbench(),
                    IWorkbenchActionDefinitionIds.FIND_PREVIOUS,
                    null,
                    UIIcon.ARROW_UP));
*/
        searchToolbarManager.add(new Action(CoreMessages.controls_progress_page_action_close, UIUtils.getShardImageDescriptor(ISharedImages.IMG_ELCL_REMOVE)) {

            @Override
            public void run() {
                cancelSearch(true);
            }
        });
    }
    searchToolbarManager.createControl(searchControlsComposite);
    searchControlsComposite.getParent().layout();
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) Action(org.eclipse.jface.action.Action) GridData(org.eclipse.swt.layout.GridData) UIJob(org.eclipse.ui.progress.UIJob) ToolBarManager(org.eclipse.jface.action.ToolBarManager)

Example 19 with GridData

use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.

the class PairListControl method createButton.

private Button createButton(Composite panel, Image label, SelectionListener listener) {
    Button button = new Button(panel, SWT.PUSH);
    button.setImage(label);
    button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    button.addSelectionListener(listener);
    return button;
}
Also used : GridData(org.eclipse.swt.layout.GridData)

Example 20 with GridData

use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.

the class PairListControl method createList.

private Table createList(Composite panel) {
    final Table table = new Table(panel, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    GridData gd = new GridData(GridData.FILL_BOTH);
    table.setLayoutData(gd);
    final TableColumn column = new TableColumn(table, SWT.LEFT);
    table.addListener(SWT.Resize, new Listener() {

        @Override
        public void handleEvent(Event e) {
            column.setWidth(table.getClientArea().width);
        }
    });
    return table;
}
Also used : GridData(org.eclipse.swt.layout.GridData)

Aggregations

GridData (org.eclipse.swt.layout.GridData)1831 GridLayout (org.eclipse.swt.layout.GridLayout)1286 Composite (org.eclipse.swt.widgets.Composite)1136 Label (org.eclipse.swt.widgets.Label)709 SelectionEvent (org.eclipse.swt.events.SelectionEvent)602 Button (org.eclipse.swt.widgets.Button)526 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)512 Text (org.eclipse.swt.widgets.Text)427 Group (org.eclipse.swt.widgets.Group)383 ModifyListener (org.eclipse.swt.events.ModifyListener)184 ModifyEvent (org.eclipse.swt.events.ModifyEvent)181 Combo (org.eclipse.swt.widgets.Combo)171 Table (org.eclipse.swt.widgets.Table)140 TableViewer (org.eclipse.jface.viewers.TableViewer)136 Point (org.eclipse.swt.graphics.Point)107 SelectionListener (org.eclipse.swt.events.SelectionListener)100 FillLayout (org.eclipse.swt.layout.FillLayout)93 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)85 TableColumn (org.eclipse.swt.widgets.TableColumn)80 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)76