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 23904 - i18n actions open form editor
Summary: i18n actions open form editor
Status: VERIFIED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 3.x
Hardware: Sun Solaris
: P2 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-05-23 13:17 UTC by Jiri Mzourek
Modified: 2004-05-20 12:13 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Mzourek 2002-05-23 13:17:05 UTC
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!
Comment 1 Tomas Pavek 2002-05-27 11:19:45 UTC
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...
Comment 2 _ pkuzel 2002-05-29 15:12:35 UTC
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.
Comment 3 _ pkuzel 2002-05-29 15:26:23 UTC
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.
Comment 4 Tomas Pavek 2002-05-29 15:58:34 UTC
I don't understand - what's the bug in form editor?
Comment 5 _ pkuzel 2002-05-29 16:17:19 UTC
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, ...
Comment 6 Tomas Pavek 2002-05-29 17:20:06 UTC
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?
Comment 7 Tomas Pavek 2002-05-30 13:10:33 UTC
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
    }
}
Comment 8 Tomas Pavek 2002-05-30 17:37:38 UTC
Done.

FormDataObject.java - rev. 1.35
FormEditorSupport.java - rev. 1.102
Comment 9 Marek Grummich 2002-07-19 16:07:34 UTC
Target milestone was changed from not determined to TBD
Comment 10 Jiri Mzourek 2003-07-08 14:35:10 UTC
Verified in NB 3.5 FCS.