Skip to content

Commit 442ba28

Browse files
committed
Fixed coding style.
Hidden new menu items when not available, this way we also fix some crashes because they were not making proper checks. Fixed copy tree recursion, it was excluding inherited and static members. Fixed copying to clipboard on elements with empty values or ids.
1 parent fe5e14c commit 442ba28

File tree

4 files changed

+650
-680
lines changed

4 files changed

+650
-680
lines changed

External/Plugins/FlashDebugger/Controls/DataTree/ValueNode.cs

Lines changed: 115 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ public int ChildrenShowLimit
1111
get { return m_ChildrenShowLimit; }
1212
set { m_ChildrenShowLimit = value; }
1313
}
14-
public static bool m_ShowFullClasspaths = true;
15-
public static bool m_ShowObjectIDs = true;
14+
public static bool m_ShowFullClasspaths = true;
15+
public static bool m_ShowObjectIDs = true;
1616

1717
protected Value m_Value;
1818
private bool m_bEditing = false;
1919

20-
/// <summary>
21-
/// Get the display value based on user's preferences
22-
/// </summary>
20+
/// <summary>
21+
/// Get the display value based on user's preferences
22+
/// </summary>
2323
public override string Value
2424
{
2525
get
@@ -32,41 +32,41 @@ public override string Value
3232
string temp = null;
3333
if (type == VariableType_.MOVIECLIP || type == VariableType_.OBJECT)
3434
{
35-
string typeStr = "";
36-
if (m_ShowFullClasspaths)
37-
{
38-
// return class type with classpath
39-
typeStr = m_Value.getTypeName().replaceAll("::", ".").ToString();
40-
41-
}else
42-
{
43-
// return class type without classpath
44-
typeStr = Strings.AfterLast(m_Value.getTypeName().ToString(), "::", true);
45-
}
46-
47-
// show / hide IDs
48-
if (m_ShowObjectIDs)
49-
{
50-
typeStr = typeStr.Replace("@", " @");
51-
}else
52-
{
53-
typeStr = Strings.Before(typeStr, "@");
54-
}
35+
string typeStr = "";
36+
if (m_ShowFullClasspaths)
37+
{
38+
// return class type with classpath
39+
typeStr = m_Value.getTypeName().replaceAll("::", ".").ToString();
40+
}
41+
else
42+
{
43+
// return class type without classpath
44+
typeStr = Strings.AfterLast(m_Value.getTypeName().ToString(), "::", true);
45+
}
46+
47+
// show / hide IDs
48+
if (m_ShowObjectIDs)
49+
{
50+
typeStr = typeStr.Replace("@", " @");
51+
}
52+
else
53+
{
54+
typeStr = Strings.Before(typeStr, "@");
55+
}
5556

56-
// rename array
57-
if (typeStr.StartsWith("[]"))
58-
{
59-
typeStr = typeStr.Replace("[]", "Array");
60-
}
57+
// rename array
58+
if (typeStr.StartsWith("[]"))
59+
{
60+
typeStr = typeStr.Replace("[]", "Array");
61+
}
6162

62-
// rename vector
63-
else if (typeStr.StartsWith("__AS3__.vec.Vector.<"))
64-
{
65-
typeStr = typeStr.Replace("__AS3__.vec.Vector.<", "Vector.<");
66-
}
63+
// rename vector
64+
else if (typeStr.StartsWith("__AS3__.vec.Vector.<"))
65+
{
66+
typeStr = typeStr.Replace("__AS3__.vec.Vector.<", "Vector.<");
67+
}
6768

68-
return typeStr;
69-
69+
return typeStr;
7070
}
7171
else if (type == VariableType_.NUMBER)
7272
{
@@ -95,7 +95,7 @@ public override string Value
9595
{
9696
if (m_Value.getValueAsObject() != null)
9797
{
98-
return "\"" + escape(m_Value.ToString()) + "\"";
98+
return "\"" + Escape(m_Value.ToString()) + "\"";
9999
}
100100
}
101101
else if (type == VariableType_.NULL)
@@ -109,7 +109,7 @@ public override string Value
109109
temp = m_Value.ToString();
110110
if (!m_bEditing)
111111
{
112-
temp = escape(temp);
112+
temp = Escape(temp);
113113
}
114114
return temp;
115115
}
@@ -119,111 +119,98 @@ public override string Value
119119
}
120120
}
121121

