Bug 315468 [UI] Using the MContribution's 'persistedState' field causes a CCE when trying to publish the event
The code in UIEventPublisher expects to be publishing events for MApplicationElements but the 'persistedState' field is defined as an EMF type that is not (the cause of the CCE). As an interim fix I'll only attempt to publish UI events for MApplicationElements. The only downside to this would be if someone needed to listen to changes in that field; extremely unlikely IMO...the person *setting* the field shouldn't need to listen and why the heck would (or even should) anyone else be trying to listen in?
bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/workbench/ui/internal/UIEventPublisher.java
/*******************************************************************************
 * Copyright (c) 2009 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.e4.workbench.ui.internal;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.e4.ui.model.application.MApplicationElement;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.workbench.ui.UIEvents;
import org.eclipse.e4.workbench.ui.UIEvents.EventTags;
import org.eclipse.e4.workbench.ui.UIEvents.EventTypes;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.util.EContentAdapter;
/**
 * Transforms E4 MPart events into 3.x legacy events.
 */
public class UIEventPublisher extends EContentAdapter {