[TIP] Switch from 4.1 to 5.0

I tried to switch from my NetBeans Mobility Pack 4.1 to the new 5.0 release. I'll describe what you can expect from this step. I closed my old NB 4.1 I installed the new NetBeans 5.0 and the Mobility Pack (you can download both here). When I run the NetBeans 5.0 this dialog appeared

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.


Conclusion
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...
Comments:

Can this preprocessor facility used in J2SE project?
It seemed as if there should still a few position for the C/C++ style preprocessor, in java, right?
Would you like to factor it as a netbeans module? Then it will make my life and hopefully other's lives much easier.
pprun

Posted by pprun on February 05, 2006 at 08:52 PM CET #

Why would you want preprocessor facility in J2SE? If you really need to decide on how to operate according to some system environment variable (OS type, shell type, whatever), use the Factory design pattern..

Posted by Aviad Ben Dov on February 05, 2006 at 11:33 PM CET #

2 pprun: You can use the preprocessing module in j2se right now. You can use the preprocessor syntax in source code. You'll have to modify your build.xml to preprocess the project before compilation, o course. Al the necessary ant tasks are in module [nb_install_dir]\\mobility7.2\\modules\\org-netbeans-modules-kjava-antext.jar Look at build.xml of mobility project for info how to use the tasks.
Don't expect the nice integration with editor only the main preprocesor functionality

Let me know if you were able to get it work ;)

I almost forgot to answer: AFAIK, there aren't any plans to integrate the preprocessor with j2se project. The big question is WHY? The preprocessor is must for Java ME but why to use it for j2se?

Posted by Lukas on February 06, 2006 at 12:47 AM CET #

this is a great blog entry. timely and useful.

Posted by vince kraemer on February 06, 2006 at 11:46 AM CET #

Post a Comment:
Comments are closed for this entry.
About

This is the main channel to share news, tips and other stuff related to my work. Sometimes you can find even personal stuff. Enjoy your reading...

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
news
Blogroll

No bookmarks in folder

OldNews
MyTrash
NavBar
NetBeans
LinksToBeExpanded