diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java index 3eea5272e9..f2c95b8117 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java @@ -2243,6 +2243,10 @@ public class PDEUIMessages extends NLS { public static String ExportPackageVisibilitySection_default; + public static String ExportPackageVisibilitySection_one; + + public static String ExportPackageVisibilitySection_many; + public static String ExportPackageVisibilitySection_hideAll; public static String ExportPackageSection_add; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExportPackageVisibilitySection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExportPackageVisibilitySection.java index 0fbc87beae..834a15fee8 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExportPackageVisibilitySection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExportPackageVisibilitySection.java @@ -19,7 +19,11 @@ import static org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IMenuManager; @@ -31,6 +35,7 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.window.Window; +import org.eclipse.osgi.util.NLS; import org.eclipse.pde.core.IBaseModel; import org.eclipse.pde.core.IModelChangedEvent; import org.eclipse.pde.core.plugin.IPluginModelBase; @@ -373,6 +378,30 @@ private void update(ExportPackageObject[] objects) { getTablePart().setButtonEnabled(1, fInternalButton.getSelection() && isEditable()); fFriendViewer.setInput(object); fBlockChanges = false; + getSection().setDescription(description(objects)); + } + + private String description(ExportPackageObject[] packages) { + List names = names(packages); + switch (names.size()) { + case 0: { + return PDEUIMessages.ExportPackageVisibilitySection_default; + } + case 1: { + return NLS.bind(PDEUIMessages.ExportPackageVisibilitySection_one, names.get(0)); + } + default: + return NLS.bind(PDEUIMessages.ExportPackageVisibilitySection_many, + names.stream().collect(Collectors.joining(", "))); //$NON-NLS-1$ + } + + } + + private List names(ExportPackageObject[] packages) { + if (packages == null) { + return Collections.emptyList(); + } + return Arrays.stream(packages).filter(Objects::nonNull).map(ExportPackageObject::getName).toList(); } private BundleInputContext getBundleContext() { diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties index b1ef2e0fa9..2eb3c74ab2 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties @@ -2246,7 +2246,9 @@ ExportPackageSection_findReferences=Find References ExportOptionsTab_antReservedMessage=build.xml is a file name reserved for PDE ExportOptionsTab_allowBinaryCycles=A&llow for binary cycles in target platform ExportOptionsTab_use_workspace_classfiles=&Use class files compiled in the workspace -ExportPackageVisibilitySection_default=The select package is: +ExportPackageVisibilitySection_default=The selected package is: +ExportPackageVisibilitySection_one=The selected package {0} is: +ExportPackageVisibilitySection_many=The selected packages {0} are: ExportPackageVisibilitySection_hideAll=provisional API, generating warnings, except for: CrossPlatformExportPage_available=&Available platforms: CrossPlatformExportPage_title=Cross-platform export