Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,13 @@
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

/**
* Class DebuggerAction
*
* @author Jeka
*/
public abstract class DebuggerAction extends AnAction {
private static final Set<String> POPUP_PLACES = Set.of(
DebuggerActions.EVALUATION_DIALOG_POPUP,
DebuggerActions.FRAME_PANEL_POPUP,
DebuggerActions.WATCH_PANEL_POPUP,
DebuggerActions.INSPECT_PANEL_POPUP
);

private static final DebuggerTreeNodeImpl[] EMPTY_TREE_NODE_ARRAY = new DebuggerTreeNodeImpl[0];

protected DebuggerAction(@Nonnull LocalizeValue text) {
Expand Down Expand Up @@ -129,10 +121,6 @@ public static DebuggerStateManager getContextManager(DataContext dataContext) {
return panel == null ? null : panel.getContextManager();
}

public static boolean isContextView(AnActionEvent e) {
return POPUP_PLACES.contains(e.getPlace());
}

public static Disposable installEditAction(JTree tree, String actionName) {
DoubleClickListener listener = new DoubleClickListener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
*/
public interface DebuggerActions extends XDebuggerActions {
String POP_FRAME = "Debugger.PopFrame";
String EVALUATION_DIALOG_POPUP = "Debugger.EvaluationDialogPopup";
String FRAME_PANEL_POPUP = "Debugger.FramePanelPopup";
String INSPECT_PANEL_POPUP = "Debugger.InspectPanelPopup";
String THREADS_PANEL_POPUP = "Debugger.ThreadsPanelPopup";
String WATCH_PANEL_POPUP = "Debugger.WatchesPanelPopup";
String REMOVE_WATCH = "Debugger.RemoveWatch";
String NEW_WATCH = "Debugger.NewWatch";
String EDIT_WATCH = "Debugger.EditWatch";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2013-2025 consulo.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.java.debugger.impl.actions;

import consulo.annotation.component.ActionImpl;
import consulo.annotation.component.ActionParentRef;
import consulo.annotation.component.ActionRef;
import consulo.annotation.component.ActionRefAnchor;
import consulo.application.dumb.DumbAware;
import consulo.localize.LocalizeValue;
import consulo.ui.ex.action.AnSeparator;
import consulo.ui.ex.action.DefaultActionGroup;

/**
* @author UNV
* @since 2025-10-30
*/
@ActionImpl(
id = "JavaCompileGroup",
children = {
@ActionRef(type = ToggleMethodBreakpointAction.class),
@ActionRef(type = ToggleFieldBreakpointAction.class),
@ActionRef(type = AnSeparator.class)
},
parents = {
@ActionParentRef(value = @ActionRef(id = "ProjectViewCompileGroup"), anchor = ActionRefAnchor.FIRST),
@ActionParentRef(value = @ActionRef(id = "StructureViewCompileGroup"), anchor = ActionRefAnchor.FIRST)
}
)
public class JavaCompileGroup extends DefaultActionGroup implements DumbAware {
public JavaCompileGroup() {
super(LocalizeValue.empty(), false);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2013-2025 consulo.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.java.debugger.impl.actions;

import consulo.annotation.component.ActionImpl;
import consulo.annotation.component.ActionParentRef;
import consulo.annotation.component.ActionRef;
import consulo.application.dumb.DumbAware;
import consulo.localize.LocalizeValue;
import consulo.ui.ex.action.AnSeparator;
import consulo.ui.ex.action.DefaultActionGroup;

/**
* @author UNV
* @since 2025-10-30
*/
@ActionImpl(
id = "EditorPopupMenuDebugJava",
children = {
@ActionRef(type = AnSeparator.class),
@ActionRef(type = ToggleFieldBreakpointAction.class),
@ActionRef(type = AnSeparator.class)
},
parents = @ActionParentRef(@ActionRef(id = "EditorPopupMenuDebug"))
)
public class JavaEditorPopupMenuDebugGroup extends DefaultActionGroup implements DumbAware {
public JavaEditorPopupMenuDebugGroup() {
super(LocalizeValue.empty(), false);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2013-2025 consulo.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.java.debugger.impl.actions;

import consulo.annotation.component.ActionImpl;
import consulo.annotation.component.ActionRef;
import consulo.application.dumb.DumbAware;
import consulo.localize.LocalizeValue;
import consulo.ui.ex.action.AnSeparator;
import consulo.ui.ex.action.DefaultActionGroup;

/**
* @author UNV
* @since 2025-10-30
*/
@ActionImpl(
id = DebuggerActions.THREADS_PANEL_POPUP,
children = {
//@ActionRef(type = ResumeThreadAction.class),
//@ActionRef(type = FreezeThreadAction.class),
@ActionRef(type = InterruptThreadAction.class),
//@ActionRef(id = "Debugger.ShowFrame"),
@ActionRef(id = DebuggerActions.POP_FRAME),
//@ActionRef(id = DebuggerActions.EDIT_FRAME_SOURCE),
//@ActionRef(id = "Debugger.EditTypeSource"),
//@ActionRef(id = "EditSource"),
@ActionRef(type = AnSeparator.class),
@ActionRef(type = ExportThreadsAction.class),
@ActionRef(type = AnSeparator.class),
@ActionRef(type = CustomizeThreadsViewAction.class)
}
)
public class JavaThreadsPanelPopupGroup extends DefaultActionGroup implements DumbAware {
public JavaThreadsPanelPopupGroup() {
super(LocalizeValue.empty(), false);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2013-2025 consulo.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.java.debugger.impl.actions;

import consulo.annotation.component.ActionImpl;
import consulo.annotation.component.ActionRef;
import consulo.application.dumb.DumbAware;
import consulo.localize.LocalizeValue;
import consulo.ui.ex.action.AnSeparator;
import consulo.ui.ex.action.DefaultActionGroup;

/**
* @author UNV
* @since 2025-10-30
*/
@ActionImpl(
id = DebuggerActions.REPRESENTATION_LIST,
children = {
@ActionRef(type = CreateRendererAction.class),
@ActionRef(type = AnSeparator.class),
@ActionRef(type = AutoRendererAction.class)
}
)
public class RepresentationGroup extends DefaultActionGroup implements DumbAware {
public RepresentationGroup() {
super(LocalizeValue.empty(), false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,34 @@
package com.intellij.java.debugger.impl.actions;

import com.intellij.java.debugger.SourcePosition;
import com.intellij.java.debugger.engine.DebuggerUtils;
import com.intellij.java.debugger.impl.DebuggerContextImpl;
import com.intellij.java.debugger.impl.DebuggerManagerEx;
import com.intellij.java.debugger.impl.DebuggerSession;
import com.intellij.java.debugger.impl.InstanceFilter;
import com.intellij.java.debugger.impl.engine.DebugProcessImpl;
import com.intellij.java.debugger.impl.engine.SourcePositionProvider;
import com.intellij.java.debugger.impl.engine.events.DebuggerContextCommandImpl;
import com.intellij.java.debugger.impl.ui.breakpoints.Breakpoint;
import com.intellij.java.debugger.impl.ui.breakpoints.BreakpointManager;
import com.intellij.java.debugger.impl.ui.breakpoints.FieldBreakpoint;
import com.intellij.java.debugger.impl.ui.impl.watch.DebuggerTree;
import com.intellij.java.debugger.impl.ui.impl.watch.DebuggerTreeNodeImpl;
import com.intellij.java.debugger.impl.ui.impl.watch.FieldDescriptorImpl;
import com.intellij.java.debugger.localize.JavaDebuggerLocalize;
import com.intellij.java.language.impl.JavaClassFileType;
import com.intellij.java.language.impl.JavaFileType;
import com.intellij.java.language.psi.PsiClass;
import com.intellij.java.language.psi.PsiField;
import consulo.annotation.access.RequiredReadAction;
import consulo.annotation.component.ActionImpl;
import consulo.codeEditor.Editor;
import consulo.dataContext.DataContext;
import consulo.document.Document;
import consulo.fileEditor.FileEditorManager;
import consulo.internal.com.sun.jdi.Field;
import consulo.internal.com.sun.jdi.ObjectReference;
import consulo.language.psi.PsiDocumentManager;
import consulo.language.psi.PsiElement;
import consulo.language.psi.PsiFile;
import consulo.language.psi.scope.GlobalSearchScope;
import consulo.project.Project;
import consulo.ui.annotation.RequiredUIAccess;
import consulo.ui.ex.action.ActionPlaces;
import consulo.ui.ex.action.AnAction;
import consulo.ui.ex.action.AnActionEvent;
import consulo.ui.ex.action.Presentation;
import consulo.util.lang.ref.SimpleReference;
import consulo.virtualFileSystem.VirtualFile;
import consulo.virtualFileSystem.fileType.FileType;
Expand Down Expand Up @@ -93,19 +84,6 @@ public void actionPerformed(AnActionEvent e) {
if (breakpoint == null) {
FieldBreakpoint fieldBreakpoint = manager.addFieldBreakpoint(document, offset);
if (fieldBreakpoint != null) {
if (DebuggerAction.isContextView(e)) {
DebuggerTreeNodeImpl selectedNode = DebuggerAction.getSelectedNode(e.getDataContext());
if (selectedNode != null && selectedNode.getDescriptor() instanceof FieldDescriptorImpl fieldDescriptor) {
ObjectReference object = fieldDescriptor.getObject();
if (object != null) {
long id = object.uniqueID();
InstanceFilter[] instanceFilters = new InstanceFilter[]{InstanceFilter.create(Long.toString(id))};
fieldBreakpoint.setInstanceFilters(instanceFilters);
fieldBreakpoint.setInstanceFiltersEnabled(true);
}
}
}

Editor editor = e.getData(Editor.KEY);
if (editor != null) {
manager.editBreakpoint(fieldBreakpoint, editor);
Expand All @@ -122,31 +100,7 @@ public void actionPerformed(AnActionEvent e) {
@Override
@RequiredUIAccess
public void update(@Nonnull AnActionEvent event) {
SourcePosition place = getPlace(event);
boolean toEnable = place != null;

Presentation presentation = event.getPresentation();
if (POPUP_PLACES.contains(event.getPlace())) {
presentation.setVisible(toEnable);
}
else if (DebuggerAction.isContextView(event)) {
presentation.setTextValue(JavaDebuggerLocalize.actionAddFieldWatchpointText());
Project project = event.getData(Project.KEY);
if (project != null && place != null) {
Document document = PsiDocumentManager.getInstance(project).getDocument(place.getFile());
if (document != null) {
int offset = place.getOffset();
BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(project).getBreakpointManager();
Breakpoint fieldBreakpoint =
offset >= 0 ? breakpointManager.findBreakpoint(document, offset, FieldBreakpoint.CATEGORY) : null;
if (fieldBreakpoint != null) {
presentation.setEnabled(false);
return;
}
}
}
}
presentation.setVisible(toEnable);
event.getPresentation().setVisible(getPlace(event) != null);
}

@Nullable
Expand Down Expand Up @@ -187,30 +141,6 @@ public void threadAction() {
}
}

if (DebuggerAction.isContextView(event)) {
DebuggerTree tree = event.getData(DebuggerTree.DATA_KEY);
if (tree != null && tree.getSelectionPath() != null) {
DebuggerTreeNodeImpl node = (DebuggerTreeNodeImpl) tree.getSelectionPath().getLastPathComponent();
if (node != null && node.getDescriptor() instanceof FieldDescriptorImpl fieldDescriptor) {
Field field = fieldDescriptor.getField();
DebuggerSession session = tree.getDebuggerContext().getDebuggerSession();
PsiClass psiClass = DebuggerUtils.findClass(
field.declaringType().name(),
project,
session != null ? session.getSearchScope() : GlobalSearchScope.allScope(project)
);
if (psiClass != null) {
psiClass = (PsiClass) psiClass.getNavigationElement();
PsiField psiField = psiClass.findFieldByName(field.name(), true);
if (psiField != null) {
return SourcePosition.createFromElement(psiField);
}
}
}
}
return null;
}

Editor editor = event.getData(Editor.KEY);
if (editor == null) {
editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
Expand Down
Loading
Loading