Search in sources :

Example 1 with CaretEvent

use of org.eclipse.swt.custom.CaretEvent in project otertool by wuntee.

the class CTabItemWithHexViewer method addListeners.

private void addListeners(final StyledText txt) {
    txt.addMouseWheelListener(new MouseWheelListener() {

        public void mouseScrolled(MouseEvent arg0) {
            binContent.setTopIndex(txt.getTopIndex());
            hexContent.setTopIndex(txt.getTopIndex());
            counter.setTopIndex(txt.getTopIndex());
        }
    });
    txt.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent arg0) {
            binContent.setTopIndex(txt.getTopIndex());
            hexContent.setTopIndex(txt.getTopIndex());
            counter.setTopIndex(txt.getTopIndex());
        }

        public void widgetSelected(SelectionEvent arg0) {
            binContent.setTopIndex(txt.getTopIndex());
            hexContent.setTopIndex(txt.getTopIndex());
            counter.setTopIndex(txt.getTopIndex());
        }
    });
    txt.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent arg0) {
            binContent.setTopIndex(txt.getTopIndex());
            hexContent.setTopIndex(txt.getTopIndex());
            counter.setTopIndex(txt.getTopIndex());
        }
    });
    txt.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDown(MouseEvent arg0) {
            binContent.setTopIndex(txt.getTopIndex());
            hexContent.setTopIndex(txt.getTopIndex());
            counter.setTopIndex(txt.getTopIndex());
        }
    });
    txt.addCaretListener(new CaretListener() {

        public void caretMoved(CaretEvent arg0) {
            binContent.setTopIndex(txt.getTopIndex());
            hexContent.setTopIndex(txt.getTopIndex());
            counter.setTopIndex(txt.getTopIndex());
        }
    });
    txt.addDragDetectListener(new DragDetectListener() {

        public void dragDetected(DragDetectEvent arg0) {
            binContent.setTopIndex(txt.getTopIndex());
            hexContent.setTopIndex(txt.getTopIndex());
            counter.setTopIndex(txt.getTopIndex());
        }
    });
    ScrollBar vbar = txt.getVerticalBar();
    if (vbar != null) {
        vbar.addListener(SWT.Selection, new Listener() {

            public void handleEvent(Event arg0) {
                binContent.setTopIndex(txt.getTopIndex());
                hexContent.setTopIndex(txt.getTopIndex());
                counter.setTopIndex(txt.getTopIndex());
            }
        });
    }
}
Also used : CaretEvent(org.eclipse.swt.custom.CaretEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) DragDetectListener(org.eclipse.swt.events.DragDetectListener) Listener(org.eclipse.swt.widgets.Listener) MouseWheelListener(org.eclipse.swt.events.MouseWheelListener) CaretListener(org.eclipse.swt.custom.CaretListener) SelectionListener(org.eclipse.swt.events.SelectionListener) KeyAdapter(org.eclipse.swt.events.KeyAdapter) MouseAdapter(org.eclipse.swt.events.MouseAdapter) MouseWheelListener(org.eclipse.swt.events.MouseWheelListener) DragDetectListener(org.eclipse.swt.events.DragDetectListener) KeyEvent(org.eclipse.swt.events.KeyEvent) CaretListener(org.eclipse.swt.custom.CaretListener) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DragDetectEvent(org.eclipse.swt.events.DragDetectEvent) DragDetectEvent(org.eclipse.swt.events.DragDetectEvent) Event(org.eclipse.swt.widgets.Event) KeyEvent(org.eclipse.swt.events.KeyEvent) CaretEvent(org.eclipse.swt.custom.CaretEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ScrollBar(org.eclipse.swt.widgets.ScrollBar) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

CaretEvent (org.eclipse.swt.custom.CaretEvent)1 CaretListener (org.eclipse.swt.custom.CaretListener)1 DragDetectEvent (org.eclipse.swt.events.DragDetectEvent)1 DragDetectListener (org.eclipse.swt.events.DragDetectListener)1 KeyAdapter (org.eclipse.swt.events.KeyAdapter)1 KeyEvent (org.eclipse.swt.events.KeyEvent)1 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 MouseWheelListener (org.eclipse.swt.events.MouseWheelListener)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 Event (org.eclipse.swt.widgets.Event)1 Listener (org.eclipse.swt.widgets.Listener)1 ScrollBar (org.eclipse.swt.widgets.ScrollBar)1