Search in sources :

Example 1 with ProgressPageControl

use of org.jkiss.dbeaver.ui.controls.ProgressPageControl in project dbeaver by serge-rider.

the class TabbedFolderPageNode method createControl.

@Override
public void createControl(Composite parent) {
    itemControl = new ItemListControl(parent, SWT.SHEET, mainEditor.getSite(), node, metaNode);
    // itemControl.getLayout().marginHeight = 0;
    // itemControl.getLayout().marginWidth = 0;
    ProgressPageControl progressControl = null;
    if (mainEditor instanceof IProgressControlProvider) {
        progressControl = ((IProgressControlProvider) mainEditor).getProgressControl();
    }
    if (progressControl != null) {
        itemControl.substituteProgressPanel(progressControl);
    } else {
        itemControl.createProgressPanel();
    }
    parent.layout();
    // Activate items control on focus
    itemControl.getItemsViewer().getControl().addFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            // Update selection provider and selection
            final ISelectionProvider selectionProvider = itemControl.getSelectionProvider();
            if (mainEditor.getSite().getSelectionProvider() != selectionProvider) {
                mainEditor.getSite().setSelectionProvider(selectionProvider);
                selectionProvider.setSelection(selectionProvider.getSelection());
            }
            itemControl.activate(true);
            // We need it to update search actions and other contributions provided by node editor
            if (mainEditor.getSite() instanceof MultiPageEditorSite) {
                MultiPageEditorPart multiPageEditor = ((MultiPageEditorSite) mainEditor.getSite()).getMultiPageEditor();
                if (multiPageEditor.getSelectedPage() != mainEditor) {
                    multiPageEditor.setActiveEditor(mainEditor);
                }
            }
        }

        @Override
        public void focusLost(FocusEvent e) {
            itemControl.activate(false);
        }
    });
}
Also used : ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) ProgressPageControl(org.jkiss.dbeaver.ui.controls.ProgressPageControl) MultiPageEditorPart(org.eclipse.ui.part.MultiPageEditorPart) IProgressControlProvider(org.jkiss.dbeaver.ui.IProgressControlProvider) ItemListControl(org.jkiss.dbeaver.ui.navigator.itemlist.ItemListControl) FocusListener(org.eclipse.swt.events.FocusListener) FocusEvent(org.eclipse.swt.events.FocusEvent) MultiPageEditorSite(org.eclipse.ui.part.MultiPageEditorSite)

Example 2 with ProgressPageControl

use of org.jkiss.dbeaver.ui.controls.ProgressPageControl in project dbeaver by serge-rider.

the class TabbedFolderPageProperties method createControl.

@Override
public void createControl(Composite parent) {
    this.boldFont = UIUtils.makeBoldFont(parent.getFont());
    ProgressPageControl ownerProgressControl = null;
    if (this.part instanceof IProgressControlProvider) {
        ownerProgressControl = ((IProgressControlProvider) this.part).getProgressControl();
    }
    progressControl = new PropertiesPageControl(parent);
    if (parent.getLayout() instanceof GridLayout) {
        progressControl.setLayoutData(new GridData(GridData.FILL_BOTH));
    }
    if (ownerProgressControl != null) {
        progressControl.substituteProgressPanel(ownerProgressControl);
    } else {
        progressControl.createProgressPanel();
    }
    propertyTree.getTree().addFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            progressControl.activate(true);
        }

        @Override
        public void focusLost(FocusEvent e) {
            progressControl.activate(false);
        }
    });
    progressControl.addDisposeListener(e -> dispose());
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ProgressPageControl(org.jkiss.dbeaver.ui.controls.ProgressPageControl) GridData(org.eclipse.swt.layout.GridData) IProgressControlProvider(org.jkiss.dbeaver.ui.IProgressControlProvider) FocusListener(org.eclipse.swt.events.FocusListener) FocusEvent(org.eclipse.swt.events.FocusEvent)

Example 3 with ProgressPageControl

use of org.jkiss.dbeaver.ui.controls.ProgressPageControl in project dbeaver by dbeaver.

the class TabbedFolderPageProperties method createControl.

