| 1 | /********************************************************************** |
| 2 | * Copyright (c) 2005, 2012 IBM Corporation, Ericsson |
| 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 |
| 7 | * |
| 8 | * Contributors: |
| 9 | * IBM - Initial API and implementation |
| 10 | * Bernd Hufmann - Updated for TMF |
| 11 | **********************************************************************/ |
| 12 | |
| 13 | package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers; |
| 14 | |
| 15 | import org.eclipse.jface.action.Action; |
| 16 | import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants; |
| 17 | import org.eclipse.linuxtools.internal.tmf.ui.Activator; |
| 18 | import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView; |
| 19 | import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.SDMessages; |
| 20 | |
| 21 | /** |
| 22 | * Action class implementation to move the focus to the next page of the whole sequence diagram. |
| 23 | * |
| 24 | * @version 1.0 |
| 25 | * @author sveyrier |
| 26 | * |
| 27 | */ |
| 28 | public class NextPage extends Action { |
| 29 | |
| 30 | // ------------------------------------------------------------------------ |
| 31 | // Constants |
| 32 | // ------------------------------------------------------------------------ |
| 33 | /** |
| 34 | * The action ID. |
| 35 | */ |
| 36 | public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.nextpage"; //$NON-NLS-1$ |
| 37 | |
| 38 | // ------------------------------------------------------------------------ |
| 39 | // Attributes |
| 40 | // ------------------------------------------------------------------------ |
| 41 | /** |
| 42 | * The sequence diagram view reference. |
| 43 | */ |
| 44 | protected SDView fView = null; |
| 45 | |
| 46 | // ------------------------------------------------------------------------ |
| 47 | // Constructors |
| 48 | // ------------------------------------------------------------------------ |
| 49 | /** |
| 50 | * Default constructor |
| 51 | * |
| 52 | * @param view the view reference |
| 53 | */ |
| 54 | public NextPage(SDView view) { |
| 55 | super(); |
| 56 | fView = view; |
| 57 | setText(SDMessages._36); |
| 58 | setToolTipText(SDMessages._38); |
| 59 | setId(ID); |
| 60 | setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_NEXT_PAGE)); |
| 61 | } |
| 62 | |
| 63 | // ------------------------------------------------------------------------ |
| 64 | // Operations |
| 65 | // ------------------------------------------------------------------------ |
| 66 | /* |
| 67 | * (non-Javadoc) |
| 68 | * @see org.eclipse.jface.action.Action#run() |
| 69 | */ |
| 70 | @Override |
| 71 | public void run() { |
| 72 | if ((fView == null) || (fView.getSDWidget()) == null) { |
| 73 | return; |
| 74 | } |
| 75 | if (fView.getSDPagingProvider() != null) { |
| 76 | fView.getSDPagingProvider().nextPage(); |
| 77 | } |
| 78 | fView.updateCoolBar(); |
| 79 | fView.getSDWidget().redraw(); |
| 80 | } |
| 81 | } |