private async Task ConfigureSettings(CancellationToken cancellationToken) { ExecutionContext.EnsureSettingsProviderAvailable(); _settingsModel = ExecutionContext.SettingsProvider.Settings; _settingsModel.IsTextInputVisible = false; var expandedColumns = new List <ColumnDescriptionItem>(); var databaseLinkReferences = new List <OracleObjectWithColumnsReference>(); _asteriskNode = FillColumnNames(expandedColumns, databaseLinkReferences, true); var useDefaultSettings = _settingsModel.UseDefaultSettings == null || _settingsModel.UseDefaultSettings(); foreach (var databaseLinkReference in databaseLinkReferences) { var databaseLinkIdentifier = String.Concat(databaseLinkReference.DatabaseLinkNode.Terminals.Select(t => t.Token.Value)); var remoteObjectIdenrifier = OracleObjectIdentifier.Create(databaseLinkReference.OwnerNode, databaseLinkReference.ObjectNode, null); var columnNames = await CurrentQueryBlock.SemanticModel.DatabaseModel.GetRemoteTableColumnsAsync(databaseLinkIdentifier, remoteObjectIdenrifier, cancellationToken); expandedColumns.AddRange( columnNames.Select( n => new ColumnDescriptionItem { OwnerIdentifier = databaseLinkReference.FullyQualifiedObjectName, ColumnName = n.ToSimpleIdentifier() })); } foreach (var expandedColumn in expandedColumns.DistinctBy(c => c.ColumnNameLabel)) { _settingsModel.AddBooleanOption( new BooleanOption { OptionIdentifier = expandedColumn.ColumnNameLabel, DescriptionContent = BuildColumnOptionDescription(expandedColumn), Value = !expandedColumn.IsPseudocolumn && !expandedColumn.IsHidden && useDefaultSettings, Tag = expandedColumn }); } _settingsModel.Title = "Expand Asterisk"; _settingsModel.Heading = _settingsModel.Title; }
private void ConfigureSettings() { ExecutionContext.EnsureSettingsProviderAvailable(); _settingsModel = ExecutionContext.SettingsProvider.Settings; _settingsModel.IsTextInputVisible = false; var columnNames = FillColumnNames(); foreach (var column in columnNames) { var isSelected = _settingsModel.UseDefaultSettings == null || !_settingsModel.UseDefaultSettings() ? _existingColumns.Contains(column.Name.ToQuotedIdentifier()) : _settingsModel.UseDefaultSettings(); var columnDescription = new ColumnDescriptionItem { DataType = column.FullTypeName, ColumnName = OracleCodeCompletionProvider.GetPrettyColumnName(column.Name), IsHidden = column.Hidden, Nullable = column.Nullable }; _settingsModel.AddBooleanOption( new BooleanOption { OptionIdentifier = column.Name.ToSimpleIdentifier(), DescriptionContent = ExpandAsteriskCommand.BuildColumnOptionDescription(columnDescription), Value = isSelected, Tag = column }); } _settingsModel.Title = "Add/Modify Columns"; _settingsModel.Heading = _settingsModel.Title; }
private void ConfigureSettings() { ExecutionContext.EnsureSettingsProviderAvailable(); _settingsModel = ExecutionContext.SettingsProvider.Settings; _settingsModel.ValidationRule = new OracleIdentifierValidationRule(); _settingsModel.Title = "Create table script"; _settingsModel.Description = "Enter table name: "; _settingsModel.Heading = _settingsModel.Title; var createTableAsAllowed = CurrentQueryBlock == SemanticModel.MainQueryBlock; _settingsModel.AddBooleanOption( new BooleanOption { OptionIdentifier = CreateSeparateStatement, DescriptionContent = "Create separate statement", Value = !createTableAsAllowed, IsEnabled = createTableAsAllowed }); }
private async Task ConfigureSettings(CancellationToken cancellationToken) { ExecutionContext.EnsureSettingsProviderAvailable(); _settingsModel = ExecutionContext.SettingsProvider.Settings; _settingsModel.IsTextInputVisible = false; var expandedColumns = new List<ColumnDescriptionItem>(); var databaseLinkReferences = new List<OracleObjectWithColumnsReference>(); _asteriskNode = FillColumnNames(expandedColumns, databaseLinkReferences, true); var useDefaultSettings = _settingsModel.UseDefaultSettings == null || _settingsModel.UseDefaultSettings(); foreach (var databaseLinkReference in databaseLinkReferences) { var databaseLinkIdentifier = String.Concat(databaseLinkReference.DatabaseLinkNode.Terminals.Select(t => t.Token.Value)); var remoteObjectIdenrifier = OracleObjectIdentifier.Create(databaseLinkReference.OwnerNode, databaseLinkReference.ObjectNode, null); var columnNames = await CurrentQueryBlock.SemanticModel.DatabaseModel.GetRemoteTableColumnsAsync(databaseLinkIdentifier, remoteObjectIdenrifier, cancellationToken); expandedColumns.AddRange( columnNames.Select( n => new ColumnDescriptionItem { OwnerIdentifier = databaseLinkReference.FullyQualifiedObjectName, ColumnName = n.ToSimpleIdentifier() })); } foreach (var expandedColumn in expandedColumns.Distinct(c => c.ColumnNameLabel)) { _settingsModel.AddBooleanOption( new BooleanOption { OptionIdentifier = expandedColumn.ColumnNameLabel, DescriptionContent = BuildColumnOptionDescription(expandedColumn), Value = !expandedColumn.IsPseudocolumn && !expandedColumn.IsHidden && useDefaultSettings, Tag = expandedColumn }); } _settingsModel.Title = "Expand Asterisk"; _settingsModel.Heading = _settingsModel.Title; }