Skip to content

Commit f19a000

Browse files
committed
Clean up
1 parent 353f32e commit f19a000

File tree

3 files changed

+70
-95
lines changed

3 files changed

+70
-95
lines changed

PlsqlDeveloperUtPlsqlPlugin/PlsqlDeveloperUtPlsqlPlugin/PlsqlDeveloperUtPlsqlPlugin.cs

Lines changed: 27 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -83,44 +83,39 @@ public static void OnActivate()
8383
{
8484
try
8585
{
86-
PlsqlDeveloperUtPlsqlPlugin.ConnectToDatabase();
86+
ConnectToDatabase();
8787

8888
// Separate streams are needed!
8989
var assembly = Assembly.GetExecutingAssembly();
9090
using (var stream = assembly.GetManifestResourceStream("utPLSQL.utPLSQL.bmp"))
9191
{
9292
if (stream != null)
9393
{
94-
PlsqlDeveloperUtPlsqlPlugin.createToolButton(pluginId, PluginMenuIndexAllTests, "utPLSQL",
95-
"utPLSQL.bmp", new Bitmap(stream).GetHbitmap().ToInt64());
94+
createToolButton(pluginId, PluginMenuIndexAllTests, "utPLSQL", "utPLSQL.bmp", new Bitmap(stream).GetHbitmap().ToInt64());
9695
}
9796
}
9897

9998
using (var stream = assembly.GetManifestResourceStream("utPLSQL.utPLSQL_coverage.bmp"))
10099
{
101100
if (stream != null)
102101
{
103-
PlsqlDeveloperUtPlsqlPlugin.createToolButton(pluginId, PluginMenuIndexAllTestsWithCoverage,
104-
"utPLSQL", "utPLSQL_coverage.bmp", new Bitmap(stream).GetHbitmap().ToInt64());
102+
createToolButton(pluginId, PluginMenuIndexAllTestsWithCoverage, "utPLSQL", "utPLSQL_coverage.bmp", new Bitmap(stream).GetHbitmap().ToInt64());
105103
}
106104
}
107105

108106
using (var stream = assembly.GetManifestResourceStream("utPLSQL.utPLSQL.bmp"))
109107
{
110108
if (stream != null)
111109
{
112-
PlsqlDeveloperUtPlsqlPlugin.createToolButton(pluginId, PluginPopupIndex, "utPLSQL",
113-
"utPLSQL.bmp",
114-
new Bitmap(stream).GetHbitmap().ToInt64());
110+
createToolButton(pluginId, PluginPopupIndex, "utPLSQL", "utPLSQL.bmp", new Bitmap(stream).GetHbitmap().ToInt64());
115111
}
116112
}
117113

118114
using (var stream = assembly.GetManifestResourceStream("utPLSQL.utPLSQL_coverage.bmp"))
119115
{
120116
if (stream != null)
121117
{
122-
PlsqlDeveloperUtPlsqlPlugin.createToolButton(pluginId, PluginPopupIndexWithCoverage, "utPLSQL",
123-
"utPLSQL_coverage.bmp", new Bitmap(stream).GetHbitmap().ToInt64());
118+
createToolButton(pluginId, PluginPopupIndexWithCoverage, "utPLSQL", "utPLSQL_coverage.bmp", new Bitmap(stream).GetHbitmap().ToInt64());
124119
}
125120
}
126121
}
@@ -129,13 +124,11 @@ public static void OnActivate()
129124
MessageBox.Show(e.Message);
130125
}
131126

132-
PlsqlDeveloperUtPlsqlPlugin.createPopupItem(pluginId, PluginPopupIndex, "Run utPLSQL Test", "USER");
133-
PlsqlDeveloperUtPlsqlPlugin.createPopupItem(pluginId, PluginPopupIndexWithCoverage, "Run Code Coverage",
134-
"USER");
127+
createPopupItem(pluginId, PluginPopupIndex, "Run utPLSQL Test", "USER");
128+
createPopupItem(pluginId, PluginPopupIndexWithCoverage, "Run Code Coverage", "USER");
135129

136-
PlsqlDeveloperUtPlsqlPlugin.createPopupItem(pluginId, PluginPopupIndex, "Run utPLSQL Test", "PACKAGE");
137-
PlsqlDeveloperUtPlsqlPlugin.createPopupItem(pluginId, PluginPopupIndexWithCoverage, "Run Code Coverage",
138-
"PACKAGE");
130+
createPopupItem(pluginId, PluginPopupIndex, "Run utPLSQL Test", "PACKAGE");
131+
createPopupItem(pluginId, PluginPopupIndexWithCoverage, "Run Code Coverage", "PACKAGE");
139132
}
140133

