public AntArtifactPropertiesEditor( AntArtifactProperties properties, Project project, boolean postProcessing) { myProperties = properties; myProject = project; myPostProcessing = postProcessing; mySelectTargetButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { selectTarget(); } }); myRunTargetCheckBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { mySelectTargetButton.setEnabled(myRunTargetCheckBox.isSelected()); if (myRunTargetCheckBox.isSelected() && myTarget == null) { selectTarget(); } } }); }
protected JComponent createCenterPanel() { JPanel panel = new JPanel(new GridBagLayout()); panel.add( new JLabel(myName), new GridBagConstraints( 0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 3, 5), 0, 0)); panel.add( myTfUrl, new GridBagConstraints( 0, 1, 2, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0)); myTfUrl.setPreferredSize(new Dimension(350, myTfUrl.getPreferredSize().height)); if (myShowPath) { panel.add( new JLabel(myLocation), new GridBagConstraints( 0, 2, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 3, 5), 0, 0)); panel.add( myTfPath, new GridBagConstraints( 0, 3, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 10, 0), 0, 0)); panel.add( myBtnBrowseLocalPath, new GridBagConstraints( 1, 3, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 10, 5), 0, 0)); // TextFieldWithBrowseButton.MyDoClickAction.addTo(myBtnBrowseLocalPath, myTfPath); myBtnBrowseLocalPath.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ignored) { FileChooserDescriptor descriptor = getChooserDescriptor(); VirtualFile file = FileChooser.chooseFile(descriptor, myProject, null); if (file != null) { myTfPath.setText(file.getPath().replace('/', File.separatorChar)); } } }); } // return panel; }