Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 157059 | Differences between
and this patch

Collapse All | Expand All

(-)tests/org/eclipse/jdt/debug/tests/core/LaunchDelegateTests.java (-7 / +7 lines)
Lines 16-22 Link Here
16
import org.eclipse.debug.core.ILaunch;
16
import org.eclipse.debug.core.ILaunch;
17
import org.eclipse.debug.core.ILaunchConfigurationType;
17
import org.eclipse.debug.core.ILaunchConfigurationType;
18
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
18
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
19
import org.eclipse.debug.core.ILaunchDelegateProxy;
19
import org.eclipse.debug.core.ILaunchDelegate;
20
import org.eclipse.debug.core.ILaunchManager;
20
import org.eclipse.debug.core.ILaunchManager;
21
import org.eclipse.debug.core.sourcelookup.ISourcePathComputer;
21
import org.eclipse.debug.core.sourcelookup.ISourcePathComputer;
22
import org.eclipse.jdt.debug.testplugin.AlternateDelegate;
22
import org.eclipse.jdt.debug.testplugin.AlternateDelegate;
Lines 79-86 Link Here
79
		HashSet modes = new HashSet();
79
		HashSet modes = new HashSet();
80
		modes.add("alternate");
80
		modes.add("alternate");
81
		modes.add(ILaunchManager.DEBUG_MODE);
81
		modes.add(ILaunchManager.DEBUG_MODE);
82
		assertTrue("Should support mixed mode (alternate/debug)", type.supportsModeCombination(modes));
82
		assertTrue("Should support mixed mode (alternate/debug)", type.supportsModes(modes));
83
		ILaunchDelegateProxy[] delegates = type.getDelegates(modes);
83
		ILaunchDelegate[] delegates = type.getDelegates(modes);
84
		assertTrue("missing delegate", delegates.length > 0);
84
		assertTrue("missing delegate", delegates.length > 0);
85
		assertEquals("Wrong number of delegates", 1, delegates.length);
85
		assertEquals("Wrong number of delegates", 1, delegates.length);
86
		assertTrue("Wrong delegate", delegates[0].getDelegate() instanceof AlternateDelegate);
86
		assertTrue("Wrong delegate", delegates[0].getDelegate() instanceof AlternateDelegate);
Lines 96-103 Link Here
96
		assertNotNull("Missing java application launch config type", type);
96
		assertNotNull("Missing java application launch config type", type);
97
		HashSet modes = new HashSet();
97
		HashSet modes = new HashSet();
98
		modes.add(ILaunchManager.DEBUG_MODE);
98
		modes.add(ILaunchManager.DEBUG_MODE);
99
		assertTrue("Should support mode (debug)", type.supportsModeCombination(modes));
99
		assertTrue("Should support mode (debug)", type.supportsModes(modes));
100
		ILaunchDelegateProxy[] delegates = type.getDelegates(modes);
100
		ILaunchDelegate[] delegates = type.getDelegates(modes);
101
		assertTrue("missing delegate", delegates.length > 0);
101
		assertTrue("missing delegate", delegates.length > 0);
102
		assertEquals("Wrong number of delegates", 1, delegates.length);
102
		assertEquals("Wrong number of delegates", 1, delegates.length);
103
		assertTrue("Wrong delegate", delegates[0].getDelegate().getClass().getName().endsWith("JavaLaunchDelegate"));		
103
		assertTrue("Wrong delegate", delegates[0].getDelegate().getClass().getName().endsWith("JavaLaunchDelegate"));		
Lines 113-120 Link Here
113
		assertNotNull("Missing java application launch config type", type);
113
		assertNotNull("Missing java application launch config type", type);
114
		HashSet modes = new HashSet();
114
		HashSet modes = new HashSet();
115
		modes.add("alternate");
115
		modes.add("alternate");
116
		assertTrue("Should support mode (alternate)", type.supportsModeCombination(modes));
116
		assertTrue("Should support mode (alternate)", type.supportsModes(modes));
117
		ILaunchDelegateProxy[] delegates = type.getDelegates(modes);
117
		ILaunchDelegate[] delegates = type.getDelegates(modes);
118
		assertTrue("missing delegate", delegates.length > 0);
118
		assertTrue("missing delegate", delegates.length > 0);
119
		assertEquals("Wrong number of delegates", 1, delegates.length);
119
		assertEquals("Wrong number of delegates", 1, delegates.length);
120
		assertTrue("Wrong delegate", delegates[0].getDelegate() instanceof AlternateDelegate);		
120
		assertTrue("Wrong delegate", delegates[0].getDelegate() instanceof AlternateDelegate);		
(-)core/org/eclipse/debug/internal/core/LaunchDelegate.java (-73 / +45 lines)
Lines 11-19 Link Here
11
package org.eclipse.debug.internal.core;
11
package org.eclipse.debug.internal.core;
12
12
13
import java.util.ArrayList;
13
import java.util.ArrayList;
14
import java.util.Collection;
15
import java.util.HashSet;
14
import java.util.HashSet;
16
import java.util.Iterator;
17
import java.util.List;
15
import java.util.List;
18
import java.util.Set;
16
import java.util.Set;
19
17
Lines 22-28 Link Here
22
import org.eclipse.core.runtime.IStatus;
20
import org.eclipse.core.runtime.IStatus;
23
import org.eclipse.core.runtime.Status;
21
import org.eclipse.core.runtime.Status;
24
import org.eclipse.debug.core.DebugPlugin;
22
import org.eclipse.debug.core.DebugPlugin;
25
import org.eclipse.debug.core.ILaunchDelegateProxy;
23
import org.eclipse.debug.core.ILaunchDelegate;
26
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
24
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
27
25
28
import com.ibm.icu.text.MessageFormat;
26
import com.ibm.icu.text.MessageFormat;
Lines 47-53 Link Here
47
 * 
45
 * 
48
 * @since 3.3
46
 * @since 3.3
49
 */
47
 */
50
public final class LaunchDelegate implements ILaunchDelegateProxy {
48
public final class LaunchDelegate implements ILaunchDelegate {
51
	
49
	
52
	/**
50
	/**
53
	 * The configuration element for this delegate
51
	 * The configuration element for this delegate
Lines 59-67 Link Here
59
	 */
57
	 */
60
	private ILaunchConfigurationDelegate fDelegate = null;
58
	private ILaunchConfigurationDelegate fDelegate = null;
61
	
59
	
62
	//lists of cached entries
60
	//a listing of sets of 
61
	private List fLaunchModes = null;
63
	private HashSet fModes = null;
62
	private HashSet fModes = null;
64
	private HashSet fOptions = null;
65
	private String fType = null;
63
	private String fType = null;
66
	
64
	
67
	/**
65
	/**
Lines 72-77 Link Here
72
		fElement = element;
70
		fElement = element;
73
	}
71
	}
74
	
72
	
73
	/* (non-Javadoc)
74
	 * @see org.eclipse.debug.core.ILaunchDelegateProxy#getDelegate()
75
	 */
75
	public ILaunchConfigurationDelegate getDelegate() throws CoreException {
76
	public ILaunchConfigurationDelegate getDelegate() throws CoreException {
76
		if(fDelegate == null) {
77
		if(fDelegate == null) {
77
			Object obj = fElement.createExecutableExtension(IConfigurationElementConstants.DELEGATE);
78
			Object obj = fElement.createExecutableExtension(IConfigurationElementConstants.DELEGATE);
Lines 84-89 Link Here
84
		return fDelegate;
85
		return fDelegate;
85
	}
86
	}
86
87
88
	/* (non-Javadoc)
89
	 * @see org.eclipse.debug.core.ILaunchDelegateProxy#getId()
90
	 */
87
	public String getId() {
91
	public String getId() {
88
		return fElement.getAttribute(IConfigurationElementConstants.ID);
92
		return fElement.getAttribute(IConfigurationElementConstants.ID);
89
	}
93
	}
Lines 103-127 Link Here
103
		}
107
		}
104
		return fType;
108
		return fType;
105
	}
109
	}
106
107
	public Set getOptions() {
108
		if(fOptions == null) {
109
			fOptions = new HashSet();
110
			String option = fElement.getAttribute(IConfigurationElementConstants.OPTIONS);
111
			if(option != null) {
112
				String[] options = option.split(","); //$NON-NLS-1$
113
				for(int i = 0; i < options.length; i++) {
114
					fOptions.add(options[i].trim());
115
				}
116
			}
117
		}
118
		return fOptions;
119
	}
120
	
110
	
121
	public Set getModes() {
111
	/**
112
	 * Parese a list of modes and creates a new set of them
113
	 * @param element the configuraiton element to read from
114
	 * @return a set of launch modes created form a comma seperated list
115
	 */
116
	private Set getModes(IConfigurationElement element) {
122
		if (fModes == null) {
117
		if (fModes == null) {
123
			fModes = new HashSet();
118
			fModes = new HashSet();
124
			String modes = fElement.getAttribute(IConfigurationElementConstants.MODES); 
119
			String modes = element.getAttribute(IConfigurationElementConstants.MODES); 
125
			if (modes != null) {
120
			if (modes != null) {
126
				String[] strings = modes.split(","); //$NON-NLS-1$
121
				String[] strings = modes.split(","); //$NON-NLS-1$
127
				for (int i = 0; i < strings.length; i++) {
122
				for (int i = 0; i < strings.length; i++) {
Lines 132-137 Link Here
132
		return fModes;
127
		return fModes;
133
	}
128
	}
134
	
129
	
130
	/* (non-Javadoc)
131
	 * @see org.eclipse.debug.core.ILaunchDelegateProxy#getModes()
132
	 */
133
	public List getModes() {
134
		if(fLaunchModes == null) {
135
			fLaunchModes = new ArrayList();
136
			IConfigurationElement[] children = fElement.getChildren(IConfigurationElementConstants.MODES_COMBINATION);
137
			for (int i = 0; i < children.length; i++) {
138
				fLaunchModes.add(getModes(children[i]));
139
			}
140
			if(fLaunchModes.size() == 0) {
141
				//try to get the modes from the old definition and make each one
142
				//a seperate set of one element
143
				String modes = fElement.getAttribute(IConfigurationElementConstants.MODES); 
144
				if (modes != null) {
145
					String[] strings = modes.split(","); //$NON-NLS-1$
146
					HashSet modeset = null;
147
					for (int i = 0; i < strings.length; i++) {
148
						modeset = new HashSet();
149
						modeset.add(strings[i].trim());
150
						fLaunchModes.add(modeset);
151
					}
152
				}
153
			}
154
		}
155
		return fLaunchModes;
156
	}
157
	
135
	/**
158
	/**
136
	 * Returns the human readable name for this launch delegate
159
	 * Returns the human readable name for this launch delegate
137
	 * @return the human readable name for this launch delegate, or <code>null</code> if none
160
	 * @return the human readable name for this launch delegate, or <code>null</code> if none
Lines 164-218 Link Here
164
	public String getSourcePathComputerId() {
187
	public String getSourcePathComputerId() {
165
		return fElement.getAttribute(IConfigurationElementConstants.SOURCE_PATH_COMPUTER);
188
		return fElement.getAttribute(IConfigurationElementConstants.SOURCE_PATH_COMPUTER);
166
	}
189
	}
167
168
	/**
169
	 * Returns all combinations of supported options.
170
	 * 
171
	 * @return combinations of supported options
172
	 */
173
	private Collection getOptionSets() {
174
		Set optionSets = new HashSet(); 
175
		optionSets.add(new HashSet()); // seed with the empty option set
176
		Object[] options = getOptions().toArray();
177
		boolean grew = false;
178
		do {
179
			grew = false;
180
			Set[] sets = (Set[]) optionSets.toArray(new Set[optionSets.size()]);
181
			for (int i = 0; i < sets.length; i++) {
182
				Set optionSet = sets[i];
183
				for (int j = 0; j < options.length; j++) {
184
					Object option = options[j];
185
					Set newOptionSet = new HashSet(optionSet);
186
					if (newOptionSet.add(option)) {
187
						if (optionSets.add(newOptionSet)) {
188
							grew = true;
189
						}
190
					}
191
				}				
192
			}                                   
193
		} while (grew);
194
		return optionSets;
195
	}
196
	
197
	/**
198
	 * Returns all supported launch mode combinations as sets of modes.
199
	 *  
200
	 * @return all supported launch mode combinations
201
	 */
202
	List getModeCombinations() {
203
		Collection optionSets = getOptionSets();
204
		Object[] modes = getModes().toArray();
205
		List combinations = new ArrayList(optionSets.size() * modes.length);
206
		Iterator iterator = optionSets.iterator();
207
		while (iterator.hasNext()) {
208
			Set optionSet = (Set) iterator.next();
209
			for (int i = 0; i < modes.length; i++) {
210
				Object mode = modes[i];
211
				Set set = new HashSet(optionSet);
212
				set.add(mode);
213
				combinations.add(set);
214
			}			
215
		}
216
		return combinations;
217
	}
218
}
190
}
(-)core/org/eclipse/debug/internal/core/IConfigurationElementConstants.java (+5 lines)
Lines 82-87 Link Here
82
	public static final String MODES = "modes"; //$NON-NLS-1$
82
	public static final String MODES = "modes"; //$NON-NLS-1$
83
	
83
	
84
	/**
84
	/**
85
	 * the modesCombination node name for a configuraiton element 
86
	 */
87
	public static final String MODES_COMBINATION = "modesCombination"; //$NON-NLS-1$
88
	
89
	/**
85
	 * the mode node name for a configuration element
90
	 * the mode node name for a configuration element
86
	 */
91
	 */
87
	public static final String MODE = "mode"; //$NON-NLS-1$
92
	public static final String MODE = "mode"; //$NON-NLS-1$
(-)core/org/eclipse/debug/internal/core/DebugCoreMessages.java (+2 lines)
Lines 29-34 Link Here
29
29
30
	public static String LaunchConfigurationInfo_35;
30
	public static String LaunchConfigurationInfo_35;
31
31
32
	public static String LaunchConfigurationType_6;
33
32
	public static String LaunchConfigurationType_7;
34
	public static String LaunchConfigurationType_7;
33
35
34
	public static String LaunchOption_0;
36
	public static String LaunchOption_0;
(-)core/org/eclipse/debug/internal/core/LaunchManager.java (-4 / +201 lines)
Lines 67-72 Link Here
67
import org.eclipse.core.runtime.ListenerList;
67
import org.eclipse.core.runtime.ListenerList;
68
import org.eclipse.core.runtime.Platform;
68
import org.eclipse.core.runtime.Platform;
69
import org.eclipse.core.runtime.PlatformObject;
69
import org.eclipse.core.runtime.PlatformObject;
70
import org.eclipse.core.runtime.Preferences;
70
import org.eclipse.core.runtime.SafeRunner;
71
import org.eclipse.core.runtime.SafeRunner;
71
import org.eclipse.core.runtime.Status;
72
import org.eclipse.core.runtime.Status;
72
import org.eclipse.core.variables.VariablesPlugin;
73
import org.eclipse.core.variables.VariablesPlugin;
Lines 76-81 Link Here
76
import org.eclipse.debug.core.ILaunchConfiguration;
77
import org.eclipse.debug.core.ILaunchConfiguration;
77
import org.eclipse.debug.core.ILaunchConfigurationListener;
78
import org.eclipse.debug.core.ILaunchConfigurationListener;
78
import org.eclipse.debug.core.ILaunchConfigurationType;
79
import org.eclipse.debug.core.ILaunchConfigurationType;
80
import org.eclipse.debug.core.ILaunchDelegate;
79
import org.eclipse.debug.core.ILaunchListener;
81
import org.eclipse.debug.core.ILaunchListener;
80
import org.eclipse.debug.core.ILaunchManager;
82
import org.eclipse.debug.core.ILaunchManager;
81
import org.eclipse.debug.core.ILaunchMode;
83
import org.eclipse.debug.core.ILaunchMode;
Lines 112-117 Link Here
112
 */
114
 */
113
public class LaunchManager extends PlatformObject implements ILaunchManager, IResourceChangeListener {
115
public class LaunchManager extends PlatformObject implements ILaunchManager, IResourceChangeListener {
114
	
116
	
117
	
118
	/**
119
	 * Constants for xml node names
120
	 * 
121
	 * @since 3.3
122
	 * 
123
	 * EXPERIMENTAL
124
	 */
125
	protected static final String MODES = "modes"; //$NON-NLS-1$
126
	protected static final String TYPEID = "typeid"; //$NON-NLS-1$
127
	protected static final String ID = "id"; //$NON-NLS-1$
128
	protected static final String DELEGATE = "delegate"; //$NON-NLS-1$
129
	protected static final String PREFERRED_DELEGATES = "preferredDelegates"; //$NON-NLS-1$
130
	protected static final String PREF_PREFERRED_DELEGATES = DebugPlugin.getUniqueIdentifier() + ".PREFERRED_DELEGATES"; //$NON-NLS-1$
131
115
	/**
132
	/**
116
	 * Constant to define debug.core for the status codes
133
	 * Constant to define debug.core for the status codes
117
	 * 
134
	 * 
Lines 131-137 Link Here
131
	 * 
148
	 * 
132
	 * @since 3.2
149
	 * @since 3.2
133
	 */
150
	 */
134
	private static final String EMPTY_STRING = ""; //$NON-NLS-1$
151
	protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
135
    
152
    
136
	/**
153
	/**
137
	 * Status code for which a UI prompter is registered.
154
	 * Status code for which a UI prompter is registered.
Lines 462-467 Link Here
462
	}
479
	}
463
	
480
	
464
	/**
481
	/**
482
	 * Internal class used to hold information about a preferred delegate
483
	 * @since 3.3
484
	 * 
485
	 * EXPERIMENTAL
486
	 */
487
	class PreferredDelegate {
488
		private ILaunchDelegate fDelegate = null;
489
		private String fTypeid = null;
490
		private Set fModes = null;
491
		
492
		public PreferredDelegate(ILaunchDelegate delegate, String typeid, Set modes) {
493
			fDelegate = delegate;
494
			fTypeid = typeid;
495
			fModes = modes;
496
		}
497
		
498
		public String getTypeId() {
499
			return fTypeid;
500
		}
501
		
502
		public Set getModes() {
503
			return fModes;
504
		}
505
		
506
		public ILaunchDelegate getDelegate() {
507
			return fDelegate;
508
		}
509
	}
510
	
511
	/**
465
	 * Types of notifications
512
	 * Types of notifications
466
	 */
513
	 */
467
	public static final int ADDED = 0;
514
	public static final int ADDED = 0;
Lines 557-562 Link Here
557
	private HashMap fLaunchDelegates = null;
604
	private HashMap fLaunchDelegates = null;
558
	
605
	
559
	/**
606
	/**
607
	 * Initial startup cache of preferred delegate so that the debug prefs are only parsed once
608
	 * 
609
	 * @since 3.3
610
	 * 
611
	 * EXPERIMENTAL
612
	 */
613
	private Set fPreferredDelegates = null;
614
	
615
	/**
560
	 * Collection of launches
616
	 * Collection of launches
561
	 */
617
	 */
562
	private List fLaunches= new ArrayList(10);
618
	private List fLaunches= new ArrayList(10);
Lines 1383-1388 Link Here
1383
	}
1439
	}
1384
	
1440
	
1385
	/**
1441
	/**
1442
	 * This method is used to initialize a simple listing of all preferred delegates, which is then used by each
1443
	 * <code>ILaunchConfigurationType</code> to find if they have preferred delegates. Once an <code>ILaunchConfigurationType</code>
1444
	 * has used this listing to initialize its preferred delegates ti will maintain changes to its preferred delegate, which are 
1445
	 * then written back to the pref sotre only when the launch manager shuts down.
1446
	 * 
1447
	 * <p>
1448
	 * This cache is not synchronized with the runtime preferred delegates stored in launch configuration types.
1449
	 * </p>
1450
	 * 
1451
	 * @since 3.3
1452
	 * 
1453
	 * EXPERIMENTAL
1454
	 */
1455
	private synchronized void initializePreferredDelegates() {
1456
		if(fPreferredDelegates == null) {
1457
			fPreferredDelegates = new HashSet();
1458
			Preferences prefs = DebugPlugin.getDefault().getPluginPreferences();
1459
			String preferred = prefs.getString(LaunchManager.PREF_PREFERRED_DELEGATES);
1460
			if(!EMPTY_STRING.equals(preferred)) {
1461
				try {
1462
					Element root = DebugPlugin.parseDocument(preferred);
1463
					NodeList nodes = root.getElementsByTagName(LaunchManager.DELEGATE);
1464
					Element element = null;
1465
					String tid = null, mod = null, did = null;
1466
					String[] modes = null;
1467
					Set modeset = null;
1468
					LaunchDelegate[] extensions = null;
1469
					ILaunchDelegate delegate = null;
1470
					for(int i = 0; i < nodes.getLength(); i++) {
1471
						element = (Element) nodes.item(i);
1472
						tid = element.getAttribute(LaunchManager.TYPEID);
1473
						if(!EMPTY_STRING.equals(tid)) {
1474
							//get the modes
1475
							mod = element.getAttribute(LaunchManager.MODES);
1476
							modes = mod.split(","); //$NON-NLS-1$
1477
							modeset = new HashSet();
1478
							for(int j = 0; j < modes.length; j++) {
1479
								modeset.add(modes[j].trim());
1480
							}
1481
							//get the delegate id and the delegate
1482
							did = element.getAttribute(LaunchManager.ID);
1483
							extensions = getLaunchDelegates();
1484
							for(int j = 0; j < extensions.length; j++) {
1485
								if(!EMPTY_STRING.equals(did) && did.equals(extensions[j].getId()) 
1486
										&& tid.equals(extensions[j].getLaunchConfigurationTypeId())
1487
										&& extensions[j].getModes().contains(modeset)) {
1488
									delegate = extensions[j]; 
1489
									break;
1490
								}
1491
							}
1492
							//take tid, modeset, delegate and create entry
1493
							if(delegate != null & !EMPTY_STRING.equals(tid) & modeset != null) {
1494
								fPreferredDelegates.add(new PreferredDelegate(delegate, tid, modeset));
1495
							}
1496
						}
1497
					}
1498
				}
1499
				catch (CoreException e) {DebugPlugin.log(e);} 
1500
			}
1501
		}
1502
	}
1503
	
1504
	/**
1505
	 * Allows internal access to a preferred delegate for a given type and mode set
1506
	 * @param typeid the id of the <code>ILaunchConfigurationType</code> to find a delegate for
1507
	 * @param modes ther set of modes for the delegate
1508
	 * @return the preferred delegate for the specified type id and mode set, or <code>null</code> if none
1509
	 * 
1510
	 * @since 3.3
1511
	 * 
1512
	 * EXPERIMENTAL
1513
	 */
1514
	protected ILaunchDelegate getPreferredDelegate(String typeid, Set modes) {
1515
		initializePreferredDelegates();
1516
		PreferredDelegate pd = null;
1517
		for(Iterator iter = fPreferredDelegates.iterator(); iter.hasNext();) {
1518
			pd = (PreferredDelegate) iter.next();
1519
			if(pd.getModes().equals(modes) & pd.getTypeId().equals(typeid)) {
1520
				return pd.getDelegate();
1521
			}
1522
		}
1523
		return null;
1524
	}
1525
	
1526
	/**
1386
	 * Returns all launch configurations that are stored locally.
1527
	 * Returns all launch configurations that are stored locally.
1387
	 * 
1528
	 * 
1388
	 * @return collection of launch configurations stored locally
1529
	 * @return collection of launch configurations stored locally
Lines 1634-1640 Link Here
1634
			sourceContainerTypes = new HashMap();
1775
			sourceContainerTypes = new HashMap();
1635
			for (int i = 0; i < extensions.length; i++) {
1776
			for (int i = 0; i < extensions.length; i++) {
1636
				sourceContainerTypes.put(
1777
				sourceContainerTypes.put(
1637
						extensions[i].getAttribute("id"), //$NON-NLS-1$
1778
						extensions[i].getAttribute(ID),
1638
						new SourceContainerType(extensions[i]));
1779
						new SourceContainerType(extensions[i]));
1639
			}
1780
			}
1640
			extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_SOURCE_PATH_COMPUTERS);
1781
			extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_SOURCE_PATH_COMPUTERS);
Lines 1642-1648 Link Here
1642
			sourcePathComputers = new HashMap();
1783
			sourcePathComputers = new HashMap();
1643
			for (int i = 0; i < extensions.length; i++) {
1784
			for (int i = 0; i < extensions.length; i++) {
1644
				sourcePathComputers.put(
1785
				sourcePathComputers.put(
1645
						extensions[i].getAttribute("id"), //$NON-NLS-1$
1786
						extensions[i].getAttribute(ID),
1646
						new SourcePathComputer(extensions[i]));
1787
						new SourcePathComputer(extensions[i]));
1647
			}
1788
			}
1648
		}
1789
		}
Lines 1663-1669 Link Here
1663
			String id = null;
1804
			String id = null;
1664
			for (int i= 0; i < infos.length; i++) {
1805
			for (int i= 0; i < infos.length; i++) {
1665
				configurationElement = infos[i];
1806
				configurationElement = infos[i];
1666
				id = configurationElement.getAttribute("id"); //$NON-NLS-1$			
1807
				id = configurationElement.getAttribute(ID);			
1667
				if (id != null) {
1808
				if (id != null) {
1668
					fSourceLocators.put(id,configurationElement);
1809
					fSourceLocators.put(id,configurationElement);
1669
				} else {
1810
				} else {
Lines 2015-2026 Link Here
2015
			}
2156
			}
2016
		}
2157
		}
2017
		
2158
		
2159
		persistPreferredLaunchDelegates();
2018
		clearAllLaunchConfigurations();
2160
		clearAllLaunchConfigurations();
2019
2161
2020
		ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
2162
		ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
2021
	}
2163
	}
2022
2164
2023
	/**
2165
	/**
2166
	 * Saves the listings of preferred launch delegates from all of the launch configuration types
2167
	 * 
2168
	 * @since 3.3
2169
	 * 
2170
	 * EXPERIMENTAL
2171
	 */
2172
	private void persistPreferredLaunchDelegates() {
2173
		Preferences prefs = DebugPlugin.getDefault().getPluginPreferences();
2174
		try {
2175
			Document doc = DebugPlugin.newDocument();
2176
			Element root = doc.createElement(PREFERRED_DELEGATES);
2177
			doc.appendChild(root);
2178
			ILaunchConfigurationType[] types = getLaunchConfigurationTypes();
2179
			Map preferred = null;
2180
			Element child = null;
2181
			ILaunchDelegate delegate = null;
2182
			Set modes = null;
2183
			String modestr = EMPTY_STRING;
2184
			for(int i = 0; i < types.length; i++) {
2185
				preferred = ((LaunchConfigurationType)types[i]).getPreferredDelegates();
2186
				if(preferred != null && preferred.size() > 0) {
2187
					for(Iterator iter = preferred.keySet().iterator(); iter.hasNext();) {
2188
						modes = (Set) iter.next();
2189
						delegate = (ILaunchDelegate) preferred.get(modes);
2190
						child = doc.createElement(DELEGATE);
2191
						child.setAttribute(ID, delegate.getId());
2192
						child.setAttribute(TYPEID, types[i].getIdentifier());
2193
						for(Iterator iter2 = modes.iterator(); iter2.hasNext();) {
2194
							modestr += iter2.next();
2195
							if(iter2.hasNext()) {
2196
								modestr += ","; //$NON-NLS-1$
2197
							}
2198
						}
2199
						child.setAttribute(MODES, modes.toString());
2200
						root.appendChild(child);
2201
					}
2202
				}
2203
			}
2204
			String pref = null;
2205
			if(root.hasChildNodes()) {
2206
				pref = serializeDocument(doc);
2207
			}
2208
			if(pref != null) {
2209
				prefs.setValue(PREF_PREFERRED_DELEGATES, pref);
2210
			}
2211
			if(prefs.needsSaving()) {
2212
				DebugPlugin.getDefault().savePluginPreferences();
2213
			}
2214
		} 
2215
		catch (CoreException e) {DebugPlugin.log(e);}
2216
		catch (IOException ioe) {DebugPlugin.log(ioe);}
2217
		catch (TransformerException te) {DebugPlugin.log(te);}
2218
	}
2219
	
2220
	/**
2024
	 * finds and terminates any running launch configurations associated with the given resource
2221
	 * finds and terminates any running launch configurations associated with the given resource
2025
	 * @param resource the resource to search for launch configurations and hence launches for
2222
	 * @param resource the resource to search for launch configurations and hence launches for
2026
	 * @since 3.2
2223
	 * @since 3.2
(-)core/org/eclipse/debug/internal/core/LaunchConfigurationType.java (-43 / +149 lines)
Lines 13-18 Link Here
13
 
13
 
14
import java.util.ArrayList;
14
import java.util.ArrayList;
15
import java.util.Collections;
15
import java.util.Collections;
16
import java.util.HashMap;
16
import java.util.HashSet;
17
import java.util.HashSet;
17
import java.util.Hashtable;
18
import java.util.Hashtable;
18
import java.util.Iterator;
19
import java.util.Iterator;
Lines 31-37 Link Here
31
import org.eclipse.debug.core.ILaunchConfigurationMigrationDelegate;
32
import org.eclipse.debug.core.ILaunchConfigurationMigrationDelegate;
32
import org.eclipse.debug.core.ILaunchConfigurationType;
33
import org.eclipse.debug.core.ILaunchConfigurationType;
33
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
34
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
34
import org.eclipse.debug.core.ILaunchDelegateProxy;
35
import org.eclipse.debug.core.ILaunchDelegate;
35
import org.eclipse.debug.core.ILaunchManager;
36
import org.eclipse.debug.core.ILaunchManager;
36
import org.eclipse.debug.core.ILaunchMode;
37
import org.eclipse.debug.core.ILaunchMode;
37
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
38
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
Lines 55-61 Link Here
55
	 *  a listing of modes contributed to this launch configuration type
56
	 *  a listing of modes contributed to this launch configuration type
56
	 *  @since 3.3
57
	 *  @since 3.3
57
	 *  
58
	 *  
58
	 *  <p>
59
	 * <p>
59
	 * <strong>EXPERIMENTAL</strong>. This field has been added as
60
	 * <strong>EXPERIMENTAL</strong>. This field has been added as
60
	 * part of a work in progress. There is no guarantee that this API will
61
	 * part of a work in progress. There is no guarantee that this API will
61
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
62
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
Lines 65-70 Link Here
65
	private Set fModes = null;
66
	private Set fModes = null;
66
	
67
	
67
	/**
68
	/**
69
	 * A set of sets containing all of the supported mode combinations of this type
70
	 * 
71
	 * @since 3.3
72
	 * 
73
	 * EXPERIMENTAL
74
	 */
75
	private Set fModeCombinations = null;
76
	
77
	/**
68
	 * the default source path computer for this config type
78
	 * the default source path computer for this config type
69
	 * @since 3.3
79
	 * @since 3.3
70
	 * 
80
	 * 
Lines 88-96 Link Here
88
	 * be different delegates for different modes (since 3.0).
98
	 * be different delegates for different modes (since 3.0).
89
	 * Map of modes (Set of modes) to list of delegates
99
	 * Map of modes (Set of modes) to list of delegates
90
	 */
100
	 */
91
	private Map fDelegates;
101
	private Map fDelegates = null;
92
	
102
	
93
	private LaunchDelegate fSourceProvider;
103
	/**
104
	 * The source provider cache entry
105
	 */
106
	private LaunchDelegate fSourceProvider = null;
107
	
108
	/**
109
	 * A map of preferred launch delegates for mode combinations
110
	 * 
111
	 *  @since 3.3
112
	 *  
113
	 *  EXPERIMENTAL
114
	 */
115
	private Map fPreferredDelegates = null;
94
	
116
	
95
	/**
117
	/**
96
	 * Constructs a new launch configuration type on the
118
	 * Constructs a new launch configuration type on the
Lines 129-135 Link Here
129
	public ILaunchConfigurationDelegate getDelegate(String mode) throws CoreException {
151
	public ILaunchConfigurationDelegate getDelegate(String mode) throws CoreException {
130
		Set modes = new HashSet();
152
		Set modes = new HashSet();
131
		modes.add(mode);
153
		modes.add(mode);
132
		ILaunchDelegateProxy[] delegates = getDelegates(modes);
154
		ILaunchDelegate[] delegates = getDelegates(modes);
133
		if (delegates.length > 0) {
155
		if (delegates.length > 0) {
134
			return delegates[0].getDelegate();
156
			return delegates[0].getDelegate();
135
		}
157
		}
Lines 147-186 Link Here
147
		throw new CoreException(status);
169
		throw new CoreException(status);
148
	}
170
	}
149
	
171
	
150
	public ILaunchDelegateProxy[] getDelegates(Set modes) throws CoreException {
172
	/* (non-Javadoc)
173
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getDelegates(java.util.Set)
174
	 */
175
	public ILaunchDelegate[] getDelegates(Set modes) throws CoreException {
151
		initializeDelegates();
176
		initializeDelegates();
152
		Object[] theModes = modes.toArray();
177
		initializePreferredDelegates();
153
		for (int i = 0; i < theModes.length; i++) {
154
			String mode = (String) theModes[i];
155
			if (!supportsMode(mode)) {
156
				throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR,
157
						MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_9, new String[] {mode, getIdentifier()}), null));  
158
			}			
159
		}
160
		List delegates = (List) fDelegates.get(modes);
178
		List delegates = (List) fDelegates.get(modes);
161
		if (delegates == null) {
179
		if (delegates == null) {
162
			delegates = Collections.EMPTY_LIST;
180
			delegates = Collections.EMPTY_LIST;
163
		}
181
		}
164
		return (ILaunchDelegateProxy[]) delegates.toArray(new ILaunchDelegateProxy[delegates.size()]);
182
		return (ILaunchDelegate[]) delegates.toArray(new ILaunchDelegate[delegates.size()]);
183
	}
184
	
185
	/**
186
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#setPreferredDelegate(java.util.Set, org.eclipse.debug.core.ILaunchDelegateProxy)
187
	 */
188
	public void setPreferredDelegate(Set modes, ILaunchDelegate delegate) {
189
		if(fPreferredDelegates == null) {
190
			fPreferredDelegates = new HashMap();
191
		}
192
		fPreferredDelegates.put(modes, delegate);
193
	}
194
	
195
	/**
196
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getPreferredDelegate(java.util.Set)
197
	 */
198
	public ILaunchDelegate getPreferredDelegate(Set modes) {
199
		initializePreferredDelegates();
200
		return (ILaunchDelegate) fPreferredDelegates.get(modes);
165
	}
201
	}
