/** * * Return an ISQLSyntax object which can be used to highlight sql statements in SQL editor. * * @param dbType * @return */ public static ISQLSyntax getSQLSyntax(String dbType) { SQLService s = getSQLService(null, dbType); if (s != null) { return s.getSQLSyntax(); } return null; }
/** * Generally this method is not encouraged to overide * * @param value * @param databaseIdentifier * @return */ protected ValidatorMessage checkReservedwords(String value, DatabaseIdentifier databaseIdentifier) { SQLDevToolsConfiguration conf = SQLToolsFacade.getConfiguration(null, databaseIdentifier); String[] reserved = conf.getSQLService().getSQLSyntax().getReservedwords(); String[] types = conf.getSQLService().getSQLSyntax().getTypes(); for (int i = 0; i < reserved.length; i++) { if (value.equalsIgnoreCase(reserved[i])) { return new ValidatorMessage(ValidatorMessage.ERROR, Messages.IdentifierValidator_invalid_reservedword); } } for (int i = 0; i < types.length; i++) { if (value.equalsIgnoreCase(types[i])) { return new ValidatorMessage(ValidatorMessage.ERROR, Messages.IdentifierValidator_invalid_reservedword); } } return null; }
/** * 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; }
if (_fWord.startsWith(globalVariablePrefix)) //$NON-NLS-1$ ISQLSyntax syntax = _config.getSQLService().getSQLSyntax(); resultCollector.setVariableList(new ArrayList(Arrays .asList(createVarProposals(syntax
/** * Sets up the document partitioner. Since we support multiple dialects, each time when the database vendor definition for this SQL editor * is changed, this method should be called to update the document partitioner. */ protected void setupDocumentPartitioner() { IDocument document = getDocumentProvider().getDocument(getEditorInput()); DatabaseVendorDefinitionId vendorId = getConnectionInfo().getDatabaseVendorDefinitionId(); SQLDevToolsConfiguration factory = SQLToolsFacade.getConfigurationByVendorIdentifier(vendorId); SQLPartitionScanner _sqlPartitionSanner = new SQLPartitionScanner(factory.getSQLService().getSQLSyntax()); if (document instanceof IDocumentExtension3) { IDocumentExtension3 extension3 = (IDocumentExtension3) document; IDocumentPartitioner partitioner = new FastPartitioner( _sqlPartitionSanner, new String[] { SQLPartitionScanner.SQL_COMMENT, SQLPartitionScanner.SQL_MULTILINE_COMMENT, SQLPartitionScanner.SQL_STRING, SQLPartitionScanner.SQL_DOUBLE_QUOTES_IDENTIFIER }); partitioner.connect(document); extension3.setDocumentPartitioner(SQLPartitionScanner.SQL_PARTITIONING, partitioner); } }
if (factory != null) sqlCodeScanner.setSQLSyntax(factory.getSQLService().getSQLSyntax());