This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 219457
Collapse All | Expand All

(-)a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/options/JavaDebuggerOptionsPanelController.java (+5 lines)
Lines 101-106 Link Here
101
        pcs.removePropertyChangeListener(l);
101
        pcs.removePropertyChangeListener(l);
102
    }
102
    }
103
103
104
    @Override
105
    public void handleSuccessfulSearch(String searchText) {
106
        getPanel().handleSearch(searchText);
107
    }
108
104
    private JavaDebuggerPanel getPanel() {
109
    private JavaDebuggerPanel getPanel() {
105
        if (panel == null) {
110
        if (panel == null) {
106
            panel = new JavaDebuggerPanel(this);
111
            panel = new JavaDebuggerPanel(this);
(-)a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/options/JavaDebuggerPanel.java (+4 lines)
Lines 175-180 Link Here
175
        categoryPanel.repaint();
175
        categoryPanel.repaint();
176
    }
176
    }
177
177
178
    public void handleSearch(String searchText) {
179
        categoriesList.setSelectedIndex(1);
180
    }
181
178
    public void load() {
182
    public void load() {
179
        for (StorablePanel p : categoryPanels) {
183
        for (StorablePanel p : categoryPanels) {
180
            p.load();
184
            p.load();
(-)a/options.api/apichanges.xml (+15 lines)
Lines 75-80 Link Here
75
<!-- ACTUAL CHANGES BEGIN HERE: -->
75
<!-- ACTUAL CHANGES BEGIN HERE: -->
76
76
77
<changes>
77
<changes>
78
    <change id="OptionsPanelController.handleSuccessfulSearch">
79
        <api name="OptionsAPI"/>
80
        <summary>API to handle successfull search in some panel in options window</summary>
81
        <version major="1" minor="30"/>
82
        <date day="18" month="10" year="2012"/>
83
        <author login="theofanis"/>
84
        <compatibility addition="yes"/>
85
        <description>
86
            Added API to handle successful search in some panel in options window.
87
            By default no action is performed. Each implementor should make special actions,
88
            for example to choose a specific sub-panel, if this is required.
89
        </description>
90
        <class package="org.netbeans.spi.options" name="OptionsPanelController"/>
91
        <issue number="219457"/>
92
    </change>
78
    <change id="optionsSearchAnnotation">
93
    <change id="optionsSearchAnnotation">
79
      <api name="OptionsAPI"/>
94
      <api name="OptionsAPI"/>
80
      <summary>Annotation to register keywords for some panel in the Options dialog</summary>
95
      <summary>Annotation to register keywords for some panel in the Options dialog</summary>
(-)a/options.api/src/org/netbeans/modules/options/CategoryModel.java (+4 lines)
Lines 369-374 Link Here
369
            return category.getCategoryName();
369
            return category.getCategoryName();
370
        }
370
        }
371
371
372
        public void handleSuccessfulSearchInController(String searchText) {
373
            create().handleSuccessfulSearch(searchText);
374
        }
375
372
        private synchronized OptionsPanelController create() {
376
        private synchronized OptionsPanelController create() {
373
            if (controller == null) {
377
            if (controller == null) {
374
                controller = category.create();
378
                controller = category.create();
(-)a/options.api/src/org/netbeans/modules/options/OptionsPanel.java (-14 / +1 lines)
Lines 136-142 Link Here
136
    private HashMap<String, ArrayList<String>> categoryid2words = new HashMap<String, ArrayList<String>>();
136
    private HashMap<String, ArrayList<String>> categoryid2words = new HashMap<String, ArrayList<String>>();
137
    private HashMap<String, HashMap<Integer, TabInfo>> categoryid2tabs = new HashMap<String, HashMap<Integer, TabInfo>>();
137
    private HashMap<String, HashMap<Integer, TabInfo>> categoryid2tabs = new HashMap<String, HashMap<Integer, TabInfo>>();
138
    private ArrayList<String> disabledCategories = new ArrayList<String>();
138
    private ArrayList<String> disabledCategories = new ArrayList<String>();
139
    private JTextField keymapsSearch = null;
140
139
141
    private ArrayList<FileObject> advancedFOs = new ArrayList<FileObject>();
140
    private ArrayList<FileObject> advancedFOs = new ArrayList<FileObject>();
142
    private HashMap<String, Integer> dublicateKeywordsFOs = new HashMap<String, Integer>();
141
    private HashMap<String, Integer> dublicateKeywordsFOs = new HashMap<String, Integer>();
Lines 466-478 Link Here
466
            component = components[i];
465
            component = components[i];
467
            String text;
466
            String text;
468
            
467
            
469
            if (component instanceof JLabel) {
470
                text = ((JLabel) component).getText();
471
                // hack to search into Keymaps category
472
                if(categoryID.equals("Keymaps") && text.equals("Search:")) { // NOI18N
473
                    keymapsSearch = (JTextField)((JLabel) component).getLabelFor();
474
                }
475
            }
476
            if(component instanceof JTabbedPane) {
468
            if(component instanceof JTabbedPane) {
477
                if(categoryid2tabbedpane.get(categoryID) == null) {
469
                if(categoryid2tabbedpane.get(categoryID) == null) {
478
                    categoryid2tabbedpane.put(categoryID, (JTabbedPane)component);
470
                    categoryid2tabbedpane.put(categoryID, (JTabbedPane)component);
Lines 629-643 Link Here
629
                        } else {
621
                        } else {
630
                            setCurrentCategory(CategoryModel.getInstance().getCategory(id), null);
622
                            setCurrentCategory(CategoryModel.getInstance().getCategory(id), null);
631
                        }
623
                        }
624
                        CategoryModel.getInstance().getCurrent().handleSuccessfulSearchInController(searchText);
632
                    } else {
625
                    } else {
633
                        handleNotFound(id, exactCategory);
626
                        handleNotFound(id, exactCategory);
634
                    }
627
                    }
635
                } else {
628
                } else {
636
                    handleNotFound(id, exactCategory);
629
                    handleNotFound(id, exactCategory);
637
                }
630
                }
638
                if (keymapsSearch != null) {
639
                    keymapsSearch.setText(searchText);
640
                }
641
            }
631
            }
642
        }
632
        }
643
633
Lines 721-729 Link Here
721
            }
711
            }
