Search in sources :

Example 6 with FastPartitioner

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

the class PropDocumentProvider 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 PropPartitionScanner(), PropPartitionScanner.LEGAL_CONTENT_TYPES);
    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) IDocument(org.eclipse.jface.text.IDocument) IEditorInput(org.eclipse.ui.IEditorInput)

Example 7 with FastPartitioner

use of org.eclipse.jface.text.rules.FastPartitioner 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

FastPartitioner (org.eclipse.jface.text.rules.FastPartitioner)7 IDocumentPartitioner (org.eclipse.jface.text.IDocumentPartitioner)5 IDocument (org.eclipse.jface.text.IDocument)4 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 ColorManager (org.dadacoalition.yedit.editor.ColorManager)1