/** * Sets the current {@link #resourceComponent}. This triggers any updates to the UI * asynchronously. * * <p><b>Note:</b> This method should only be called when the active {@link #editor} changes, * i.e., via {@link #setActiveEditor(ICEFormEditor)}. * * @param component The new ResourceComponent, or null to unset it. This is assumed to be a new * value. */ private void setResourceComponent(ResourceComponent component) { // If necessary, clear the contents of the view and unregister from the // previous ResourceComponent. if (resourceComponent != null) { // Unregister from the old ResourceComponent. resourceComponent.unregister(this); // Clear the related UI pieces. if (resourceTreeViewer != null && !resourceTreeViewer.getControl().isDisposed()) { textList.clear(); imageList.clear(); resourceTreeViewer.refresh(); resourceTreeViewer.getTree().redraw(); } // Unset the reference to the old ResourceComponent. resourceComponent = null; } // If the new ResourceComponent is valid, update the contents of the // view and register for updates from it. if (component != null) { // Set the component reference resourceComponent = component; // Register this view with the Component to receive updates resourceComponent.register(this); // Trigger a UI update. update(resourceComponent); } return; }