1 | package de.uka.ipd.sdq.pcm.gmf.toolbar; |
2 | |
3 | import org.eclipse.jface.action.IAction; |
4 | import org.eclipse.jface.viewers.StructuredSelection; |
5 | import org.eclipse.jface.wizard.WizardDialog; |
6 | import org.eclipse.ui.INewWizard; |
7 | |
8 | /** |
9 | * Baseclass for the new diagram actions. |
10 | * A factory method is used to retrieve the new wizard |
11 | * of the appropriate package. |
12 | * |
13 | * @author Philipp Meier |
14 | */ |
15 | public abstract class BaseNewDiagramAction |
16 | extends BaseDiagramAction { |
17 | |
18 | public void run(final IAction action) { |
19 | INewWizard wizard = getNewWizard(); |
20 | assert (wizard != null); |
21 | |
22 | wizard.init( |
23 | getWindow().getWorkbench(), |
24 | new StructuredSelection()); |
25 | |
26 | WizardDialog dialog = new WizardDialog( |
27 | getWindow().getShell(), |
28 | wizard); |
29 | dialog.open(); |
30 | } |
31 | |
32 | /** |
33 | * Template method for the new wizard to open. |
34 | * @return the new wizard to open. must not be null |
35 | */ |
36 | protected abstract INewWizard getNewWizard(); |
37 | } |