diff -r c9a896e042ec core.ui/src/org/netbeans/core/ui/options/general/Bundle.properties --- a/core.ui/src/org/netbeans/core/ui/options/general/Bundle.properties Wed Jul 09 07:04:51 2008 +0200 +++ b/core.ui/src/org/netbeans/core/ui/options/general/Bundle.properties Mon Jul 14 15:43:46 2008 +0200 @@ -227,3 +227,6 @@ WebBrowsersOptionsPanel.AccessibleContext.accessibleDescription=Web Browsers GeneralOptionsPanel_rbUseSystemProxy_Direct=Direct connection. GeneralOptionsPanel_rbUseSystemProxy_Format={0}:{1} + +# Keywords for quick-search +KW_General=proxy, general diff -r c9a896e042ec core.ui/src/org/netbeans/core/ui/options/general/GeneralOptions.java --- a/core.ui/src/org/netbeans/core/ui/options/general/GeneralOptions.java Wed Jul 09 07:04:51 2008 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2007 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]" - * - * Contributor(s): - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - * - * 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. - */ - -package org.netbeans.core.ui.options.general; - -import javax.swing.Icon; -import javax.swing.ImageIcon; -import org.netbeans.spi.options.OptionsCategory; -import org.netbeans.spi.options.OptionsPanelController; -import org.openide.util.NbBundle; -import org.openide.util.Utilities; - - -/** - * Contains information about General Options Panel, and creates a new - * instance of it. - * - * @author Jan Jancura - */ - -public final class GeneralOptions extends OptionsCategory { - - private static String loc (String key) { - return NbBundle.getMessage (GeneralOptionsPanel.class, key); - } - - - private static Icon icon; - - public Icon getIcon () { - if (icon == null) - icon = new ImageIcon ( - Utilities.loadImage - ("org/netbeans/modules/options/resources/generalOptions.png") - ); - return icon; - } - - public String getCategoryName () { - return loc ("CTL_General_Options"); - } - - public String getTitle () { - return loc ("CTL_General_Options_Title"); - } - - public String getDescription () { - return loc ("CTL_General_Options_Description"); - } - - public OptionsPanelController create () { - return new GeneralOptionsPanelController (); - } -} diff -r c9a896e042ec core.ui/src/org/netbeans/core/ui/resources/layer.xml --- a/core.ui/src/org/netbeans/core/ui/resources/layer.xml Wed Jul 09 07:04:51 2008 +0200 +++ b/core.ui/src/org/netbeans/core/ui/resources/layer.xml Mon Jul 14 15:43:46 2008 +0200 @@ -40,7 +40,7 @@ Version 2 license, then the option applies only if the new code is made subject to such option by the copyright holder. --> - + @@ -51,7 +51,7 @@ - + @@ -66,7 +66,7 @@ - + @@ -95,38 +95,38 @@ - + - + - - - + + + - + - + - + - - + + - - + + @@ -200,7 +200,7 @@ - + @@ -208,9 +208,9 @@ - + - + @@ -223,7 +223,7 @@ - + @@ -240,8 +240,8 @@ - - + + @@ -260,13 +260,13 @@ - + - + - - + - + - + - - - + + + - + @@ -336,7 +336,7 @@ - + @@ -344,9 +344,9 @@ - + - + @@ -359,24 +359,24 @@ - + - + - + - + @@ -385,29 +385,29 @@ --> - + - + - + - + - + - + - + - + @@ -416,14 +416,14 @@ - + - + - - + + @@ -482,12 +482,12 @@ - + - - + + @@ -558,7 +558,7 @@ - + @@ -614,12 +614,12 @@ - + - - + + @@ -682,17 +682,26 @@ - + - + - + + + + + + + + + + - + diff -r c9a896e042ec java.editor/src/org/netbeans/modules/java/editor/options/Bundle.properties --- a/java.editor/src/org/netbeans/modules/java/editor/options/Bundle.properties Wed Jul 09 07:04:51 2008 +0200 +++ b/java.editor/src/org/netbeans/modules/java/editor/options/Bundle.properties Mon Jul 14 15:43:46 2008 +0200 @@ -38,6 +38,9 @@ # made subject to such option by the copyright holder. OPTIONS_java=Java Editor + +# QuickSearch keywords for Mark Occurrences Panel +KW_Mark=Mark Occurrences PROP_completionCaseSensitive=Case Sensitive Code Completion HINT_completionCaseSensitive=If True, the completion query search will be case sensitive diff -r c9a896e042ec java.editor/src/org/netbeans/modules/java/editor/options/MarkOccurencesAdvancedOption.java --- a/java.editor/src/org/netbeans/modules/java/editor/options/MarkOccurencesAdvancedOption.java Wed Jul 09 07:04:51 2008 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2007 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]" - * - * Contributor(s): - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun - * Microsystems, Inc. All Rights Reserved. - * - * 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. - */ - -package org.netbeans.modules.java.editor.options; - -import org.netbeans.spi.options.AdvancedOption; -import org.netbeans.spi.options.OptionsPanelController; -import org.openide.util.NbBundle; - -/** - * - * @author Petr Hrebejk - */ -public class MarkOccurencesAdvancedOption extends AdvancedOption { - - OptionsPanelController panelController; - - public String getDisplayName() { - return NbBundle.getMessage(MarkOccurencesAdvancedOption.class, "CTL_MarkOccurences_DisplayName"); // NOI18N - } - - public String getTooltip() { - return NbBundle.getMessage(MarkOccurencesAdvancedOption.class, "CTL_MarkOccurences_ToolTip"); // NOI18N - } - - public synchronized OptionsPanelController create() { - - if ( panelController == null ) { - panelController = new MarkOccurencesOptionsPanelController(); - } - - return panelController; - } - -} diff -r c9a896e042ec java.editor/src/org/netbeans/modules/java/editor/options/MarkOccurencesOptionsPanelController.java --- a/java.editor/src/org/netbeans/modules/java/editor/options/MarkOccurencesOptionsPanelController.java Wed Jul 09 07:04:51 2008 +0200 +++ b/java.editor/src/org/netbeans/modules/java/editor/options/MarkOccurencesOptionsPanelController.java Mon Jul 14 15:43:46 2008 +0200 @@ -42,16 +42,12 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; -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; -final class MarkOccurencesOptionsPanelController extends OptionsPanelController { - - private Preferences node; +public final class MarkOccurencesOptionsPanelController extends OptionsPanelController { private MarkOccurencesPanel panel; @@ -104,5 +100,5 @@ } pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null); } - + } diff -r c9a896e042ec java.editor/src/org/netbeans/modules/java/editor/resources/layer.xml --- a/java.editor/src/org/netbeans/modules/java/editor/resources/layer.xml Wed Jul 09 07:04:51 2008 +0200 +++ b/java.editor/src/org/netbeans/modules/java/editor/resources/layer.xml Mon Jul 14 15:43:46 2008 +0200 @@ -329,15 +329,36 @@ + + + + + + + + + + + - + + diff -r c9a896e042ec java.hints/src/org/netbeans/modules/java/hints/options/Bundle.properties --- a/java.hints/src/org/netbeans/modules/java/hints/options/Bundle.properties Wed Jul 09 07:04:51 2008 +0200 +++ b/java.hints/src/org/netbeans/modules/java/hints/options/Bundle.properties Mon Jul 14 15:43:46 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 c9a896e042ec java.hints/src/org/netbeans/modules/java/hints/options/HintsAdvancedOption.java --- a/java.hints/src/org/netbeans/modules/java/hints/options/HintsAdvancedOption.java Wed Jul 09 07:04:51 2008 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* - * Sun Public License Notice - * - * The contents of this file are subject to the Sun Public License - * Version 1.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://www.sun.com/ - * - * The Original Code is NetBeans. The Initial Developer of the Original - * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun - * Microsystems, Inc. All Rights Reserved. - -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. - */ - -package org.netbeans.modules.java.hints.options; - -import org.netbeans.spi.options.AdvancedOption; -import org.netbeans.spi.options.OptionsPanelController; -import org.openide.util.NbBundle; - -/** - * - * @author phrebejk - */ -public class HintsAdvancedOption extends AdvancedOption { - - OptionsPanelController panelController; - - public String getDisplayName() { - return NbBundle.getMessage(HintsAdvancedOption.class, "CTL_Hints_DisplayName"); // NOI18N - } - - public String getTooltip() { - return NbBundle.getMessage(HintsAdvancedOption.class, "CTL_Hints_ToolTip"); // NOI18N - } - - public synchronized OptionsPanelController create() { - - if ( panelController == null ) { - panelController = new HintsOptionsPanelController(); - } - - return panelController; - } - -} diff -r c9a896e042ec java.hints/src/org/netbeans/modules/java/hints/options/HintsOptionsPanelController.java --- a/java.hints/src/org/netbeans/modules/java/hints/options/HintsOptionsPanelController.java Wed Jul 09 07:04:51 2008 +0200 +++ b/java.hints/src/org/netbeans/modules/java/hints/options/HintsOptionsPanelController.java Mon Jul 14 15:43:46 2008 +0200 @@ -47,7 +47,7 @@ import org.openide.util.HelpCtx; import org.openide.util.Lookup; -final class HintsOptionsPanelController extends OptionsPanelController { +public final class HintsOptionsPanelController extends OptionsPanelController { private HintsPanel panel; diff -r c9a896e042ec java.hints/src/org/netbeans/modules/java/hints/resources/layer.xml --- a/java.hints/src/org/netbeans/modules/java/hints/resources/layer.xml Wed Jul 09 07:04:51 2008 +0200 +++ b/java.hints/src/org/netbeans/modules/java/hints/resources/layer.xml Mon Jul 14 15:43:46 2008 +0200 @@ -265,10 +265,15 @@ - - + + - + + + + + + diff -r c9a896e042ec java.source/src/org/netbeans/modules/java/source/resources/layer.xml --- a/java.source/src/org/netbeans/modules/java/source/resources/layer.xml Wed Jul 09 07:04:51 2008 +0200 +++ b/java.source/src/org/netbeans/modules/java/source/resources/layer.xml Mon Jul 14 15:43:46 2008 +0200 @@ -164,13 +164,35 @@ - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -180,18 +202,6 @@ - - - - - - - - - - - - diff -r c9a896e042ec java.source/src/org/netbeans/modules/java/source/tasklist/Bundle.properties --- a/java.source/src/org/netbeans/modules/java/source/tasklist/Bundle.properties Wed Jul 09 07:04:51 2008 +0200 +++ b/java.source/src/org/netbeans/modules/java/source/tasklist/Bundle.properties Mon Jul 14 15:43:47 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 c9a896e042ec java.source/src/org/netbeans/modules/java/source/tasklist/TaskListOptionsPanelController.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java.source/src/org/netbeans/modules/java/source/tasklist/TaskListOptionsPanelController.java Mon Jul 14 15:43:47 2008 +0200 @@ -0,0 +1,128 @@ +/* + * 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.java.source.tasklist; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import javax.swing.JComponent; +import javax.swing.SwingUtilities; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import org.netbeans.spi.options.OptionsPanelController; +import org.openide.util.HelpCtx; +import org.openide.util.Lookup; + +/** + * OptionsPanelController for JavaOptions/Tasklist options subcategory + * + * @author Max Sauer + */ +public class TaskListOptionsPanelController extends OptionsPanelController implements ChangeListener { + + private TasklistOptionsPanel panel; + private PropertyChangeSupport pcs = new PropertyChangeSupport(this); + + public void update() { + assert SwingUtilities.isEventDispatchThread(); + if (panel == null) { + getComponent(null);//XXX: should not happen + } + + panel.setDependenciesEnabled(TasklistSettings.isDependencyTrackingEnabled()); + panel.setBadgesEnabled(TasklistSettings.isBadgesEnabled()); + panel.setTasklistEnabled(TasklistSettings.isTasklistEnabled()); + + } + + public void applyChanges() { + if (panel == null) { + return; + } + + TasklistSettings.setTasklistsEnabled(panel.getTasklistEnabled()); + TasklistSettings.setDependencyTrackingEnabled(panel.getDependenciesEnabled()); + TasklistSettings.setBadgesEnabled(panel.getBadgesEnabled()); + + } + + public void cancel() { + if (panel == null) { + return; + } + panel.setTasklistEnabled(TasklistSettings.isTasklistEnabled()); + panel.setDependenciesEnabled(TasklistSettings.isDependencyTrackingEnabled()); + panel.setBadgesEnabled(TasklistSettings.isBadgesEnabled()); + } + + public boolean isValid() { + return true; + } + + public boolean isChanged() { + if (panel == null) { + return false; + } + + return TasklistSettings.isTasklistEnabled() != panel.getTasklistEnabled() || TasklistSettings.isDependencyTrackingEnabled() != panel.getDependenciesEnabled() || TasklistSettings.isBadgesEnabled() != panel.getBadgesEnabled(); + } + + public JComponent getComponent(Lookup masterLookup) { + if (panel == null) { + panel = new TasklistOptionsPanel(); + panel.addChangeListener(this); + } + return panel; + } + + public HelpCtx getHelpCtx() { + return new HelpCtx("netbeans.optionsDialog.java.tasklist"); + } + + public void addPropertyChangeListener(PropertyChangeListener l) { + pcs.addPropertyChangeListener(l); + } + + public void removePropertyChangeListener(PropertyChangeListener l) { + pcs.removePropertyChangeListener(l); + } + + public void stateChanged(ChangeEvent e) { + pcs.firePropertyChange(PROP_CHANGED, null, null); + } +} diff -r c9a896e042ec java.source/src/org/netbeans/modules/java/source/tasklist/TasklistOptions.java --- a/java.source/src/org/netbeans/modules/java/source/tasklist/TasklistOptions.java Wed Jul 09 07:04:51 2008 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2007 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]" - * - * Contributor(s): - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun - * Microsystems, Inc. All Rights Reserved. - * - * 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. - */ -package org.netbeans.modules.java.source.tasklist; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import javax.swing.JComponent; -import javax.swing.SwingUtilities; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import org.netbeans.spi.options.AdvancedOption; -import org.netbeans.spi.options.OptionsPanelController; -import org.openide.util.HelpCtx; -import org.openide.util.Lookup; -import org.openide.util.NbBundle; - -/** - * - * @author Jan Lahoda - */ -public class TasklistOptions extends AdvancedOption { - - public TasklistOptions() { - } - - public String getDisplayName() { - return NbBundle.getMessage(TasklistOptions.class, "DN_Tasklist");// "Java Tasklist - Temporary settings"; - } - - public String getTooltip() { - return NbBundle.getMessage(TasklistOptions.class, "TP_Tasklist");// "Java Tasklist - Temporary settings"; - } - - public OptionsPanelController create() { - return new TasklistOptionsPanelController(); - } - - private static class TasklistOptionsPanelController extends OptionsPanelController implements ChangeListener { - - private TasklistOptionsPanel panel; - private PropertyChangeSupport pcs = new PropertyChangeSupport(this); - - public void update() { - assert SwingUtilities.isEventDispatchThread(); - if (panel == null) { - getComponent(null);//XXX: should not happen - } - - panel.setDependenciesEnabled(TasklistSettings.isDependencyTrackingEnabled()); - panel.setBadgesEnabled(TasklistSettings.isBadgesEnabled()); - panel.setTasklistEnabled(TasklistSettings.isTasklistEnabled()); - - } - - public void applyChanges() { - if (panel == null) - return ; - - TasklistSettings.setTasklistsEnabled(panel.getTasklistEnabled()); - TasklistSettings.setDependencyTrackingEnabled(panel.getDependenciesEnabled()); - TasklistSettings.setBadgesEnabled(panel.getBadgesEnabled()); - - } - - public void cancel() { - if (panel == null) - return ; - panel.setTasklistEnabled(TasklistSettings.isTasklistEnabled()); - panel.setDependenciesEnabled(TasklistSettings.isDependencyTrackingEnabled()); - panel.setBadgesEnabled(TasklistSettings.isBadgesEnabled()); - } - - public boolean isValid() { - return true; - } - - public boolean isChanged() { - if (panel == null) - return false; - - return TasklistSettings.isTasklistEnabled() != panel.getTasklistEnabled() - || TasklistSettings.isDependencyTrackingEnabled() != panel.getDependenciesEnabled() - || TasklistSettings.isBadgesEnabled() != panel.getBadgesEnabled(); - } - - public JComponent getComponent(Lookup masterLookup) { - if (panel == null) { - panel = new TasklistOptionsPanel(); - panel.addChangeListener(this); - } - return panel; - } - - public HelpCtx getHelpCtx() { - return new HelpCtx("netbeans.optionsDialog.java.tasklist"); - } - - public void addPropertyChangeListener(PropertyChangeListener l) { - pcs.addPropertyChangeListener(l); - } - - public void removePropertyChangeListener(PropertyChangeListener l) { - pcs.removePropertyChangeListener(l); - } - - public void stateChanged(ChangeEvent e) { - pcs.firePropertyChange(PROP_CHANGED, null, null); - } - - } -} diff -r c9a896e042ec java.source/src/org/netbeans/modules/java/ui/Bundle.properties --- a/java.source/src/org/netbeans/modules/java/ui/Bundle.properties Wed Jul 09 07:04:51 2008 +0200 +++ b/java.source/src/org/netbeans/modules/java/ui/Bundle.properties Mon Jul 14 15:43:47 2008 +0200 @@ -39,6 +39,9 @@ OptionsCategory_Name=Java Code OptionsCategory_Title=Java Code + +KW_Formatting=Formatting,Indentation,Spaces,Alignment,Blank Lines,Braces +KW_JavaOptions=Java Options CTL_Formating_DisplayName=Formatting CTL_Formating_ToolTip=Java Code Formatting Options diff -r c9a896e042ec java.source/src/org/netbeans/modules/java/ui/FormatingAdvancedOption.java --- a/java.source/src/org/netbeans/modules/java/ui/FormatingAdvancedOption.java Wed Jul 09 07:04:51 2008 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2007 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]" - * - * Contributor(s): - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - * - * 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. - */ - -package org.netbeans.modules.java.ui; - -import org.netbeans.spi.options.AdvancedOption; -import org.netbeans.spi.options.OptionsPanelController; -import org.openide.util.NbBundle; - -/** - * - * @author phrebejk - */ -public class FormatingAdvancedOption extends AdvancedOption { - - OptionsPanelController panelController; - - public String getDisplayName() { - return NbBundle.getMessage(FormatingAdvancedOption.class, "CTL_Formating_DisplayName"); // NOI18N - } - - public String getTooltip() { - return NbBundle.getMessage(FormatingAdvancedOption.class, "CTL_Formating_ToolTip"); // NOI18N - } - - public synchronized OptionsPanelController create() { - - if ( panelController == null ) { - panelController = new FormatingOptionsPanelController(); - } - - return panelController; - } - -} diff -r c9a896e042ec java.source/src/org/netbeans/modules/java/ui/FormatingOptionsPanelController.java --- a/java.source/src/org/netbeans/modules/java/ui/FormatingOptionsPanelController.java Wed Jul 09 07:04:51 2008 +0200 +++ b/java.source/src/org/netbeans/modules/java/ui/FormatingOptionsPanelController.java Mon Jul 14 15:43:47 2008 +0200 @@ -50,14 +50,14 @@ import org.openide.util.HelpCtx; import org.openide.util.Lookup; -final class FormatingOptionsPanelController extends OptionsPanelController { +public final class FormatingOptionsPanelController extends OptionsPanelController { FormatingOptionsPanel panel; Preferences preferences; private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); private boolean changed; - + public void update() { changed = false; panel.load(null); diff -r c9a896e042ec java.source/src/org/netbeans/modules/java/ui/JavaOptionsCategory.java --- a/java.source/src/org/netbeans/modules/java/ui/JavaOptionsCategory.java Wed Jul 09 07:04:51 2008 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2007 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]" - * - * Contributor(s): - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - * - * 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. - */ - -package org.netbeans.modules.java.ui; - -import javax.swing.Icon; -import javax.swing.ImageIcon; -import org.netbeans.spi.options.OptionsCategory; -import org.netbeans.spi.options.OptionsPanelController; -import org.openide.util.NbBundle; -import org.openide.util.Utilities; - -/** - * Defines a new options category in the IDE's options dialog. - */ -public final class JavaOptionsCategory extends OptionsCategory { - - public Icon getIcon() { - return new ImageIcon(Utilities.loadImage("org/netbeans/modules/java/source/resources/icons/JavaOptions_32.png")); - } - - public String getCategoryName() { - return NbBundle.getMessage(JavaOptionsCategory.class, "OptionsCategory_Name"); - } - - public String getTitle() { - return NbBundle.getMessage(JavaOptionsCategory.class, "OptionsCategory_Title"); - } - - public OptionsPanelController create() { - return new JavaOptionsPanelController(); - } -} - diff -r c9a896e042ec java.source/src/org/netbeans/modules/java/ui/JavaOptionsPanelController.java --- a/java.source/src/org/netbeans/modules/java/ui/JavaOptionsPanelController.java Wed Jul 09 07:04:51 2008 +0200 +++ b/java.source/src/org/netbeans/modules/java/ui/JavaOptionsPanelController.java Mon Jul 14 15:43:47 2008 +0200 @@ -61,9 +61,9 @@ import org.openide.util.HelpCtx; import org.openide.util.Lookup; -final class JavaOptionsPanelController extends OptionsPanelController { +public final class JavaOptionsPanelController extends OptionsPanelController { - private static final String TAB_FOLDER = "org.netbeans.modules.java.source/options/"; + private static final String TAB_FOLDER = "OptionsDialog/JavaOptions"; //NOI18N private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); @@ -76,7 +76,7 @@ public JavaOptionsPanelController() { readPanels(); } - + public void update() { for (OptionsPanelController c : getControllers()) { c.update(); diff -r c9a896e042ec options.api/apichanges.xml --- a/options.api/apichanges.xml Wed Jul 09 07:04:51 2008 +0200 +++ b/options.api/apichanges.xml Mon Jul 14 15:43:47 2008 +0200 @@ -72,6 +72,22 @@ + + + Support for searchable options + + + + + + Added new factory methods enabling declarative loading of option + panels (createCategory and createSubCategory) to OptionsCategory + and AdvancedOption + + + + + API to open the options dialog with some subcategory pre-selected diff -r c9a896e042ec options.api/manifest.mf --- a/options.api/manifest.mf Wed Jul 09 07:04:51 2008 +0200 +++ b/options.api/manifest.mf Mon Jul 14 15:43:47 2008 +0200 @@ -2,6 +2,6 @@ OpenIDE-Module: org.netbeans.modules.options.api/1 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/options/Bundle.properties OpenIDE-Module-Layer: org/netbeans/modules/options/resources/mf-layer.xml -OpenIDE-Module-Specification-Version: 1.8 +OpenIDE-Module-Specification-Version: 1.9 AutoUpdate-Show-In-Client: false AutoUpdate-Essential-Module: true diff -r c9a896e042ec options.api/nbproject/project.xml --- a/options.api/nbproject/project.xml Wed Jul 09 07:04:51 2008 +0200 +++ b/options.api/nbproject/project.xml Mon Jul 14 15:43:47 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 c9a896e042ec options.api/src/org/netbeans/modules/options/AdvancedOptionImpl.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/options.api/src/org/netbeans/modules/options/AdvancedOptionImpl.java Mon Jul 14 15:43:47 2008 +0200 @@ -0,0 +1,98 @@ +/* + * 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 org.netbeans.spi.options.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.StringTokenizer; + +/** + * Advanced Option implementation class. Used by factory method from + * AdvancedOption as instance created from layer.xml values + * + * @author Max Sauer + */ +public class AdvancedOptionImpl extends AdvancedOption { + + private String displayName; + private String tooltip; + private String keywords; + private OptionsPanelController controller; + private String keywordsCategory; + + public AdvancedOptionImpl(OptionsPanelController controller, String displayName, String tooltip, String keywords, String keywordsCategory) { + this.controller = controller; + this.displayName = displayName; + this.tooltip = tooltip; + this.keywords = keywords; + this.keywordsCategory = keywordsCategory; + } + + @Override + public String getDisplayName () { + return displayName; + } + + @Override + public String getTooltip () { + return tooltip; + } + + /** + * Provides list of options for this category + * @return map of path and keywords for each optioncategory sub-panel + */ + public Map> getKeywordsByCategory() { + HashMap> result = new HashMap>(); + if(keywordsCategory != null && keywords != null) + result.put(keywordsCategory, new HashSet(Collections.list(new StringTokenizer(keywords, ",")))); //NOI18N + return result; + } + + @Override + public OptionsPanelController create() { + return controller; + } + +} diff -r c9a896e042ec options.api/src/org/netbeans/modules/options/Bundle.properties --- a/options.api/src/org/netbeans/modules/options/Bundle.properties Wed Jul 09 07:04:51 2008 +0200 +++ b/options.api/src/org/netbeans/modules/options/Bundle.properties Mon Jul 14 15:43:47 2008 +0200 @@ -67,3 +67,5 @@ ACS_OKButton=OK ACS_ClassicButton= Invokes Advanced Options dialog ACS_OptionsPanel=Options Dialog + +QuickSearch/GoToOption=Options diff -r c9a896e042ec options.api/src/org/netbeans/modules/options/CategoryModel.java --- a/options.api/src/org/netbeans/modules/options/CategoryModel.java Wed Jul 09 07:04:51 2008 +0200 +++ b/options.api/src/org/netbeans/modules/options/CategoryModel.java Mon Jul 14 15:43:47 2008 +0200 @@ -41,12 +41,14 @@ package org.netbeans.modules.options; +import java.awt.image.LookupTable; import java.beans.PropertyChangeListener; import java.lang.ref.Reference; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; @@ -54,10 +56,13 @@ import java.util.Set; import javax.swing.Icon; import javax.swing.JComponent; +import org.netbeans.spi.options.AdvancedOption; import org.netbeans.spi.options.OptionsCategory; import org.netbeans.spi.options.OptionsPanelController; import org.openide.util.HelpCtx; import org.openide.util.Lookup; +import org.openide.util.Lookup.Item; +import org.openide.util.Lookup.Result; import org.openide.util.LookupEvent; import org.openide.util.LookupListener; import org.openide.util.RequestProcessor; @@ -69,13 +74,18 @@ */ public final class CategoryModel implements LookupListener { private static Reference INSTANCE = new WeakReference(new CategoryModel()); - private final RequestProcessor RP = new RequestProcessor(); + private final RequestProcessor RP = new RequestProcessor(); private static String currentCategoryID = null; - private String highlitedCategoryID = null; + private String highlitedCategoryID = null; private boolean categoriesValid = true; - private final Map id2Category = + private final Map id2Category = Collections.synchronizedMap(new LinkedHashMap()); private MasterLookup masterLookup; + + Set> getCategories() { + return id2Category.entrySet(); + } + private final RequestProcessor.Task masterLookupTask = RP.create(new Runnable() { public void run() { String[] categoryIDs = getCategoryIDs(); @@ -93,7 +103,7 @@ },true); private final RequestProcessor.Task categoryTask = RP.create(new Runnable() { public void run() { - Map all = loadOptionsCategories(); + Map all = loadOptionsCategories(); Map temp = new LinkedHashMap(); for (Iterator> it = all.entrySet().iterator(); it.hasNext();) { Map.Entry entry = it.next(); @@ -107,11 +117,11 @@ masterLookupTask.schedule(0); } },true); - + private CategoryModel() { categoryTask.schedule(0); } - + public static CategoryModel getInstance() { CategoryModel retval = INSTANCE.get(); if (retval == null) { @@ -120,39 +130,39 @@ } return retval; } - + boolean needsReinit() { synchronized(CategoryModel.class) { return !categoriesValid; - } + } } - + boolean isInitialized() { return categoryTask.isFinished(); } - + boolean isLookupInitialized() { return masterLookupTask.isFinished(); } - - + + void waitForInitialization() { categoryTask.waitFinished(); } - + public String getCurrentCategoryID() { return verifyCategoryID(currentCategoryID); } - + public void setCurrentCategoryID(String categoryID) { currentCategoryID = verifyCategoryID(categoryID); } - + String getHighlitedCategoryID() { return verifyCategoryID(highlitedCategoryID); } - + private String verifyCategoryID(String categoryID) { String retval = findCurrentCategoryID(categoryID) != -1 ? categoryID : null; if (retval == null) { @@ -163,22 +173,22 @@ } return retval; } - + private int findCurrentCategoryID(String categoryID) { return categoryID == null ? -1 : Arrays.asList(getCategoryIDs()).indexOf(categoryID); } - + public String[] getCategoryIDs() { categoryTask.waitFinished(); - Set keys = id2Category.keySet(); + Set keys = id2Category.keySet(); return keys.toArray(new String[keys.size()]); } - + Category getCurrent() { String categoryID = getCurrentCategoryID(); return (categoryID == null) ? null : getCategory(categoryID); } - + void setCurrent(Category item) { item.setCurrent(); } @@ -186,12 +196,12 @@ void setHighlited(Category item,boolean highlited) { item.setHighlited(highlited); } - + HelpCtx getHelpCtx() { final CategoryModel.Category category = getCurrent(); return (category == null) ? null : category.getHelpCtx(); } - + void update(PropertyChangeListener l, boolean force) { String[] categoryIDs = getCategoryIDs(); for (int i = 0; i < categoryIDs.length; i++) { @@ -199,7 +209,7 @@ item.update(l, force); } } - + void save() { String[] categoryIDs = getCategoryIDs(); for (int i = 0; i < categoryIDs.length; i++) { @@ -207,7 +217,7 @@ item.applyChanges(); } } - + void cancel() { String[] categoryIDs = getCategoryIDs(); for (int i = 0; i < categoryIDs.length; i++) { @@ -215,7 +225,7 @@ item.cancel(); } } - + boolean dataValid() { boolean retval = true; String[] categoryIDs = getCategoryIDs(); @@ -225,7 +235,7 @@ } return retval; } - + boolean isChanged() { boolean retval = false; String[] categoryIDs = getCategoryIDs(); @@ -235,8 +245,8 @@ } return retval; } - - + + Category getNextCategory() { int idx = findCurrentCategoryID(getCurrentCategoryID()); String[] categoryIDs = getCategoryIDs(); @@ -252,7 +262,7 @@ } return nextId != null ? getCategory(nextId) : null; } - + Category getPreviousCategory() { int idx = findCurrentCategoryID(getCurrentCategoryID()); String[] categoryIDs = getCategoryIDs(); @@ -268,20 +278,20 @@ } return previousId != null ? getCategory(previousId) : null; } - - + + Category getCategory(String categoryID) { categoryTask.waitFinished(); return id2Category.get(categoryID); } - + private MasterLookup getMasterLookup() { if (masterLookup == null) { masterLookup = new MasterLookup(); } return masterLookup; } - + private Map loadOptionsCategories() { Lookup lookup = Lookups.forPath("OptionsDialog"); // NOI18N Lookup.Result result = lookup.lookup(new Lookup.Template(OptionsCategory.class)); @@ -296,12 +306,12 @@ public void resultChanged(LookupEvent ev) { synchronized(CategoryModel.class) { - categoriesValid = false; + categoriesValid = false; OptionsDisplayerImpl.lookupListener.resultChanged(ev); INSTANCE = new WeakReference(new CategoryModel()); } } - + final class Category { private OptionsCategory category; private OptionsPanelController controller; @@ -310,20 +320,20 @@ private JComponent component; private Lookup lookup; private final String id; - + private Category(final String id, final OptionsCategory category) { this.category = category; this.id = id; } - + boolean isCurrent() { return getID().equals(getCurrentCategoryID()); } - + boolean isHighlited() { return getID().equals(getHighlitedCategoryID()); } - + private void setCurrent() { setCurrentCategoryID(getID()); } @@ -331,7 +341,7 @@ public void setCurrentSubcategory(String subpath) { OptionsPanelControllerAccessor.getDefault().setCurrentSubcategory(create(), subpath); } - + private void setHighlited(boolean highlited) { if (highlited) { highlitedCategoryID = getID(); @@ -339,7 +349,7 @@ highlitedCategoryID = currentCategoryID; } } - + public Icon getIcon() { return category.getIcon(); } @@ -349,22 +359,43 @@ public String getID() { return id; } - + public String getCategoryName() { return category.getCategoryName(); } - + public String getTitle() { return category.getTitle(); } - + private synchronized OptionsPanelController create() { if (controller == null) { controller = category.create(); } return controller; } - + + public Map> getKeywords() { + Map> kws = new HashMap>(); + if(category != null && (category instanceof OptionsCategoryImpl)) { + kws.putAll(((OptionsCategoryImpl) category).getKeywordsByCategory()); + } + + //sub-panels keywords + String path = "OptionsDialog/" + getID(); // NOI18N + Lookup lkp = Lookups.forPath(path); + Result lkpResult = lkp.lookup(new Lookup.Template(AdvancedOption.class)); + for (Item item : lkpResult.allItems()) { + // don't lookup in subfolders + if (item.getId().substring(0, item.getId().lastIndexOf('/')).equals(path)) { // NOI18N + AdvancedOption option = item.getInstance(); + if(option instanceof AdvancedOptionImpl) + kws.putAll(((AdvancedOptionImpl) option).getKeywordsByCategory()); + } + } + return kws; + } + final void update(PropertyChangeListener l, boolean forceUpdate) { if ((!isUpdated && !forceUpdate) || (isUpdated && forceUpdate)) { isUpdated = true; @@ -375,21 +406,21 @@ } } } - + private void applyChanges() { if (isUpdated) { create().applyChanges(); } isUpdated = false; } - + private void cancel() { if (isUpdated) { create().cancel(); } isUpdated = false; } - + private boolean isValid() { boolean retval = true; if (isUpdated) { @@ -397,7 +428,7 @@ } return retval; } - + private boolean isChanged() { boolean retval = false; if (isUpdated) { @@ -405,19 +436,19 @@ } return retval; } - + public JComponent getComponent() { if (component == null) { component = create().getComponent(getMasterLookup()); } return component; } - + private HelpCtx getHelpCtx() { return create().getHelpCtx(); } - - + + private Lookup getLookup() { if (lookup == null) { lookup = create().getLookup(); @@ -425,7 +456,7 @@ return lookup; } } - + private class MasterLookup extends ProxyLookup { private void setLookups(List lookups) { setLookups(lookups.toArray(new Lookup[lookups.size()])); diff -r c9a896e042ec options.api/src/org/netbeans/modules/options/OptionsCategoryImpl.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/options.api/src/org/netbeans/modules/options/OptionsCategoryImpl.java Mon Jul 14 15:43:47 2008 +0200 @@ -0,0 +1,128 @@ +/* + * 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.awt.Image; +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.Icon; +import javax.swing.ImageIcon; +import org.netbeans.spi.options.OptionsCategory; +import org.netbeans.spi.options.OptionsPanelController; +import org.openide.util.Utilities; + +/** + * OptionsCategory implementation class. Used by factory method from + * OptionsCategory as instance created from layer.xml values + * + * @author Max Sauer + */ +public class OptionsCategoryImpl extends OptionsCategory { + + //category fields + private String title; + private String categoryName; + private String iconBase; + private ImageIcon icon; + private OptionsPanelController controller; + private String description; + private String keywords; + private String keywordsCategory; + + public OptionsCategoryImpl(String title, String categoryName, String iconBase, OptionsPanelController controller, String description, String keywords, String keywordsCategory) { + this.title = title; + this.categoryName = categoryName; + this.iconBase = iconBase; + this.controller = controller; + this.description = description; + this.keywords = keywords; + this.keywordsCategory = keywordsCategory; + } + + @Override + public Icon getIcon() { + if (icon == null) { + Image image = Utilities.loadImage(iconBase); + if (image != null) { + return new ImageIcon(image); + } + image = Utilities.loadImage(iconBase + ".png"); + if (image != null) { + return new ImageIcon(image); + } + image = Utilities.loadImage(iconBase + ".gif"); + if (image == null) { + return null; + } + icon = new ImageIcon(image); + } + return icon; + } + + @Override + public String getCategoryName () { + return categoryName; + } + + @Override + public String getTitle () { + return title; + } + + public String getDescription() { + return description; + } + + @Override + public OptionsPanelController create() { + return controller; + } + + final Map> getKeywordsByCategory() { + HashMap> result = new HashMap>(); + if(keywordsCategory != null && keywords != null) + result.put(keywordsCategory, new HashSet(Collections.list(new StringTokenizer(keywords, ",")))); //NOI18N + return result; + } +} diff -r c9a896e042ec 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 Mon Jul 14 15:43:47 2008 +0200 @@ -0,0 +1,82 @@ +/* + * 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.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 c9a896e042ec options.api/src/org/netbeans/modules/options/advanced/Model.java --- a/options.api/src/org/netbeans/modules/options/advanced/Model.java Wed Jul 09 07:04:51 2008 +0200 +++ b/options.api/src/org/netbeans/modules/options/advanced/Model.java Mon Jul 14 15:43:47 2008 +0200 @@ -133,15 +133,18 @@ public OptionsPanelController getController(String categoryID) { return categoryToController.get(getDisplayName(categoryID)); } - + 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 ()); + OptionsPanelController controller = categoryToController.get(category); + if (controller==null) { + controller = new DelegatingController(option.create ()); + categoryToController.put (category, controller); + } controller.addPropertyChangeListener(propertyChangeListener); - categoryToController.put (category, controller); panel = controller.getComponent (masterLookup); categoryToPanel.put (category, panel); Border b = panel.getBorder (); @@ -306,7 +309,7 @@ public void removePropertyChangeListener(PropertyChangeListener l) { delegate.removePropertyChangeListener(l); - } + } } } diff -r c9a896e042ec options.api/src/org/netbeans/modules/options/resources/mf-layer.xml --- a/options.api/src/org/netbeans/modules/options/resources/mf-layer.xml Wed Jul 09 07:04:51 2008 +0200 +++ b/options.api/src/org/netbeans/modules/options/resources/mf-layer.xml Mon Jul 14 15:43:47 2008 +0200 @@ -69,4 +69,15 @@ + + + + + + + + + + + diff -r c9a896e042ec options.api/src/org/netbeans/spi/options/AdvancedOption.java --- a/options.api/src/org/netbeans/spi/options/AdvancedOption.java Wed Jul 09 07:04:51 2008 +0200 +++ b/options.api/src/org/netbeans/spi/options/AdvancedOption.java Mon Jul 14 15:43:47 2008 +0200 @@ -41,28 +41,52 @@ package org.netbeans.spi.options; +import org.netbeans.modules.options.AdvancedOptionImpl; +import java.util.Map; + /** - * Implementation of this class represents one category (like "Ant" - * or "Form Editor") in Miscellaneous Panel of Options Dialog. It should - * be registerred in layers: + * This class represents one category (like "Ant" + * or "Form Editor") in Miscellaneous Panel of Options Dialog. Its instances should + * be registered in layers and created by createSubCategory factory + * method as follows: * *
  * <folder name="OptionsDialog">
  *     <folder name="Advanced">
  *         <file name="FooAdvancedPanel.instance">
