internal static Grid BuildColumnOptionDescription(ColumnDescriptionItem column) { var descriptionContent = new Grid(); descriptionContent.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star), SharedSizeGroup = "ColumnName" }); descriptionContent.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto, SharedSizeGroup = "DataType" }); descriptionContent.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto, SharedSizeGroup = "Nullable" }); var columnNameLabel = new TextBlock(); descriptionContent.Children.Add(columnNameLabel); var dataTypeLabel = new TextBlock { HorizontalAlignment = HorizontalAlignment.Right, Text = column.DataType, Margin = new Thickness(20, 0, 0, 0) }; Grid.SetColumn(dataTypeLabel, 1); descriptionContent.Children.Add(dataTypeLabel); var nullableLabel = new TextBlock { HorizontalAlignment = HorizontalAlignment.Right, Margin = new Thickness(4, 0, 0, 0) }; if (column.Nullable.HasValue) { nullableLabel.Text = column.Nullable.Value ? "NULL" : "NOT NULL"; Grid.SetColumn(nullableLabel, 2); descriptionContent.Children.Add(nullableLabel); } string extraInformation = null; if (column.IsPseudocolumn) { extraInformation = " (pseudocolumn)"; columnNameLabel.Foreground = dataTypeLabel.Foreground = nullableLabel.Foreground = Brushes.CornflowerBlue; } else if (column.IsHidden) { extraInformation = " (invisible)"; columnNameLabel.Foreground = dataTypeLabel.Foreground = nullableLabel.Foreground = Brushes.DimGray; } columnNameLabel.Text = $"{column.ColumnNameLabel}{extraInformation}"; return(descriptionContent); }
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; }
internal static Grid BuildColumnOptionDescription(ColumnDescriptionItem column) { var descriptionContent = new Grid(); descriptionContent.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star), SharedSizeGroup = "ColumnName" }); descriptionContent.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto, SharedSizeGroup = "DataType" }); descriptionContent.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto, SharedSizeGroup = "Nullable" }); var columnNameLabel = new TextBlock(); descriptionContent.Children.Add(columnNameLabel); var dataTypeLabel = new TextBlock { HorizontalAlignment = HorizontalAlignment.Right, Text = column.DataType, Margin = new Thickness(20, 0, 0, 0) }; Grid.SetColumn(dataTypeLabel, 1); descriptionContent.Children.Add(dataTypeLabel); var nullableLabel = new TextBlock { HorizontalAlignment = HorizontalAlignment.Right, Margin = new Thickness(4, 0, 0, 0) }; if (column.Nullable.HasValue) { nullableLabel.Text = column.Nullable.Value ? "NULL" : "NOT NULL"; Grid.SetColumn(nullableLabel, 2); descriptionContent.Children.Add(nullableLabel); } string extraInformation = null; if (column.IsPseudocolumn) { extraInformation = " (pseudocolumn)"; columnNameLabel.Foreground = dataTypeLabel.Foreground = nullableLabel.Foreground = Brushes.CornflowerBlue; } else if (column.IsHidden) { extraInformation = " (invisible)"; columnNameLabel.Foreground = dataTypeLabel.Foreground = nullableLabel.Foreground = Brushes.DimGray; } columnNameLabel.Text = $"{column.ColumnNameLabel}{extraInformation}"; return descriptionContent; }