Commit | Line | Data |
---|---|---|
73005152 | 1 | /********************************************************************** |
c8422608 | 2 | * Copyright (c) 2005, 2012 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 | ||
15 | import org.eclipse.jface.action.Action; | |
16 | import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView; | |
17 | import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDWidget; | |
18 | ||
19 | /** | |
013a5f1c AM |
20 | * Action class implementation to move up in the sequence diagram view within a |
21 | * page. | |
22 | * | |
23 | * @version 1.0 | |
73005152 | 24 | * @author sveyrier |
73005152 BH |
25 | */ |
26 | public class MoveSDUp extends Action { | |
27 | ||
28 | // ------------------------------------------------------------------------ | |
df0b8ff4 | 29 | // Constants |
73005152 | 30 | // ------------------------------------------------------------------------ |
df0b8ff4 BH |
31 | /** |
32 | * The action ID. | |
33 | */ | |
73005152 | 34 | public final static String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.MoveSDUp"; //$NON-NLS-1$ |
013a5f1c | 35 | |
df0b8ff4 BH |
36 | // ------------------------------------------------------------------------ |
37 | // Attributes | |
38 | // ------------------------------------------------------------------------ | |
39 | /** | |
40 | * The sequence diagram view reference. | |
41 | */ | |
73005152 BH |
42 | protected SDView fView = null; |
43 | ||
44 | // ------------------------------------------------------------------------ | |
45 | // Constructors | |
46 | // ------------------------------------------------------------------------ | |
df0b8ff4 BH |
47 | /** |
48 | * Default constructor | |
49 | */ | |
73005152 BH |
50 | public MoveSDUp() { |
51 | this(null); | |
52 | } | |
53 | ||
df0b8ff4 BH |
54 | /** |
55 | * Constructor | |
013a5f1c | 56 | * |
df0b8ff4 BH |
57 | * @param view a sequence diagram view reference |
58 | */ | |
73005152 BH |
59 | public MoveSDUp(SDView view) { |
60 | super(); | |
61 | setId(ID); | |
62 | setActionDefinitionId(ID); | |
abbdd66a | 63 | fView = view; |
73005152 BH |
64 | } |
65 | ||
66 | // ------------------------------------------------------------------------ | |
df0b8ff4 | 67 | // Methods |
73005152 BH |
68 | // ------------------------------------------------------------------------ |
69 | /* | |
70 | * (non-Javadoc) | |
71 | * @see org.eclipse.jface.action.Action#run() | |
72 | */ | |
73 | @Override | |
74 | public void run() { | |
75 | if (fView == null) { | |
76 | return; | |
77 | } | |
abbdd66a | 78 | SDWidget viewer = fView.getSDWidget(); |
df0b8ff4 | 79 | |
73005152 BH |
80 | if (viewer != null) { |
81 | viewer.scrollBy(0, -viewer.getVisibleHeight()); | |
82 | } | |
83 | } | |
84 | ||
85 | /** | |
86 | * Sets the active SD view. | |
87 | * @param view The SD view. | |
88 | */ | |
89 | public void setView(SDView view) { | |
90 | fView = view; | |
91 | } | |
92 | } |