/** * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentFormatter(org.eclipse.jface.text.source.ISourceViewer) */ public IContentFormatter getContentFormatter( ISourceViewer sourceViewer ) { if ( formattingStrategy == null ) { formattingStrategy = new FilterFormattingStrategy( sourceViewer, parser ); } if ( formatter == null ) { formatter = new ContentFormatter(); formatter.enablePartitionAwareFormatting( false ); formatter.setFormattingStrategy( formattingStrategy, IDocument.DEFAULT_CONTENT_TYPE ); } return formatter; }
/** * Creates, configures, and returns the ContentFormatter to use. * * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentFormatter(ISourceViewer) */ public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) { ContentFormatter formatter = new ContentFormatter(); formatter.setDocumentPartitioning( SQLPartitionScanner.SQL_PARTITIONING ); SQLDevToolsConfiguration factory = SQLToolsFacade.getConfigurationByVendorIdentifier(getSQLEditor().getConnectionInfo().getDatabaseVendorDefinitionId()); IFormattingStrategy formattingStrategy = new SQLWordStrategy(factory.getSQLService().getSQLSyntax()); formatter.setFormattingStrategy( formattingStrategy, IDocument.DEFAULT_CONTENT_TYPE ); return formatter; }