use of org.eclipse.compare.structuremergeviewer.DocumentRangeNode in project linuxtools by eclipse.
the class SpecStructureCreator method createStructureComparator.
@Override
protected IStructureComparator createStructureComparator(Object input, IDocument document, ISharedDocumentAdapter adapter, IProgressMonitor monitor) {
final boolean isEditable;
if (input instanceof IEditableContent) {
isEditable = ((IEditableContent) input).isEditable();
} else {
isEditable = false;
}
// get the resource being compared, but treat compare with history as
// null resource
IFile file = null;
if (input instanceof IResourceProvider) {
IResource res = ((IResourceProvider) input).getResource();
file = res.getAdapter(IFile.class);
}
DocumentRangeNode rootNode = new StructureRootNode(document, input, this, adapter) {
@Override
public boolean isEditable() {
return isEditable;
}
};
try {
monitor = beginWork(monitor);
// Section Root
SpecNode specfileSectionRoot = new SpecNode(rootNode, 0, SPECFILE_ROOT_NODE, document, 0, document.getLength());
parseSpecfile(specfileSectionRoot, document, file);
} finally {
if (monitor != null) {
monitor.done();
}
}
return rootNode;
}
Aggregations