- *             <attr name="instanceClass" stringvalue="org.foo.FooAdvancedPanel"/>
+ *             <attr name="instanceCreate" methodvalue="org.netbeans.spi.options.AdvancedOption.createSubCategory"/>
+ *             <attr name="controller" newvalue="org.foo.ToDoOptionsController"/>
+ *             <attr name="displayName" bundlevalue="org.foo.Bundle#LBL_Foo"/>
+ *             <attr name="toolTip" bundlevalue="org.foo.Bundle#HINT_Foo"/>
+ *             <attr name="keywords" bundlevalue="org.foo.Bundle#KW_Foo"/>
+ *             <attr name="keywordsCategory" stringvalue="Advanced/FooSubTabInOptions"/>
  *         </file>
  *     </folder>
  * </folder>
- * + * + * where: + *
controller should be an instance of OptionsPanelController + *
displayName should be a pointer to Bundle where your tab displayname is stored + *
toolTip should be a pointer to Bundle where your tab toolTip is stored + *
keywords should be localized keywords list, separated by comma in Bundle, for quickserach purposes + *
keywordsCategory should be relative path to your panel inside Options dialog + *

* No explicit sorting recognized (may be sorted e.g. by display name). * * @see OptionsCategory * @see OptionsPanelController * @author Jan Jancura + * @author Max Sauer */ public abstract class AdvancedOption { - + + //xml entry names + private static final String DISPLAYNAME = "displayName"; + private static final String TOOLTIP = "toolTip"; + private static final String KEYWORDS = "keywords"; + private static final String CONTROLLER = "controller"; + private static final String KEYWORDS_CATEGORY = "keywordsCategory"; + /** * Returns name of category used in Advanced Panel of * Options Dialog. @@ -77,7 +101,7 @@ * @return tooltip for this category */ public abstract String getTooltip (); - + /** * Returns {@link OptionsPanelController} for this category. PanelController * creates visual component to be used inside of Advanced Panel. @@ -87,4 +111,20 @@ */ public abstract OptionsPanelController create (); + /** + * Factory method for creating instaces of Advanced option in a declarative + * way by loading necessary values from layer.xml + * + * @param attrs attributes defined in layer + * @return instance of AdvancedOption + */ + static AdvancedOption createSubCategory(Map attrs) { + String displayName = (String) attrs.get(DISPLAYNAME); + String tooltip = (String) attrs.get(TOOLTIP); + String keywords = (String) attrs.get(KEYWORDS); + OptionsPanelController controller = (OptionsPanelController) attrs.get(CONTROLLER); + String keywordsCategory = (String) attrs.get(KEYWORDS_CATEGORY); + + return new AdvancedOptionImpl(controller, displayName, tooltip, keywords, keywordsCategory); + } } diff -r c9a896e042ec options.api/src/org/netbeans/spi/options/OptionsCategory.java --- a/options.api/src/org/netbeans/spi/options/OptionsCategory.java Wed Jul 09 07:04:51 2008 +0200 +++ b/options.api/src/org/netbeans/spi/options/OptionsCategory.java Mon Jul 14 15:43:47 2008 +0200 @@ -42,21 +42,44 @@ package org.netbeans.spi.options; import java.awt.Image; +import java.util.Map; import javax.swing.Icon; import javax.swing.ImageIcon; +import org.netbeans.modules.options.OptionsCategoryImpl; import org.openide.util.Utilities; /** - * Implementation of this class represents one category (like "Fonts & Colors" - * or "Editor") in Options Dialog. It should be registerred in layers: + * This class represents one category (like "Fonts & Colors" + * or "Editor") in Options Dialog. Its instances should + * be registered in layers and created by createCategory factory + * method as follows: * - *
- * <folder name="OptionsDialog">
- *     <file name="FooOptionsPanel.instance">
- *         <attr name="instanceClass" stringvalue="org.foo.FooOptionsPanel"/>
- *     </file>
- * </folder>
+ *
+ *   <folder name="OptionsDialog">
+ *       <file name="General.instance">
+ *           <attr name="instanceCreate" methodvalue="org.netbeans.spi.options.OptionsCategory.createCategory"/>
+ *           <attr name="title" bundlevalue="org.netbeans.core.ui.options.general.Bundle#CTL_General_Options_Title"/>
+ *           <attr name="categoryName" bundlevalue="org.netbeans.core.ui.options.general.Bundle#CTL_General_Options"/>
+ *           <attr name="iconBase" stringvalue="org/netbeans/modules/options/resources/generalOptions.png"/>
+ *           <attr name="controller" newvalue="org.netbeans.core.ui.options.general.GeneralOptionsPanelController"/>
+ *           <attr name="keywords" bundlevalue="org.netbeans.core.ui.options.general.Bundle#KW_General"/>
+ *           <attr name="keywordsCategory" stringvalue="General"/>
+ *           <attr name="description" bundlevalue="org.netbeans.core.ui.options.general.Bundle#CTL_General_Options_Description"/>
  *
+ *           <attr name="position" intvalue="100"/>
+ *       </file>
+ *   </folder>
+ * + * where: + *
controller should be an instance of OptionsPanelController + *
title should be a pointer to Bundle where title of your tab inside OD is stored + *
categoryName should be a pointer to Bundle where your tab categoryName is stored + *
iconBase should be relative path to icon wou wish to display inside OD + *
keywords should be localized keywords list, separated by comma in Bundle, for quickserach purposes + *
keywordsCategory should be relative path to your panel inside Options dialog + *
description should be a pointer to Bundle where your tab description is stored + * + *

* Use standard way how to sort items registered in layers: * *
@@ -64,14 +87,24 @@
  * 
* * @see AdvancedOption - * @see OptionsPanelController + * @see OptionsPanelController * * @author Jan Jancura + * @author Max Sauer */ public abstract class OptionsCategory { - + + //xml entry names + private static final String TITLE = "title"; + private static final String CATEGORY_NAME = "categoryName"; + private static final String ICON = "iconBase"; + private static final String CONTROLLER = "controller"; + private static final String DESCRIPTION = "description"; + private static final String KEYWORDS = "keywords"; + private static Object KEYWORDS_CATEGORY = "keywordsCategory"; + /** - * Returns base name of 32x32 icon (gif, png) used in list on the left side of + * Returns base name of 32x32 icon (gif, png) used in list on the left side of * Options Dialog. See {@link AbstractNode#setIconBase} method for more info. * * @deprecated This method will not be a part of NB50! Use @@ -83,7 +116,7 @@ } /** - * Returns 32x32 icon used in list on the left side of + * Returns 32x32 icon used in list on the top of * Options Dialog. * * @return 32x32 icon @@ -94,16 +127,16 @@ image = Utilities.loadImage (getIconBase () + ".gif"); if (image == null) return null; return new ImageIcon (image); - } - + } + /** - * Returns name of category used in list on the left side of + * Returns name of category used in list on the top side of * Options Dialog. * * @return name of category */ public abstract String getCategoryName (); - + /** * This text will be used in title component on the top of Options Dialog * when your panel will be selected. @@ -111,16 +144,34 @@ * @return title of this panel */ public abstract String getTitle (); - + /** - * Returns new {@link OptionsPanelController} for this category. PanelController + * Returns new {@link OptionsPanelController} for this category. PanelController * creates visual component to be used inside of the Options Dialog. - * You should not do any time-consuming operations inside - * the constructor, because it blocks initialization of OptionsDialog. + * You should not do any time-consuming operations inside + * the constructor, because it blocks initialization of OptionsDialog. * Initialization should be implemented in update method. * * @return new instance of PanelController for this options category */ public abstract OptionsPanelController create (); - + + /** + * Creates instance of OptionsCategory based on layer.xml + * attribute values + * + * @param attrs attributes loaded from layer.xml + * @return new OptionsCategory instance + */ + static OptionsCategory createCategory(Map attrs) { + String title = (String) attrs.get(TITLE); + String categoryName = (String) attrs.get(CATEGORY_NAME); + String iconBase = (String) attrs.get(ICON); + OptionsPanelController controller = (OptionsPanelController) attrs.get(CONTROLLER); + String description = (String) attrs.get(DESCRIPTION); + String keywords = (String) attrs.get(KEYWORDS); + String keywordsCategory = (String) attrs.get(KEYWORDS_CATEGORY); + + return new OptionsCategoryImpl(title, categoryName, iconBase, controller, description, keywords, keywordsCategory); + } } diff -r c9a896e042ec tasklist.todo/src/org/netbeans/modules/tasklist/todo/layer.xml --- a/tasklist.todo/src/org/netbeans/modules/tasklist/todo/layer.xml Wed Jul 09 07:04:51 2008 +0200 +++ b/tasklist.todo/src/org/netbeans/modules/tasklist/todo/layer.xml Mon Jul 14 15:43:47 2008 +0200 @@ -30,7 +30,13 @@ - + + + + + + +
diff -r c9a896e042ec tasklist.todo/src/org/netbeans/modules/tasklist/todo/settings/Bundle.properties --- a/tasklist.todo/src/org/netbeans/modules/tasklist/todo/settings/Bundle.properties Wed Jul 09 07:04:51 2008 +0200 +++ b/tasklist.todo/src/org/netbeans/modules/tasklist/todo/settings/Bundle.properties Mon Jul 14 15:43:47 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 c9a896e042ec tasklist.todo/src/org/netbeans/modules/tasklist/todo/settings/ToDoOptions.java --- a/tasklist.todo/src/org/netbeans/modules/tasklist/todo/settings/ToDoOptions.java Wed Jul 09 07:04:51 2008 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2007 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]" - * - * Contributor(s): - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - * - * 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. - */ - -package org.netbeans.modules.tasklist.todo.settings; - -import org.netbeans.spi.options.AdvancedOption; -import org.netbeans.spi.options.OptionsPanelController; -import org.openide.util.NbBundle; - -/** - * - * @author S. Aubrecht - */ -public class ToDoOptions extends AdvancedOption { - - public String getDisplayName() { - return NbBundle.getMessage( ToDoOptions.class, "LBL_Options" ); //NOI18N - } - - public String getTooltip() { - return NbBundle.getMessage( ToDoOptions.class, "HINT_Options" ); //NOI18N - } - - public OptionsPanelController create() { - return new ToDoOptionsController(); - } - -}