[TIP] Switch from 4.1 to 5.0
By lukas on Feb 05, 2006
I answered YES, of course. The dialog doesn't appear next time when you answer NO. The NetBeans Mobility Pack started.
All my projects that I worked on in 4.1 were listed again in the Projects view. Exactly as I expected
When I look at Tools > Java Platform Manager then all my emulators platform were transfered successfully too.
When I build/run the projects then everything works too.
What changed for me? What is the difference?
I can use all the new features from Mobility Pack 5.0 right now - look at my previous post where they are listed. There are even all the new features of Netbeans 5.0, of course.
What should I be careful of?
The format of generated code changed for Visual MIDlets. It doesn't mean that you should create everything again from start. NOWAY. When you open a midlet that is in the 4.1 format then following message appears
Don't be afraid and click OK. The visual midlet opens in Flow Design and everything should look exactly the same as in 4.1. When you look at Source code you'll see the difference. The one big guarded block was splitted and you can write your code into the unguarded parts of source code. It means that you won't need any Property Editor for the pre/post code anymore. You can write it directly into the source code. If you don't know where is the right place for your code use Go to Source feature in Flow/Screen Designer. All these changes aren't saved yet. If you don't want to save your file in new format then Discard the changes. If you'll accept the changes and save the file in 5.0 format then you cannot open this visual midlet in NB 4.1 anymore!
Preprocessor block definition changed too. The old syntax works anyway so you don't have to change it to the new syntax immediatelly. You can leave it in the old syntax. There is suggestion on left sidebar that appears when you are on the line with old syntax. Look at the picture.
You can use the suggestion to change the old syntax to the new one.
Do you see the small difference? You can create new preprocessor block from context menu as you used to in 4.1. Second way how to create preprocessor block is start to type definition of preprocessor block directly into the source code. Try type
//#and code completion with available preprocessor directives appears.
When you change the active configuration then there are commented and uncommented preprocessor blocks. You maybe noticed that the prefix of inactive preprocessor block changed to
//#. The prefix was
//--in 4.1 You can be suprised that when you close the file and look at the file on your hard disc then you'll still see the old syntax. CVS diff doesn't show any change too. Why? The file is always saved in DefautConfiguration. The main reason for it is the CVS. All users save file in same configuration and therefore they are not suprised be unexpected diffs.
The new prefix will be saved only for changed or new inactive lines.
Your settings and setup should be imported into 5.0 automatically when you use the default userdirs (no --userdir command line switch).
Projects from 4.1 should work in 5.0 without any change.
Be carefull that you cannot use some code from 5.0 in 4.1 again...