Projects STRLCPY LoggerPlusPlus Commits a808aaf2
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■
    src/main/java/com/nccgroup/loggerplusplus/logview/LogEntryMenu.java
    skipped 10 lines
    11 11   
    12 12  import javax.swing.*;
    13 13  import java.awt.event.ActionEvent;
     14 +import java.net.MalformedURLException;
     15 +import java.net.URL;
    14 16  import java.util.HashMap;
    15 17  import java.util.UUID;
    16 18   
    skipped 73 lines
    90 92   
    91 93   this.add(new JPopupMenu.Separator());
    92 94   final boolean inScope = LoggerPlusPlus.callbacks.isInScope(entry.url);
    93  - JMenuItem scope = new JMenuItem(new AbstractAction((inScope ? "Remove from scope" : "Add to scope")) {
    94  - @Override
    95  - public void actionPerformed(ActionEvent actionEvent) {
    96  - if(inScope)
     95 + JMenuItem scopeItem;
     96 + if(!inScope){
     97 + scopeItem = new JMenu("Add to scope");
     98 + scopeItem.add(new JMenuItem(new AbstractAction("Domain") {
     99 + @Override
     100 + public void actionPerformed(ActionEvent actionEvent) {
     101 + try {
     102 + URL domainURL = new URL(entry.protocol, entry.host, entry.targetPort, "");
     103 + LoggerPlusPlus.callbacks.includeInScope(domainURL);
     104 + } catch (MalformedURLException e) {
     105 + JOptionPane.showMessageDialog(scopeItem, "Could not build URL for scope entry. Sorry!", "Add to scope", JOptionPane.ERROR_MESSAGE);
     106 + }
     107 + }
     108 + }));
     109 + scopeItem.add(new JMenuItem(new AbstractAction("Domain + Path") {
     110 + @Override
     111 + public void actionPerformed(ActionEvent actionEvent) {
     112 + LoggerPlusPlus.callbacks.includeInScope(entry.url);
     113 + }
     114 + }));
     115 + }else{
     116 + scopeItem = new JMenuItem(new AbstractAction("Remove from scope") {
     117 + @Override
     118 + public void actionPerformed(ActionEvent actionEvent) {
    97 119   LoggerPlusPlus.callbacks.excludeFromScope(entry.url);
    98  - else
    99  - LoggerPlusPlus.callbacks.includeInScope(entry.url);
    100  - }
    101  - });
    102  - this.add(scope);
     120 + }
     121 + });
     122 + }
     123 + this.add(scopeItem);
    103 124   
    104 125   this.add(new JPopupMenu.Separator());
    105 126   
    skipped 73 lines
Please wait...
Page is in error, reload to recover