1 11 package org.eclipse.ui.internal; 12 13 import java.util.ArrayList ; 14 import java.util.Iterator ; 15 16 import org.eclipse.core.runtime.IConfigurationElement; 17 import org.eclipse.jface.action.IAction; 18 import org.eclipse.ui.IActionBars; 19 import org.eclipse.ui.IWorkbenchWindow; 20 import org.eclipse.ui.internal.registry.ActionSetDescriptor; 21 import org.eclipse.ui.internal.registry.IActionSet; 22 23 28 public class PluginActionSet implements IActionSet { 29 private ActionSetDescriptor desc; 30 31 private ArrayList pluginActions = new ArrayList (4); 32 33 private ActionSetActionBars bars; 34 35 40 public PluginActionSet(ActionSetDescriptor desc) { 41 super(); 42 this.desc = desc; 43 } 44 45 50 public void addPluginAction(WWinPluginAction action) { 51 pluginActions.add(action); 52 } 53 54 59 public IAction[] getPluginActions() { 60 IAction result[] = new IAction[pluginActions.size()]; 61 pluginActions.toArray(result); 62 return result; 63 } 64 65 68 public void dispose() { 69 Iterator iter = pluginActions.iterator(); 70 while (iter.hasNext()) { 71 WWinPluginAction action = (WWinPluginAction) iter.next(); 72 action.dispose(); 73 } 74 pluginActions.clear(); 75 bars = null; 76 } 77 78 80 ActionSetActionBars getBars() { 81 return bars; 82 } 83 84 89 public IConfigurationElement getConfigElement() { 90 return desc.getConfigurationElement(); 91 } 92 93 98 public ActionSetDescriptor getDesc() { 99 return desc; 100 } 101 102 109 public void init(IWorkbenchWindow window, IActionBars bars) { 110 this.bars = (ActionSetActionBars) bars; 111 } 112 } 113 | Popular Tags |