166
	
202
	
203
	/**
204
	 * Internal use method to allow access to the listing of preferred delegates
205
	 * @return the map opf preferred delegates
206
	 * 
207
	 * @since 3.3
208
	 * 
209
	 * EXPERIMENTAL
210
	 */
211
	public Map getPreferredDelegates() {
212
		initializePreferredDelegates();
213
		return fPreferredDelegates;
214
	}
215
	
216
	/**
217
	 * This method is used to initialize the listing of preferred launch delegates for this type
218
	 * 
219
	 * <p>
220
	 * Undecide if this code should live in the launch manager and have it load a listing of all perferred launch 
221
	 * delegates that each config type could then query as needed when looking for their preferrred delegate. 
222
	 * Seems like it would be alot less work...
223
	 * </p>
224
	 * @since 3.3
225
	 * 
226
	 * EXPERIMENTAL
227
	 */
228
	private synchronized void initializePreferredDelegates() {
229
		if(fPreferredDelegates == null) {
230
			fPreferredDelegates = new HashMap();
231
			initializeDelegates();
232
			LaunchManager lm = (LaunchManager) DebugPlugin.getDefault().getLaunchManager();
233
			ILaunchDelegate delegate = null;
234
			Set modes = null;
235
			for(Iterator iter = fDelegates.keySet().iterator(); iter.hasNext();) {
236
				modes = (Set) iter.next();
237
				delegate = lm.getPreferredDelegate(getIdentifier(), modes);
238
				if(delegate != null) {
239
					fPreferredDelegates.put(modes, delegate);
240
				}
241
			}
242
		}
243
	}
244
	
245
	/**
246
	 * Initializes the listing of launch delegates for this type
247
	 */
167
	private synchronized void initializeDelegates() {
248
	private synchronized void initializeDelegates() {
168
		if (fDelegates == null) {
249
		if (fDelegates == null) {
169
			// initialize delegate
250
			// initialize delegate
170
			fDelegates = new Hashtable();
251
			fDelegates = new Hashtable();
171
			LaunchDelegate[] launchDelegates = getLaunchDelegateExtensions();
252
			LaunchDelegate[] launchDelegates = getLaunchDelegateExtensions();
253
			LaunchDelegate delegate = null;
254
			List modelist = null;
172
			for (int i = 0; i < launchDelegates.length; i++) {
255
			for (int i = 0; i < launchDelegates.length; i++) {
173
				LaunchDelegate delegate = launchDelegates[i];
256
				delegate = launchDelegates[i];
174
				List combintaions = delegate.getModeCombinations();
257
				modelist = delegate.getModes();
175
				Iterator iterator = combintaions.iterator();
258
				for(int j = 0; j < modelist.size(); j++) {
176
				while (iterator.hasNext()) {
259
					//cache the delegate based on its set of modes and delegate
177
					Set combination = (Set) iterator.next();
260
					registerDelegate(delegate, (Set) modelist.get(j));
178
					registerDelegate(delegate, combination);
179
				}
261
				}
180
			}
262
			}
181
		}		
263
		}
182
	}
264
	}
183
265
	
184
	/**
266
	/**
185
	 * Returns all launch delegate extensions registered for this configuration type.
267
	 * Returns all launch delegate extensions registered for this configuration type.
186
	 * 
268
	 * 
Lines 190-195 Link Here
190
		return ((LaunchManager) DebugPlugin.getDefault().getLaunchManager()).getLaunchDelegates(getIdentifier());
272
		return ((LaunchManager) DebugPlugin.getDefault().getLaunchManager()).getLaunchDelegates(getIdentifier());
191
	}
273
	}
192
	
274
	
275
	/**
276
	 * Caches a delegate keyed using the set of modes that it supports
277
	 * @param delegate the delegate to cache
278
	 * @param modes the set of modes that the specified delegate supports
279
	 */
193
	private void registerDelegate(LaunchDelegate delegate, Set modes) {
280
	private void registerDelegate(LaunchDelegate delegate, Set modes) {
194
		List delegatesForModes = (List) fDelegates.get(modes);
281
		List delegatesForModes = (List) fDelegates.get(modes);
195
		if (delegatesForModes == null) {
282
		if (delegatesForModes == null) {
Lines 289-301 Link Here
289
		if(fModes == null) {
376
		if(fModes == null) {
290
			fModes = new HashSet();
377
			fModes = new HashSet();
291
			LaunchDelegate[] delegates = getLaunchDelegateExtensions();
378
			LaunchDelegate[] delegates = getLaunchDelegateExtensions();
379
			List modesets = null;
292
			for(int i= 0; i < delegates.length; i++) {
380
			for(int i= 0; i < delegates.length; i++) {
293
				fModes.addAll(delegates[i].getModes());
381
				modesets = delegates[i].getModes();
382
				for(Iterator iter = modesets.iterator(); iter.hasNext();) {
383
					fModes.addAll((Set) iter.next());
384
				}
294
			}
385
			}
295
		}
386
		}
296
		return fModes;
387
		return fModes;
297
	}
388
	}
298
389
	
390
	/**
391
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getSupportedModeCombinations()
392
	 */
393
	public Set getSupportedModeCombinations() {
394
		if(fModeCombinations == null) {
395
			initializeDelegates();
396
			fModeCombinations = new HashSet();
397
			fModeCombinations = fDelegates.keySet();
398
		}
399
		//return a clone or bad things happen
400
		HashSet set = new HashSet();
401
		for(Iterator iter = fModeCombinations.iterator(); iter.hasNext();) {
402
			set.add(new HashSet((Set) iter.next()));
403
		}
404
		return set;
405
	}
406
	
299
	/**
407
	/**
300
	 * determines if the specified candidate is suitable for migration by loading it delegate.
408
	 * determines if the specified candidate is suitable for migration by loading it delegate.
301
	 * @param candidate the candidate to inspect for migration suitability
409
	 * @param candidate the candidate to inspect for migration suitability
Lines 368-374 Link Here
368
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#supportsMode(java.lang.String)
476
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#supportsMode(java.lang.String)
369
	 */
477
	 */
370
	public boolean supportsMode(String mode) {
478
	public boolean supportsMode(String mode) {
371
		return getSupportedModes().contains(mode);
479
		if(fModeCombinations == null) {
480
			getSupportedModeCombinations();
481
		}
482
		Set modes = null;
483
		for(Iterator iter = fModeCombinations.iterator(); iter.hasNext();) {
484
			modes = (Set) iter.next();
485
			if(modes.size() == 1 && modes.contains(mode)) {
486
				return true;
487
			}
488
		}
489
		return false;
372
	}
490
	}
373
	
491
	
374
	/* (non-Javadoc)
492
	/* (non-Javadoc)
Lines 386-410 Link Here
386
	}
504
	}
387
505
388
	/* (non-Javadoc)
506
	/* (non-Javadoc)
389
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getSupportedModeCombinations()
390
	 */
391
	public Set[] getSupportedModeCombinations() {
392
		initializeDelegates();
393
		Set combinations = fDelegates.keySet();
394
		Set[] sets = (Set[])combinations.toArray(new Set[combinations.size()]);
395
		Set[] copy = new Set[sets.length];
396
		for (int i = 0; i < copy.length; i++) {
397
			copy[i] = new HashSet(sets[i]);
398
		}
399
		return copy;
400
	}
401
402
	/* (non-Javadoc)
403
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#supportsModeCombination(java.util.Set)
507
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#supportsModeCombination(java.util.Set)
404
	 */
508
	 */
405
	public boolean supportsModeCombination(Set modes) {
509
	public boolean supportsModes(Set modes) {
406
		initializeDelegates();
510
		if(fModeCombinations == null) {
407
		return fDelegates.containsKey(modes);
511
			getSupportedModeCombinations();
512
		}
513
		return fModeCombinations.contains(modes);
408
	}
514
	}
409
515
410
}
516
}
(-)core/org/eclipse/debug/internal/core/DebugCoreMessages.properties (+1 lines)
Lines 65-70 Link Here
65
LaunchConfigurationType_Launch_delegate_for__0__does_not_implement_required_interface_ILaunchConfigurationDelegate__1=Launch delegate for {0} does not implement required interface ILaunchConfigurationDelegate.
65
LaunchConfigurationType_Launch_delegate_for__0__does_not_implement_required_interface_ILaunchConfigurationDelegate__1=Launch delegate for {0} does not implement required interface ILaunchConfigurationDelegate.
66
LaunchConfigurationType_9=Launch mode {0} not supported for configuration type {1}
66
LaunchConfigurationType_9=Launch mode {0} not supported for configuration type {1}
67
LaunchConfigurationType_7=Launch mode not supported: {0}
67
LaunchConfigurationType_7=Launch mode not supported: {0}
68
LaunchConfigurationType_6=Launch mode combination {0} not supported for configuration type {1}.
68
LaunchConfigurationType_10=There is no launch delegate registered for configuration type {0}, mode {1}
69
LaunchConfigurationType_10=There is no launch delegate registered for configuration type {0}, mode {1}
69
WatchExpression_0=(Watch expressions not supported)
70
WatchExpression_0=(Watch expressions not supported)
70
NullStreamsProxy_0=Null Stream Monitor
71
NullStreamsProxy_0=Null Stream Monitor
(-)core/org/eclipse/debug/internal/core/LaunchConfiguration.java (-12 / +14 lines)
Lines 46-52 Link Here
46
import org.eclipse.debug.core.ILaunchConfiguration;
46
import org.eclipse.debug.core.ILaunchConfiguration;
47
import org.eclipse.debug.core.ILaunchConfigurationType;
47
import org.eclipse.debug.core.ILaunchConfigurationType;
48
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
48
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
49
import org.eclipse.debug.core.ILaunchDelegateProxy;
49
import org.eclipse.debug.core.ILaunchDelegate;
50
import org.eclipse.debug.core.IStatusHandler;
50
import org.eclipse.debug.core.IStatusHandler;
51
import org.eclipse.debug.core.Launch;
51
import org.eclipse.debug.core.Launch;
52
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
52
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
Lines 600-624 Link Here
600
     * @see org.eclipse.debug.core.ILaunchConfiguration#launch(java.lang.String, org.eclipse.core.runtime.IProgressMonitor, boolean, boolean)
600
     * @see org.eclipse.debug.core.ILaunchConfiguration#launch(java.lang.String, org.eclipse.core.runtime.IProgressMonitor, boolean, boolean)
601
     */
601
     */
602
    public ILaunch launch(String mode, IProgressMonitor monitor, boolean build, boolean register) throws CoreException {
602
    public ILaunch launch(String mode, IProgressMonitor monitor, boolean build, boolean register) throws CoreException {
603
    	if (monitor == null) {
604
			monitor = new NullProgressMonitor();
605
		}
603
		// bug 28245 - force the delegate to load in case it is interested in launch notifications
606
		// bug 28245 - force the delegate to load in case it is interested in launch notifications
604
    	Set modes = getModes();
607
    	Set modes = getModes();
605
    	modes.add(mode);
608
    	modes.add(mode);
606
    	ILaunchDelegateProxy[] delegates = getType().getDelegates(modes);
609
    	ILaunchDelegate[] delegates = getType().getDelegates(modes);
607
    	ILaunchConfigurationDelegate delegate = null;
610
    	ILaunchConfigurationDelegate delegate = null;
608
    	if (delegates.length == 1) {
611
    	if (delegates.length == 1) {
609
    		delegate = delegates[0].getDelegate();
612
    		delegate = delegates[0].getDelegate();
610
    	} else if (delegates.length == 0) {
613
    	} else if (delegates.length == 0) {
614
    		monitor.setCanceled(true);
611
    		IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(promptStatus);
615
    		IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(promptStatus);
612
    		handler.handleStatus(delegateNotAvailable, new Object[] {this, mode});
616
    		handler.handleStatus(delegateNotAvailable, new Object[] {this, mode});
613
    		// no delegates TODO:
617
    		IStatus status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "No launch delegate found, cancelling launch and returning", null); //$NON-NLS-1$
614
    		IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), 
615
    				DebugPlugin.INTERNAL_ERROR, "No launch delegate", null); //$NON-NLS-1$
616
    		throw new CoreException(status);
618
    		throw new CoreException(status);
617
    	} else {
619
    	} else {
618
    		// multiple delegates TODO:
620
    		ILaunchDelegate del = getType().getPreferredDelegate(modes);
619
    		IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), 
621
    		if(del == null) {
620
    				DebugPlugin.INTERNAL_ERROR, "Duplicate launch delegates", null); //$NON-NLS-1$
622
	    		IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "Duplicate launch delegates", null); //$NON-NLS-1$
621
    		throw new CoreException(status);
623
	    		throw new CoreException(status);
624
    		}
625
    		delegate = del.getDelegate();
622
    	}
626
    	}
623
    	
627
    	
624
		ILaunchConfigurationDelegate2 delegate2 = null;
628
		ILaunchConfigurationDelegate2 delegate2 = null;
Lines 651-659 Link Here
651
		String attribute = getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String)null);
655
		String attribute = getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String)null);
652
		launch.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, attribute);
656
		launch.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, attribute);
653
		
657
		
654
		if (monitor == null) {
658
				
655
			monitor= new NullProgressMonitor();
656
		}		
657
		// perform initial pre-launch sanity checks
659
		// perform initial pre-launch sanity checks
