Skip to content

Commit

Permalink
some refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
aress31 committed Dec 23, 2023
1 parent fb32673 commit a7efb87
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
4 changes: 4 additions & 0 deletions src/main/java/burp/MyBurpExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,9 @@ public void initialize(MontoyaApi montoyaApi) {

montoyaApi.http().registerHttpHandler(mainTabGroup.getParametersPanel());
logging.logToOutput("HTTPListener registered");

// TODO: Complete the implementation of this feature.
// montoyaApi.userInterface().registerHttpRequestEditorProvider(mainTabGroup.getParametersPanel());
// logging.logToOutput("'MessageEditorTabFactory' registered");
}
}
11 changes: 6 additions & 5 deletions src/main/java/swurg/gui/views/AboutPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,27 +104,28 @@ private JPanel createButtonPanel() {
"<html>Follow me on <b>GitHub</b></html>", "https://github.com/aress31",
"<html>Submit a <b>pull request</b> or report a <b>bug</b></html>", "https://github.com/aress31/swurg");

for (Map.Entry<String, String> entry : buttonMap.entrySet()) {
JButton button = new JButton(entry.getKey());
buttonMap.forEach((key, value) -> {
JButton button = new JButton(key);
button.putClientProperty("html.disable", null);
button.setAlignmentX(CENTER_ALIGNMENT);

button.addActionListener(e -> {
try {
Desktop.getDesktop().browse(new URI(entry.getValue()));
Desktop.getDesktop().browse(new URI(value));
} catch (IOException | URISyntaxException ex) {
// Do nothing
}
});

if (entry.getKey().equals(buttonMap.keySet().iterator().next())) {
if (key.equals(buttonMap.keySet().iterator().next())) {
button.setBackground(UIManager.getColor("Burp.burpOrange"));
button.setFont(new Font(button.getFont().getName(), Font.BOLD, button.getFont().getSize()));
button.setForeground(UIManager.getColor("Burp.primaryButtonForeground"));
}

buttonPanel.add(button);
buttonPanel.add(Box.createVerticalStrut(4));
}
});

return buttonPanel;
}
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/swurg/gui/views/ParametersPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import burp.api.montoya.http.message.requests.HttpRequest;

Expand All @@ -27,7 +26,6 @@
import burp.api.montoya.http.handler.ResponseReceivedAction;
import burp.api.montoya.http.message.params.HttpParameter;
import burp.api.montoya.http.message.params.ParsedHttpParameter;
import burp.api.montoya.core.Annotations;
import burp.api.montoya.core.ToolType;

import burp.api.montoya.MontoyaApi;
Expand Down
8 changes: 2 additions & 6 deletions src/main/java/swurg/gui/views/ParserPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ private String browseForFile(JButton button) {
prefs.get("LAST_USED_FOLDER", new File(".").getAbsolutePath()));

// Add history to the file chooser
for (File file : fileChooser.getHistory()) {
fileChooser.addFileToHistory(file);
}
fileChooser.getHistory().forEach(file -> fileChooser.addFileToHistory(file));

// Find the top-level window (JFrame or JDialog) containing the button
Component topLevelWindow = SwingUtilities.getWindowAncestor(button);
Expand Down Expand Up @@ -180,9 +178,7 @@ public void actionPerformed(ActionEvent e) {
}

private void updateTableModel(List<RequestWithMetadata> requestWithMetadatas) {
SwingUtilities.invokeLater(() -> {
requestWithMetadatas.forEach(parserTableModel::addRow);
});
SwingUtilities.invokeLater(() -> requestWithMetadatas.forEach(parserTableModel::addRow));
}
}
}

0 comments on commit a7efb87

Please sign in to comment.