# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /space/nball/ant/freeform/src/org/netbeans/modules/ant/freeform
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: ui/ProjectCustomizer.java
*** /space/nball/ant/freeform/src/org/netbeans/modules/ant/freeform/ui/ProjectCustomizer.java Base (1.20)
--- /space/nball/ant/freeform/src/org/netbeans/modules/ant/freeform/ui/ProjectCustomizer.java Locally Modified (Based On 1.20)
***************
*** 31,36 ****
--- 31,37 ----
import javax.swing.JPanel;
import javax.swing.tree.TreeSelectionModel;
import org.netbeans.modules.ant.freeform.FreeformProject;
+ import org.netbeans.modules.ant.freeform.Util;
import org.netbeans.modules.ant.freeform.spi.ProjectNature;
import org.netbeans.modules.ant.freeform.spi.ProjectPropertiesPanel;
import org.netbeans.spi.project.AuxiliaryConfiguration;
***************
*** 63,69 ****
public ProjectCustomizer(FreeformProject project) {
this.project = project;
initComponents();
! HelpCtx.setHelpIDString( customizerPanel, "org.netbeans.modules.ant.freeform.ui.ProjectCustomizer" ); // NOI18N
fillConstraints = new GridBagConstraints();
fillConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
--- 64,70 ----
public ProjectCustomizer(FreeformProject project) {
this.project = project;
initComponents();
! HelpCtx.setHelpIDString( customizerPanel, "org.netbeans.modules.ant.freeform.ui.ProjectCustomizer." + Util.getMergedHelpIDFragments(project) ); // NOI18N
fillConstraints = new GridBagConstraints();
fillConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
***************
*** 168,178 ****
public HelpCtx getHelpCtx() {
if ( currentCustomizer != null ) {
! return HelpCtx.findHelp( currentCustomizer );
}
else {
return HelpCtx.findHelp( customizerPanel );
--- 169,182 ----
public HelpCtx getHelpCtx() {
if ( currentCustomizer != null ) {
! HelpCtx customizerCtx = HelpCtx.findHelp( currentCustomizer );
!
! if (customizerCtx.getHelpID() != null) {
! return new HelpCtx(customizerCtx.getHelpID() + "." + Util.getMergedHelpIDFragments(project)); // NOI18N
! } else {
! return customizerCtx;
}
+ }
else {
return HelpCtx.findHelp( customizerPanel );
}
Index: ui/View.java
*** /space/nball/ant/freeform/src/org/netbeans/modules/ant/freeform/ui/View.java Base (1.18)
--- /space/nball/ant/freeform/src/org/netbeans/modules/ant/freeform/ui/View.java Locally Modified (Based On 1.18)
***************
*** 46,51 ****
--- 46,52 ----
import org.openide.nodes.Node;
import org.openide.nodes.NodeNotFoundException;
import org.openide.nodes.NodeOp;
+ import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
import org.openide.util.RequestProcessor;
import org.openide.util.Utilities;
***************
*** 269,276 ****
--- 270,282 ----
public void setName(String name) {
DefaultProjectOperations.performDefaultRenameOperation(p, name);
}
+
+ public HelpCtx getHelpCtx() {
+ return new HelpCtx("freeform.node." + org.netbeans.modules.ant.freeform.Util.getMergedHelpIDFragments(p)); // NOI18N
}
+ }
+
static final class VisibilityQueryDataFilter implements ChangeListener, ChangeableDataFilter {
EventListenerList ell = new EventListenerList();
Index: spi/HelpIDFragmentProvider.java
*** /space/nball/ant/freeform/src/org/netbeans/modules/ant/freeform/spi/HelpIDFragmentProvider.java No Base Revision
--- /space/nball/ant/freeform/src/org/netbeans/modules/ant/freeform/spi/HelpIDFragmentProvider.java Locally New
***************
*** 1,0 ****
--- 1,43 ----
+ /*
+ * 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.
+ */
+ package org.netbeans.modules.ant.freeform.spi;
+
+ /**This interface is used to compute the help context for a freeform project.
+ * Each {@link ProjectNature} should register an implementation in its lookup.
+ * See {@link #getHelpIDFragment} to find out what are the requirements on the help
+ * id fragments.
+ *
+ * If it is necessary to compute a help context for a freeform project, all
+ * {@link HelpIDFragmentProvider}s registered in the project's lookup are asked to
+ * provide the fragments. The fragments are then lexicographically sorted and
+ * concatenated (separated by dots) into one string, used as a base for the help id.
+ *
+ * @author Jan Lahoda
+ */
+ public interface HelpIDFragmentProvider {
+
+ /**Returns a help id fragment defined by the implementor. The method should return
+ * the same string each time it is called (more preciselly, it is required that
+ * getHelpIDFragment().equals(getHelpIDFragment())
, but is allowed to
+ * getHelpIDFragment() != getHelpIDFragment()
). The string should be unique
+ * among all the freeform project natures. The string is required to match this
+ * regular expression: ([A-Za-z0-9])+
.
+ *
+ * Please note that the returned fragment is part of the contract between the
+ * code and documentation, so be carefull when you need to change it.
+ *
+ * @return a non-null help id fragment, fullfilling the above conditions.
+ */
+ public String getHelpIDFragment();
+
+ }
Index: Util.java
*** /space/nball/ant/freeform/src/org/netbeans/modules/ant/freeform/Util.java Base (1.10)
--- /space/nball/ant/freeform/src/org/netbeans/modules/ant/freeform/Util.java Locally Modified (Based On 1.10)
***************
*** 17,35 ****
--- 17,41 ----
import java.io.IOException;
import java.text.Collator;
import java.util.ArrayList;
+ import java.util.Collection;
+ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
+ import java.util.regex.Pattern;
import javax.swing.event.ChangeListener;
import org.apache.tools.ant.module.api.AntProjectCookie;
import org.apache.tools.ant.module.api.support.TargetLister;
+ import org.netbeans.api.project.Project;
+ import org.netbeans.modules.ant.freeform.spi.HelpIDFragmentProvider;
import org.openide.ErrorManager;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.loaders.DataObject;
import org.openide.loaders.DataObjectNotFoundException;
+ import org.openide.util.Lookup;
import org.openide.xml.XMLUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
***************
*** 95,100 ****
--- 101,138 ----
return apc;
}
+ private static final Pattern VALIDATION = Pattern.compile("([A-Za-z0-9])+"); // NOI18N
+
+ public static String getMergedHelpIDFragments(Project p) {
+ Collection/**/ providers = p.getLookup().lookup(new Lookup.Template(HelpIDFragmentProvider.class)).allInstances();
+ List/**/ fragments = new ArrayList();
+
+ for (Iterator i = providers.iterator(); i.hasNext(); ) {
+ HelpIDFragmentProvider provider = (HelpIDFragmentProvider) i.next();
+ String fragment = provider.getHelpIDFragment();
+
+ if (fragment == null || !VALIDATION.matcher(fragment).matches()) {
+ throw new IllegalStateException("HelpIDFragmentProvider \"" + provider + "\" provided invalid help ID fragment \"" + fragment + "\"."); // NOI18N
+ }
+
+ fragments.add(fragment);
+ }
+
+ Collections.sort(fragments);
+
+ StringBuffer result = new StringBuffer();
+
+ for (Iterator i = fragments.iterator(); i.hasNext(); ) {
+ result.append((String) i.next());
+
+ if (i.hasNext()) {
+ result.append('.');
+ }
+ }
+
+ return result.toString();
+ }
+
/**
* Returns sorted list of targets name of the Ant script represented by the
* given file object.