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