| 1 | /********************************************************************** |
| 2 | * Copyright (c) 2013, 2014 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 | * Bernd Hufmann - Initial API and implementation |
| 10 | **********************************************************************/ |
| 11 | package org.eclipse.tracecompass.tmf.ui.views.uml2sd.handlers; |
| 12 | |
| 13 | import org.eclipse.jface.action.Action; |
| 14 | import org.eclipse.tracecompass.tmf.ui.views.uml2sd.SDView; |
| 15 | |
| 16 | /** |
| 17 | * Base class for sequence diagram actions. |
| 18 | * |
| 19 | * @author Bernd Hufmann |
| 20 | */ |
| 21 | public class BaseSDAction extends Action { |
| 22 | |
| 23 | // ------------------------------------------------------------------------ |
| 24 | // Attributes |
| 25 | // ------------------------------------------------------------------------ |
| 26 | /** |
| 27 | * The sequence diagram view reference. |
| 28 | */ |
| 29 | private SDView fView = null; |
| 30 | |
| 31 | // ------------------------------------------------------------------------ |
| 32 | // Constructors |
| 33 | // ------------------------------------------------------------------------ |
| 34 | /** |
| 35 | * Default constructor |
| 36 | */ |
| 37 | public BaseSDAction() { |
| 38 | this(null); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Constructor |
| 43 | * |
| 44 | * @param view |
| 45 | * a sequence diagram view reference |
| 46 | */ |
| 47 | public BaseSDAction(SDView view) { |
| 48 | super(); |
| 49 | fView = view; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Constructor |
| 54 | * @param view |
| 55 | * a sequence diagram view reference |
| 56 | * @param text |
| 57 | * The action text |
| 58 | * @param style |
| 59 | * The style |
| 60 | */ |
| 61 | protected BaseSDAction(SDView view, String text, int style) { |
| 62 | super(text, style); |
| 63 | fView = view; |
| 64 | } |
| 65 | |
| 66 | // ------------------------------------------------------------------------ |
| 67 | // Operations |
| 68 | // ------------------------------------------------------------------------ |
| 69 | |
| 70 | /** |
| 71 | * Sets the active SD view. |
| 72 | * |
| 73 | * @param view The SD view. |
| 74 | */ |
| 75 | public void setView(SDView view) { |
| 76 | fView = view; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Gets the active SD view. |
| 81 | * |
| 82 | * @return view The SD view. |
| 83 | */ |
| 84 | public SDView getView() { |
| 85 | return fView; |
| 86 | } |
| 87 | } |