NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
Andreas Stefik Posted via mailing list.
|
Posted: Wed Aug 25, 2010 9:43 pm Post subject: [platform-dev] Re: Understanding the NetBeans Debugger Architecture |
|
|
Thanks, Ivan, that helps,
With this particular architecture, are there any do's/don't's, related
to efficiency that I should be aware of? For example, in our
architecture, we can potentially be generating very large numbers of
nodes, as our debugger stores variable history in addition to current
values. Is there anything special we need to do to handle large
numbers of nodes, as there is, so far as I understand it, with the
nodes architecture?
Stefik
On Wed, Aug 25, 2010 at 3:27 PM, Ivan Soleimanipour
<address-removed> wrote:
| Quote: | On 08/25/10 07:25, Andreas Stefik wrote:
| Quote: |
However, what I can't quite figure out is how these registrations get
used, or how they ultimately get hooked into the actual Locals window
(or other windows, similarly). For example, when I start my debugger,
the locals window appears, but I'm assuming I somehow need to either
pass it a node, or otherwise provide a view, which includes a node,
that can be displayed, although I'm not quite sure how to do that in
this case.
|
The modelview package doesn't work with Nodes but rather with arbitrary
objects of debuggers choice. (It does use Nodes internally but that's not
relevant to the API).
The modelview package is also a pull architecture and the main pull begins
in TreeModel.getRoot(). You pass your own object back. In the case
of locals it will be a dummy singleton, or maybe a per-session dummy
object. Let's call it MyLocalsModel.ROOT.
Then TreeModel.getChildrenCount() and getChildren() will be called
with MyLocalsModel.ROOT as an argument and you can return an array
of your Local (or Variable) objects. Then various other
callbacks will get called to populate the columns, icons etc of
each of these objects. Other callbacks ask questions regarding whether
each object has more children. That enables full trees to be built.
| Quote: | Can anyone more familiar with this architecture than I offer some clues?
Stefik
|
|
|
|
| Back to top |
|
 |
Ivan Soleimanipour Posted via mailing list.
|
Posted: Wed Aug 25, 2010 10:22 pm Post subject: [platform-dev] Re: Understanding the NetBeans Debugger Architecture |
|
|
On 08/25/10 14:36, Andreas Stefik wrote:
| Quote: | Thanks, Ivan, that helps,
With this particular architecture, are there any do's/don't's, related
to efficiency that I should be aware of?
|
Two areas I'm aware of but unfortunately don't have good solutions.
- To force a pull one needs to trigger it. Triggering is done through
ModelListener.modelChanged() and there are a variety of events. You have to
be careful how many of these you fire to reduce the number of pulls.
- You might notice that there is a TreeModel.getChildrenCount() and that
getChildren() asks for a window. However my understanding is that
getChildren() always asks for the whole window. I don't know the
history of why this is so.
I don't know how well viewmodel will scale with very large numbers of nodes.
It has to in-effect reconstruct or re-edit it's internal Node representation
to match the Object's it's modelling.
But you need not use the viewmodel package. One can create other
TopComponents which display things using regular Nodes. Scalability
of regular Nodes has been discussed before but unfortunately I never
payed attention to it. The DevFAQ doesn't seem to mention scalability:
http://wiki.netbeans.org/NetBeansDeveloperFAQ#Nodes_and_Explorer
but check in case I missed something.
| Quote: | For example, in our
architecture, we can potentially be generating very large numbers of
nodes, as our debugger stores variable history in addition to current
values. Is there anything special we need to do to handle large
numbers of nodes, as there is, so far as I understand it, with the
nodes architecture?
|
|
|
| Back to top |
|
 |
