A generic mechanism for help IDs in variable input descriptors and command customizers
introduced. This is necessary to be able to fix issue #38733.
1.1 --- a/vcscore/src/org/netbeans/modules/vcscore/cmdline/UserCommandCustomizer.java Wed Feb 18 17:05:13 2004 +0000
1.2 +++ b/vcscore/src/org/netbeans/modules/vcscore/cmdline/UserCommandCustomizer.java Wed Feb 18 17:47:34 2004 +0000
1.3 @@ -89,6 +89,10 @@
1.4 return title;
1.5 }
1.6
1.7 + public String getHelpID() {
1.8 + return (String) dlg.getClientProperty("helpID");
1.9 + }
1.10 +
1.11 /**
1.12 * Add action listener, which is notified when an OK/Cancel action was performed
1.13 * on the dialog. The Dialog with this Customizer is closed when ACTION_PERFORMED
2.1 --- a/vcscore/src/org/netbeans/modules/vcscore/commands/CommandCustomizationSupport.java Wed Feb 18 17:05:13 2004 +0000
2.2 +++ b/vcscore/src/org/netbeans/modules/vcscore/commands/CommandCustomizationSupport.java Wed Feb 18 17:47:34 2004 +0000
2.3 @@ -847,6 +847,9 @@
2.4 // since I have the original variables locked.
2.5 final Hashtable dlgVars = new Hashtable(vars);
2.6 final VariableInputDialog dlg = new VariableInputDialog(new String[] { file }, inputDescriptor, expertCondition, dlgVars);
2.7 + if (inputDescriptor.getHelpID() != null) {
2.8 + dlg.putClientProperty("helpID", inputDescriptor.getHelpID());
2.9 + }
2.10 dlg.setExecutionContext(executionContext, dlgVars);
2.11 if (cmd.getDisplayName() != null) {
2.12 dlg.setCmdName(cmd.getDisplayName());
3.1 --- a/vcscore/src/org/netbeans/modules/vcscore/commands/CommandProcessor.java Wed Feb 18 17:05:13 2004 +0000
3.2 +++ b/vcscore/src/org/netbeans/modules/vcscore/commands/CommandProcessor.java Wed Feb 18 17:47:34 2004 +0000
3.3 @@ -401,6 +401,7 @@
3.4 ActionListener actionL = null;
3.5 java.lang.reflect.Method addActionListenerMethod = null;
3.6 java.lang.reflect.Method getDisplayNameMethod = null;
3.7 + java.lang.reflect.Method getHelpIDMethod = null;
3.8 java.lang.reflect.Method getInitialFocusedComponentMethod = null;
3.9 if (cust instanceof ActionListener) actionL = (ActionListener) cust;
3.10 try {
3.11 @@ -410,6 +411,9 @@
3.12 getDisplayNameMethod = cust.getClass().getMethod("getDisplayTitle",null);
3.13 } catch (Exception ex) {}
3.14 try {
3.15 + getHelpIDMethod = cust.getClass().getMethod("getHelpID", null);
3.16 + } catch (Exception ex) {}
3.17 + try {
3.18 getInitialFocusedComponentMethod = cust.getClass().getMethod("getInitialFocusedComponent", null);
3.19 } catch (Exception ex) {}
3.20 String displayName = null;
3.21 @@ -421,9 +425,20 @@
3.22 if (displayName == null) {
3.23 displayName = cmd.getDisplayName();
3.24 }
3.25 + org.openide.util.HelpCtx helpCtx = null;
3.26 + if (getHelpIDMethod != null) {
3.27 + try {
3.28 + String helpID = (String) getHelpIDMethod.invoke(cust, null);
3.29 + if (helpID != null) {
3.30 + helpCtx = new org.openide.util.HelpCtx(helpID);
3.31 + }
3.32 + } catch (Exception ex) {}
3.33 + }
3.34 dlg = new DialogDescriptor(cust, displayName,
3.35 true, DialogDescriptor.OK_CANCEL_OPTION,
3.36 - DialogDescriptor.OK_OPTION, actionL);
3.37 + DialogDescriptor.OK_OPTION,
3.38 + DialogDescriptor.DEFAULT_ALIGN, helpCtx,
3.39 + actionL);
3.40 final Dialog dialog = DialogDisplayer.getDefault().createDialog(dlg);
3.41 if (getInitialFocusedComponentMethod != null) {
3.42 java.awt.Component initialFocusedComponent = null;
4.1 --- a/vcscore/src/org/netbeans/modules/vcscore/util/VariableInputDescriptor.java Wed Feb 18 17:05:13 2004 +0000
4.2 +++ b/vcscore/src/org/netbeans/modules/vcscore/util/VariableInputDescriptor.java Wed Feb 18 17:47:34 2004 +0000
4.3 @@ -35,8 +35,10 @@
4.4 public static final int INPUT_GLOBAL = 8;
4.5 public static final int INPUT_SELECT_COMBO_EDITABLE = 9;
4.6 public static final int INPUT_TEXT = 11;
4.7 + public static final int INPUT_HELP_ID = 13;
4.8
4.9 public static final String INPUT_STR_LABEL = "LABEL";
4.10 + public static final String INPUT_STR_HELP_ID = "HELP_ID";
4.11 public static final String INPUT_STR_PROMPT_FIELD = "PROMPT_FOR";
4.12 public static final String INPUT_STR_PROMPT_AREA = "PROMPT_FOR_FILE";
4.13 public static final String INPUT_STR_PROMPT_PASSWD = "PROMPT_FOR_PASSWORD";
4.14 @@ -83,6 +85,7 @@
4.15 private String label;
4.16 private String a11yName = null;
4.17 private String a11yDescription = null;
4.18 + private String helpID;
4.19 private ArrayList components = new ArrayList();
4.20
4.21 /** Creates new VariableInputDescriptor */
4.22 @@ -92,6 +95,7 @@
4.23 if (inputMap == null) {
4.24 inputMap = new HashMap();
4.25 inputMap.put(INPUT_STR_LABEL, new Integer(INPUT_LABEL));
4.26 + inputMap.put(INPUT_STR_HELP_ID, new Integer(INPUT_HELP_ID));
4.27 inputMap.put(INPUT_STR_ACCESSIBILITY, new Integer(INPUT_ACCESSIBILITY));
4.28 inputMap.put(INPUT_STR_PROMPT_FIELD, new Integer(INPUT_PROMPT_FIELD));
4.29 inputMap.put(INPUT_STR_PROMPT_AREA, new Integer(INPUT_PROMPT_AREA));
4.30 @@ -148,6 +152,8 @@
4.31 //System.out.println("parseItems: "+inputStr+": "+inputArg);
4.32 if (inputId == INPUT_LABEL && inputArgs.length > 0) {
4.33 descriptor.label = VcsUtilities.getBundleString(inputArgs[0]);
4.34 + } else if (inputId == INPUT_HELP_ID && inputArgs.length > 0) {
4.35 + descriptor.helpID = inputArgs[0];
4.36 } else if (inputId == INPUT_ACCESSIBILITY && inputArgs.length > 0) {
4.37 VariableInputComponent testComponent = new VariableInputComponent(0, "", "");
4.38 setA11y(VcsUtilities.getBundleString(inputArg), testComponent);
4.39 @@ -199,6 +205,13 @@
4.40 }
4.41
4.42 /**
4.43 + * Get the help ID that should be associated with the dialog.
4.44 + */
4.45 + public String getHelpID() {
4.46 + return helpID;
4.47 + }
4.48 +
4.49 + /**
4.50 * Get the array of components.
4.51 * @return the array of components.
4.52 */