Ghidra is a software reverse engineering (SRE) framework
Merge remote-tracking branch 'origin/GT-3030_ghidravore_PR-372_technateNG_PluginManager-fix'
ghidravore8b67e3c1e506
diff --cc Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/dialog/PluginManagerComponent.javaindex 7787e82abe,139ff4c0a5..2401078cd5--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/dialog/PluginManagerComponent.java+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/dialog/PluginManagerComponent.java@@@ -77,55 -74,95 +76,95 @@@ public class PluginManagerComponent exttool.showDialog(pluginTableDialog);}- class PluginPackageComponent extends JPanel {- private Color BG = Color.white;+ private class PluginPackageComponent extends JPanel {+ private final Color BG = Color.white;private final PluginPackage pluginPackage;- private JCheckBox jCheckBox;-- private final JCheckBox jCheckBox;++ private final GCheckBox checkBox;+PluginPackageComponent(PluginPackage pluginPackage) {super(new BorderLayout());setBackground(BG);+this.pluginPackage = pluginPackage;- JPanel panel = new JPanel(new HorizontalLayout(0));- panel.setBackground(BG);- jCheckBox = new GCheckBox();- jCheckBox.addActionListener(e -> checkBoxClicked());- this.jCheckBox = new JCheckBox();++ this.checkBox = new GCheckBox();++ initizalizeCheckBoxSection();+ initializeLabelSection();+ initializeDescriptionSection();++ setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY));+ updateCheckBoxState();+ }++ private void initizalizeCheckBoxSection() {+ final JPanel checkboxPanel = new JPanel(new HorizontalLayout(0));+ checkboxPanel.setBackground(BG);+- jCheckBox.addActionListener(e -> checkBoxClicked());++ checkBox.addActionListener(e -> checkBoxClicked());if (!pluginPackage.isfullyAddable()) {-- jCheckBox.setEnabled(false);++ checkBox.setEnabled(false);}- panel.add(Box.createHorizontalStrut(10));-- jCheckBox.setBackground(BG);- panel.add(jCheckBox);- panel.add(Box.createHorizontalStrut(10));- JLabel label =++ checkBox.setBackground(BG);++ checkboxPanel.add(Box.createHorizontalStrut(10));- checkboxPanel.add(jCheckBox);++ checkboxPanel.add(checkBox);+ checkboxPanel.add(Box.createHorizontalStrut(10));++ final JLabel iconLabel =- new JLabel(ResourceManager.getScaledIcon(pluginPackage.getIcon(), 32, 32, 32));+ new GIconLabel(ResourceManager.getScaledIcon(pluginPackage.getIcon(), 32, 32, 32));- label.setBackground(BG);- panel.add(label);- panel.add(Box.createHorizontalStrut(10));- add(panel, BorderLayout.WEST);-- JPanel labelPanel = new JPanel(new VerticalLayout(3));- labelPanel.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0));+ iconLabel.setBackground(BG);++ checkboxPanel.add(iconLabel);+ checkboxPanel.add(Box.createHorizontalStrut(10));+ checkboxPanel.setPreferredSize(new Dimension(84, 70));++ add(checkboxPanel, BorderLayout.WEST);+ }++ private void initializeLabelSection() {+ final JPanel centerPanel = new JPanel(new GridBagLayout());+ GridBagConstraints gbc = new GridBagConstraints();+ gbc.fill = GridBagConstraints.HORIZONTAL;+ gbc.weightx = 1.0;++ centerPanel.setBackground(BG);++ final JPanel labelPanel = new JPanel(new VerticalLayout(3));labelPanel.setBackground(BG);- label = new GLabel(pluginPackage.getName());- //label.setVerticalAlignment(SwingConstants.TOP);- label.setFont(label.getFont().deriveFont(18f));- label.setForeground(Color.BLACK);- labelPanel.add(label);- HyperlinkComponent hyper =- new HyperlinkComponent("<html> <a href=\"Configure\">Configure</a>");- hyper.addHyperlinkListener("Configure", e -> {- if (e.getEventType() == EventType.ACTIVATED) {- managePlugins(PluginPackageComponent.this.pluginPackage);- }- });- hyper.setBackground(BG);- labelPanel.add(hyper);- labelPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 40));-- add(labelPanel);- String htmlDescription = getHTMLDescription();- JLabel descriptionlabel = new GHtmlLabel(htmlDescription);+- final JLabel nameLabel = new JLabel(pluginPackage.getName());++ final GLabel nameLabel = new GLabel(pluginPackage.getName());+ nameLabel.setFont(nameLabel.getFont().deriveFont(18f));+ nameLabel.setForeground(Color.BLACK);+ labelPanel.add(nameLabel);++ final HyperlinkComponent configureHyperlink = createConfigureHyperlink();+ labelPanel.add(configureHyperlink);++ labelPanel.setBorder(BorderFactory.createEmptyBorder(0, 25, 0, 40));+ centerPanel.add(labelPanel, gbc);+ add(centerPanel);+ }++ private HyperlinkComponent createConfigureHyperlink() {+ final HyperlinkComponent configureHyperlink =+ new HyperlinkComponent("<html> <a href=\"Configure\">Configure</a>");+ configureHyperlink.addHyperlinkListener("Configure", e -> {+ if (e.getEventType() == EventType.ACTIVATED) {+ managePlugins(PluginPackageComponent.this.pluginPackage);+ }+ });+ configureHyperlink.setBackground(BG);+ return configureHyperlink;+ }++ private String enchanceDescription(final String text) {+ return String.format("<html><body style='width: 300px'>%s</body></html>", text);+ }++ private void initializeDescriptionSection() {+ final String htmlDescription = enchanceDescription(pluginPackage.getDescription());+- final JLabel descriptionlabel = new JLabel(htmlDescription);++ final JLabel descriptionlabel = new GHtmlLabel(htmlDescription);descriptionlabel.setForeground(Color.GRAY);descriptionlabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));descriptionlabel.setVerticalAlignment(SwingConstants.TOP);@@@ -136,15 -173,7 +175,7 @@@}protected void checkBoxClicked() {-- boolean isSelected = jCheckBox.isSelected();++ boolean isSelected = checkBox.isSelected();if (isSelected) {model.addAllPlugins(pluginPackage);}@@@ -155,7 -184,7 +186,7 @@@}void updateCheckBoxState() {-- jCheckBox.setSelected(++ checkBox.setSelected(model.getPackageState(pluginPackage) != PluginPackageState.NO_PLUGINS_LOADED);}}