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