> 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);
+ }
+
+ }
+}
--- a/options.api/src/org/netbeans/modules/options/advanced/Model.java Wed Jul 09 07:04:51 2008 +0200
+++ a/options.api/src/org/netbeans/modules/options/advanced/Model.java Fri Jul 11 17:15:02 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);
- }
+ }
}
}
--- a/options.api/src/org/netbeans/modules/options/resources/mf-layer.xml Wed Jul 09 07:04:51 2008 +0200
+++ a/options.api/src/org/netbeans/modules/options/resources/mf-layer.xml Fri Jul 11 17:15:02 2008 +0200
@@ -69,4 +69,15 @@
+
+
+
+
+
+
+
+
+
+
+
--- a/options.api/src/org/netbeans/spi/options/AdvancedOption.java Wed Jul 09 07:04:51 2008 +0200
+++ a/options.api/src/org/netbeans/spi/options/AdvancedOption.java Fri Jul 11 17:15:02 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);
+ }
}
--- a/options.api/src/org/netbeans/spi/options/OptionsCategory.java Wed Jul 09 07:04:51 2008 +0200
+++ a/options.api/src/org/netbeans/spi/options/OptionsCategory.java Fri Jul 11 17:15:02 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);
+ }
}
--- a/tasklist.todo/src/org/netbeans/modules/tasklist/todo/layer.xml Wed Jul 09 07:04:51 2008 +0200
+++ a/tasklist.todo/src/org/netbeans/modules/tasklist/todo/layer.xml Fri Jul 11 17:15:02 2008 +0200
@@ -30,7 +30,13 @@
-
+
+
+
+
+
+
+
--- a/tasklist.todo/src/org/netbeans/modules/tasklist/todo/settings/Bundle.properties Wed Jul 09 07:04:51 2008 +0200
+++ a/tasklist.todo/src/org/netbeans/modules/tasklist/todo/settings/Bundle.properties Fri Jul 11 17:15:02 2008 +0200
@@ -9,4 +9,6 @@
ToDoCustomizer.btnChange.text=&Edit
LBL_Options=ToDo Tasks
-HINT_Options=Options for ToDo tasks in Task List window.
+HINT_Options=Options for ToDo tasks in Task List window.
+
+KW_ToDo=ToDo,@todo,FIXME,PENDING
--- 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();
- }
-
-}