assertionListPopup.add(new ShowOnlineHelpAction(getHelpUrl()));
return;
}
int[] indices = assertionList.getSelectedIndices();
if (indices.length == 1) {
TestAssertion assertion = assertionListModel.getAssertionAt(ix);
ActionSupport.addActions(ActionListBuilder.buildActions(assertion), assertionListPopup);
} else {
TestAssertion[] testAssertion = new TestAssertion[indices.length];
for (int c = 0; c < indices.length; c++) {
testAssertion[c] = assertionListModel.getAssertionAt(indices[c]);
}
ActionSupport.addActions(ActionListBuilder.buildMultiActions(testAssertion), assertionListPopup);
}
}
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
}
public void popupMenuCanceled(PopupMenuEvent e) {
}
});
assertionList.setComponentPopupMenu(assertionListPopup);
assertionList.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() < 2) {
return;
}
int ix = assertionList.getSelectedIndex();
if (ix == -1) {
return;
}
Object obj = assertionList.getModel().getElementAt(ix);
if (obj instanceof TestAssertion) {
TestAssertion assertion = (TestAssertion) obj;
if (assertion.isConfigurable()) {
assertion.configure();
}
return;
}
if (obj instanceof AssertionError) {
AssertionError error = (AssertionError) obj;
if (error.getLineNumber() >= 0) {
selectError(error);
} else {
Toolkit.getDefaultToolkit().beep();
}
} else {
Toolkit.getDefaultToolkit().beep();
}
}
});
assertionList.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
int ix = assertionList.getSelectedIndex();
if (ix == -1) {
return;
}
int[] indices = assertionList.getSelectedIndices();
if (indices.length == 1) {
TestAssertion assertion = assertionListModel.getAssertionAt(ix);
if (e.getKeyChar() == KeyEvent.VK_ENTER) {
if (assertion.isConfigurable()) {
assertion.configure();
}
} else {
ActionList actions = ActionListBuilder.buildActions(assertion);
if (actions != null) {
actions.dispatchKeyEvent(e);