722
            setCurrentCategory(CategoryModel.getInstance().getCurrent(), null);
712
            setCurrentCategory(CategoryModel.getInstance().getCurrent(), null);
723
            disabledCategories.clear();
713
            disabledCategories.clear();
724
            if(keymapsSearch != null) {
725
                keymapsSearch.setText(""); //NOI18N
726
            }
727
        }
714
        }
728
    }
715
    }
729
    
716
    
(-)a/options.api/src/org/netbeans/modules/options/TabbedController.java (-3 / +11 lines)
Lines 103-109 Link Here
103
    private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
103
    private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
104
    private final ChangeListener tabbedPaneChangeListener = new ChangeListener() {
104
    private final ChangeListener tabbedPaneChangeListener = new ChangeListener() {
105
        public void stateChanged(ChangeEvent e) {
105
        public void stateChanged(ChangeEvent e) {
106
            handleTabSwitched();
106
            handleTabSwitched(null);
107
        }
107
        }
108
    };
108
    };
109
109
Lines 170-175 Link Here
170
        return pane;
170
        return pane;
171
    }
171
    }
172
172
173
    @Override
174
    public void handleSuccessfulSearch(String searchText) {
175
        handleTabSwitched(searchText);
176
    }
177
173
    private void initTabbedPane() {
178
    private void initTabbedPane() {
174
        if (pane != null) {
179
        if (pane != null) {
175
            pane.removeChangeListener(tabbedPaneChangeListener);
180
            pane.removeChangeListener(tabbedPaneChangeListener);
Lines 178-190 Link Here
178
                pane.addTab(tabTitle, new JLabel(tabTitle));
183
                pane.addTab(tabTitle, new JLabel(tabTitle));
179
            }
184
            }
180
            pane.addChangeListener(tabbedPaneChangeListener);
185
            pane.addChangeListener(tabbedPaneChangeListener);
181
            handleTabSwitched();
186
            handleTabSwitched(null);
182
        }
187
        }
183
    }
188
    }
184
189
185
190
186
    /** Replace placeholder with real panel and change help context. */
191
    /** Replace placeholder with real panel and change help context. */
187
    private void handleTabSwitched() {
192
    private void handleTabSwitched(String searchText) {
188
        final int selectedIndex = pane.getSelectedIndex();
193
        final int selectedIndex = pane.getSelectedIndex();
189
        if (selectedIndex != -1) {
194
        if (selectedIndex != -1) {
190
            String tabTitle = pane.getTitleAt(selectedIndex);
195
            String tabTitle = pane.getTitleAt(selectedIndex);
Lines 213-218 Link Here
213
                pane.setComponentAt(selectedIndex, scroll);
218
                pane.setComponentAt(selectedIndex, scroll);
214
                controller.update();
219
                controller.update();
215
            }
220
            }
221
            if (searchText != null) {
222
                controller.handleSuccessfulSearch(searchText);
223
            }
216
            pcs.firePropertyChange(OptionsPanelController.PROP_HELP_CTX, null, null);
224
            pcs.firePropertyChange(OptionsPanelController.PROP_HELP_CTX, null, null);
217
        }
225
        }
