diff --git a/lib/jsyntaxpane-0.9.5.jar b/lib/jsyntaxpane-0.9.5.jar index 195c89e1b..2af05d4b8 100644 Binary files a/lib/jsyntaxpane-0.9.5.jar and b/lib/jsyntaxpane-0.9.5.jar differ diff --git a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/components/LineMarkerPainter.java b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/components/LineMarkerPainter.java new file mode 100644 index 000000000..a5479cb9d --- /dev/null +++ b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/components/LineMarkerPainter.java @@ -0,0 +1,14 @@ +package jsyntaxpane.components; + +import java.awt.Graphics; + +/** + * + * @author JPEXS + */ +public interface LineMarkerPainter { + + public void installLineMarker(LineNumbersBreakpointsRuler ruler); + + public void paintLineMarker(Graphics g, int line, int x, int lineY, int textY, int lineHeight, boolean currentLine, int maxLines); +} diff --git a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/components/LineNumbersBreakpointsRuler.java b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/components/LineNumbersBreakpointsRuler.java index 126c38661..b1b86c7be 100644 --- a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/components/LineNumbersBreakpointsRuler.java +++ b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/components/LineNumbersBreakpointsRuler.java @@ -13,11 +13,17 @@ */ package jsyntaxpane.components; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; import java.awt.Point; +import java.awt.Rectangle; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JEditorPane; import javax.swing.text.BadLocationException; +import jsyntaxpane.SyntaxView; import jsyntaxpane.actions.ActionUtils; /** @@ -29,6 +35,9 @@ public class LineNumbersBreakpointsRuler extends LineNumbersRuler { @Override public void install(final JEditorPane editor) { super.install(editor); + if (editor instanceof LineMarkerPainter) { + ((LineMarkerPainter) editor).installLineMarker(this); + } removeMouseListener(mouseListener); mouseListener = new MouseAdapter() { @@ -54,4 +63,38 @@ public class LineNumbersBreakpointsRuler extends LineNumbersRuler { addMouseListener(mouseListener); } + @Override + public void paintComponent(Graphics g) { + super.paintComponent(g); + if (editor instanceof LineMarkerPainter) { + FontMetrics fontMetrics = editor.getFontMetrics(editor.getFont()); + int lh = fontMetrics.getHeight(); + Rectangle bounds = g.getClipBounds(); + int minY = bounds.y; + int maxY = minY + bounds.height; + int maxLines = ActionUtils.getLineCount(editor); + Insets insets = getInsets(); + + int currentLine = -1; + try { + // get current line, and add one as we start from 1 for the display + currentLine = ActionUtils.getLineNumber(editor, editor.getCaretPosition()) + 1; + } catch (BadLocationException ex) { + // this wont happen, even if it does, we can ignore it and we will not have + // a current line to worry about... + } + + for (int line = 1; line <= maxLines; line++) { + int y = line * lh; + if (y < minY) { + continue; + } + if (y - lh > maxY) { + break; + } + ((LineMarkerPainter) editor).paintLineMarker(g, line, insets.left, y - lh + fontMetrics.getDescent() - 1, y, lh, currentLine == line, maxLines); + } + } + } + } diff --git a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/components/LineNumbersRuler.java b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/components/LineNumbersRuler.java index 78db74374..5c57438b3 100644 --- a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/components/LineNumbersRuler.java +++ b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/components/LineNumbersRuler.java @@ -75,7 +75,7 @@ public class LineNumbersRuler extends JPanel private Status status; private final static int HEIGHT = Integer.MAX_VALUE - 1000000; // Text component this TextTextLineNumber component is in sync with - private JEditorPane editor; + protected JEditorPane editor; //JPEXS: changed to protected private int minimumDisplayDigits = 2; // Keep history information to reduce the number of times the component // needs to be repainted diff --git a/src/com/jpexs/decompiler/flash/gui/DebugPanel.java b/src/com/jpexs/decompiler/flash/gui/DebugPanel.java index 3f9d334c0..20f4427cd 100644 --- a/src/com/jpexs/decompiler/flash/gui/DebugPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/DebugPanel.java @@ -111,6 +111,18 @@ public class DebugPanel extends JPanel { } }); + Main.getDebugHandler().addConnectionListener(new DebuggerHandler.ConnectionListener() { + + @Override + public void connected() { + } + + @Override + public void disconnected() { + refresh(); + } + }); + Main.getDebugHandler().addBreakListener(listener = new DebuggerHandler.BreakListener() { @Override diff --git a/src/com/jpexs/decompiler/flash/gui/DebuggerHandler.java b/src/com/jpexs/decompiler/flash/gui/DebuggerHandler.java index 6b12b847f..efbe2c6b0 100644 --- a/src/com/jpexs/decompiler/flash/gui/DebuggerHandler.java +++ b/src/com/jpexs/decompiler/flash/gui/DebuggerHandler.java @@ -92,6 +92,10 @@ public class DebuggerHandler implements DebugConnectionListener { public synchronized void removeBreakPoint(String scriptName, int line) { if (isBreakpointInvalid(scriptName, line)) { + invalidBreakPointMap.get(scriptName).remove(line); + if (invalidBreakPointMap.get(scriptName).isEmpty()) { + invalidBreakPointMap.remove(scriptName); + } return; } if (isBreakpointToAdd(scriptName, line)) { @@ -160,7 +164,7 @@ public class DebuggerHandler implements DebugConnectionListener { public boolean addBreakPoint(String scriptName, int line) { synchronized (this) { - Logger.getLogger(DebuggerHandler.class.getName()).log(Level.INFO, "adding bp " + scriptName + ":" + line); + Logger.getLogger(DebuggerHandler.class.getName()).log(Level.FINE, "adding bp " + scriptName + ":" + line); if (isBreakpointToRemove(scriptName, line)) { toRemoveBPointMap.get(scriptName).remove(line); if (toRemoveBPointMap.get(scriptName).isEmpty()) { @@ -169,18 +173,18 @@ public class DebuggerHandler implements DebugConnectionListener { } if (isBreakpointConfirmed(scriptName, line)) { - Logger.getLogger(DebuggerHandler.class.getName()).log(Level.INFO, "bp " + scriptName + ":" + line + " already confirmed"); + Logger.getLogger(DebuggerHandler.class.getName()).log(Level.FINE, "bp " + scriptName + ":" + line + " already confirmed"); return true; } if (isBreakpointInvalid(scriptName, line)) { - Logger.getLogger(DebuggerHandler.class.getName()).log(Level.INFO, "bp " + scriptName + ":" + line + " already invalid"); + Logger.getLogger(DebuggerHandler.class.getName()).log(Level.FINE, "bp " + scriptName + ":" + line + " already invalid"); return false; } if (!toAddBPointMap.containsKey(scriptName)) { toAddBPointMap.put(scriptName, new TreeSet<>()); } toAddBPointMap.get(scriptName).add(line); - Logger.getLogger(DebuggerHandler.class.getName()).log(Level.INFO, "bp " + scriptName + ":" + line + " added to todo"); + Logger.getLogger(DebuggerHandler.class.getName()).log(Level.FINE, "bp " + scriptName + ":" + line + " added to todo"); } try { sendBreakPoints(false); @@ -328,6 +332,15 @@ public class DebuggerHandler implements DebugConnectionListener { commands.disconnect(); } commands = null; + synchronized (this) { + for (String scriptName : confirmedPointMap.keySet()) { + if (!toAddBPointMap.containsKey(scriptName)) { + toAddBPointMap.put(scriptName, new TreeSet<>()); + } + toAddBPointMap.get(scriptName).addAll(confirmedPointMap.get(scriptName)); + } + confirmedPointMap.clear(); + } for (ConnectionListener l : clisteners) { l.disconnected(); } diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index f5524a5c3..11235ab41 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -426,7 +426,7 @@ public class Main { } public synchronized static boolean toggleBreakPoint(String scriptName, int line) { - if (getDebugHandler().isBreakpointToAdd(scriptName, line) || getDebugHandler().isBreakpointConfirmed(scriptName, line)) { + if (getDebugHandler().isBreakpointToAdd(scriptName, line) || getDebugHandler().isBreakpointConfirmed(scriptName, line) || getDebugHandler().isBreakpointInvalid(scriptName, line)) { getDebugHandler().removeBreakPoint(scriptName, line); return false; } else { diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index b105367b4..0932db1c6 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -2838,10 +2838,10 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se public void clearDebuggerColors() { if (abcPanel != null) { - abcPanel.decompiledTextArea.removeColorMarkerOnAllLines(DecompiledEditorPane.FG_IP_COLOR, DecompiledEditorPane.BG_IP_COLOR, DecompiledEditorPane.PRIORITY_IP); + abcPanel.decompiledTextArea.removeColorMarkerOnAllLines(DecompiledEditorPane.IP_MARKER); } if (actionPanel != null) { - actionPanel.decompiledEditor.removeColorMarkerOnAllLines(DecompiledEditorPane.FG_IP_COLOR, DecompiledEditorPane.BG_IP_COLOR, DecompiledEditorPane.PRIORITY_IP); + actionPanel.decompiledEditor.removeColorMarkerOnAllLines(DecompiledEditorPane.IP_MARKER); } } diff --git a/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java b/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java index fb8b07177..060d7b898 100644 --- a/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -45,15 +45,6 @@ import com.jpexs.decompiler.flash.gui.SearchPanel; import com.jpexs.decompiler.flash.gui.TagEditorPanel; import com.jpexs.decompiler.flash.gui.View; import com.jpexs.decompiler.flash.gui.DebugPanel; -import static com.jpexs.decompiler.flash.gui.abc.DecompiledEditorPane.BG_BREAKPOINT_COLOR; -import static com.jpexs.decompiler.flash.gui.abc.DecompiledEditorPane.BG_INVALID_BREAKPOINT_COLOR; -import static com.jpexs.decompiler.flash.gui.abc.DecompiledEditorPane.BG_IP_COLOR; -import static com.jpexs.decompiler.flash.gui.abc.DecompiledEditorPane.FG_BREAKPOINT_COLOR; -import static com.jpexs.decompiler.flash.gui.abc.DecompiledEditorPane.FG_INVALID_BREAKPOINT_COLOR; -import static com.jpexs.decompiler.flash.gui.abc.DecompiledEditorPane.FG_IP_COLOR; -import static com.jpexs.decompiler.flash.gui.abc.DecompiledEditorPane.PRIORITY_BREAKPOINT; -import static com.jpexs.decompiler.flash.gui.abc.DecompiledEditorPane.PRIORITY_INVALID_BREAKPOINT; -import static com.jpexs.decompiler.flash.gui.abc.DecompiledEditorPane.PRIORITY_IP; import com.jpexs.decompiler.flash.gui.controls.JPersistentSplitPane; import com.jpexs.decompiler.flash.gui.controls.NoneSelectedButtonGroup; import com.jpexs.decompiler.flash.gui.editor.DebuggableEditorPane; diff --git a/src/com/jpexs/decompiler/flash/gui/editor/DebuggableEditorPane.java b/src/com/jpexs/decompiler/flash/gui/editor/DebuggableEditorPane.java index 29763fea9..15cdecf5e 100644 --- a/src/com/jpexs/decompiler/flash/gui/editor/DebuggableEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/editor/DebuggableEditorPane.java @@ -17,29 +17,44 @@ package com.jpexs.decompiler.flash.gui.editor; import com.jpexs.decompiler.flash.gui.Main; +import com.jpexs.decompiler.flash.gui.View; +import java.awt.BasicStroke; import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; import java.util.Set; import jsyntaxpane.components.BreakPointListener; +import jsyntaxpane.components.LineMarkerPainter; +import jsyntaxpane.components.LineNumbersBreakpointsRuler; /** * * @author JPEXS */ -public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakPointListener { +public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakPointListener, LineMarkerPainter { - public static final Color BG_BREAKPOINT_COLOR = new Color(0xfc, 0x9d, 0x9f); - public static final Color FG_BREAKPOINT_COLOR = null; - public static final int PRIORITY_BREAKPOINT = 20; + private static final Color BG_CURRENT_COLOR = new Color(0xd6, 0xe8, 0xe2); + private static final Color BG_RULER_COLOR = new Color(0xe9, 0xe8, 0xe2); - public static final Color BG_IP_COLOR = new Color(0xbd, 0xe6, 0xaa); - public static final Color FG_IP_COLOR = null; - public static final int PRIORITY_IP = 0; + private static final Color BG_BREAKPOINT_COLOR = new Color(0xfc, 0x9d, 0x9f); + private static final Color FG_BREAKPOINT_COLOR = null; + private static final int PRIORITY_BREAKPOINT = 20; - public static final Color BG_INVALID_BREAKPOINT_COLOR = new Color(0xdc, 0xdc, 0xd8); - public static final Color FG_INVALID_BREAKPOINT_COLOR = null; - public static final int PRIORITY_INVALID_BREAKPOINT = 10; + private static final Color BG_IP_COLOR = new Color(0xbd, 0xe6, 0xaa); + private static final Color FG_IP_COLOR = null; + private static final int PRIORITY_IP = 0; + + private static final Color BG_INVALID_BREAKPOINT_COLOR = new Color(0xdc, 0xdc, 0xd8); + private static final Color FG_INVALID_BREAKPOINT_COLOR = null; + private static final int PRIORITY_INVALID_BREAKPOINT = 10; + + public static final LineMarker BREAKPOINT_MARKER = new LineMarker(FG_BREAKPOINT_COLOR, BG_BREAKPOINT_COLOR, PRIORITY_BREAKPOINT); + public static final LineMarker IP_MARKER = new LineMarker(FG_IP_COLOR, BG_IP_COLOR, PRIORITY_IP); + public static final LineMarker INVALID_BREAKPOINT_MARKER = new LineMarker(FG_INVALID_BREAKPOINT_COLOR, BG_INVALID_BREAKPOINT_COLOR, PRIORITY_INVALID_BREAKPOINT); protected String scriptName = null; + private LineNumbersBreakpointsRuler ruler; public synchronized void setScriptName(String scriptName) { this.scriptName = scriptName; @@ -51,23 +66,23 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP return; } boolean on = Main.toggleBreakPoint(scriptName, line); - removeColorMarker(line, FG_INVALID_BREAKPOINT_COLOR, BG_INVALID_BREAKPOINT_COLOR, PRIORITY_INVALID_BREAKPOINT); + removeColorMarker(line, INVALID_BREAKPOINT_MARKER); if (on) { if (Main.isBreakPointValid(scriptName, line)) { - addColorMarker(line, FG_BREAKPOINT_COLOR, BG_BREAKPOINT_COLOR, PRIORITY_BREAKPOINT); + addColorMarker(line, BREAKPOINT_MARKER); } else { - addColorMarker(line, FG_INVALID_BREAKPOINT_COLOR, BG_INVALID_BREAKPOINT_COLOR, PRIORITY_INVALID_BREAKPOINT); + addColorMarker(line, INVALID_BREAKPOINT_MARKER); } } else { - removeColorMarker(line, FG_BREAKPOINT_COLOR, BG_BREAKPOINT_COLOR, PRIORITY_BREAKPOINT); - removeColorMarker(line, FG_INVALID_BREAKPOINT_COLOR, BG_INVALID_BREAKPOINT_COLOR, PRIORITY_INVALID_BREAKPOINT); + removeColorMarker(line, BREAKPOINT_MARKER); + removeColorMarker(line, INVALID_BREAKPOINT_MARKER); } } public synchronized void refreshMarkers() { - removeColorMarkerOnAllLines(FG_BREAKPOINT_COLOR, BG_BREAKPOINT_COLOR, PRIORITY_BREAKPOINT); - removeColorMarkerOnAllLines(FG_INVALID_BREAKPOINT_COLOR, BG_INVALID_BREAKPOINT_COLOR, PRIORITY_INVALID_BREAKPOINT); - removeColorMarkerOnAllLines(FG_IP_COLOR, BG_IP_COLOR, PRIORITY_IP); + removeColorMarkerOnAllLines(BREAKPOINT_MARKER); + removeColorMarkerOnAllLines(INVALID_BREAKPOINT_MARKER); + removeColorMarkerOnAllLines(IP_MARKER); if (scriptName == null) { return; @@ -77,15 +92,15 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP for (int line : bkptLines) { if (Main.isBreakPointValid(scriptName, line)) { - addColorMarker(line, FG_BREAKPOINT_COLOR, BG_BREAKPOINT_COLOR, PRIORITY_BREAKPOINT); + addColorMarker(line, BREAKPOINT_MARKER); } else { - addColorMarker(line, FG_INVALID_BREAKPOINT_COLOR, BG_INVALID_BREAKPOINT_COLOR, PRIORITY_INVALID_BREAKPOINT); + addColorMarker(line, INVALID_BREAKPOINT_MARKER); } } int ip = Main.getIp(scriptName); String ipPath = Main.getIpClass(); if (ip > 0 && ipPath != null && ipPath.equals(scriptName)) { - addColorMarker(ip, FG_IP_COLOR, BG_IP_COLOR, PRIORITY_IP); + addColorMarker(ip, IP_MARKER); } } @@ -99,4 +114,71 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP return scriptName; } + @Override + public void paintLineMarker(Graphics g, int line, int x, int lineY, int textY, int lineHeight, boolean currentLine, int maxLines) { + + if (currentLine) { + g.setColor(BG_CURRENT_COLOR); + } else { + g.setColor(View.getDefaultBackgroundColor()); + } + int h = lineHeight; + if (line == 1) { + h += lineY; + } + if (line == maxLines) { + h = getHeight() - lineY; + } + g.fillRect(0, line == 1 ? 0 : lineY, getWidth(), h); + + ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + ((Graphics2D) g).setStroke(new BasicStroke(0.5f)); + + boolean drawText = true; + if (hasColorMarker(line, INVALID_BREAKPOINT_MARKER)) { + g.setColor(BG_INVALID_BREAKPOINT_COLOR); + g.fillOval(x + 5, textY - 10, 10, 10); + g.setColor(Color.black); + g.drawOval(x + 5, textY - 10, 10, 10); + drawText = false; + } else if (hasColorMarker(line, BREAKPOINT_MARKER)) { + g.setColor(BG_BREAKPOINT_COLOR); + g.fillOval(x + 5, textY - 10, 10, 10); + g.setColor(Color.black); + g.drawOval(x + 5, textY - 10, 10, 10); + drawText = false; + } + if (hasColorMarker(line, IP_MARKER)) { + int mx = x + 10; + g.setColor(BG_IP_COLOR); + g.fillPolygon(new int[]{mx, mx + 10, mx}, new int[]{textY - 10, textY - 5, textY}, 3); + g.setColor(Color.black); + g.drawPolygon(new int[]{mx, mx + 10, mx}, new int[]{textY - 10, textY - 5, textY}, 3); + drawText = false; + } + if (drawText) { + g.setColor(getForeground()); + g.drawString("" + line, x, textY); + } + + } + + @Override + public void installLineMarker(LineNumbersBreakpointsRuler ruler) { + this.ruler = ruler; + } + + @Override + public void addColorMarker(int line, LineMarker lm) { + super.addColorMarker(line, lm); + ruler.repaint(); + } + + @Override + public void removeColorMarker(int line, LineMarker lm) { + super.removeColorMarker(line, lm); + ruler.repaint(); + } + } diff --git a/src/com/jpexs/decompiler/flash/gui/editor/LineMarkedEditorPane.java b/src/com/jpexs/decompiler/flash/gui/editor/LineMarkedEditorPane.java index d558924ad..062e1dbd5 100644 --- a/src/com/jpexs/decompiler/flash/gui/editor/LineMarkedEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/editor/LineMarkedEditorPane.java @@ -82,7 +82,7 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan private Color bgColor; private Color color; private FgPainter fgPainter; - private int line; + //private int line; private int priority; public FgPainter getForegroundPainter() { @@ -91,11 +91,10 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan @Override public String toString() { - return bgColor.toString() + " line " + line + " priority:" + priority; + return bgColor.toString() + " priority:" + priority; } - public LineMarker(int line, Color color, Color bgColor, int priority) { - this.line = line; + public LineMarker(Color color, Color bgColor, int priority) { this.bgColor = bgColor; this.color = color; this.priority = priority; @@ -109,7 +108,6 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan int hash = 5; hash = 17 * hash + Objects.hashCode(this.bgColor); hash = 17 * hash + Objects.hashCode(this.color); - hash = 17 * hash + this.line; return hash; } @@ -125,10 +123,7 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan if (!Objects.equals(this.bgColor, other.bgColor)) { return false; } - if (!Objects.equals(this.color, other.color)) { - return false; - } - return this.line == other.line; + return (Objects.equals(this.color, other.color)); } public Color getBgColor() { @@ -156,41 +151,45 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan repaint(); } - public void removeColorMarker(int line, Color color, Color bgColor, int priority) { + public boolean hasColorMarker(int line, LineMarker lm) { + if (lineMarkers.containsKey(line)) { + return lineMarkers.get(line).contains(lm); + } + return false; + } + + public void removeColorMarker(int line, LineMarker lm) { if (lineMarkers.containsKey(line)) { - LineMarker lm = new LineMarker(line, color, bgColor, priority); lineMarkers.get(line).remove(lm); } - repaint(); + getParent().repaint(); } - public void removeColorMarkerOnAllLines(Color color, Color bgColor, int priority) { + public void removeColorMarkerOnAllLines(LineMarker lm) { for (int line : lineMarkers.keySet()) { - removeColorMarker(line, color, bgColor, priority); + removeColorMarker(line, lm); } } - public void toggleColorMarker(int line, Color color, Color bgColor, int priority) { + public void toggleColorMarker(int line, LineMarker lm) { if (!lineMarkers.containsKey(line)) { - addColorMarker(line, color, bgColor, priority); + addColorMarker(line, lm); } else { - LineMarker m = new LineMarker(line, color, bgColor, priority); - if (lineMarkers.get(line).contains(m)) { - removeColorMarker(line, color, bgColor, priority); + if (lineMarkers.get(line).contains(lm)) { + removeColorMarker(line, lm); } else { - addColorMarker(line, color, bgColor, priority); + addColorMarker(line, lm); } } - repaint(); + getParent().repaint(); } - public void addColorMarker(int line, Color color, Color bgColor, int priority) { + public void addColorMarker(int line, LineMarker lm) { if (!lineMarkers.containsKey(line)) { lineMarkers.put(line, Collections.synchronizedSortedSet(new TreeSet<>())); } - LineMarker marker = new LineMarker(line, color, bgColor, priority); - lineMarkers.get(line).add(marker); - repaint(); + lineMarkers.get(line).add(lm); + getParent().repaint(); } public int getLine() {