mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
safe delete dead code
This commit is contained in:
@@ -55,9 +55,6 @@ public abstract class BreakpointFactory {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void configureBreakpointPanel(BreakpointPanel panel) {
|
||||
}
|
||||
|
||||
protected abstract String getHelpID();
|
||||
|
||||
public abstract String getDisplayName();
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.debugger.ui.breakpoints.BreakpointPanel">
|
||||
<grid id="800c4" binding="myPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="42" y="71" width="312" height="181"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="9a369" binding="myBreakPointsPanel" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="7" vgap="-1">
|
||||
<margin top="0" left="5" bottom="5" right="5"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<xy id="c9dc2" binding="myTablePlace" layout-manager="XYLayout" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</xy>
|
||||
<xy id="73b7b" binding="myButtonsPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</xy>
|
||||
</children>
|
||||
</grid>
|
||||
<xy id="96060" binding="myPropertiesPanelPlace" layout-manager="XYLayout" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="empty">
|
||||
<size top="0" left="5" bottom="5" right="5"/>
|
||||
</border>
|
||||
<children/>
|
||||
</xy>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -1,559 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* 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.debugger.ui.breakpoints;
|
||||
|
||||
import com.intellij.debugger.DebuggerManagerEx;
|
||||
import com.intellij.debugger.ui.breakpoints.actions.BreakpointPanelAction;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiField;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.SideBorder;
|
||||
import com.intellij.ui.TableUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
import com.intellij.xdebugger.impl.breakpoints.ui.AbstractBreakpointPanel;
|
||||
import gnu.trove.TIntArrayList;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.*;
|
||||
import javax.swing.tree.TreeModel;
|
||||
import javax.swing.tree.TreePath;
|
||||
import javax.swing.tree.TreeSelectionModel;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jeka
|
||||
*/
|
||||
public class BreakpointPanel extends AbstractBreakpointPanel<Breakpoint> {
|
||||
private final BreakpointPropertiesPanel myPropertiesPanel;
|
||||
private final BreakpointPanelAction[] myActions;
|
||||
private final Key<? extends Breakpoint> myBreakpointCategory;
|
||||
private Breakpoint myCurrentViewableBreakpoint;
|
||||
private final List<Runnable> myDisposeActions = new ArrayList<Runnable>();
|
||||
|
||||
private final Project myProject;
|
||||
private JPanel myPanel;
|
||||
private JPanel myBreakPointsPanel;
|
||||
private JPanel myTablePlace;
|
||||
private JPanel myPropertiesPanelPlace;
|
||||
private final BreakpointTable myTable;
|
||||
private final BreakpointTree myTree;
|
||||
private JPanel myButtonsPanel;
|
||||
private String myCurrentViewId = TABLE_VIEW;
|
||||
|
||||
private static final @NonNls String PROPERTIES_STUB = "STUB";
|
||||
private static final @NonNls String PROPERTIES_DATA = "DATA";
|
||||
|
||||
public static final @NonNls String TREE_VIEW = "TREE";
|
||||
public static final @NonNls String TABLE_VIEW = "TABLE";
|
||||
|
||||
public BreakpointPanel(final Project project,
|
||||
BreakpointPropertiesPanel propertiesPanel,
|
||||
final BreakpointPanelAction[] actions,
|
||||
Key<? extends Breakpoint> breakpointCategory,
|
||||
String tabName,
|
||||
String helpId) {
|
||||
super(tabName, helpId, Breakpoint.class);
|
||||
myProject = project;
|
||||
myPropertiesPanel = propertiesPanel;
|
||||
myActions = actions;
|
||||
myBreakpointCategory = breakpointCategory;
|
||||
|
||||
myTable = new BreakpointTable(project);
|
||||
myTree = new BreakpointTree(project);
|
||||
|
||||
myTablePlace.setLayout(new CardLayout());
|
||||
JScrollPane pane = ScrollPaneFactory.createScrollPane(myTable);
|
||||
pane.putClientProperty(UIUtil.KEEP_BORDER_SIDES, SideBorder.ALL);
|
||||
myTablePlace.add(pane, TABLE_VIEW);
|
||||
|
||||
final ListSelectionListener listSelectionListener = new ListSelectionListener() {
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
if (!e.getValueIsAdjusting()) {
|
||||
updateCurrentBreakpointPropertiesPanel();
|
||||
}
|
||||
}
|
||||
};
|
||||
final ListSelectionModel tableSelectionModel = myTable.getSelectionModel();
|
||||
tableSelectionModel.addListSelectionListener(listSelectionListener);
|
||||
myDisposeActions.add(new Runnable() {
|
||||
public void run() {
|
||||
tableSelectionModel.removeListSelectionListener(listSelectionListener);
|
||||
}
|
||||
});
|
||||
|
||||
final TreeSelectionModel treeSelectionModel = myTree.getSelectionModel();
|
||||
final TreeSelectionListener treeSelectionListener = new TreeSelectionListener() {
|
||||
public void valueChanged(TreeSelectionEvent e) {
|
||||
updateCurrentBreakpointPropertiesPanel();
|
||||
}
|
||||
};
|
||||
treeSelectionModel.addTreeSelectionListener(treeSelectionListener);
|
||||
myDisposeActions.add(new Runnable() {
|
||||
public void run() {
|
||||
treeSelectionModel.removeTreeSelectionListener(treeSelectionListener);
|
||||
}
|
||||
});
|
||||
|
||||
final BreakpointTableModel tableModel = myTable.getModel();
|
||||
final TableModelListener tableModelListener = new TableModelListener() {
|
||||
public void tableChanged(TableModelEvent e) {
|
||||
if (e.getType() == TableModelEvent.UPDATE) {
|
||||
updateCurrentBreakpointPropertiesPanel();
|
||||
}
|
||||
fireBreakpointsChanged();
|
||||
}
|
||||
};
|
||||
tableModel.addTableModelListener(tableModelListener);
|
||||
myDisposeActions.add(new Runnable() {
|
||||
public void run() {
|
||||
tableModel.removeTableModelListener(tableModelListener);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
final TreeModel treeModel = myTree.getModel();
|
||||
final TreeModelListener treeModelListener = new TreeModelListener() {
|
||||
public void treeNodesChanged(TreeModelEvent e) {
|
||||
}
|
||||
|
||||
public void treeNodesInserted(TreeModelEvent e) {
|
||||
}
|
||||
|
||||
public void treeNodesRemoved(TreeModelEvent e) {
|
||||
}
|
||||
|
||||
public void treeStructureChanged(TreeModelEvent e) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
ensureSelectionExists();
|
||||
updateButtons();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
treeModel.addTreeModelListener(treeModelListener);
|
||||
myDisposeActions.add(new Runnable() {
|
||||
public void run() {
|
||||
treeModel.removeTreeModelListener(treeModelListener);
|
||||
}
|
||||
});
|
||||
|
||||
myPropertiesPanelPlace.setLayout(new CardLayout());
|
||||
final JPanel stubPanel = new JPanel();
|
||||
stubPanel.setMinimumSize(myPropertiesPanel.getPanel().getMinimumSize());
|
||||
myPropertiesPanelPlace.add(stubPanel, PROPERTIES_STUB);
|
||||
myPropertiesPanelPlace.add(myPropertiesPanel.getPanel(), PROPERTIES_DATA);
|
||||
|
||||
myBreakPointsPanel.setBorder(IdeBorderFactory.createEmptyBorder(6, 6, 0, 6));
|
||||
|
||||
myButtonsPanel.setLayout(new GridBagLayout());
|
||||
for (int idx = 0; idx < actions.length; idx++) {
|
||||
final BreakpointPanelAction action = actions[idx];
|
||||
action.setPanel(this);
|
||||
final AbstractButton button = action.isStateAction()? new JCheckBox(action.getName()) : new JButton(action.getName());
|
||||
action.setButton(button);
|
||||
button.addActionListener(action);
|
||||
myDisposeActions.add(new Runnable() {
|
||||
public void run() {
|
||||
button.removeActionListener(action);
|
||||
}
|
||||
});
|
||||
final double weighty = (idx == actions.length - 1) ? 1.0 : 0.0;
|
||||
myButtonsPanel.add(button, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, weighty, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 2, 2, 2), 0, 0));
|
||||
}
|
||||
final ListSelectionListener tableSelectionListener = new ListSelectionListener() {
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
updateButtons();
|
||||
}
|
||||
};
|
||||
tableSelectionModel.addListSelectionListener(tableSelectionListener);
|
||||
myDisposeActions.add(new Runnable() {
|
||||
public void run() {
|
||||
tableSelectionModel.removeListSelectionListener(tableSelectionListener);
|
||||
}
|
||||
});
|
||||
|
||||
pane = ScrollPaneFactory.createScrollPane(myTree);
|
||||
pane.putClientProperty(UIUtil.KEEP_BORDER_SIDES, SideBorder.ALL);
|
||||
myTablePlace.add(pane, TREE_VIEW);
|
||||
|
||||
updateCurrentBreakpointPropertiesPanel();
|
||||
|
||||
final BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(project).getBreakpointManager();
|
||||
final BreakpointManagerListener breakpointManagerListener = new BreakpointManagerListener() {
|
||||
public void breakpointsChanged() {
|
||||
if (isTreeShowing()) {
|
||||
myTree.repaint();
|
||||
}
|
||||
else {
|
||||
myTable.repaint();
|
||||
}
|
||||
}
|
||||
};
|
||||
breakpointManager.addBreakpointManagerListener(breakpointManagerListener);
|
||||
myDisposeActions.add(new Runnable() {
|
||||
public void run() {
|
||||
breakpointManager.removeBreakpointManagerListener(breakpointManagerListener);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public BreakpointTable getTable() {
|
||||
return myTable;
|
||||
}
|
||||
|
||||
public BreakpointTree getTree() {
|
||||
return myTree;
|
||||
}
|
||||
|
||||
public void switchViews() {
|
||||
final Breakpoint[] selectedBreakpoints = getSelectedBreakpoints();
|
||||
showView(isTreeShowing() ? TABLE_VIEW : TREE_VIEW);
|
||||
selectBreakpoints(selectedBreakpoints);
|
||||
}
|
||||
|
||||
public void showView(final String viewId) {
|
||||
if (TREE_VIEW.equals(viewId) || TABLE_VIEW.equals(viewId)) {
|
||||
myCurrentViewId = viewId;
|
||||
((CardLayout)myTablePlace.getLayout()).show(myTablePlace, viewId);
|
||||
updateButtons();
|
||||
ensureSelectionExists();
|
||||
}
|
||||
}
|
||||
|
||||
public String getCurrentViewId() {
|
||||
return myCurrentViewId;
|
||||
}
|
||||
|
||||
public boolean isTreeShowing() {
|
||||
return BreakpointPanel.TREE_VIEW.equals(getCurrentViewId());
|
||||
}
|
||||
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
public void setupPanelUI() {
|
||||
final BreakpointManager breakpointManager = getBreakpointManager();
|
||||
final Key<? extends Breakpoint> category = getBreakpointCategory();
|
||||
final BreakpointTree tree = getTree();
|
||||
final String flattenPackages = breakpointManager.getProperty(category + "_flattenPackages");
|
||||
if (flattenPackages != null) {
|
||||
tree.setFlattenPackages("true".equalsIgnoreCase(flattenPackages));
|
||||
}
|
||||
final String groupByClasses = breakpointManager.getProperty(category + "_groupByClasses");
|
||||
if (groupByClasses != null) {
|
||||
tree.setGroupByClasses("true".equalsIgnoreCase(groupByClasses));
|
||||
}
|
||||
final String groupByMethods = breakpointManager.getProperty(category + "_groupByMethods");
|
||||
if (groupByMethods != null) {
|
||||
tree.setGroupByMethods("true".equalsIgnoreCase(groupByMethods));
|
||||
}
|
||||
|
||||
final String viewId = breakpointManager.getProperty(category + "_viewId");
|
||||
if (viewId != null) {
|
||||
showView(viewId);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
public void savePanelSettings() {
|
||||
Key<? extends Breakpoint> category = getBreakpointCategory();
|
||||
final BreakpointManager breakpointManager = getBreakpointManager();
|
||||
|
||||
final BreakpointTree tree = getTree();
|
||||
breakpointManager.setProperty(category + "_flattenPackages", tree.isFlattenPackages() ? "true" : "false");
|
||||
breakpointManager.setProperty(category + "_groupByClasses", tree.isGroupByClasses() ? "true" : "false");
|
||||
breakpointManager.setProperty(category + "_groupByMethods", tree.isGroupByMethods() ? "true" : "false");
|
||||
breakpointManager.setProperty(category + "_viewId", getCurrentViewId());
|
||||
}
|
||||
|
||||
protected BreakpointManager getBreakpointManager() {
|
||||
return DebuggerManagerEx.getInstanceEx(myProject).getBreakpointManager();
|
||||
}
|
||||
|
||||
private boolean hasEnabledBreakpoints() {
|
||||
final List<Breakpoint> breakpoints = getBreakpoints();
|
||||
for (Breakpoint breakpoint : breakpoints) {
|
||||
if (breakpoint.ENABLED) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Icon getTabIcon() {
|
||||
final BreakpointFactory factory = BreakpointFactory.getInstance(getBreakpointCategory());
|
||||
return hasEnabledBreakpoints() ? factory.getIcon() : factory.getDisabledIcon();
|
||||
}
|
||||
|
||||
public boolean canSelectBreakpoint(final Breakpoint breakpoint) {
|
||||
return breakpoint.getCategory().equals(getBreakpointCategory());
|
||||
}
|
||||
|
||||
public Key<? extends Breakpoint> getBreakpointCategory() {
|
||||
return myBreakpointCategory;
|
||||
}
|
||||
|
||||
public Breakpoint getCurrentViewableBreakpoint() {
|
||||
return myCurrentViewableBreakpoint;
|
||||
}
|
||||
|
||||
public void saveBreakpoints() {
|
||||
if (myCurrentViewableBreakpoint != null) {
|
||||
myPropertiesPanel.saveTo(myCurrentViewableBreakpoint, new Runnable() {
|
||||
public void run() {
|
||||
myTable.repaint();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void updateButtons() {
|
||||
for (final BreakpointPanelAction action : myActions) {
|
||||
final AbstractButton button = action.getButton();
|
||||
action.update();
|
||||
if (!button.isEnabled() && button.hasFocus()) {
|
||||
button.transferFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
return myPanel;
|
||||
}
|
||||
|
||||
public void selectBreakpoint(Breakpoint breakpoint) {
|
||||
if (isTreeShowing()) {
|
||||
myTree.selectBreakpoint(breakpoint);
|
||||
}
|
||||
else {
|
||||
int index = myTable.getModel().getBreakpointIndex(breakpoint);
|
||||
ListSelectionModel model = myTable.getSelectionModel();
|
||||
model.clearSelection();
|
||||
model.addSelectionInterval(index, index);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBreakpoints() {
|
||||
return getBreakpointManager().getBreakpoints(getBreakpointCategory()).length > 0;
|
||||
}
|
||||
|
||||
public void selectBreakpoints(Breakpoint[] breakpoints) {
|
||||
if (isTreeShowing()) {
|
||||
myTree.selectBreakpoints(breakpoints);
|
||||
}
|
||||
else {
|
||||
final TIntArrayList rows = new TIntArrayList(breakpoints.length);
|
||||
for (Breakpoint breakpoint : breakpoints) {
|
||||
final int index = myTable.getModel().getBreakpointIndex(breakpoint);
|
||||
if (index >= 0) {
|
||||
rows.add(index);
|
||||
}
|
||||
}
|
||||
myTable.getSelectionModel().clearSelection();
|
||||
TableUtil.selectRows(myTable, rows.toNativeArray());
|
||||
}
|
||||
}
|
||||
|
||||
public void resetBreakpoints() {
|
||||
Breakpoint[] breakpoints = getBreakpointManager().getBreakpoints(getBreakpointCategory());
|
||||
myTable.setBreakpoints(breakpoints);
|
||||
myTree.setBreakpoints(breakpoints);
|
||||
ensureSelectionExists();
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
public Breakpoint[] getSelectedBreakpoints() {
|
||||
return isTreeShowing() ? myTree.getSelectedBreakpoints() : myTable.getSelectedBreakpoints();
|
||||
}
|
||||
|
||||
public void removeSelectedBreakpoints() {
|
||||
final Breakpoint[] selectedBreakpoints = getSelectedBreakpoints();
|
||||
if (selectedBreakpoints.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
final boolean inTreeMode = isTreeShowing();
|
||||
|
||||
final int minSelectionIndex;
|
||||
if (inTreeMode) {
|
||||
minSelectionIndex = Math.max(0, myTree.getSelectionModel().getMinSelectionRow());
|
||||
}
|
||||
else {
|
||||
minSelectionIndex = Math.max(0, myTable.getSelectionModel().getMinSelectionIndex());
|
||||
}
|
||||
|
||||
myTree.removeBreakpoints(selectedBreakpoints);
|
||||
myTable.getModel().removeBreakpoints(selectedBreakpoints);
|
||||
myCurrentViewableBreakpoint = null;
|
||||
|
||||
if (inTreeMode) {
|
||||
if (myTree.getRowCount() > 0) {
|
||||
int rowToSelect = minSelectionIndex >= myTree.getRowCount()? myTree.getRowCount() - 1 : minSelectionIndex;
|
||||
final TreePath path = myTree.getPathForRow(rowToSelect);
|
||||
if (path != null) {
|
||||
TreeUtil.selectPath(myTree, path, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (myTable.getRowCount() > 0) { // if in table mode and there are items to select
|
||||
int indexToSelect = minSelectionIndex >= myTable.getRowCount()? myTable.getRowCount() - 1 : minSelectionIndex;
|
||||
TableUtil.selectRows(myTable, new int[] {indexToSelect});
|
||||
}
|
||||
}
|
||||
|
||||
updateCurrentBreakpointPropertiesPanel();
|
||||
}
|
||||
|
||||
public void insertBreakpointAt(Breakpoint breakpoint, int index) {
|
||||
myTable.getModel().insertBreakpointAt(breakpoint, index);
|
||||
myTree.addBreakpoint(breakpoint);
|
||||
selectBreakpoint(breakpoint);
|
||||
}
|
||||
|
||||
public void addBreakpoint(Breakpoint breakpoint) {
|
||||
myTable.getModel().addBreakpoint(breakpoint);
|
||||
myTree.addBreakpoint(breakpoint);
|
||||
selectBreakpoint(breakpoint);
|
||||
}
|
||||
|
||||
private void updateCurrentBreakpointPropertiesPanel() {
|
||||
if (myCurrentViewableBreakpoint != null) {
|
||||
myPropertiesPanel.saveTo(myCurrentViewableBreakpoint, new Runnable() {
|
||||
public void run() {
|
||||
if (isTreeShowing()) {
|
||||
myTree.repaint();
|
||||
}
|
||||
else {
|
||||
myTable.repaint();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
Breakpoint[] breakpoints = getSelectedBreakpoints();
|
||||
Breakpoint oldViewableBreakpoint = myCurrentViewableBreakpoint;
|
||||
myCurrentViewableBreakpoint = (breakpoints != null && breakpoints.length == 1) ? breakpoints[0] : null;
|
||||
if (myCurrentViewableBreakpoint != null) {
|
||||
if (oldViewableBreakpoint == null) {
|
||||
((CardLayout)myPropertiesPanelPlace.getLayout()).show(myPropertiesPanelPlace, PROPERTIES_DATA);
|
||||
}
|
||||
myPropertiesPanel.initFrom(myCurrentViewableBreakpoint, true);
|
||||
}
|
||||
else {
|
||||
((CardLayout)myPropertiesPanelPlace.getLayout()).show(myPropertiesPanelPlace, PROPERTIES_STUB);
|
||||
}
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
public JComponent getControl(String control) {
|
||||
return myPropertiesPanel.getControl(control);
|
||||
}
|
||||
|
||||
public int getBreakpointCount() {
|
||||
return myTable.getBreakpoints().size();
|
||||
}
|
||||
|
||||
public final List<Breakpoint> getBreakpoints() {
|
||||
return myTable.getBreakpoints();
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
savePanelSettings();
|
||||
for (Runnable runnable : myDisposeActions) {
|
||||
runnable.run();
|
||||
}
|
||||
myDisposeActions.clear();
|
||||
|
||||
myTree.dispose();
|
||||
|
||||
final KeyStroke[] tableStrokes = myTable.getRegisteredKeyStrokes();
|
||||
for (KeyStroke stroke : tableStrokes) {
|
||||
myTable.unregisterKeyboardAction(stroke);
|
||||
}
|
||||
|
||||
myPropertiesPanel.dispose();
|
||||
}
|
||||
|
||||
public OpenFileDescriptor createEditSourceDescriptor(final Project project) {
|
||||
Breakpoint[] breakpoints = getSelectedBreakpoints();
|
||||
if (breakpoints == null || breakpoints.length == 0) {
|
||||
return null;
|
||||
}
|
||||
Breakpoint br = breakpoints[0];
|
||||
int line;
|
||||
Document doc;
|
||||
if (br instanceof BreakpointWithHighlighter) {
|
||||
BreakpointWithHighlighter breakpoint = (BreakpointWithHighlighter)br;
|
||||
doc = breakpoint.getDocument();
|
||||
line = breakpoint.getLineIndex();
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
if (line < 0 || line >= doc.getLineCount()) {
|
||||
return null;
|
||||
}
|
||||
int offset = doc.getLineStartOffset(line);
|
||||
if(br instanceof FieldBreakpoint) {
|
||||
PsiField field = ((FieldBreakpoint) br).getPsiField();
|
||||
if(field != null) {
|
||||
offset = field.getTextOffset();
|
||||
}
|
||||
}
|
||||
VirtualFile vFile = FileDocumentManager.getInstance().getFile(doc);
|
||||
if (vFile == null || !vFile.isValid()) {
|
||||
return null;
|
||||
}
|
||||
return new OpenFileDescriptor(project, vFile, offset);
|
||||
}
|
||||
|
||||
public void ensureSelectionExists() {
|
||||
if (myTable.getRowCount() > 0 && myTable.getSelectedRow() < 0) {
|
||||
ListSelectionModel model = myTable.getSelectionModel();
|
||||
model.clearSelection();
|
||||
model.addSelectionInterval(0, 0);
|
||||
}
|
||||
|
||||
final List<Breakpoint> treeBreakpoints = myTree.getBreakpoints();
|
||||
if (treeBreakpoints.size() > 0) {
|
||||
if (myTree.getSelectionModel().getSelectionCount() == 0) {
|
||||
myTree.selectFirstBreakpoint();
|
||||
}
|
||||
}
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
if (isTreeShowing()) {
|
||||
myTree.requestFocus();
|
||||
}
|
||||
else {
|
||||
myTable.requestFocus();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
-6
@@ -59,12 +59,6 @@ public class ExceptionBreakpointFactory extends BreakpointFactory {
|
||||
return DebuggerBundle.message("exception.breakpoints.tab.title");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureBreakpointPanel(BreakpointPanel panel) {
|
||||
super.configureBreakpointPanel(panel);
|
||||
panel.getTree().setGroupByMethods(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BreakpointPropertiesPanel createBreakpointPropertiesPanel(Project project, boolean compact) {
|
||||
return new ExceptionBreakpointPropertiesPanel(project, compact);
|
||||
|
||||
-5
@@ -48,11 +48,6 @@ public class FieldBreakpointFactory extends BreakpointFactory{
|
||||
return AllIcons.Debugger.Db_disabled_field_breakpoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureBreakpointPanel(BreakpointPanel panel) {
|
||||
panel.getTree().setGroupByMethods(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHelpID() {
|
||||
return HelpID.FIELD_WATCHPOINTS;
|
||||
|
||||
-6
@@ -60,12 +60,6 @@ public class MethodBreakpointFactory extends BreakpointFactory{
|
||||
return new MethodBreakpointPropertiesPanel(project, compact);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureBreakpointPanel(BreakpointPanel panel) {
|
||||
super.configureBreakpointPanel(panel);
|
||||
panel.getTree().setGroupByMethods(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Key<MethodBreakpoint> getBreakpointCategory() {
|
||||
return MethodBreakpoint.CATEGORY;
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* 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.debugger.ui.breakpoints.actions;
|
||||
|
||||
import com.intellij.debugger.ui.breakpoints.Breakpoint;
|
||||
import com.intellij.debugger.ui.breakpoints.BreakpointFactory;
|
||||
import com.intellij.debugger.ui.breakpoints.BreakpointPanel;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: May 25, 2005
|
||||
*/
|
||||
public class AddAction extends BreakpointPanelAction {
|
||||
protected final Project myProject;
|
||||
protected BreakpointFactory myBreakpointFactory;
|
||||
|
||||
public AddAction(BreakpointFactory breakpointFactory, Project project) {
|
||||
super(IdeBundle.message("button.add"));
|
||||
myProject = project;
|
||||
this.myBreakpointFactory = breakpointFactory;
|
||||
}
|
||||
|
||||
public void setPanel(BreakpointPanel panel) {
|
||||
super.setPanel(panel);
|
||||
getPanel().getTable().registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
|
||||
}
|
||||
|
||||
public void update() {
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Breakpoint breakpoint = myBreakpointFactory.addBreakpoint(myProject);
|
||||
if (breakpoint != null) {
|
||||
getPanel().addBreakpoint(breakpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
-61
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* 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.debugger.ui.breakpoints.actions;
|
||||
|
||||
import com.intellij.debugger.ui.breakpoints.BreakpointPanel;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: May 25, 2005
|
||||
*/
|
||||
public abstract class BreakpointPanelAction implements ActionListener {
|
||||
private final String myName;
|
||||
private AbstractButton myButton;
|
||||
private BreakpointPanel myPanel;
|
||||
|
||||
protected BreakpointPanelAction(String name) {
|
||||
myName = name;
|
||||
}
|
||||
|
||||
public final String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
public boolean isStateAction() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setPanel(BreakpointPanel panel) {
|
||||
myPanel = panel;
|
||||
}
|
||||
|
||||
public final BreakpointPanel getPanel() {
|
||||
return myPanel;
|
||||
}
|
||||
|
||||
public void setButton(AbstractButton button) {
|
||||
myButton = button;
|
||||
}
|
||||
|
||||
public final AbstractButton getButton() {
|
||||
return myButton;
|
||||
}
|
||||
|
||||
public abstract void update();
|
||||
}
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* 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.debugger.ui.breakpoints.actions;
|
||||
|
||||
import com.intellij.debugger.ui.breakpoints.BreakpointPanel;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: May 25, 2005
|
||||
*/
|
||||
public class GotoSourceAction extends BreakpointPanelAction {
|
||||
private final Project myProject;
|
||||
|
||||
protected GotoSourceAction(final Project project) {
|
||||
super(IdeBundle.message("button.go.to"));
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
gotoSource();
|
||||
}
|
||||
|
||||
private void gotoSource() {
|
||||
OpenFileDescriptor editSourceDescriptor = getPanel().createEditSourceDescriptor(myProject);
|
||||
if (editSourceDescriptor != null) {
|
||||
FileEditorManager.getInstance(myProject).openTextEditor(editSourceDescriptor, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void setPanel(BreakpointPanel panel) {
|
||||
super.setPanel(panel);
|
||||
ShortcutSet shortcutSet = ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE).getShortcutSet();
|
||||
new AnAction() {
|
||||
public void actionPerformed(AnActionEvent e){
|
||||
gotoSource();
|
||||
}
|
||||
}.registerCustomShortcutSet(shortcutSet, getPanel().getPanel());
|
||||
}
|
||||
|
||||
public void update() {
|
||||
getButton().setEnabled(getPanel().getCurrentViewableBreakpoint() != null);
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* 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.debugger.ui.breakpoints.actions;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.DebuggerManagerEx;
|
||||
import com.intellij.debugger.ui.breakpoints.AnyExceptionBreakpoint;
|
||||
import com.intellij.debugger.ui.breakpoints.Breakpoint;
|
||||
import com.intellij.debugger.ui.breakpoints.BreakpointManager;
|
||||
import com.intellij.debugger.ui.breakpoints.BreakpointPanel;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: May 25, 2005
|
||||
*/
|
||||
public class RemoveAction extends BreakpointPanelAction {
|
||||
private final Project myProject;
|
||||
|
||||
public RemoveAction(final Project project) {
|
||||
super(DebuggerBundle.message("button.remove"));
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
|
||||
public void setPanel(BreakpointPanel panel) {
|
||||
super.setPanel(panel);
|
||||
getPanel().getTable().registerKeyboardAction(
|
||||
this, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
|
||||
);
|
||||
getPanel().getTree().registerKeyboardAction(
|
||||
this, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
|
||||
);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Breakpoint[] breakpoints = getPanel().getSelectedBreakpoints();
|
||||
if (breakpoints != null) {
|
||||
for (Breakpoint breakpoint1 : breakpoints) {
|
||||
if (breakpoint1 instanceof AnyExceptionBreakpoint) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
getPanel().removeSelectedBreakpoints();
|
||||
BreakpointManager manager = DebuggerManagerEx.getInstanceEx(myProject).getBreakpointManager();
|
||||
for (final Breakpoint breakpoint : breakpoints) {
|
||||
getPanel().getTree().removeBreakpoint(breakpoint);
|
||||
manager.removeBreakpoint(breakpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void update() {
|
||||
getButton().setEnabled(getPanel().getSelectedBreakpoints().length > 0);
|
||||
}
|
||||
}
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* 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.debugger.ui.breakpoints.actions;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.ui.breakpoints.BreakpointPanel;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: May 25, 2005
|
||||
*/
|
||||
public class SwitchViewAction extends BreakpointPanelAction {
|
||||
public SwitchViewAction() {
|
||||
super(DebuggerBundle.message("button.switch.view"));
|
||||
}
|
||||
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getPanel().switchViews();
|
||||
}
|
||||
|
||||
|
||||
public void update() {
|
||||
final AbstractButton button = getButton();
|
||||
final BreakpointPanel panel = getPanel();
|
||||
button.setText(panel.isTreeShowing()? DebuggerBundle.message("button.list.view") : DebuggerBundle.message("button.tree.view"));
|
||||
button.setEnabled(panel.getBreakpointCount() > 0);
|
||||
}
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* 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.debugger.ui.breakpoints.actions;
|
||||
|
||||
import com.intellij.debugger.ui.breakpoints.BreakpointPanel;
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: May 25, 2005
|
||||
*/
|
||||
public class ToggleFlattenPackagesAction extends BreakpointPanelAction {
|
||||
public ToggleFlattenPackagesAction() {
|
||||
super(DebuggerBundle.message("button.flatten.packages"));
|
||||
}
|
||||
|
||||
public boolean isStateAction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setButton(AbstractButton button) {
|
||||
super.setButton(button);
|
||||
getButton().setSelected(getPanel().getTree().isFlattenPackages());
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getPanel().getTree().setFlattenPackages(getButton().isSelected());
|
||||
}
|
||||
|
||||
public void update() {
|
||||
final AbstractButton button = getButton();
|
||||
final BreakpointPanel panel = getPanel();
|
||||
button.setEnabled(panel.getBreakpointCount() > 0 && panel.isTreeShowing());
|
||||
button.setSelected(panel.getTree().isFlattenPackages());
|
||||
}
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* 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.debugger.ui.breakpoints.actions;
|
||||
|
||||
import com.intellij.debugger.ui.breakpoints.BreakpointPanel;
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: May 25, 2005
|
||||
*/
|
||||
public class ToggleGroupByClassesAction extends BreakpointPanelAction {
|
||||
public ToggleGroupByClassesAction() {
|
||||
super(DebuggerBundle.message("button.group.by.classes"));
|
||||
}
|
||||
|
||||
public boolean isStateAction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setButton(AbstractButton button) {
|
||||
super.setButton(button);
|
||||
getButton().setSelected(getPanel().getTree().isGroupByClasses());
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getPanel().getTree().setGroupByClasses(getButton().isSelected());
|
||||
}
|
||||
|
||||
public void update() {
|
||||
final AbstractButton button = getButton();
|
||||
final BreakpointPanel panel = getPanel();
|
||||
button.setEnabled(panel.getBreakpointCount() > 0 && panel.isTreeShowing());
|
||||
button.setSelected(panel.getTree().isGroupByClasses());
|
||||
}
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* 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.debugger.ui.breakpoints.actions;
|
||||
|
||||
import com.intellij.debugger.ui.breakpoints.BreakpointPanel;
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: May 25, 2005
|
||||
*/
|
||||
public class ToggleGroupByMethodsAction extends BreakpointPanelAction {
|
||||
public ToggleGroupByMethodsAction() {
|
||||
super(DebuggerBundle.message("button.group.by.methods"));
|
||||
}
|
||||
|
||||
public boolean isStateAction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setButton(AbstractButton button) {
|
||||
super.setButton(button);
|
||||
getButton().setSelected(getPanel().getTree().isGroupByMethods());
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getPanel().getTree().setGroupByMethods(getButton().isSelected());
|
||||
}
|
||||
|
||||
public void update() {
|
||||
final AbstractButton button = getButton();
|
||||
final BreakpointPanel panel = getPanel();
|
||||
button.setEnabled(panel.getBreakpointCount() > 0 && panel.isTreeShowing());
|
||||
button.setSelected(panel.getTree().isGroupByMethods());
|
||||
}
|
||||
}
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* 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.debugger.ui.breakpoints.actions;
|
||||
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: May 25, 2005
|
||||
*/
|
||||
public class ViewSourceAction extends BreakpointPanelAction {
|
||||
private final Project myProject;
|
||||
|
||||
public ViewSourceAction(final Project project) {
|
||||
super(IdeBundle.message("button.view.source"));
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
OpenFileDescriptor editSourceDescriptor = getPanel().createEditSourceDescriptor(myProject);
|
||||
if (editSourceDescriptor != null) {
|
||||
FileEditorManager.getInstance(myProject).openTextEditor(editSourceDescriptor, false);
|
||||
}
|
||||
}
|
||||
|
||||
public void update() {
|
||||
getButton().setEnabled(getPanel().getCurrentViewableBreakpoint() != null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user