658
		if (delegate2 != null) {
660
		if (delegate2 != null) {
659
			if (!(delegate2.preLaunchCheck(this, mode, monitor))) {
661
			if (!(delegate2.preLaunchCheck(this, mode, monitor))) {
(-)core/org/eclipse/debug/core/ILaunchDelegateProxy.java (-79 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.core;
12
13
import java.util.Set;
14
15
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
17
18
/**
19
 * A proxy to a launch configuration delegate. Represents a
20
 * launch delegate contributed to the <code>org.eclipse.debug.core.launchDelegates</code>
21
 * extension point. 
22
 * 
23
 * @since 3.3
24
 * <p>
25
 * <strong>EXPERIMENTAL</strong>. This interface has been added as
26
 * part of a work in progress. There is no guarantee that this API will
27
 * remain unchanged during the 3.3 release cycle. Please do not use this API
28
 * without consulting with the Platform/Debug team.
29
 * </p>
30
 */
31
public interface ILaunchDelegateProxy {
32
33
	/**
34
	 * Returns this delegate's unique identifier.
35
	 * 
36
	 * @return launch delegate identifier
37
	 */
38
	public String getId();
39
	
40
	/**
41
	 * Returns a human readable name for this launch delegate
42
	 * or <code>null</code> if none.
43
	 * 
44
	 * @return name or <code>null</code>
45
	 */
46
	public String getName();
47
	
48
	/**
49
	 * Returns the name of the plug-in that contributed this delegate.
50
	 * 
51
	 * @return contributor name
52
	 */
53
	public String getContributorName();
54
	
55
	/**
56
	 * Returns the delegate that performs the actual launch.
57
	 * Causes the delegate to be instantiated.
58
	 * 
59
	 * @return launch delegate
60
	 * @exception CoreException if unable to instantiate the delegate
61
	 */
62
	public ILaunchConfigurationDelegate getDelegate() throws CoreException;
63
	
64
	/**
65
	 * Returns the launch modes this delegate supports.
66
	 * 
67
	 * @return launch modes as a set of launch mode identifiers
68
	 */
69
	public Set getModes();
70
	
71
	/**
72
	 * Returns the launch modes this delegate supports in combination with
73
	 * its modes specified by <code>getModes()</code>.
74
	 * 
75
	 * @return launch options as a set of launch mode identifiers
76
	 */
77
	public Set getOptions();
78
	
79
}
(-)core/org/eclipse/debug/core/ILaunchConfigurationType.java (-12 / +39 lines)
Lines 148-169 Link Here
148
	 * without consulting with the Platform/Debug team.
148
	 * without consulting with the Platform/Debug team.
149
	 * </p>
149
	 * </p>
150
	 */
150
	 */
151
	public ILaunchDelegateProxy[] getDelegates(Set modes) throws CoreException;
151
	public ILaunchDelegate[] getDelegates(Set modes) throws CoreException;
152
	
152
	
153
	/**
153
	/**
154
	 * Returns a collection of all supported launch mode combinations for 
154
	 * Returns the preferred launch delegate for this type in the specified mode set
155
	 * this launch configuration type.
155
	 * @param modes the set of modes to support
156
	 * @return the preferred delegate proxy or <code>null</code> if none
157
	 * @throws CoreException
156
	 * 
158
	 * 
157
	 * @return all supported launch mode combinations
158
	 * @since 3.3
159
	 * @since 3.3
159
	 * <p>
160
	 * 
160
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
161
	 * EXPERIMENTAL
161
	 * part of a work in progress. There is no guarantee that this API will
162
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
163
	 * without consulting with the Platform/Debug team.
164
	 * </p>
165
	 */
162
	 */
166
	public Set[] getSupportedModeCombinations();
163
	public ILaunchDelegate getPreferredDelegate(Set modes) throws CoreException;
164
	
165
	/**
166
	 * Allows the preferred launch delegate to be setfor this type with the specifie set of modes
167
	 * @param delegate the delegate proxy to set as the default one
168
	 * @throws CoreException
169
	 * 
170
	 * @since 3.3
171
	 * 
172
	 * EXPERIMENTAL
173
	 */
174
	public void setPreferredDelegate(Set modes, ILaunchDelegate delegate) throws CoreException;
167
	
175
	
168
	/**
176
	/**
169
	 * Returns whether this launch configuration supports the specified launch
177
	 * Returns whether this launch configuration supports the specified launch
Lines 179-185 Link Here
179
	 * without consulting with the Platform/Debug team.
187
	 * without consulting with the Platform/Debug team.
180
	 * </p>
188
	 * </p>
181
	 */
189
	 */
182
	public boolean supportsModeCombination(Set modes);
190
	public boolean supportsModes(Set modes);
183
	
191
	
184
	/**
192
	/**
185
	 * Returns the unique identifier for this type of launch configuration
193
	 * Returns the unique identifier for this type of launch configuration
Lines 237-248 Link Here
237
	 * Returns all of the registered supported modes for this launch configuration type.
245
	 * Returns all of the registered supported modes for this launch configuration type.
238
	 * This method does not return null.
246
	 * This method does not return null.
239
	 * 
247
	 * 
248
	 * <p>
249
	 * The returned set does not convey any mode combination capability nor does it describe how or what the type can launch, all this method does is return
250
	 * a set of strings of all the modes in some way associated with this type 
251
	 * </p>
252
	 * 
240
	 * @return the set of all supported modes
253
	 * @return the set of all supported modes
241
	 * @since 3.2
254
	 * @since 3.2
255
	 * 
256
	 * @deprecated Since 3.3 all modes are provided as sets and not individual strings. The method <code>getSupportedModeCombinations</code>
257
	 * should be used instead to retrive the complete listing of supported modes and their allowable combinations.
242
	 */
258
	 */
243
	public Set getSupportedModes();
259
	public Set getSupportedModes();
244
	
260
	
245
	/**
261
	/**
262
	 * Returns a <code>java.util.Set</code> of <code>java.util.Set</code>s containing all of the supported mode combinations
263
	 * for this type
264
	 * @return a set of sets of all the supported mode combinations supported by this type
265
	 * 
266
	 * @since 3.3
267
	 * 
268
	 * EXPERIMENTAL
269
	 */
270
	public Set getSupportedModeCombinations();
271
	
272
	/**
246
	 * Returns whether this launch configuration type is public.  Public configuration
273
	 * Returns whether this launch configuration type is public.  Public configuration
247
	 * types are available for use by the user, for example, the user can create new
274
	 * types are available for use by the user, for example, the user can create new
248
	 * configurations based on public types through the UI.  Private types are not
275
	 * configurations based on public types through the UI.  Private types are not
(-)schema/launchModes.exsd (-120 / +118 lines)
Lines 1-120 Link Here
1
<?xml version='1.0' encoding='UTF-8'?>
1
<?xml version='1.0' encoding='UTF-8'?>
2
<!-- Schema file written by PDE -->
2
<!-- Schema file written by PDE -->
3
<schema targetNamespace="org.eclipse.debug.core">
3
<schema targetNamespace="org.eclipse.debug.core">
4
<annotation>
4
<annotation>
5
      <appInfo>
5
      <appInfo>
6
         <meta.schema plugin="org.eclipse.debug.core" id="launchModes" name="Launch Modes"/>
6
         <meta.schema plugin="org.eclipse.debug.core" id="launchModes" name="Launch Modes"/>
7
      </appInfo>
7
      </appInfo>
8
      <documentation>
8
      <documentation>
9
         This extension point provides a mechanism for contributing launch modes to the debug platform. The debug platform defines modes for &quot;run&quot;, &quot;debug&quot;, and &quot;profile&quot;.
9
         This extension point provides a mechanism for contributing launch modes to the debug platform. The debug platform defines modes for &quot;run&quot;, &quot;debug&quot;, and &quot;profile&quot;.
10
      </documentation>
10
      </documentation>
11
   </annotation>
11
   </annotation>
12
12
13
   <element name="extension">
13
   <element name="extension">
14
      <complexType>
14
      <complexType>
15
         <sequence>
15
         <sequence>
16
            <element ref="launchMode" minOccurs="0" maxOccurs="unbounded"/>
16
            <element ref="launchMode" minOccurs="1" maxOccurs="unbounded"/>
17
         </sequence>
17
         </sequence>
18
         <attribute name="point" type="string" use="required">
18
         <attribute name="point" type="string" use="required">
19
            <annotation>
19
            <annotation>
20
               <documentation>
20
               <documentation>
21
                  a fully qualified identifier of the target extension point
21
                  a fully qualified identifier of the target extension point
22
               </documentation>
22
               </documentation>
23
            </annotation>
23
            </annotation>
24
         </attribute>
24
         </attribute>
25
      </complexType>
25
      </complexType>
26
   </element>
26
   </element>
27
27
28
   <element name="launchMode">
28
   <element name="launchMode">
29
      <annotation>
29
      <annotation>
30
         <appInfo>
30
         <appInfo>
31
            <meta.element labelAttribute="name"/>
31
            <meta.element labelAttribute="name"/>
32
         </appInfo>
32
         </appInfo>
33
      </annotation>
33
      </annotation>
34
      <complexType>
34
      <complexType>
35
         <sequence>
35
         <attribute name="mode" type="string" use="required">
36
         </sequence>
36
            <annotation>
37
         <attribute name="mode" type="string" use="required">
37
               <documentation>
38
            <annotation>
38
                  specifies a unique identifier for this launch mode. The launch modes contributed by the debug plaform are &quot;run&quot;, &quot;debug&quot;, and &quot;profile&quot;.
39
               <documentation>
39
               </documentation>
40
                  specifies a unique identifier for this launch mode. The launch modes contributed by the debug plaform are &quot;run&quot;, &quot;debug&quot;, and &quot;profile&quot;.
40
            </annotation>
41
               </documentation>
41
         </attribute>
42
            </annotation>
42
         <attribute name="label" type="string" use="required">
43
         </attribute>
43
            <annotation>
44
         <attribute name="label" type="string" use="required">
44
               <documentation>
45
            <annotation>
45
                  A human-readable label that describes the launch mode
46
               <documentation>
46
               </documentation>
47
                  A human-readable label that describes the launch mode
47
               <appInfo>
48
               </documentation>
48
                  <meta.attribute translatable="true"/>
49
               <appInfo>
49
               </appInfo>
50
                  <meta.attribute translatable="true"/>
50
            </annotation>
51
               </appInfo>
51
         </attribute>
52
            </annotation>
52
         <attribute name="launchAsLabel" type="string">
53
         </attribute>
53
            <annotation>
54
         <attribute name="launchAsLabel" type="string">
54
               <documentation>
55
            <annotation>
55
                  A human-readable label to be used in a launch cascade menu. For example &quot;Run As&quot;. This attribute was added in 3.2 to allow the label to be properly externalized. When unspecified, a default label is created via concatenation.
56
               <documentation>
56
               </documentation>
57
                  A human-readable label to be used in a launch cascade menu. For example &quot;Run As&quot;. This attribute was added in 3.2 to allow the label to be properly externalized. When unspecified, a default label is created via concatenation.
57
               <appInfo>
58
               </documentation>
58
                  <meta.attribute translatable="true"/>
59
               <appInfo>
59
               </appInfo>
60
                  <meta.attribute translatable="true"/>
60
            </annotation>
61
               </appInfo>
61
         </attribute>
62
            </annotation>
62
      </complexType>
63
         </attribute>
63
   </element>
64
      </complexType>
64
65
   </element>
65
   <annotation>
66
66
      <appInfo>
67
   <annotation>
67
         <meta.section type="since"/>
68
      <appInfo>
68
      </appInfo>
69
         <meta.section type="since"/>
69
      <documentation>
70
      </appInfo>
70
         3.0
71
      <documentation>
71
      </documentation>
72
         3.0
72
   </annotation>
73
      </documentation>
73
74
   </annotation>
74
   <annotation>
75
75
      <appInfo>
76
   <annotation>
76
         <meta.section type="examples"/>
77
      <appInfo>
77
      </appInfo>
78
         <meta.section type="examples"/>
78
      <documentation>
79
      </appInfo>
79
         The following is an example of a launch delegate extension point:
80
      <documentation>
80
81
         The following is an example of a launch delegate extension point:
81
&lt;p&gt;
82
82
&lt;pre&gt;
83
&lt;p&gt;
83
 &lt;extension point=&quot;org.eclipse.debug.core.launchModes&quot;&gt;
84
&lt;pre&gt;
84
  &lt;launchMode
85
 &lt;extension point=&quot;org.eclipse.debug.core.launchModes&quot;&gt;
85
   mode=&quot;profile&quot;
86
  &lt;launchMode
86
   label=&quot;Profile&quot;&gt;
87
   mode=&quot;profile&quot;
87
  &lt;/launchMode&gt;
88
   label=&quot;Profile&quot;&gt;
88
 &lt;/extension&gt;
89
  &lt;/launchMode&gt;
89
&lt;/pre&gt;
90
 &lt;/extension&gt;
90
&lt;/p&gt;
91
&lt;/pre&gt;
91
92
&lt;/p&gt;
92
In the example above, the profile launch mode is contributed.
93
93
      </documentation>
94
In the example above, the profile launch mode is contributed.
94
   </annotation>
95
      </documentation>
95
96
   </annotation>
96
   <annotation>
97
97
      <appInfo>
98
   <annotation>
98
         <meta.section type="apiInfo"/>
99
      <appInfo>
99
      </appInfo>
100
         <meta.section type="apiInfo"/>
100
      <documentation>
101
      </appInfo>
101
         
102
      <documentation>
102
      </documentation>
103
         
103
   </annotation>
104
      </documentation>
104
105
   </annotation>
105
   <annotation>
106
106
      <appInfo>
107
   <annotation>
107
         <meta.section type="copyright"/>
108
      <appInfo>
108
      </appInfo>
109
         <meta.section type="copyright"/>
109
      <documentation>
110
      </appInfo>
110
         Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
111
      <documentation>
111
All rights reserved. This program and the accompanying materials are made 
112
         Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
112
available under the terms of the Eclipse Public License v1.0 which 
113
All rights reserved. This program and the accompanying materials are made 
113
accompanies this distribution, and is available at 
114
available under the terms of the Eclipse Public License v1.0 which 
114
&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
115
accompanies this distribution, and is available at 
115
      </documentation>
116
&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
116
   </annotation>
117
      </documentation>
117
118
   </annotation>
118
</schema>
119
120
</schema>
(-)schema/launchDelegates.exsd (-185 / +217 lines)
Lines 1-185 Link Here
1
<?xml version='1.0' encoding='UTF-8'?>
1
<?xml version='1.0' encoding='UTF-8'?>
2
<!-- Schema file written by PDE -->
2
<!-- Schema file written by PDE -->
3
<schema targetNamespace="org.eclipse.debug.core">
3
<schema targetNamespace="org.eclipse.debug.core">
4
<annotation>
4
<annotation>
5
      <appInfo>
5
      <appInfo>
6
         <meta.schema plugin="org.eclipse.debug.core" id="launchDelegates" name="Launch Delegates"/>
6
         <meta.schema plugin="org.eclipse.debug.core" id="launchDelegates" name="Launch Delegates"/>
7
      </appInfo>
7
      </appInfo>
8
      <documentation>
8
      <documentation>
9
         This extension point provides a mechanism for contributing a launch delegate to an existing launch configuration type for one or more launch modes. Since launch modes are extensible, it may be neccessary to contribute additional launch delegates to an existing launch configuration type. Each launch delegate is contributed for a specific launch configuration type. A launch delegate supports one or more launch modes, and specifies a delegate responsible for the implementation of launching.
9
         This extension point provides a mechanism for contributing a launch delegate to an existing launch configuration type for one or more launch modes. Since launch modes are extensible, it may be neccessary to contribute additional launch delegates to an existing launch configuration type. Each launch delegate is contributed for a specific launch configuration type. A launch delegate supports one or more launch modes, and specifies a delegate responsible for the implementation of launching.
10
      </documentation>
10
      </documentation>
11
   </annotation>
11
   </annotation>
12
12
13
   <element name="extension">
13
   <element name="extension">
14
      <complexType>
14
      <complexType>
15
         <sequence>
15
         <sequence>
16
            <element ref="launchDelegate" minOccurs="1" maxOccurs="unbounded"/>
16
            <element ref="launchDelegate" minOccurs="1" maxOccurs="unbounded"/>
17
         </sequence>
17
         </sequence>
18
         <attribute name="point" type="string" use="required">
18
         <attribute name="point" type="string" use="required">
19
            <annotation>
19
            <annotation>
20
               <documentation>
20
               <documentation>
21
                  a fully qualified identifier of the target extension point
21
                  a fully qualified identifier of the target extension point
22
               </documentation>
22
               </documentation>
23
            </annotation>
23
            </annotation>
24
         </attribute>
24
         </attribute>
25
         <attribute name="id" type="string">
25
         <attribute name="id" type="string">
26
            <annotation>
26
            <annotation>
27
               <documentation>
27
               <documentation>
28
                  an optional identifier of the extension instance
28
                  an optional identifier of the extension instance
29
               </documentation>
29
               </documentation>
30
            </annotation>
30
            </annotation>
31
         </attribute>
31
         </attribute>
32
         <attribute name="name" type="string">
32
         <attribute name="name" type="string">
33
            <annotation>
33
            <annotation>
34
               <documentation>
34
               <documentation>
35
                  an optional name of the extension instance
35
                  an optional name of the extension instance
36
               </documentation>
36
               </documentation>
37
            </annotation>
37
            </annotation>
38
         </attribute>
38
         </attribute>
39
      </complexType>
39
      </complexType>
40
   </element>
40
   </element>
41
41
42
   <element name="launchDelegate">
42
   <element name="launchDelegate">
43
      <annotation>
43
      <annotation>
44
         <appInfo>
44
         <appInfo>
45
            <meta.element labelAttribute="name"/>
45
            <meta.element labelAttribute="name"/>
46
         </appInfo>
46
         </appInfo>
47
      </annotation>
47
      </annotation>
48
      <complexType>
48
      <complexType>
49
         <attribute name="id" type="string" use="required">
49
         <sequence minOccurs="0" maxOccurs="unbounded">
50
            <annotation>
50
            <element ref="modeCombination" minOccurs="1" maxOccurs="unbounded"/>
51
               <documentation>
51
         </sequence>
52
                  specifies a unique identifier for this launch delegate.
52
         <attribute name="id" type="string" use="required">
53
               </documentation>
53
            <annotation>
54
            </annotation>
54
               <documentation>
55
         </attribute>
55
                  specifies a unique identifier for this launch delegate.
56
         <attribute name="name" type="string">
56
               </documentation>
57
            <annotation>
57
            </annotation>
58
               <documentation>
58
         </attribute>
59
                  A human readable name for this delegate. This attribute was added in the 3.3. release.
59
         <attribute name="name" type="string">
60
60
            <annotation>
61
&lt;p&gt;
61
               <documentation>
62
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This attribute has been added as
62
                  A human readable name for this delegate. This attribute was added in the 3.3. release.
63
part of a work in progress. There is no guarantee that this API will
63
64
remain unchanged during the 3.3 release cycle. Please do not use this API
64
&lt;p&gt;
65
without consulting with the Platform/Debug team.
65
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This attribute has been added as
66
&lt;/p&gt;
66
part of a work in progress. There is no guarantee that this API will
67
               </documentation>
67
remain unchanged during the 3.3 release cycle. Please do not use this API
68
               <appInfo>
68
without consulting with the Platform/Debug team.
69
                  <meta.attribute translatable="true"/>
69
&lt;/p&gt;
70
               </appInfo>
70
               </documentation>
71
            </annotation>
71
               <appInfo>
72
         </attribute>
72
                  <meta.attribute translatable="true"/>
73
         <attribute name="delegate" type="string" use="required">
73
               </appInfo>
74
            <annotation>
74
            </annotation>
75
               <documentation>
75
         </attribute>
76
                  specifies the fully qualified name of the Java class that implements &lt;code&gt;ILaunchConfigurationDelegate&lt;/code&gt;.
76
         <attribute name="delegate" type="string" use="required">
77
Launch configuration instances of this delegate&apos;s type will delegate to instances of this class to perform launching.
77
            <annotation>
78
               </documentation>
78
               <documentation>
79
               <appInfo>
79
                  specifies the fully qualified name of the Java class that implements &lt;code&gt;ILaunchConfigurationDelegate&lt;/code&gt;.
80
                  <meta.attribute kind="java" basedOn="org.eclipse.debug.core.model.ILaunchConfigurationDelegate"/>
80
Launch configuration instances of this delegate&apos;s type will delegate to instances of this class to perform launching.
81
               </appInfo>
81
               </documentation>
82
            </annotation>
82
               <appInfo>
83
         </attribute>
83
                  <meta.attribute kind="java" basedOn="org.eclipse.debug.core.model.ILaunchConfigurationDelegate"/>
84
         <attribute name="modes" type="string">
84
               </appInfo>
85
            <annotation>
85
            </annotation>
86
               <documentation>
86
         </attribute>
87
                  A comma-separated list of the launch modes this lauch delegate supports.
87
         <attribute name="modes" type="string">
88
               </documentation>
88
            <annotation>
89
            </annotation>
89
               <documentation>
90
         </attribute>
90
                  A comma-separated list of the launch modes this delegate supports.
91
         <attribute name="type" type="string">
91
               </documentation>
92
            <annotation>
92
            </annotation>
93
               <documentation>
93
         </attribute>
94
                  identifier of an existing launch configuration type that this launch delegate is capable of launching.
94
         <attribute name="type" type="string">
95
               </documentation>
95
            <annotation>
96
            </annotation>
96
               <documentation>
97
         </attribute>
97
                  identifier of an existing launch configuration type that this launch delegate is capable of launching.
98
         <attribute name="sourcePathComputerId" type="string">
98
               </documentation>
99
            <annotation>
99
            </annotation>
100
               <documentation>
100
         </attribute>
101
                  The unique identifier of a sourcePathComputer extension that is used to compute a default source lookup path for launch configurations of this type. Since 3.1, this attribute cab be specified in a launchDelegate extension when unspecified in the assocaited launchConfigurationType extension. Only one source path computer can be specified per launch configuration type.
101
         <attribute name="sourcePathComputerId" type="string">
102
               </documentation>
102
            <annotation>
103
            </annotation>
103
               <documentation>
104
         </attribute>
104
                  The unique identifier of a sourcePathComputer extension that is used to compute a default source lookup path for launch configurations of this type. Since 3.1, this attribute cab be specified in a launchDelegate extension when unspecified in the assocaited launchConfigurationType extension. Only one source path computer can be specified per launch configuration type.
105
         <attribute name="sourceLocatorId" type="string">
105
               </documentation>
106
            <annotation>
106
            </annotation>
107
               <documentation>
107
         </attribute>
108
                  The unique identifier of a sourceLocator extension that is used to create the source locator for sessions launched using launch configurations of this type. Since 3.1, this attribute can be specified in a launchDelegate extension when unspecified in the assocaited launchConfigurationType extension. Only one source locater can be specified per launch configuration type.
108
         <attribute name="sourceLocatorId" type="string">
109
               </documentation>
109
            <annotation>
110
            </annotation>
110
               <documentation>
111
         </attribute>
111
                  The unique identifier of a sourceLocator extension that is used to create the source locator for sessions launched using launch configurations of this type. Since 3.1, this attribute can be specified in a launchDelegate extension when unspecified in the assocaited launchConfigurationType extension. Only one source locater can be specified per launch configuration type.
112
         <attribute name="options" type="string">
112
               </documentation>
113
            <annotation>
113
            </annotation>
114
               <documentation>
114
         </attribute>
115
                  A comma-separated list of launch modes this launch delegate supports in combination with its supported modes. This attribute was added in the 3.3 release to allow configurations to be launched in a mixed mode.
115
         <attribute name="options" type="string">
116
116
            <annotation>
117
&lt;p&gt;
117
               <documentation>
118
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This attribute has been added as
118
                  A comma-separated list of launch modes this launch delegate supports in combination with its supported modes. This attribute was added in the 3.3 release to allow configurations to be launched in a mixed mode.
119
part of a work in progress. There is no guarantee that this API will
119
120
remain unchanged during the 3.3 release cycle. Please do not use this API
120
&lt;p&gt;
121
without consulting with the Platform/Debug team.
121
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This attribute has been added as
122
&lt;/p&gt;
122
part of a work in progress. There is no guarantee that this API will
123
               </documentation>
123
remain unchanged during the 3.3 release cycle. Please do not use this API
124
            </annotation>
124
without consulting with the Platform/Debug team.
125
         </attribute>
125
&lt;/p&gt;
126
      </complexType>
126
               </documentation>
127
   </element>
127
            </annotation>
128
128
         </attribute>
129
   <annotation>
129
      </complexType>
130
      <appInfo>
130
   </element>
131
         <meta.section type="since"/>
131
132
      </appInfo>
132
   <element name="modeCombination">
133
      <documentation>
133
      <annotation>
134
         3.0
134
         <documentation>
135
      </documentation>
135
            This element represents a collection of mode combinations that this delegate can launch. Each entry of a modeCombination is a comma seperated listing of a single combination of modes the delegate supports.
136
   </annotation>
136
137
137
For example, a delegate that supports debugging, profiling and code coverage might have a modeCombination of:
138
   <annotation>
138
139
      <appInfo>
139
[debug, profile, coverage]
140
         <meta.section type="examples"/>
140
141
      </appInfo>
141
since 3.3
142
      <documentation>
142
143
         The following is an example of a launch delegate extension point:
143
EXPERIMENTAL
144
144
         </documentation>
145
&lt;p&gt;
145
      </annotation>
146
&lt;pre&gt;
146
      <complexType>
147
 &lt;extension point=&quot;org.eclipse.debug.core.launchDelegates&quot;&gt;
147
         <attribute name="modes" type="string" use="required">
148
  &lt;launchDelegate
148
            <annotation>
149
   id=&quot;com.example.ExampleProfileDelegate&quot;
149
               <documentation>
150
   delegate=&quot;com.example.ExampleProfileDelegate&quot;
150
                  the modes attribute represents a comma seperated listing of a combination of modes that the associated delegate can launch
151
   type=&quot;org.eclipse.jdt.launching.localJavaApplication&quot;
151
152
   modes=&quot;profile&quot;
152
since 3.3
153
   options&quot;run, debug&quot;&gt;
153
154
  &lt;/launchDelegate&gt;
154
EXPERIMENTAL
155
 &lt;/extension&gt;
155
               </documentation>
156
&lt;/pre&gt;
156
            </annotation>
157
&lt;/p&gt;
157
         </attribute>
158
158
      </complexType>
159
In the example above, the specified launch delegate is contributed to launch Java applications in profile mode. The delegate supports mixed mode launching. The delegate supports profiling when launching in run or debug mode.
159
   </element>
160
      </documentation>
160
161
   </annotation>
161
   <annotation>
162
162
      <appInfo>
163
   <annotation>
163
         <meta.section type="since"/>
164
      <appInfo>
164
      </appInfo>
165
         <meta.section type="apiInfo"/>
165
      <documentation>
166
      </appInfo>
166
         3.0
167
      <documentation>
167
      </documentation>
168
         Value of the attribute &lt;b&gt;delegate&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.debug.core.model.ILaunchConfigurationDelegate&lt;/b&gt;.
168
   </annotation>
169
      </documentation>
169
170
   </annotation>
170
   <annotation>
171
171
      <appInfo>
172
   <annotation>
172
         <meta.section type="examples"/>
173
      <appInfo>
173
      </appInfo>
174
         <meta.section type="copyright"/>
174
      <documentation>
175
      </appInfo>
175
         The following is an example of a launch delegate extension point:
176
      <documentation>
176
177
         Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
177
&lt;p&gt;
178
All rights reserved. This program and the accompanying materials are made 
178
&lt;pre&gt;
179
available under the terms of the Eclipse Public License v1.0 which 
179
 &lt;extension point=&quot;org.eclipse.debug.core.launchDelegates&quot;&gt;
180
accompanies this distribution, and is available at 
180
  &lt;launchDelegate
181
&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
181
   id=&quot;com.example.ExampleProfileDelegate&quot;
182
      </documentation>
182
   delegate=&quot;com.example.ExampleProfileDelegate&quot;
183
   </annotation>
183
   type=&quot;org.eclipse.jdt.launching.localJavaApplication&quot;&gt;
184
184
  &lt;/launchDelegate&gt;
185
</schema>
185
  &lt;modeCombination modes=&quot;run, profile&quot;&gt;&lt;/modeCombination&gt;
186
  &lt;modeCombination modes=&quot;debug, profile, coverage&quot;&gt;&lt;/modeCombination&gt;
187
 &lt;/extension&gt;
188
&lt;/pre&gt;
189
&lt;/p&gt;
190
191
In the example above, the specified launch delegate is contributed to launch Java applications in profile mode. The delegate supports mixed mode launching. The delegate supports profiling when launching in run or debug mode, with code coverage in debug mode only.
192
      </documentation>
193
   </annotation>
194
195
   <annotation>
196
      <appInfo>
197
         <meta.section type="apiInfo"/>
198
      </appInfo>
199
      <documentation>
200
         Value of the attribute &lt;b&gt;delegate&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.debug.core.model.ILaunchConfigurationDelegate&lt;/b&gt;.
201
      </documentation>
202
   </annotation>
203
204
   <annotation>
205
      <appInfo>
206
         <meta.section type="copyright"/>
207
      </appInfo>
208
      <documentation>
209
         Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
210
All rights reserved. This program and the accompanying materials are made 
211
available under the terms of the Eclipse Public License v1.0 which 
212
accompanies this distribution, and is available at 
213
&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
214
      </documentation>
215
   </annotation>
216
217
</schema>
(-)core/org/eclipse/debug/core/ILaunchDelegate.java (+72 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.core;
12
13
import java.util.List;
14
15
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
17
18
/**
19
 * A proxy to a launch configuration delegate. Represents a
20
 * launch delegate contributed to the <code>org.eclipse.debug.core.launchDelegates</code>
21
 * extension point. 
22
 * 
23
 * @since 3.3
24
 * <p>
25
 * <strong>EXPERIMENTAL</strong>. This interface has been added as
26
 * part of a work in progress. There is no guarantee that this API will
27
 * remain unchanged during the 3.3 release cycle. Please do not use this API
28
 * without consulting with the Platform/Debug team.
29
 * </p>
30
 */
31
public interface ILaunchDelegate {
32
33
	/**
34
	 * Returns this delegate's unique identifier.
35
	 * 
36
	 * @return launch delegate identifier
37
	 */
38
	public String getId();
39
	
40
	/**
41
	 * Returns a human readable name for this launch delegate
42
	 * or <code>null</code> if none.
43
	 * 
44
	 * @return name or <code>null</code>
45
	 */
46
	public String getName();
47
	
48
	/**
49
	 * Returns the name of the plug-in that contributed this delegate.
50
	 * 
51
	 * @return contributor name
52
	 */
53
	public String getContributorName();
54
	
55
	/**
56
	 * Returns the delegate that performs the actual launch.
57
	 * Causes the delegate to be instantiated.
58
	 * 
59
	 * @return launch delegate
60
	 * @exception CoreException if unable to instantiate the delegate
61
	 */
62
	public ILaunchConfigurationDelegate getDelegate() throws CoreException;
63
	
64
	/**
65
	 * Returns the complete set of launch modes as a list of sets.
66
	 * If no modes are available an empty list is returned, never <code>null</code>
67
	 * @return the complete set of launch modes for this delegate as a list
68
	 * of sets
69
	 */
70
	public List getModes();
71
	
72
}
(-)ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java (+4 lines)
Lines 49-54 Link Here
49
	public static String DebugPreferencePage_26;
49
	public static String DebugPreferencePage_26;
50
	public static String DebugPreferencePage_27;
50
	public static String DebugPreferencePage_27;
51
51
52
	public static String LaunchDelegatesPreferencePage_0;
53
54
	public static String LaunchDelegatesPreferencePage_1;
55
52
	public static String LaunchingPreferencePage_1;
56
	public static String LaunchingPreferencePage_1;
53
	public static String LaunchingPreferencePage_2;
57
	public static String LaunchingPreferencePage_2;
54
	public static String LaunchingPreferencePage_3;
58
	public static String LaunchingPreferencePage_3;
(-)ui/org/eclipse/debug/internal/ui/preferences/PerspectivePreferencePage.java (-12 / +23 lines)
Lines 13-19 Link Here
13
13
14
import java.io.IOException;
14
import java.io.IOException;
15
import java.io.StringReader;
15
import java.io.StringReader;
16
import com.ibm.icu.text.MessageFormat;
17
import java.util.ArrayList;
16
import java.util.ArrayList;
18
import java.util.HashMap;
17
import java.util.HashMap;
19
import java.util.Iterator;
18
import java.util.Iterator;
Lines 47-52 Link Here
47
import org.eclipse.swt.events.SelectionAdapter;
46
import org.eclipse.swt.events.SelectionAdapter;
48
import org.eclipse.swt.events.SelectionEvent;
47
import org.eclipse.swt.events.SelectionEvent;
49
import org.eclipse.swt.graphics.Font;
48
import org.eclipse.swt.graphics.Font;
49
import org.eclipse.swt.graphics.Point;
50
import org.eclipse.swt.layout.GridData;
50
import org.eclipse.swt.layout.GridData;
51
import org.eclipse.swt.layout.GridLayout;
51
import org.eclipse.swt.layout.GridLayout;
52
import org.eclipse.swt.widgets.Combo;
52
import org.eclipse.swt.widgets.Combo;
Lines 71-76 Link Here
71
import org.xml.sax.SAXException;
71
import org.xml.sax.SAXException;
72
import org.xml.sax.helpers.DefaultHandler;
72
import org.xml.sax.helpers.DefaultHandler;
73
73
74
import com.ibm.icu.text.MessageFormat;
75
74
/**
76
/**
75
 * Provides one place to set perspective preferences
77
 * Provides one place to set perspective preferences
76
 * 
78
 * 
Lines 254-285 Link Here
254
								HashMap map = (HashMap) fTypeInformationMapping.get(typeobj);
256
								HashMap map = (HashMap) fTypeInformationMapping.get(typeobj);
255
								if(map == null) {
257
								if(map == null) {
256
									map = new HashMap();
258
									map = new HashMap();
257
								}//end if
259
								}
258
								map.put(mode, (perspective != null ? perspective : IDebugUIConstants.PERSPECTIVE_NONE));
260
								map.put(mode, (perspective != null ? perspective : IDebugUIConstants.PERSPECTIVE_NONE));
259
								fTypeInformationMapping.put(typeobj, map);
261
								fTypeInformationMapping.put(typeobj, map);
260
							}//end if
262
							}
261
						}// end if
263
						}
262
					}// end if
264
					}
263
				}// end for
265
				}
264
			}// end try
266
			}
265
			catch (ParserConfigurationException e) {DebugUIPlugin.log(e);} 
267
			catch (ParserConfigurationException e) {DebugUIPlugin.log(e);} 
266
			catch (SAXException e) {DebugUIPlugin.log(e);}
268
			catch (SAXException e) {DebugUIPlugin.log(e);}
267
			catch (IOException e) {DebugUIPlugin.log(e);}
269
			catch (IOException e) {DebugUIPlugin.log(e);}
268
		}// end if
270
		}
269
		perspec.load();
271
		perspec.load();
270
		suspend.load();
272
		suspend.load();
271
		TreeItem item = findLastSelected(getPreferenceStore().getString(LAST_SELECTED_CONFIGTYPE));
273
		TreeItem item = findLastSelected(getPreferenceStore().getString(LAST_SELECTED_CONFIGTYPE));
272
		if (item != null) {
274
		if (item != null) {
273
			fTree.setSelection(new TreeItem[] { item });
275
			fTree.setSelection(new TreeItem[] { item });
274
		}// end if
276
		}
275
		else {
277
		else {
276
			if(fTree.getItemCount() > 0) {
278
			if(fTree.getItemCount() > 0) {
277
				fTree.setSelection(new TreeItem[] { fTree.getItem(0) });
279
				fTree.setSelection(new TreeItem[] { fTree.getItem(0) });
278
			}
280
			}
279
		}// end else
281
		}
280
		fCurrentType = (ILaunchConfigurationType) ((IStructuredSelection) fViewer.getSelection()).getFirstElement();
282
		fCurrentType = (ILaunchConfigurationType) ((IStructuredSelection) fViewer.getSelection()).getFirstElement();
281
		buildComboBoxes(fCurrentType);
283
		buildComboBoxes(fCurrentType);
282
	}// restoreState
284
	}
283
285
284
	/**
286
	/**
285
	 * Sets the default perspectives for the modes of an ILaunchConfiguration
287
	 * Sets the default perspectives for the modes of an ILaunchConfiguration
Lines 373-381 Link Here
373
				}
375
				}
374
			}
376
			}
375
		}
377
		}
376
		fPerspectiveComp.layout();
378
		fPerspectiveComp.layout(new Control[] {fComboPlaceHolder});
379
		resizeShell();
377
	}
380
	}
378
381
382
	private void resizeShell() {
383
		Point pnt = this.getShell().getSize();
384
		Point p = this.getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
385
		if(pnt.x < p.x) {
386
			this.getShell().setSize(p);
387
		}
388
	}
389
	
379
	/**
390
	/**
380
	 * Handles the change in selection from the launch configuration listing
391
	 * Handles the change in selection from the launch configuration listing
381
	 * 
392
	 * 
(-)ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties (+2 lines)
Lines 123-125 Link Here
123
LaunchConfigurationsPreferencePage_1=Launch Configurations
123
LaunchConfigurationsPreferencePage_1=Launch Configurations
124
LaunchConfigurationsPreferencePage_2=Delete configurations when associated project is deleted
124
LaunchConfigurationsPreferencePage_2=Delete configurations when associated project is deleted
125
LaunchConfigurationsPreferencePage_3=Apply window &working set(s)
125
LaunchConfigurationsPreferencePage_3=Apply window &working set(s)
126
LaunchDelegatesPreferencePage_0=Launch Delegates
127
LaunchDelegatesPreferencePage_1=The settings on this page are used to select a preferred launch delegate in the event there are duplicates.
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchModesDialog.java (-12 / +16 lines)
Lines 12-17 Link Here
12
12
13
import java.util.ArrayList;
13
import java.util.ArrayList;
14
import java.util.Arrays;
14
import java.util.Arrays;
15
import java.util.Iterator;
15
import java.util.List;
16
import java.util.List;
16
import java.util.Set;
17
import java.util.Set;
17
18
Lines 68-96 Link Here
68
		public void removeListener(ILabelProviderListener listener) {}
69
		public void removeListener(ILabelProviderListener listener) {}
69
	}
70
	}
70
	
71
	
71
	private static final String SETTINGS_ID = IDebugUIConstants.PLUGIN_ID + ".SELECT_LAUNCH_OPTIONS_DIALOG"; //$NON-NLS-1$
72
	private static final String SETTINGS_ID = IDebugUIConstants.PLUGIN_ID + ".SELECT_LAUNCH_MODES_DIALOG"; //$NON-NLS-1$
72
	
73
	
73
	private CheckboxTableViewer fTableViewer = null;
74
	private CheckboxTableViewer fTableViewer = null;
74
	private Table fTable  = null;
75
	private Table fTable  = null;
75
	private List fValidCombinations;
76
	private List fValidModes = null;
76
	
77
	
77
	/**
78
	/**
78
	 * Constructor
79
	 * Constructor
79
	 * @param parentShell the parent shell
80
	 * @param parentShell the parent shell
80
	 * @param message the message for the dialog
81
	 * @param mode the current mode context
81
	 * @param options the listing of arrays of options (each entry in the list must be an <code>Set</code> of options)
82
	 * @param configuration the current launch configuration context
83
	 * 
84
	 * @throws CoreException
82
	 */
85
	 */
83
	public SelectLaunchModesDialog(Shell parentShell, String mode, ILaunchConfiguration configuration) throws CoreException {
86
	public SelectLaunchModesDialog(Shell parentShell, String mode, ILaunchConfiguration configuration) throws CoreException {
84
		super(parentShell);
87
		super(parentShell);
85
		super.setMessage(LaunchConfigurationsMessages.SelectLaunchOptionsDialog_2);
88
		super.setMessage(LaunchConfigurationsMessages.SelectLaunchOptionsDialog_2);
86
		super.setTitle(LaunchConfigurationsMessages.SelectLaunchOptionsDialog_3);
89
		super.setTitle(LaunchConfigurationsMessages.SelectLaunchOptionsDialog_3);
87
		setShellStyle(getShellStyle() | SWT.RESIZE);
90
		setShellStyle(getShellStyle() | SWT.RESIZE);
88
		Set[] combinations = configuration.getType().getSupportedModeCombinations();
91
		fValidModes = new ArrayList();
89
		fValidCombinations = new ArrayList();
92
		Set modes = configuration.getType().getSupportedModeCombinations();
90
		for (int i = 0; i < combinations.length; i++) {
93
		Set modeset = null;
91
			Set set = combinations[i];
94
		for(Iterator iter = modes.iterator(); iter.hasNext();) {
92
			if (set.contains(mode)) {
95
			modeset = (Set) iter.next();
93
				fValidCombinations.add(set);
96
			if(modeset.contains(mode)) {
97
				fValidModes.add(modeset);
94
			}
98
			}
95
		}
99
		}
96
	}
100
	}
Lines 107-113 Link Here
107
		fTableViewer = new CheckboxTableViewer(fTable);
111
		fTableViewer = new CheckboxTableViewer(fTable);
108
		fTableViewer.setLabelProvider(new OptionsLabelProvider());
112
		fTableViewer.setLabelProvider(new OptionsLabelProvider());
109
		fTableViewer.setContentProvider(new ArrayContentProvider());
113
		fTableViewer.setContentProvider(new ArrayContentProvider());
110
		fTableViewer.setInput(fValidCombinations.toArray());
114
		fTableViewer.setInput(fValidModes.toArray());
111
		fTableViewer.addCheckStateListener(new ICheckStateListener() {
115
		fTableViewer.addCheckStateListener(new ICheckStateListener() {
112
			public void checkStateChanged(CheckStateChangedEvent event) {
116
			public void checkStateChanged(CheckStateChangedEvent event) {
113
				fTableViewer.setAllChecked(false);
117
				fTableViewer.setAllChecked(false);
Lines 115-121 Link Here
115
			}
119
			}
116
		});
120
		});
117
		Dialog.applyDialogFont(comp);
121
		Dialog.applyDialogFont(comp);
118
		PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IDebugHelpContextIds.SELECT_LAUNCH_OPTIONS_DIALOG);
122
		PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IDebugHelpContextIds.SELECT_LAUNCH_MODES_DIALOG);
119
		return comp;
123
		return comp;
120
	}
124
	}
121
125
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties (+5 lines)
Lines 56-61 Link Here
56
LaunchConfigurationTabGroupViewer_9=The file associated with this launch configuration is read-only and cannot be modified.\n
56
LaunchConfigurationTabGroupViewer_9=The file associated with this launch configuration is read-only and cannot be modified.\n
57
LaunchConfigurationTabGroupViewer_13=Select a supported <a>launch mode</a>.
57
LaunchConfigurationTabGroupViewer_13=Select a supported <a>launch mode</a>.
58
LaunchConfigurationTabGroupViewer_14=Mixed launch mode not supported: {0}
58
LaunchConfigurationTabGroupViewer_14=Mixed launch mode not supported: {0}
59
LaunchConfigurationTabGroupViewer_15=Select a preferred <a>launch delegate</a>.
60
LaunchConfigurationTabGroupViewer_16=There are duplicate launch delegates for mixed mode: {0}
59
61
60
LaunchConfigurationDialog_Create__manage__and_run_launch_configurations_8=Create, manage, and run configurations
62
LaunchConfigurationDialog_Create__manage__and_run_launch_configurations_8=Create, manage, and run configurations
61
LaunchConfigurationDialog_Dele_te_14=De&lete
63
LaunchConfigurationDialog_Dele_te_14=De&lete
Lines 172-174 Link Here
172
SelectLaunchOptionsDialog_2=A plug-in that once provided the ability to launch the saved set of launch options for the current launch configuration is no longer available. As such, you must select a valid set of launch options that can be launched
174
SelectLaunchOptionsDialog_2=A plug-in that once provided the ability to launch the saved set of launch options for the current launch configuration is no longer available. As such, you must select a valid set of launch options that can be launched
173
SelectLaunchOptionsDialog_3=Select Launch Mode
175
SelectLaunchOptionsDialog_3=Select Launch Mode
174
SelectLaunchOptionsDialog_4=&Select a supported mode combination:
176
SelectLaunchOptionsDialog_4=&Select a supported mode combination:
177
SelectLaunchDelegatesDialog_0=There is more than one launch delegate capable of launching the current configuration in the current mode. Please select which launch delegate you would like to use to continue launching.
178
SelectLaunchDelegatesDialog_1=Select Launch Delegate
179
SelectLaunchDelegatesDialog_2=Select a &preferred launch delegate:
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java (-1 / +1 lines)
Lines 68-74 Link Here
68
	public void updateButtons() {
68
	public void updateButtons() {
69
		// Launch button
69
		// Launch button
70
		getTabViewer().refresh();
70
		getTabViewer().refresh();
71
		getButton(ID_LAUNCH_BUTTON).setEnabled(getTabViewer().canLaunch() & getTabViewer().canLaunchWithOptions());
71
		getButton(ID_LAUNCH_BUTTON).setEnabled(getTabViewer().canLaunch() & getTabViewer().canLaunchWithModes() & !getTabViewer().hasDuplicateDelegates());
72
		
72
		
73
	}
73
	}
74
		
74
		
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java (-34 / +83 lines)
Lines 11-16 Link Here
11
package org.eclipse.debug.internal.ui.launchConfigurations;
11
package org.eclipse.debug.internal.ui.launchConfigurations;
12
12
13
13
14
import java.util.HashSet;
14
import java.util.List;
15
import java.util.List;
15
import java.util.Set;
16
import java.util.Set;
16
17
Lines 23-28 Link Here
23
import org.eclipse.debug.core.ILaunchConfiguration;
24
import org.eclipse.debug.core.ILaunchConfiguration;
24
import org.eclipse.debug.core.ILaunchConfigurationType;
25
import org.eclipse.debug.core.ILaunchConfigurationType;
25
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
26
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
27
import org.eclipse.debug.core.ILaunchDelegate;
26
import org.eclipse.debug.internal.ui.DebugUIPlugin;
28
import org.eclipse.debug.internal.ui.DebugUIPlugin;
27
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
29
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
28
import org.eclipse.debug.internal.ui.SWTUtil;
30
import org.eclipse.debug.internal.ui.SWTUtil;
Lines 284-292 Link Here
284
		
286
		
285
		Composite blComp = SWTUtil.createComposite(mainComp, mainComp.getFont(), 2, 1, GridData.FILL_HORIZONTAL);
287
		Composite blComp = SWTUtil.createComposite(mainComp, mainComp.getFont(), 2, 1, GridData.FILL_HORIZONTAL);
286
		Composite linkComp = SWTUtil.createComposite(blComp, blComp.getFont(), 1, 1, GridData.FILL_HORIZONTAL);
288
		Composite linkComp = SWTUtil.createComposite(blComp, blComp.getFont(), 1, 1, GridData.FILL_HORIZONTAL);
287
//		a link for launch options
289
290
	//a link for launch options
288
		fOptionsLink = new Link(linkComp, SWT.NONE);
291
		fOptionsLink = new Link(linkComp, SWT.NONE);
289
		fOptionsLink.setText(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_13);
292
		
290
		fOptionsLink.setFont(linkComp.getFont());
293
		fOptionsLink.setFont(linkComp.getFont());
291
		gd = new GridData(GridData.BEGINNING);
294
		gd = new GridData(GridData.BEGINNING);
292
		fOptionsLink.setLayoutData(gd);
295
		fOptionsLink.setLayoutData(gd);
Lines 294-316 Link Here
294
			public void widgetSelected(SelectionEvent e) {
297
			public void widgetSelected(SelectionEvent e) {
295
				//collect the options available
298
				//collect the options available
296
				try {
299
				try {
297
					SelectLaunchModesDialog sld = new SelectLaunchModesDialog(getShell(), 
300
					if(!canLaunchWithModes()) {
298
							getLaunchConfigurationDialog().getMode(), getWorkingCopy());
301
						SelectLaunchModesDialog sld = new SelectLaunchModesDialog(getShell(), 
299
					if(sld.open() == IDialogConstants.OK_ID) {
302
								getLaunchConfigurationDialog().getMode(), getWorkingCopy());
300
						//set the options to the config
303
						if(sld.open() == IDialogConstants.OK_ID) {
301
						Object[] res = sld.getResult();
304
							//set the options to the config
302
						if(res != null) {
305
							Object[] res = sld.getResult();
303
							Set modes = (Set) res[0];
306
							if(res != null) {
304
							modes.remove(getLaunchConfigurationDialog().getMode());
307
								Set modes = (Set) res[0];
305
							ILaunchConfigurationWorkingCopy wc = getWorkingCopy();
308
								modes.remove(getLaunchConfigurationDialog().getMode());
306
							wc.setModes(modes);
309
								ILaunchConfigurationWorkingCopy wc = getWorkingCopy();
307
							refresh();
310
								wc.setModes(modes);
308
							refreshStatus();
311
								refresh();
312
								refreshStatus();
313
							}
309
						}
314
						}
310
					}
315
					}
311
				} catch (CoreException ex) {
316
					else if(hasDuplicateDelegates()) {
312
					// TODO:
317
						Set modes = new HashSet();
313
				}
318
						modes.add(getLaunchConfigurationDialog().getMode());
319
						modes.addAll(getWorkingCopy().getModes());
320
						SelectLaunchDelegatesDialog sld = new SelectLaunchDelegatesDialog(getShell(), fTabType.getDelegates(modes));
321
						if(sld.open() == IDialogConstants.OK_ID) {
322
							Object[] res = sld.getResult();
323
							if(res != null) {
324
								fTabType.setPreferredDelegate(modes, (ILaunchDelegate) res[0]);
325
								refresh();
326
								refreshStatus();
327
							}
328
						}
329
					}
330
				} catch (CoreException ex) {}
314
			}
331
			}
315
			public void widgetDefaultSelected(SelectionEvent e) {}
332
			public void widgetDefaultSelected(SelectionEvent e) {}
316
		});
