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)
tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/reconciler/E4XMIResourceFactoryTest.java
assertFalse(getId(application).equals(getId(window)));
	}
	public void testNonConflictingIds2() {
		MApplication application = createApplication();
		saveModel();
		ModelReconciler reconciler = createModelReconciler();
		reconciler.recordChanges(application);
		MWindow window1 = MApplicationFactory.eINSTANCE.createWindow();
		application.getChildren().add(window1);
		Object state = reconciler.serialize();
		application = createApplication();
		MWindow window2 = MApplicationFactory.eINSTANCE.createWindow();
		application.getChildren().add(window2);
		Collection<ModelDelta> deltas = constructDeltas(application, state);
		applyAll(deltas);
		window1 = application.getChildren().get(0);
		window2 = application.getChildren().get(1);
		String applicationId = getId(application);
		String window1Id = getId(window1);
		String window2Id = getId(window2);
		assertFalse(applicationId.equals(window1Id));
		assertFalse(applicationId.equals(window2Id));
		assertFalse(window1Id.equals(window2Id));
	}
	@Override
	protected IModelReconcilingService getModelReconcilingService() {
		return new ModelReconcilingService();
	}
}