Commit | Line | Data |
---|---|---|
73005152 BH |
1 | /********************************************************************** |
2 | * Copyright (c) 2011 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Bernd Hufmann - Initial API and implementation | |
11 | **********************************************************************/ | |
12 | package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers; | |
13 | ||
14 | import org.eclipse.jface.action.Action; | |
d34665f9 FC |
15 | import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants; |
16 | import org.eclipse.linuxtools.internal.tmf.ui.TmfUiPlugin; | |
73005152 BH |
17 | import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView; |
18 | import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.SDMessages; | |
19 | ||
20 | /** | |
21 | * Moves the focus on the last page in the sequence diagram view. | |
22 | */ | |
23 | public class LastPage extends Action { | |
24 | ||
25 | // ------------------------------------------------------------------------ | |
26 | // Attributes | |
27 | // ------------------------------------------------------------------------ | |
28 | public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.lastpage"; //$NON-NLS-1$ | |
29 | ||
30 | protected SDView fView = null; | |
31 | ||
32 | // ------------------------------------------------------------------------ | |
33 | // Constructors | |
34 | // ------------------------------------------------------------------------ | |
35 | public LastPage(SDView theView) { | |
36 | super(); | |
37 | fView = theView; | |
38 | setText(SDMessages._141); | |
39 | setToolTipText(SDMessages._142); | |
40 | setId(ID); | |
41 | setImageDescriptor(TmfUiPlugin.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_LAST_PAGE)); | |
42 | } | |
43 | ||
44 | // ------------------------------------------------------------------------ | |
45 | // Operations | |
46 | // ------------------------------------------------------------------------ | |
47 | /* | |
48 | * (non-Javadoc) | |
49 | * @see org.eclipse.jface.action.Action#run() | |
50 | */ | |
51 | @Override | |
52 | public void run() { | |
53 | if ((fView == null) || (fView.getSDWidget()) == null) { | |
54 | return; | |
55 | } | |
56 | if (fView.getSDPagingProvider() != null) { | |
57 | fView.getSDPagingProvider().lastPage(); | |
58 | } | |
59 | fView.updateCoolBar(); | |
60 | fView.getSDWidget().redraw(); | |
61 | } | |
62 | } |