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