Commit | Line | Data |
---|---|---|
73005152 | 1 | /********************************************************************** |
df0b8ff4 | 2 | * Copyright (c) 2011, 2012 Ericsson |
73005152 BH |
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 | 15 | import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants; |
8fd82db5 | 16 | import org.eclipse.linuxtools.internal.tmf.ui.Activator; |
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 | /** | |
df0b8ff4 BH |
21 | * Action class implementation to move the focus to the first page of the whole sequence diagram. |
22 | * | |
23 | * @version 1.0 | |
24 | * @author Bernd Hufmann | |
73005152 BH |
25 | */ |
26 | public class FirstPage extends Action { | |
27 | ||
28 | // ------------------------------------------------------------------------ | |
df0b8ff4 | 29 | // Constants |
73005152 | 30 | // ------------------------------------------------------------------------ |
df0b8ff4 BH |
31 | /** |
32 | * The action ID. | |
33 | */ | |
73005152 | 34 | public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.firstpage"; //$NON-NLS-1$ |
df0b8ff4 BH |
35 | |
36 | // ------------------------------------------------------------------------ | |
37 | // Attributes | |
38 | // ------------------------------------------------------------------------ | |
39 | /** | |
40 | * The sequence diagram view reference | |
41 | */ | |
73005152 BH |
42 | protected SDView fView = null; |
43 | ||
44 | // ------------------------------------------------------------------------ | |
45 | // Constructors | |
46 | // ------------------------------------------------------------------------ | |
df0b8ff4 BH |
47 | /** |
48 | * Default constructor | |
49 | * | |
eb63f5ff | 50 | * @param view the view reference |
df0b8ff4 | 51 | */ |
eb63f5ff | 52 | public FirstPage(SDView view) { |
73005152 | 53 | super(); |
eb63f5ff | 54 | fView = view; |
73005152 BH |
55 | setText(SDMessages._139); |
56 | setToolTipText(SDMessages._140); | |
57 | setId(ID); | |
8fd82db5 | 58 | setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_FIRST_PAGE)); |
73005152 BH |
59 | } |
60 | ||
61 | // ------------------------------------------------------------------------ | |
df0b8ff4 | 62 | // Methods |
73005152 BH |
63 | // ------------------------------------------------------------------------ |
64 | /* | |
65 | * (non-Javadoc) | |
66 | * @see org.eclipse.jface.action.Action#run() | |
67 | */ | |
68 | @Override | |
69 | public void run() { | |
70 | if ((fView == null) || (fView.getSDWidget()) == null) { | |
71 | return; | |
72 | } | |
73 | if (fView.getSDPagingProvider() != null) { | |
74 | fView.getSDPagingProvider().firstPage(); | |
75 | } | |
76 | fView.updateCoolBar(); | |
77 | fView.getSDWidget().redraw(); | |
78 | } | |
79 | } |