protected JComponent createCenterPanel() { final VirtualFile[] sourceRoots = getSourceRoots(); boolean isDestinationVisible = sourceRoots.length > 1; myDestinationFolderCB.setVisible(isDestinationVisible); myTargetDestinationLabel.setVisible(isDestinationVisible); return null; }
@Override public void dispose() { super.dispose(); if (myValidationManager != null) { myValidationManager.removeScopeListener(myScopeListener); myValidationManager = null; } if (myNamedScopeManager != null) { myNamedScopeManager.removeScopeListener(myScopeListener); myNamedScopeManager = null; } myScopeListener = null; }
protected JComponent createCenterPanel() { boolean isDestinationVisible = getSourceRoots().size() > 1; myDestinationFolderCB.setVisible(isDestinationVisible); myTargetDestinationLabel.setVisible(isDestinationVisible); return null; }
public ResourceEditor( @Nullable ResourceType[] types, Set<AttributeFormat> formats, @Nullable String[] values) { myTypes = types; myIsDimension = formats.contains(AttributeFormat.Dimension); if (formats.contains(AttributeFormat.Boolean)) { myCheckBox = new JCheckBox(); myEditor = new ComponentWithBrowseButton<JCheckBox>(myCheckBox, null) { @Override public Dimension getPreferredSize() { return getComponentPreferredSize(); } }; myCheckBox.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (!myIgnoreCheckBoxValue) { myBooleanResourceValue = null; fireValueCommitted(false, true); } } }); } else if (formats.contains(AttributeFormat.Enum)) { ComboboxWithBrowseButton editor = new ComboboxWithBrowseButton(SystemInfo.isWindows ? new MyComboBox() : new JComboBox()) { @Override public Dimension getPreferredSize() { return getComponentPreferredSize(); } }; final JComboBox comboBox = editor.getComboBox(); DefaultComboBoxModel model = new DefaultComboBoxModel(values); model.insertElementAt(StringsComboEditor.UNSET, 0); comboBox.setModel(model); comboBox.setEditable(true); ComboEditor.installListeners( comboBox, new ComboEditor.ComboEditorListener(this) { @Override protected void onValueChosen() { if (comboBox.getSelectedItem() == StringsComboEditor.UNSET) { comboBox.setSelectedItem(null); } super.onValueChosen(); } }); myEditor = editor; comboBox.setSelectedIndex(0); } else { myEditor = new TextFieldWithBrowseButton() { @Override protected void installPathCompletion( FileChooserDescriptor fileChooserDescriptor, @Nullable Disposable parent) {} @Override public Dimension getPreferredSize() { return getComponentPreferredSize(); } }; myEditor.registerKeyboardAction( new ActionListener() { @Override public void actionPerformed(ActionEvent e) {} }, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); JTextField textField = getComboText(); textField.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { fireValueCommitted(false, true); } }); textField .getDocument() .addDocumentListener( new DocumentAdapter() { @Override protected void textChanged(final DocumentEvent e) { preferredSizeChanged(); } }); selectTextOnFocusGain(textField); } if (myCheckBox == null) { myEditor.registerKeyboardAction( new ActionListener() { @Override public void actionPerformed(ActionEvent e) {} }, KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); } myEditor.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showDialog(); } }); myEditor.addFocusListener( new FocusAdapter() { @Override public void focusGained(FocusEvent e) { myEditor.getChildComponent().requestFocus(); } }); }
@Override public void dispose() { CloudConfigurationCoordinator.getInstance(myConfigurationKind).removeComboBox(this); super.dispose(); }