breakpoints ui. breakpoints list selection with separators. saving breakpoint properties on deselecting breakpoint.

This commit is contained in:
andrey.zaytsev
2012-05-15 17:51:38 +04:00
parent 719456b525
commit 0cab6dbd64
8 changed files with 64 additions and 27 deletions
@@ -108,6 +108,7 @@ public abstract class BreakpointPropertiesPanel {
private static final int MAX_COMBO_WIDTH = 300;
private final FixedSizeButton myConditionMagnifierButton;
private boolean myMoreOptionsVisible = true;
private Breakpoint myBreakpoint;
public boolean isMoreOptionsVisible() {
return myMoreOptionsVisible;
@@ -116,13 +117,12 @@ public abstract class BreakpointPropertiesPanel {
private void createUIComponents() {
myPanel = new JPanel() {
@Override
public boolean requestFocus(boolean b) {
return super.requestFocus(b); //To change body of overridden methods use File | Settings | File Templates.
}
@Override
public void requestFocus() {
super.requestFocus(); //To change body of overridden methods use File | Settings | File Templates.
public void removeNotify() {
super.removeNotify();
saveTo(myBreakpoint, new Runnable() {
@Override
public void run() {}
});
}
};
}
@@ -392,6 +392,7 @@ public abstract class BreakpointPropertiesPanel {
* Init UI components with the values from Breakpoint
*/
public void initFrom(Breakpoint breakpoint, boolean moreOptionsVisible1) {
myBreakpoint = breakpoint;
boolean moreOptionsVisible = moreOptionsVisible1;
boolean actionsPanelVisible = moreOptionsVisible1;
myBreakpointComboboxHandler.initFrom(breakpoint);
@@ -55,7 +55,12 @@ class JavaBreakpointItem implements BreakpointItem {
@Override
public void execute(Project project) {
//To change body of implemented methods use File | Settings | File Templates.
if (myBreakpoint instanceof BreakpointWithHighlighter) {
final SourcePosition position = ((BreakpointWithHighlighter)myBreakpoint).getSourcePosition();
if (position != null) {
position.navigate(true);
}
}
}
@Override
@@ -72,6 +77,7 @@ class JavaBreakpointItem implements BreakpointItem {
public void updateDetailView(DetailView panel) {
BreakpointPropertiesPanel breakpointPropertiesPanel = myBreakpointFactory
.createBreakpointPropertiesPanel(myBreakpoint.getProject(), false);
if (breakpointPropertiesPanel != null) {
breakpointPropertiesPanel.initFrom(myBreakpoint, true);
final JPanel mainPanel = breakpointPropertiesPanel.getPanel();
@@ -27,7 +27,6 @@ import com.intellij.openapi.editor.*;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.ui.popup.util.ItemWrapper;
import com.intellij.openapi.ui.popup.JBPopup;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.IdeFocusManager;
@@ -100,11 +99,6 @@ public class BookmarksAction extends AnAction implements DumbAware, MasterDetail
}
}
@Override
public void itemRemoved(ItemWrapper item, Project project) {
BookmarkManager.getInstance(project).removeBookmark(((BookmarkItem)item).getBookmark());
}
private static DefaultListModel buildModel(Project project) {
final DefaultListModel model = new DefaultListModel();
@@ -74,7 +74,12 @@ public class MasterDetailPopupBuilder {
myList.setCellRenderer(new ItemRenderer(myProject));
myList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
final ListSelectionModel selectionModel = myList.getSelectionModel();
selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
final boolean directionUp[] = new boolean[1];
selectionModel.addListSelectionListener(new ListSelectionListener() {
private String getTitle2Text(String fullText) {
int labelWidth = pathLabel.getWidth();
if (fullText == null || fullText.length() == 0) return " ";
@@ -102,7 +107,7 @@ public class MasterDetailPopupBuilder {
public void run() {
detailView.updateWithItem(wrapper);
}
}, 300);
}, 100);
}
private void updatePathLabel() {
@@ -110,6 +115,26 @@ public class MasterDetailPopupBuilder {
ItemWrapper wrapper = null;
if (values != null && values.length == 1) {
wrapper = (ItemWrapper)values[0];
if (wrapper instanceof SplitterItem) {
if (!directionUp[0]) {
final int index = myList.getSelectedIndex();
if (myList.getItemsCount() >= index + 1) {
myList.setSelectedIndex(index + 1);
}
else {
myList.setSelectedIndex(0);
}
}
else {
final int index = myList.getSelectedIndex();
if (index - 1 > 0) {
myList.setSelectedIndex(index - 1);
}
else {
myList.setSelectedIndex(myList.getItemsCount() - 1);
}
}
}
pathLabel.setText(getTitle2Text(wrapper.footerText()));
}
else {
@@ -212,6 +237,11 @@ public class MasterDetailPopupBuilder {
}
}
else if (e.getKeyCode() == KeyEvent.VK_UP) {
directionUp[0] = true;
} else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
directionUp[0] = false;
}
else if (e.getModifiersEx() == 0) {
myDelegate.handleMnemonic(e, myProject, popup);
}
@@ -240,8 +270,6 @@ public class MasterDetailPopupBuilder {
void handleMnemonic(KeyEvent e, Project project, JBPopup popup);
void itemRemoved(ItemWrapper item, Project project);
boolean hasItemsWithMnemonic(Project project);
}
@@ -253,7 +281,7 @@ public class MasterDetailPopupBuilder {
super(new BorderLayout());
myProject = project;
setBackground(UIUtil.getListBackground());
setBackground(UIUtil.getPanelBackground());
final JLabel mnemonicLabel = new JLabel();
mnemonicLabel.setFont(Bookmark.MNEMONIC_FONT);
@@ -55,7 +55,10 @@ class XBreakpointItem implements BreakpointItem {
@Override
public void execute(Project project) {
//To change body of implemented methods use File | Settings | File Templates.
final XSourcePosition position = myBreakpoint.getSourcePosition();
if (position != null) {
position.createNavigatable(project).navigate(true);
}
}
@Override
@@ -74,7 +77,7 @@ class XBreakpointItem implements BreakpointItem {
XLightBreakpointPropertiesPanel<XBreakpoint<?>> propertiesPanel =
new XLightBreakpointPropertiesPanel<XBreakpoint<?>>(project, getManager(), myBreakpoint, true);
propertiesPanel.loadProperties();
panel.setDetailPanel(propertiesPanel.getMainPanel());
XSourcePosition sourcePosition = myBreakpoint.getSourcePosition();
@@ -91,11 +91,6 @@ public class BreakpointsMasterDetailPopupFactory {
//To change body of implemented methods use File | Settings | File Templates.
}
@Override
public void itemRemoved(ItemWrapper item, Project project) {
//To change body of implemented methods use File | Settings | File Templates.
}
public boolean hasItemsWithMnemonic(Project project) {
return false;
}
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.xdebugger.impl.breakpoints.ui.XLightBreakpointPropertiesPanel">
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="7" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="myMainPanel" custom-create="true" layout-manager="GridLayoutManager" row-count="7" 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="20" y="20" width="500" height="400"/>
@@ -55,6 +55,16 @@ public class XLightBreakpointPropertiesPanel<B extends XBreakpoint<?>> implement
}
}
private void createUIComponents() {
myMainPanel = new JPanel() {
@Override
public void removeNotify() {
super.removeNotify();
saveProperties();
}
};
}
public interface Delegate {
void showMoreOptions();
}