333
		});
Lines 348-364 Link Here
348
	}
365
	}
349
	
366
	
350
	/**
367
	/**
351
	 * Shows/hides the options link on the top of the viewer
352
	 * @param show true if the link should be visible, false otherwise
353
	 * @since 3.3
354
	 * 
355
	 * EXPERIMENTAL
356
	 */
357
	protected void showOptionsLink(boolean show) {
358
		fOptionsLink.setVisible(show);
359
	}
360
	
361
	/**
362
	 * Simple method to create a spacer in the page
368
	 * Simple method to create a spacer in the page
363
	 * 
369
	 * 
364
	 * @param composite the composite to add the spacer to
370
	 * @param composite the composite to add the spacer to
Lines 525-531 Link Here
525
		if (fInitializingTabs) {
531
		if (fInitializingTabs) {
526
			return;
532
			return;
527
		}
533
		}
528
		
529
		ILaunchConfigurationTab[] tabs = getTabs();
534
		ILaunchConfigurationTab[] tabs = getTabs();
530
		if (!fInitializingTabs && tabs != null) {
535
		if (!fInitializingTabs && tabs != null) {
531
			// update the working copy from the active tab
536
			// update the working copy from the active tab
Lines 540-546 Link Here
540
				item = fTabFolder.getItem(i);
545
				item = fTabFolder.getItem(i);
541
				setTabIcon(item, error, tabs[i]);
546
				setTabIcon(item, error, tabs[i]);
542
			}
547
			}
543
			fOptionsLink.setVisible(!canLaunchWithOptions());
548
			if(!canLaunchWithModes()) {
549
				fOptionsLink.setText(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_13);
550
			}
551
			else if(hasDuplicateDelegates()) {
552
				fOptionsLink.setText(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_15);
553
			}
554
			fOptionsLink.setVisible(!canLaunchWithModes() || hasDuplicateDelegates());
544
		}
555
		}
545
	}
556
	}
546
557
Lines 1032-1038 Link Here
1032
	 * </p>
1043
	 * </p>
1033
	 * @return
1044
	 * @return
1034
	 */
