KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > part > services > EditorToPartActionBarsAdapter


1 /*******************************************************************************
2  * Copyright (c) 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.part.services;
12
13 import org.eclipse.jface.action.IAction;
14 import org.eclipse.jface.action.ICoolBarManager;
15 import org.eclipse.jface.action.IMenuManager;
16 import org.eclipse.jface.action.IToolBarManager;
17 import org.eclipse.ui.IActionBars;
18 import org.eclipse.ui.IActionBars2;
19 import org.eclipse.ui.internal.part.components.services.IPartActionBars;
20
21 public class EditorToPartActionBarsAdapter implements IPartActionBars {
22
23     private IActionBars parent;
24     private IMenuManager partMenuManager = new NullMenuManager();
25     private ICoolBarManager cbm;
26     
27     public EditorToPartActionBarsAdapter(IActionBars parent) {
28         this.parent = parent;
29         
30         if (parent instanceof IActionBars2) {
31             cbm = ((IActionBars2)parent).getCoolBarManager();
32         } else {
33             cbm = new NullCoolBarManager();
34         }
35     }
36     
37     public ICoolBarManager getCoolBarManager() {
38         return cbm;
39     }
40     
41     public void clearGlobalActionHandlers() {
42         parent.clearGlobalActionHandlers();
43     }
44
45     public IAction getGlobalActionHandler(String JavaDoc actionId) {
46         return parent.getGlobalActionHandler(actionId);
47     }
48
49     public IMenuManager getMenuBarManager() {
50         return parent.getMenuManager();
51     }
52
53     public IMenuManager getPartMenuManager() {
54         return partMenuManager;
55     }
56
57     public IToolBarManager getToolBarManager() {
58         return parent.getToolBarManager();
59     }
60
61     public void setGlobalActionHandler(String JavaDoc actionId, IAction handler) {
62         parent.setGlobalActionHandler(actionId, handler);
63     }
64
65     public void updateActionBars() {
66         parent.updateActionBars();
67     }
68 }
69
Popular Tags