3446c939da63568b9befe7dbd73cca13b2d76a20
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / handlers / FirstPage.java
1 /**********************************************************************
2 * Copyright (c) 2011, 2013 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;
15 import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
16 import org.eclipse.linuxtools.internal.tmf.ui.Activator;
17 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
18 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.Messages;
19
20 /**
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
25 */
26 public class FirstPage extends Action {
27
28 // ------------------------------------------------------------------------
29 // Constants
30 // ------------------------------------------------------------------------
31
32 /**
33 * The action ID.
34 */
35 public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.firstpage"; //$NON-NLS-1$
36
37 // ------------------------------------------------------------------------
38 // Attributes
39 // ------------------------------------------------------------------------
40
41 /**
42 * The sequence diagram view reference
43 */
44 protected SDView fView = null;
45
46 // ------------------------------------------------------------------------
47 // Constructors
48 // ------------------------------------------------------------------------
49
50 /**
51 * Default constructor
52 *
53 * @param view the view reference
54 */
55 public FirstPage(SDView view) {
56 super();
57 fView = view;
58 setText(Messages.SequenceDiagram_FirstPage);
59 setToolTipText(Messages.SequenceDiagram_GoToFirstPage);
60 setId(ID);
61 setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_FIRST_PAGE));
62 }
63
64 // ------------------------------------------------------------------------
65 // Methods
66 // ------------------------------------------------------------------------
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 }
This page took 0.033031 seconds and 4 git commands to generate.