~ubuntu-branches/ubuntu/vivid/eclipse-linuxtools/vivid-proposed

« back to all changes in this revision

Viewing changes to lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramZoom.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam, Jakub Adam, tony mancill
  • Date: 2014-10-11 11:44:05 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20141011114405-yazjvxfzzhmi5sgj
Tags: 3.1.0-1
[ Jakub Adam ]
* New upstream release (Closes: #761524).
* Refreshed d/patches.
* Don't build removed feature org.eclipse.linuxtools.tools.launch
  - merged into org.eclipse.linuxtools.profiling.
* Use javac target 1.7.
* Build new feature org.eclipse.linuxtools.dataviewers.feature
  - required by Valgrind integration.
* Build-depend on eclipse-remote-services-api and eclipse-cdt-autotools.
* Bump Standards-Version to 3.9.6.
* Override incompatible-java-bytecode-format - linuxtools needs Java 7.
* Remove unused codeless-jar override.

[ tony mancill ]
* Tweak short package description to make lintian happy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
package org.eclipse.linuxtools.tmf.ui.views.histogram;
16
16
 
 
17
import org.eclipse.swt.events.KeyEvent;
 
18
import org.eclipse.swt.events.KeyListener;
17
19
import org.eclipse.swt.events.MouseEvent;
18
20
import org.eclipse.swt.events.MouseWheelListener;
19
21
 
24
26
 * @author Francois Chouinard
25
27
 * <p>
26
28
 */
27
 
public class HistogramZoom implements MouseWheelListener {
 
29
public class HistogramZoom implements MouseWheelListener, KeyListener {
28
30
 
29
31
    // ------------------------------------------------------------------------
30
32
    // Constants
68
70
 
69
71
        fRangeStartTime = fAbsoluteStartTime;
70
72
        fRangeDuration = fAbsoluteStartTime + fMinWindowSize;
 
73
 
 
74
        histogram.addMouseWheelListener(this);
 
75
        histogram.addKeyListener(this);
71
76
    }
72
77
 
73
78
    // ------------------------------------------------------------------------
144
149
    // ------------------------------------------------------------------------
145
150
 
146
151
    @Override
147
 
    public synchronized void mouseScrolled(MouseEvent event) {
 
152
    public void mouseScrolled(MouseEvent event) {
148
153
        zoom(event.count);
149
154
    }
150
155
 
 
156
    /**
 
157
     * @since 3.1
 
158
     */
 
159
    @Override
 
160
    public void keyPressed(KeyEvent e) {
 
161
        if (e.character == '+') {
 
162
            zoom(1);
 
163
        } else if (e.character == '-') {
 
164
            zoom(-1);
 
165
        }
 
166
    }
 
167
 
 
168
    /**
 
169
     * @since 3.1
 
170
     */
 
171
    @Override
 
172
    public void keyReleased(KeyEvent e) {
 
173
    }
 
174
 
151
175
    private synchronized void zoom(int nbClicks) {
152
176
        // Compute the new time range
153
177
        long requestedRange = (nbClicks > 0) ? Math.round(ZOOM_FACTOR * fRangeDuration) : (long) Math.ceil(fRangeDuration * (1.0 / ZOOM_FACTOR));