1 /******************************************************************************* 2 * Copyright (c) 2000, 2015 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.ui.internal; 15 16 import org.eclipse.core.runtime.Assert; 17 import org.eclipse.jface.action.IAction; 18 import org.eclipse.jface.action.ICoolBarManager; 19 import org.eclipse.jface.action.IMenuManager; 20 import org.eclipse.jface.action.IStatusLineManager; 21 import org.eclipse.jface.action.IToolBarManager; 22 import org.eclipse.ui.IActionBars2; 23 import org.eclipse.ui.IWorkbenchActionConstants; 24 import org.eclipse.ui.services.IServiceLocator; 25 26 public class WWinActionBars implements IActionBars2 { 27 private WorkbenchWindow window; 28 29 /** 30 * PerspActionBars constructor comment. 31 */ WWinActionBars(WorkbenchWindow window)32 public WWinActionBars(WorkbenchWindow window) { 33 super(); 34 this.window = window; 35 } 36 37 /** 38 * Clears the global action handler list. 39 */ 40 @Override clearGlobalActionHandlers()41 public void clearGlobalActionHandlers() { 42 } 43 44 /** 45 * Returns the cool bar manager. 46 * 47 */ 48 @Override getCoolBarManager()49 public ICoolBarManager getCoolBarManager() { 50 return window.getCoolBarManager2(); 51 } 52 53 /** 54 * Get the handler for a window action. 55 * 56 * @param actionID an action ID declared in the registry 57 * @return an action handler which implements the action ID, or 58 * <code>null</code> if none is registered. 59 */ 60 @Override getGlobalActionHandler(String actionID)61 public IAction getGlobalActionHandler(String actionID) { 62 return null; 63 } 64 65 /** 66 * Returns the menu manager. If items are added or removed from the manager be 67 * sure to call <code>updateActionBars</code>. 68 * 69 * @return the menu manager 70 */ 71 @Override getMenuManager()72 public IMenuManager getMenuManager() { 73 return window.getMenuManager(); 74 } 75 76 @Override getServiceLocator()77 public final IServiceLocator getServiceLocator() { 78 return window; 79 } 80 81 /** 82 * Returns the status line manager. If items are added or removed from the 83 * manager be sure to call <code>updateActionBars</code>. 84 * 85 * @return the status line manager 86 */ 87 @Override getStatusLineManager()88 public IStatusLineManager getStatusLineManager() { 89 return window.getStatusLineManager(); 90 } 91 92 /** 93 * Returns the tool bar manager. 94 * 95 */ 96 @Override getToolBarManager()97 public IToolBarManager getToolBarManager() { 98 // This should never be called 99 Assert.isTrue(false); 100 return null; 101 } 102 103 /** 104 * Add a handler for a window action. 105 * 106 * The standard action ID's for the workbench are defined in 107 * <code>IWorkbenchActionConstants</code>. 108 * 109 * @see IWorkbenchActionConstants 110 * 111 * @param actionID an action ID declared in the registry 112 * @param handler an action which implements the action ID. <code>null</code> 113 * may be passed to deregister a handler. 114 */ 115 @Override setGlobalActionHandler(String actionID, IAction handler)116 public void setGlobalActionHandler(String actionID, IAction handler) { 117 } 118 119 /** 120 * Commits all UI changes. This should be called after additions or subtractions 121 * have been made to a menu, status line, or toolbar. 122 */ 123 @Override updateActionBars()124 public void updateActionBars() { 125 window.updateActionBars(); 126 } 127 } 128