Ignore:
Timestamp:
2009-09-16T17:55:01+02:00 (17 years ago)
Author:
stoecker
Message:

applied #3061 - patch by avar - search in plugin list

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/PluginPreference.java

    r2017 r2147  
    1717import javax.swing.JLabel;
    1818import javax.swing.JList;
     19import javax.swing.JTextField;
    1920import javax.swing.JOptionPane;
    2021import javax.swing.JPanel;
    2122import javax.swing.JScrollPane;
    2223import javax.swing.Scrollable;
     24import javax.swing.event.DocumentEvent;
     25import javax.swing.event.DocumentListener;
    2326
    2427import org.openstreetmap.josm.Main;
     
    4043    private JScrollPane pluginPane;
    4144    private PluginSelection selection = new PluginSelection();
     45    private JTextField txtFilter;
    4246
    4347    public void addGui(final PreferenceDialog gui) {
    4448        this.gui = gui;
    4549        plugin = gui.createPreferenceTab("plugin", tr("Plugins"), tr("Configure available plugins."), false);
     50
     51        txtFilter = new JTextField();
     52        JLabel lbFilter = new JLabel(tr("Search: "));
     53        lbFilter.setLabelFor(txtFilter);
     54        plugin.add(lbFilter);
     55        plugin.add(txtFilter, GBC.eol().fill(GBC.HORIZONTAL));
     56        txtFilter.getDocument().addDocumentListener(new DocumentListener(){
     57            public void changedUpdate(DocumentEvent e) {
     58                action();
     59            }
     60
     61            public void insertUpdate(DocumentEvent e) {
     62                action();
     63            }
     64
     65            public void removeUpdate(DocumentEvent e) {
     66                action();
     67            }
     68
     69            private void action() {
     70                selection.drawPanel(pluginPanel);
     71            }
     72        });
     73        plugin.add(GBC.glue(0,10), GBC.eol());
     74
     75        /* main plugin area */
    4676        pluginPane = new JScrollPane(pluginPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    4777        pluginPane.setBorder(null);
    4878        plugin.add(pluginPane, GBC.eol().fill(GBC.BOTH));
    4979        plugin.add(GBC.glue(0,10), GBC.eol());
     80
     81        /* buttons at the bottom */
    5082        JButton morePlugins = new JButton(tr("Download List"));
    5183        morePlugins.addActionListener(new ActionListener(){
     
    72104        plugin.add(configureSites, GBC.std());
    73105
     106        selection.passTxtFilter(txtFilter);
    74107        selection.drawPanel(pluginPanel);
    75108    }
Note: See TracChangeset for help on using the changeset viewer.