[ 
https://issues.apache.org/jira/browse/DIRSTUDIO-1046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14565917#comment-14565917
 ] 

Stefan Seelmann commented on DIRSTUDIO-1046:
--------------------------------------------

Hi Paul,

if you don't need the change then I'd prefer to no apply it. The 
EntryEditorManager code is already big and comlex enough and I'd like to avoid 
to add additional executor inner classes.

The ldapbrowser.ui plugin is the one that defines the LDAP perspective with 
views and editors. The activation of the plugin and hence creation of 
EntryEditorManager is done in main UI thread, so everything should work. I'd 
not recommend to only use parts of the plugin, I'd rather suggest to move 
reusable parts to ldapbrowser.common or another new plugin. 

In fact we created the ldapbrowser.common plugin to be able to use the 
BrowserWidget (e.g. via DnDialog or SelectEntryDialog) from other plugins 
(ldifeditor, apacheds.configuration, openldap.config) without dependency to the 
larger ldapbrowser.ui plugin.

Still many thanks for your report, it's nice to see that Studio plugins are 
reused in other products, looking forward to hear from you :)


> EntryEditorManager constructor can throw NPE
> --------------------------------------------
>
>                 Key: DIRSTUDIO-1046
>                 URL: https://issues.apache.org/jira/browse/DIRSTUDIO-1046
>             Project: Directory Studio
>          Issue Type: Bug
>          Components: studio-ldapbrowser
>    Affects Versions: 2.0.0-M8 (2.0.0.v20130628)
>            Reporter: Paul Richardson
>         Attachments: 
> replace-active-workbench-calls-in-EntryEditorManager-v2.diff, 
> replace-active-workbench-calls-in-EntryEditorManager.diff
>
>
> Using the BrowserWidget in a wizard rather than the BrowserView can result in 
> a NullPointerException being thrown.
> The BrowseWidget is embedded in a WizardPage so the 
> org.apache.directory.ldapbrowser.ui plugin has not necessarily been 
> activated. However, during a refresh of the BrowserWidget's tree view, a 
> worker-runnable calls on resources of the ldapbrowser.ui plugin and it is 
> activated.
> The activation of the ldapbrowser.ui plugin calls
> {code}
> entryEditorManager = new EntryEditorManager();
> {code}
> The constructor of the EntryEditorManager contains
> {code}
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().addPartListener(
>  partListener );
> {code}
> This code only works if called from the UI thread. Otherwise, 
> getActiveWorkbenchWindow() returns null hence the NPE.
> Since a runnable is responsible for the plugin activation in this use-case 
> then this behaviour occurs.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to