|
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.ArrayList; |
| 14 |
import java.util.Hashtable; |
15 |
import java.util.Hashtable; |
| 15 |
import java.util.Iterator; |
16 |
import java.util.Iterator; |
| 16 |
import java.util.Map; |
17 |
import java.util.Map; |
|
Lines 22-31
Link Here
|
| 22 |
import org.eclipse.core.runtime.IStatus; |
23 |
import org.eclipse.core.runtime.IStatus; |
| 23 |
import org.eclipse.core.runtime.Platform; |
24 |
import org.eclipse.core.runtime.Platform; |
| 24 |
import org.eclipse.core.runtime.Status; |
25 |
import org.eclipse.core.runtime.Status; |
| 25 |
import org.eclipse.debug.core.DebugPlugin; |
|
|
| 26 |
import org.eclipse.debug.core.ILaunchConfigurationType; |
26 |
import org.eclipse.debug.core.ILaunchConfigurationType; |
|
|
27 |
import org.eclipse.debug.internal.core.ConfigurationElementConstants; |
| 27 |
import org.eclipse.debug.internal.ui.DebugUIPlugin; |
28 |
import org.eclipse.debug.internal.ui.DebugUIPlugin; |
|
|
29 |
import org.eclipse.debug.internal.ui.LaunchConfigurationTabExtension; |
| 28 |
import org.eclipse.debug.ui.IDebugUIConstants; |
30 |
import org.eclipse.debug.ui.IDebugUIConstants; |
|
|
31 |
import org.eclipse.debug.ui.ILaunchConfigurationTab; |
| 29 |
import org.eclipse.debug.ui.ILaunchConfigurationTabGroup; |
32 |
import org.eclipse.debug.ui.ILaunchConfigurationTabGroup; |
| 30 |
|
33 |
|
| 31 |
import com.ibm.icu.text.MessageFormat; |
34 |
import com.ibm.icu.text.MessageFormat; |
|
Lines 49-54
Link Here
|
| 49 |
* used to represent the default tab group (i.e. unspecified mode). |
52 |
* used to represent the default tab group (i.e. unspecified mode). |
| 50 |
*/ |
53 |
*/ |
| 51 |
private Hashtable fTabGroupExtensions; |
54 |
private Hashtable fTabGroupExtensions; |
|
|
55 |
|
| 56 |
/** |
| 57 |
* contributed tabs are stored by the tab group id that they contribute to. |
| 58 |
* each entry is a futher <code>Hashtable</code> consisting of the corrseponding |
| 59 |
* <code>LaunchConfigurationTabExtension</code> objects for each contributed tab stored by their |
| 60 |
* id |
| 61 |
* |
| 62 |
* @since 3.3 |
| 63 |
*/ |
| 64 |
private Hashtable fContributedTabs; |
| 52 |
|
65 |
|
| 53 |
/** |
66 |
/** |
| 54 |
* Constructs the singleton launch configuration presentation |
67 |
* Constructs the singleton launch configuration presentation |
|
Lines 57-62
Link Here
|
| 57 |
private LaunchConfigurationPresentationManager() { |
70 |
private LaunchConfigurationPresentationManager() { |
| 58 |
fgDefault = this; |
71 |
fgDefault = this; |
| 59 |
initializeTabGroupExtensions(); |
72 |
initializeTabGroupExtensions(); |
|
|
73 |
initializeContributedTabExtensions(); |
| 60 |
} |
74 |
} |
| 61 |
|
75 |
|
| 62 |
/** |
76 |
/** |
|
Lines 75-126
Link Here
|
| 75 |
*/ |
89 |
*/ |
| 76 |
private void initializeTabGroupExtensions() { |
90 |
private void initializeTabGroupExtensions() { |
| 77 |
fTabGroupExtensions = new Hashtable(); |
91 |
fTabGroupExtensions = new Hashtable(); |
| 78 |
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_LAUNCH_CONFIGURATION_TAB_GROUPS); |
92 |
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_LAUNCH_CONFIGURATION_TAB_GROUPS); |
| 79 |
IConfigurationElement[] groups = extensionPoint.getConfigurationElements(); |
93 |
IConfigurationElement[] groups = extensionPoint.getConfigurationElements(); |
|
|
94 |
LaunchConfigurationTabGroupExtension group = null; |
| 95 |
String typeId = null; |
| 96 |
Map map = null; |
| 97 |
Set modes = null; |
| 80 |
for (int i = 0; i < groups.length; i++) { |
98 |
for (int i = 0; i < groups.length; i++) { |
| 81 |
LaunchConfigurationTabGroupExtension group = new LaunchConfigurationTabGroupExtension(groups[i]); |
99 |
group = new LaunchConfigurationTabGroupExtension(groups[i]); |
| 82 |
String typeId = group.getTypeIdentifier(); |
100 |
typeId = group.getTypeIdentifier(); |
| 83 |
if (typeId == null) { |
101 |
map = (Map)fTabGroupExtensions.get(typeId); |
| 84 |
IStatus status = new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.STATUS_INVALID_EXTENSION_DEFINITION, |
102 |
if (map == null) { |
| 85 |
MessageFormat.format("Launch configuration tab group extension {0} does not specify launch configuration type.", (new String[] {groups[i].getAttribute("id")})), null); //$NON-NLS-1$ //$NON-NLS-2$ |
103 |
map = new Hashtable(); |
| 86 |
DebugUIPlugin.log(status); |
104 |
fTabGroupExtensions.put(typeId, map); |
| 87 |
} else { |
|
|
| 88 |
// verify it references a valid launch configuration type |
| 89 |
ILaunchConfigurationType lct = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(typeId); |
| 90 |
if (lct == null) { |
| 91 |
IStatus status = new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.STATUS_INVALID_EXTENSION_DEFINITION, |
| 92 |
MessageFormat.format("Launch configuration tab group extension {0} refers to non-existent launch configuration type {1}.", (new String[] {groups[i].getAttribute("id"), typeId})), null); //$NON-NLS-1$ //$NON-NLS-2$ |
| 93 |
DebugUIPlugin.log(status); |
| 94 |
} |
| 95 |
} |
105 |
} |
| 96 |
if (typeId != null) { |
106 |
modes = group.getModes(); |
| 97 |
// get the map for the config type |
107 |
if (modes == null) { |
| 98 |
Map map = (Map)fTabGroupExtensions.get(typeId); |
108 |
// default tabs - store with "*" |
| 99 |
if (map == null) { |
109 |
map.put("*", group); //$NON-NLS-1$ |
| 100 |
map = new Hashtable(); |
110 |
} else { |
| 101 |
fTabGroupExtensions.put(typeId, map); |
111 |
// store per mode |
| 102 |
} |
112 |
Iterator iterator = modes.iterator(); |
| 103 |
Set modes = group.getModes(); |
113 |
while (iterator.hasNext()) { |
| 104 |
if (modes == null) { |
114 |
map.put(iterator.next(), group); |
| 105 |
// default tabs - store with "*" |
|
|
| 106 |
map.put("*", group); //$NON-NLS-1$ |
| 107 |
} else { |
| 108 |
// store per mode |
| 109 |
Iterator iterator = modes.iterator(); |
| 110 |
while (iterator.hasNext()) { |
| 111 |
map.put(iterator.next(), group); |
| 112 |
} |
| 113 |
} |
115 |
} |
| 114 |
} |
116 |
} |
| 115 |
} |
117 |
} |
| 116 |
} |
118 |
} |
| 117 |
|
119 |
|
| 118 |
/** |
120 |
/** |
|
|
121 |
* This method is used to collect all of the contributed tabs defined by the <code>launchConfigurationTabs</code> |
| 122 |
* extension point |
| 123 |
* <p> |
| 124 |
* <strong>EXPERIMENTAL</strong>. This method has been added as |
| 125 |
* part of a work in progress. There is no guarantee that this API will |
| 126 |
* remain unchanged during the 3.3 release cycle. Please do not use this API |
| 127 |
* without consulting with the Platform/Debug team. |
| 128 |
* </p> |
| 129 |
* @since 3.3 |
| 130 |
*/ |
| 131 |
private void initializeContributedTabExtensions() { |
| 132 |
fContributedTabs = new Hashtable(); |
| 133 |
IExtensionPoint epoint = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_CONTRIBUTED_LAUNCH_TABS); |
| 134 |
IConfigurationElement[] elements = epoint.getConfigurationElements(); |
| 135 |
LaunchConfigurationTabExtension tab = null; |
| 136 |
Hashtable element = null; |
| 137 |
for(int i = 0; i < elements.length; i++) { |
| 138 |
tab = new LaunchConfigurationTabExtension(elements[i]); |
| 139 |
element = (Hashtable) fContributedTabs.get(tab.getTabGroupId()); |
| 140 |
if(element == null) { |
| 141 |
element = new Hashtable(); |
| 142 |
element.put(tab.getIdentifier(), tab); |
| 143 |
fContributedTabs.put(tab.getTabGroupId(), element); |
| 144 |
} |
| 145 |
element.put(tab.getIdentifier(), tab); |
| 146 |
} |
| 147 |
} |
| 148 |
|
| 149 |
/** |
| 119 |
* Returns the tab group for the given launch configuration type and mode. |
150 |
* Returns the tab group for the given launch configuration type and mode. |
| 120 |
* |
151 |
* |
| 121 |
* @param type launch configuration type |
152 |
* @param type launch configuration type |
| 122 |
* @param mode launch mode |
153 |
* @param mode launch mode |
| 123 |
* @return the tab group for the given type of launch configuration |
154 |
* @return the tab group for the given type of launch configuration, or <code>null</code> if none |
| 124 |
* @exception CoreException if an exception occurs creating the group |
155 |
* @exception CoreException if an exception occurs creating the group |
| 125 |
*/ |
156 |
*/ |
| 126 |
public ILaunchConfigurationTabGroup getTabGroup(ILaunchConfigurationType type, String mode) throws CoreException { |
157 |
public ILaunchConfigurationTabGroup getTabGroup(ILaunchConfigurationType type, String mode) throws CoreException { |
|
Lines 130-136
Link Here
|
| 130 |
MessageFormat.format(LaunchConfigurationsMessages.LaunchConfigurationPresentationManager_No_tab_group_defined_for_launch_configuration_type__0__3, (new String[] {type.getIdentifier()})), null); |
161 |
MessageFormat.format(LaunchConfigurationsMessages.LaunchConfigurationPresentationManager_No_tab_group_defined_for_launch_configuration_type__0__3, (new String[] {type.getIdentifier()})), null); |
| 131 |
throw new CoreException(status); |
162 |
throw new CoreException(status); |
| 132 |
} |
163 |
} |
| 133 |
return ext.newTabGroup(); |
164 |
return new LaunchConfigurationTabGroupWrapper(ext.newTabGroup(), ext.getIdentifier()); |
|
|
165 |
} |
| 166 |
|
| 167 |
/** |
| 168 |
* Returns the listing of <code>ILaunchConfigurationTab</code>s for the specified <code>ILaunchConfigurationTabGroup</code>. |
| 169 |
* If no tabs are found for the specified id an empty array is returned, never <code>null</code> |
| 170 |
* @param groupid |
| 171 |
* @return the <code>ILaunchConfigurationTab</code>s for the specified <code>ILaunchConfigurationTabGroup</code> id, |
| 172 |
* or an empty array if none are found |
| 173 |
* |
| 174 |
* <p> |
| 175 |
* <strong>EXPERIMENTAL</strong>. This method has been added as |
| 176 |
* part of a work in progress. There is no guarantee that this API will |
| 177 |
* remain unchanged during the 3.3 release cycle. Please do not use this API |
| 178 |
* without consulting with the Platform/Debug team. |
| 179 |
* </p> |
| 180 |
* @since 3.3 |
| 181 |
*/ |
| 182 |
public ILaunchConfigurationTab[] createContributedTabs(String groupid) { |
| 183 |
Hashtable tabs = (Hashtable) fContributedTabs.get(groupid); |
| 184 |
ArrayList list = new ArrayList(); |
| 185 |
if(tabs != null) { |
| 186 |
LaunchConfigurationTabExtension ext = null; |
| 187 |
for(Iterator iter = tabs.keySet().iterator(); iter.hasNext();) { |
| 188 |
ext = (LaunchConfigurationTabExtension) tabs.get(iter.next()); |
| 189 |
if(ext != null) { |
| 190 |
list.add(ext.getTab()); |
| 191 |
} |
| 192 |
} |
| 193 |
} |
| 194 |
return (ILaunchConfigurationTab[]) list.toArray(new ILaunchConfigurationTab[list.size()]); |
| 134 |
} |
195 |
} |
| 135 |
|
196 |
|
| 136 |
/** |
197 |
/** |
|
Lines 187-193
Link Here
|
| 187 |
*/ |
248 |
*/ |
| 188 |
public String getDescription(ILaunchConfigurationType configType, String mode) { |
249 |
public String getDescription(ILaunchConfigurationType configType, String mode) { |
| 189 |
LaunchConfigurationPresentationManager manager = LaunchConfigurationPresentationManager.getDefault(); |
250 |
LaunchConfigurationPresentationManager manager = LaunchConfigurationPresentationManager.getDefault(); |
| 190 |
LaunchConfigurationTabGroupExtension extension = manager.getExtension(configType.getAttribute("id"), mode); //$NON-NLS-1$ |
251 |
LaunchConfigurationTabGroupExtension extension = manager.getExtension(configType.getAttribute(ConfigurationElementConstants.ID), mode); |
| 191 |
return (extension != null ? extension.getDescription(mode) : null); |
252 |
return (extension != null ? extension.getDescription(mode) : null); |
| 192 |
} |
253 |
} |
| 193 |
|
254 |
|