Commit | Line | Data |
---|---|---|
73005152 | 1 | /********************************************************************** |
11252342 | 2 | * Copyright (c) 2005, 2013 IBM Corporation, Ericsson |
73005152 BH |
3 | * All rights reserved. This program and the accompanying materials |
4 | * are made available under the terms of the Eclipse Public License v1.0 | |
5 | * which accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
013a5f1c AM |
7 | * |
8 | * Contributors: | |
c8422608 AM |
9 | * IBM - Initial API and implementation |
10 | * Bernd Hufmann - Updated for TMF | |
73005152 | 11 | **********************************************************************/ |
c8422608 | 12 | |
73005152 BH |
13 | package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers; |
14 | ||
73005152 BH |
15 | import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView; |
16 | import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDWidget; | |
17 | ||
18 | /** | |
013a5f1c AM |
19 | * Action class implementation to move up in the sequence diagram view within a |
20 | * page. | |
21 | * | |
22 | * @version 1.0 | |
73005152 | 23 | * @author sveyrier |
73005152 | 24 | */ |
cab6c8ff | 25 | public class MoveSDUp extends BaseSDAction { |
73005152 BH |
26 | |
27 | // ------------------------------------------------------------------------ | |
df0b8ff4 | 28 | // Constants |
73005152 | 29 | // ------------------------------------------------------------------------ |
df0b8ff4 BH |
30 | /** |
31 | * The action ID. | |
32 | */ | |
f26e290b | 33 | public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.MoveSDUp"; //$NON-NLS-1$ |
013a5f1c | 34 | |
73005152 BH |
35 | // ------------------------------------------------------------------------ |
36 | // Constructors | |
37 | // ------------------------------------------------------------------------ | |
df0b8ff4 BH |
38 | /** |
39 | * Default constructor | |
40 | */ | |
73005152 BH |
41 | public MoveSDUp() { |
42 | this(null); | |
43 | } | |
44 | ||
df0b8ff4 BH |
45 | /** |
46 | * Constructor | |
013a5f1c | 47 | * |
df0b8ff4 BH |
48 | * @param view a sequence diagram view reference |
49 | */ | |
73005152 | 50 | public MoveSDUp(SDView view) { |
cab6c8ff | 51 | super(view); |
73005152 BH |
52 | setId(ID); |
53 | setActionDefinitionId(ID); | |
73005152 BH |
54 | } |
55 | ||
56 | // ------------------------------------------------------------------------ | |
df0b8ff4 | 57 | // Methods |
73005152 | 58 | // ------------------------------------------------------------------------ |
11252342 | 59 | |
73005152 BH |
60 | @Override |
61 | public void run() { | |
cab6c8ff | 62 | if (getView() == null) { |
73005152 BH |
63 | return; |
64 | } | |
cab6c8ff | 65 | SDWidget viewer = getView().getSDWidget(); |
df0b8ff4 | 66 | |
73005152 BH |
67 | if (viewer != null) { |
68 | viewer.scrollBy(0, -viewer.getVisibleHeight()); | |
69 | } | |
70 | } | |
73005152 | 71 | } |