Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » Post processing matches breaks navigation to differences(If I remove levels of Matches in postprocessing, navigation is broken)
Post processing matches breaks navigation to differences [message #1386082] Fri, 13 June 2014 11:22
Mattias Backman is currently offline Mattias BackmanFriend
Messages: 4
Registered: June 2014
Location: Sweden
Junior Member
Hi,

This topic is very much related to my other question, https://www.eclipse.org/forums/index.php/t/781759/, in case you wonder about the similarities.

I have written a post processor to remove some container objects from the tree of matches. It is successful in that in the top window I can see the model without the unwanted levels.

The problem is that doing so breaks the behavior of the bottom window. Double-clicking on a diff in the top window no longer scrolls to that diff in the bottom window.

Also, in the bottom window the entire model tree is displayed, disregarding the changes that are in effect in the top window.

Is there something more I need to process to get the same view in the bottom as well as keeping the navigation intact?

		class CustomPostProcessor implements IPostProcessor {

			@Override
			public void postMatch(Comparison comparison, Monitor monitor) {
				EList<Match> matches = comparison.getMatches();

				EList<Match> processedMatches = removeListElements(matches);
				matches.clear();
				matches.addAll(processedMatches);
			}

			private EList<Match> removeListElements(EList<Match> originalMatches) {
				EList<Match> newMatches = new BasicEList<Match>();
				for (Match m : originalMatches) {

					if (m.getLeft() instanceof DomainRTVariableSetupList || m.getRight() instanceof DomainRTVariableSetupList) {
						newMatches.addAll(removeListElements(m.getSubmatches()));
						break;
					}
				
					EList<Match> submatches = m.getSubmatches();
					if (!submatches.isEmpty()) {
						EList<Match> originalSubmatches = m.getSubmatches();
						EList<Match> newSubmatches = removeListElements(originalSubmatches);
						originalSubmatches.clear();
						originalSubmatches.addAll(newSubmatches);
					}
					newMatches.add(m);
				}
				return newMatches;
			}

			@Override
			public void postDiff(Comparison comparison, Monitor monitor) {
				// TODO Auto-generated method stub
			}

			@Override
			public void postRequirements(Comparison comparison, Monitor monitor) {
				// TODO Auto-generated method stub
			}

			@Override
			public void postEquivalences(Comparison comparison, Monitor monitor) {
				// TODO Auto-generated method stub
			}

			@Override
			public void postConflicts(Comparison comparison, Monitor monitor) {
				// TODO Auto-generated method stub
			}

			@Override
			public void postComparison(Comparison comparison, Monitor monitor) {
				// TODO Auto-generated method stub
			}
			
		};
		IPostProcessor customPostProcessor = new CustomPostProcessor();
		IPostProcessor.Descriptor descriptor = new BasicPostProcessorDescriptorImpl(customPostProcessor, Pattern.compile(".*"), null);

		PostProcessorDescriptorRegistryImpl<String> registry = new PostProcessorDescriptorRegistryImpl<String>();
		registry.put(CustomPostProcessor.class.getName(), descriptor);
		result = EMFCompare.builder().setPostProcessorRegistry(registry).build().compare(scope);
		
		return result;

Previous Topic:Plugin vs. standalone configuration of EMF Compare
Next Topic:Accessing elements properties in a EMF Compare Diff Model
Goto Forum:
  


Current Time: Fri Apr 19 07:32:37 GMT 2024

Powered by FUDForum. Page generated in 0.01869 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top