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