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 132887 - Automatic Re-Comment
Summary: Automatic Re-Comment
Status: NEW
Alias: None
Product: javame
Classification: Unclassified
Component: Fragmentation (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: Karol Harezlak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-15 14:17 UTC by Petr Dvorak
Modified: 2008-05-06 11:43 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Dvorak 2008-04-15 14:17:02 UTC
Preprocessor re-comment could be automatic. How it might be done so that it is not a performance issue:

1. Make an option "Automatic preprocessor re-comment" in the editor options so that a user can turn this function off
2. Whenever a user types in the preprocessor part in the code, a timer is set to execute the re-comment action in some
3-5 seconds. This timer is reset whenever a user types a key in the code for preprocessor. After the timer action
triggers, the re-commenting is executed on the background.
Comment 1 Vitezslav Stejskal 2008-04-21 12:04:17 UTC
I'm sorry, but what is 'preprocessor re-comment'? What file types are you talking about? What user action would you like
to automate? Please be more specific about how the feature should work from the user's point of view. Thanks
Comment 2 Petr Dvorak 2008-04-21 12:53:39 UTC
Sorry for the brief description, I will give more elaborate one.

If you create a new mobility project (MIDP Application), you can use a preprocessor to build your application on various
platforms. For example - if you write:

//#if CLDC
System.out.print("CLDC present");
class A {
// CLDC specific implementation of some class
}
//#else
System.out.print("CLDC not present");
class A {
// universal implementation of some class
}
//#endif

the right code is included in the build according to the presence of CLDC platform.

Java preprocessor used in NB is based on commenting-out the code. If you have the code above, error badges are usually
displayed in the editor, as class A is redefined in the code. However, the build works fine (classes are in different
preprocessor blocks), you can build the code above...

If you don't like the fact you can see the errors in the editor (while the code is correct), you can invoke a popup menu
on the editor and choose "Preprocessor blocks > re-comment". This can result in following code, for example:

//#if CLDC
System.out.print("CLDC present");
class A {
}
//#else
//# System.out.print("CLDC not present");
//# class A {
//# }
//#endif

In other words, the code that is irrelevant with respect to the current settings is commented out.

I think the action from the popup menu mustn't be necessary - you see the errors in the correct code until you ask the
editor to hide it - this is not very logical, imho.

The code should be "re-commented" automatically, after a user closes a preprocessor block, for example, or after a few
seconds after user typed in the preprocessors code...

It would be best if the code was not commented out in the editor (it could be physically commented out in the file) but
if it was just grayed. I will provide you a how-it-might-look-screenshot from other IDE (which is not for Java, but it
is irrelevant)...
Comment 3 Vitezslav Stejskal 2008-04-21 14:33:02 UTC
Thanks for this nice description. I think it's pretty clear how the feature should look like from users point of view.
I'm not sure how much of this can be implemented in mobility editor and how much support they will need from the java
infrastructure. But since this feature primarily concerns mobility apps support I'm reassigning it to them. I'm sure
they will ask for specific support from java infra if they need some.
Comment 4 Petr Dvorak 2008-04-21 15:23:12 UTC
... just a note... the "System.out.println" should not have been in the sample code, of course (this code does not make
sense)...
Comment 5 Petr Dvorak 2008-05-05 15:53:36 UTC
See also enhancement proposal here:

http://qa.netbeans.org/issues/show_bug.cgi?id=83096

This is a screenshot/footage I made to demonstrate how nicely it could look:o):

http://www.netbeans.org/nonav/issues/showattachment.cgi/61048/before_and_after.png