-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQLFormatterOptions.cs
More file actions
134 lines (98 loc) · 4.24 KB
/
SQLFormatterOptions.cs
File metadata and controls
134 lines (98 loc) · 4.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
using MsaSQLEditor;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
namespace SQLFormatterPlugin
{
/// <summary>
/// Your options class should be derived from IPluginOptions. Mark
/// the class with the [Serializable] attribute.
/// </summary>
[Serializable]
public class SQLFormatterOptions : IPluginOptions
{
Action SaveCallback = null;
Action CancelCallback = null;
/// <summary>
/// The DisplayName attribute gives an option a friendly name in the
/// SQL editor options, and the Category groups options together.
/// </summary>
[DisplayName("Trailing Commas"), Category("Options"), DefaultValue(false)]
public bool TrailingCommas { get; set; }
[DisplayName("Space After Comma"), Category("Options"), DefaultValue(false)]
public bool SpaceAfterComma { get; set; }
[DisplayName("Indent String"), Category("Options"), DefaultValue("\\t")]
public string IndentString { get; set; }
[DisplayName("Spaces Per Tab"), Category("Options"), DefaultValue(4)]
public int SpacesPerTab { get; set; }
[DisplayName("New Statement Line Breaks"), Category("Options"), DefaultValue(2)]
public int NewStatementLineBreaks { get; set; }
[DisplayName("New Clause Line Breaks"), Category("Options"), DefaultValue(1)]
public int NewClauseLineBreaks { get; set; }
[DisplayName("Max Line Width"), Category("Options"), DefaultValue(999)]
public int MaxLineWidth { get; set; }
[DisplayName("Expand Comma Lists"), Category("Options"), DefaultValue(true)]
public bool ExpandCommaLists { get; set; }
[DisplayName("Expand Boolean Expressions"), Category("Options"), DefaultValue(true)]
public bool ExpandBooleanExpressions { get; set; }
[DisplayName("Expand Case Statements"), Category("Options"), DefaultValue(true)]
public bool ExpandCaseStatements { get; set; }
[DisplayName("Expand Between Conditions"), Category("Options"), DefaultValue(true)]
public bool ExpandBetweenConditions { get; set; }
[DisplayName("Break Join On Sections"), Category("Options"), DefaultValue(false)]
public bool BreakJoinOnSections { get; set; }
[DisplayName("Uppercase Keywords"), Category("Options"), DefaultValue(true)]
public bool UppercaseKeywords { get; set; }
//[DisplayName("htmlcoloring"), Category("Options")]
//public bool HTMLColoring { get; set; }
[DisplayName("Keyword Standardization"), Category("Options"), DefaultValue(true)]
public bool KeywordStandardization { get; set; }
[DisplayName("Expand In Lists"), Category("Options"), DefaultValue(true)]
public bool ExpandInLists { get; set; }
public void Save()
{
if (SaveCallback != null)
{
this.SaveCallback();
}
}
public void Cancel()
{
if (this.CancelCallback != null)
{
this.CancelCallback();
}
}
public SQLFormatterOptions()
{
this.TrailingCommas = false;
this.SpaceAfterComma = false;
this.IndentString = "\\t";
this.SpacesPerTab = 4;
this.NewStatementLineBreaks = 2;
this.NewClauseLineBreaks = 1;
this.MaxLineWidth = 999;
this.ExpandCommaLists = true;
this.ExpandBooleanExpressions = true;
this.ExpandCaseStatements = true;
this.ExpandBetweenConditions = true;
this.BreakJoinOnSections = false;
this.UppercaseKeywords = true;
this.KeywordStandardization = true;
this.ExpandInLists = true;
}
public SQLFormatterOptions(Action saveCallback, Action cancelCallback) : this()
{
this.SetCallbacks(saveCallback, cancelCallback);
}
public void SetCallbacks(Action saveCallback, Action cancelCallback)
{
this.SaveCallback = saveCallback;
this.CancelCallback = cancelCallback;
}
}
}