only show inspector when debugger enabled, change inspector location

This commit is contained in:
Ben Fry
2015-05-19 16:43:36 -04:00
parent dd0dadc845
commit b59546eb69
3 changed files with 23 additions and 14 deletions

View File

@@ -1522,6 +1522,7 @@ public class JavaEditor extends Editor {
debugMenu.add(item);
item.setEnabled(false);
/*
inspectorItem = Toolkit.newJMenuItem(Language.text("menu.debug.show_variables"), 'Y');
inspectorItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@@ -1530,6 +1531,7 @@ public class JavaEditor extends Editor {
});
debugMenu.add(inspectorItem);
inspectorItem.setEnabled(false);
*/
/*
item = new JMenuItem(Language.text("menu.debug.list_breakpoints"));
@@ -2188,10 +2190,12 @@ public class JavaEditor extends Editor {
debugItem.setText(Language.text("menu.debug.enable"));
}
// Hide the variable inspector if it's currently visible
if (!debugEnabled && inspector.isVisible()) {
toggleVariableInspector();
}
// // Hide the variable inspector if it's currently visible
// if (!debugEnabled && inspector.isVisible()) {
// toggleVariableInspector();
// }
inspector.setVisible(debugEnabled);
/*
if (enabled) {
inspector.setFocusableWindowState(false); // to not get focus when set visible
@@ -2209,6 +2213,7 @@ public class JavaEditor extends Editor {
}
/*
public void toggleVariableInspector() {
if (inspector.isVisible()) {
inspectorItem.setText(Language.text("menu.debug.show_variables"));
@@ -2220,6 +2225,7 @@ public class JavaEditor extends Editor {
// inspector.setFocusableWindowState(true); // allow to get focus again
}
}
*/
// public void showVariableInspector() {

View File

@@ -111,9 +111,15 @@ public class VariableInspector extends JDialog {
getContentPane().add(box);
pack();
// setLocation(editor.getX() + editor.getWidth() + HORIZONTAL_OFFSET,
// editor.getY() + VERTICAL_OFFSET);
setLocationRelativeTo(editor);
int x = editor.getX() + editor.getWidth() + HORIZONTAL_OFFSET;
if (x + getWidth() > getToolkit().getScreenSize().width) {
// If it doesn't fit on screen, place it inside the editor window,
// per the OS rules for window placement
setLocationRelativeTo(editor);
} else {
// If it'll fit, place it to the right of the editor window
setLocation(x, editor.getY() + VERTICAL_OFFSET);
}
/*
bgColor = mode.getColor("buttons.bgcolor");