1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 14:15:23 +02:00

Fix descriptor name on edit config dialog.

Use the label provider if there is one.

Also externalizes strings for the dialog.

Change-Id: I3a1e5c7f2b2843cd014a033ee5859832f7e10f9e
This commit is contained in:
Doug Schaefer 2016-11-24 14:52:09 -05:00
parent 303bd3aaa7
commit ecc24ace4d
3 changed files with 29 additions and 6 deletions

View file

@ -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));

View file

@ -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;

View file

@ -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.