mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-22 04:05:39 +00:00
Merge remote-tracking branch 'origin/GP-2217_ghidra1_DataTypePreviewFix'
This commit is contained in:
commit
e66e5b70e9
@ -125,13 +125,11 @@ public class CompositeDataTypeHTMLRepresentation extends HTMLDataTypeRepresentat
|
||||
|
||||
DataType dataType = dataTypeComponent.getDataType();
|
||||
String type = "<unknown type>";
|
||||
DataType locatableType = null;
|
||||
if (dataType != null) {
|
||||
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) {
|
||||
// Prevent a ridiculous number of components from consuming all memory.
|
||||
list.add(
|
||||
@ -344,7 +342,7 @@ public class CompositeDataTypeHTMLRepresentation extends HTMLDataTypeRepresentat
|
||||
|
||||
String type = truncateAsNecessary(line.getType());
|
||||
type = friendlyEncodeHTML(type);
|
||||
return wrapStringInColor(type, line.getTypeColor());
|
||||
return wrapStringInColor(type, color);
|
||||
}
|
||||
|
||||
// overridden to return truncated text by default
|
||||
|
@ -15,11 +15,13 @@
|
||||
*/
|
||||
package ghidra.app.util.html;
|
||||
|
||||
import static ghidra.util.HTMLUtilities.*;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ghidra.app.util.ToolTipUtils;
|
||||
import ghidra.app.util.datatype.DataTypeUrl;
|
||||
import ghidra.app.util.html.diff.DataTypeDiff;
|
||||
import ghidra.app.util.html.diff.DataTypeDiffBuilder;
|
||||
import ghidra.program.model.data.*;
|
||||
@ -130,9 +132,8 @@ public class FunctionDataTypeHTMLRepresentation extends HTMLDataTypeRepresentati
|
||||
String displayName = dataType.getDisplayName();
|
||||
String name = var.getName();
|
||||
|
||||
DataType locatableType = getLocatableDataType(dataType);
|
||||
lines.add(new VariableTextLine(HTMLUtilities.friendlyEncodeHTML(displayName),
|
||||
HTMLUtilities.friendlyEncodeHTML(name), locatableType));
|
||||
HTMLUtilities.friendlyEncodeHTML(name), dataType));
|
||||
}
|
||||
|
||||
return lines;
|
||||
@ -242,23 +243,15 @@ public class FunctionDataTypeHTMLRepresentation extends HTMLDataTypeRepresentati
|
||||
|
||||
private static String generateTypeText(VariableTextLine line, boolean trim) {
|
||||
|
||||
String type = line.getVariableType();
|
||||
if (trim) {
|
||||
type = StringUtilities.trimMiddle(type, ToolTipUtils.LINE_LENGTH);
|
||||
}
|
||||
type = wrapStringInColor(type, line.getVariableTypeColor());
|
||||
|
||||
if (!line.hasUniversalId()) {
|
||||
return type;
|
||||
Color color = line.getVariableTypeColor();
|
||||
DataType dt = line.getDataType();
|
||||
if (dt != null) {
|
||||
return generateTypeName(dt, color, trim);
|
||||
}
|
||||
|
||||
//
|
||||
// Markup the name with info for later hyperlink capability, as needed by the client
|
||||
//
|
||||
DataType dataType = line.getDataType();
|
||||
DataTypeUrl url = new DataTypeUrl(dataType);
|
||||
String wrapped = HTMLUtilities.wrapWithLinkPlaceholder(type, url.toString());
|
||||
return wrapped;
|
||||
String type = truncateAsNecessary(line.getVariableType());
|
||||
type = friendlyEncodeHTML(type);
|
||||
return wrapStringInColor(type, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -288,31 +288,6 @@ public abstract class HTMLDataTypeRepresentation {
|
||||
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;
|
||||
|
||||
/** Default constructor for those who promise to later set the HTML text */
|
||||
|
Loading…
Reference in New Issue
Block a user