diff -r e330f82a3068 -r 5e5be7095549 java.editor/src/org/netbeans/modules/java/editor/options/Bundle.properties --- a/java.editor/src/org/netbeans/modules/java/editor/options/Bundle.properties Mon Jun 16 00:48:29 2008 -0700 +++ b/java.editor/src/org/netbeans/modules/java/editor/options/Bundle.properties Tue Jun 17 15:52:19 2008 +0200 @@ -38,6 +38,8 @@ # made subject to such option by the copyright holder. OPTIONS_java=Java Editor + +KW_Mark=Mark Occurrences PROP_completionCaseSensitive=Case Sensitive Code Completion HINT_completionCaseSensitive=If True, the completion query search will be case sensitive diff -r e330f82a3068 -r 5e5be7095549 java.editor/src/org/netbeans/modules/java/editor/options/MarkOccurencesOptionsPanelController.java --- a/java.editor/src/org/netbeans/modules/java/editor/options/MarkOccurencesOptionsPanelController.java Mon Jun 16 00:48:29 2008 -0700 +++ b/java.editor/src/org/netbeans/modules/java/editor/options/MarkOccurencesOptionsPanelController.java Tue Jun 17 15:52:19 2008 +0200 @@ -42,12 +42,18 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.StringTokenizer; import java.util.prefs.Preferences; import javax.swing.JComponent; import org.netbeans.spi.options.OptionsPanelController; import org.openide.util.HelpCtx; import org.openide.util.Lookup; -import org.openide.util.NbPreferences; +import org.openide.util.NbBundle; final class MarkOccurencesOptionsPanelController extends OptionsPanelController { @@ -104,5 +110,14 @@ } pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null); } - + + @Override + public Map> getKeywordsByCategory() { + String keywords = NbBundle.getMessage(MarkOccurencesOptionsPanelController.class, "KW_Mark"); + HashMap result = new HashMap(); + result.put("JavaOptions/MarkOccurences", new HashSet(Collections.list(new StringTokenizer(keywords, ",")))); //NOI18N + return result; + } + } + diff -r e330f82a3068 -r 5e5be7095549 java.hints/src/org/netbeans/modules/java/hints/options/Bundle.properties --- a/java.hints/src/org/netbeans/modules/java/hints/options/Bundle.properties Mon Jun 16 00:48:29 2008 -0700 +++ b/java.hints/src/org/netbeans/modules/java/hints/options/Bundle.properties Tue Jun 17 15:52:19 2008 +0200 @@ -14,3 +14,5 @@ HintsPanel.errorTree.AccessibleContext.accessibleDescription=Hints HintsPanel.AccessibleContext.accessibleName=Hints Options HintsPanel.AccessibleContext.accessibleDescription=Hints Options +KW_Hints=Hints,Fixes,Suggestions,Javadoc Hints,Warnings + diff -r e330f82a3068 -r 5e5be7095549 java.hints/src/org/netbeans/modules/java/hints/options/HintsOptionsPanelController.java --- a/java.hints/src/org/netbeans/modules/java/hints/options/HintsOptionsPanelController.java Mon Jun 16 00:48:29 2008 -0700 +++ b/java.hints/src/org/netbeans/modules/java/hints/options/HintsOptionsPanelController.java Tue Jun 17 15:52:19 2008 +0200 @@ -42,10 +42,17 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.StringTokenizer; import javax.swing.JComponent; import org.netbeans.spi.options.OptionsPanelController; import org.openide.util.HelpCtx; import org.openide.util.Lookup; +import org.openide.util.NbBundle; final class HintsOptionsPanelController extends OptionsPanelController { @@ -103,4 +110,11 @@ pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null); } + @Override + public Map> getKeywordsByCategory() { + String keywords = NbBundle.getMessage(HintsOptionsPanelController.class, "KW_Hints"); + HashMap result = new HashMap(); + result.put("JavaOptions/Hints", new HashSet(Collections.list(new StringTokenizer(keywords, ",")))); //NOI18N + return result; + } } diff -r e330f82a3068 -r 5e5be7095549 java.source/src/org/netbeans/modules/java/source/tasklist/Bundle.properties --- a/java.source/src/org/netbeans/modules/java/source/tasklist/Bundle.properties Mon Jun 16 00:48:29 2008 -0700 +++ b/java.source/src/org/netbeans/modules/java/source/tasklist/Bundle.properties Tue Jun 17 15:52:19 2008 +0200 @@ -43,6 +43,8 @@ jCheckBox2.text=Enable &Dependencies in Java Tasklist jCheckBox1.text_1=Enable &Error Badges on Files +KW_TaskList=Error Badges,Tasklist + DN_Tasklist=Tasklist TP_Tasklist=Java Tasklist Settings enableLint.text=Enable Compiler &Warnings diff -r e330f82a3068 -r 5e5be7095549 java.source/src/org/netbeans/modules/java/source/tasklist/TasklistOptions.java --- a/java.source/src/org/netbeans/modules/java/source/tasklist/TasklistOptions.java Mon Jun 16 00:48:29 2008 -0700 +++ b/java.source/src/org/netbeans/modules/java/source/tasklist/TasklistOptions.java Tue Jun 17 15:52:19 2008 +0200 @@ -42,6 +42,12 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.StringTokenizer; import javax.swing.JComponent; import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; @@ -145,5 +151,12 @@ pcs.firePropertyChange(PROP_CHANGED, null, null); } + @Override + public Map> getKeywordsByCategory() { + String keywords = NbBundle.getMessage(TasklistOptions.class, "KW_TaskList"); + HashMap result = new HashMap(); + result.put("JavaOptions/Tasklist", new HashSet(Collections.list(new StringTokenizer(keywords, ",")))); //NOI18N + return result; + } } } diff -r e330f82a3068 -r 5e5be7095549 java.source/src/org/netbeans/modules/java/ui/Bundle.properties --- a/java.source/src/org/netbeans/modules/java/ui/Bundle.properties Mon Jun 16 00:48:29 2008 -0700 +++ b/java.source/src/org/netbeans/modules/java/ui/Bundle.properties Tue Jun 17 15:52:19 2008 +0200 @@ -39,6 +39,8 @@ OptionsCategory_Name=Java Code OptionsCategory_Title=Java Code + +KW_Formatting=Formatting,Indentation,Spaces,Alignment,Blank Lines,Braces CTL_Formating_DisplayName=Formatting CTL_Formating_ToolTip=Java Code Formatting Options diff -r e330f82a3068 -r 5e5be7095549 java.source/src/org/netbeans/modules/java/ui/FormatingOptionsPanelController.java --- a/java.source/src/org/netbeans/modules/java/ui/FormatingOptionsPanelController.java Mon Jun 16 00:48:29 2008 -0700 +++ b/java.source/src/org/netbeans/modules/java/ui/FormatingOptionsPanelController.java Tue Jun 17 15:52:19 2008 +0200 @@ -42,6 +42,12 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.StringTokenizer; import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; import javax.swing.JComponent; @@ -49,6 +55,7 @@ import org.netbeans.spi.options.OptionsPanelController; import org.openide.util.HelpCtx; import org.openide.util.Lookup; +import org.openide.util.NbBundle; final class FormatingOptionsPanelController extends OptionsPanelController { @@ -57,7 +64,15 @@ private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); private boolean changed; - + + @Override + public Map> getKeywordsByCategory() { + String keywords = NbBundle.getMessage(FormatingOptionsPanelController.class, "KW_Formatting"); + HashMap result = new HashMap(); + result.put("JavaOptions/Formatting", new HashSet(Collections.list(new StringTokenizer(keywords, ",")))); //NOI18N + return result; + } + public void update() { changed = false; panel.load(null); diff -r e330f82a3068 -r 5e5be7095549 java.source/src/org/netbeans/modules/java/ui/JavaOptionsPanelController.java --- a/java.source/src/org/netbeans/modules/java/ui/JavaOptionsPanelController.java Mon Jun 16 00:48:29 2008 -0700 +++ b/java.source/src/org/netbeans/modules/java/ui/JavaOptionsPanelController.java Tue Jun 17 15:52:19 2008 +0200 @@ -49,6 +49,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set; import javax.swing.JComponent; import javax.swing.JTabbedPane; import org.netbeans.spi.options.AdvancedOption; @@ -76,7 +77,20 @@ public JavaOptionsPanelController() { readPanels(); } - + + private Map> keywords = null; + + @Override + public Map> getKeywordsByCategory() { + if (keywords==null) { + keywords = new HashMap>(); + for (OptionsPanelController controller:getControllers()) { + keywords.putAll(controller.getKeywordsByCategory()); + } + } + return keywords; + } + public void update() { for (OptionsPanelController c : getControllers()) { c.update(); diff -r e330f82a3068 -r 5e5be7095549 options.api/apichanges.xml --- a/options.api/apichanges.xml Mon Jun 16 00:48:29 2008 -0700 +++ b/options.api/apichanges.xml Tue Jun 17 15:52:19 2008 +0200 @@ -72,6 +72,20 @@ + + + Support for searchable options + + + + + + Added new method OptionsPanelController.getKeywordsByCategory + + + + + API to open the options dialog with some subcategory pre-selected diff -r e330f82a3068 -r 5e5be7095549 options.api/nbproject/project.xml --- a/options.api/nbproject/project.xml Mon Jun 16 00:48:29 2008 -0700 +++ b/options.api/nbproject/project.xml Tue Jun 17 15:52:19 2008 +0200 @@ -47,19 +47,11 @@ org.netbeans.modules.options.api - org.openide.filesystems + org.netbeans.spi.quicksearch - 6.2 - - - - org.openide.util - - - - 6.2 + 1.0 @@ -72,6 +64,22 @@ org.openide.dialogs + + + + 6.2 + + + + org.openide.filesystems + + + + 6.2 + + + + org.openide.util diff -r e330f82a3068 -r 5e5be7095549 options.api/src/org/netbeans/modules/options/Bundle.properties --- a/options.api/src/org/netbeans/modules/options/Bundle.properties Mon Jun 16 00:48:29 2008 -0700 +++ b/options.api/src/org/netbeans/modules/options/Bundle.properties Tue Jun 17 15:52:19 2008 +0200 @@ -67,3 +67,5 @@ ACS_OKButton=OK ACS_ClassicButton= Invokes Advanced Options dialog ACS_OptionsPanel=Options Dialog + +QuickSearch/GoToOption=Options diff -r e330f82a3068 -r 5e5be7095549 options.api/src/org/netbeans/modules/options/CategoryModel.java --- a/options.api/src/org/netbeans/modules/options/CategoryModel.java Mon Jun 16 00:48:29 2008 -0700 +++ b/options.api/src/org/netbeans/modules/options/CategoryModel.java Tue Jun 17 15:52:19 2008 +0200 @@ -76,6 +76,11 @@ private final Map id2Category = Collections.synchronizedMap(new LinkedHashMap()); private MasterLookup masterLookup; + + public Set> getCategories() { + return id2Category.entrySet(); + } + private final RequestProcessor.Task masterLookupTask = RP.create(new Runnable() { public void run() { String[] categoryIDs = getCategoryIDs(); @@ -365,6 +370,10 @@ return controller; } + public Map> getKeywords() { + return create().getKeywordsByCategory(); + } + final void update(PropertyChangeListener l, boolean forceUpdate) { if ((!isUpdated && !forceUpdate) || (isUpdated && forceUpdate)) { isUpdated = true; diff -r e330f82a3068 -r 5e5be7095549 options.api/src/org/netbeans/modules/options/QuickSearchProvider.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/options.api/src/org/netbeans/modules/options/QuickSearchProvider.java Tue Jun 17 15:52:19 2008 +0200 @@ -0,0 +1,83 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2008 Sun Microsystems, Inc. + */ + +package org.netbeans.modules.options; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import org.netbeans.api.options.OptionsDisplayer; +import org.netbeans.spi.quicksearch.SearchProvider; +import org.netbeans.spi.quicksearch.SearchRequest; +import org.netbeans.spi.quicksearch.SearchResponse; + +/** + * + * @author Jan Becicka + */ +public class QuickSearchProvider implements SearchProvider { + + public void evaluate(SearchRequest request, SearchResponse response) { + for (Map.Entry entry : CategoryModel.getInstance().getCategories()) { + for (Map.Entry> kw : entry.getValue().getKeywords().entrySet()) { + for (String keyword : kw.getValue()) { + if (keyword.toLowerCase().indexOf(request.getText().toLowerCase()) > -1) { + if (!response.addResult(new OpenOption(kw.getKey()), keyword)) { + return; + } + } + } + } + } + } + + private class OpenOption implements Runnable { + + private String path; + + OpenOption(String path) { + this.path = path; + } + + public void run() { + OptionsDisplayer.getDefault().open(path); + } + + } +} \ No newline at end of file diff -r e330f82a3068 -r 5e5be7095549 options.api/src/org/netbeans/modules/options/advanced/AdvancedPanel.java --- a/options.api/src/org/netbeans/modules/options/advanced/AdvancedPanel.java Mon Jun 16 00:48:29 2008 -0700 +++ b/options.api/src/org/netbeans/modules/options/advanced/AdvancedPanel.java Tue Jun 17 15:52:19 2008 +0200 @@ -85,6 +85,10 @@ AdvancedPanel(String subpath) { this.subpath = subpath; this.model = new Model(subpath, listener); + } + + public Model getModel() { + return model; } public void update () { diff -r e330f82a3068 -r 5e5be7095549 options.api/src/org/netbeans/modules/options/advanced/AdvancedPanelController.java --- a/options.api/src/org/netbeans/modules/options/advanced/AdvancedPanelController.java Mon Jun 16 00:48:29 2008 -0700 +++ b/options.api/src/org/netbeans/modules/options/advanced/AdvancedPanelController.java Tue Jun 17 15:52:19 2008 +0200 @@ -42,6 +42,10 @@ package org.netbeans.modules.options.advanced; import java.beans.PropertyChangeListener; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; import javax.swing.JComponent; import org.netbeans.spi.options.OptionsPanelController; import org.openide.util.HelpCtx; @@ -120,4 +124,17 @@ advancedPanel = new AdvancedPanel(subpath); return advancedPanel; } + + private Map> keywords = null; + + @Override + public Map> getKeywordsByCategory() { + if (keywords == null) { + keywords = new HashMap>(); + for (Entry entry : getAdvancedPanel().getModel().getCategoryToController().entrySet()) { + keywords.putAll(entry.getValue().getKeywordsByCategory()); + } + } + return keywords; + } } diff -r e330f82a3068 -r 5e5be7095549 options.api/src/org/netbeans/modules/options/advanced/Model.java --- a/options.api/src/org/netbeans/modules/options/advanced/Model.java Mon Jun 16 00:48:29 2008 -0700 +++ b/options.api/src/org/netbeans/modules/options/advanced/Model.java Tue Jun 17 15:52:19 2008 +0200 @@ -50,6 +50,8 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; import javax.swing.JComponent; import javax.swing.border.Border; import javax.swing.border.CompoundBorder; @@ -132,14 +134,31 @@ public OptionsPanelController getController(String categoryID) { return categoryToController.get(getDisplayName(categoryID)); } + + private boolean init = false; + public Map getCategoryToController() { + init(); + if (!init) { + for ( Entry entry: categoryToOption.entrySet()) { + if (categoryToController.get(entry.getKey())==null) + categoryToController.put (entry.getKey(), entry.getValue().create()); + } + init=true; + } + + return categoryToController; + } public JComponent getPanel (String category) { init (); JComponent panel = categoryToPanel.get (category); if (panel != null) return panel; AdvancedOption option = categoryToOption.get (category); - OptionsPanelController controller = new DelegatingController(option.create ()); - categoryToController.put (category, controller); + OptionsPanelController controller = categoryToController.get(category); + if (controller==null) { + controller = new DelegatingController(option.create ()); + categoryToController.put (category, controller); + } panel = controller.getComponent (masterLookup); categoryToPanel.put (category, panel); Border b = panel.getBorder (); @@ -291,7 +310,11 @@ public void removePropertyChangeListener(PropertyChangeListener l) { delegate.removePropertyChangeListener(l); - } + } + + public Map> getKeywordsByCategory() { + return delegate.getKeywordsByCategory(); + } } } diff -r e330f82a3068 -r 5e5be7095549 options.api/src/org/netbeans/modules/options/resources/mf-layer.xml --- a/options.api/src/org/netbeans/modules/options/resources/mf-layer.xml Mon Jun 16 00:48:29 2008 -0700 +++ b/options.api/src/org/netbeans/modules/options/resources/mf-layer.xml Tue Jun 17 15:52:19 2008 +0200 @@ -69,4 +69,15 @@ + + + + + + + + + + + diff -r e330f82a3068 -r 5e5be7095549 options.api/src/org/netbeans/spi/options/OptionsPanelController.java --- a/options.api/src/org/netbeans/spi/options/OptionsPanelController.java Mon Jun 16 00:48:29 2008 -0700 +++ b/options.api/src/org/netbeans/spi/options/OptionsPanelController.java Tue Jun 17 15:52:19 2008 +0200 @@ -41,6 +41,9 @@ package org.netbeans.spi.options; import java.beans.PropertyChangeListener; +import java.util.Collections; +import java.util.Map; +import java.util.Set; import javax.swing.JComponent; import org.netbeans.modules.options.OptionsPanelControllerAccessor; import org.netbeans.modules.options.advanced.AdvancedPanelController; @@ -210,4 +213,12 @@ * @param l a listener to be removed */ public abstract void removePropertyChangeListener (PropertyChangeListener l); + + /** + * Set of keywords related to this panel + * @return Map) + */ + public Map> getKeywordsByCategory() { + return Collections.EMPTY_MAP; + } } diff -r e330f82a3068 -r 5e5be7095549 tasklist.todo/src/org/netbeans/modules/tasklist/todo/settings/Bundle.properties --- a/tasklist.todo/src/org/netbeans/modules/tasklist/todo/settings/Bundle.properties Mon Jun 16 00:48:29 2008 -0700 +++ b/tasklist.todo/src/org/netbeans/modules/tasklist/todo/settings/Bundle.properties Tue Jun 17 15:52:19 2008 +0200 @@ -9,4 +9,6 @@ ToDoCustomizer.btnChange.text=&Edit LBL_Options=ToDo Tasks -HINT_Options=Options for ToDo tasks in Task List window. \ No newline at end of file +HINT_Options=Options for ToDo tasks in Task List window. + +KW_ToDo=ToDo,@todo,FIXME,PENDING diff -r e330f82a3068 -r 5e5be7095549 tasklist.todo/src/org/netbeans/modules/tasklist/todo/settings/ToDoOptionsController.java --- a/tasklist.todo/src/org/netbeans/modules/tasklist/todo/settings/ToDoOptionsController.java Mon Jun 16 00:48:29 2008 -0700 +++ b/tasklist.todo/src/org/netbeans/modules/tasklist/todo/settings/ToDoOptionsController.java Tue Jun 17 15:52:19 2008 +0200 @@ -42,10 +42,17 @@ package org.netbeans.modules.tasklist.todo.settings; import java.beans.PropertyChangeListener; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.StringTokenizer; import javax.swing.JComponent; import org.netbeans.spi.options.OptionsPanelController; import org.openide.util.HelpCtx; import org.openide.util.Lookup; +import org.openide.util.NbBundle; /** * @@ -97,4 +104,13 @@ } return customizer; } + + @Override + public Map> getKeywordsByCategory() { + String keywords = NbBundle.getMessage(ToDoOptionsController.class, "KW_ToDo"); + HashMap result = new HashMap(); + result.put("Advanced/ToDo", new HashSet(Collections.list(new StringTokenizer(keywords, ",")))); //NOI18N + return result; + } + }