Commit | Line | Data |
---|---|---|
73005152 BH |
1 | /********************************************************************** |
2 | * Copyright (c) 2005, 2006, 2011 IBM Corporation and others. | |
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 | |
7 | * $Id: MoveSDRight.java,v 1.2 2006/09/20 20:56:26 ewchan Exp $ | |
8 | * | |
9 | * Contributors: | |
10 | * IBM - Initial API and implementation | |
11 | * Bernd Hufmann - Updated for TMF | |
12 | **********************************************************************/ | |
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 | /** | |
20 | * @author sveyrier | |
21 | * | |
22 | */ | |
23 | ||
24 | public class MoveSDRight extends Action { | |
25 | ||
26 | // ------------------------------------------------------------------------ | |
27 | // Attributes | |
28 | // ------------------------------------------------------------------------ | |
29 | public final static String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.MoveSDRight"; //$NON-NLS-1$ | |
30 | ||
31 | protected SDView fView = null; | |
32 | ||
33 | // ------------------------------------------------------------------------ | |
34 | // Constructors | |
35 | // ------------------------------------------------------------------------ | |
36 | public MoveSDRight() { | |
37 | this(null); | |
38 | } | |
39 | ||
40 | public MoveSDRight(SDView view) { | |
41 | super(); | |
42 | setId(ID); | |
43 | setActionDefinitionId(ID); | |
44 | fView = view; | |
45 | } | |
46 | ||
47 | // ------------------------------------------------------------------------ | |
48 | // Operations | |
49 | // ------------------------------------------------------------------------ | |
50 | /* | |
51 | * (non-Javadoc) | |
52 | * @see org.eclipse.jface.action.Action#run() | |
53 | */ | |
54 | @Override | |
55 | public void run() { | |
56 | ||
57 | if (fView == null) { | |
58 | return; | |
59 | } | |
60 | ||
61 | SDWidget viewer = fView.getSDWidget(); | |
62 | if (viewer != null) | |
63 | viewer.scrollBy(+viewer.getVisibleWidth(), 0); | |
64 | } | |
65 | ||
66 | /** | |
67 | * Sets the active SD view. | |
68 | * @param view The SD view. | |
69 | */ | |
70 | public void setView(SDView view) { | |
71 | fView = view; | |
72 | } | |
73 | } |