org.eclipse.emf.compare.Comparison Java Examples
The following examples show how to use
org.eclipse.emf.compare.Comparison.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SCTMatchEngineFactory.java From statecharts with Eclipse Public License 1.0 | 6 votes |
@Override public Comparison match(IComparisonScope scope, Monitor monitor) { Predicate<EObject> predicate = new Predicate<EObject>() { @Override public boolean apply(EObject eobject) { // We only want to diff the SGraph and notation elements, // not the transient palceholders for concrete languages EPackage ePackage = eobject.eClass().getEPackage(); return ePackage == SGraphPackage.eINSTANCE || ePackage == NotationPackage.eINSTANCE; } }; if (scope instanceof DefaultComparisonScope) { DefaultComparisonScope defaultScope = (DefaultComparisonScope) scope; defaultScope.setEObjectContentFilter(predicate); defaultScope.setResourceContentFilter(predicate); } return super.match(scope, monitor); }
Example #2
Source File: EdgeChangePostProcessor.java From statecharts with Eclipse Public License 1.0 | 6 votes |
@Override public void postComparison(Comparison comparison, Monitor monitor) { for (Diff diff : comparison.getDifferences()) { if (diff instanceof EdgeChange) { EdgeChange edgeChange = (EdgeChange) diff; switch (edgeChange.getKind()) { case ADD: postProcessEdgeAddition(edgeChange); break; case DELETE: postProcessEdgeDeletion(edgeChange); break; default: // do nothing } } } }
Example #3
Source File: RefactorActorMappingsOperation.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask(Messages.refactoringActorMappings, IProgressMonitor.UNKNOWN); final ProcessConfigurationRepositoryStore confStore = RepositoryManager.getInstance() .getRepositoryStore(ProcessConfigurationRepositoryStore.class); final DiagramRepositoryStore diagramStore = RepositoryManager.getInstance() .getRepositoryStore(DiagramRepositoryStore.class); final Comparison comparison = compareOrganizations(); List<Configuration> configurations = getConfigurations(confStore, diagramStore); for (Configuration config : configurations) { EditingDomain editingDomain = TransactionUtil.getEditingDomain(config); if (editingDomain == null) { editingDomain = confStore.getEditingDomain(); } refactorConfiguration(config, comparison, editingDomain); if(config.eContainer() == null) { try { final Resource eResource = config.eResource(); if (eResource != null) { eResource.save(Collections.emptyMap()); } } catch (final IOException e) { BonitaStudioLog.error(e); } } } diagramStore.refresh(); }
Example #4
Source File: EdgeChangePostProcessor.java From statecharts with Eclipse Public License 1.0 | 4 votes |
@Override public void postMatch(Comparison comparison, Monitor monitor) { }
Example #5
Source File: EdgeChangePostProcessor.java From statecharts with Eclipse Public License 1.0 | 4 votes |
@Override public void postDiff(Comparison comparison, Monitor monitor) { }
Example #6
Source File: EdgeChangePostProcessor.java From statecharts with Eclipse Public License 1.0 | 4 votes |
@Override public void postRequirements(Comparison comparison, Monitor monitor) { }
Example #7
Source File: EdgeChangePostProcessor.java From statecharts with Eclipse Public License 1.0 | 4 votes |
@Override public void postEquivalences(Comparison comparison, Monitor monitor) { }
Example #8
Source File: EdgeChangePostProcessor.java From statecharts with Eclipse Public License 1.0 | 4 votes |
@Override public void postConflicts(Comparison comparison, Monitor monitor) { }
Example #9
Source File: RefactorActorMappingsOperation.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
private void refactorConfiguration(Configuration config, Comparison comparison, EditingDomain editingDomain) { final List<Diff> differences = comparison.getDifferences(); for (final Diff difference : differences) { if (difference instanceof AttributeChange) { CompoundCommand cc = new CompoundCommand("Refactoring " + config.getName()); final AttributeChange updateAttributeChange = (AttributeChange) difference; final Object oldElement = updateAttributeChange.getMatch().getRight(); final Object newElement = updateAttributeChange.getMatch().getLeft(); final EAttribute attribute = updateAttributeChange.getAttribute(); if (OrganizationPackage.Literals.GROUP__NAME.equals(attribute)) { cc.appendIfCanExecute(refactorGroup((Group) oldElement, (Group) newElement, config, editingDomain)); cc.appendIfCanExecute( refactorMembership((Group) oldElement, (Group) newElement, config, editingDomain)); } else if (OrganizationPackage.Literals.ROLE__NAME.equals(attribute)) { cc.appendIfCanExecute(refactorRole((Role) oldElement, (Role) newElement, config, editingDomain)); cc.appendIfCanExecute( refactorMembership((Role) oldElement, (Role) newElement, config, editingDomain)); } else if (OrganizationPackage.Literals.USER__USER_NAME.equals(attribute)) { cc.appendIfCanExecute( refactorUsername((User) oldElement, (User) newElement, config, editingDomain)); } else if (OrganizationPackage.Literals.MEMBERSHIP__USER_NAME.equals(attribute)) { cc.appendIfCanExecute( refactorUsername((org.bonitasoft.studio.actors.model.organization.Membership) oldElement, (org.bonitasoft.studio.actors.model.organization.Membership) newElement, config, editingDomain)); } else if (OrganizationPackage.Literals.MEMBERSHIP__GROUP_NAME.equals(attribute)) { cc.appendIfCanExecute( refactorGroup((org.bonitasoft.studio.actors.model.organization.Membership) oldElement, (org.bonitasoft.studio.actors.model.organization.Membership) newElement, config, editingDomain)); } else if (OrganizationPackage.Literals.GROUP__PARENT_PATH.equals(attribute)) { cc.appendIfCanExecute(refactorGroup((Group) oldElement, (Group) newElement, config, editingDomain)); cc.appendIfCanExecute( refactorMembership((Group) oldElement, (Group) newElement, config, editingDomain)); } else if (OrganizationPackage.Literals.MEMBERSHIP__GROUP_PARENT_PATH.equals(attribute)) { cc.appendIfCanExecute( refactorGroup((org.bonitasoft.studio.actors.model.organization.Membership) oldElement, (org.bonitasoft.studio.actors.model.organization.Membership) newElement, config, editingDomain)); } editingDomain.getCommandStack().execute(cc); cc.dispose(); } } }
Example #10
Source File: RefactorActorMappingsOperation.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
private Comparison compareOrganizations() { return EMFCompare.builder() .build() .compare(new DefaultComparisonScope(newOrganization, oldOrganization, null)); }