diff options
author | Darin Wright | 2008-05-08 20:07:23 +0000 |
---|---|---|
committer | Darin Wright | 2008-05-08 20:07:23 +0000 |
commit | 9eb9c012cc98f12683c7fb3054127027f261e385 (patch) | |
tree | b6fcfef14b00b143affe55d6025d033e8b2a2787 /org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences | |
parent | 36b4f1ce401fb7a9976e67cd1c72531877aa1577 (diff) | |
download | eclipse.platform.debug-9eb9c012cc98f12683c7fb3054127027f261e385.tar.gz eclipse.platform.debug-9eb9c012cc98f12683c7fb3054127027f261e385.tar.xz eclipse.platform.debug-9eb9c012cc98f12683c7fb3054127027f261e385.zip |
Bug 223851 - Contextual launch not choosing most recent configuration
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences')
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java index a50202b38..18ab779d4 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. + * Copyright (c) 2007, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.debug.internal.ui.preferences; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; @@ -119,7 +120,7 @@ public class RunDebugPropertiesPage extends PropertyPage { layout.marginHeight = 0; fNewButton = SWTFactory.createPushButton(buttonComp, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_2, null); fNewButton.setToolTipText(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_3); - fNewButton.setEnabled(collectTypeCandidates().size() > 0); + fNewButton.setEnabled(collectTypeCandidates().length > 0); fNewButton.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) {} public void widgetSelected(SelectionEvent e) { @@ -237,9 +238,14 @@ public class RunDebugPropertiesPage extends PropertyPage { * mapping of launch shortcut to config type id to derive the applicable types. * @return the listing of applicable launch configuration types for the backing resource */ - protected List collectTypeCandidates() { + protected ILaunchConfigurationType[] collectTypeCandidates() { if(fTypeCandidates == null) { - fTypeCandidates = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getApplicableConfigurationTypes(getResource()); + String[] types = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getApplicableConfigurationTypes(getResource()); + fTypeCandidates = new ArrayList(types.length); + for(int i = 0; i < types.length; i++) { + fTypeCandidates.add(DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(types[i])); + } + Collections.sort(fTypeCandidates, new Comparator() { public int compare(Object o1, Object o2) { ILaunchConfigurationType t1 = (ILaunchConfigurationType) o1; @@ -248,7 +254,7 @@ public class RunDebugPropertiesPage extends PropertyPage { } }); } - return fTypeCandidates; + return (ILaunchConfigurationType[]) fTypeCandidates.toArray(new ILaunchConfigurationType[fTypeCandidates.size()]); } /** @@ -262,9 +268,9 @@ public class RunDebugPropertiesPage extends PropertyPage { if(fOriginalCandidates == null) { fOriginalCandidates = new HashSet(); try { - List configs = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getApplicableLaunchConfigurations(null, resource); - for(Iterator iter = configs.iterator(); iter.hasNext();) { - fOriginalCandidates.add(((ILaunchConfiguration)iter.next()).getWorkingCopy()); + ILaunchConfiguration[] configs = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getApplicableLaunchConfigurations(null, resource); + for(int i = 0; i < configs.length; i++) { + fOriginalCandidates.add(configs[i].getWorkingCopy()); } } catch(CoreException ce) {DebugUIPlugin.log(ce);} @@ -459,7 +465,7 @@ public class RunDebugPropertiesPage extends PropertyPage { */ private void handleNew() { - final List typeCandidates = collectTypeCandidates(); + final ILaunchConfigurationType[] typeCandidates = collectTypeCandidates(); SelectionDialog dialog = new AbstractDebugListSelectionDialog(getShell()){ |