1045
	 */
1035
	public boolean canLaunchWithOptions() {
1046
	public boolean canLaunchWithModes() {
1036
		if(fInitializingTabs) {
1047
		if(fInitializingTabs) {
1037
			return false;
1048
			return false;
1038
		}
1049
		}
Lines 1042-1048 Link Here
1042
			if(wc != null) {
1053
			if(wc != null) {
1043
				Set modes = wc.getModes();
1054
				Set modes = wc.getModes();
1044
				modes.add(getLaunchConfigurationDialog().getMode());
1055
				modes.add(getLaunchConfigurationDialog().getMode());
1045
				return wc.getType().supportsModeCombination(modes);
1056
				return wc.getType().supportsModes(modes);
1046
			}
1057
			}
1047
		}  catch (CoreException e) {
1058
		}  catch (CoreException e) {
1048
		}
1059
		}
Lines 1050-1055 Link Here
1050
	}
1061
	}
1051
	
1062
	
1052
	/**
1063
	/**
1064
	 * Returns if the type currently showing in the tab group viewer has duplicate launch delegates for the given set of modes.
1065
	 * 
1066
	 * The given set of modes comprises the current mode that the launch dialog was opened in as well as any modes that have been set on the launch
1067
	 * configuration.
1068
	 * @return the true if there are duplicates, false otherwise
1069
	 * 
1070
	 * @since 3.3
1071
	 * 
1072
	 * EXPERIMENTAL
1073
	 */
1074
	public boolean hasDuplicateDelegates() {
1075
		if(fInitializingTabs) {
1076
			return false;
1077
		}
1078
		try {
1079
			ILaunchConfiguration config = getWorkingCopy();
1080
			if(config != null) {
1081
				Set modes = config.getModes();
1082
				modes.add(getLaunchConfigurationDialog().getMode());
1083
				if(fTabType.getDelegates(modes).length > 1) {
1084
					return fTabType.getPreferredDelegate(modes) == null;
1085
				}
1086
			}
1087
		}
1088
		catch(CoreException ce) {DebugUIPlugin.log(ce);}
1089
		return false;
1090
	}
1091
	
1092
	/**
1053
	 * Returns the current error message or <code>null</code> if none.
1093
	 * Returns the current error message or <code>null</code> if none.
1054
	 */
1094
	 */
1055
	public String getErrorMesssage() {
1095
	public String getErrorMesssage() {
Lines 1076-1082 Link Here
1076
			return message;
1116
			return message;
1077
		}
1117
		}
1078
		
1118
		
1079
	//EXPERIMENTAL
1080
		ILaunchConfigurationTab[] allTabs = getTabs();
1119
		ILaunchConfigurationTab[] allTabs = getTabs();
1081
		for (int i = 0; i < allTabs.length; i++) {
1120
		for (int i = 0; i < allTabs.length; i++) {
1082
			ILaunchConfigurationTab tab = allTabs[i];
1121
			ILaunchConfigurationTab tab = allTabs[i];
Lines 1098-1104 Link Here
1098
				return LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_9;
1137
				return LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_9;
1099
			}
1138
			}
1100
		}
1139
		}
