}
@Override
public void menuOptions(final UserActionSet options) {
final String showExplorationMenu = "Always show exploration menu " + (viewer.showExplorationMenuByDefault ? "off" : "on");
options.add(new UserActionAbstract(showExplorationMenu, ActionType.DEBUG) {
@Override
public void execute(final Workspace workspace, final View view, final Location at) {
viewer.showExplorationMenuByDefault = !viewer.showExplorationMenuByDefault;
view.markDamaged();
}
});
final String repaint = "Show painting area " + (viewer.showRepaintArea ? "off" : "on");
options.add(new UserActionAbstract(repaint, ActionType.DEBUG) {
@Override
public void execute(final Workspace workspace, final View view, final Location at) {
viewer.showRepaintArea = !viewer.showRepaintArea;
view.markDamaged();
}
});
final String debug = "Debug graphics " + (Toolkit.debug ? "off" : "on");
options.add(new UserActionAbstract(debug, ActionType.DEBUG) {
@Override
public void execute(final Workspace workspace, final View view, final Location at) {
Toolkit.debug = !Toolkit.debug;
view.markDamaged();
}
});
final String action = viewer.isShowingMouseSpy() ? "Hide" : "Show";
options.add(new UserActionAbstract(action + " mouse spy", ActionType.DEBUG) {
@Override
public void execute(final Workspace workspace, final View view, final Location at) {
viewer.setShowMouseSpy(!viewer.isShowingMouseSpy());
}
});
// I've commented this out because in the new design we should close the
// ExecutionContext
// and then re-login.
// options.add(new AbstractUserAction("Restart object loader/persistor",
// UserAction.DEBUG) {
// @Override
// public void execute(final Workspace workspace, final View view, final
// Location at) {
// IsisContext.getObjectPersistor().reset();
// }
// });
options.add(new UserActionAbstract("Diagnostics...", ActionType.DEBUG) {
@Override
public void execute(final Workspace workspace, final View view, final Location at) {
final InfoDebugFrame f = new InfoDebugFrame();
final DebuggableWithTitle info = new DebuggableWithTitle() {
@Override
public void debugData(final DebugBuilder debug) {
final ByteArrayOutputStream out2 = new ByteArrayOutputStream();
final PrintStream out = new PrintStream(out2);
new SystemPrinter(out).printDiagnostics();
debug.append(out2.toString());
}
@Override
public String debugTitle() {
return "Diagnostics";
}
};
f.setInfo(info);
f.show(at.getX() + 50, workspace.getBounds().getY() + 6);
}
});
options.add(new UserActionAbstract("Debug system...", ActionType.DEBUG) {
@Override
public void execute(final Workspace workspace, final View view, final Location at) {
final InfoDebugFrame f = new InfoDebugFrame();
final DebuggableWithTitle[] contextInfo = IsisContext.debugSystem();
f.setInfo(contextInfo);
f.show(at.getX() + 50, workspace.getBounds().getY() + 6);
}
});
options.add(new UserActionAbstract("Debug session...", ActionType.DEBUG) {
@Override
public void execute(final Workspace workspace, final View view, final Location at) {
final InfoDebugFrame f = new InfoDebugFrame();
final DebuggableWithTitle[] contextInfo = IsisContext.debugSession();
f.setInfo(contextInfo);
f.show(at.getX() + 50, workspace.getBounds().getY() + 6);
}
});
options.add(new UserActionAbstract("Debug viewer...", ActionType.DEBUG) {
@Override
public void execute(final Workspace workspace, final View view, final Location at) {
final InfoDebugFrame f = new InfoDebugFrame();
f.setInfo(new DebuggableWithTitle[] { Toolkit.getViewFactory(), viewer.updateNotifier });
f.show(at.getX() + 50, workspace.getBounds().getY() + 6);
}
});
options.add(new UserActionAbstract("Debug overlay...", ActionType.DEBUG) {
@Override
public void execute(final Workspace workspace, final View view, final Location at) {
final DebugFrame f = new OverlayDebugFrame(viewer);
f.show(at.getX() + 50, workspace.getBounds().getY() + 6);
}