Bug 303841 Model ids should not be used as resource ids
Merging can go wrong here because model ids are only unique within a given scope. java.lang.ClassCastException: org.eclipse.e4.ui.model.application.impl.CommandImpl cannot be cast to org.eclipse.e4.ui.model.application.MPerspective at org.eclipse.e4.ui.model.application.impl.PerspectiveStackImpl.eSet(PerspectiveStackImpl.java:201) at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:1081) at org.eclipse.e4.workbench.ui.internal.EMFModelDeltaSet.apply(EMFModelDeltaSet.java:31) at org.eclipse.e4.workbench.ui.internal.EMFModelDeltaDelayedSet.apply(EMFModelDeltaDelayedSet.java:44) at org.eclipse.e4.workbench.ui.internal.ModelReconcilingService.applyDeltas(ModelReconcilingService.java:53) at org.eclipse.e4.workbench.ui.internal.ModelReconcilingService.applyDeltas(ModelReconcilingService.java:35) at org.eclipse.e4.workbench.ui.internal.ResourceHandler.loadMostRecentModel(ResourceHandler.java:172)
bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/workbench/ui/internal/E4XMIResource.java
private Map<EObject, String> objectMap = new WeakHashMap<EObject, String>();
	public E4XMIResource() {
	}
	public E4XMIResource(URI uri) {
		super(uri);
	}
	public void setInternalId(EObject object, String id) {
		objectMap.put(object, id);
	}
	public String getInternalId(EObject object) {
		return objectMap.get(object);
	}
	@Override
	protected boolean useIDs() {
		return true;
	}
	private String createId() {
		return EcoreUtil.generateUUID();
	}
	private String getUniqueId() {
		String id = createId();
		while (objectMap.get(id) != null) {
			id = createId();
		}
		return id;
	}
	@Override
	public void setID(EObject eObject, String id) {
		if (id != null) {
			String internalId = objectMap.get(eObject);