Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1417] Plug-in editor: Runtime tab should show selected package #1418

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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<String> 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<String> names(ExportPackageObject[] packages) {
if (packages == null) {
return Collections.emptyList();
}
return Arrays.stream(packages).filter(Objects::nonNull).map(ExportPackageObject::getName).toList();
}

private BundleInputContext getBundleContext() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading