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 | |
c8422608 AM |
7 | * |
8 | * Contributors: | |
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 | /** | |
df0b8ff4 | 20 | * Action class implementation to move right in the sequence diagram view within a page. |
c8422608 | 21 | * |
df0b8ff4 | 22 | * @version 1.0 |
73005152 | 23 | * @author sveyrier |
c8422608 | 24 | * |
73005152 BH |
25 | */ |
26 | ||
27 | public class MoveSDRight extends Action { | |
28 | ||
29 | // ------------------------------------------------------------------------ | |
df0b8ff4 | 30 | // Constants |
73005152 | 31 | // ------------------------------------------------------------------------ |
df0b8ff4 BH |
32 | /** |
33 | * The action ID. | |
34 | */ | |
35 | public final static String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.MoveSDRight"; //$NON-NLS-1$ | |
73005152 | 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 MoveSDRight() { |
52 | this(null); | |
53 | } | |
df0b8ff4 BH |
54 | |
55 | /** | |
56 | * Constructor | |
c8422608 | 57 | * |
df0b8ff4 BH |
58 | * @param view a sequence diagram view reference |
59 | */ | |
73005152 BH |
60 | public MoveSDRight(SDView view) { |
61 | super(); | |
62 | setId(ID); | |
63 | setActionDefinitionId(ID); | |
64 | fView = 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() { | |
c8422608 | 76 | |
73005152 BH |
77 | if (fView == null) { |
78 | return; | |
79 | } | |
c8422608 | 80 | |
73005152 | 81 | SDWidget viewer = fView.getSDWidget(); |
df0b8ff4 | 82 | if (viewer != null) { |
73005152 | 83 | viewer.scrollBy(+viewer.getVisibleWidth(), 0); |
df0b8ff4 | 84 | } |
73005152 | 85 | } |
df0b8ff4 | 86 | |
73005152 BH |
87 | /** |
88 | * Sets the active SD view. | |
c8422608 | 89 | * |
73005152 BH |
90 | * @param view The SD view. |
91 | */ | |
92 | public void setView(SDView view) { | |
93 | fView = view; | |
94 | } | |
95 | } |