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 153574 - Improve usability of guard blocks
Summary: Improve usability of guard blocks
Status: NEW
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@ide
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-20 19:13 UTC by _ gtzabari
Modified: 2009-02-19 20:49 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 _ gtzabari 2008-11-20 19:13:35 UTC
1) We should be able to edit guard-blocks directly in the editor, as opposed to going through Customize Code. You could
do something like this:

<-- users can edit here
// creation code start <-- make this comment a guarded block
<-- users can edit here
// creation code end <-- make this comment a guarded block
<-- users can edit here

2) Ideally do away with guard blocks altogether, or as much as possible. For example, instead of "JTable -> properties
-> model -> custom code" I'd be able to simply invoke setModel() on the variable. Netbeans would scan the
initComponents() code and do its best to recognize what value is passed into setModel(). If it doesn't recognize any
code pattern it generates itself it will simply display it as "<user code>" in the properties tab as it already does.
Maybe it can mark up code it generated itself using proprietary comments as it currently does for guard-blocks.

Maybe it isn't possible to do this for everything, but we should discuss this and do away with as many guard blocks as
possible.
Comment 1 _ gtzabari 2008-11-20 19:43:21 UTC
I notice that when I create event-listeners the form editor creates method prototypes for me and lets me fill in the
contents.

3) How about doing the same thing for Swing properties? For example:

JTable myVariableName = ...;
myVariableName.setModel(getMyVariableNameModel());
[...]

private TableModel getMyVariableNameModel() { // protected block 
  // user inserts code here
} // protected block

or group related properties up as follows:

private static class MyVariableName // protected block
{ // protected block
  public TableModel getModel() { // protected block
    // user fills this in
  } // protected block

  public Color getBackgroundColor() { // protected block
    // user fills this in
  } // protected block
} // protected block

I still prefer #2 though.
Comment 2 Petr Dvorak 2008-11-25 11:26:19 UTC
This has actually been discussed long time ago (see "two-way editing"): http://form.netbeans.org/doc/IssuesAndToDo.html

We are certainly planning to make this work better, but I can't tell when it is going to happen...