[
https://issues.apache.org/jira/browse/DIRSTUDIO-1046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14550084#comment-14550084
]
Paul Richardson commented on DIRSTUDIO-1046:
--------------------------------------------
The wizard dialog is displayed in its own modal shell hence lacks an active
workbrnch window.
You can get the eorkbench window using
PlatformUI.getWorkbench().getWorkbenchWindows() if appropriate. However, given
the EntryEditorManager relates to Parts and Editors, it may be better to start
the plugin, check if active workbench and only then init the EditorManager. If
not leave the manager uninited until getEditorManager is called by a thread
with an active workbench.
> 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
>
> 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)