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