Skip to content

Commit eccc3bf

Browse files
committed
Find references, minor edits.
1 parent cb920c4 commit eccc3bf

2 files changed

Lines changed: 31 additions & 41 deletions

File tree

SSIS/FindVariableReferences.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public partial class FindVariableReferences : Form
1414
private FindVariables finder = new FindVariables();
1515
private Package package;
1616
private Variable variable;
17+
private bool parameterMode;
1718

1819
public FindVariableReferences()
1920
{
@@ -30,11 +31,16 @@ public FindVariableReferences()
3031

3132
public void Show(Package package, Variable variable)
3233
{
33-
this.progressBar.Visible = true;
34+
if (parameterMode)
35+
this.Text = string.Format("Find parameter references - {0}", variable.QualifiedName);
36+
else
37+
this.Text = string.Format("Find variable references - {0}", variable.QualifiedName);
3438

3539
this.package = package;
3640
this.variable = variable;
3741

42+
this.progressBar.Visible = true;
43+
3844
InitializeTreeView();
3945

4046
stopwatch = new System.Diagnostics.Stopwatch();
@@ -45,8 +51,11 @@ public void Show(Package package, Variable variable)
4551

4652
public void Show(Package package, Parameter parameter)
4753
{
54+
parameterMode = true;
55+
4856
// Get the Variable object that is the same as the Parameter. A parameter is also an item in the Variables collection.
4957
Variable variable = package.Variables[parameter.ID];
58+
5059
this.Show(package, variable);
5160
}
5261

SSIS/FindVariables.cs

Lines changed: 21 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -172,30 +172,30 @@ private void AddNodeSafe(TreeNode parentNode, TreeNode childNode)
172172
}
173173
}
174174

175-
private int GetControlFlowImageIndex(string creationName)
175+
private int GetControlFlowImageIndex(string key)
176176
{
177177
if (treeView == null)
178178
return -1;
179179

180-
int imageIndex = treeView.ImageList.Images.IndexOfKey(creationName);
180+
int imageIndex = treeView.ImageList.Images.IndexOfKey(key);
181181
if (imageIndex == -1)
182182
{
183-
AddImageListItem(creationName, PackageHelper.ControlFlowInfos[creationName].Icon);
183+
AddImageListItem(key, PackageHelper.ControlFlowInfos[key].Icon);
184184
imageIndex = treeView.ImageList.Images.Count - 1;
185185
}
186186

187187
return imageIndex;
188188
}
189189

190-
private int GetComponentImageIndex(string creationName)
190+
private int GetComponentImageIndex(string key)
191191
{
192192
if (treeView == null)
193193
return -1;
194194

195-
int imageIndex = treeView.ImageList.Images.IndexOfKey(creationName);
195+
int imageIndex = treeView.ImageList.Images.IndexOfKey(key);
196196
if (imageIndex == -1)
197197
{
198-
AddImageListItem(creationName, PackageHelper.ComponentInfos[creationName].Icon);
198+
AddImageListItem(key, PackageHelper.ComponentInfos[key].Icon);
199199
imageIndex = treeView.ImageList.Images.Count - 1;
200200
}
201201

@@ -250,7 +250,6 @@ private void ProcessObject(object component, TreeNode parentNode)
250250
return;
251251
}
252252

253-
254253
Package package = component as Package;
255254
if (package != null)
256255
{
@@ -266,7 +265,7 @@ private void ProcessObject(object component, TreeNode parentNode)
266265

267266
if (package == null)
268267
{
269-
int imageIndex = GetControlFlowImageIndex(container.CreationName);
268+
int imageIndex = GetControlFlowImageIndex(containerKey);
270269
parentNode = AddNode(parentNode, container.Name, imageIndex, component);
271270
taskHost = container as TaskHost;
272271
}
@@ -289,6 +288,7 @@ private void ProcessObject(object component, TreeNode parentNode)
289288
}
290289
else
291290
{
291+
// Package, Event Handlers etc
292292
ScanProperties(container as IDTSPropertiesProvider, parentNode);
293293
}
294294

@@ -305,13 +305,10 @@ private void ProcessObject(object component, TreeNode parentNode)
305305
EventsProvider eventsProvider = component as EventsProvider;
306306
if (eventsProvider != null)
307307
{
308-
TreeNode eventHandlers = AddFolder("EventHandlers", parentNode);
309-
int imageIndex = GetControlFlowImageIndex(PackageHelper.EventHandlerCreationName);
310-
308+
TreeNode eventsNode = AddFolder("EventHandlers", parentNode);
311309
foreach (DtsEventHandler eventhandler in eventsProvider.EventHandlers)
312310
{
313-
TreeNode node = AddNode(parentNode, eventhandler.Name, imageIndex, eventhandler);
314-
ProcessObject(eventhandler, node);
311+
ProcessObject(eventhandler, eventsNode);
315312
}
316313
}
317314

@@ -329,9 +326,7 @@ private void ProcessSequence(IDTSSequence sequence, TreeNode parentNode)
329326
return;
330327

331328
if (this.CancellationPending)
332-
{
333329
return;
334-
}
335330

