Board index » jbuilder » How JBuilder Structure Pane is actually implemented?

How JBuilder Structure Pane is actually implemented?


2003-10-26 01:53:12 AM
jbuilder13
Hi,
Many advanced Java IDEs, such as JBuilder, show the structure pane in which
they list all members of current class, such as constructors, fields and
methods as programmer types them.
Does someone knows how it is implemented? I am trying to use reflection. It
works, but far too slow as it needs to recompile the class every time i add
new variable or method. It is obviously implemented some other way.
Any hints will be highly appreciated.
Thanks,
Vlad
 
 

Re:How JBuilder Structure Pane is actually implemented?

In order to implement something like a structure pane, you have to implement
a mini-compiler, but one that is forgiving of syntax errors while the
programmer is writing. It isn't a trivial task.
--
Check out our latest white papers at
www.datadevelopment.com/papers/index.html
BladeNET Scores With Borland Enterprise Tools
Team Development with JBuilder and Borland Enterprise Server
Dolphin Data Development Ltd.
www.datadevelopment.com/
"Vlad" < XXXX@XXXXX.COM >wrote in message
Quote
Hi,

Many advanced Java IDEs, such as JBuilder, show the structure pane in
which
they list all members of current class, such as constructors, fields and
methods as programmer types them.
Does someone knows how it is implemented? I am trying to use reflection.
It
works, but far too slow as it needs to recompile the class every time i
add
new variable or method. It is obviously implemented some other way.
Any hints will be highly appreciated.

Thanks,

Vlad


 

Re:How JBuilder Structure Pane is actually implemented?

Many thanks, I guess writing a compiler (even a mini-compiler) is a really
big project per se.
May be in my next project :)
Thanks again,
Vlad
"Kevin Dean" < XXXX@XXXXX.COM >wrote in message
Quote
In order to implement something like a structure pane, you have to
implement
a mini-compiler, but one that is forgiving of syntax errors while the
programmer is writing. It isn't a trivial task.

--
Check out our latest white papers at
www.datadevelopment.com/papers/index.html

BladeNET Scores With Borland Enterprise Tools
Team Development with JBuilder and Borland Enterprise Server

Dolphin Data Development Ltd.
www.datadevelopment.com/

"Vlad" < XXXX@XXXXX.COM >wrote in message
news:3f9ab887$ XXXX@XXXXX.COM ...
>Hi,
>
>Many advanced Java IDEs, such as JBuilder, show the structure pane in
which
>they list all members of current class, such as constructors, fields and
>methods as programmer types them.
>Does someone knows how it is implemented? I am trying to use reflection.
It
>works, but far too slow as it needs to recompile the class every time i
add
>new variable or method. It is obviously implemented some other way.
>Any hints will be highly appreciated.
>
>Thanks,
>
>Vlad
>
>


 

{smallsort}

Re:How JBuilder Structure Pane is actually implemented?

"Vlad" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
Quote
Many thanks, I guess writing a compiler (even a mini-compiler) is a really
big project per se.
May be in my next project :)

You don't need a whole compiler for this (that's somehow nonsense), instead
you need just the parser part for this task. You have here many different
choices. You can for example reuse JB's JOT API for this task, or you can
also take ANTLR or JavaCC etc. with one of their accompanied Java grammars
for this.
So if you just want to present structured code, you would just need a suited
language parser which creates some AST from the parsed in tokens together
with some occurrence tags (e.g. file, symbol, line, col) related to the
determined language tokens/symbols. - If you want more than just presenting
the code, as manipulating the parsed in code/AST in order to write later the
manipulated code back, or performing search querries etc. on the parsed in
data, an accompanied data structure for the AST in form of a symbol table or
the like would be ideal.
-vkyr
 

Re:How JBuilder Structure Pane is actually implemented?

Thanks a lot, I'll give it a try,
Vlad
"Valentino Kyriakides" < XXXX@XXXXX.COM >wrote in message
Quote

"Vlad" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
news: XXXX@XXXXX.COM ...
>Many thanks, I guess writing a compiler (even a mini-compiler) is a
really
>big project per se.
>May be in my next project :)
>

You don't need a whole compiler for this (that's somehow nonsense),
instead
you need just the parser part for this task. You have here many different
choices. You can for example reuse JB's JOT API for this task, or you can
also take ANTLR or JavaCC etc. with one of their accompanied Java grammars
for this.

