use of javax.swing.event.DocumentEvent in project android by JetBrains.
the class ChooseResourceDialog method createSearchField.
@NotNull
private SearchField createSearchField() {
SearchField searchField = new // no history: interferes with arrow down to jump into the list
SearchField(// no history: interferes with arrow down to jump into the list
false) {
@Override
protected void showPopup() {
// Turn off search popup; we're overriding the Down key to jump into the list instead
}
};
searchField.getTextEditor().addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
// Allow arrow down to jump directly into the list
if (e.getKeyCode() == KeyEvent.VK_DOWN) {
e.consume();
getSelectedPanel().selectFirst();
}
}
});
searchField.setMaximumSize(new Dimension(JBUI.scale(300), searchField.getMaximumSize().height));
searchField.addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
updateFilter();
}
});
return searchField;
}
use of javax.swing.event.DocumentEvent in project intellij-plugins by JetBrains.
the class SelectDirWithFlashBuilderProjectsStep method setupInitialPathComponent.
private void setupInitialPathComponent() {
myInitialPathComponent.getComponent().getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
protected void textChanged(final DocumentEvent e) {
onInitialPathChanged();
}
});
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, true, true, false, false) {
public boolean isFileVisible(final VirtualFile file, final boolean showHiddenFiles) {
return (super.isFileVisible(file, showHiddenFiles) && (file.isDirectory() || FlashBuilderProjectFinder.isFlashBuilderProject(file)) || FlashBuilderProjectFinder.hasArchiveExtension(file.getPath()));
}
public Icon getIcon(final VirtualFile file) {
// do not use Flash Builder specific icon for zip
return !file.isDirectory() && (FlashBuilderProjectFinder.hasFxpExtension(file.getPath()) || FlashBuilderProjectFinder.isFlashBuilderProject(file)) ? dressIcon(file, getBuilder().getIcon()) : super.getIcon(file);
}
};
myInitialPathComponent.getComponent().addBrowseFolderListener(FlexBundle.message("select.flash.builder.workspace.or.project"), null, getWizardContext().getProject(), descriptor);
}
use of javax.swing.event.DocumentEvent in project intellij-plugins by JetBrains.
the class SwingUtils method addTextChangeListener.
public static void addTextChangeListener(final JTextComponent textComponent, final TextChangeListener textChangeListener) {
final String[] oldTextContainer = { textComponent.getText() };
textChangeListener.textChanged("", textComponent.getText());
textComponent.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
textChanged();
}
@Override
public void removeUpdate(DocumentEvent e) {
textChanged();
}
@Override
public void changedUpdate(DocumentEvent e) {
textChanged();
}
public void textChanged() {
String oldText = ObjectUtils.notNull(oldTextContainer[0], "");
String newText = ObjectUtils.notNull(textComponent.getText(), "");
if (!oldText.equals(newText)) {
textChangeListener.textChanged(oldText, newText);
oldTextContainer[0] = newText;
}
}
});
}
use of javax.swing.event.DocumentEvent in project intellij-plugins by JetBrains.
the class DartGeneratorPeer method enableIntellijLiveValidation.
private void enableIntellijLiveValidation() {
final JTextComponent editorComponent = (JTextComponent) mySdkPathComboWithBrowse.getComboBox().getEditor().getEditorComponent();
editorComponent.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(final DocumentEvent e) {
validateInIntelliJ();
}
});
myCreateSampleProjectCheckBox.addActionListener(e -> validateInIntelliJ());
myTemplatesList.addListSelectionListener(e -> validateInIntelliJ());
}
use of javax.swing.event.DocumentEvent in project intellij-plugins by JetBrains.
the class CompilerOptionsConfigurable method initButtonsAndAdditionalOptions.
private void initButtonsAndAdditionalOptions() {
if (myMode == Mode.BC || myMode == Mode.Module) {
final CompilerOptionsListener optionsListener = new CompilerOptionsListener() {
public void optionsInTableChanged() {
updateTreeTable();
}
public void additionalOptionsChanged() {
updateAdditionalOptionsControls();
}
};
if (myMode == Mode.BC) {
myBCManager.getModuleLevelCompilerOptions().addOptionsListener(optionsListener, myDisposable);
}
myProjectLevelOptionsHolder.getProjectLevelCompilerOptions().addOptionsListener(optionsListener, myDisposable);
}
final ActionListener projectDefaultsListener = new ActionListener() {
public void actionPerformed(final ActionEvent e) {
ModifiableCompilerOptions compilerOptions = myProjectLevelOptionsHolder.getProjectLevelCompilerOptions();
final CompilerOptionsConfigurable configurable = new CompilerOptionsConfigurable(Mode.Project, null, myProject, myNature, myDependenciesConfigurable, compilerOptions);
ShowSettingsUtil.getInstance().editConfigurable(myProject, configurable);
}
};
final ActionListener moduleDefaultsListener = new ActionListener() {
public void actionPerformed(final ActionEvent e) {
ModifiableCompilerOptions compilerOptions = myBCManager.getModuleLevelCompilerOptions();
final CompilerOptionsConfigurable configurable = new CompilerOptionsConfigurable(Mode.Module, myModule, myProject, myNature, myDependenciesConfigurable, compilerOptions);
ShowSettingsUtil.getInstance().editConfigurable(myProject, configurable);
}
};
myConfigFileTextWithBrowse.addBrowseFolderListener(null, null, myProject, FlexUtils.createFileChooserDescriptor("xml"));
myConfigFileTextWithBrowse.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
protected void textChanged(final DocumentEvent e) {
updateAdditionalOptionsControls();
fireConfigFileChanged();
}
});
myConfigFileLabel.setVisible(myMode == Mode.BC);
myConfigFileTextWithBrowse.setVisible(myMode == Mode.BC);
myInheritedOptionsLabel.setVisible(myMode == Mode.BC || myMode == Mode.Module);
myInheritedOptionsField.setVisible(myMode == Mode.BC || myMode == Mode.Module);
final String labelText = myMode == Mode.BC ? "Additional compiler options:" : myMode == Mode.Module ? "Default options for module:" : "Default options for project:";
myAdditionalOptionsLabel.setText(labelText);
myAdditionalOptionsField.setDialogCaption(StringUtil.capitalizeWords(labelText, true));
myAdditionalOptionsField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
protected void textChanged(final DocumentEvent e) {
updateAdditionalOptionsControls();
fireAdditionalOptionsChanged();
}
});
myNoteLabel.setIcon(UIUtil.getBalloonInformationIcon());
myProjectDefaultsButton.addActionListener(projectDefaultsListener);
myProjectDefaultsButton.setVisible(myMode == Mode.BC || myMode == Mode.Module);
myModuleDefaultsButton.addActionListener(moduleDefaultsListener);
myModuleDefaultsButton.setVisible(myMode == Mode.BC);
}
Aggregations