218
    }
226
    }
(-)a/options.api/src/org/netbeans/modules/options/advanced/AdvancedPanel.java (-3 / +10 lines)
Lines 80-86 Link Here
80
    private String subpath;
80
    private String subpath;
81
    private ChangeListener changeListener = new ChangeListener () {
81
    private ChangeListener changeListener = new ChangeListener () {
82
            public void stateChanged(ChangeEvent e) {
82
            public void stateChanged(ChangeEvent e) {
83
                handleTabSwitched();
83
                handleTabSwitched(null);
84
            }
84
            }
85
        };
85
        };
86
    
86
    
Lines 155-161 Link Here
155
            tabbedPanel.addTab(category, new JLabel(category));
155
            tabbedPanel.addTab(category, new JLabel(category));
156
        }
156
        }
157
        tabbedPanel.addChangeListener(changeListener);
157
        tabbedPanel.addChangeListener(changeListener);
158
        handleTabSwitched();
158
        handleTabSwitched(null);
159
    }
159
    }
160
    
160
    
161
    public void setCurrentSubcategory(String path) {
161
    public void setCurrentSubcategory(String path) {
Lines 190-196 Link Here
190
        return categoryDisplayName;
190
        return categoryDisplayName;
191
    }
191
    }
192
192
193
    private void handleTabSwitched() {        
193
    private void handleTabSwitched(String searchText) {
194
        final int selectedIndex = tabbedPanel.getSelectedIndex() >= 0 ? tabbedPanel.getSelectedIndex() : -1;
194
        final int selectedIndex = tabbedPanel.getSelectedIndex() >= 0 ? tabbedPanel.getSelectedIndex() : -1;
195
        if (selectedIndex != -1) {
195
        if (selectedIndex != -1) {
196
            String category = tabbedPanel.getTitleAt(selectedIndex);
196
            String category = tabbedPanel.getTitleAt(selectedIndex);
Lines 206-214 Link Here
206
                tabbedPanel.setComponentAt(tabbedPanel.getSelectedIndex(), scroll);
206
                tabbedPanel.setComponentAt(tabbedPanel.getSelectedIndex(), scroll);
207
            }
207
            }
208
            model.update(category);
208
            model.update(category);
209
            if (searchText != null) {
210
                model.getController(category).handleSuccessfulSearch(searchText);
211
            }
209
            firePropertyChange (OptionsPanelController.PROP_HELP_CTX, null, null);        
212
            firePropertyChange (OptionsPanelController.PROP_HELP_CTX, null, null);        
210
        }
213
        }
211
    }
214
    }
215
216
    void handleSearch(String searchText) {
217
        handleTabSwitched(searchText);
218
    }
212
    
219
    
213
    private class LookupListenerImpl implements LookupListener {
220
    private class LookupListenerImpl implements LookupListener {
214
        public void resultChanged(LookupEvent ev) {
221
        public void resultChanged(LookupEvent ev) {
(-)a/options.api/src/org/netbeans/modules/options/advanced/AdvancedPanelController.java (+5 lines)
Lines 119-124 Link Here
119
        getAdvancedPanel().removeModelPropertyChangeListener(l);
119
        getAdvancedPanel().removeModelPropertyChangeListener(l);
120
    }
120
    }
121
121
122
    @Override
123
    public void handleSuccessfulSearch(String searchText) {
124
        getAdvancedPanel().handleSearch(searchText);
125
    }
126
122
    private AdvancedPanel advancedPanel;
127
    private AdvancedPanel advancedPanel;
123
    
128
    
124
    private synchronized AdvancedPanel getAdvancedPanel () {
129
    private synchronized AdvancedPanel getAdvancedPanel () {
(-)a/options.api/src/org/netbeans/modules/options/advanced/Model.java (+5 lines)
Lines 346-351 Link Here
346
        public void removePropertyChangeListener(PropertyChangeListener l) {
346
        public void removePropertyChangeListener(PropertyChangeListener l) {
347
            delegate.removePropertyChangeListener(l);
347
            delegate.removePropertyChangeListener(l);
348
        }
348
        }
349
350
        @Override
351
        public void handleSuccessfulSearch(String searchText) {
352
            delegate.handleSuccessfulSearch(searchText);
353
        }
349
    }            
354
    }            
350
}
355
}
351
356
(-)a/options.api/src/org/netbeans/spi/options/OptionsPanelController.java (+10 lines)
Lines 174-179 Link Here
174
    }
174
    }
