1 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 ViewToPartActionBarsAdapter implements IPartActionBars { 22 23 private IActionBars parent; 24 private IMenuManager menuBarManager = new NullMenuManager(); 25 private ICoolBarManager cbm; 26 27 public ViewToPartActionBarsAdapter(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 actionId) { 46 return parent.getGlobalActionHandler(actionId); 47 } 48 49 public IMenuManager getPartMenuManager() { 50 return parent.getMenuManager(); 51 } 52 53 public IMenuManager getMenuBarManager() { 54 return menuBarManager; 55 } 56 57 public IToolBarManager getToolBarManager() { 58 return parent.getToolBarManager(); 59 } 60 61 public void setGlobalActionHandler(String actionId, IAction handler) { 62 parent.setGlobalActionHandler(actionId, handler); 63 } 64 65 public void updateActionBars() { 66 parent.updateActionBars(); 67 } 68 69 } 70 | Popular Tags |