Post processing matches breaks navigation to differences [message #1386082] |
Fri, 13 June 2014 11:22 |
|
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;
|
|
|
Powered by
FUDForum. Page generated in 0.03149 seconds