So if you just want to present structured code, you would just need a
suited
language parser which creates some AST from the parsed in tokens together
with some occurrence tags (e.g. file, symbol, line, col) related to the
determined language tokens/symbols. - If you want more than just
presenting
the code, as manipulating the parsed in code/AST in order to write later
the
manipulated code back, or performing search querries etc. on the parsed in
data, an accompanied data structure for the AST in form of a symbol table
or
the like would be ideal.


-vkyr


 

Re:How JBuilder Structure Pane is actually implemented?

You're right, Valentino, my mistake. The parser part is all that's
necessary. However, it has to be quite forgiving of structural errors
during the code editing process.
--
Check out our latest white papers at
www.datadevelopment.com/papers/index.html
BladeNET Scores With Borland Enterprise Tools
Team Development with JBuilder and Borland Enterprise Server
Dolphin Data Development Ltd.
www.datadevelopment.com/
"Valentino Kyriakides" < XXXX@XXXXX.COM >wrote in message
Quote

"Vlad" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
news: XXXX@XXXXX.COM ...
>Many thanks, I guess writing a compiler (even a mini-compiler) is a
really
>big project per se.
>May be in my next project :)
>

You don't need a whole compiler for this (that's somehow nonsense),
instead
you need just the parser part for this task. You have here many different
choices. You can for example reuse JB's JOT API for this task, or you can
also take ANTLR or JavaCC etc. with one of their accompanied Java grammars
for this.

So if you just want to present structured code, you would just need a
suited
language parser which creates some AST from the parsed in tokens together
with some occurrence tags (e.g. file, symbol, line, col) related to the
determined language tokens/symbols. - If you want more than just
presenting
the code, as manipulating the parsed in code/AST in order to write later
the
manipulated code back, or performing search querries etc. on the parsed in
data, an accompanied data structure for the AST in form of a symbol table
or
the like would be ideal.


-vkyr


 

Re:How JBuilder Structure Pane is actually implemented?

"Vlad" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
Quote
Thanks a lot, I'll give it a try,

Vlad, if what you want to do is JBuilder specific (if you maybe want to
integrate your solution into JB) you can look into this OT
codecentral.borland.com/codecentral/ccweb.exe/listing
which builds an own custom structure view via the help of JBuilder's JOT
API. This OT is somehow older, but might still work (?) or at least give you
some of the needed insights.
If you instead want to build such a structure view for an own JB independent
Java app, then you can find a lot of source code examples related to this
theme on the net. For example "JRefactory", "Freefactor", "DocWiz" etc. all
do have and use such sort of structure views. Some of them use make use of
JavaCC or ANTLR etc.
-Valentino
 

Re:How JBuilder Structure Pane is actually implemented?

"Kevin Dean" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
Quote
You're right, Valentino, my mistake. The parser part is all that's
necessary. However, it has to be quite forgiving of structural errors
during the code editing process.

Yes, ideally it would also have to be so during it's parsing in process.
Meaning that instead of just throwing an exception and quitting if it parses
in something incorrect, it should mark/show up the erroneous problem
position, but also continue to parse then the underlayed data file until
it's end. So it shouldn't crash either way.
-Valentino
 

Re:How JBuilder Structure Pane is actually implemented?

Hi Valentino,
Thanks a lot for useful links, I think JRefactory will work better for me,
Vlad
"Valentino Kyriakides" < XXXX@XXXXX.COM >wrote in message
Quote

"Vlad" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
news: XXXX@XXXXX.COM ...
>Thanks a lot, I'll give it a try,
>

Vlad, if what you want to do is JBuilder specific (if you maybe want to
integrate your solution into JB) you can look into this OT

codecentral.borland.com/codecentral/ccweb.exe/listing


which builds an own custom structure view via the help of JBuilder's JOT
API. This OT is somehow older, but might still work (?) or at least give
you
some of the needed insights.

If you instead want to build such a structure view for an own JB
independent
Java app, then you can find a lot of source code examples related to this
theme on the net. For example "JRefactory", "Freefactor", "DocWiz" etc.
all
do have and use such sort of structure views. Some of them use make use of
JavaCC or ANTLR etc.

-Valentino