Java Code Examples for ghidra.program.model.listing.CodeUnit#REPEATABLE_COMMENT
The following examples show how to use
ghidra.program.model.listing.CodeUnit#REPEATABLE_COMMENT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommentWindowPlugin.java From ghidra with Apache License 2.0 | 6 votes |
private int getCommentType(int type) { if (type == ChangeManager.DOCR_PRE_COMMENT_CHANGED) { return CodeUnit.PRE_COMMENT; } if (type == ChangeManager.DOCR_POST_COMMENT_CHANGED) { return CodeUnit.POST_COMMENT; } if (type == ChangeManager.DOCR_EOL_COMMENT_CHANGED) { return CodeUnit.EOL_COMMENT; } if (type == ChangeManager.DOCR_PLATE_COMMENT_CHANGED) { return CodeUnit.PLATE_COMMENT; } if ((type == ChangeManager.DOCR_REPEATABLE_COMMENT_CHANGED) || (type == ChangeManager.DOCR_REPEATABLE_COMMENT_ADDED) || (type == ChangeManager.DOCR_REPEATABLE_COMMENT_REMOVED) || (type == ChangeManager.DOCR_REPEATABLE_COMMENT_CREATED) || (type == ChangeManager.DOCR_REPEATABLE_COMMENT_DELETED)) { return CodeUnit.REPEATABLE_COMMENT; } return -1; }
Example 2
Source File: CommentsDialog.java From ghidra with Apache License 2.0 | 6 votes |
void setCommentType(int type) { switch (type) { case CodeUnit.EOL_COMMENT: tab.setSelectedIndex(0); break; case CodeUnit.PRE_COMMENT: tab.setSelectedIndex(1); break; case CodeUnit.POST_COMMENT: tab.setSelectedIndex(2); break; case CodeUnit.PLATE_COMMENT: tab.setSelectedIndex(3); break; case CodeUnit.REPEATABLE_COMMENT: tab.setSelectedIndex(4); break; } }
Example 3
Source File: CommentHistoryDialog.java From ghidra with Apache License 2.0 | 6 votes |
private JPanel buildMainPanel() { JPanel mainPanel = new JPanel(new BorderLayout()); tabbedPane = new JTabbedPane(); mainPanel.add(tabbedPane); eolPanel = new CommentHistoryPanel(CodeUnit.EOL_COMMENT); prePanel = new CommentHistoryPanel(CodeUnit.PRE_COMMENT); postPanel = new CommentHistoryPanel(CodeUnit.POST_COMMENT); platePanel = new CommentHistoryPanel(CodeUnit.PLATE_COMMENT); repeatablePanel = new CommentHistoryPanel(CodeUnit.REPEATABLE_COMMENT); JScrollPane sp = new JScrollPane(eolPanel); JViewport vp = sp.getViewport(); Dimension d = vp.getPreferredSize(); sp.getViewport().setPreferredSize(new Dimension(500, d.height*7)); tabbedPane.addTab(" EOL Comment ",sp); tabbedPane.addTab(" Pre Comment ",new JScrollPane(prePanel)); tabbedPane.addTab(" Post Comment ",new JScrollPane(postPanel)); tabbedPane.addTab(" Plate Comment ",new JScrollPane(platePanel)); tabbedPane.addTab(" Repeatable Comment ", new JScrollPane(repeatablePanel)); tabbedPane.addChangeListener(this); return mainPanel; }
Example 4
Source File: CommentMerger.java From ghidra with Apache License 2.0 | 6 votes |
private int getCodeUnitCommentType(int programMergeCommentType) { switch (programMergeCommentType) { case ProgramMergeFilter.PLATE_COMMENTS: return CodeUnit.PLATE_COMMENT; case ProgramMergeFilter.PRE_COMMENTS: return CodeUnit.PRE_COMMENT; case ProgramMergeFilter.EOL_COMMENTS: return CodeUnit.EOL_COMMENT; case ProgramMergeFilter.REPEATABLE_COMMENTS: return CodeUnit.REPEATABLE_COMMENT; case ProgramMergeFilter.POST_COMMENTS: return CodeUnit.POST_COMMENT; default: return -1; } }
Example 5
Source File: CommentFieldLocation.java From ghidra with Apache License 2.0 | 5 votes |
/** * Checks that the type is a valid comment type. * @throws IllegalArgumentException if this doesn't have a valid comment type. */ protected void validateType() { if (type != CodeUnit.PRE_COMMENT && type != CodeUnit.POST_COMMENT && type != CodeUnit.EOL_COMMENT && type != CodeUnit.REPEATABLE_COMMENT && type != CodeUnit.PLATE_COMMENT && type != CodeUnit.NO_COMMENT) { throw new IllegalArgumentException( "The comment type was " + type + ", but it must be from 0 to 4"); } }
Example 6
Source File: CommentType.java From ghidra with Apache License 2.0 | 5 votes |
/** * Get the comment type from the current location. If the cursor * is not over a comment, then just return EOL as the default. * @param cu * @param loc * @param defaultCommentType * @return comment type */ public static int getCommentType(CodeUnit cu, ProgramLocation loc, int defaultCommentType) { if (loc instanceof CommentFieldLocation) { CommentFieldLocation cfLoc = (CommentFieldLocation) loc; return cfLoc.getCommentType(); } else if (loc instanceof PlateFieldLocation) { return CodeUnit.PLATE_COMMENT; } else if (loc instanceof FunctionRepeatableCommentFieldLocation) { return CodeUnit.REPEATABLE_COMMENT; } else if (cu != null) { if (cu.getComment(CodeUnit.PRE_COMMENT) != null) { return CodeUnit.PRE_COMMENT; } if (cu.getComment(CodeUnit.POST_COMMENT) != null) { return CodeUnit.POST_COMMENT; } if (cu.getComment(CodeUnit.EOL_COMMENT) != null) { return CodeUnit.EOL_COMMENT; } if (cu.getComment(CodeUnit.PLATE_COMMENT) != null) { return CodeUnit.PLATE_COMMENT; } if (cu.getComment(CodeUnit.REPEATABLE_COMMENT) != null) { return CodeUnit.REPEATABLE_COMMENT; } } return defaultCommentType; }
Example 7
Source File: CommentHistoryDialog.java From ghidra with Apache License 2.0 | 5 votes |
private CommentHistoryPanel getHistoryPanel(int commentType) { switch(commentType) { case CodeUnit.EOL_COMMENT: return eolPanel; case CodeUnit.PRE_COMMENT: return prePanel; case CodeUnit.POST_COMMENT: return postPanel; case CodeUnit.PLATE_COMMENT: return platePanel; case CodeUnit.REPEATABLE_COMMENT: return repeatablePanel; } return null; }
Example 8
Source File: CommentsPlugin.java From ghidra with Apache License 2.0 | 4 votes |
private void updatePopupPath(DockingAction action, String actionString, ProgramLocation loc) { String endString = ""; if (action == historyAction) { endString = "..."; } if (loc instanceof FunctionRepeatableCommentFieldLocation) { action.getPopupMenuData().setMenuPath( new String[] { "Comments", actionString + " Repeatable Comment" + endString }); return; } if (loc instanceof PlateFieldLocation) { action.getPopupMenuData().setMenuPath( new String[] { "Comments", actionString + " Plate Comment" + endString }); return; } CommentFieldLocation cfLoc = (CommentFieldLocation) loc; int type = cfLoc.getCommentType(); switch (type) { case CodeUnit.PRE_COMMENT: action.getPopupMenuData().setMenuPath( new String[] { "Comments", actionString + " Pre-Comment" + endString }); break; case CodeUnit.POST_COMMENT: action.getPopupMenuData().setMenuPath( new String[] { "Comments", actionString + " Post-Comment" + endString }); break; case CodeUnit.EOL_COMMENT: action.getPopupMenuData().setMenuPath( new String[] { "Comments", actionString + " EOL Comment" + endString }); break; case CodeUnit.REPEATABLE_COMMENT: action.getPopupMenuData().setMenuPath( new String[] { "Comments", actionString + " Repeatable Comment" + endString }); break; } }
Example 9
Source File: RepeatableCommentMarkupType.java From ghidra with Apache License 2.0 | 4 votes |
@Override protected int getCodeUnitCommentType() { return CodeUnit.REPEATABLE_COMMENT; }
Example 10
Source File: RepeatableCommentFieldLocation.java From ghidra with Apache License 2.0 | 2 votes |
/** * Construct a new RepeatableCommentFieldLocation. * * @param program the program of the location * @param addr the address of the codeunit. * @param componentPath the componentPath of the codeUnit * @param comment comment text for the particular comment indicated by the address, subtype, and reference address. * @param row the line within the Eol comment. * @param charOffset the character position on the line within the comment line. * @param currentCommentRow the row index relative to the beginning of the repeatable comment * as displayed in the Eol comment field. */ public RepeatableCommentFieldLocation(Program program, Address addr, int[] componentPath, String[] comment, int row, int charOffset, int currentCommentRow) { super(program, addr, componentPath, comment, CodeUnit.REPEATABLE_COMMENT, row, charOffset); this.currentCommentRow = currentCommentRow; }