141134
[DllExport("CanClose", CallingConvention = CallingConvention.Cdecl)]
@@ -158,44 +151,34 @@ public static void RegisterCallback(int index, IntPtr function)
158151
switch (index)
159152
{
160153
case 11:
161-
PlsqlDeveloperUtPlsqlPlugin.connected =
162-
(IdeConnected)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeConnected));
154+
connected = (IdeConnected)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeConnected));
163155
break;
164156
case 12:
165-
PlsqlDeveloperUtPlsqlPlugin.getConnectionInfo =
166-
(IdeGetConnectionInfo)Marshal.GetDelegateForFunctionPointer(function,
157+
getConnectionInfo = (IdeGetConnectionInfo)Marshal.GetDelegateForFunctionPointer(function,
167158
typeof(IdeGetConnectionInfo));
168159
break;
169160
case 20:
170-
PlsqlDeveloperUtPlsqlPlugin.createWindow =
171-
(IdeCreateWindow)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeCreateWindow));
161+
createWindow = (IdeCreateWindow)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeCreateWindow));
172162
break;
173163
case 69:
174-
PlsqlDeveloperUtPlsqlPlugin.createPopupItem =
175-
(IdeCreatePopupItem)Marshal.GetDelegateForFunctionPointer(function,
176-
typeof(IdeCreatePopupItem));
164+
createPopupItem = (IdeCreatePopupItem)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeCreatePopupItem));
177165
break;
178166
case 74:
179-
PlsqlDeveloperUtPlsqlPlugin.getPopupObject =
180-
(IdeGetPopupObject)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetPopupObject));
167+
getPopupObject = (IdeGetPopupObject)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetPopupObject));
181168
break;
182169
case 79:
183-
PlsqlDeveloperUtPlsqlPlugin.getObjectSource =
184-
(IdeGetObjectSource)Marshal.GetDelegateForFunctionPointer(function,
185-
typeof(IdeGetObjectSource));
170+
getObjectSource = (IdeGetObjectSource)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetObjectSource));
186171
break;
187172
case 150:
188-
PlsqlDeveloperUtPlsqlPlugin.createToolButton =
189-
(IdeCreateToolButton)Marshal.GetDelegateForFunctionPointer(function,
190-
typeof(IdeCreateToolButton));
173+
createToolButton = (IdeCreateToolButton)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeCreateToolButton));
191174
break;
192175
}
193176
}
194177

195178
[DllExport("OnConnectionChange", CallingConvention = CallingConvention.Cdecl)]
196179
public static void OnConnectionChange()
197180
{
198-
PlsqlDeveloperUtPlsqlPlugin.ConnectToDatabase();
181+
ConnectToDatabase();
199182
}
200183

201184
[DllExport("CreateMenuItem", CallingConvention = CallingConvention.Cdecl)]
@@ -221,7 +204,7 @@ public static void OnMenuClick(int index)
221204
{
222205
if (index == PluginMenuIndexAllTests)
223206
{
224-
if (PlsqlDeveloperUtPlsqlPlugin.connected())
207+
if (connected())
225208
{
226209
var testResultWindow = new TestRunnerWindow(_testRunner, _plugin);
227210
Windows.Add(testResultWindow);
@@ -230,7 +213,7 @@ public static void OnMenuClick(int index)
230213
}
231214
else if (index == PluginMenuIndexAllTestsWithCoverage)
232215
{
233-
if (PlsqlDeveloperUtPlsqlPlugin.connected())
216+
if (connected())
234217
{
235218
var testResultWindow = new TestRunnerWindow(_testRunner, _plugin);
236219
Windows.Add(testResultWindow);
@@ -239,9 +222,9 @@ public static void OnMenuClick(int index)
239222
}
240223
else if (index == PluginPopupIndex)
241224
{
242-
if (PlsqlDeveloperUtPlsqlPlugin.connected())
225+
if (connected())
243226
{
244-
PlsqlDeveloperUtPlsqlPlugin.getPopupObject(out IntPtr type, out IntPtr owner, out IntPtr name, out IntPtr subType);
227+
getPopupObject(out IntPtr type, out IntPtr owner, out IntPtr name, out IntPtr subType);
245228

246229
var testResultWindow = new TestRunnerWindow(_testRunner, _plugin);
247230
Windows.Add(testResultWindow);
@@ -251,9 +234,9 @@ public static void OnMenuClick(int index)
251234
}
252235
else if (index == PluginPopupIndexWithCoverage)
253236
{
254-
if (PlsqlDeveloperUtPlsqlPlugin.connected())
237+
if (connected())
255238
{
256-
PlsqlDeveloperUtPlsqlPlugin.getPopupObject(out IntPtr type, out IntPtr owner, out IntPtr name, out IntPtr subType);
239+
getPopupObject(out IntPtr type, out IntPtr owner, out IntPtr name, out IntPtr subType);
257240

258241
var testResultWindow = new TestRunnerWindow(_testRunner, _plugin);
259242
Windows.Add(testResultWindow);
@@ -274,8 +257,8 @@ public static string About()
274257

275258
public void OpenPackageBody(string owner, string name)
276259
{
277-
IntPtr source = getObjectSource("PACKAGE BODY", owner, name);
278-
PlsqlDeveloperUtPlsqlPlugin.createWindow(3, Marshal.PtrToStringAnsi(source), false);
260+
var source = getObjectSource("PACKAGE BODY", owner, name);
261+
createWindow(3, Marshal.PtrToStringAnsi(source), false);
279262
}
280263

281264
private static void ConnectToDatabase()
@@ -284,9 +267,9 @@ private static void ConnectToDatabase()
284267
{
285268
_testRunner.Close();
286269

287-
if (PlsqlDeveloperUtPlsqlPlugin.connected())
270+
if (connected())
288271
{
289-
PlsqlDeveloperUtPlsqlPlugin.getConnectionInfo(out IntPtr ptrUsername, out IntPtr ptrPassword, out IntPtr ptrDatabase);
272+
getConnectionInfo(out IntPtr ptrUsername, out IntPtr ptrPassword, out IntPtr ptrDatabase);
290273

291274
username = Marshal.PtrToStringAnsi(ptrUsername);
292275
password = Marshal.PtrToStringAnsi(ptrPassword);

PlsqlDeveloperUtPlsqlPlugin/utPLSQL.Lib.Test/RealTimeTestRunnerTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public void TestToscamtest()
1515

1616
testRunner.RunTestsWithCoverage(type: "USER", owner: null, name: "toscamtest", procedure: null, coverageSchemas: "'toscam'", "'pa_m720','pa_m770'", null);
1717

18-
List<@event> events = new List<@event>();
18+
var events = new List<@event>();
1919
testRunner.ConsumeResult(@event =>
2020
{
2121
events.Add(@event);

0 commit comments

Comments
 (0)