mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-24 12:55:47 +08:00
Merge branch 'GP-5628_ghidra1_NewTypedefFix'
This commit is contained in:
+4
-3
@@ -896,9 +896,10 @@
|
||||
alt=""> Pointer to XYZ</B></I>. A new pointer will be created to the <I>XYZ</I> data
|
||||
type in the same category as the original data type.<SUP>*</SUP></P>
|
||||
|
||||
<P><IMG src="help/shared/note.png" alt=""><SUP>*</SUP>If you create a typedef or
|
||||
pointer to a data type in the <B>Built-in Data Type Manager</B>, the newly created type
|
||||
will be placed in program's data type manager at the root category.</P>
|
||||
<P><IMG src="help/shared/note.png" alt=""><SUP>*</SUP>A pointer will always be created
|
||||
within the same category where the base datatype is defined. When defining a
|
||||
pointer or typedef for a selected datatype from the <B>Built-in Data Type Manager</B>
|
||||
it will be created within the root category of the active program's datatype manager.</P>
|
||||
|
||||
<P>Structures can also be created directly in the <A href=
|
||||
"../CodeBrowserPlugin/CodeBrowser.htm#Code_Browser">Listing</A> view. See <A href=
|
||||
|
||||
+9
-19
@@ -24,9 +24,7 @@ import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.widgets.combobox.GhidraComboBox;
|
||||
import docking.widgets.label.GLabel;
|
||||
import docking.widgets.list.GComboBoxCellRenderer;
|
||||
import ghidra.app.plugin.core.datamgr.DataTypeManagerPlugin;
|
||||
import ghidra.app.plugin.core.datamgr.tree.ArchiveNode;
|
||||
import ghidra.app.plugin.core.datamgr.tree.DataTypeTreeNode;
|
||||
@@ -42,7 +40,7 @@ public class CreateTypeDefDialog extends DialogComponentProvider {
|
||||
private final Category category;
|
||||
private JTextField nameTextField;
|
||||
private DataTypeSelectionEditor dataTypeEditor;
|
||||
private GhidraComboBox<DataTypeManager> dataTypeManagerBox;
|
||||
private JTextField categoryField;
|
||||
private boolean isCancelled;
|
||||
private final TreePath selectedTreePath;
|
||||
|
||||
@@ -96,14 +94,15 @@ public class CreateTypeDefDialog extends DialogComponentProvider {
|
||||
|
||||
dataTypeEditor.setDefaultSelectedTreePath(selectedTreePath);
|
||||
|
||||
dataTypeManagerBox = new GhidraComboBox<>();
|
||||
dataTypeManagerBox
|
||||
.setRenderer(GComboBoxCellRenderer.createDefaultTextRenderer(dtm -> dtm.getName()));
|
||||
dataTypeManagerBox.addToModel(managers);
|
||||
dataTypeManagerBox.setSelectedItem(defaultDTM);
|
||||
categoryField = new JTextField(24);
|
||||
categoryField.setEditable(false);
|
||||
categoryField.setName("Category");
|
||||
|
||||
panel.add(new GLabel("Archive:"));
|
||||
panel.add(dataTypeManagerBox);
|
||||
String archiveName = category.getDataTypeManager().getName();
|
||||
categoryField.setText(archiveName + category.getCategoryPath().getPath());
|
||||
|
||||
panel.add(new GLabel("Category:"));
|
||||
panel.add(categoryField);
|
||||
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
|
||||
|
||||
@@ -162,12 +161,6 @@ public class CreateTypeDefDialog extends DialogComponentProvider {
|
||||
return;
|
||||
}
|
||||
|
||||
DataTypeManager manager = (DataTypeManager) dataTypeManagerBox.getSelectedItem();
|
||||
if (manager == null) {
|
||||
setStatusText("Must select an archive", MessageType.ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
clearStatusText();
|
||||
close();
|
||||
}
|
||||
@@ -198,7 +191,4 @@ public class CreateTypeDefDialog extends DialogComponentProvider {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
DataTypeManager getDataTypeManager() {
|
||||
return (DataTypeManager) dataTypeManagerBox.getSelectedItem();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ public class CreateTypeDefFromDialogAction extends AbstractTypeDefAction {
|
||||
|
||||
String name = dialog.getTypeDefName();
|
||||
DataType dataType = dialog.getDataType();
|
||||
DataTypeManager dataTypeManager = dialog.getDataTypeManager();
|
||||
DataTypeManager dataTypeManager = category.getDataTypeManager();
|
||||
|
||||
final DataTypeArchiveGTree gTree = (DataTypeArchiveGTree) context.getContextObject();
|
||||
CategoryPath categoryPath = category.getCategoryPath();
|
||||
|
||||
Reference in New Issue
Block a user