| 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.tmf.ui.views.uml2sd.SDView; |
| 17 | |
| 18 | /** |
| 19 | * Action class implementation for 'Printing'. |
| 20 | * |
| 21 | * @version 1.0 |
| 22 | * @author sveyrier |
| 23 | */ |
| 24 | public class Print extends Action { |
| 25 | |
| 26 | // ------------------------------------------------------------------------ |
| 27 | // Constants |
| 28 | // ------------------------------------------------------------------------ |
| 29 | /** |
| 30 | * The action ID. |
| 31 | */ |
| 32 | public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.print"; //$NON-NLS-1$ |
| 33 | |
| 34 | // ------------------------------------------------------------------------ |
| 35 | // Attributes |
| 36 | // ------------------------------------------------------------------------ |
| 37 | /** |
| 38 | * The sequence diagram view reference |
| 39 | */ |
| 40 | private SDView fView; |
| 41 | |
| 42 | // ------------------------------------------------------------------------ |
| 43 | // Constructors |
| 44 | // ------------------------------------------------------------------------ |
| 45 | /** |
| 46 | * Constructor |
| 47 | * |
| 48 | * @param view The view reference |
| 49 | */ |
| 50 | public Print(SDView view) { |
| 51 | super(); |
| 52 | setId(ID); |
| 53 | fView = view; |
| 54 | } |
| 55 | |
| 56 | // ------------------------------------------------------------------------ |
| 57 | // Methods |
| 58 | // ------------------------------------------------------------------------ |
| 59 | /* |
| 60 | * (non-Javadoc) |
| 61 | * @see org.eclipse.jface.action.Action#run() |
| 62 | */ |
| 63 | @Override |
| 64 | public void run() { |
| 65 | if ((fView == null) || fView.getSDWidget() == null){ |
| 66 | return; |
| 67 | } |
| 68 | |
| 69 | fView.getSDWidget().print(); |
| 70 | } |
| 71 | } |