Board index » jbuilder » Help Needed With Browser.SetActiveNode()

Help Needed With Browser.SetActiveNode()


2004-04-21 06:45:31 AM
jbuilder16
Hello,
In my update to the Jindent addin for JBuilderX, I have found that the call I
am making to Browser.setActiveNode() within my action code seems to be
returning prior to the node "really" being visible and active. In previous
versions of JBuilder, this did not seem to be the case. It would appear that
this call is now carried out asynchronously when it was previously performed
synchronously but I am not sure.
Anyhow, is there a good way for my action code to call Browser.setActiveNode()
and "wait" until the requested node is "really" visible and active?
Thanks for any pointers or tips here.
David
Seattle
 
 

Re:Help Needed With Browser.SetActiveNode()

Try being a BrowserListener and wait for a
browserViewerActivated() event where the activated
NodeViewer is the right type for your tool.
"David White" < XXXX@XXXXX.COM >wrote in message
Hello,
In my update to the Jindent addin for JBuilderX, I have
found that the call I
am making to Browser.setActiveNode() within my action code
seems to be
returning prior to the node "really" being visible and
active. In previous
versions of JBuilder, this did not seem to be the case. It
would appear that
this call is now carried out asynchronously when it was
previously performed
synchronously but I am not sure.
Anyhow, is there a good way for my action code to call
Browser.setActiveNode()
and "wait" until the requested node is "really" visible and
active?
Thanks for any pointers or tips here.
David
Seattle
 

Re:Help Needed With Browser.SetActiveNode()

Thanks, Bill. This might work. However, it looks like the docs say the event is
not fired if the node passed in Browser.setActiveNode() is already active. Is
there a good way to trigger this event even if this is the case? I just don't
want to have to do the same thing two ways if I can help it.
David
Bill Joy wrote:
Quote
Try being a BrowserListener and wait for a
browserViewerActivated() event where the activated
NodeViewer is the right type for your tool.


"David White" < XXXX@XXXXX.COM >wrote in message
news:4085a481$ XXXX@XXXXX.COM ...
Hello,

In my update to the Jindent addin for JBuilderX, I have
found that the call I
am making to Browser.setActiveNode() within my action code
seems to be
returning prior to the node "really" being visible and
active. In previous
versions of JBuilder, this did not seem to be the case. It
would appear that
this call is now carried out asynchronously when it was
previously performed
synchronously but I am not sure.

Anyhow, is there a good way for my action code to call
Browser.setActiveNode()
and "wait" until the requested node is "really" visible and
active?

Thanks for any pointers or tips here.

David
Seattle


 

{smallsort}

Re:Help Needed With Browser.SetActiveNode()

You're right (though you could just check if the Node is
already active and invoke the event handling code yourself
if that is a possible scenario).
Or you could just call setActiveNode(), then place your
following logic so it is called from inside a
SwingUtilities.invokeLater() done next. I suspect that
would work and you would not need to add an event listener.
Note that you can get the buffer content from the Virtual
File System regardless of whether or not the file is open
(or created but never saved) or some NodeViewer other than
an Editor is active. For instance, the "Format File"
context menu action in the Project Pane re-formats the file
without regard to it being open or currently modified. If
the file is open, setting the buffer content should
automatically generate an undo buffer entry.
"David White" < XXXX@XXXXX.COM >wrote in message
Thanks, Bill. This might work. However, it looks like the
docs say the event is
not fired if the node passed in Browser.setActiveNode() is
already active. Is
there a good way to trigger this event even if this is the
case? I just don't
want to have to do the same thing two ways if I can help it.
David
Bill Joy wrote:
Quote
Try being a BrowserListener and wait for a
browserViewerActivated() event where the activated
NodeViewer is the right type for your tool.


"David White" < XXXX@XXXXX.COM >wrote in message
news:4085a481$ XXXX@XXXXX.COM ...
Hello,

In my update to the Jindent addin for JBuilderX, I have
found that the call I
am making to Browser.setActiveNode() within my action code
seems to be
returning prior to the node "really" being visible and
active. In previous
versions of JBuilder, this did not seem to be the case. It
would appear that
this call is now carried out asynchronously when it was
previously performed
synchronously but I am not sure.

Anyhow, is there a good way for my action code to call
Browser.setActiveNode()
and "wait" until the requested node is "really" visible
and
active?

Thanks for any pointers or tips here.

David
Seattle


 

Re:Help Needed With Browser.SetActiveNode()

Thanks again Bill. I took the first route and it works great! And I was trying
to set things up so Undo would work properly. The new release of my addin has
been posted.
Bill Joy wrote:
Quote
You're right (though you could just check if the Node is
already active and invoke the event handling code yourself
if that is a possible scenario).

Or you could just call setActiveNode(), then place your
following logic so it is called from inside a
SwingUtilities.invokeLater() done next. I suspect that
would work and you would not need to add an event listener.

Note that you can get the buffer content from the Virtual
File System regardless of whether or not the file is open
(or created but never saved) or some NodeViewer other than
an Editor is active. For instance, the "Format File"
context menu action in the Project Pane re-formats the file
without regard to it being open or currently modified. If
the file is open, setting the buffer content should
automatically generate an undo buffer entry.


"David White" < XXXX@XXXXX.COM >wrote in message
news:40868584$ XXXX@XXXXX.COM ...
Thanks, Bill. This might work. However, it looks like the
docs say the event is
not fired if the node passed in Browser.setActiveNode() is
already active. Is
there a good way to trigger this event even if this is the
case? I just don't
want to have to do the same thing two ways if I can help it.

David

Bill Joy wrote:


>Try being a BrowserListener and wait for a
>browserViewerActivated() event where the activated
>NodeViewer is the right type for your tool.
>
>
>"David White" < XXXX@XXXXX.COM >wrote in message
>news:4085a481$ XXXX@XXXXX.COM ...
>Hello,
>
>In my update to the Jindent addin for JBuilderX, I have
>found that the call I
>am making to Browser.setActiveNode() within my action code
>seems to be
>returning prior to the node "really" being visible and
>active. In previous
>versions of JBuilder, this did not seem to be the case. It
>would appear that
>this call is now carried out asynchronously when it was
>previously performed
>synchronously but I am not sure.
>
>Anyhow, is there a good way for my action code to call
>Browser.setActiveNode()
>and "wait" until the requested node is "really" visible

and

>active?
>
>Thanks for any pointers or tips here.
>
>David
>Seattle
>
>