Andreas Stefik Posted via mailing list.
|
Posted: Thu Aug 26, 2010 5:07 pm Post subject: [platform-dev] Re: Understanding the NetBeans Debugger Architecture |
|
|
Hi again, and thanks for putting up with my questions!
I have a basic implementation limping along pretty well now. One thing
I've noticed is that in the function:
public Object getValueAt(Object node, String columnID) throws
UnknownTypeException {
which comes from org.netbeans.spi.viewmodel.TableModel
that it always asks you for the following two columns: LocalsType and LocalsType
It's pretty obvious what those do, but I have two questions:
1. I would like to add an additional column in my debugger, that will
get fired as it is evaluating the table. Assuming (perhaps
incorrectly) that this is possible, would I do this through some kind
of layer registration?
2. Where are these values defined and passed from? I've dug through
the call stack pretty carefully, but haven't seen a variable
definition, which leads me to speculate that these are, perhaps,
defined in xml somewhere. I'm guessing though ...
Stefik
On Wed, Aug 25, 2010 at 5:13 PM, Ivan Soleimanipour
<address-removed> wrote:
| Quote: | On 08/25/10 14:36, Andreas Stefik wrote:
| Quote: |
Thanks, Ivan, that helps,
With this particular architecture, are there any do's/don't's, related
to efficiency that I should be aware of?
|
Two areas I'm aware of but unfortunately don't have good solutions.
- To force a pull one needs to trigger it. Triggering is done through
|
|
| Back to top |
|
 |
Ivan Soleimanipour Posted via mailing list.
|
Posted: Thu Aug 26, 2010 7:51 pm Post subject: [platform-dev] Re: Understanding the NetBeans Debugger Architecture |
|
|
On 08/26/10 09:33, Andreas Stefik wrote:
| Quote: | Hi again, and thanks for putting up with my questions!
I have a basic implementation limping along pretty well now. One thing
I've noticed is that in the function:
public Object getValueAt(Object node, String columnID) throws
UnknownTypeException {
which comes from org.netbeans.spi.viewmodel.TableModel
that it always asks you for the following two columns: LocalsType and LocalsType
|
And you're not concerned that it asks for the same column twice?
| Quote: | It's pretty obvious what those do, but I have two questions:
1. I would like to add an additional column in my debugger, that will
get fired as it is evaluating the table. Assuming (perhaps
incorrectly) that this is possible, would I do this through some kind
of layer registration?
|
To "add a column" you do layer registration.
You need to extend org.netbeans.spi.viewmodel.ColumnModel and then register
your classes in the in
META-INF/debugger/<yourengine>/LocalsView/org.netbeans.spi.viewmodel.ColumnModel
Your ColumnModel extension will provide the columnID's that get passed via getValueAt().
As for "get fired as it is evaluating the table" ... I'm not sure exactly what you mean.
It's a reasonably standard ModelView architecture, so getValueAt's will get called
when the view needs to be refreshed. To trigger it to be refreshed you need to use
ModelListener.modelChanged().
| Quote: |
2. Where are these values defined and passed from? I've dug through
the call stack pretty carefully, but haven't seen a variable
definition, which leads me to speculate that these are, perhaps,
defined in xml somewhere. I'm guessing though ...
|
"these values"? You mean the columnID's or what getValue() returns?
| Quote: |
Stefik
On Wed, Aug 25, 2010 at 5:13 PM, Ivan Soleimanipour
<address-removed> wrote: |
|
|
| Back to top |
|
 |
Andreas Stefik Posted via mailing list.
|
Posted: Thu Aug 26, 2010 8:41 pm Post subject: [platform-dev] Re: Understanding the NetBeans Debugger Architecture |
|
|
Hey Ivan,
| Quote: | | Quote: | that it always asks you for the following two columns: LocalsType and
LocalsType
|
And you're not concerned that it asks for the same column twice?
|
Woops, I meant to say LocalsType and LocalsValue
| Quote: |
| Quote: | It's pretty obvious what those do, but I have two questions:
1. I would like to add an additional column in my debugger, that will
get fired as it is evaluating the table. Assuming (perhaps
incorrectly) that this is possible, would I do this through some kind
of layer registration?
|
To "add a column" you do layer registration.
You need to extend org.netbeans.spi.viewmodel.ColumnModel and then register
your classes in the in
META-INF/debugger/<yourengine>/LocalsView/org.netbeans.spi.viewmodel.ColumnModel
Your ColumnModel extension will provide the columnID's that get passed via
getValueAt().
|
Great, thanks, this helps.
| Quote: |
As for "get fired as it is evaluating the table" ... I'm not sure exactly
what you mean.
It's a reasonably standard ModelView architecture, so getValueAt's will get
called
when the view needs to be refreshed. To trigger it to be refreshed you need
to use
ModelListener.modelChanged().
|
What I was trying to ask is, will the layer registration ensure that
values for these columns are automatically requested from my
implementation. In other words, I was trying to determine if public
Object getValueAt(Object node, String columnID) would automatically be
called for any custom columns I define. You've already answered how to
add columns though, so I'll just try it and ask again if I get stuck.
Sounds like it should work fine.
| Quote: | | Quote: |
2. Where are these values defined and passed from? I've dug through
the call stack pretty carefully, but haven't seen a variable
definition, which leads me to speculate that these are, perhaps,
defined in xml somewhere. I'm guessing though ...
|
"these values"? You mean the columnID's or what getValue() returns?
|
Sorry, I meant the string values for the columnID's. Basically, I was
just hoping to reuse the constants (e.g., LocalsType, LocalsValue) (if
they are defined somewhere), so that I don't have to change my
implementation if something changes internally.
Thanks for your help, this has really helped my understanding of the
architecture,
Stefik |
|
| Back to top |
|
 |
Ivan Soleimanipour Posted via mailing list.
|
Posted: Thu Aug 26, 2010 9:04 pm Post subject: [platform-dev] Re: Understanding the NetBeans Debugger Architecture |
|
|
On 08/26/10 13:41, Andreas Stefik wrote:
| Quote: | | Quote: | As for "get fired as it is evaluating the table" ... I'm not sure exactly
what you mean.
It's a reasonably standard ModelView architecture, so getValueAt's will get
called
when the view needs to be refreshed. To trigger it to be refreshed you need
to use
ModelListener.modelChanged().
|
What I was trying to ask is, will the layer registration ensure that
values for these columns are automatically requested from my
implementation. In other words, I was trying to determine if public
Object getValueAt(Object node, String columnID) would automatically be
called for any custom columns I define.
|
In general yes. At any given time there might be several ColumnModel's
or any of the other Models registered in the layers. Which one gets lookup'ed
depends on a tree of ContextProvider's that correspond to the directories
in the layers. I myself am eternally confused about the precedences
of layers. (There are things called filters on modelview that allow
you to enhance as opposed to override a window but the wise will stay
away until they have bare bones working .
| Quote: | | Quote: | | Quote: | Where are these values defined and passed from? I've dug through
the call stack pretty carefully, but haven't seen a variable
definition, which leads me to speculate that these are, perhaps,
defined in xml somewhere. I'm guessing though ...
| "these values"? You mean the columnID's or what getValue() returns?
|
Sorry, I meant the string values for the columnID's. Basically, I was
just hoping to reuse the constants (e.g., LocalsType, LocalsValue) (if
they are defined somewhere), so that I don't have to change my
implementation if something changes internally.
|
Ah! The id's for the existing columns.
Try org.netbeans.spi.debugger.ui.Constants
| Quote: |
Thanks for your help, this has really helped my understanding of the
architecture,
|
I wish I had time to write a tutorial ... |
|
| Back to top |
|
 |
Andreas Stefik Posted via mailing list.
|
Posted: Fri Aug 27, 2010 5:16 pm Post subject: [platform-dev] Re: Understanding the NetBeans Debugger Architecture |
|
|
Ivan,
Great, this is really helpful (again). I must say, I also wish I had
time to write up a tutorial on the debugger system (I'm a very busy
university professor) as well, as it is probably one of the least
documented features. I've spent many hours reading source in the
python/ant/other debuggers trying to figure out how the different
components are linked together. Besides the documentation, though, the
actual code you have to write for the debugger system is pretty easy.
I have found writing much of the way you grab info from your debugger,
to be massively simpler than writing your own top component and the
nodes architecture to do the same thing (which my team and I did
previously, but are now replacing). So yaa, I second the desire for
such a tutorial to be written. Maybe I'll have time in the next month
or so, we'll see.
Stefik
On Thu, Aug 26, 2010 at 4:03 PM, Ivan Soleimanipour
<address-removed> wrote:
| Quote: | On 08/26/10 13:41, Andreas Stefik wrote:
| Quote: | | Quote: | As for "get fired as it is evaluating the table" ... I'm not sure exactly
what you mean.
It's a reasonably standard ModelView architecture, so getValueAt's will
get
called
when the view needs to be refreshed. To trigger it to be refreshed you
need
to use
ModelListener.modelChanged().
|
What I was trying to ask is, will the layer registration ensure that
values for these columns are automatically requested from my
implementation. In other words, I was trying to determine if public
Object getValueAt(Object node, String columnID) would automatically be
called for any custom columns I define.
|
In general yes. At any given time there might be several ColumnModel's
or any of the other Models registered in the layers. Which one gets
lookup'ed
depends on a tree of ContextProvider's that correspond to the directories
in the layers. I myself am eternally confused about the precedences
of layers. (There are things called filters on modelview that allow
you to enhance as opposed to override a window but the wise will stay
away until they have bare bones working .
| Quote: | | Quote: | | Quote: | Where are these values defined and passed from? I've dug through
the call stack pretty carefully, but haven't seen a variable
definition, which leads me to speculate that these are, perhaps,
defined in xml somewhere. I'm guessing though ...
|
"these values"? You mean the columnID's or what getValue() returns?
|
Sorry, I meant the string values for the columnID's. Basically, I was
just hoping to reuse the constants (e.g., LocalsType, LocalsValue) (if
they are defined somewhere), so that I don't have to change my
implementation if something changes internally.
|
Ah! The id's for the existing columns.
Try org.netbeans.spi.debugger.ui.Constants
| Quote: |
Thanks for your help, this has really helped my understanding of the
architecture,
|
I wish I had time to write a tutorial ...
|
|
|
| Back to top |
|
 |
Ivan Soleimanipour Posted via mailing list.
|
Posted: Sat Aug 28, 2010 5:39 pm Post subject: [platform-dev] Re: Understanding the NetBeans Debugger Architecture |
|
|
On 08/27/10 07:50, Andreas Stefik wrote:
| Quote: | Besides the documentation, though, the
actual code you have to write for the debugger system is pretty easy.
I have found writing much of the way you grab info from your debugger,
to be massively simpler than writing your own top component and the
nodes architecture
|
This is why everytime I see some-one ask "How to program Nodes"
I want to answer "Don't! use modelview" I have answered this way
on occasion but Nodes are such a big part of NB I feel like I'm
being a heretic :-)
| Quote: | to do the same thing (which my team and I did
previously, but are now replacing). So yaa, I second the desire for
such a tutorial to be written. Maybe I'll have time in the next month
or so, we'll see.
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|
|