Source:
<code>public void updateDetailPanel(final boolean setFocusToDetail) { final Object selectedObject = treeViewer.getSelection() != null ? ((StructuredSelection) treeViewer .getSelection()).getFirstElement() : null; if (selectedObject instanceof EObject) { lastRenderedObject = selectedObject; final EObject eObject = EObject.class.cast(selectedObject); if (renderedView != null && !renderedView.getSWTControl().isDisposed()) { renderedView.getSWTControl().setParent(limbo); cache.cache(renderedView); } createDetailPanel(); if (cache.isChached(eObject)) { renderedView = cache.getCachedView(eObject); renderedView.getSWTControl().setParent(detailPanel); detailPanel.layout(); renderedView.getViewModelContext().changeDomainModel(eObject); } else { <START> viewModelPropertiesUpdateCallback.updateViewModelProperties(context); <END> final VView view = ViewProviderHelper.getView((EObject) selectedObject, context); if (view.getChildren().size() > 0 && view.getChildren().get(0) instanceof VTreeMasterDetail) { final VTreeMasterDetail vTreeMasterDetail = (VTreeMasterDetail) view.getChildren().get(0); try { renderedView = ECPSWTViewRenderer.INSTANCE.render(detailPanel, (EObject) selectedObject, vTreeMasterDetail.getDetailView()); detailPanel.layout(true, true); } catch (final ECPRendererException e) { } } else { final Label label = new Label(detailPanel, SWT.NONE); label.setText("loading..."); GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).grab(true, true).applyTo(label); detailPanel.layout(true, true); Display.getDefault().asyncExec(new UpdateDetailRunnable(setFocusToDetail, eObject, label)); } if (ScrolledComposite.class.isInstance(detailComposite)) { ScrolledComposite.class.cast(detailComposite) .setMinSize(detailPanel.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } } } else { renderEmptyDetailPanel(); } }</code><technical_language>Potential NPE, callback null</technical_language>

Target:
public void updateDetailPanel(final boolean setFocusToDetail) { final Object selectedObject = treeViewer.getSelection() != null ? ((StructuredSelection) treeViewer .getSelection()).getFirstElement() : null; if (selectedObject instanceof EObject) { lastRenderedObject = selectedObject; final EObject eObject = EObject.class.cast(selectedObject); if (renderedView != null && !renderedView.getSWTControl().isDisposed()) { renderedView.getSWTControl().setParent(limbo); cache.cache(renderedView); } createDetailPanel(); if (cache.isChached(eObject)) { renderedView = cache.getCachedView(eObject); renderedView.getSWTControl().setParent(detailPanel); detailPanel.layout(); renderedView.getViewModelContext().changeDomainModel(eObject); } else { if (viewModelPropertiesUpdateCallback != null) { viewModelPropertiesUpdateCallback.updateViewModelProperties(context); } final VView view = ViewProviderHelper.getView((EObject) selectedObject, context); if (view.getChildren().size() > 0 && view.getChildren().get(0) instanceof VTreeMasterDetail) { final VTreeMasterDetail vTreeMasterDetail = (VTreeMasterDetail) view.getChildren().get(0); try { renderedView = ECPSWTViewRenderer.INSTANCE.render(detailPanel, (EObject) selectedObject, vTreeMasterDetail.getDetailView()); detailPanel.layout(true, true); } catch (final ECPRendererException e) { } } else { final Label label = new Label(detailPanel, SWT.NONE); label.setText("loading..."); GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).grab(true, true).applyTo(label); detailPanel.layout(true, true); Display.getDefault().asyncExec(new UpdateDetailRunnable(setFocusToDetail, eObject, label)); } if (ScrolledComposite.class.isInstance(detailComposite)) { ScrolledComposite.class.cast(detailComposite) .setMinSize(detailPanel.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } } } else { renderEmptyDetailPanel(); } }