# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: E:\sources\netbeans.org\release55\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: src/org/netbeans/modules/ant/freeform/ui/View.java
*** E:\sources\netbeans.org\release55\ant\freeform\src\org\netbeans\modules\ant\freeform\ui\View.java Base (1.14.12.2.2.1)
--- E:\sources\netbeans.org\release55\ant\freeform\src\org\netbeans\modules\ant\freeform\ui\View.java Locally Modified (Based On 1.14.12.2.2.1)
***************
*** 52,57 ****
--- 52,58 ----
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;
***************
*** 272,279 ****
--- 273,285 ----
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: src/org/netbeans/modules/ant/freeform/spi/HelpIDFragmentProvider.java
*** E:\sources\netbeans.org\release55\ant\freeform\src\org\netbeans\modules\ant\freeform\spi\HelpIDFragmentProvider.java No Base Revision
--- E:\sources\netbeans.org\release55\ant\freeform\src\org\netbeans\modules\ant\freeform\spi\HelpIDFragmentProvider.java Locally New
***************
*** 1,0 ****
--- 1,52 ----
+ /*
+ * The contents of this file are subject to the terms of the Common Development
+ * and Distribution License (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.html
+ * or http://www.netbeans.org/cddl.txt.
+ *
+ * When distributing Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at http://www.netbeans.org/cddl.txt.
+ * If applicable, add the following below the CDDL Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * 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.
+ */
+
+ 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: src/org/netbeans/modules/ant/freeform/Util.java
*** E:\sources\netbeans.org\release55\ant\freeform\src\org\netbeans\modules\ant\freeform\Util.java Base (1.10.64.1)
--- E:\sources\netbeans.org\release55\ant\freeform\src\org\netbeans\modules\ant\freeform\Util.java Locally Modified (Based On 1.10.64.1)
***************
*** 23,41 ****
--- 23,47 ----
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;
***************
*** 101,106 ****
--- 107,145 ----
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.
Index: src/org/netbeans/modules/ant/freeform/ui/ProjectCustomizer.java
*** E:\sources\netbeans.org\release55\ant\freeform\src\org\netbeans\modules\ant\freeform\ui\ProjectCustomizer.java Base (1.19.58.1)
--- E:\sources\netbeans.org\release55\ant\freeform\src\org\netbeans\modules\ant\freeform\ui\ProjectCustomizer.java Locally Modified (Based On 1.19.58.1)
***************
*** 35,47 ****
import java.util.Iterator;
import java.util.List;
import java.util.ResourceBundle;
- import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.tree.TreeSelectionModel;
import org.netbeans.modules.ant.freeform.FreeformProject;
import org.netbeans.modules.ant.freeform.spi.ProjectNature;
import org.netbeans.modules.ant.freeform.spi.ProjectPropertiesPanel;
--- 35,44 ----
import java.util.Iterator;
import java.util.List;
import java.util.ResourceBundle;
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;
***************
*** 75,81 ****
this.helper = helper;
this.project = project;
initComponents();
! HelpCtx.setHelpIDString( customizerPanel, "org.netbeans.modules.ant.freeform.ui.ProjectCustomizer" ); // NOI18N
fillConstraints = new GridBagConstraints();
fillConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
--- 75,81 ----
this.helper = helper;
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;
***************
*** 180,188 ****
public HelpCtx getHelpCtx() {
if ( currentCustomizer != null ) {
! return HelpCtx.findHelp( currentCustomizer );
}
! else {
return HelpCtx.findHelp( customizerPanel );
}
}
--- 180,192 ----
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 );
}
}