| 1 | package de.uka.ipd.sdq.pcm.gmf.toolbar; |
| 2 | |
| 3 | import org.eclipse.jface.action.IAction; |
| 4 | import org.eclipse.ui.IObjectActionDelegate; |
| 5 | |
| 6 | /** |
| 7 | * Baseclass for the inizialize diagram actions. |
| 8 | * A factory method is used to retrieve the init diagram action |
| 9 | * of the appropriate package. |
| 10 | * |
| 11 | * @author Philipp Meier |
| 12 | */ |
| 13 | public abstract class BaseInitializeDiagramAction |
| 14 | extends BaseDiagramAction { |
| 15 | |
| 16 | public void run(final IAction action) { |
| 17 | |
| 18 | IObjectActionDelegate initAction = getInitAction(); |
| 19 | assert (action != null); |
| 20 | |
| 21 | initAction.selectionChanged( |
| 22 | action, |
| 23 | getWindow().getSelectionService().getSelection()); |
| 24 | initAction.setActivePart( |
| 25 | action, |
| 26 | getWindow().getPartService().getActivePart()); |
| 27 | initAction.run(action); |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Template method for the init actin to run. |
| 32 | * @return the init action to run. must not be null |
| 33 | */ |
| 34 | protected abstract IObjectActionDelegate getInitAction(); |
| 35 | } |