use of org.eclipse.jface.text.IDocumentPartitioner in project linuxtools by eclipse.
the class DockerDocumentProvider method createDocument.
@Override
protected IDocument createDocument(Object element) throws CoreException {
IDocument document = super.createDocument(element);
if (document != null) {
DockerPartitionScanner scanner = new DockerPartitionScanner();
IDocumentPartitioner partitioner = new FastPartitioner(scanner, DockerPartitionScanner.ALLOWED_CONTENT_TYPES);
partitioner.connect(document);
document.setDocumentPartitioner(partitioner);
}
return document;
}
use of org.eclipse.jface.text.IDocumentPartitioner in project linuxtools by eclipse.
the class STPFormattingTest method setupDocumentPartitioner.
/**
* Sets up the document partitioner for the given document for the given partitioning.
*
* @param document
* @param partitioning
* @param owner may be null
*/
private static void setupDocumentPartitioner(IDocument document, String partitioning) {
IDocumentPartitioner partitioner = new FastPartitioner(new STPPartitionScanner(), STPPartitionScanner.STP_PARTITION_TYPES);
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3 = (IDocumentExtension3) document;
extension3.setDocumentPartitioner(partitioning, partitioner);
} else {
document.setDocumentPartitioner(partitioner);
}
partitioner.connect(document);
}
use of org.eclipse.jface.text.IDocumentPartitioner in project tmdm-studio-se by Talend.
the class XMLDocumentProvider method createDocument.
// XMLEditor editor;
// public XMLDocumentProvider(XMLEditor editor){
// this.editor=editor;
// }
protected IDocument createDocument(Object element) throws CoreException {
if (element instanceof XMLEditorInput) {
// IDocument document = super.createDocument(element);
IDocument document = ((XMLEditorInput) element).getDocument();
if (document != null) {
IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT });
partitioner.connect(document);
document.setDocumentPartitioner(partitioner);
}
return document;
}
return null;
}
use of org.eclipse.jface.text.IDocumentPartitioner in project tmdm-studio-se by Talend.
the class ElementFKInfoFormatViewer method intallDocument.
private void intallDocument(IDocument doc) {
IDocumentPartitioner partitioner = new FastPartitioner(new ElementFKInfotPartitionScanner(), new String[] { ElementFKInfotPartitionScanner.COMMON_STRING });
partitioner.connect(doc);
doc.setDocumentPartitioner(partitioner);
setDocument(doc, annotationModel);
}
use of org.eclipse.jface.text.IDocumentPartitioner in project tmdm-studio-se by Talend.
the class XMLTreeModel method createTree.
public void createTree(IDocument document) {
this.fireDocumentAboutToBeChanged(this.getTree());
IDocumentPartitioner partitioner = document.getDocumentPartitioner();
String[] categories = ((IDocumentPartitionerExtension2) partitioner).getManagingPositionCategories();
this.sourceViewer.getCodeTagContainersRegistry().clear();
for (int iCat = 0; iCat < categories.length; iCat++) {
String category = categories[iCat];
Position[] positions = null;
try {
positions = document.getPositions(category);
this.rootNode = new XMLRootNode(0, 0, IXMLPartitions.XML_TAG, document, sourceViewer);
ElementsToRelate.currentNode = this.rootNode;
ElementsToRelate.parentNode = null;
for (int j = 0; j < positions.length; j++) {
Position pos = positions[j];
ElementsToRelate.node = (XMLNode) pos;
ElementsToRelate.node.getChildren().clear();
ElementsToRelate.node.setCorrespondingNode(null);
ElementsToRelate.node.setSourceViewer(this.sourceViewer);
if (ElementsToRelate.currentNode != null && ElementsToRelate.currentNode.isTag()) {
String nodeType = ElementsToRelate.node.getType();
RelateElementsCommand command = this.commands.get(nodeType);
if (command != null) {
command.excecute(this.rootNode, this.sourceViewer.getCodeTagContainersRegistry());
}
}
}
} catch (BadPositionCategoryException e) {
e.printStackTrace();
}
}
this.fireDocumentChanged(this.getTree());
}
Aggregations