175
175
176
    /**
176
    /**
177
     * Handle successful search in some panel in options window.
178
     * By default no action is performed. Each implementor should make special
179
     * actions, for example to choose a specific sub-panel, if this is required.
180
     * @param searchText the text the user has entered in the search box in the options window.
181
     * @since 1.30
182
     */
183
    public void handleSuccessfulSearch(String searchText) {
184
    }
185
186
    /**
177
     * Returns visual component representing this options category.
187
     * Returns visual component representing this options category.
178
     * This method is called before {@link #update} method.
188
     * This method is called before {@link #update} method.
179
     * 
189
     * 
(-)a/options.keymap/src/org/netbeans/modules/options/keymap/KeymapPanel.java (+4 lines)
Lines 372-377 Link Here
372
        refreshProfileCombo ();
372
        refreshProfileCombo ();
373
    }
373
    }
374
374
375
    public void handleSearch(String searchText) {
376
        searchField.setText(searchText);
377
    }
378
375
    //controller method end
379
    //controller method end
376
380
377
381
(-)a/options.keymap/src/org/netbeans/modules/options/keymap/KeymapPanelController.java (+5 lines)
Lines 110-115 Link Here
110
    public void removePropertyChangeListener (PropertyChangeListener l) {
110
    public void removePropertyChangeListener (PropertyChangeListener l) {
111
        getKeymapPanel ().removePropertyChangeListener (l);
111
        getKeymapPanel ().removePropertyChangeListener (l);
112
    }
112
    }
113
114
    @Override
115
    public void handleSuccessfulSearch(String searchText) {
116
        getKeymapPanel().handleSearch(searchText);
117
    }
113
    
118
    
114
119
115
    private KeymapPanel keymapPanel;
120
    private KeymapPanel keymapPanel;
(-)a/versioning.ui/src/org/netbeans/modules/versioning/ui/options/GeneralOptionsPanel.java (+4 lines)
Lines 88-93 Link Here
88
        super.removeNotify();
88
        super.removeNotify();
89
    }
89
    }
90
90
91
    public void handleSearch(String searchText) {
92
        cmbVersioningSystems.setSelectedIndex(1);
93
    }
94
91
    private void fillDisconnectedFolders () {
95
    private void fillDisconnectedFolders () {
92
        if (cmbVersioningSystems.getSelectedItem() instanceof VersioningSystem) {
96
        if (cmbVersioningSystems.getSelectedItem() instanceof VersioningSystem) {
93
            String[] disconnected = Utils.getDisconnectedRoots(((VersioningSystem) cmbVersioningSystems.getSelectedItem()));
97
            String[] disconnected = Utils.getDisconnectedRoots(((VersioningSystem) cmbVersioningSystems.getSelectedItem()));
(-)a/versioning.ui/src/org/netbeans/modules/versioning/ui/options/GeneralOptionsPanelController.java (+5 lines)
Lines 107-112 Link Here
107
        pcs.removePropertyChangeListener(l);
107
        pcs.removePropertyChangeListener(l);
108
    }            
108
    }            
109
109
110
    @Override
111
    public void handleSuccessfulSearch(String searchText) {
112
        getPanel().handleSearch(searchText);
113
    }
114
110
    private Boolean validateFields() {
115
    private Boolean validateFields() {
111
        
116
        
112
        return true;
117
        return true;
(-)a/versioning.util/src/org/netbeans/modules/versioning/util/VcsAdvancedOptions.java (+8 lines)
Lines 102-107 Link Here
102
            panel.addPanel(category, controller.getComponent(masterLookup));
102
            panel.addPanel(category, controller.getComponent(masterLookup));
103
        }
103
        }
104
    }
104
    }
105
106
    @Override
107
    public void handleSuccessfulSearch(String searchText) {
108
        if(initialized) {
109
            panel.handleSearch(searchText);
110
            categoryToController.get("General").handleSuccessfulSearch(searchText);
111
        }
112
    }
105
        
113
        
106
        public JComponent getComponent(Lookup masterLookup) {
114
        public JComponent getComponent(Lookup masterLookup) {
107
            init(masterLookup);
115
            init(masterLookup);
(-)a/versioning.util/src/org/netbeans/modules/versioning/util/VcsAdvancedOptionsPanel.java (+4 lines)
Lines 72-77 Link Here
72
        }
72
        }
73
    }
73
    }
74
    
74
    
75
    void handleSearch(String searchText) {
76
        versioningSystemsList.setSelectedValue("General", true);
77
    }
78
    
75
    /** This method is called from within the constructor to
79
    /** This method is called from within the constructor to
76
     * initialize the form.
80
     * initialize the form.
77
     * WARNING: Do NOT modify this code. The content of this method is
81
     * WARNING: Do NOT modify this code. The content of this method is

Return to bug 219457