1 | /* |
2 | *Copyright 2007, IPD, SDQ, University of Karlsruhe |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.repository.part; |
5 | |
6 | import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramActionBarContributor; |
7 | import org.eclipse.gmf.runtime.diagram.ui.printing.render.actions.EnhancedPrintActionHelper; |
8 | import org.eclipse.gmf.runtime.diagram.ui.printing.render.actions.RenderedPrintPreviewAction; |
9 | import org.eclipse.jface.action.GroupMarker; |
10 | import org.eclipse.jface.action.IAction; |
11 | import org.eclipse.jface.action.IMenuManager; |
12 | import org.eclipse.ui.IActionBars; |
13 | import org.eclipse.ui.IWorkbenchActionConstants; |
14 | import org.eclipse.ui.IWorkbenchPage; |
15 | |
16 | /** |
17 | * @generated |
18 | */ |
19 | public class PalladioComponentModelDiagramActionBarContributor extends |
20 | DiagramActionBarContributor { |
21 | |
22 | /** |
23 | * @generated |
24 | */ |
25 | protected Class getEditorClass() { |
26 | return PalladioComponentModelRepositoryDiagramEditor.class; |
27 | } |
28 | |
29 | /** |
30 | * @generated |
31 | */ |
32 | protected String getEditorId() { |
33 | return PalladioComponentModelRepositoryDiagramEditor.ID; |
34 | } |
35 | |
36 | /** |
37 | * @generated |
38 | */ |
39 | public void init(IActionBars bars, IWorkbenchPage page) { |
40 | super.init(bars, page); |
41 | // print preview |
42 | IMenuManager fileMenu = bars.getMenuManager().findMenuUsingPath( |
43 | IWorkbenchActionConstants.M_FILE); |
44 | assert fileMenu != null; |
45 | IAction printPreviewAction = new RenderedPrintPreviewAction( |
46 | new EnhancedPrintActionHelper()); |
47 | fileMenu.insertBefore("print", printPreviewAction); //$NON-NLS-1$ |
48 | IMenuManager editMenu = bars.getMenuManager().findMenuUsingPath( |
49 | IWorkbenchActionConstants.M_EDIT); |
50 | assert editMenu != null; |
51 | if (editMenu.find("validationGroup") == null) { //$NON-NLS-1$ |
52 | editMenu.add(new GroupMarker("validationGroup")); //$NON-NLS-1$ |
53 | } |
54 | IAction validateAction = new ValidateAction(page); |
55 | editMenu.appendToGroup("validationGroup", validateAction); //$NON-NLS-1$ |
56 | } |
57 | } |