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.
How to reproduce: 1) open file, which has also associated form 2) run action Tools -> i18n -> Internationalize or Tools -> i18n -> Insert Internationalized String 3) SURPRISE - form editor is open!
The only surprise is that anybody has not noticed this until now. It behaves this way probably since i18n module exists (at least since NB 3.2 I've just tried). Yes, it is probably a bug, but I doubt it is P2 or an q-build stopper...
Scenario 1: Problem roots from EditorCookie. It does not support multi editor (visual and text) implementations. i18n needs access to textual representation only but it cannot open it using the cookie separately. May be that EditCookie could help if defined that it always opens *text* editor. Then someone could use EditCookie.edit() and then access opened text editor using EditorCookie. It requires consencus because all: java, jsp, form, other modules and OpenIDE must agree on above semancics. What OpenIDE API specification maintainers think about it? Scenario 2: Current EditorCookie is about text editing only. Then there is a bug in form module because it open()s visual editor. Anyway EditCookie, EditorCookie and OpenCookie relation should be documented. I assume that scenario 2 is the case so transfering to form.
I have hacked it in i18n: //!!! #23904 hack if (editorCookie.getClass().getName().endsWith("FormEditorSupport")) { ((EditCookie)editorCookie).edit(); } else { editorCookie.open(); } It is hack so please do not close until clean solution will be provided.
I don't understand - what's the bug in form editor?
EditorCookie.open() must not open visual editor under scenario 2. It can open text editor only. Problem is that form editor cookie implements all: OpenCookie, EditorCookie, ...
FormEditorSupport cannot choose because it extends JavaEditor implementing both OpenCookie and EditorCookie - so it has one open() method. I think it is not possible to split it (i.e. form editor provide its own OpenCookie). What do you think, Svata?
Seems that I've found a way how to not use FormEditorSupport.open() for opening the form - by registering another OpenCookie explicitly in FormDataObject (together with EditCookie). However it seems working, I'm not quite sure if I can rely on it (that this OpenCookie will be used instead of FormEditorSupport). Svata, may I ask you to overview the code? Thanks. A code snippet from FormDataObject: private void init() { ... getCookieSet().add(OpenCookie.class, this); getCookieSet().add(EditCookie.class, this); } // CookieSet.Factory implementation public Node.Cookie createCookie(Class klass) { if (OpenCookie.class.equals(klass) || EditCookie.class.equals(klass)) { if (openEdit == null) openEdit = new OpenEdit(); return openEdit; } return super.createCookie(klass); } private class OpenEdit implements OpenCookie, EditCookie { public void open() { getFormEditor().openForm(); // open java and form } public void edit() { getFormEditor().open(); // open java only } }
Done. FormDataObject.java - rev. 1.35 FormEditorSupport.java - rev. 1.102
Target milestone was changed from not determined to TBD
Verified in NB 3.5 FCS.