public void browseTestClasses() { TestCollector collector= createTestCollector(); TestSelector selector= new TestSelector(fFrame, collector); if (selector.isEmpty()) { JOptionPane.showMessageDialog(fFrame, "No Test Cases found.\nCheck that the configured \'TestCollector\' is supported on this platform."); return; } selector.show(); String className= selector.getSelectedItem(); if (className != null) setSuite(className); }
public void valueChanged(ListSelectionEvent e) { checkEnableOK(e); } }
public void actionPerformed(ActionEvent e) { dispose(); } }
public TestSelector(Frame parent, TestCollector testCollector) { super(parent, true); setSize(350, 300); setResizable(false); setLocationRelativeTo(parent); } catch (NoSuchMethodError e) { centerWindow(this); setTitle("Test Selector"); list= createTestList(testCollector); } finally { parent.setCursor(Cursor.getDefaultCursor()); fOk= new JButton("OK"); fOk.setEnabled(false); getRootPane().setDefaultButton(fOk); defineLayout(); addListeners();
private void defineLayout() { getContentPane().setLayout(new GridBagLayout()); GridBagConstraints labelConstraints = new GridBagConstraints(); labelConstraints.gridx= 0; labelConstraints.gridy= 0; labelConstraints.weighty= 0.0; labelConstraints.insets= new Insets(8, 8, 0, 8); getContentPane().add(fDescription, labelConstraints); listConstraints.weighty= 1.0; listConstraints.insets= new Insets(8, 8, 8, 8); getContentPane().add(fScrolledList, listConstraints); okConstraints.anchor= java.awt.GridBagConstraints.EAST; okConstraints.insets= new Insets(0, 8, 8, 8); getContentPane().add(fOk, okConstraints); cancelConstraints.anchor= java.awt.GridBagConstraints.EAST; cancelConstraints.insets= new Insets(0, 8, 8, 8); getContentPane().add(fCancel, cancelConstraints);
addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) {
setLocationRelativeTo(parent); } catch (NoSuchMethodError e) { TestSelector.centerWindow(this);
public void windowClosing(WindowEvent e) { dispose(); } }
public void okSelected() { fSelectedItem= (String)fList.getSelectedValue(); dispose(); }