Search in sources :

Example 1 with FocusEvent

use of org.eclipse.draw2d.FocusEvent in project tdi-studio-se by Talend.

the class TalendDrawerEditPart method createFigure.

@Override
@SuppressWarnings("restriction")
public IFigure createFigure() {
    EditPart module = getParent();
    if (module instanceof TalendDrawerEditPart) {
        TalendDrawerEditPart parent = (TalendDrawerEditPart) getParent();
        childLevel = parent.childLevel + 1;
    } else {
        childLevel = 0;
    }
    //$NON-NLS-1$
    getViewer().getControl().setData("ANIMATE", Boolean.FALSE);
    TalendDrawerFigure fig = new TalendDrawerFigure(getViewer().getControl(), childLevel, cssStyleSetting) {

        @Override
        IFigure buildTooltip() {
            return createToolTip();
        }
    };
    //$NON-NLS-1$
    getViewer().getControl().setData("ANIMATE", Boolean.TRUE);
    fig.setExpanded(getDrawer().isInitiallyOpen());
    fig.setPinned(getDrawer().isInitiallyPinned());
    fig.getCollapseToggle().addFocusListener(new FocusListener.Stub() {

        @Override
        public void focusGained(FocusEvent fe) {
            getViewer().select(TalendDrawerEditPart.this);
        }
    });
    return fig;
}
Also used : EditPart(org.eclipse.gef.EditPart) DrawerEditPart(org.eclipse.gef.internal.ui.palette.editparts.DrawerEditPart) FocusListener(org.eclipse.draw2d.FocusListener) FocusEvent(org.eclipse.draw2d.FocusEvent)

Example 2 with FocusEvent

use of org.eclipse.draw2d.FocusEvent in project yamcs-studio by yamcs.

the class ScrollbarFigure method initializeListeners.

/**
 */
private void initializeListeners() {
    addKeyListener(new KeyListener() {

        @Override
        public void keyPressed(KeyEvent ke) {
            if ((ke.keycode == SWT.ARROW_UP && !isHorizontal()) || (ke.keycode == SWT.ARROW_LEFT && isHorizontal()))
                stepUp();
            else if ((ke.keycode == SWT.ARROW_DOWN && !isHorizontal()) || (ke.keycode == SWT.ARROW_RIGHT && isHorizontal()))
                stepDown();
            else if ((ke.keycode == SWT.PAGE_DOWN && !isHorizontal()) || (ke.keycode == SWT.PAGE_UP && isHorizontal()))
                pageDown();
            else if ((ke.keycode == SWT.PAGE_UP && !isHorizontal()) || (ke.keycode == SWT.PAGE_DOWN && isHorizontal()))
                pageUp();
        }

        @Override
        public void keyReleased(KeyEvent ke) {
        }
    });
    addFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent fe) {
            repaint();
        }

        @Override
        public void focusLost(FocusEvent fe) {
            repaint();
        }
    });
}
Also used : KeyEvent(org.eclipse.draw2d.KeyEvent) KeyListener(org.eclipse.draw2d.KeyListener) FocusListener(org.eclipse.draw2d.FocusListener) FocusEvent(org.eclipse.draw2d.FocusEvent)

Aggregations

FocusEvent (org.eclipse.draw2d.FocusEvent)2 FocusListener (org.eclipse.draw2d.FocusListener)2 KeyEvent (org.eclipse.draw2d.KeyEvent)1 KeyListener (org.eclipse.draw2d.KeyListener)1 EditPart (org.eclipse.gef.EditPart)1 DrawerEditPart (org.eclipse.gef.internal.ui.palette.editparts.DrawerEditPart)1