-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from gdgd009xcd/JOHANNES240616
## [v0.8.12] - 2024-06-20
- Loading branch information
Showing
8 changed files
with
145 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...rc/main/java/org/zaproxy/zap/extension/customactivescan/view/InterfaceCompoStyleName.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.zaproxy.zap.extension.customactivescan.view; | ||
|
||
public interface InterfaceCompoStyleName { | ||
public void setStyleName(String name); | ||
public String getStyleName(); | ||
} |
65 changes: 65 additions & 0 deletions
65
.../src/main/java/org/zaproxy/zap/extension/customactivescan/view/ManagedStyledDocument.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package org.zaproxy.zap.extension.customactivescan.view; | ||
|
||
|
||
import org.zaproxy.zap.extension.customactivescan.CastUtils; | ||
|
||
import javax.swing.text.*; | ||
import java.awt.*; | ||
|
||
@SuppressWarnings({"unchecked", "serial"}) | ||
public class ManagedStyledDocument extends DefaultStyledDocument { | ||
private final static org.apache.logging.log4j.Logger LOGGER4J = | ||
org.apache.logging.log4j.LogManager.getLogger(); | ||
public ManagedStyledDocument(StyleContext styleContext) { | ||
super(styleContext); | ||
} | ||
/** | ||
* set Character attributes except component positions. | ||
* @param startPos | ||
* @param length | ||
* @param style | ||
* @param replace | ||
*/ | ||
public void setCharacterAttributeExceptComponents(int startPos, int length, Style style, boolean replace) { | ||
int exStartPos = startPos; | ||
int exEndPos = startPos + length; | ||
int curStart = exStartPos; | ||
int curEnd = -1; | ||
for(int pos = exStartPos; pos < exEndPos; pos++) { | ||
Element elm = this.getCharacterElement(pos); | ||
if (elm != null) { | ||
AttributeSet attrSet = elm.getAttributes(); | ||
if (attrSet != null) { | ||
String styleName = ""; | ||
Object name = attrSet.getAttribute(AttributeSet.NameAttribute); | ||
if (name != null) { | ||
// character's styleName is overwrited each calling setCharacterAttributes. | ||
// so below styleName is changed from original. | ||
styleName = CastUtils.castToType(name); | ||
} | ||
Component compo = StyleConstants.getComponent(attrSet); | ||
if (compo != null) { | ||
if (compo instanceof InterfaceCompoStyleName) { | ||
InterfaceCompoStyleName compoStyle = (InterfaceCompoStyleName) compo; | ||
styleName = compoStyle.getStyleName(); | ||
} | ||
curEnd = pos; | ||
int len = curEnd - curStart; | ||
if (len > 0) { | ||
this.setCharacterAttributes(curStart, len, style, replace); | ||
LOGGER4J.debug("curStart,curEnd:" + curStart + "," + curEnd + " style:[" + style.getName() + "]"); | ||
} | ||
LOGGER4J.debug("pos=" + pos + " except component name[" + styleName + "]"); | ||
curStart = curEnd + 1; | ||
} | ||
} | ||
} | ||
} | ||
if (curStart < exEndPos) { | ||
curEnd = exEndPos; | ||
int len = curEnd - curStart; | ||
this.setCharacterAttributes(curStart, len, style, replace); | ||
LOGGER4J.debug("curStart,curEnd:" + curStart + "," + curEnd + " style:[" + style.getName() + "]"); | ||
} | ||
} | ||
} |
72 changes: 31 additions & 41 deletions
72
...vescan/src/main/java/org/zaproxy/zap/extension/customactivescan/view/RegexTestDialog.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...mactivescan/src/main/java/org/zaproxy/zap/extension/customactivescan/view/StyleLabel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.zaproxy.zap.extension.customactivescan.view; | ||
|
||
import javax.swing.*; | ||
|
||
@SuppressWarnings({"unchecked", "serial"}) | ||
public class StyleLabel extends JLabel implements InterfaceCompoStyleName { | ||
private String styleName; | ||
public StyleLabel(String styleName, String value){ | ||
super(value); | ||
this.styleName = styleName; | ||
} | ||
|
||
@Override | ||
public void setStyleName(String name) { | ||
this.styleName = name; | ||
} | ||
|
||
@Override | ||
public String getStyleName() { | ||
return this.styleName; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters