tag:infinitekind.tenderapp.com,2009-01-14:/discussions/moneydance-development/2811-earliest-availability-of-getcurrentaccountbookInfinite Kind: Discussion 2020-06-11T05:32:52Ztag:infinitekind.tenderapp.com,2009-01-14:Comment/483765172020-06-02T05:05:24Z2020-06-02T05:05:25ZEarliest availability of getCurrentAccountBook()<div><p>I got a null pointer exception upon opening Moneydance. It came from my extension's <code>init()</code>, the line where I call <code>getCurrentAccountBook()</code> on the Context. This was the first time I opened Moneydance with the extension installed - I hadn't noticed it when the extension initialized upon installation because the "current account book" has been set by that point.</p>
<p>I have a workaround in the meantime, but I would like to know if there is an event that is the earliest point in time that I can expect the current account book to be available. Perhaps one of the mysterious <em>"available at a later date"</em> <code>handleEvent(String)</code> events?</p></div>Max Pixeltag:infinitekind.tenderapp.com,2009-01-14:Comment/483765172020-06-02T08:35:08Z2020-06-02T08:35:08ZEarliest availability of getCurrentAccountBook()<div><p>Hi Max,</p>
<p>You can override the handleEvent(String) method in your extension to be notified when files are opened, closed, etc:</p>
<pre>
<code> /**
* Receive notifications of application events.
*/
public void handleEvent(String appEvent) {
if (appEvent.startsWith(AppEventManager.FILE_OPENED)) {
...
}
}</code>
</pre>
<p>--<br>
Sean Reilly<br>
Developer, The Infinite Kind<br>
<a href="https://infinitekind.com">https://infinitekind.com</a></p></div>Sean Reilly