@Override public IDocument getDocument(Object element) { IDocument document = super.getDocument(element); if (document == null) { return null; } IDocumentPartitioner formerPartitioner = document.getDocumentPartitioner(); if (formerPartitioner instanceof JenkinsPartitioner) { return document; } /* installation necessary */ JenkinsPartitioner partitioner = JenkinsPartionerFactory.create(); partitioner.connect(document,true); document.setDocumentPartitioner(partitioner); return document; }
@Override public IDocument getDocument(Object element) { IDocument document = super.getDocument(element); if (document == null) { return null; } IDocumentPartitioner formerPartitioner = document.getDocumentPartitioner(); if (formerPartitioner instanceof BatchPartitioner) { return document; } /* installation necessary */ IDocumentPartitioner partitioner = BatchPartionerFactory.create(); partitioner.connect(document); document.setDocumentPartitioner(partitioner); return document; }
/** * This method initializes compositeXml * */ private void createCompositeXml() { compositeXml = new Composite(sashForm, SWT.NONE); compositeXml.setLayout(new FillLayout()); xmlView = new StructuredTextViewer(compositeXml, null, null, false, SWT.H_SCROLL | SWT.V_SCROLL); xmlView.setEditable(false); colorManager = new ColorManager(); xmlView.configure(new XMLConfiguration(colorManager)); Document document = new Document( "Click on the XML generation button to view the XML document generated by Convertigo."); IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT, }); partitioner.connect(document); document.setDocumentPartitioner(partitioner); xmlView.setDocument(document); }
/** * This method initializes compositeXml * */ private void createCompositeXml() { compositeXml = new Composite(sashForm, SWT.NONE); compositeXml.setLayout(new FillLayout()); xmlView = new StructuredTextViewer(compositeXml, null, null, false, SWT.H_SCROLL | SWT.V_SCROLL); xmlView.setEditable(false); colorManager = new ColorManager(); xmlView.configure(new XMLConfiguration(colorManager)); Document document = new Document("Click on the XML generation button to view the XML document generated by Convertigo."); IDocumentPartitioner partitioner = new FastPartitioner( new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT, } ); partitioner.connect(document); document.setDocumentPartitioner(partitioner); xmlView.setDocument(document); }
@Override public IDocument getDocument(Object element) { IDocument document = super.getDocument(element); if (document == null) { return null; } IDocumentPartitioner formerPartitioner = document.getDocumentPartitioner(); if (formerPartitioner instanceof BashPartitioner) { return document; } /* installation necessary */ IDocumentPartitioner partitioner = BashPartionerFactory.create(); partitioner.connect(document); document.setDocumentPartitioner(partitioner); return document; }
@Override public IDocument getDocument(Object element) { IDocument document = super.getDocument(element); if (document == null) { return null; } IDocumentPartitioner formerPartitioner = document.getDocumentPartitioner(); if (formerPartitioner instanceof GradlePartitioner) { return document; } /* installation necessary */ GradlePartitioner partitioner = GradlePartionerFactory.create(); partitioner.connect(document,true); document.setDocumentPartitioner(partitioner); return document; }
@SuppressWarnings("static-access") @Override protected FileInfo createFileInfo(Object element) throws CoreException{ FileInfo info = super.createFileInfo(element); if (info == null) { info = createEmptyFileInfo(); } IDocument document = info.fTextFileBuffer.getDocument(); if (document != null) { EiffelPartitionScanner partitionScanner = EiffelEditorPlugin .getDefault().getPartitionScanner(); IDocumentPartitioner partitioner = new FastPartitioner(partitionScanner, EiffelPartitionScanner.PARTITION_TYPE); partitioner.connect(document); document.setDocumentPartitioner(partitioner); } return info; }
public static IDocument createDocument1(){ IDocument doc = new Document(){ public String getDefaultLineDelimiter(){ return String.valueOf(AssistConstants.LINE_DELIM_NL) /*super.getDefaultLineDelimiter()*/; } }; IDocumentPartitioner partitioner = new DefaultPartitioner( new HPartitionScanner(), new String[] { HPartitionScanner.COMMENT, HPartitionScanner.PROPERTY_VALUE}); partitioner.connect(doc); doc.setDocumentPartitioner(partitioner); return doc; }
public static IDocument createDocument2() { IDocument document = new Document(); if( document != null) { IDocumentPartitioner partitioner = new XMLPartitioner( new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_START_TAG, XMLPartitionScanner.XML_PI, XMLPartitionScanner.XML_DOCTYPE, XMLPartitionScanner.XML_END_TAG, XMLPartitionScanner.XML_TEXT, XMLPartitionScanner.XML_CDATA, XMLPartitionScanner.XML_COMMENT }); partitioner.connect(document); document.setDocumentPartitioner(partitioner); } return document; }
@Override protected IDocument createDocument(Object element) throws CoreException { IDocument document = super.createDocument(element); //IDocumentPartitioner partitioner = createDocumentPartitioner(); IDocumentPartitioner partitioner = new ImpexDocumentPartitioner(); if ((document instanceof IDocumentExtension3)) { IDocumentExtension3 extension3 = (IDocumentExtension3) document; extension3.setDocumentPartitioner(Activator.IMPEX_PARTITIONING, partitioner); } else { document.setDocumentPartitioner(partitioner); } partitioner.connect(document); return document; }
protected FileInfo createFileInfo(Object element) throws CoreException { FileInfo info = super.createFileInfo(element); if (info == null) { info = createEmptyFileInfo(); } //System.out.println(info.fTextFileBuffer.getDocument().getClass()); IDocument document = info.fTextFileBuffer.getDocument(); if (document != null) { IDocumentPartitioner partitioner = new XMLPartitioner( new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_START_TAG, XMLPartitionScanner.XML_PI, XMLPartitionScanner.XML_DOCTYPE, XMLPartitionScanner.XML_END_TAG, XMLPartitionScanner.XML_TEXT, XMLPartitionScanner.XML_CDATA, XMLPartitionScanner.XML_COMMENT }); partitioner.connect(document); document.setDocumentPartitioner(partitioner); } return info; }
protected IDocument createDocument(Object element) throws CoreException { IDocument document = super.createDocument(element); if (document != null) { IDocumentPartitioner partitioner = new XMLPartitioner( new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_START_TAG, XMLPartitionScanner.XML_PI, XMLPartitionScanner.XML_DOCTYPE, XMLPartitionScanner.XML_END_TAG, XMLPartitionScanner.XML_TEXT, XMLPartitionScanner.XML_CDATA, XMLPartitionScanner.XML_COMMENT }); partitioner.connect(document); document.setDocumentPartitioner(partitioner); } return document; }
/** * Create a new SourceDocument from a IDocument object. The changes in the * SourceDocument will not be made in the original IDocument. Use this * function just to read the content. * * @param doc * @return */ public static NCLSourceDocument createNCLSourceDocumentFromIDocument( IDocument doc) { if (doc instanceof NCLSourceDocument) return (NCLSourceDocument) doc; NCLSourceDocument document = new NCLSourceDocument(); document.set(doc.get()); IDocumentPartitioner partitioner = new XMLPartitioner( new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_START_TAG, XMLPartitionScanner.XML_PI, XMLPartitionScanner.XML_DOCTYPE, XMLPartitionScanner.XML_END_TAG, XMLPartitionScanner.XML_TEXT, XMLPartitionScanner.XML_CDATA, XMLPartitionScanner.XML_COMMENT }); partitioner.connect(document); document.setDocumentPartitioner(partitioner); return document; }
public static MplEditor create(Path path, BorderPane pane, EventBus eventBus, AppMemento appMemento, Context context) { MplEditor editor = new MplEditor(eventBus, context); StringInput input = new DelegatingLocalSourceFileInput( new LocalSourceFileInput(path, StandardCharsets.UTF_8, eventBus)); EditorContextMenuProvider contextMenuProvider = (Control styledText, Type type) -> { }; ContextInformationPresenter contextInformationPresenter = new MplContextInformationPresenter(); EditingContext editingContext = new DelegatingEditingContext(); IDocument document = new InputDocument(input, eventBus); SourceViewerConfiguration configuration = createConfiguration(input, document, editingContext, appMemento); IDocumentPartitioner partitioner = new MplPartitioner(); Property<Input<?>> activeInput = editor.activeInput; @SuppressWarnings("unchecked") Property<Double> zoomFactor = (Property<Double>) (Property<?>) new SimpleDoubleProperty(1); editor.initUI(pane, eventBus, contextMenuProvider, contextInformationPresenter, editingContext, document, configuration, partitioner, input, activeInput, zoomFactor); return editor; }
@Override protected IDocument createDocument(Object element) throws CoreException { IDocument document = null; if (isWorkspaceExternalEditorInput(element)) { document= createEmptyDocument(); if (setDocumentContent(document, (IEditorInput) element, Charset.defaultCharset().name())) { setupDocument(element, document); } } else { document = super.createDocument(element); } if (document != null) { IDocumentPartitioner partitioner = documentPartitioner.get(); partitioner.connect(document); document.setDocumentPartitioner(partitioner); } return document; }
public int getNonBlankLineAbove(int line, IDocument doc) { IDocumentPartitioner partitioner = doc.getDocumentPartitioner(); while (--line >= 0) { if (EditorsUtil.isBlankLine(doc, line)) { continue; } try { int start = doc.getLineOffset(line); if (EditorsUtil.isInsidePartition(start, new String[] { IEditorConfiguration.CDATA_PARTITION }, true, doc)) { line = doc.getLineOfOffset(partitioner.getPartition(start) .getOffset()); continue; } if (isInsideEscapedPartitions(start, doc)) { line = doc.getLineOfOffset(partitioner.getPartition(start) .getOffset()) + 1; continue; } } catch (BadLocationException e) { } return line; } return line; }
@Override protected IDocument createDocument(final Object element) throws CoreException { final IDocument document = super.createDocument(element); if (document != null) { MapFile.parse(document.get()); final IDocumentPartitioner partitioner = new FastPartitioner( new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT }); partitioner.connect(document); document.setDocumentPartitioner(partitioner); } return document; }
@Override protected IDocument createDocument(final Object element) throws CoreException { final IDocument document = super.createDocument(element); if (document != null) { final String[] toBeProcessed = new String[] { DMPartitionScanner.DM_COMMENT, DMPartitionScanner.DM_STRING }; // Use of RuleBasedPartitioner in favor of FastPartitioner because otherwise single-line comments // ended with '\' will not be processed correctly when editing from below the original comment. final IDocumentPartitioner partitioner = new RuleBasedPartitioner(new DMPartitionScanner(), toBeProcessed); partitioner.connect(document); document.setDocumentPartitioner(partitioner); } return document; }
/** * Setup the TrafficScript Partitioner for .zts files */ /* Override */ public void setup( IDocument document ) { if (document instanceof IDocumentExtension3) { IDocumentExtension3 extension3 = (IDocumentExtension3) document; IDocumentPartitioner partitioner = new FastPartitioner( ZXTMPlugin.getDefault().getTrafficScriptPartitioner(), Partition.getAllPartitionIds() ); extension3.setDocumentPartitioner( TrafficScriptPartitioner.TS_PARTITIONER, partitioner ); partitioner.connect( document ); } }
@Override public void connect(Object element) throws CoreException { super.connect(element); IDocument document = getDocument(element); if (document != null) { CompositePartitionScanner partitionScanner = new CompositePartitionScanner(XMLSourceConfiguration .getDefault().createSubPartitionScanner(), new NullSubPartitionScanner(), new NullPartitionerSwitchStrategy()); IDocumentPartitioner partitioner = new ExtendedFastPartitioner(partitionScanner, XMLSourceConfiguration .getDefault().getContentTypes()); partitionScanner.setPartitioner((IExtendedPartitioner) partitioner); partitioner.connect(document); document.setDocumentPartitioner(partitioner); CommonEditorPlugin.getDefault().getDocumentScopeManager() .registerConfiguration(document, XMLSourceConfiguration.getDefault()); } }
@Override public void connect(Object element) throws CoreException { super.connect(element); IDocument document = getDocument(element); if (document != null) { CompositePartitionScanner partitionScanner = new CompositePartitionScanner(HTMLSourceConfiguration .getDefault().createSubPartitionScanner(), new NullSubPartitionScanner(), new NullPartitionerSwitchStrategy()); IDocumentPartitioner partitioner = new ExtendedFastPartitioner(partitionScanner, HTMLSourceConfiguration .getDefault().getContentTypes()); partitionScanner.setPartitioner((IExtendedPartitioner) partitioner); partitioner.connect(document); document.setDocumentPartitioner(partitioner); CommonEditorPlugin.getDefault().getDocumentScopeManager().registerConfiguration(document, HTMLSourceConfiguration.getDefault()); } }
@Override public void disconnect(Object element) { FileInfo fileInfo = getFileInfo(element); if (fileInfo != null && fileInfo.fCount == 1) { IDocument document = getDocument(element); if (document != null) { IDocumentPartitioner partitioner = document.getDocumentPartitioner(); if (partitioner != null) { partitioner.disconnect(); document.setDocumentPartitioner(null); } } } super.disconnect(element); }
@Override public void connect(Object element) throws CoreException { super.connect(element); IDocument document = getDocument(element); if (document != null) { CompositePartitionScanner partitionScanner = new CompositePartitionScanner(defaultPartitioningConfiguration.createSubPartitionScanner(), primaryPartitioningConfiguration.createSubPartitionScanner(), partitionerSwitchStrategy); IDocumentPartitioner partitioner = new ExtendedFastPartitioner(partitionScanner, TextUtils.combine(new String[][] { CompositePartitionScanner.SWITCHING_CONTENT_TYPES, defaultPartitioningConfiguration.getContentTypes(), primaryPartitioningConfiguration.getContentTypes() })); partitionScanner.setPartitioner((IExtendedPartitioner) partitioner); partitioner.connect(document); document.setDocumentPartitioner(partitioner); CommonEditorPlugin.getDefault().getDocumentScopeManager() .registerConfigurations(document, new IPartitioningConfiguration[] { defaultPartitioningConfiguration, primaryPartitioningConfiguration }); } }
protected List<ElementRegion> parseTag(IDocument document, ITypedRegion tagRegion, String[] attrs) { IDocumentPartitioner partitioner = null; try { // create attribute partitioner partitioner = createAttrPartitioner(document, attrs); ITypedRegion[] regions = partitioner.computePartitioning( tagRegion.getOffset(), tagRegion.getLength()); return fetchAttrsRegions(document, regions); } finally { if (partitioner != null) { partitioner.disconnect(); } } }
protected IDocumentPartitioner createTagPartitioner(IDocument document, String[] tags) { IPredicateRule[] tagRules = new IPredicateRule[tags.length]; for (int i = 0; i < tags.length; i++) { if (CLOSE_TAG_TOKEN.equals(tags[i])) { tagRules[i] = new MultiLineRule("</", ">", new Token(tags[i])); } else if (COMMENT_TOKEN.equals(tags[i])) { tagRules[i] = new MultiLineRule("<!--", "-->", new Token( tags[i])); } else { tagRules[i] = new MultiLineRule("<" + tags[i], ">", new Token( tags[i])); } } return createConnectPartitioner(document, tagRules, tags); }
private IDocumentPartitioner createAttrPartitioner(IDocument document, String[] attrs) { IPredicateRule[] attrRules = new IPredicateRule[attrs.length + 2]; attrRules[0] = new SingleLineRule("\"", "\"", new Token( DOUBLE_QUOTES_TOKEN)); attrRules[1] = new SingleLineRule("'", "'", new Token( SINGLE_QUOTES_TOKEN)); String[] types = new String[attrs.length + 2]; types[0] = DOUBLE_QUOTES_TOKEN; types[1] = SINGLE_QUOTES_TOKEN; for (int i = 0; i < attrs.length; i++) { attrRules[i + 2] = new WordPatternRule(new AttributeDetector(), attrs[i], "=", new Token(attrs[i])); types[i + 2] = attrs[i]; } return createConnectPartitioner(document, attrRules, types); }
public IDocument createDocument(final Object element) throws CoreException { IDocument document = super.createDocument(element); if (document != null) { IDocumentPartitioner partitioner = new FastPartitioner( new HTMLPartitionScanner(), new String[]{ HTMLPartitionScanner.HTML_TAG, HTMLPartitionScanner.HTML_COMMENT, HTMLPartitionScanner.HTML_SCRIPT, HTMLPartitionScanner.HTML_DOCTYPE, HTMLPartitionScanner.HTML_DIRECTIVE, HTMLPartitionScanner.JAVASCRIPT, HTMLPartitionScanner.HTML_CSS, HTMLPartitionScanner.SYNCOPE_TAG}); partitioner.connect(document); document.setDocumentPartitioner(partitioner); } return document; }
protected IDocument createDocument(Object element) throws CoreException { IDocument document = super.createDocument(element); if (document != null) { IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(), new String[] {XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT}); partitioner.connect(document); document.setDocumentPartitioner(partitioner); // document.addDocumentListener(new IDocumentListener() { // // public void documentAboutToBeChanged(DocumentEvent event) { // } // // public void documentChanged(DocumentEvent event) { // System.out.println("XMLDocumentProvider.documentChanged :"+event.getText()); // } // }); } return document; }
public SourceEditor() { setSourceViewerConfiguration(new TextUMLSourceViewerConfiguration(this)); // set the document provider to create the partitioner setDocumentProvider(new FileDocumentProvider() { protected IDocument createDocument(Object element) throws CoreException { IDocument document = super.createDocument(element); if (document != null) { // this will create partitions IDocumentPartitioner partitioner = new FastPartitioner(new PartitionScanner(), ContentTypes.CONFIGURED_CONTENT_TYPES); partitioner.connect(document); document.setDocumentPartitioner(partitioner); } return document; } }); }
@Override protected FileInfo createFileInfo(Object element) throws CoreException { FileInfo info = super.createFileInfo(element); if(info==null){ info = createEmptyFileInfo(); } IDocument document = info.fTextFileBuffer.getDocument(); if (document != null) { /* register your partitioner and other things here same way as in your first document provider */ if (document instanceof IDocumentExtension3) { IDocumentExtension3 extension3= (IDocumentExtension3) document; IDocumentPartitioner partitioner= new FastPartitioner(RustCorePlugin.getDefault().scanners().rustPartitionScanner(), RustPartitionScanner.PARTITION_TYPES); extension3.setDocumentPartitioner(RustConstants.RUST_PARTITIONING, partitioner); partitioner.connect(document); } } return info; }
@Override protected @Nullable IDocument createDocument(@Nullable Object element) throws CoreException { // IDocument document = super.createDocument(element); // if (document != null) { // IDocumentPartitioner partitioner = // new FastPartitioner( // new RustPartitionScanner(), // new String[] { // RustPartitionScanner.RUST_MULTILINE_COMMENT }); // partitioner.connect(document); // document.setDocumentPartitioner(partitioner); // } // return document; IDocument document = super.createDocument(element); if (document instanceof IDocumentExtension3) { IDocumentExtension3 extension3= (IDocumentExtension3) document; IDocumentPartitioner partitioner= new FastPartitioner(RustCorePlugin.getDefault().scanners().rustPartitionScanner(), RustPartitionScanner.PARTITION_TYPES); extension3.setDocumentPartitioner(RustConstants.RUST_PARTITIONING, partitioner); partitioner.connect(document); } return document; }
/** * Checks if the partitioner is correctly set in the document. * @return the partitioner that is set in the document */ public static IDocumentPartitioner checkPartitionScanner(IDocument document, IGrammarVersionProvider grammarVersionProvider) { if (document == null) { return null; } IDocumentExtension3 docExtension = (IDocumentExtension3) document; IDocumentPartitioner partitioner = docExtension.getDocumentPartitioner(IPythonPartitions.PYTHON_PARTITION_TYPE); if (partitioner == null) { addPartitionScanner(document, grammarVersionProvider); //get it again for the next check partitioner = docExtension.getDocumentPartitioner(IPythonPartitions.PYTHON_PARTITION_TYPE); } if (!(partitioner instanceof PyPartitioner)) { Log.log("Partitioner should be subclass of PyPartitioner. It is " + partitioner.getClass()); } return partitioner; }
/** * @see http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/editors_documents.htm * @see http://jroller.com/page/bobfoster - Saturday July 16, 2005 * @param document the document where we want to add the partitioner * @return the added document partitioner (or null) */ public static IDocumentPartitioner addPartitionScanner(IDocument document, IGrammarVersionProvider grammarVersionProvider) { if (document != null) { IDocumentExtension3 docExtension = (IDocumentExtension3) document; IDocumentPartitioner curr = docExtension.getDocumentPartitioner(IPythonPartitions.PYTHON_PARTITION_TYPE); if (curr == null) { //set the new one PyPartitioner partitioner = createPyPartitioner(); partitioner.connect(document); docExtension.setDocumentPartitioner(IPythonPartitions.PYTHON_PARTITION_TYPE, partitioner); return partitioner; } else { return curr; } } return null; }
/** * Get the current line up to where the cursor is without any comments or literals. */ public String getLineContentsToCursor(boolean removeComments, boolean removeLiterals) throws BadLocationException { if (removeComments == false || removeLiterals == false) { throw new RuntimeException("Currently only accepts removing the literals and comments."); } int cursorOffset = getAbsoluteCursorOffset(); IRegion lineInformationOfOffset = doc.getLineInformationOfOffset(cursorOffset); IDocumentPartitioner partitioner = PyPartitionScanner.checkPartitionScanner(doc); if (partitioner == null) { throw new RuntimeException("Partitioner not set up."); } StringBuffer buffer = new StringBuffer(); int offset = lineInformationOfOffset.getOffset(); int length = lineInformationOfOffset.getLength(); for (int i = offset; i <= offset + length && i < cursorOffset; i++) { String contentType = partitioner.getContentType(i); if (contentType.equals(IPythonPartitions.PY_DEFAULT)) { buffer.append(doc.getChar(i)); } else { buffer.append(' '); } } return buffer.toString(); }
@Override protected FileInfo createFileInfo(Object element) throws CoreException { FileInfo info = super.createFileInfo(element); if(info == null) { info = createEmptyFileInfo(); } IDocument document = info.fTextFileBuffer.getDocument(); if(document != null) { IDocumentPartitioner partitioner = new FastPartitioner( new BytemanRulePartitionScanner(), new String[] { BytemanRulePartitionScanner.RULE_COMMENT, BytemanRulePartitionScanner.RULE_DEF_LINE }); partitioner.connect(document); document.setDocumentPartitioner(partitioner); } return info; }
@Override protected IDocument createDocument(Object element) throws CoreException { IDocument document = super.createDocument(element); if (document != null) { /* installation necessary */ IDocumentPartitioner partitioner = BatchPartionerFactory.create(); partitioner.connect(document); document.setDocumentPartitioner(partitioner); } return document; }
protected IDocument createDocument(Object element) throws CoreException { IDocument document = super.createDocument(element); 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; }
@Override protected IDocument createDocument(Object element) throws CoreException { IDocument document = super.createDocument(element); if (document != null) { /* installation necessary */ IDocumentPartitioner partitioner = BashPartionerFactory.create(); partitioner.connect(document); document.setDocumentPartitioner(partitioner); } return document; }
void setupDocument(IDocument document) { if (document instanceof IDocumentExtension3) { IDocumentExtension3 ext= (IDocumentExtension3) document; IDocumentPartitioner partitioner= createRecipePartitioner(); partitioner.connect(document); ext.setDocumentPartitioner(SQL_PARTITIONING, partitioner); } }
IDocumentPartitioner createRecipePartitioner() { IPredicateRule[] rules = { new SingleLineRule("--", null, new Token(SQL_SINGLE_COMMENT), (char) 0, true, false), //$NON-NLS-1$ new MultiLineRule("/*", "*/", new Token(SQL_MULTI_COMMENT), (char) 0, true), //$NON-NLS-1$ //$NON-NLS-2$ new MultiLineRule( "'", "'", new Token(SQL_CHARACTER_STRING_LITERAL), (char) 0 , true) //$NON-NLS-1$ //$NON-NLS-2$ }; RuleBasedPartitionScanner scanner = new RuleBasedPartitionScanner(); scanner.setPredicateRules(rules); return new FastPartitioner(scanner, CONTENT_TYPES); }