diff options
author | Sarika Sinha | 2018-05-11 09:37:53 +0000 |
---|---|---|
committer | Sarika Sinha | 2018-05-14 06:21:32 +0000 |
commit | 777d7a4ea604cd14f2e013e012fc9f281df4697f (patch) | |
tree | 6015605606f1f402842a5bfe1ca16c7897cc9644 | |
parent | c8f280c0c218dbca2a1074db547b0e63beb01489 (diff) | |
download | eclipse.platform.debug-I20180522-0800.tar.gz eclipse.platform.debug-I20180522-0800.tar.xz eclipse.platform.debug-I20180522-0800.zip |
Bug 517809 - Modes in Launches tab of Launch Group use mode namesS4_8_0_RC2S4_8_0_RC1I20180528-0800I20180527-2250I20180527-2000I20180527-0800I20180526-1500I20180526-0800I20180525-2000I20180524-0900I20180523-2000I20180523-0800I20180522-2000I20180522-0800I20180521-2000I20180521-0800I20180520-2000I20180520-0800I20180519-1500I20180519-0800I20180518-2000I20180516-2000I20180516-0800I20180515-2000I20180515-1755I20180515-1620I20180515-1440I20180515-1300I20180515-0950I20180515-0800I20180514-2000I20180514-0800
instead of labels
Change-Id: I2e62b93ee3810b06f75278db08f423f08bf60b2d
2 files changed, 104 insertions, 70 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationSelectionDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationSelectionDialog.java index 2b5f0ac04..77b78ecc9 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationSelectionDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationSelectionDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 QNX Software Systems and others. + * Copyright (c) 2009, 2018 QNX Software Systems 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,17 +10,15 @@ * Freescale Semiconductor * SSI Schaefer * Axel Richard (Obeo) - Bug 41353 - Launch configurations prototypes + * IBM Corporation - Bug 517809 *******************************************************************************/ package org.eclipse.debug.internal.ui.groups; import java.util.ArrayList; -import java.util.Arrays; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.Set; -import java.util.TreeSet; import java.util.regex.Pattern; import org.eclipse.core.runtime.CoreException; @@ -28,23 +26,19 @@ import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationType; import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.internal.core.DebugCoreMessages; import org.eclipse.debug.internal.core.groups.GroupLaunchConfigurationDelegate; import org.eclipse.debug.internal.core.groups.GroupLaunchElement; import org.eclipse.debug.internal.core.groups.GroupLaunchElement.GroupElementPostLaunchAction; import org.eclipse.debug.internal.ui.DebugUIMessages; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationFilteredTree; -import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager; import org.eclipse.debug.internal.ui.launchConfigurations.LaunchGroupFilter; -import org.eclipse.debug.internal.ui.launchConfigurations.LaunchHistory; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.ILaunchGroup; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.TitleAreaDialog; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.GridLayoutFactory; -import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; @@ -152,25 +146,7 @@ class GroupLaunchConfigurationSelectionDialog extends TitleAreaDialog implements // dialog message area (not title bar) setTitle(fForEditing ? DebugUIMessages.GroupLaunchConfigurationSelectionDialog_15 : DebugUIMessages.GroupLaunchConfigurationSelectionDialog_14); - Map<String, ILaunchGroup> modes = new LinkedHashMap<>(); - modes.put(GroupLaunchElement.MODE_INHERIT, new InheritModeGroup()); - Set<ILaunchGroup> sortedGroups = new TreeSet<>((a, b) -> { - return a.getLabel().compareTo(b.getLabel()); - }); - LaunchConfigurationManager mgr = DebugUIPlugin.getDefault().getLaunchConfigurationManager(); - sortedGroups.addAll(Arrays.asList(mgr.getLaunchGroups())); - for (ILaunchGroup launchGroup : sortedGroups) { - LaunchHistory history = mgr.getLaunchHistory(launchGroup.getIdentifier()); - if (history == null) { - // mode currently not supported. - continue; - } - - String modeName = launchGroup.getMode(); - if (!modes.containsKey(modeName)) { - modes.put(modeName, launchGroup); - } - } + Map<String, ILaunchGroup> modes = GroupLaunchConfigurationTabGroup.getModes(); // the tree requires a non-null group. use inherit as dummy as this will // not cause filtering. @@ -457,45 +433,4 @@ class GroupLaunchConfigurationSelectionDialog extends TitleAreaDialog implements fSelection = fInitialSelection; } - /** - * Required to satisfy the tree in mode inherit. - */ - private static final class InheritModeGroup implements ILaunchGroup { - - @Override - public ImageDescriptor getImageDescriptor() { - return null; - } - - @Override - public ImageDescriptor getBannerImageDescriptor() { - return null; - } - - @Override - public String getLabel() { - return DebugCoreMessages.GroupLaunchElement_inherit_launch_mode_label; - } - - @Override - public String getIdentifier() { - return null; - } - - @Override - public String getCategory() { - return null; - } - - @Override - public String getMode() { - return null; - } - - @Override - public boolean isPublic() { - return false; - } - - } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationTabGroup.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationTabGroup.java index 074ee4441..a70137904 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationTabGroup.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationTabGroup.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2012, 2016 QNX Software Systems and others. + * Copyright (c) 2009, 2018 QNX Software Systems 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 @@ -9,18 +9,25 @@ * QNX Software Systems - initial API and implementation * Freescale Semiconductor * SSI Schaefer + * IBM Corporation - Bug 517809 *******************************************************************************/ package org.eclipse.debug.internal.ui.groups; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.Iterator; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.internal.core.DebugCoreMessages; import org.eclipse.debug.internal.core.groups.GroupLaunchConfigurationDelegate; import org.eclipse.debug.internal.core.groups.GroupLaunchElement; import org.eclipse.debug.internal.core.groups.GroupLaunchElement.GroupElementPostLaunchAction; @@ -29,11 +36,15 @@ import org.eclipse.debug.internal.ui.DebugUIMessages; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; import org.eclipse.debug.internal.ui.SWTFactory; +import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager; +import org.eclipse.debug.internal.ui.launchConfigurations.LaunchHistory; import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.ILaunchConfigurationDialog; import org.eclipse.debug.ui.ILaunchConfigurationTab; +import org.eclipse.debug.ui.ILaunchGroup; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.BaseLabelProvider; import org.eclipse.jface.viewers.CheckStateChangedEvent; import org.eclipse.jface.viewers.CheckboxTreeViewer; @@ -148,7 +159,7 @@ public class GroupLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio // launch mode if (columnIndex == 1) { - return el.mode + (el.adoptIfRunning ? DebugUIMessages.GroupLaunchConfigurationTabGroup_lblAdopt : ""); //$NON-NLS-1$ + return getLabel(el.mode) + (el.adoptIfRunning ? DebugUIMessages.GroupLaunchConfigurationTabGroup_lblAdopt : ""); //$NON-NLS-1$ } // launch post action @@ -579,4 +590,92 @@ public class GroupLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio }; setTabs(tabs); } + + public static Map<String, ILaunchGroup> getModes() { + if (modes == null) { + initializeModes(); + } + return modes; + } + + private static Map<String, ILaunchGroup> modes; + + /** + * Required to satisfy the tree in mode inherit. + */ + private static final class InheritModeGroup implements ILaunchGroup { + + @Override + public ImageDescriptor getImageDescriptor() { + return null; + } + + @Override + public ImageDescriptor getBannerImageDescriptor() { + return null; + } + + @Override + public String getLabel() { + return DebugCoreMessages.GroupLaunchElement_inherit_launch_mode_label; + } + + @Override + public String getIdentifier() { + return null; + } + + @Override + public String getCategory() { + return null; + } + + @Override + public String getMode() { + return null; + } + + @Override + public boolean isPublic() { + return false; + } + + } + + private static synchronized void initializeModes() { + if (modes != null) { + return; + } + modes = new LinkedHashMap<>(); + modes.put(GroupLaunchElement.MODE_INHERIT, new InheritModeGroup()); + Set<ILaunchGroup> sortedGroups = new TreeSet<>((a, b) -> { + return a.getLabel().compareTo(b.getLabel()); + }); + LaunchConfigurationManager mgr = DebugUIPlugin.getDefault().getLaunchConfigurationManager(); + sortedGroups.addAll(Arrays.asList(mgr.getLaunchGroups())); + for (ILaunchGroup launchGroup : sortedGroups) { + LaunchHistory history = mgr.getLaunchHistory(launchGroup.getIdentifier()); + if (history == null) { + // mode currently not supported. + continue; + } + + String modeName = launchGroup.getMode(); + if (!modes.containsKey(modeName)) { + modes.put(modeName, launchGroup); + } + } + } + + public static String getLabel(String mode) { + if (mode == null || mode.isEmpty()) + { + return ""; //$NON-NLS-1$ + } + if (modes == null) { + initializeModes(); + } + ILaunchGroup launchGrp = modes.get(mode); + return DebugUIPlugin.removeAccelerators(launchGrp.getLabel()); + } } |