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 129000 - "Cannot apply changes due to guarded block" message in the situation it should not happen
Summary: "Cannot apply changes due to guarded block" message in the situation it shoul...
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Jan Pokorsky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-03 13:15 UTC by Petr Dvorak
Modified: 2009-11-02 10:59 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 Petr Dvorak 2008-03-03 13:15:51 UTC
Product Version: NetBeans IDE Dev (Build 200803021202)
Java: 1.6.0_04; Java HotSpot(TM) Client VM 10.0-b19
System: Linux version 2.6.22-14-generic running on i386; UTF-8; en_US (nb)

The issue is concerning the generated code.

Create a new MIDP project (empty), insert a new WaitScreen in the Flow designer and go to the Screen designer. There is
a task resource called "task" in the Resource panel (it is the task which is by default associated with the WaitScreen).
Right-click the "task" resource in the Resources panel, select "Go to source" from the pop-up menu. A source code appears.

There is a set of "guarded blocks" (the code that cannot be modified by directly typing into it). Right-click this code
(for example: right click the word "setExecutable" in the line: "task.setExecutable(new
org.netbeans.microedition.util.Executable() {" ... and select "Insert code" from the popup menu. Then choose for example
Constructor, check for example the exitCommand in the pop-up window and confirm your choice. A code:

>>  public HelloMIDlet(Command exitCommand) {
>>      this.exitCommand = exitCommand;
>>  }
>>  //</editor-fold>

... appears right bellow the method "getTask()" in the source. Note, that there is only "//</editor-fold>" tag, which is
probably a mistake by itself (missing an opening tag).

Now, manually delete generated code (the one above), save the file (Ctrl+S) and close the MIDlet file. Reopen the file
in the "Projects" window and go back to the source file (*.java).

Scroll down bellow the method "getTask" (it is probably just collapsed block described as "Generated Getter: task"). Go
JUST bellow the "getTask" method (to the first place in the code where you can normaly write a code after the block
"Generated Getter: task"), right-click there and try to insert a code again.

The action will fail with the message "Cannot apply changes due to guarded block". You cannot generate a code here in
spite of the fact it should be possible.

It almost seems that the steps described in the beginning (trying to insert a code into a guarded block) somehow
invalidates the integrity of guarded blocks...
Comment 1 Karol Harezlak 2008-07-23 13:18:25 UTC
It looks like you can break guarded blocks by using insert option inside guarded block. Most likely this issue should be
P2. Reassigning to Editor team.
Comment 2 Jan Pokorsky 2009-03-18 19:13:02 UTC
Is it still reproducible with the latest build? There has been added some fixes to GuardedDocument to allow to insert
code around guarded sections AFAIK.

Otherwise I would appreciate some unit test case that would demonstrate the problem as I am not familiar with source
code of MIDP projects.
Comment 3 David Strupl 2009-03-31 15:55:35 UTC
Resolving all issues with milestone "future" as LATER. If you feel strongly that
it should be implemented please reopen and set the target milestone to "next".
Comment 4 Quality Engineering 2009-11-02 10:59:16 UTC
NetBeans.org Migration: changing resolution from LATER to WONTFIX