This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 135069 - OK button is disabled in "Replace Code Format Editor" dialog
Summary: OK button is disabled in "Replace Code Format Editor" dialog
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: I18N (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
: 137149 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-05-14 17:09 UTC by Petr Dvorak
Modified: 2016-07-07 07:18 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Dialog re-design (9.62 KB, image/png)
2008-05-15 20:53 UTC, Petr Dvorak
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Dvorak 2008-05-14 17:09:18 UTC
Product Version: NetBeans IDE Dev (Build 200805130003)
Java: 1.6.0_05; Java HotSpot(TM) Client VM 10.0-b19
System: Linux version 2.6.24-17-generic running on i386; UTF-8; en_US (nb)

In "Replace Code Format Editor" dialog, the OK button is enabled only if all parameters are filled in in the "Insert
Internationalized String" dialog (the same holds for the "Internationalize" dialog)... This didn't hold in NB6.0.1 - the
OK button was enabled, you were allowed to change the format of an i18n replace string with no limitations...

I don't know if it is not just an enhancement (imho its not - it worked fine in 6.0.1, now the behavior is really
strange, I think there is a little step backwards in NB functionality, but feel free to change it to an enhancement).

Steps to reproduce:

1. Create some java application and open some java file
2. Prepare some properties file (we will try to insert internationalized string - we need to have it)
3. Go to "Tools > Internationalization > Insert Internationalized String"
-> an "Insert Internationalized String" dialog opens

4. Click the "Format" button
-> dialog with a title "Replace Code Format Editor" opens, but you cannot confirm it using OK button, close this dialog
by clicking Cancel

5. Fill in bundle name and select a key in the "Insert Internationalized String" dialog
6. Click "Format" button again
-> Now, you can click OK button

I don't think there is a reason why users shouldn't be allowed to change the format of I18N replace string in the dialog
without doing anything else, is there? (in that case this issue would be invalid...)
Comment 1 Jana Maleckova 2008-05-15 10:27:19 UTC
I agree that in case the dialog for formatting is enabled to open then OK button should not be disabled. But anyway In
case you haven't selected any bundle and keys in primary dialog, any formatted code couldn't be generated.

I hope that better solution is to disable "Format" button in case when no parameters are filled instead of enabling OK
button in Format Editor.
Comment 2 Petr Dvorak 2008-05-15 20:50:38 UTC
Well, I don't know if disabling the "Format" button is currently the good way how to deal with the issue, Janie. You
don't need to see any generated code after you change the replace string format, you might just want to set the replace
string format... I think the way it worked in 6.0.1 was quite fine (not perfect) as the change in the replace string
format was persistent after you reopened the dialog.

Supose this use case: you are using some solution for the i18n and you want to set the replace string format matching
your i18n solution in the beginning of your work (before there is any internationalized string in the project - you just
want to "get ready") so that you can just use it later whenever you want to really insert some internationalized string...

Anyway - is there any way how to edit the list of replace string formats (can you edit the items in the "Replace Code
Format Editor" combobox?) or is user allowed to create/customize a replace string before he/she really wants to do some
internationalization in the project? [ I haven't found these features :-( but maybe they are somewhere... ]

I think the best would be to do following:

1. Redesign the "Replace Code Format Editor" - change combobox to listbox, add a textfield and new buttons: "Add",
"Remove", "Edit", ... See the picture (it is just an illustration, don't take the appearance of the dialog too
seriously;))...

2. Allow invoking the "Replace Code Format Editor" from somewhere else then from the "Insert Internationalized String"
dialog (and "Internationalize" dialog). Hmm, I do not actually know where it should be placed. It would be possible to
create a new sub-menu in the Internationalize menu called Others, or something (Tools > Internationalization > Others >
Edit Replace Code Formats)...

3. An OK button in above mentioned dialog would just store the selected listbox item somewhere. The dialog "Insert
internationalized string" could just use the currently stored value when "Replace code format editor" dialog is closed...

If there is any problem (conceptual, technical or other) with this solution, please comment on it.
Comment 3 Petr Dvorak 2008-05-15 20:53:34 UTC
Created attachment 61449 [details]
Dialog re-design
Comment 4 rbalada 2008-06-09 15:56:17 UTC
Hello,

this issue seems to a side effect in user experience likely caused by a fix for issue 58477.

The OK button was always enabled in all pre-6.1 releases. Starting with 6.1 the OK button is enabled only when the
formatting code is properly formatted and can be properly handled w/o exceptions.

From my point of view this issue is not DEFECT, but ENHANCEMENT. I do admit that disabling OK button is not the best way
of feedback to tell user about improperly formatted replace string, but it was the only way possible in that time for NB
6.1 release. It was the only way w/o UI change, which gives user at least some feedback that something is wrong. 

If the formating code is correct, the OK button should be enabled and in such a case I would treat this issue a DEFECT.
Comment 5 rbalada 2008-06-09 16:16:36 UTC
Notes for UI redesign: Please consider also graphical&textual notification area where user can get info about quality of
the formatting string, current dialog just disables the OK button.

Developer note:
Disabling/enabling of the OK button is done by calls of "dd.setValid()" method in
http://hg.netbeans.org/main/file/1d277c3e7f2d/i18n/src/org/netbeans/modules/i18n/PropertyPanel.java lines 546-572
Comment 6 Jana Maleckova 2008-06-10 09:00:45 UTC
Hi Rudo,
OK button is always disabled in case when no resource bundle and keys are filled in basic dialog and it doesn't matter
if formatted string is correct or not. I agree with joshis that current behavior of this dialog is odd. This case should
be handled better. But anyway IMHO 6.5 release is coming soon and this issue is not so serious to be solved immediately
in such complicated way. This state doesn't cause any issue to user, he just has to adapt to it. 

So, I agree with joshis that this is bug not enhancement. On the other hand it's not so serious to fulfill criteria of
priority P3 therefore I am lowering it on P4.
Finally, I don't think that we have enough time to fix it because there are more critical issues which should be done in 6.5
Comment 7 Petr Dvorak 2008-06-10 09:06:11 UTC
Yes, I agree, janie.
Comment 8 Jana Maleckova 2008-06-13 08:41:43 UTC
*** Issue 137149 has been marked as a duplicate of this issue. ***
Comment 9 Martin Balin 2016-07-07 07:18:10 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss