Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. Resource res = new ResourceSetImpl().getResource(
  2.         URI.createURI(Urls.URL_Model), true);
  3. WorldCupForecastQuery worldCupOnlineScores = new WorldCupForecastQuery(
  4.         (WorldCupForecast) res.getContents().get(0));
  5.  
  6. EObject currentPlayer = selectedDay.eContainer();
  7. Player bestPlayer = worldCupOnlineScores.getBestPlayer();
  8.  
  9.  
  10. /* prepare the options */
  11. Map<String, Object> options = new HashMap<String, Object>();
  12. options.put(MatchOptions.OPTION_IGNORE_XMI_ID, Boolean.TRUE);
  13. options.put(MatchOptions.OPTION_IGNORE_ID, Boolean.TRUE);
  14.  
  15. /* match both versions of the models */
  16. MatchModel match = new ForeCastMatcher().contentMatch(bestPlayer,
  17.         currentPlayer, options);
  18.  
  19. /* build a delta from this match */
  20. DiffModel diff = DiffService.doDiff(match);
  21.  
  22. /* prepare the ui content */
  23. ComparisonResourceSnapshot snapshot = DiffFactory.eINSTANCE
  24.         .createComparisonResourceSnapshot();
  25. snapshot.setDiff(diff);
  26. snapshot.setMatch(match);
  27.  
  28. /* open the ui */
  29. CompareUI.openCompareEditor(new ModelCompareEditorInput(
  30.         (ComparisonSnapshot) snapshot));