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 115481 - pre-action and post-action cleaned after code-generation
Summary: pre-action and post-action cleaned after code-generation
Status: VERIFIED FIXED
Alias: None
Product: javame
Classification: Unclassified
Component: Visual Designer (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: David Kaspar
URL:
Keywords:
: 116428 120013 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-09-13 17:31 UTC by windli
Modified: 2007-10-25 14:02 UTC (History)
0 users

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 windli 2007-09-13 17:31:35 UTC
1. Create mobility application in v6.0 m10 or older netbeans such as netbeans 5.5 with default setting.
2. In the last nightly build,  convert the HelloMidlet to visual designer. And some command to the form and add some
pre-action and post-action code to the command action. 
3. Make some changes to the form and save the form. 

the pre-action and post-action code will lost.
Comment 1 David Kaspar 2007-09-14 06:23:52 UTC
I was trying to reproduce it with latest development build and it works without any problem.

Here is what I was doing:
1) I have created a new HelloMidlet in NetBeans 6.0 Milestone 10
2) I have started NB 6.0 dev build, and there:
3) I have converted the HelloMidlet to a new ConvertedHelloMidlet class.
4) I have opened the new class (it opens in Flow view).
5) I have added a new "Ok Command" from palette to the "HelloForm".
6) I have switched to the Source tab. Code is automatically updated for "Ok Command" component.
7) I have added "//pre" and "//post" text to the "pre-action" and "post-action" section related to "OkCommand" in
commandAction method.
8) I have switched to the Flow view tab.
9) I have changed "HelloForm" "title" property to "myHelloForm1".
10) I have saved the file using Ctrl+S.
11) The code generated properly and the particular "user-code" is there.

I also check to set "pre-action" and "post-action" to the "ExitCommand" in the original HelloMidlet class before the
conversion. The conversion was successful and the user-code is copied there correctly.

Resolving as WorksForMe. Feel free to reopen the issue, then please, add a step-by-step how to reproduce the issue
together with original and converted files. Thanks.
Comment 2 windli 2007-09-14 07:04:50 UTC
I do more test, and I find it will not only affect the convert midlet, but affect all midlets.
The following steps will always reproduce for me:
1. Create Mobility project.
2. Open HelloMIDlet, switch to source mode and add some post action code like: //hello world
3. Save and close it.
4. Open HelloMIDlet again, double click to open the form and add a textfield to it.
5. Switch to source mode, all the post action code disappear.

Here is the info I get from the about dialog:

Product Version: NetBeans IDE Dev (Build 200709131200) 
Java: 1.5.0_10; Java HotSpot(TM) Client VM 1.5.0_10-b03 
System: Linux version 2.6.22 running on i386; UTF-8; zh_CN (nb) 
Userdir: /home/wind/.netbeans/dev
Comment 3 David Kaspar 2007-09-14 07:16:41 UTC
I have reproduce it. Thanks. I will fix it asap.
Comment 4 David Kaspar 2007-09-15 20:43:36 UTC
Fixed in main trunk. The fix is going to be visible in the tomorrow's daily build or NB 6.0 beta 2.
Workaround: when making any change in the source code (between guarded-blocks e.g. pre-action, post-action, ...), then
you have to save the file in the "Flow" or "Screen" view and additionally do some change in the model.

Please, check whether there are not any other code-generation issues - the code generation should keep all the
user-codes int the file and should be updated in case that the document is modified and an user switched to the sources
or saves the file. Thanks.
Comment 5 David Kaspar 2007-09-23 10:10:20 UTC
*** Issue 116428 has been marked as a duplicate of this issue. ***
Comment 6 David Kaspar 2007-09-25 04:22:50 UTC
Fixed on release60_beta1 branch too:

Checking in io/manifest.mf;
/cvs/mobility/designer2/io/manifest.mf,v  <--  manifest.mf
new revision: 1.3.2.1; previous revision: 1.3
done
Checking in io/src/org/netbeans/modules/vmd/io/CodeResolver.java;
/cvs/mobility/designer2/io/src/org/netbeans/modules/vmd/io/CodeResolver.java,v  <--  CodeResolver.java
new revision: 1.11.6.1; previous revision: 1.11
done
Checking in kit/nbproject/project.xml;
/cvs/mobility/designer2/kit/nbproject/project.xml,v  <--  project.xml
new revision: 1.3.2.1; previous revision: 1.3
done
Comment 7 David Kaspar 2007-09-25 04:25:57 UTC
Due to designer2/io module spec. version update on release60_beta1 branch, the spec. version was updated on the main
trunk too:

Checking in io/manifest.mf;
/cvs/mobility/designer2/io/manifest.mf,v  <--  manifest.mf
new revision: 1.4; previous revision: 1.3
done
Checking in kit/nbproject/project.xml;
/cvs/mobility/designer2/kit/nbproject/project.xml,v  <--  project.xml
new revision: 1.4; previous revision: 1.3
done
Comment 8 Lukas Hasik 2007-10-05 08:39:06 UTC
verified together with issue 116527. The fix is available in trunk daily builds or at Update Center for the 6.0 Beta1 build.
Comment 9 Lukas Hasik 2007-10-25 14:02:25 UTC
*** Issue 120013 has been marked as a duplicate of this issue. ***