1101
		if(!canLaunchWithOptions()) {
1140
		//EXPERIMENTAL
1141
		if(!canLaunchWithModes()) {
1102
			try {
1142
			try {
1103
				Set modes = getWorkingCopy().getModes();
1143
				Set modes = getWorkingCopy().getModes();
1104
				modes.add(getLaunchConfigurationDialog().getMode());
1144
				modes.add(getLaunchConfigurationDialog().getMode());
Lines 1108-1113 Link Here
1108
				return e.getMessage();
1148
				return e.getMessage();
1109
			}
1149
			}
1110
		}
1150
		}
1151
		if(hasDuplicateDelegates()) {
1152
			try {
1153
				Set modes = getWorkingCopy().getModes();
1154
				modes.add(getLaunchConfigurationDialog().getMode());
1155
				List names = LaunchConfigurationPresentationManager.getDefault().getLaunchModeNames(modes);
1156
				return MessageFormat.format(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_16, new String[] {names.toString()});
1157
			}
1158
			catch (CoreException e) {DebugUIPlugin.log(e);}
1159
		}
1111
		return null;
1160
		return null;
1112
	}	
1161
	}	
1113
	
1162
	
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchDelegateNotAvailableHandler.java (-6 / +10 lines)
Lines 17-22 Link Here
17
import org.eclipse.debug.core.IStatusHandler;
17
import org.eclipse.debug.core.IStatusHandler;
18
import org.eclipse.debug.internal.ui.DebugUIPlugin;
18
import org.eclipse.debug.internal.ui.DebugUIPlugin;
19
import org.eclipse.debug.ui.DebugUITools;
19
import org.eclipse.debug.ui.DebugUITools;
20
import org.eclipse.swt.widgets.Shell;
20
21
21
/**
22
/**
22
 * This class provides a mechanism to prompt users in the UI thread from debug.core in the case where
23
 * This class provides a mechanism to prompt users in the UI thread from debug.core in the case where
Lines 35-46 Link Here
35
		if(source instanceof Object[]) {
36
		if(source instanceof Object[]) {
36
			Object[] infos = (Object[]) source;
37
			Object[] infos = (Object[]) source;
37
			if(infos.length == 2) {
38
			if(infos.length == 2) {
38
				ILaunchConfiguration config = (ILaunchConfiguration) infos[0];
39
				final ILaunchConfiguration config = (ILaunchConfiguration) infos[0];
39
				String mode = (String) infos[1];
40
				final String mode = (String) infos[1];
40
				DebugUITools.openLaunchConfigurationEditDialog(DebugUIPlugin.getShell(), 
41
				final Shell shell = DebugUIPlugin.getShell();
41
						config, 
42
				Runnable runnable = new Runnable() {
42
						DebugUITools.getLaunchGroup(config, mode).getIdentifier(),
43
					public void run() {
43
						null);
44
						DebugUITools.openLaunchConfigurationDialog(shell, config, DebugUITools.getLaunchGroup(config, mode).getIdentifier(), null);
45
					}
46
				};
47
				DebugUIPlugin.getStandardDisplay().asyncExec(runnable);
44
			}
48
			}
45
		}
49
		}
46
		return Status.OK_STATUS;
50
		return Status.OK_STATUS;
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java (+10 lines)
Lines 95-100 Link Here
95
95
96
	public static String LaunchConfigurationTabGroupViewer_14;
96
	public static String LaunchConfigurationTabGroupViewer_14;
97
97
98
	public static String LaunchConfigurationTabGroupViewer_15;
99
100
	public static String LaunchConfigurationTabGroupViewer_16;
101
98
	public static String LaunchConfigurationTabGroupViewer_9;
102
	public static String LaunchConfigurationTabGroupViewer_9;
99
	public static String LaunchConfigurationTabGroupViewer_13;
103
	public static String LaunchConfigurationTabGroupViewer_13;
100
	public static String PerspectiveManager_Error_1;
104
	public static String PerspectiveManager_Error_1;
Lines 210-215 Link Here
210
214
211
	public static String CollapseAllLaunchConfigurationAction_2;
215
	public static String CollapseAllLaunchConfigurationAction_2;
212
216
217
	public static String SelectLaunchDelegatesDialog_0;
218
219
	public static String SelectLaunchDelegatesDialog_1;
220
221
	public static String SelectLaunchDelegatesDialog_2;
222
213
	public static String SelectLaunchOptionsDialog_2;
223
	public static String SelectLaunchOptionsDialog_2;
214
224
215
	public static String SelectLaunchOptionsDialog_3;
225
	public static String SelectLaunchOptionsDialog_3;
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java (-2 / +2 lines)
Lines 526-532 Link Here
526
				IStructuredSelection selection = (IStructuredSelection)fLaunchConfigurationView.getViewer().getSelection();
526
				IStructuredSelection selection = (IStructuredSelection)fLaunchConfigurationView.getViewer().getSelection();
527
				Object target = selection.getFirstElement();
527
				Object target = selection.getFirstElement();
528
				if (target instanceof ILaunchConfiguration) {
528
				if (target instanceof ILaunchConfiguration) {
529
					if (getTabViewer().canLaunch() & getTabViewer().canLaunchWithOptions()) {
529
					if (getTabViewer().canLaunch() & getTabViewer().canLaunchWithModes() & !getTabViewer().hasDuplicateDelegates()) {
530
						handleLaunchPressed();
530
						handleLaunchPressed();
531
					}
531
					}
532
				} else {
532
				} else {
Lines 1431-1437 Link Here
1431
		getDeleteAction().setEnabled(getDeleteAction().isEnabled());
1431
		getDeleteAction().setEnabled(getDeleteAction().isEnabled());
1432
		getDuplicateAction().setEnabled(getDuplicateAction().isEnabled());
1432
		getDuplicateAction().setEnabled(getDuplicateAction().isEnabled());
1433
		getTabViewer().refresh();
1433
		getTabViewer().refresh();
1434
		getButton(ID_LAUNCH_BUTTON).setEnabled(getTabViewer().canLaunch() & getTabViewer().canLaunchWithOptions());
1434
		getButton(ID_LAUNCH_BUTTON).setEnabled(getTabViewer().canLaunch() & getTabViewer().canLaunchWithModes() & !getTabViewer().hasDuplicateDelegates());
1435
	}
1435
	}
1436
1436
1437
	/* (non-Javadoc)
1437
	/* (non-Javadoc)
(-)plugin.properties (+1 lines)
Lines 19-24 Link Here
19
ConsoleFont.label= Console font
19
ConsoleFont.label= Console font
20
ConsoleLineTrackersExtensionName= Console Line Trackers
20
ConsoleLineTrackersExtensionName= Console Line Trackers
21
LaunchingPreferencePage.name=Launching
21
LaunchingPreferencePage.name=Launching
22
LaunchDelegatesPreferencePage.name=Launch Delegates
22
ViewManagementPreferencePage.name=View Management
23
ViewManagementPreferencePage.name=View Management
23
ConsolePreferencePage.name=Console
24
ConsolePreferencePage.name=Console
24
DebugModelContextBindingsName=Debug Model Context Bindings
25
DebugModelContextBindingsName=Debug Model Context Bindings
(-)plugin.xml (+13 lines)
Lines 145-150 Link Here
145
            name="%LaunchConfigurationsPage.name">
145
            name="%LaunchConfigurationsPage.name">
146
         <keywordReference id="org.eclipse.debug.ui.launchconfigurations"/>
146
         <keywordReference id="org.eclipse.debug.ui.launchconfigurations"/>
147
      </page>
147
      </page>
148
      <page
149
            category="org.eclipse.debug.ui.LaunchingPreferencePage"
150
            class="org.eclipse.debug.internal.ui.preferences.LaunchDelegatesPreferencePage"
151
            id="org.eclipse.debug.ui.LaunchDelegatesPreferencePage"
152
            name="%LaunchDelegatesPreferencePage.name">
153
         <keywordReference
154
               id="org.eclipse.debug.ui.launchDelegatesKeywords">
155
         </keywordReference>
156
      </page>
148
   </extension>
157
   </extension>
149
   <extension
158
   <extension
150
         point="org.eclipse.ui.actionSets">
159
         point="org.eclipse.ui.actionSets">
Lines 2293-2298 Link Here
2293
       <keyword
2302
       <keyword
2294
             id="org.eclipse.debug.ui.launchconfigurations"
2303
             id="org.eclipse.debug.ui.launchconfigurations"
2295
             label="%preferenceKeywords.launchConfigurations"/>
2304
             label="%preferenceKeywords.launchConfigurations"/>
2305
       <keyword
2306
             id="org.eclipse.debug.ui.launchDelegatesKeywords"
2307
             label="launch delegate duplicate run debug profile mode configuration">
2308
       </keyword>
2296
    </extension>
2309
    </extension>
2297
    <extension
2310
    <extension
2298
          point="org.eclipse.ui.importWizards">
2311
          point="org.eclipse.ui.importWizards">
(-)ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java (-1 / +3 lines)
Lines 73-78 Link Here
73
	public static final String LAUNCHING_PREFERENCE_PAGE = PREFIX + "launching_preference_page_context"; //$NON-NLS-1$
73
	public static final String LAUNCHING_PREFERENCE_PAGE = PREFIX + "launching_preference_page_context"; //$NON-NLS-1$
74
	public static final String LAUNCH_CONFIGURATION_PREFERENCE_PAGE = PREFIX + "launch_configuration_preference_page_context"; //$NON-NLS-1$
74
	public static final String LAUNCH_CONFIGURATION_PREFERENCE_PAGE = PREFIX + "launch_configuration_preference_page_context"; //$NON-NLS-1$
75
	public static final String VIEW_MANAGEMENT_PREFERENCE_PAGE = PREFIX + "view_management_preference_page_context"; //$NON-NLS-1$
75
	public static final String VIEW_MANAGEMENT_PREFERENCE_PAGE = PREFIX + "view_management_preference_page_context"; //$NON-NLS-1$
76
	public static final String LAUNCH_DELEGATES_PREFERENCE_PAGE = PREFIX + "launch_delegate_preferencef_page_context"; //$NON-NLS-1$
76
	
77
	
77
	// Dialogs
78
	// Dialogs
78
	public static final String LAUNCH_CONFIGURATION_DIALOG = PREFIX + "launch_configuration_dialog"; //$NON-NLS-1$
79
	public static final String LAUNCH_CONFIGURATION_DIALOG = PREFIX + "launch_configuration_dialog"; //$NON-NLS-1$
Lines 97-103 Link Here
97
	public static final String MAX_DETAILS_LENGTH_DIALOG = PREFIX + "max_details_length_dialog_context"; //$NON-NLS-1$
98
	public static final String MAX_DETAILS_LENGTH_DIALOG = PREFIX + "max_details_length_dialog_context"; //$NON-NLS-1$
98
	public static final String SELECT_DEFAULT_WORKINGSET_DIALOG = PREFIX + "select_breakpoint_workingset_dialog"; //$NON-NLS-1$
99
	public static final String SELECT_DEFAULT_WORKINGSET_DIALOG = PREFIX + "select_breakpoint_workingset_dialog"; //$NON-NLS-1$
99
	public static final String DELETE_ASSOCIATED_LAUNCH_CONFIGS_DIALOG = PREFIX + "delete_associated_launch_configs_dialog"; //$NON-NLS-1$
100
	public static final String DELETE_ASSOCIATED_LAUNCH_CONFIGS_DIALOG = PREFIX + "delete_associated_launch_configs_dialog"; //$NON-NLS-1$
100
	public static final String SELECT_LAUNCH_OPTIONS_DIALOG = PREFIX + "select_launch_options_dialog"; //$NON-NLS-1$
101
	public static final String SELECT_LAUNCH_MODES_DIALOG = PREFIX + "select_launch_modes_dialog"; //$NON-NLS-1$
102
	public static final String SELECT_LAUNCH_DELEGATES_DIALOG = PREFIX + "select_launch_delegates_dialog"; //$NON-NLS-1$
101
	
103
	
102
	// Property pages
104
	// Property pages
103
	public static final String PROCESS_PROPERTY_PAGE = PREFIX + "process_property_page_context"; //$NON-NLS-1$
105
	public static final String PROCESS_PROPERTY_PAGE = PREFIX + "process_property_page_context"; //$NON-NLS-1$
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchDelegatesDialog.java (+143 lines)
Added Link Here
1
package org.eclipse.debug.internal.ui.launchConfigurations;
2
3
import java.util.Arrays;
4
5
import org.eclipse.debug.core.ILaunchDelegate;
6
import org.eclipse.debug.internal.ui.DebugUIPlugin;
7
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
8
import org.eclipse.debug.internal.ui.SWTUtil;
9
import org.eclipse.debug.ui.IDebugUIConstants;
10
import org.eclipse.jface.dialogs.Dialog;
11
import org.eclipse.jface.dialogs.IDialogSettings;
12
import org.eclipse.jface.viewers.ArrayContentProvider;
13
import org.eclipse.jface.viewers.CheckStateChangedEvent;
14
import org.eclipse.jface.viewers.CheckboxTableViewer;
15
import org.eclipse.jface.viewers.ICheckStateListener;
16
import org.eclipse.jface.viewers.ILabelProvider;
17
import org.eclipse.jface.viewers.ILabelProviderListener;
18
import org.eclipse.swt.SWT;
19
import org.eclipse.swt.graphics.Image;
20
import org.eclipse.swt.graphics.Point;
21
import org.eclipse.swt.layout.GridData;
22
import org.eclipse.swt.widgets.Composite;
23
import org.eclipse.swt.widgets.Control;
24
import org.eclipse.swt.widgets.Shell;
25
import org.eclipse.swt.widgets.Table;
26
import org.eclipse.ui.PlatformUI;
27
import org.eclipse.ui.dialogs.SelectionDialog;
28
29
import com.ibm.icu.text.MessageFormat;
30
31
public class SelectLaunchDelegatesDialog extends SelectionDialog {
32
33
	/**
34
	 * Builds labels for list control
35
	 */
