use of com.intellij.ui.DocumentAdapter in project intellij-community by JetBrains.
the class HgBookmarkDialog method createCenterPanel.
@Override
@NotNull
protected JComponent createCenterPanel() {
JPanel contentPanel = new JPanel(new GridBagLayout());
GridBag g = new GridBag().setDefaultInsets(new Insets(0, 0, DEFAULT_VGAP, DEFAULT_HGAP)).setDefaultAnchor(GridBagConstraints.LINE_START).setDefaultFill(GridBagConstraints.HORIZONTAL);
JLabel icon = new JLabel(UIUtil.getQuestionIcon(), SwingConstants.LEFT);
myBookmarkName = new JBTextField(13);
myBookmarkName.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
public void textChanged(DocumentEvent e) {
validateFields();
}
});
JBLabel bookmarkLabel = new JBLabel("Bookmark name:");
bookmarkLabel.setLabelFor(myBookmarkName);
myActiveCheckbox = new JBCheckBox("Inactive", false);
contentPanel.add(icon, g.nextLine().next().coverColumn(3).pady(DEFAULT_HGAP));
contentPanel.add(bookmarkLabel, g.next().fillCellNone().insets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)));
contentPanel.add(myBookmarkName, g.next().coverLine().setDefaultWeightX(1));
contentPanel.add(myActiveCheckbox, g.nextLine().next().next().coverLine(2));
return contentPanel;
}
use of com.intellij.ui.DocumentAdapter in project intellij-community by JetBrains.
the class BaseIntroduceDialog method init.
protected void init(XPathExpression expression, int numberOfExpressions, String title) {
setModal(true);
setTitle(title);
final JLabel jLabel = getTypeLabel();
jLabel.setText(expression.getType().getName());
final JCheckBox jCheckBox = getReplaceAll();
if (numberOfExpressions > 1) {
jCheckBox.setText(MessageFormat.format(jCheckBox.getText(), String.valueOf(numberOfExpressions)));
} else {
jCheckBox.setVisible(false);
}
getNameField().addDocumentListener(new DocumentAdapter() {
protected void textChanged(DocumentEvent e) {
getOKAction().setEnabled(myInputValidator.checkInput(getName()));
}
});
getOKAction().setEnabled(false);
init();
}
use of com.intellij.ui.DocumentAdapter in project intellij-community by JetBrains.
the class RequiredAttributesInspection method createOptionsPanel.
@Override
@Nullable
public JComponent createOptionsPanel() {
JPanel panel = new JPanel(new BorderLayout());
FieldPanel additionalAttributesPanel = new FieldPanel(InspectionsBundle.message("inspection.javadoc.html.not.required.label.text"), InspectionsBundle.message("inspection.javadoc.html.not.required.dialog.title"), null, null);
panel.add(additionalAttributesPanel, BorderLayout.NORTH);
additionalAttributesPanel.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
final Document document = e.getDocument();
try {
final String text = document.getText(0, document.getLength());
if (text != null) {
myAdditionalRequiredHtmlAttributes = text.trim();
}
} catch (BadLocationException e1) {
LOG.error(e1);
}
}
});
additionalAttributesPanel.setText(myAdditionalRequiredHtmlAttributes);
return panel;
}
use of com.intellij.ui.DocumentAdapter in project intellij-community by JetBrains.
the class MavenEnvironmentForm method createComponent.
public JComponent createComponent() {
// all listeners will be removed when dialog is closed
mavenHomeComponent.getComponent().addBrowseFolderListener(ProjectBundle.message("maven.select.maven.home.directory"), "", null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR, TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
mavenHomeField.addDocumentListener(new DocumentAdapter() {
protected void textChanged(DocumentEvent e) {
updateMavenVersionLabel();
}
});
settingsFileComponent.getComponent().addBrowseFolderListener(ProjectBundle.message("maven.select.maven.settings.file"), "", null, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
localRepositoryComponent.getComponent().addBrowseFolderListener(ProjectBundle.message("maven.select.local.repository"), "", null, FileChooserDescriptorFactory.createSingleFolderDescriptor());
return panel;
}
use of com.intellij.ui.DocumentAdapter in project intellij-community by JetBrains.
the class TerminalSettingsPanel method createPanel.
public JComponent createPanel(@NotNull TerminalOptionsProvider provider, @NotNull TerminalProjectOptionsProvider projectOptionsProvider) {
myOptionsProvider = provider;
myProjectOptionsProvider = projectOptionsProvider;
myProjectSettingsPanel.setBorder(IdeBorderFactory.createTitledBorder("Project settings"));
myGlobalSettingsPanel.setBorder(IdeBorderFactory.createTitledBorder("Application settings"));
FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false);
myShellPathField.addBrowseFolderListener("", "Shell executable path", null, fileChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
fileChooserDescriptor = new FileChooserDescriptor(false, true, false, false, false, false);
myStartDirectoryField.addBrowseFolderListener("", "Starting directory", null, fileChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
myShellPathField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
myShellPathField.getTextField().setForeground(StringUtil.equals(myShellPathField.getText(), myProjectOptionsProvider.getDefaultShellPath()) ? getDefaultValueColor() : getChangedValueColor());
}
});
myStartDirectoryField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
myStartDirectoryField.getTextField().setForeground(StringUtil.equals(myStartDirectoryField.getText(), myProjectOptionsProvider.getDefaultStartingDirectory()) ? getDefaultValueColor() : getChangedValueColor());
}
});
for (LocalTerminalCustomizer c : LocalTerminalCustomizer.EP_NAME.getExtensions()) {
UnnamedConfigurable configurable = c.getConfigurable(projectOptionsProvider.getProject());
if (configurable != null) {
myConfigurables.add(configurable);
JComponent component = configurable.createComponent();
if (component != null) {
myConfigurablesPanel.add(component, BorderLayout.CENTER);
}
}
}
return myWholePanel;
}
Aggregations