PreviousNextTracker indexSee it online !

(12/28) 496 - Patch for bug ID 3598585 NullPointerException .....

Patch for bug ID 3598585 posted here: https://sourceforge.net/tracker/?func=detail&aid=3598585&group_id=588&atid=100588

The reason for NullPointerException wasnt specified well. The real problem was, that if user wanted to add new tool to toolbar and forgot to select an action to be performed by the new toolbar icon, then the NullPointerException occured, but the user didnt see any action. It could be quite confusing.


My simple patch gives the user more info, when he forgets to select an action and presses the OK button in toolbar Add dialog.
When user presses OK and action is not selected, the message dialog appears and warns him.

Submitted danisluk - 2013-05-06 11:55:34 Assigned kpouer
Priority 5 Labels
Status open Group
Resolution None

Comments

2013-05-06 11:56:48
danisluk

Index: jEdit/trunk/org/gjt/sp/jedit/options/ToolBarOptionPane.java
===================================================================
--- jEdit/trunk/org/gjt/sp/jedit/options/ToolBarOptionPane.java (revision 22966)
+++ jEdit/trunk/org/gjt/sp/jedit/options/ToolBarOptionPane.java (working copy)
@@ -656,13 +656,16 @@
{
ToolBarOptionPane.Button button =
(ToolBarOptionPane.Button)list
- .getSelectedValue();
\+ .getSelectedValue();
\+ if(button==null){
\+ JOptionPane.showMessageDialog(null, "No action was selected");
\+ return null;
\+ }
label = button.label;
actionName = button.actionName;
}
else
throw new InternalError();
-
return new ToolBarOptionPane.Button(actionName,
iconName,icon,label);
}

2013-05-06 12:37:54
danisluk

better patch with updated localization properties

patch.patch (2.1Kio)

2013-05-06 12:39:05
danisluk

I updated the patch to use text resource from properties

2013-05-07 09:50:42
kpouer

Maybe it would be better to not activate the buttons if the action is not selected ?

2013-05-07 10:21:34
danisluk

Ok, I can do as you suggested.

2013-05-08 22:50:24
danisluk

fixed , as kpouer suggested by disabling ok button

patch2.patch (1.7Kio)

2013-05-08 22:53:09
danisluk

To kpouer : I have made another patch, which does what you suggested to me. The OK button is disabled when is not set any action or the separator radio button is not selected, otherwise the OK button is enabled.

2013-05-16 09:09:41
kpouer

I think there is something wrong. If you do control+click on the list you can unselect the action and the button will remains activated.
Also could you following coding rules (place opening braces on next line)

2014-04-25 20:26:24.057000
ezust

- **assigned_to**: Alan Ezust --> Matthieu Casanova