36
	class DelegatesLabelProvider implements ILabelProvider {
37
		public Image getImage(Object element) {return null;}
38
		public String getText(Object element) {
39
			if(element instanceof ILaunchDelegate) {
40
				ILaunchDelegate ldp = (ILaunchDelegate) element;
41
				String name = ldp.getName();
42
				if(name == null) {
43
					name = ldp.getContributorName();
44
				}
45
				return name;
46
			}
47
			return element.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 static final String SETTINGS_ID = IDebugUIConstants.PLUGIN_ID + ".SELECT_LAUNCH_DELEGATES_DIALOG"; //$NON-NLS-1$
56
	
57
	private CheckboxTableViewer fTableViewer = null;
58
	private Table fTable  = null;
59
	private ILaunchDelegate[] fDelegates = null;
60
	
61
	/**
62
	 * Constructor
63
	 * @param parentShell the parent shell
64
	 * @param delegates the current delegates context
65
	 * 
66
	 * @throws CoreException
67
	 */
68
	public SelectLaunchDelegatesDialog(Shell parentShell, ILaunchDelegate[] delegates) {
69
		super(parentShell);
70
		super.setMessage(MessageFormat.format(LaunchConfigurationsMessages.SelectLaunchDelegatesDialog_0, new String[] {}));
71
		super.setTitle(LaunchConfigurationsMessages.SelectLaunchDelegatesDialog_1);
72
		setShellStyle(getShellStyle() | SWT.RESIZE);
73
		fDelegates = delegates;
74
	}
75
	
76
	/**
77
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
78
	 */
79
	protected Control createDialogArea(Composite parent) {
80
		initializeDialogUnits(parent);
81
		Composite comp = (Composite) super.createDialogArea(parent);
82
		SWTUtil.createLabel(comp, LaunchConfigurationsMessages.SelectLaunchDelegatesDialog_2, 1);
83
		fTable = new Table(comp, SWT.BORDER | SWT.SINGLE | SWT.CHECK);
84
		fTable.setLayoutData(new GridData(GridData.FILL_BOTH));
85
		fTableViewer = new CheckboxTableViewer(fTable);
86
		fTableViewer.setLabelProvider(new DelegatesLabelProvider());
87
		fTableViewer.setContentProvider(new ArrayContentProvider());
88
		fTableViewer.setInput(fDelegates);
89
		fTableViewer.addCheckStateListener(new ICheckStateListener() {
90
			public void checkStateChanged(CheckStateChangedEvent event) {
91
				fTableViewer.setAllChecked(false);
92
				fTableViewer.setChecked(event.getElement(), true);
93
			}
94
		});
95
		Dialog.applyDialogFont(comp);
96
		PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IDebugHelpContextIds.SELECT_LAUNCH_DELEGATES_DIALOG);
97
		return comp;
98
	}
99
100
	/**
101
	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
102
	 */
103
	protected void okPressed() {
104
		Object[] o =  fTableViewer.getCheckedElements();
105
		if(o.length > 0) {
106
			setResult(Arrays.asList(o));
107
		}
108
		super.okPressed();
109
	}
110
111
	/* (non-Javadoc)
112
	 * @see org.eclipse.ui.dialogs.SelectionDialog#getDialogBoundsSettings()
113
	 */
114
	protected IDialogSettings getDialogBoundsSettings() {
115
		IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
116
		IDialogSettings section = settings.getSection(SETTINGS_ID);
117
		if (section == null) {
118
			section = settings.addNewSection(SETTINGS_ID);
119
		} 
120
		return section;
121
	}
122
123
	/* (non-Javadoc)
124
	 * @see org.eclipse.jface.dialogs.Dialog#getInitialSize()
125
	 */
126
	protected Point getInitialSize() {
127
		IDialogSettings settings = getDialogBoundsSettings();
128
		if(settings != null) {
129
			try {
130
				int width = settings.getInt("DIALOG_WIDTH"); //$NON-NLS-1$
131
				int height = settings.getInt("DIALOG_HEIGHT"); //$NON-NLS-1$
132
				if(width > 0 & height > 0) {
133
					return new Point(width, height);
134
				}
135
			}
136
			catch (NumberFormatException nfe) {
137
				return new Point(350, 400);
138
			}
139
		}
140
		return new Point(350, 400);
141
	}
142
143
}
(-)ui/org/eclipse/debug/internal/ui/preferences/LaunchDelegatesPreferencePage.java (+282 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui.preferences;
12
13
import java.util.HashMap;
14
import java.util.HashSet;
15
import java.util.Iterator;
16
import java.util.Map;
17
import java.util.Set;
18
19
import org.eclipse.core.runtime.CoreException;
20
import org.eclipse.debug.core.DebugPlugin;
21
import org.eclipse.debug.core.ILaunchConfigurationType;
22
import org.eclipse.debug.core.ILaunchDelegate;
23
import org.eclipse.debug.internal.core.LaunchManager;
24
import org.eclipse.debug.internal.ui.DebugUIPlugin;
25
import org.eclipse.debug.internal.ui.DefaultLabelProvider;
26
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
27
import org.eclipse.debug.internal.ui.SWTUtil;
28
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPresentationManager;
29
import org.eclipse.jface.preference.PreferencePage;
30
import org.eclipse.jface.viewers.ArrayContentProvider;
31
import org.eclipse.jface.viewers.CheckStateChangedEvent;
32
import org.eclipse.jface.viewers.CheckboxTableViewer;
33
import org.eclipse.jface.viewers.ICheckStateListener;
34
import org.eclipse.jface.viewers.ISelectionChangedListener;
35
import org.eclipse.jface.viewers.IStructuredSelection;
36
import org.eclipse.jface.viewers.ITreeContentProvider;
37
import org.eclipse.jface.viewers.SelectionChangedEvent;
38
import org.eclipse.jface.viewers.TreeViewer;
39
import org.eclipse.jface.viewers.Viewer;
40
import org.eclipse.swt.SWT;
41
import org.eclipse.swt.layout.GridData;
42
import org.eclipse.swt.widgets.Composite;
43
import org.eclipse.swt.widgets.Control;
44
import org.eclipse.swt.widgets.Table;
45
import org.eclipse.swt.widgets.Tree;
46
import org.eclipse.ui.IWorkbench;
47
import org.eclipse.ui.IWorkbenchPreferencePage;
48
import org.eclipse.ui.PlatformUI;
49
import org.eclipse.ui.model.WorkbenchViewerComparator;
50
51
/**
52
 * This class provides a preference page for selecting and changing preferred launch delegates for those of them
53
 * that have conflicting delegates.
54
 * 
55
 * Delegates are considered to be conflicting if they are for the same launc configuraiton type, and apply to the same 
56
 * mode sets.
57
 * 
58
 * @since 3.3
59
 * 
60
 * EXPERIMENTAL
61
 */
62
public class LaunchDelegatesPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
63
64
	class DuplicateDelegate {
65
		private ILaunchConfigurationType fType = null;
66
		private ILaunchDelegate[] fDelegates = null;
67
		private Set fModes = null;
68
		
69
		public DuplicateDelegate(ILaunchConfigurationType type, ILaunchDelegate[] delegates, Set modes) {
70
			fModes = modes;
71
			fType = type;
72
			fDelegates = delegates;
73
		}
74
		
75
		public ILaunchConfigurationType getType() {
76
			return fType;
77
		}
78
		public ILaunchDelegate[] getDelegates() {
79
			return fDelegates;
80
		}
81
		public Set getModeSet() {
82
			return fModes;
83
		}
84
	}
85
	
86
	/**
87
	 * label provider to extend the default one
88
	 */
89
	class LabelProvider extends DefaultLabelProvider {
90
		public String getText(Object element) {
91
			if(element instanceof ILaunchConfigurationType) {
92
				return super.getText(element);
93
			}
94
			else if(element instanceof DuplicateDelegate) {
95
				DuplicateDelegate dd = (DuplicateDelegate) element;
96
				return LaunchConfigurationPresentationManager.getDefault().getLaunchModeNames(dd.getModeSet()).toString();
97
			}
98
			else if(element instanceof ILaunchDelegate){
99
				return ((ILaunchDelegate) element).getName();
100
			}
101
			return element.toString();
102
		}
103
	}
104
	
105
	/**
106
	 * This class is used to provide content to the tree
107
	 */
108
	class TreeProvider implements ITreeContentProvider {
109
		public Object[] getChildren(Object parentElement) {
110
			if(parentElement instanceof ILaunchConfigurationType) {
111
				ILaunchConfigurationType type = (ILaunchConfigurationType) parentElement;
112
				Set dupes = (Set) fDuplicates.get(type);
113
				if(dupes != null) {
114
					return dupes.toArray();
115
				}
116
				return null;
117
			}
118
			return null;
119
		}
120
		public boolean hasChildren(Object element) {
121
			return element instanceof ILaunchConfigurationType;
122
		}
123
		public Object[] getElements(Object inputElement) {
124
			if(inputElement instanceof Map) {
125
				return ((Map)inputElement).keySet().toArray();
126
			}
127
			return null;
128
		}
129
		public Object getParent(Object element) {return null;}
130
		public void dispose() {}
131
		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
132
	}
133
	
134
	private TreeViewer fTreeViewer = null;
135
	private CheckboxTableViewer fTableViewer = null;
136
	private Map fDuplicates = null;
137
	private Map fDupeSelections = null;
138
	private boolean fDirty = false;
139
	
140
	/**
141
	 * Constructor
142
	 */
143
	public LaunchDelegatesPreferencePage() {
144
		setTitle(DebugPreferencesMessages.LaunchDelegatesPreferencePage_0);
145
	}
146
147
	/**
148
	 * @see org.eclipse.jface.preference.PreferencePage#createControl(org.eclipse.swt.widgets.Composite)
149
	 */
150
	public void createControl(Composite parent) {
151
		super.createControl(parent);
152
		PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.LAUNCH_DELEGATES_PREFERENCE_PAGE);
153
		getDefaultsButton().setEnabled(false);
154
	}
155
156
	/**
157
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
158
	 */
159
	protected Control createContents(Composite parent) {
160
		Composite comp = SWTUtil.createComposite(parent, parent.getFont(), 2, 1, GridData.FILL_BOTH);
161
		SWTUtil.createWrapLabel(comp, DebugPreferencesMessages.LaunchDelegatesPreferencePage_1, 2, 300);
162
		
163
	//tree
164
		Tree tree = new Tree(comp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE);
165
		GridData gd = new GridData(GridData.FILL_BOTH);
166
		gd.grabExcessHorizontalSpace = false;
167
		tree.setLayoutData(gd);
168
		fTreeViewer = new TreeViewer(tree);
169
		fTreeViewer.setComparator(new WorkbenchViewerComparator());
170
		fTreeViewer.setContentProvider(new TreeProvider());
171
		fTreeViewer.setLabelProvider(new LabelProvider());
172
		fTreeViewer.setInput(fDuplicates);
173
		fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
174
			public void selectionChanged(SelectionChangedEvent event) {
175
				Object obj = ((IStructuredSelection) event.getSelection()).getFirstElement();
176
				if(obj instanceof DuplicateDelegate) {
177
					fTableViewer.setAllChecked(false);
178
					DuplicateDelegate dd = (DuplicateDelegate) obj;
179
					fTableViewer.setInput(dd.getDelegates());
180
					obj = fDupeSelections.get(dd);
181
					if(obj != null) {
182
						fTableViewer.setChecked(obj, true);
183
					}
184
				}
185
				else {
186
					fTableViewer.setInput(null);
187
				}
188
			}
189
		});
190
		
191
	//table
192
		Table table = new Table(comp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK | SWT.SINGLE);
193
		gd = new GridData(GridData.FILL_BOTH);
194
		table.setLayoutData(gd);
195
		fTableViewer = new CheckboxTableViewer(table);
196
		fTableViewer.setComparator(new WorkbenchViewerComparator());
197
		fTableViewer.setLabelProvider(new LabelProvider());
198
		fTableViewer.setContentProvider(new ArrayContentProvider());
199
		fTableViewer.addCheckStateListener(new ICheckStateListener() {
200
			public void checkStateChanged(CheckStateChangedEvent event) {
201
				fDirty = true;
202
				Object element = event.getElement();
203
				boolean checked = event.getChecked();
204
				fTableViewer.setAllChecked(false);
205
				fTableViewer.setChecked(element, checked);
206
				//persist the selection
207
				Object obj = ((IStructuredSelection) fTreeViewer.getSelection()).getFirstElement();
208
				if(obj instanceof DuplicateDelegate) {
209
					fDupeSelections.remove(obj);
210
					if(checked) {
211
						fDupeSelections.put(obj, element);
212
					}
213
				}
214
			}
215
		});
216
		//make a size good enough to see it all at the onset
217
		comp.setSize(400, 500);
218
		
219
		return comp;
220
	}
221
222
	/**
223
	 * @see org.eclipse.jface.preference.PreferencePage#performOk()
224
	 */
225
	public boolean performOk() {
226
		if(fDirty && fDupeSelections != null && fDupeSelections.size() > 0) {
227
			fDirty = false;
228
			DuplicateDelegate dd = null;
229
			ILaunchDelegate delegate = null;
230
			for(Iterator iter = fDupeSelections.keySet().iterator(); iter.hasNext();) {
231
				dd = (DuplicateDelegate) iter.next();
232
				delegate = (ILaunchDelegate) fDupeSelections.get(dd);
233
				try {
234
					dd.getType().setPreferredDelegate(dd.getModeSet(), delegate);
235
				} 
236
				catch (CoreException e) {DebugUIPlugin.log(e);}
237
			}
238
		}
239
		return super.performOk();
240
	}
241
242
	/**
243
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
244
	 */
245
	public void init(IWorkbench workbench) {
246
		//init a listing of duplicate delegates arranged by type
247
		try {
248
			LaunchManager lm = (LaunchManager) DebugPlugin.getDefault().getLaunchManager();
249
			ILaunchConfigurationType[] types = lm.getLaunchConfigurationTypes();
250
			fDuplicates = new HashMap();
251
			fDupeSelections = new HashMap();
252
			Set modes = null;
253
			ILaunchDelegate[] delegates = null;
254
			Set modeset = null;
255
			Set tmp = null;
256
			ILaunchDelegate prefdelegate = null;
257
			DuplicateDelegate dd = null;
258
			for(int i = 0; i < types.length; i++) {
259
				modes = types[i].getSupportedModeCombinations();
260
				for(Iterator iter = modes.iterator(); iter.hasNext();) {
261
					modeset = (Set) iter.next();
262
					delegates = types[i].getDelegates(modeset);
263
					if(delegates.length > 1) {
264
						tmp = (Set) fDuplicates.get(types[i]);
265
						if(tmp == null) {
266
							tmp = new HashSet();
267
						}
268
						dd = new DuplicateDelegate(types[i], delegates, modeset);
269
						tmp.add(dd);
270
						fDuplicates.put(types[i], tmp);
271
						prefdelegate = types[i].getPreferredDelegate(modeset);
272
						if(prefdelegate != null) {
273
							fDupeSelections.put(dd, prefdelegate);
274
						}
275
					}
276
				}
277
			}
278
		}
279
		catch(CoreException e) {DebugUIPlugin.log(e);}
280
	}
281
282
}
(-)contexts_Debugger.xml (+28 lines)
Lines 487-492 Link Here
487
   		<topic label="Running and Debugging" href="tasks/task-running_and_debugging.htm"/>
487
   		<topic label="Running and Debugging" href="tasks/task-running_and_debugging.htm"/>
488
		<topic label="Creating a Java application launch configuration" href="tasks/tasks-java-local-configuration.htm"/>
488
		<topic label="Creating a Java application launch configuration" href="tasks/tasks-java-local-configuration.htm"/>
489
   	</context>
489
   	</context>
490
   	<context id="select_launch_delegates_dialog">
491
   		<description>This dialog allows you to select a delegate to continue launching in the event there is more than one delegate available to launch a particular type in a given mode.</description>
492
   		<topic label="Running and Debugging" href="tasks/task-running_and_debugging.htm"/>
493
		<topic label="Creating a Java application launch configuration" href="tasks/tasks-java-local-configuration.htm"/>
494
   	</context>
490
495
491
496
492
497
Lines 728-757 Link Here
728
	</context>
733
	</context>
729
	<context id="launch_history_preference_page_context" >
734
	<context id="launch_history_preference_page_context" >
730
		<description>On this page, you can modify launch history and favorites.</description>
735
		<description>On this page, you can modify launch history and favorites.</description>
736
		<topic label="Debug Preferences" href="reference/preferences/ref-debug.htm"/>
737
		<topic label="Debugger Concepts" href="concepts/cdebugger.htm"/>
731
	</context>
738
	</context>
732
	<context id="debug_action_groups_views_preference_page_context" >
739
	<context id="debug_action_groups_views_preference_page_context" >
733
		<description>On this page, you can enable and disable actions associated with a debugger. When a group of actions is disabled, the actions will not appear in debug views.</description>
740
		<description>On this page, you can enable and disable actions associated with a debugger. When a group of actions is disabled, the actions will not appear in debug views.</description>
741
		<topic label="Debug Preferences" href="reference/preferences/ref-debug.htm"/>
742
		<topic label="Debugger Concepts" href="concepts/cdebugger.htm"/>
734
	</context>
743
	</context>
735
	<context id="simple_variable_preference_page_context">
744
	<context id="simple_variable_preference_page_context">
736
		<description>One this page, you can create and configure simple launch variables which you can reference in launch configurations that support variables.</description>
745
		<description>One this page, you can create and configure simple launch variables which you can reference in launch configurations that support variables.</description>
746
		<topic label="Debug Preferences" href="reference/preferences/ref-debug.htm"/>
747
		<topic label="Debugger Concepts" href="concepts/cdebugger.htm"/>
737
	</context>
748
	</context>
738
	<context  id="table_renderings_preference_page_context">
749
	<context  id="table_renderings_preference_page_context">
739
		<description>On this page, you can configure the memory loading mode in table renderings.   </description>
750
		<description>On this page, you can configure the memory loading mode in table renderings.   </description>
751
		<topic label="Debug Preferences" href="reference/preferences/ref-debug.htm"/>
752
		<topic label="Debugger Concepts" href="concepts/cdebugger.htm"/>
740
	</context>
753
	</context>
741
	<context  id="perspective_preference_page_context">
754
	<context  id="perspective_preference_page_context">
742
		<description>On this page, you can configure the perspectives used when running and debugging.</description>
755
		<description>On this page, you can configure the perspectives used when running and debugging.</description>
756
		<topic label="Debug Preferences" href="reference/preferences/ref-debug.htm"/>
757
		<topic label="Debugger Concepts" href="concepts/cdebugger.htm"/>
743
	</context>
758
	</context>
744
	<context  id="launching_preference_page_context">
759
	<context  id="launching_preference_page_context">
745
		<description>On this page, you can configure launch options.</description>
760
		<description>On this page, you can configure launch options.</description>
761
		<topic label="Debug Preferences" href="reference/preferences/ref-debug.htm"/>
762
		<topic label="Debugger Concepts" href="concepts/cdebugger.htm"/>
746
	</context>
763
	</context>
747
	<context  id="launch_configuration_preference_page_context">
764
	<context  id="launch_configuration_preference_page_context">
748
		<description>On this page, you can configure the filters used in the launch dialog and migrate launch configurations.</description>
765
		<description>On this page, you can configure the filters used in the launch dialog and migrate launch configurations.</description>
766
		<topic label="Debug Preferences" href="reference/preferences/ref-debug.htm"/>
767
		<topic label="Debugger Concepts" href="concepts/cdebugger.htm"/>
749
	</context>
768
	</context>
750
	<context  id="view_management_preference_page_context">
769
	<context  id="view_management_preference_page_context">
751
		<description>On this page, you can select the perspectives that debug related views will be opened in automatically.</description>
770
		<description>On this page, you can select the perspectives that debug related views will be opened in automatically.</description>
771
		<topic label="Debug Preferences" href="reference/preferences/ref-debug.htm"/>
772
		<topic label="Debugger Concepts" href="concepts/cdebugger.htm"/>
752
	</context>
773
	</context>
753
	<context  id="resetMemoryMonitor_preference_page_context" >
774
	<context  id="resetMemoryMonitor_preference_page_context" >
754
		<description>On this page, you can configure the reset memory monitor behavior. </description>
775
		<description>On this page, you can configure the reset memory monitor behavior. </description>
776
		<topic label="Debug Preferences" href="reference/preferences/ref-debug.htm"/>
777
		<topic label="Debugger Concepts" href="concepts/cdebugger.htm"/>
778
	</context>
779
	<context id="launch_delegate_preferencef_page_context">
780
		<description>On this page, you can select default launch delegates in the event there are duplicates</description>
781
		<topic label="Debug Preferences" href="reference/preferences/ref-debug.htm"/>
782
		<topic label="Debugger Concepts" href="concepts/cdebugger.htm"/>
755
	</context>
783
	</context>
756
	
784
	
757
<!-- 
785
<!-- 

Return to bug 157059