use of com.intellij.ui.DocumentAdapter in project intellij-plugins by JetBrains.
the class PhoneGapRunConfigurationEditor method setListenerForExecutablePath.
private void setListenerForExecutablePath() {
final Ref<String> prevExecutablePathRef = Ref.create(StringUtil.notNullize(myExecutablePathField.getText()));
final JTextField textEditor = myExecutablePathField.getChildComponent().getTextEditor();
textEditor.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
String executablePath = StringUtil.notNullize(textEditor.getText());
if (StringUtil.isEmpty(executablePath))
return;
String prevExecutablePath = prevExecutablePathRef.get();
if (!prevExecutablePath.equals(executablePath)) {
setCommandList();
prevExecutablePathRef.set(executablePath);
}
}
});
}
use of com.intellij.ui.DocumentAdapter in project intellij-plugins by JetBrains.
the class DartGeneratorPeer method addSettingsStateListener.
@Override
public void addSettingsStateListener(@NotNull final WebProjectGenerator.SettingsStateListener stateListener) {
// invalid Dartium path is not a blocking error
final JTextComponent editorComponent = (JTextComponent) mySdkPathComboWithBrowse.getComboBox().getEditor().getEditorComponent();
editorComponent.getDocument().addDocumentListener(new DocumentAdapter() {
protected void textChanged(final DocumentEvent e) {
stateListener.stateChanged(validate() == null);
}
});
myCreateSampleProjectCheckBox.addActionListener(e -> stateListener.stateChanged(validate() == null));
myTemplatesList.addListSelectionListener(e -> stateListener.stateChanged(validate() == null));
}
use of com.intellij.ui.DocumentAdapter in project intellij-plugins by JetBrains.
the class RegistrationForm method setupFormActionsAndLF.
private void setupFormActionsAndLF() {
myUseExisting.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
boolean useExisting = myUseExisting.isSelected();
JComponent[] hideableFields = new JComponent[] { myNickname, myNicknameLabel, myFirstName, myFirstNameLabel, myLastName, myLastNameLabel, myPasswordAgain, myPasswordAgainLabel };
for (JComponent hideableField : hideableFields) {
hideableField.setVisible(!useExisting);
}
Window window = SwingUtilities.getWindowAncestor(myPanel);
if (window != null) {
window.pack();
}
}
});
UIUtil.traverse(myPanel, new UIUtil.TraverseAction() {
public boolean executeAndContinue(Component c) {
if (c instanceof JTextComponent) {
JTextComponent textComponent = (JTextComponent) c;
textComponent.getDocument().addDocumentListener(new DocumentAdapter() {
protected void textChanged(DocumentEvent e) {
myErrorLabel.setText(null);
}
});
}
return true;
}
});
}
use of com.intellij.ui.DocumentAdapter in project android by JetBrains.
the class IconPickerDialog method createUIComponents.
private void createUIComponents() {
mySearchField = new SearchField(false);
mySearchField.addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
updateFilter();
}
});
}
use of com.intellij.ui.DocumentAdapter in project liferay-ide by liferay.
the class LiferayModuleNameLocationComponent method bindModuleSettings.
public void bindModuleSettings(LiferayNamePathComponent namePathComponent) {
JTextField nameComponent = namePathComponent.getNameComponent();
Document nameDocument = nameComponent.getDocument();
nameDocument.addDocumentListener(new DocumentAdapter() {
protected void textChanged(DocumentEvent event) {
if (!_moduleNameChangedByUser) {
setModuleName(namePathComponent.getNameValue());
}
}
});
JTextField pathComponent = namePathComponent.getPathComponent();
Document pathDocument = pathComponent.getDocument();
pathDocument.addDocumentListener(new DocumentAdapter() {
protected void textChanged(DocumentEvent event) {
if (!_contentRootChangedByUser) {
_setModuleContentRoot(namePathComponent.getPath());
}
}
});
Document document = _moduleName.getDocument();
document.addDocumentListener(new DocumentAdapter() {
protected void textChanged(DocumentEvent event) {
if (_moduleNameDocListenerEnabled) {
_moduleNameChangedByUser = true;
}
String path = _getDefaultBaseDir(_context, namePathComponent);
String moduleName = _getModuleName();
if ((path.length() > 0) && !Comparing.strEqual(moduleName, namePathComponent.getNameValue())) {
path += "/" + _getTargetFolderName() + "/" + moduleName;
}
if (!_contentRootChangedByUser) {
boolean f = _moduleNameChangedByUser;
_moduleNameChangedByUser = true;
_setModuleContentRoot(path);
_moduleNameChangedByUser = f;
}
if (!_imlLocationChangedByUser) {
_setImlFileLocation(path);
}
}
});
Document moduleContentRootDocument = _moduleContentRoot.getDocument();
moduleContentRootDocument.addDocumentListener(new DocumentAdapter() {
protected void textChanged(DocumentEvent event) {
if (_contentRootDocListenerEnabled) {
_contentRootChangedByUser = true;
}
if (!_imlLocationChangedByUser) {
_setImlFileLocation(_getModuleContentRoot());
}
if (!_moduleNameChangedByUser) {
String path = FileUtil.toSystemIndependentName(_getModuleContentRoot());
int idx = path.lastIndexOf("/");
boolean f = _contentRootChangedByUser;
_contentRootChangedByUser = true;
boolean i = _imlLocationChangedByUser;
_imlLocationChangedByUser = true;
setModuleName(idx >= 0 ? path.substring(idx + 1) : "");
_contentRootChangedByUser = f;
_imlLocationChangedByUser = i;
}
}
});
Document moduleFileLocationDocument = _moduleFileLocation.getDocument();
moduleFileLocationDocument.addDocumentListener(new DocumentAdapter() {
protected void textChanged(DocumentEvent event) {
if (_imlLocationDocListenerEnabled) {
_imlLocationChangedByUser = true;
}
}
});
JTextField jTextField = namePathComponent.getPathComponent();
Document namePathDocument = jTextField.getDocument();
namePathDocument.addDocumentListener(new DocumentAdapter() {
protected void textChanged(DocumentEvent event) {
if (!_imlLocationChangedByUser) {
_setImlFileLocation(namePathComponent.getPath());
}
}
});
}
Aggregations