Commit | Line | Data |
---|---|---|
73005152 | 1 | /********************************************************************** |
df0b8ff4 BH |
2 | * Copyright (c) 2005, 2008 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; | |
d34665f9 | 17 | import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants; |
8fd82db5 | 18 | import org.eclipse.linuxtools.internal.tmf.ui.Activator; |
73005152 BH |
19 | import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView; |
20 | import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.SDMessages; | |
21 | ||
22 | /** | |
df0b8ff4 BH |
23 | * Action class implementation to move the focus to the previous page of the whole sequence diagram. |
24 | * | |
25 | * @version 1.0 | |
73005152 BH |
26 | * @author sveyrier |
27 | * | |
28 | */ | |
29 | public class PrevPage extends Action { | |
30 | ||
31 | // ------------------------------------------------------------------------ | |
df0b8ff4 | 32 | // Constants |
73005152 | 33 | // ------------------------------------------------------------------------ |
df0b8ff4 BH |
34 | |
35 | /** | |
36 | * The action ID. | |
37 | */ | |
73005152 BH |
38 | public final static String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.prevpage"; //$NON-NLS-1$ |
39 | ||
df0b8ff4 BH |
40 | // ------------------------------------------------------------------------ |
41 | // Attributes | |
42 | // ------------------------------------------------------------------------ | |
43 | ||
44 | /** | |
45 | * The sequence diagram view reference. | |
46 | */ | |
eb63f5ff | 47 | protected SDView fView = null; |
73005152 BH |
48 | |
49 | // ------------------------------------------------------------------------ | |
50 | // Constructors | |
51 | // ------------------------------------------------------------------------ | |
df0b8ff4 BH |
52 | |
53 | /** | |
54 | * Default constructor | |
55 | * | |
eb63f5ff | 56 | * @param view the view reference |
df0b8ff4 | 57 | */ |
eb63f5ff | 58 | public PrevPage(SDView view) { |
73005152 | 59 | super(); |
eb63f5ff | 60 | fView = view; |
73005152 BH |
61 | setText(SDMessages._35); |
62 | setToolTipText(SDMessages._37); | |
63 | setId(ID); | |
8fd82db5 | 64 | setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_PREV_PAGE)); |
73005152 BH |
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() { | |
eb63f5ff | 76 | if ((fView == null) || (fView.getSDWidget()) == null) { |
73005152 BH |
77 | return; |
78 | } | |
eb63f5ff BH |
79 | if (fView.getSDPagingProvider() != null) { |
80 | fView.getSDPagingProvider().prevPage(); | |
73005152 | 81 | } |
eb63f5ff BH |
82 | fView.updateCoolBar(); |
83 | fView.getSDWidget().redraw(); | |
73005152 BH |
84 | } |
85 | } |