use of org.eclipse.jface.text.IDocumentPartitioner in project xtext-xtend by eclipse.
the class ImportAwareActionTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
this.document = this.<XtextDocument>get(XtextDocument.class);
IDocumentPartitioner partitioner = this.<IDocumentPartitioner>get(IDocumentPartitioner.class);
partitioner.connect(this.document);
this.document.setDocumentPartitioner(partitioner);
}
use of org.eclipse.jface.text.IDocumentPartitioner in project dbeaver by dbeaver.
the class JSONTextEditor method setupDocument.
private void setupDocument() {
IDocument document = getDocument();
if (document != null) {
IDocumentPartitioner partitioner = new FastPartitioner(new JSONPartitionScanner(), new String[] { JSONPartitionScanner.JSON_STRING });
partitioner.connect(document);
((IDocumentExtension3) document).setDocumentPartitioner(JSONPartitionScanner.JSON_PARTITIONING, partitioner);
}
}
use of org.eclipse.jface.text.IDocumentPartitioner in project dbeaver by dbeaver.
the class XMLEditor method setupDocument.
private void setupDocument() {
IDocument document = getDocument();
if (document != null) {
IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT });
partitioner.connect(document);
((IDocumentExtension3) document).setDocumentPartitioner(XMLPartitionScanner.XML_PARTITIONING, partitioner);
}
}
use of org.eclipse.jface.text.IDocumentPartitioner in project xtext-eclipse by eclipse.
the class StreamContentDocumentProvider method setupDocument.
protected void setupDocument(Object element, IDocument document) {
String content = getString(element);
document.set(content);
IDocumentPartitioner partitioner = documentPartitioner.get();
partitioner.connect(document);
document.setDocumentPartitioner(partitioner);
XtextResource resource = createResource(element);
loadResource(element, resource);
if (resource != null) {
((XtextDocument) document).setInput(resource);
}
}
use of org.eclipse.jface.text.IDocumentPartitioner in project cubrid-manager by CUBRID.
the class QueryEditorPart method getQuerySQLStartPos.
/**
* Get query SQL start position
*
* @param document PersistentDocument
* @param queries String
* @param cursorPosOffset int
* @return int
*/
private static int getQuerySQLStartPos(SQLDocument document, String queries, int cursorPosOffset) {
// TODO #664 check whether xml queries?
char[] buffer = queries.toCharArray();
IDocumentPartitioner docPartitioner = document.getDocumentPartitioner(ISQLPartitions.SQL_PARTITIONING);
int start = cursorPosOffset;
for (int i = start; i >= 0; i--) {
if (buffer[i] == ';') {
String contentType = docPartitioner == null ? IDocument.DEFAULT_CONTENT_TYPE : docPartitioner.getContentType(i);
boolean isBreak = !ISQLPartitions.SQL_MULTI_LINE_COMMENT.equals(contentType) && !ISQLPartitions.SQL_SINGLE_LINE_COMMENT.equals(contentType) && !ISQLPartitions.SQL_STRING.equals(contentType);
if (isBreak) {
break;
}
}
start--;
}
start++;
for (int i = start; i < buffer.length; i++) {
if (buffer[i] == '\n' || buffer[i] == '\r' || buffer[i] == ' ') {
start++;
} else {
break;
}
}
return start;
}
Aggregations