Search in sources :

Example 6 with IDocumentPartitioner

use of org.eclipse.jface.text.IDocumentPartitioner in project cubrid-manager by CUBRID.

the class XMLDocumentProvider method getDocument.

/**
	 * Retrieves the document to be edited.
	 * 
	 * @param element Object
	 * @return IDocument
	 */
public IDocument getDocument(Object element) {
    IDocument document = null;
    if (element instanceof IEditorInput) {
        IEditorInput ei = ((IEditorInput) element);
        DocumentProvider dp = (DocumentProvider) ei.getAdapter(DocumentProvider.class);
        if (dp != null) {
            document = dp.getDocument(element);
        }
    }
    if (document == null) {
        document = new Document();
    }
    IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT });
    partitioner.connect(document);
    document.setDocumentPartitioner(partitioner);
    return document;
}
Also used : IDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner) FastPartitioner(org.eclipse.jface.text.rules.FastPartitioner) DocumentProvider(com.cubrid.tool.editor.DocumentProvider) Document(org.eclipse.jface.text.Document) IDocument(org.eclipse.jface.text.IDocument) XMLPartitionScanner(com.cubrid.tool.editor.xml.scanner.XMLPartitionScanner) IDocument(org.eclipse.jface.text.IDocument) IEditorInput(org.eclipse.ui.IEditorInput)

Aggregations

IDocumentPartitioner (org.eclipse.jface.text.IDocumentPartitioner)6 FastPartitioner (org.eclipse.jface.text.rules.FastPartitioner)5 IDocument (org.eclipse.jface.text.IDocument)3 SQLDocument (com.cubrid.common.ui.query.editor.SQLDocument)2 SQLPartitionScanner (com.cubrid.common.ui.query.editor.SQLPartitionScanner)2 SQLTextViewer (com.cubrid.common.ui.query.editor.SQLTextViewer)2 SQLViewerConfiguration (com.cubrid.common.ui.query.editor.SQLViewerConfiguration)2 DocumentProvider (com.cubrid.tool.editor.DocumentProvider)2 Document (org.eclipse.jface.text.Document)2 TextViewerUndoManager (org.eclipse.jface.text.TextViewerUndoManager)2 CompositeRuler (org.eclipse.jface.text.source.CompositeRuler)2 LineNumberRulerColumn (org.eclipse.jface.text.source.LineNumberRulerColumn)2 RGB (org.eclipse.swt.graphics.RGB)2 FillLayout (org.eclipse.swt.layout.FillLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 IEditorInput (org.eclipse.ui.IEditorInput)2 TextViewerOperationHandler (com.cubrid.common.ui.query.control.TextViewerOperationHandler)1 QueryPlanComposite (com.cubrid.common.ui.query.control.queryplan.QueryPlanComposite)1 XMLPartitionScanner (com.cubrid.tool.editor.xml.scanner.XMLPartitionScanner)1 FindReplaceDocumentAdapter (org.eclipse.jface.text.FindReplaceDocumentAdapter)1