Community
Participate
Working Groups
I am involved in the devlopment of an RCP-based application. One of the requirements from our customer was to be able to create a button on the window toolbar that would invoke a user-defined program. The 'External Tools' feature is very close to what the customer desired, however it has no support to assign an icon, and place said icon in the Toolbar for fast access. Rather than re-implementing the LaunchConfiguration mechanisms available in the Debug component of Eclipse, I modified the org.eclipse.debug.ui/ code to support this requirement. Below is a patch against today's (Feb 14, 2006) CVS repository of org.eclipse.debug.ui/ This patch performs the following: * Adds two attributes to a LaunchConfiguration: An Icon, and whether the configuration should be shown in the Toolbar * Modifies the CommonTab to allow the selection of an icon (defaulting to the LaunchConfigurationType's icon) and if the configuration should be shown in the Toolbar * Creates a LaunchBarManager that handles the Toolbar for the DebugUI plugin * Extends the DefaultLabelProvider to supply a per-configuration icon, if one exists. ----------------- PATCH --------------------- Index: ui/org/eclipse/debug/ui/CommonTab.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java,v retrieving revision 1.68 diff -u -r1.68 CommonTab.java --- ui/org/eclipse/debug/ui/CommonTab.java 5 Aug 2005 15:54:58 -0000 1.68 +++ ui/org/eclipse/debug/ui/CommonTab.java 14 Feb 2006 14:58:51 -0000 @@ -25,10 +25,12 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; +import org.eclipse.core.variables.IStringVariableManager; import org.eclipse.core.variables.VariablesPlugin; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.internal.ui.DebugPluginImages; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.IDebugHelpContextIds; import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; @@ -97,6 +99,10 @@ * Check box list for specifying favorites */ private CheckboxTableViewer fFavoritesTable; + + private Button fInToolbar; + private Label fIconNameLabel; + private Button fSelectIconButton; /** * Modify listener that simply updates the owning launch configuration dialog. @@ -128,7 +134,7 @@ Composite comp = new Composite(parent, SWT.NONE); setControl(comp); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_COMMON_TAB); - GridLayout topLayout = new GridLayout(2, true); + GridLayout topLayout = new GridLayout(3, true); topLayout.horizontalSpacing = 10; comp.setLayout(topLayout); comp.setFont(parent.getFont()); @@ -138,7 +144,7 @@ layout.numColumns = 3; group.setLayout(layout); GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; + gd.horizontalSpan = 3; group.setLayoutData(gd); group.setText(LaunchConfigurationsMessages.CommonTab_0); group.setFont(comp.getFont()); @@ -199,6 +205,44 @@ } }); + Group toolGroup = new Group(comp, SWT.NONE); + gd = new GridData(GridData.FILL_BOTH); + toolGroup.setLayoutData(gd); + toolGroup.setLayout(new GridLayout()); + toolGroup.setText(LaunchConfigurationsMessages.CommonTab_Toolbar_1); + toolGroup.setFont(parent.getFont()); + + fInToolbar = createCheckButton(toolGroup, LaunchConfigurationsMessages.CommonTab_Toolbar_2); //$NON-NLS-1$ + fInToolbar.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + updateLaunchConfigurationDialog(); + } + }); + + fSelectIconButton = new Button(toolGroup, SWT.PUSH); + gd = new GridData(); + gd.heightHint = 36; + gd.widthHint = 36; + fSelectIconButton.setLayoutData(gd); + fSelectIconButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + FileDialog fd = new FileDialog(fSelectIconButton.getShell(), SWT.OPEN); + fd.setFilterExtensions(new String[] {"*.ico", "*.jpg", "*.gif", "*.png", "*.bmp"}); + fd.setText("Select an image"); + String res = fd.open(); + if ( res != null ) { + fIconNameLabel.setText(res); + fSelectIconButton.setImage(new Image(fSelectIconButton.getDisplay(), res)); + fIconNameLabel.setText(res); + } + updateLaunchConfigurationDialog(); + } + }); + + fIconNameLabel = new Label(toolGroup, SWT.NONE); + gd = new GridData(GridData.FILL_HORIZONTAL); + fIconNameLabel.setLayoutData(gd); + createEncodingComponent(comp); createOutputCaptureComponent(comp); createLaunchInBackgroundComponent(comp); @@ -210,7 +254,7 @@ Group group = new Group(parent, SWT.NONE); group.setText(LaunchConfigurationsMessages.CommonTab_4); GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false); - gd.horizontalSpan = 2; + gd.horizontalSpan = 3; group.setLayoutData(gd); GridLayout layout = new GridLayout(5, false); group.setLayout(layout); @@ -456,12 +500,41 @@ public void initializeFrom(ILaunchConfiguration configuration) { updateLocalSharedFromConfig(configuration); updateSharedLocationFromConfig(configuration); + updateToolbarFromConfig(configuration); updateFavoritesFromConfig(configuration); updateLaunchInBackground(configuration); updateEncoding(configuration); updateConsoleOutput(configuration); } + private void updateToolbarFromConfig(ILaunchConfiguration config) { + boolean inToolbar = false; + String inToolbarIconPath = null; + Image icon = null; + try { + inToolbar = config.getAttribute(IDebugUIConstants.ATTR_DISPLAY_IN_TOOLBAR, false); + inToolbarIconPath = config.getAttribute(IDebugUIConstants.ATTR_ICON_FILE, (String)null); + + fInToolbar.setSelection(inToolbar); + if ( inToolbarIconPath != null ) { + IStringVariableManager svm = VariablesPlugin.getDefault().getStringVariableManager(); + inToolbarIconPath = svm.performStringSubstitution(inToolbarIconPath, false); + + icon = new Image(fInToolbar.getDisplay(), inToolbarIconPath); + if ( icon == null ) { + icon = ImageDescriptor.getMissingImageDescriptor().createImage(); + } + fIconNameLabel.setText(inToolbarIconPath); + } + if ( icon == null ) { + icon = DebugPluginImages.getImage(config.getType().getIdentifier()); + fIconNameLabel.setText(LaunchConfigurationsMessages.CommonTab_Toolbar_3); + } + fSelectIconButton.setImage(icon); + } catch (CoreException e1) { + } + } + private void updateConsoleOutput(ILaunchConfiguration configuration) { boolean outputToConsole = true; String outputFile = null; @@ -584,6 +657,15 @@ config.setContainer(null); } } + + private void updateConfigFromToolbar(ILaunchConfigurationWorkingCopy config) { + config.setAttribute(IDebugUIConstants.ATTR_DISPLAY_IN_TOOLBAR, fInToolbar.getSelection()); + if ( fIconNameLabel.getText().equals(LaunchConfigurationsMessages.CommonTab_Toolbar_3) ) { + config.setAttribute(IDebugUIConstants.ATTR_ICON_FILE, (String)null); + } else { + config.setAttribute(IDebugUIConstants.ATTR_ICON_FILE, fIconNameLabel.getText()); + } + } /** * Update the favorite settings. @@ -708,6 +790,7 @@ */ public void performApply(ILaunchConfigurationWorkingCopy configuration) { updateConfigFromLocalShared(configuration); + updateConfigFromToolbar(configuration); updateConfigFromFavorites(configuration); setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, configuration, fLaunchInBackgroundButton.getSelection(), true); String encoding = null; Index: ui/org/eclipse/debug/ui/IDebugUIConstants.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java,v retrieving revision 1.159 diff -u -r1.159 IDebugUIConstants.java --- ui/org/eclipse/debug/ui/IDebugUIConstants.java 9 Feb 2006 14:30:01 -0000 1.159 +++ ui/org/eclipse/debug/ui/IDebugUIConstants.java 14 Feb 2006 14:58:52 -0000 @@ -899,6 +899,20 @@ */ public static final String ATTR_APPEND_TO_FILE = PLUGIN_ID + ".ATTR_APPEND_TO_FILE"; //$NON-NLS-1$ + /** + * Launch configuration attribute specifying whether a custom icon will be used to represent + * this configuration. The default icon will be used unless <code>ATTR_ICON_FILE</code> contains + * a valid icon file. Default value is <code>null</code>. + */ + public static final String ATTR_ICON_FILE = PLUGIN_ID + ".ATTR_ICON_FILE"; //$NON-NLS-1$ + + /** + * Launch configuration attribute specifying whether this configuration should be directly accessible + * from the toolbar. Default value is <code>false</code>. + */ + public static final String ATTR_DISPLAY_IN_TOOLBAR = PLUGIN_ID + ".ATTR_DISPLAY_IN_TOOLBAR"; //$NON-NLS-1$ + + // Extension points /** Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties,v retrieving revision 1.136 diff -u -r1.136 LaunchConfigurationsMessages.properties --- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties 27 Jan 2006 15:30:53 -0000 1.136 +++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties 14 Feb 2006 14:58:50 -0000 @@ -18,6 +18,9 @@ CommonTab_S_hared_4=S&hared file: CommonTab_Select_a_location_for_the_launch_configuration_13=Select a location for the launch configuration CommonTab_Cannot_save_launch_configuration_in_a_closed_project__1=Cannot save launch configuration in a closed project. +CommonTab_Toolbar_1=Display in Toolbar +CommonTab_Toolbar_2=&Display in Toolbar +CommonTab_Toolbar_3=Choose Icon CommonTab_10=Launch in bac&kground CommonTab_11=A&ppend CommonTab_12=Browse Worksp&ace... Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java,v retrieving revision 1.23 diff -u -r1.23 LaunchConfigurationsMessages.java --- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java 26 Jan 2006 19:04:52 -0000 1.23 +++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java 14 Feb 2006 14:58:50 -0000 @@ -22,6 +22,9 @@ public static String CommonTab_S_hared_4; public static String CommonTab_Select_a_location_for_the_launch_configuration_13; public static String CommonTab_Cannot_save_launch_configuration_in_a_closed_project__1; + public static String CommonTab_Toolbar_1; + public static String CommonTab_Toolbar_2; + public static String CommonTab_Toolbar_3; public static String CommonTab_10; public static String CommonTab_11; public static String CommonTab_12; Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java,v retrieving revision 1.20 diff -u -r1.20 LaunchConfigurationView.java --- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java 6 Feb 2006 19:36:55 -0000 1.20 +++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java 14 Feb 2006 14:58:50 -0000 @@ -294,6 +294,10 @@ * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse.debug.core.ILaunchConfiguration) */ public void launchConfigurationChanged(ILaunchConfiguration configuration) { + TreeViewer viewer = getTreeViewer(); + if (viewer != null) { + viewer.refresh(configuration, true); + } } /** Index: ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java,v retrieving revision 1.268 diff -u -r1.268 DebugUIPlugin.java --- ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java 9 Feb 2006 18:21:56 -0000 1.268 +++ ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java 14 Feb 2006 14:58:49 -0000 @@ -65,6 +65,7 @@ import org.eclipse.debug.internal.ui.contexts.SuspendTriggerAdapterFactory; import org.eclipse.debug.internal.ui.launchConfigurations.ClosedProjectFilter; import org.eclipse.debug.internal.ui.launchConfigurations.DeletedProjectFilter; +import org.eclipse.debug.internal.ui.launchConfigurations.LaunchBarManager; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTypeFilter; import org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveManager; @@ -169,6 +170,11 @@ */ private StepFilterManager fStepFilterManager = null; + /** + * Toolbar Manager + */ + private LaunchBarManager fLaunchBarManager = null; + /** * Image descriptor registry used for images with common overlays. * @@ -281,6 +287,13 @@ return fLaunchConfigurationManager; } + public LaunchBarManager getLaunchBarManager() { + if (fLaunchBarManager == null) { + fLaunchBarManager = new LaunchBarManager(); + } + return fLaunchBarManager; + } + /** * Returns the currently active workbench window or <code>null</code> * if none. @@ -368,6 +381,9 @@ if (fLaunchConfigurationManager != null) { fLaunchConfigurationManager.shutdown(); } + if (fLaunchBarManager != null) { + fLaunchBarManager.shutdown(); + } if (fStepFilterManager != null) { fStepFilterManager.shutdown(); @@ -405,6 +421,8 @@ // and be the first debug event listener fPerspectiveManager = new PerspectiveManager(); fPerspectiveManager.startup(); + + getLaunchBarManager().startup(); // Listen to launches to lazily create "launch processors" DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this); Index: ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java,v retrieving revision 1.44 diff -u -r1.44 DefaultLabelProvider.java --- ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java 9 Feb 2006 18:22:31 -0000 1.44 +++ ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java 14 Feb 2006 14:58:50 -0000 @@ -18,6 +18,8 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.variables.IStringVariableManager; +import org.eclipse.core.variables.VariablesPlugin; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; @@ -68,6 +70,27 @@ } return null; } + if ( element instanceof ILaunchConfiguration ) { + ILaunchConfiguration configuration = (ILaunchConfiguration)element; + try { + Image icon = null; + String iconPath = configuration.getAttribute(IDebugUIConstants.ATTR_ICON_FILE, (String)null); + + if ( iconPath != null ) { + IStringVariableManager svm = VariablesPlugin.getDefault().getStringVariableManager(); + iconPath = svm.performStringSubstitution(iconPath, false); + + icon = new Image(DebugUIPlugin.getStandardDisplay(), iconPath); + if ( icon == null ) { + icon = ImageDescriptor.getMissingImageDescriptor().createImage(); + } + } + if ( icon != null ) + return icon; + } catch (CoreException e) { + } + } + return DebugPluginImages.getImage(key); } Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchBarManager.java =================================================================== RCS file: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchBarManager.java diff -N ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchBarManager.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchBarManager.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,240 @@ +package org.eclipse.debug.internal.ui.launchConfigurations; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.variables.IStringVariableManager; +import org.eclipse.core.variables.VariablesPlugin; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationListener; +import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.debug.internal.ui.DebugPluginImages; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.CoolBarManager; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.ToolBarContributionItem; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.window.ApplicationWindow; +import org.eclipse.swt.widgets.CoolBar; +import org.eclipse.swt.widgets.CoolItem; +import org.eclipse.ui.IWindowListener; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +public class LaunchBarManager implements IWindowListener, ILaunchConfigurationListener { + + private class BarManager { + public IToolBarManager toolbarManager; + public CoolBarManager coolbarManager; + + public BarManager(IToolBarManager tb, CoolBarManager cb) { + toolbarManager = tb; + coolbarManager = cb; + } + + public void update() { + toolbarManager.update(true); + coolbarManager.update(true); + } + } + + private Map barManagerMap = new HashMap(); // Window -> BarManager + + public LaunchBarManager() { + } + + public void startup() { + PlatformUI.getWorkbench().addWindowListener(this); + DebugPlugin.getDefault().getLaunchManager().addLaunchConfigurationListener(this); + } + + public void shutdown() { + PlatformUI.getWorkbench().removeWindowListener(this); + DebugPlugin.getDefault().getLaunchManager().removeLaunchConfigurationListener(this); + } + + + public void windowActivated(IWorkbenchWindow window) { + } + + public void windowDeactivated(IWorkbenchWindow window) { + } + + public void windowClosed(IWorkbenchWindow window) { + barManagerMap.remove(window); + } + + public void windowOpened(IWorkbenchWindow window) { + if ( addWindowToMap(window) ) { + addToWindow(window); + } + } + + + private void addToWindow(IWorkbenchWindow window) { + try { + BarManager bm = (BarManager)barManagerMap.get(window); + if ( bm == null ) return; + + ILaunchConfiguration configs[] = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(); + for ( int i = 0 ; i < configs.length ; i++ ) { + conditionallyAddToBar(configs[i], bm); + } + + } catch (CoreException e) { + } + } + + private void conditionallyAddToBar(ILaunchConfiguration config, BarManager bm) throws CoreException { + boolean inBar = config.getAttribute(IDebugUIConstants.ATTR_DISPLAY_IN_TOOLBAR, false); + if ( inBar ) { + addToBar(config, bm); + } + } + + private void addToBar(ILaunchConfiguration config, BarManager bm) throws CoreException { + IAction configAction = createBarAction(config); + String myID = createIDFromConfig(config); + if ( bm.toolbarManager.find(createIDFromConfig(config)) == null ) { + IContributionItem items[] = bm.toolbarManager.getItems(); + String itemID; + boolean inserted = false; + for ( int i = 0 ; i < items.length ; i++ ) { + itemID = items[i].getId(); + + if ( myID.compareTo(itemID) < 0 ) { + bm.toolbarManager.insertBefore(itemID, configAction); + inserted = true; + break; + } + } + if ( !inserted ) { + bm.toolbarManager.add(configAction); + } + bm.update(); + } + } + + + private void removeFromBar(ILaunchConfiguration config, BarManager bm) { + bm.toolbarManager.remove(createIDFromConfig(config)); + bm.update(); + } + + private String createIDFromConfig(ILaunchConfiguration config) { + String id = config.getLocation().toPortableString(); + return id; + } + + private IAction createBarAction(final ILaunchConfiguration config) throws CoreException { + IAction act = new Action() { + public void run() { + DebugUITools.launch(config, ILaunchManager.RUN_MODE); + } + }; + act.setId(createIDFromConfig(config)); + act.setToolTipText(config.getName()); + act.setEnabled(true); + act.setText(config.getName()); + act.setImageDescriptor( getImageDescriptorFromConfig(config)); + + return act; + } + + private ImageDescriptor getImageDescriptorFromConfig(ILaunchConfiguration config) throws CoreException { + ImageDescriptor id = ImageDescriptor.getMissingImageDescriptor(); + String filename = config.getAttribute(IDebugUIConstants.ATTR_ICON_FILE, (String)null); + + if ( filename != null ) { + IStringVariableManager svm = VariablesPlugin.getDefault().getStringVariableManager(); + filename = svm.performStringSubstitution(filename, false); + + try { + File file = new File(filename); + URL url = file.toURL(); + id = ImageDescriptor.createFromURL(url); + } catch (MalformedURLException e) {} + } else { + id = DebugPluginImages.getImageDescriptor(config.getType().getIdentifier()); + } + return id; + } + + private boolean addWindowToMap(IWorkbenchWindow window) { + boolean added = false; + if ( window instanceof ApplicationWindow ) { + ApplicationWindow win = (ApplicationWindow)window; + + IToolBarManager tbm = null; + CoolBarManager cbm = win.getCoolBarManager(); + if ( cbm != null ) { + // Grab all the items in the CoolBar + CoolBar cb = cbm.getControl(); + CoolItem[] items = cb.getItems(); + // Find the CoolItem that matches the ToolBar we are looking for + for ( int i = 0 ; i < items.length ; i++ ) { + CoolItem ci = items[i]; + Object data = ci.getData(); + // Make sure it's a Toolbar type contribution + if ( data instanceof ToolBarContributionItem ) { + ToolBarContributionItem tbci = (ToolBarContributionItem)data; + if ( tbci.getId().equals("org.eclipse.debug.ui.launchActionSet") ) { + // Get *THIS* toobar manager + tbm = tbci.getToolBarManager(); + break; + } + } + } + } + if ( cbm != null && tbm != null ) { + BarManager bm = new BarManager(tbm, cbm); + barManagerMap.put(window, bm); + added = true; + } + } + return added; + } + + + + public void launchConfigurationAdded(ILaunchConfiguration configuration) { + Iterator i = barManagerMap.values().iterator(); + while ( i.hasNext() ) { + try { + conditionallyAddToBar(configuration, (BarManager)i.next()); + } catch (CoreException e) {} + } + } + + public void launchConfigurationChanged(ILaunchConfiguration configuration) { + if ( !configuration.isWorkingCopy() ) { + Iterator i = barManagerMap.values().iterator(); + while ( i.hasNext() ) { + BarManager bm = (BarManager)i.next(); + try { + removeFromBar(configuration, bm); + conditionallyAddToBar(configuration, bm); + } catch (CoreException e) {} + } + } + } + + public void launchConfigurationRemoved(ILaunchConfiguration configuration) { + Iterator i = barManagerMap.values().iterator(); + while ( i.hasNext() ) { + removeFromBar(configuration, (BarManager)i.next()); + } + } + + +}
Created attachment 34697 [details] Patch to implement enhancement request The file version of the patch in the initial comments.
This is a dup of the request in 51003, but also provdes a nice patch. The patch does not address the issue of what launch mode to use when the launch button is invoked, but is a good example of how the toolbar launch button could be supported. Thanks for the patch. *** This bug has been marked as a duplicate of 51003 ***