mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-31 21:06:03 +08:00
Merge remote-tracking branch 'origin/GP-2217_ghidra1_DataTypePreviewFix'
This commit is contained in:
+2
-4
@@ -125,13 +125,11 @@ public class CompositeDataTypeHTMLRepresentation extends HTMLDataTypeRepresentat
|
|||||||
|
|
||||||
DataType dataType = dataTypeComponent.getDataType();
|
DataType dataType = dataTypeComponent.getDataType();
|
||||||
String type = "<unknown type>";
|
String type = "<unknown type>";
|
||||||
DataType locatableType = null;
|
|
||||||
if (dataType != null) {
|
if (dataType != null) {
|
||||||
type = dataType.getDisplayName();
|
type = dataType.getDisplayName();
|
||||||
locatableType = getLocatableDataType(dataType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
list.add(new DataTypeLine(fieldName, type, comment, locatableType));
|
list.add(new DataTypeLine(fieldName, type, comment, dataType));
|
||||||
if (count++ >= MAX_COMPONENT_COUNT) {
|
if (count++ >= MAX_COMPONENT_COUNT) {
|
||||||
// Prevent a ridiculous number of components from consuming all memory.
|
// Prevent a ridiculous number of components from consuming all memory.
|
||||||
list.add(
|
list.add(
|
||||||
@@ -344,7 +342,7 @@ public class CompositeDataTypeHTMLRepresentation extends HTMLDataTypeRepresentat
|
|||||||
|
|
||||||
String type = truncateAsNecessary(line.getType());
|
String type = truncateAsNecessary(line.getType());
|
||||||
type = friendlyEncodeHTML(type);
|
type = friendlyEncodeHTML(type);
|
||||||
return wrapStringInColor(type, line.getTypeColor());
|
return wrapStringInColor(type, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// overridden to return truncated text by default
|
// overridden to return truncated text by default
|
||||||
|
|||||||
+11
-18
@@ -15,11 +15,13 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.util.html;
|
package ghidra.app.util.html;
|
||||||
|
|
||||||
|
import static ghidra.util.HTMLUtilities.*;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import ghidra.app.util.ToolTipUtils;
|
import ghidra.app.util.ToolTipUtils;
|
||||||
import ghidra.app.util.datatype.DataTypeUrl;
|
|
||||||
import ghidra.app.util.html.diff.DataTypeDiff;
|
import ghidra.app.util.html.diff.DataTypeDiff;
|
||||||
import ghidra.app.util.html.diff.DataTypeDiffBuilder;
|
import ghidra.app.util.html.diff.DataTypeDiffBuilder;
|
||||||
import ghidra.program.model.data.*;
|
import ghidra.program.model.data.*;
|
||||||
@@ -130,9 +132,8 @@ public class FunctionDataTypeHTMLRepresentation extends HTMLDataTypeRepresentati
|
|||||||
String displayName = dataType.getDisplayName();
|
String displayName = dataType.getDisplayName();
|
||||||
String name = var.getName();
|
String name = var.getName();
|
||||||
|
|
||||||
DataType locatableType = getLocatableDataType(dataType);
|
|
||||||
lines.add(new VariableTextLine(HTMLUtilities.friendlyEncodeHTML(displayName),
|
lines.add(new VariableTextLine(HTMLUtilities.friendlyEncodeHTML(displayName),
|
||||||
HTMLUtilities.friendlyEncodeHTML(name), locatableType));
|
HTMLUtilities.friendlyEncodeHTML(name), dataType));
|
||||||
}
|
}
|
||||||
|
|
||||||
return lines;
|
return lines;
|
||||||
@@ -242,23 +243,15 @@ public class FunctionDataTypeHTMLRepresentation extends HTMLDataTypeRepresentati
|
|||||||
|
|
||||||
private static String generateTypeText(VariableTextLine line, boolean trim) {
|
private static String generateTypeText(VariableTextLine line, boolean trim) {
|
||||||
|
|
||||||
String type = line.getVariableType();
|
Color color = line.getVariableTypeColor();
|
||||||
if (trim) {
|
DataType dt = line.getDataType();
|
||||||
type = StringUtilities.trimMiddle(type, ToolTipUtils.LINE_LENGTH);
|
if (dt != null) {
|
||||||
}
|
return generateTypeName(dt, color, trim);
|
||||||
type = wrapStringInColor(type, line.getVariableTypeColor());
|
|
||||||
|
|
||||||
if (!line.hasUniversalId()) {
|
|
||||||
return type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
String type = truncateAsNecessary(line.getVariableType());
|
||||||
// Markup the name with info for later hyperlink capability, as needed by the client
|
type = friendlyEncodeHTML(type);
|
||||||
//
|
return wrapStringInColor(type, color);
|
||||||
DataType dataType = line.getDataType();
|
|
||||||
DataTypeUrl url = new DataTypeUrl(dataType);
|
|
||||||
String wrapped = HTMLUtilities.wrapWithLinkPlaceholder(type, url.toString());
|
|
||||||
return wrapped;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
-25
@@ -288,31 +288,6 @@ public abstract class HTMLDataTypeRepresentation {
|
|||||||
return newList;
|
return newList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns a data type that can later be located */
|
|
||||||
protected static DataType getLocatableDataType(DataType type) {
|
|
||||||
|
|
||||||
if (type instanceof DefaultDataType) {
|
|
||||||
return null; // special case; for some reason this type has a universal ID
|
|
||||||
}
|
|
||||||
|
|
||||||
UniversalID id = type.getUniversalID();
|
|
||||||
if (id == null) {
|
|
||||||
type = DataTypeUtils.getNamedBaseDataType(type);
|
|
||||||
id = type.getUniversalID();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (id == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
DataTypeManager manager = type.getDataTypeManager();
|
|
||||||
if (manager == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String originalHTMLData;
|
protected String originalHTMLData;
|
||||||
|
|
||||||
/** Default constructor for those who promise to later set the HTML text */
|
/** Default constructor for those who promise to later set the HTML text */
|
||||||
|
|||||||
Reference in New Issue
Block a user