122-
/// <summary>
123-
/// Get the full classpath of the value, eg: "flash.display.MovieClip"
124-
/// </summary>
125-
public string ClassPath
126-
{
127-
get
128-
{
129-
130-
//return m_Value.getClassHierarchy(false).replaceAll("::", ".");
122+
/// <summary>
123+
/// Get the full classpath of the value, eg: "flash.display.MovieClip"
124+
/// </summary>
125+
public string ClassPath
126+
{
127+
get
128+
{
131129

132-
if (m_Value == null)
133-
{
134-
return null;
135-
}
136-
int type = m_Value.getType();
137-
if (type == VariableType_.MOVIECLIP || type == VariableType_.OBJECT)
138-
{
139-
string typeStr = Strings.Before(m_Value.getTypeName().replaceAll("::", "."), "@");
130+
//return m_Value.getClassHierarchy(false).replaceAll("::", ".");
140131

141-
if (typeStr == "[]")
142-
{
143-
return "Array";
144-
}
145-
return typeStr;
132+
if (m_Value == null)
133+
{
134+
return null;
135+
}
136+
int type = m_Value.getType();
137+
if (type == VariableType_.MOVIECLIP || type == VariableType_.OBJECT)
138+
{
139+
string typeStr = Strings.Before(m_Value.getTypeName().replaceAll("::", "."), "@");
146140

147-
}
148-
else if (type == VariableType_.NUMBER)
149-
{
150-
return "Number";
151-
}
152-
else if (type == VariableType_.BOOLEAN)
153-
{
154-
return "Boolean";
155-
}
156-
else if (type == VariableType_.STRING)
157-
{
158-
return "String";
159-
}
160-
else if (type == VariableType_.NULL)
161-
{
162-
return "null";
163-
}
164-
else if (type == VariableType_.FUNCTION)
165-
{
166-
return "Function";
167-
}
168-
return null;
169-
}
170-
set
171-
{
172-
throw new NotSupportedException();
173-
}
141+
if (typeStr == "[]")
142+
{
143+
return "Array";
144+
}
145+
return typeStr;
174146

175-
}
147+
}
148+
else if (type == VariableType_.NUMBER)
149+
{
150+
return "Number";
151+
}
152+
else if (type == VariableType_.BOOLEAN)
153+
{
154+
return "Boolean";
155+
}
156+
else if (type == VariableType_.STRING)
157+
{
158+
return "String";
159+
}
160+
else if (type == VariableType_.NULL)
161+
{
162+
return "null";
163+
}
164+
else if (type == VariableType_.FUNCTION)
165+
{
166+
return "Function";
167+
}
168+
return null;
169+
}
170+
}
176171

177-
/// <summary>
178-
/// Get the object ID with the class name
179-
/// </summary>
180-
public string ID
181-
{
182-
get
183-
{
184-
if (m_Value != null)
185-
{
186-
int type = m_Value.getType();
187-
if (type == VariableType_.MOVIECLIP || type == VariableType_.OBJECT)
188-
{
189-
return m_Value.getTypeName().replaceAll("::", ".").replaceAll("@", " - ").ToString();
190-
}
191-
else if (type == VariableType_.FUNCTION)
192-
{
193-
return "Function - " + m_Value.ToString();
194-
}
195-
}
196-
return "";
197-
}
198-
}
172+
/// <summary>
173+
/// Get the object ID with the class name
174+
/// </summary>
175+
public string Id
176+
{
177+
get
178+
{
179+
if (m_Value != null)
180+
{
181+
int type = m_Value.getType();
182+
if (type == VariableType_.MOVIECLIP || type == VariableType_.OBJECT)
183+
{
184+
return m_Value.getTypeName().replaceAll("::", ".").replaceAll("@", " - ").ToString();
185+
}
186+
else if (type == VariableType_.FUNCTION)
187+
{
188+
return "Function - " + m_Value.ToString();
189+
}
190+
}
191+
return "";
192+
}
193+
}
199194

200-
/// <summary>
201-
/// Check if the value is a primitive type (int, Number, String, Boolean)
202-
/// </summary>
203-
public bool IsPrimitive
195+
/// <summary>
196+
/// Check if the value is a primitive type (int, Number, String, Boolean)
197+
/// </summary>
198+
public bool IsPrimitive
204199
{
205200
get
206201
{
207-
if (m_Value == null)
202+
if (m_Value == null)
208203
{
209204
return false;
210205
}
211206
int type = m_Value.getType();
212-
if (type == VariableType_.NUMBER || type == VariableType_.BOOLEAN ||
213-
type == VariableType_.STRING || type == VariableType_.NULL)
214-
{
215-
return true;
216-
}
217-
return false;
218-
}
219-
set
220-
{
221-
throw new NotSupportedException();
207+
return type == VariableType_.NUMBER || type == VariableType_.BOOLEAN ||
208+
type == VariableType_.STRING || type == VariableType_.NULL;
222209
}
223210
}
224211

225-
226-
private string escape(string text)
212+
213+
private string Escape(string text)
227214
{
228215
text = text.Replace("\\", "\\\\");
229216
text = text.Replace("\"", "\\\"");

0 commit comments

Comments
 (0)