mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
threads dropdown combined with actions
This commit is contained in:
@@ -45,7 +45,6 @@ import com.intellij.execution.ui.ExecutionConsoleEx;
|
||||
import com.intellij.execution.ui.RunContentDescriptor;
|
||||
import com.intellij.execution.ui.actions.CloseAction;
|
||||
import com.intellij.execution.ui.layout.PlaceInGrid;
|
||||
import com.intellij.ide.CommonActionsManager;
|
||||
import com.intellij.ide.actions.ContextHelpAction;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.Disposable;
|
||||
@@ -76,7 +75,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.ui.DebuggerSessionTab");
|
||||
|
||||
private static final Icon WATCH_RETURN_VALUES_ICON = IconLoader.getIcon("/debugger/watchLastReturnValue.png");
|
||||
private static final Icon FILTER_STACK_FRAMES_ICON = IconLoader.getIcon("/debugger/class_filter.png");
|
||||
private static final Icon AUTO_VARS_ICONS = IconLoader.getIcon("/debugger/autoVariablesMode.png");
|
||||
|
||||
private final VariablesPanel myVariablesPanel;
|
||||
@@ -166,14 +164,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
framesContent.setCloseable(false);
|
||||
framesContent.setAlertIcon(breakpointAlert);
|
||||
|
||||
final DefaultActionGroup framesGroup = new DefaultActionGroup();
|
||||
|
||||
CommonActionsManager actionsManager = CommonActionsManager.getInstance();
|
||||
framesGroup.add(actionsManager.createPrevOccurenceAction(myFramesPanel.getOccurenceNavigator()));
|
||||
framesGroup.add(actionsManager.createNextOccurenceAction(myFramesPanel.getOccurenceNavigator()));
|
||||
framesGroup.add(new ShowLibraryFramesAction());
|
||||
|
||||
framesContent.setActions(framesGroup, ActionPlaces.DEBUGGER_TOOLBAR, myFramesPanel.getFramesList());
|
||||
myUi.addContent(framesContent, 0, PlaceInGrid.left, false);
|
||||
|
||||
// variables
|
||||
@@ -571,34 +561,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
|
||||
}
|
||||
}
|
||||
|
||||
private class ShowLibraryFramesAction extends ToggleAction {
|
||||
private volatile boolean myShouldShow;
|
||||
private static final String ourTextWhenShowIsOn = "Hide Frames from Libraries";
|
||||
private static final String ourTextWhenShowIsOff = "Show All Frames";
|
||||
|
||||
public ShowLibraryFramesAction() {
|
||||
super("", "", FILTER_STACK_FRAMES_ICON);
|
||||
myShouldShow = DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES;
|
||||
}
|
||||
|
||||
public void update(final AnActionEvent e) {
|
||||
super.update(e);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
final boolean shouldShow = !(Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
|
||||
presentation.setText(shouldShow ? ourTextWhenShowIsOn : ourTextWhenShowIsOff);
|
||||
}
|
||||
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
return !myShouldShow;
|
||||
}
|
||||
|
||||
public void setSelected(AnActionEvent e, boolean enabled) {
|
||||
myShouldShow = !enabled;
|
||||
DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES = myShouldShow;
|
||||
myFramesPanel.setShowLibraryFrames(myShouldShow);
|
||||
}
|
||||
}
|
||||
|
||||
private class WatchLastMethodReturnValueAction extends ToggleAction {
|
||||
private volatile boolean myWatchesReturnValues;
|
||||
private final String myTextEnable;
|
||||
|
||||
@@ -41,22 +41,25 @@ import com.intellij.debugger.ui.impl.watch.MethodsTracker;
|
||||
import com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl;
|
||||
import com.intellij.debugger.ui.tree.render.DescriptorLabelListener;
|
||||
import com.intellij.ide.CommonActionsManager;
|
||||
import com.intellij.ide.OccurenceNavigator;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.ActionPopupMenu;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.impl.ActionToolbarImpl;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.ComboBoxWithWidePopup;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.ui.PopupHandler;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.components.panels.Wrapper;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.sun.jdi.ObjectCollectedException;
|
||||
import com.sun.jdi.VMDisconnectedException;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import java.awt.*;
|
||||
@@ -71,6 +74,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
public class FramesPanel extends UpdatableDebuggerView {
|
||||
private static final Icon FILTER_STACK_FRAMES_ICON = IconLoader.getIcon("/debugger/class_filter.png");
|
||||
|
||||
private final JComboBox myThreadsCombo;
|
||||
private final FramesList myFramesList;
|
||||
private final ThreadsListener myThreadsListener;
|
||||
@@ -106,10 +111,31 @@ public class FramesPanel extends UpdatableDebuggerView {
|
||||
registerThreadsPopupMenu(myFramesList);
|
||||
|
||||
setBorder(null);
|
||||
add(myThreadsCombo, BorderLayout.NORTH);
|
||||
|
||||
final ActionToolbar toolbar = createToolbar();
|
||||
Wrapper threads = new Wrapper();
|
||||
threads.add(toolbar.getComponent(), BorderLayout.EAST);
|
||||
threads.add(myThreadsCombo, BorderLayout.CENTER);
|
||||
add(threads, BorderLayout.NORTH);
|
||||
add(ScrollPaneFactory.createScrollPane(myFramesList), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
private ActionToolbar createToolbar() {
|
||||
final DefaultActionGroup framesGroup = new DefaultActionGroup();
|
||||
framesGroup.addSeparator();
|
||||
|
||||
CommonActionsManager actionsManager = CommonActionsManager.getInstance();
|
||||
framesGroup.add(actionsManager.createPrevOccurenceAction(getOccurenceNavigator()));
|
||||
framesGroup.add(actionsManager.createNextOccurenceAction(getOccurenceNavigator()));
|
||||
framesGroup.add(new ShowLibraryFramesAction());
|
||||
|
||||
final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, framesGroup, true);
|
||||
toolbar.setReservePlaceAutoPopupIcon(false);
|
||||
((ActionToolbarImpl)toolbar).setAddSeparatorFirst(true);
|
||||
toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0));
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
public DebuggerStateManager getContextManager() {
|
||||
return myStateManager;
|
||||
}
|
||||
@@ -630,4 +656,32 @@ public class FramesPanel extends UpdatableDebuggerView {
|
||||
public FramesList getFramesList() {
|
||||
return myFramesList;
|
||||
}
|
||||
|
||||
private class ShowLibraryFramesAction extends ToggleAction {
|
||||
private volatile boolean myShouldShow;
|
||||
private static final String ourTextWhenShowIsOn = "Hide Frames from Libraries";
|
||||
private static final String ourTextWhenShowIsOff = "Show All Frames";
|
||||
|
||||
public ShowLibraryFramesAction() {
|
||||
super("", "", FILTER_STACK_FRAMES_ICON);
|
||||
myShouldShow = DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES;
|
||||
}
|
||||
|
||||
public void update(final AnActionEvent e) {
|
||||
super.update(e);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
final boolean shouldShow = !(Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
|
||||
presentation.setText(shouldShow ? ourTextWhenShowIsOn : ourTextWhenShowIsOff);
|
||||
}
|
||||
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
return !myShouldShow;
|
||||
}
|
||||
|
||||
public void setSelected(AnActionEvent e, boolean enabled) {
|
||||
myShouldShow = !enabled;
|
||||
DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES = myShouldShow;
|
||||
setShowLibraryFrames(myShouldShow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user