@Override
public void createControl(Composite parent) {
    this.boldFont = UIUtils.makeBoldFont(parent.getFont());
    ProgressPageControl ownerProgressControl = null;
    if (this.part instanceof IProgressControlProvider) {
        ownerProgressControl = ((IProgressControlProvider) this.part).getProgressControl();
    }
    progressControl = new PropertiesPageControl(parent);
    if (parent.getLayout() instanceof GridLayout) {
        progressControl.setLayoutData(new GridData(GridData.FILL_BOTH));
    }
    if (ownerProgressControl != null) {
        progressControl.substituteProgressPanel(ownerProgressControl);
    } else {
        progressControl.createProgressPanel();
    }
    propertyTree.getTree().addFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            progressControl.activate(true);
        }

        @Override
        public void focusLost(FocusEvent e) {
            progressControl.activate(false);
        }
    });
    progressControl.addDisposeListener(e -> dispose());
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ProgressPageControl(org.jkiss.dbeaver.ui.controls.ProgressPageControl) GridData(org.eclipse.swt.layout.GridData) IProgressControlProvider(org.jkiss.dbeaver.ui.IProgressControlProvider) FocusListener(org.eclipse.swt.events.FocusListener) FocusEvent(org.eclipse.swt.events.FocusEvent)

Example 4 with ProgressPageControl

use of org.jkiss.dbeaver.ui.controls.ProgressPageControl in project dbeaver by dbeaver.

the class TabbedFolderPageNode method createControl.

@Override
public void createControl(Composite parent) {
    itemControl = new ItemListControl(parent, SWT.SHEET, mainEditor.getSite(), node, metaNode);
    // itemControl.getLayout().marginHeight = 0;
    // itemControl.getLayout().marginWidth = 0;
    ProgressPageControl progressControl = null;
    if (mainEditor instanceof IProgressControlProvider) {
        progressControl = ((IProgressControlProvider) mainEditor).getProgressControl();
    }
    if (progressControl != null) {
        itemControl.substituteProgressPanel(progressControl);
    } else {
        itemControl.createProgressPanel();
    }
    parent.layout();
    // Activate items control on focus
    itemControl.getItemsViewer().getControl().addFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            // Update selection provider and selection
            final ISelectionProvider selectionProvider = itemControl.getSelectionProvider();
            if (mainEditor.getSite().getSelectionProvider() != selectionProvider) {
                mainEditor.getSite().setSelectionProvider(selectionProvider);
                selectionProvider.setSelection(selectionProvider.getSelection());
            }
            itemControl.activate(true);
            // We need it to update search actions and other contributions provided by node editor
            if (mainEditor.getSite() instanceof MultiPageEditorSite) {
                MultiPageEditorPart multiPageEditor = ((MultiPageEditorSite) mainEditor.getSite()).getMultiPageEditor();
                if (multiPageEditor.getSelectedPage() != mainEditor) {
                    multiPageEditor.setActiveEditor(mainEditor);
                }
            }
        }

        @Override
        public void focusLost(FocusEvent e) {
            itemControl.activate(false);
        }
    });
}
Also used : ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) ProgressPageControl(org.jkiss.dbeaver.ui.controls.ProgressPageControl) MultiPageEditorPart(org.eclipse.ui.part.MultiPageEditorPart) IProgressControlProvider(org.jkiss.dbeaver.ui.IProgressControlProvider) ItemListControl(org.jkiss.dbeaver.ui.navigator.itemlist.ItemListControl) FocusListener(org.eclipse.swt.events.FocusListener) FocusEvent(org.eclipse.swt.events.FocusEvent) MultiPageEditorSite(org.eclipse.ui.part.MultiPageEditorSite)

Aggregations

FocusEvent (org.eclipse.swt.events.FocusEvent)4 FocusListener (org.eclipse.swt.events.FocusListener)4 IProgressControlProvider (org.jkiss.dbeaver.ui.IProgressControlProvider)4 ProgressPageControl (org.jkiss.dbeaver.ui.controls.ProgressPageControl)4 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 MultiPageEditorPart (org.eclipse.ui.part.MultiPageEditorPart)2 MultiPageEditorSite (org.eclipse.ui.part.MultiPageEditorSite)2 ItemListControl (org.jkiss.dbeaver.ui.navigator.itemlist.ItemListControl)2