From ecc24ace4da910e4735ecdf20dce88ff623f5e18 Mon Sep 17 00:00:00 2001 From: Doug Schaefer Date: Thu, 24 Nov 2016 14:52:09 -0500 Subject: [PATCH] Fix descriptor name on edit config dialog. Use the label provider if there is one. Also externalizes strings for the dialog. Change-Id: I3a1e5c7f2b2843cd014a033ee5859832f7e10f9e --- .../internal/LaunchBarLaunchConfigDialog.java | 23 ++++++++++++++----- .../launchbar/ui/internal/Messages.java | 8 +++++++ .../launchbar/ui/internal/messages.properties | 4 ++++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/LaunchBarLaunchConfigDialog.java b/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/LaunchBarLaunchConfigDialog.java index c3c65d2f6ef..11d22c2f5c4 100644 --- a/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/LaunchBarLaunchConfigDialog.java +++ b/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/LaunchBarLaunchConfigDialog.java @@ -12,10 +12,12 @@ import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.TitleAreaDialog; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.operation.ModalContext; +import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.wizard.ProgressMonitorPart; import org.eclipse.launchbar.core.ILaunchDescriptor; import org.eclipse.launchbar.core.target.ILaunchTarget; import org.eclipse.launchbar.ui.ILaunchBarLaunchConfigDialog; +import org.eclipse.launchbar.ui.ILaunchBarUIManager; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.custom.CTabItem; @@ -70,19 +72,28 @@ public class LaunchBarLaunchConfigDialog extends TitleAreaDialog implements ILau composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parent.getFont()); - getShell().setText("Edit Configuration"); + getShell().setText(Messages.LaunchBarLaunchConfigDialog_EditConfiguration); boolean supportsTargets = true; try { supportsTargets = descriptor.getType().supportsTargets(); } catch (CoreException e) { Activator.log(e); } - if (supportsTargets) { - setTitle(String.format("Edit %s for %s on %s", descriptor.getName(), mode.getLabel(), target.getId())); - } else { - setTitle(String.format("Edit %s for %s", descriptor.getName(), mode.getLabel())); + + try { + ILaunchBarUIManager uiManager = Activator.getService(ILaunchBarUIManager.class); + ILabelProvider labelProvider = uiManager.getLabelProvider(descriptor); + String descName = labelProvider != null ? labelProvider.getText(descriptor) : descriptor.getName(); + if (supportsTargets) { + setTitle(String.format(Messages.LaunchBarLaunchConfigDialog_Edit2, descName, mode.getLabel(), target.getId())); + } else { + setTitle(String.format(Messages.LaunchBarLaunchConfigDialog_Edit1, descName, mode.getLabel())); + } + } catch (CoreException e) { + Activator.log(e); } - setMessage("Set parameters for the configuration."); + + setMessage(Messages.LaunchBarLaunchConfigDialog_SetParameters); tabFolder = new CTabFolder(composite, SWT.NONE); tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); diff --git a/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/Messages.java b/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/Messages.java index ed4c60c346e..aa8c1687353 100644 --- a/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/Messages.java +++ b/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/Messages.java @@ -41,6 +41,14 @@ public class Messages extends NLS { public static String CannotEditLaunchConfiguration; public static String NoLaunchModeSelected; public static String NoLaunchGroupSelected; + public static String LaunchBarLaunchConfigDialog_Edit1; + + public static String LaunchBarLaunchConfigDialog_Edit2; + + public static String LaunchBarLaunchConfigDialog_EditConfiguration; + + public static String LaunchBarLaunchConfigDialog_SetParameters; + public static String LaunchConfigurationNotFound; public static String LaunchConfigurationNotFoundDesc; public static String NoLaunchTabsDefined; diff --git a/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/messages.properties b/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/messages.properties index 31942645c4c..bab31f6113c 100644 --- a/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/messages.properties +++ b/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/messages.properties @@ -34,6 +34,10 @@ NoLaunchConfigType=No launch configuration type matches selected launch descript CannotEditLaunchConfiguration=Cannot edit this configuration. NoLaunchModeSelected=No launch mode selected. NoLaunchGroupSelected=No launch group found for the current selection. +LaunchBarLaunchConfigDialog_Edit1=Edit %s for %s +LaunchBarLaunchConfigDialog_Edit2=Edit %s for %s on %s +LaunchBarLaunchConfigDialog_EditConfiguration=Edit Configuration +LaunchBarLaunchConfigDialog_SetParameters=Set parameters for the configuration. LaunchConfigurationNotFound=Launch Configuration Not Found LaunchConfigurationNotFoundDesc=No launch configuration is found for the given launch descriptor and target. NoLaunchTabsDefined=No launch tabs defined.