1 11 package org.eclipse.debug.internal.ui.launchConfigurations; 12 13 import java.util.ArrayList ; 14 import java.util.Iterator ; 15 import java.util.List ; 16 import java.util.Set ; 17 18 import org.eclipse.core.runtime.CoreException; 19 import org.eclipse.debug.core.ILaunchConfiguration; 20 import org.eclipse.debug.internal.ui.IDebugHelpContextIds; 21 import org.eclipse.debug.ui.IDebugUIConstants; 22 import org.eclipse.jface.viewers.IBaseLabelProvider; 23 import org.eclipse.jface.viewers.ILabelProvider; 24 import org.eclipse.jface.viewers.ILabelProviderListener; 25 import org.eclipse.swt.SWT; 26 import org.eclipse.swt.graphics.Image; 27 import org.eclipse.swt.widgets.Shell; 28 29 37 public class SelectLaunchModesDialog extends AbstractDebugListSelectionDialog{ 38 39 42 class OptionsLabelProvider implements ILabelProvider { 43 public Image getImage(Object element) {return null;} 44 public String getText(Object element) { 45 Set modes = (Set ) element; 46 List names = LaunchConfigurationPresentationManager.getDefault().getLaunchModeNames(modes); 47 return names.toString(); 48 } 49 public void addListener(ILabelProviderListener listener) {} 50 public void dispose() {} 51 public boolean isLabelProperty(Object element, String property) {return false;} 52 public void removeListener(ILabelProviderListener listener) {} 53 } 54 55 private List fValidModes = null; 56 57 65 public SelectLaunchModesDialog(Shell parentShell, String mode, ILaunchConfiguration configuration) throws CoreException { 66 super(parentShell); 67 super.setTitle(LaunchConfigurationsMessages.SelectLaunchOptionsDialog_3); 68 setShellStyle(getShellStyle() | SWT.RESIZE); 69 fValidModes = new ArrayList (); 70 Set modes = configuration.getType().getSupportedModeCombinations(); 71 Set modeset = null; 72 for(Iterator iter = modes.iterator(); iter.hasNext();) { 73 modeset = (Set ) iter.next(); 74 if(modeset.contains(mode)) { 75 fValidModes.add(modeset); 76 } 77 } 78 } 79 80 83 protected String getDialogSettingsId() { 84 return IDebugUIConstants.PLUGIN_ID + ".SELECT_LAUNCH_MODES_DIALOG"; } 86 87 90 protected IBaseLabelProvider getLabelProvider() { 91 return new OptionsLabelProvider(); 92 } 93 94 97 protected Object getViewerInput() { 98 return fValidModes.toArray(); 99 } 100 101 104 protected String getHelpContextId() { 105 return IDebugHelpContextIds.SELECT_LAUNCH_MODES_DIALOG; 106 } 107 108 111 protected String getViewerLabel() { 112 return LaunchConfigurationsMessages.SelectLaunchOptionsDialog_4; 113 } 114 } 115 | Popular Tags |