mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
introduced a separate icon for breakpoints being validated - IDEA-190220
This commit is contained in:
+17
-15
@@ -2,10 +2,7 @@
|
||||
package com.intellij.debugger.ui.breakpoints;
|
||||
|
||||
import com.intellij.debugger.*;
|
||||
import com.intellij.debugger.engine.DebugProcess;
|
||||
import com.intellij.debugger.engine.DebugProcessImpl;
|
||||
import com.intellij.debugger.engine.DebuggerManagerThreadImpl;
|
||||
import com.intellij.debugger.engine.JVMNameUtil;
|
||||
import com.intellij.debugger.engine.*;
|
||||
import com.intellij.debugger.engine.events.DebuggerCommandImpl;
|
||||
import com.intellij.debugger.engine.requests.RequestManagerImpl;
|
||||
import com.intellij.debugger.impl.DebuggerContextImpl;
|
||||
@@ -24,7 +21,6 @@ import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.jsp.JspFile;
|
||||
import com.intellij.ui.classFilter.ClassFilter;
|
||||
import com.intellij.xdebugger.XDebuggerManager;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
|
||||
@@ -105,7 +101,6 @@ public abstract class BreakpointWithHighlighter<P extends JavaBreakpointProperti
|
||||
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
updateUI();
|
||||
updateGutter();
|
||||
}
|
||||
|
||||
return this;
|
||||
@@ -113,6 +108,12 @@ public abstract class BreakpointWithHighlighter<P extends JavaBreakpointProperti
|
||||
|
||||
private void updateCaches(@Nullable DebugProcessImpl debugProcess) {
|
||||
myIcon = calcIcon(debugProcess);
|
||||
if (isVisible() && isValid() && debugProcess != null && myXBreakpoint instanceof XLineBreakpoint) {
|
||||
JavaDebugProcess process = debugProcess.getXdebugProcess();
|
||||
if (process != null) {
|
||||
process.getSession().updateBreakpointPresentation(((XLineBreakpoint)myXBreakpoint), myIcon, myInvalidMessage);
|
||||
}
|
||||
}
|
||||
myClassName = JVMNameUtil.getSourcePositionClassDisplayName(debugProcess, getSourcePosition());
|
||||
myPackageName = JVMNameUtil.getSourcePositionPackageDisplayName(debugProcess, getSourcePosition());
|
||||
}
|
||||
@@ -150,6 +151,16 @@ public abstract class BreakpointWithHighlighter<P extends JavaBreakpointProperti
|
||||
return getVerifiedIcon(muted);
|
||||
}
|
||||
|
||||
return getValidatingIcon(muted);
|
||||
}
|
||||
|
||||
protected Icon getValidatingIcon(boolean muted) {
|
||||
if (myXBreakpoint != null) {
|
||||
Icon icon = myXBreakpoint.getType().getValidatingIcon();
|
||||
if (icon != null) {
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
return getSetIcon(muted);
|
||||
}
|
||||
|
||||
@@ -277,7 +288,6 @@ public abstract class BreakpointWithHighlighter<P extends JavaBreakpointProperti
|
||||
DebugProcessImpl debugProcess = context.getDebugProcess();
|
||||
if (debugProcess == null || !debugProcess.isAttached()) {
|
||||
updateCaches(null);
|
||||
updateGutter();
|
||||
}
|
||||
else {
|
||||
debugProcess.getManagerThread().invoke(new DebuggerCommandImpl() {
|
||||
@@ -288,20 +298,12 @@ public abstract class BreakpointWithHighlighter<P extends JavaBreakpointProperti
|
||||
updateCaches(debugProcess);
|
||||
}
|
||||
});
|
||||
DebuggerInvocationUtil.swingInvokeLater(myProject, BreakpointWithHighlighter.this::updateGutter);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateGutter() {
|
||||
if (isVisible() && isValid()) {
|
||||
XDebuggerManager.getInstance(myProject).getBreakpointManager()
|
||||
.updateBreakpointPresentation((XLineBreakpoint)myXBreakpoint, getIcon(), myInvalidMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAt(@NotNull Document document, int offset) {
|
||||
final VirtualFile file = FileDocumentManager.getInstance().getFile(document);
|
||||
int line = document.getLineNumber(offset);
|
||||
|
||||
+6
@@ -68,6 +68,12 @@ public class JavaFieldBreakpointType extends JavaLineBreakpointTypeBase<JavaFiel
|
||||
return AllIcons.Debugger.Db_muted_disabled_field_breakpoint;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Icon getValidatingIcon() {
|
||||
return AllIcons.Debugger.Db_validate_field_breakpoint;
|
||||
}
|
||||
|
||||
//@Override
|
||||
protected String getHelpID() {
|
||||
return HelpID.FIELD_WATCHPOINTS;
|
||||
|
||||
+10
@@ -2,6 +2,7 @@
|
||||
package com.intellij.debugger.ui.breakpoints;
|
||||
|
||||
import com.intellij.debugger.engine.DebuggerUtils;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
@@ -19,10 +20,13 @@ import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.java.debugger.JavaDebuggerEditorsProvider;
|
||||
import org.jetbrains.java.debugger.breakpoints.JavaBreakpointFiltersPanel;
|
||||
import org.jetbrains.java.debugger.breakpoints.properties.JavaBreakpointProperties;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Base class for java line-connected exceptions (line, method, field)
|
||||
* @author egor
|
||||
@@ -60,6 +64,12 @@ public abstract class JavaLineBreakpointTypeBase<P extends JavaBreakpointPropert
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Icon getValidatingIcon() {
|
||||
return AllIcons.Debugger.Db_validate_breakpoint;
|
||||
}
|
||||
|
||||
protected static boolean canPutAtElement(@NotNull final VirtualFile file,
|
||||
final int line,
|
||||
@NotNull Project project,
|
||||
|
||||
+6
@@ -56,6 +56,12 @@ public class JavaMethodBreakpointType extends JavaLineBreakpointTypeBase<JavaMet
|
||||
return AllIcons.Debugger.Db_muted_disabled_method_breakpoint;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Icon getValidatingIcon() {
|
||||
return AllIcons.Debugger.Db_validate_method_breakpoint;
|
||||
}
|
||||
|
||||
//@Override
|
||||
protected String getHelpID() {
|
||||
return HelpID.METHOD_BREAKPOINTS;
|
||||
|
||||
@@ -116,6 +116,11 @@ public abstract class XBreakpointType<B extends XBreakpoint<P>, P extends XBreak
|
||||
return AllIcons.Debugger.Db_muted_disabled_breakpoint;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Icon getValidatingIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the icon which is shown for a dependent breakpoint until its master breakpoint is reached
|
||||
*/
|
||||
|
||||
@@ -395,7 +395,9 @@ public class XDebugSessionImpl implements XDebugSession {
|
||||
boolean active = ReadAction.compute(() -> isBreakpointActive(b));
|
||||
if (active) {
|
||||
synchronized (myRegisteredBreakpoints) {
|
||||
myRegisteredBreakpoints.put(b, new CustomizedBreakpointPresentation());
|
||||
CustomizedBreakpointPresentation validatingPresentation = new CustomizedBreakpointPresentation();
|
||||
validatingPresentation.setIcon(b.getType().getValidatingIcon());
|
||||
myRegisteredBreakpoints.put(b, validatingPresentation);
|
||||
}
|
||||
handler.registerBreakpoint(b);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user