336331
foreach (Executable executable in sequence.Executables)
337332
{
@@ -341,7 +336,8 @@ private void ProcessSequence(IDTSSequence sequence, TreeNode parentNode)
341336

342337
private void CheckConnectionManagers(Package package, TreeNode parentNode)
343338
{
344-
if (this.CancellationPending) return;
339+
if (this.CancellationPending)
340+
return;
345341

346342
TreeNode folder = AddFolder("Connections", parentNode);
347343

@@ -382,15 +378,10 @@ private void CheckTask(TaskHost taskHost, TreeNode parent)
382378
// Need to be wary of suffix, SSIS.ExecutePackageTask.3 for 2012, SSIS.ExecutePackageTask.4 for 2014 etc
383379
if (creatioName == string.Format("SSIS.{0}.{1}", ObjectTypeExecutePackageTask, SSISHelpers.CreationNameIndex))
384380
{
385-
//foundArgument.Type = typeof(ExecutePackageTask);
386-
//foundArgument.ObjectType = ObjectTypeExecutePackageTask;
387381
CheckExecutePackageTask(taskHost, parent);
388382
}
389383
else if (creatioName == string.Format("SSIS.Pipeline.{0}", SSISHelpers.CreationNameIndex))
390384
{
391-
//foundArgument.ObjectType = ObjectTypeDataFlowTask;
392-
//foundArgument.Type = typeof(MainPipe);
393-
//foundArgument.Icon = BIDSHelper.Resources.Versioned.DataFlow;
394385
MainPipe pipeline = taskHost.InnerObject as MainPipe;
395386
ScanPipeline(pipeline, parent);
396387
}
@@ -705,7 +696,7 @@ private void ScanProperties(IDTSPropertiesProvider provider, TreeNode parent)
705696
VariableFoundEventArgs foundArgument = new VariableFoundEventArgs();
706697
foundArgument.Match = match;
707698
OnRaiseVariableFound(foundArgument);
708-
AddNode(expressions, "Expression", GetImageIndex(IconKeyVariableExpression), new PropertyExpression(propertyName, expression, PackageHelper.GetTypeFromTypeCode(property.Type)), true);
699+
AddNode(expressions, propertyName, GetImageIndex(IconKeyVariableExpression), new PropertyExpression(propertyName, expression, PackageHelper.GetTypeFromTypeCode(property.Type)), true);
709700
}
710701
#endregion
711702

@@ -924,17 +915,7 @@ public VariableFoundEventArgs()
924915

925916
public VariableFoundEventArgs(VariableFoundEventArgs variableFoundEventArgs)
926917
{
927-
//this.Icon = variableFoundEventArgs.Icon;
928-
//this.Type = variableFoundEventArgs.Type;
929-
//this.IsExpression = variableFoundEventArgs.IsExpression;
930-
//this.ContainerID = variableFoundEventArgs.ContainerID;
931918
this.Match = variableFoundEventArgs.Match;
932-
//this.ObjectID = variableFoundEventArgs.ObjectID;
933-
//this.ObjectName = variableFoundEventArgs.ObjectName;
934-
//this.ObjectPath = variableFoundEventArgs.ObjectPath;
935-
//this.ObjectType = variableFoundEventArgs.ObjectType;
936-
//this.PropertyName = variableFoundEventArgs.PropertyName;
937-
//this.Value = variableFoundEventArgs.Value;
938919
}
939920

940921
public string Match { get; set; }
@@ -949,10 +930,10 @@ public PropertyExpression(string name, string expression, Type type)
949930
this.Type = type;
950931
}
951932

952-
[ParenthesizePropertyName(), Browsable(true), Category("General")]
933+
[ParenthesizePropertyName(), Browsable(true), Category("General"), Description("The name of the property hosting the expression.")]
953934
public string PropertyName { get; private set; }
954935

955-
[Category("General")]
936+
[Category("General"), Description("The expression text for the property expression.")]
956937
public object Expression { get; private set; }
957938

958939
[Category("General")]
@@ -963,7 +944,7 @@ public PropertyExpression(string name, string expression, Type type)
963944
public class PropertyInfo
964945
{
965946
// We don't need an IDTSCustomProperty100 version because that already does a good job of displaying both the property information AND the value.
966-
// DtsProper doesn't include the value, hence we use thso wrapper for teh TreeView tag object
947+
// DtsProperty doesn't include the value, hence we use this wrapper for the TreeView tag object
967948

968949
public PropertyInfo(DtsProperty property, object value)
969950
{
@@ -974,19 +955,19 @@ public PropertyInfo(DtsProperty property, object value)
974955
this.Set = property.Set;
975956
}
976957

977-
[ParenthesizePropertyName(), Browsable(true), Category("General")]
958+
[ParenthesizePropertyName(), Browsable(true), Category("General"), Description("The name of the property which contains the reference.")]
978959
public string Name { get; private set; }
979960

980-
[Category("General")]
961+
[Category("Accessors"), Description("Indicates whether the property value can be read.")]
981962
public bool Get { get; private set; }
982963

983-
[Category("General")]
964+
[Category("Accessors"), Description("Indicates whether the property value is changeable.")]
984965
public bool Set { get; private set; }
985966

986-
[Category("General")]
967+
[Category("General"), Description("THe property value, including the reference.")]
987968
public object Value { get; private set; }
988969

989-
[Category("General")]
970+
[Category("General"), Description("The data type of the property value.")]
990971
public Type Type { get; private set; }
991972
}
992973
}

0 commit comments

Comments
 (0)