Ticket #7541: 7541.patch

File 7541.patch, 2.4 KB (added by xeen, 14 years ago)

This works for me. Plugin list is only loaded once and properly displayed. The progress bar probably needs to be reworked though since it hides even when the list is still being rendered. This patch only applies if it’s enough to read the plugin data once.

  • src/org/openstreetmap/josm/gui/preferences/PluginPreference.java

    ### Eclipse Workspace Patch 1.0
    #P JOSM
     
    55import static org.openstreetmap.josm.tools.I18n.trn;
    66
    77import java.awt.BorderLayout;
    8 import java.awt.Component;
    98import java.awt.GridBagConstraints;
    109import java.awt.GridBagLayout;
    1110import java.awt.GridLayout;
     
    3332import javax.swing.JTextField;
    3433import javax.swing.SwingUtilities;
    3534import javax.swing.UIManager;
    36 import javax.swing.event.ChangeEvent;
    37 import javax.swing.event.ChangeListener;
    3835import javax.swing.event.DocumentEvent;
    3936import javax.swing.event.DocumentListener;
    4037
     
    6057            return new PluginPreference();
    6158        }
    6259    }
    63    
     60
    6461    private PluginPreference() {
    6562        super("plugin", tr("Plugins"), tr("Configure available plugins."));
    6663    }
     
    184181        gc.fill = GridBagConstraints.BOTH;
    185182        PreferencePanel plugins = gui.createPreferenceTab(this);
    186183        plugins.add(buildContentPanel(), gc);
    187         //pnlPluginPreferences.refreshView(); // fix #7541, refreshView() will be called when the first tab will be selected
    188         gui.addChangeListener(new PluginPreferenceActivationListener(plugins));
     184        readLocalPluginInformation();
     185        pluginPreferencesActivated = true;
     186        pnlPluginPreferences.refreshView();
    189187    }
    190188
    191189    private void configureSites() {
     
    409407    }
    410408
    411409    /**
    412      * Listens to the activation of the plugin preferences tab. On activation it
    413      * reloads plugin information from the local file system.
    414      *
    415      */
    416     class PluginPreferenceActivationListener implements ChangeListener {
    417         private Component pane;
    418         public PluginPreferenceActivationListener(Component preferencesPane) {
    419             pane = preferencesPane;
    420         }
    421 
    422         public void stateChanged(ChangeEvent e) {
    423             JTabbedPane tp = (JTabbedPane)e.getSource();
    424             if (tp.getSelectedComponent() == pane && !pluginPreferencesActivated) {
    425                 readLocalPluginInformation();
    426                 pluginPreferencesActivated = true;
    427             }
    428         }
    429     }
    430 
    431     /**
    432410     * Applies the current filter condition in the filter text field to the
    433411     * model
    434412     */