use of com.intellij.ui.DocumentAdapter in project Perl5-IDEA by Camelcade.
the class PerlConfigurationEditor method getGeneralComponent.
@Nullable
@Override
protected JComponent getGeneralComponent() {
myScriptField = new TextFieldWithBrowseButton();
myScriptField.addBrowseFolderListener(PerlBundle.message("perl.run.config.select.script.header"), PerlBundle.message("perl.run.config.select.script.prompt"), myProject, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor().withFileFilter(PerlConfigurationProducer::isExecutableFile), TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
myConsoleCharset = new ComboBox(new CollectionComboBoxModel(new ArrayList<>(Charset.availableCharsets().keySet())));
myScriptField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent documentEvent) {
VirtualFile file = LocalFileSystem.getInstance().findFileByPath(myScriptField.getText());
if (file != null) {
myConsoleCharset.setSelectedItem(file.getCharset().displayName());
} else {
myConsoleCharset.setSelectedItem(null);
}
}
});
myAlternativeSdkPanel = new PerlAlternativeSdkPanel();
myParametersPanel = new CommonProgramParametersPanel() {
@Override
protected void addComponents() {
LabeledComponent<?> scriptLabel = LabeledComponent.create(myScriptField, PerlBundle.message("perl.run.option.script"));
scriptLabel.setLabelLocation(BorderLayout.WEST);
add(scriptLabel);
LabeledComponent<?> consoleEncoding = LabeledComponent.create(myConsoleCharset, PerlBundle.message("perl.run.option.output.encoding"));
consoleEncoding.setLabelLocation(BorderLayout.WEST);
add(consoleEncoding);
myPerlParametersPanel = new RawCommandLineEditor();
LabeledComponent<RawCommandLineEditor> perlParametersPanel = LabeledComponent.create(myPerlParametersPanel, PerlBundle.message("perl.run.option.perl.parameters"));
perlParametersPanel.setLabelLocation(BorderLayout.WEST);
copyDialogCaption(perlParametersPanel);
add(perlParametersPanel);
super.addComponents();
add(myAlternativeSdkPanel);
setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 5, true, false));
}
};
myParametersPanel.setProgramParametersLabel(PerlBundle.message("perl.run.option.script.parameters"));
return myParametersPanel;
}
use of com.intellij.ui.DocumentAdapter in project intellij by bazelbuild.
the class NewRuleUI method syncRuleNameTo.
void syncRuleNameTo(JBTextField textField) {
ruleNameField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
ruleNameEditedByUser = true;
}
});
textField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
if (!ruleNameEditedByUser) {
syncRuleName(textField.getText());
}
}
});
}
use of com.intellij.ui.DocumentAdapter in project flutter-intellij by flutter.
the class FlutterGeneratorPeer method init.
private void init() {
mySdkPathComboWithBrowse.getComboBox().setEditable(true);
FlutterSdkUtil.addKnownSDKPathsToCombo(mySdkPathComboWithBrowse.getComboBox());
mySdkPathComboWithBrowse.addBrowseFolderListener(FlutterBundle.message("flutter.sdk.browse.path.label"), null, null, FileChooserDescriptorFactory.createSingleFolderDescriptor(), TextComponentAccessor.STRING_COMBOBOX_WHOLE_TEXT);
final JTextComponent editorComponent = (JTextComponent) getSdkEditor().getEditorComponent();
editorComponent.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
validate();
}
});
// When this changes the corresponding parts of FlutterProjectStep should also be changed.
myInstallActionLink.setIcon(myInstallSdkAction.getLinkIcon());
myInstallActionLink.setDisabledIcon(IconLoader.getDisabledIcon(myInstallSdkAction.getLinkIcon()));
myInstallActionLink.setText(myInstallSdkAction.getLinkText());
// noinspection unchecked
myInstallActionLink.setListener((label, linkUrl) -> myInstallSdkAction.actionPerformed(null), null);
myProgressText.setFont(UIUtil.getLabelFont(UIUtil.FontSize.NORMAL).deriveFont(Font.ITALIC));
// Some feedback on hover.
myCancelProgressButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
myCancelProgressButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
myListener.actionCanceled();
}
});
}
use of com.intellij.ui.DocumentAdapter in project google-cloud-intellij by GoogleCloudPlatform.
the class CloudSdkPanel method initEvents.
private void initEvents() {
// track all changes in UI to report settings changes.
UserActivityWatcher activityWatcher = new UserActivityWatcher();
activityWatcher.register(cloudSdkPanel);
activityWatcher.addUserActivityListener(() -> settingsModified = true);
ButtonGroup sdkChoiceGroup = new ButtonGroup();
sdkChoiceGroup.add(managedRadioButton);
sdkChoiceGroup.add(customRadioButton);
managedRadioButton.addActionListener((e) -> {
setManagedSdkUiAvailable(true);
setCustomSdkUiAvailable(false);
selectedCloudSdkServiceType = CloudSdkServiceType.MANAGED_SDK;
});
customRadioButton.addActionListener((e) -> {
setCustomSdkUiAvailable(true);
setManagedSdkUiAvailable(false);
selectedCloudSdkServiceType = CloudSdkServiceType.CUSTOM_SDK;
});
checkForUpdatesHyperlink.addHyperlinkListener(new HyperlinkAdapter() {
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
// TODO(ivanporty) will call ManagedSdk#update if it's installed and active.
}
});
cloudSdkDirectoryField.addBrowseFolderListener(GctBundle.message("cloudsdk.location.browse.window.title"), null, /* description */
null, /* project */
FileChooserDescriptorFactory.createSingleFolderDescriptor());
cloudSdkDirectoryField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent event) {
checkSdkInBackground();
}
});
}
use of com.intellij.ui.DocumentAdapter in project azure-tools-for-java by Microsoft.
the class SpringCloudAppConfigPanel method init.
private void init() {
final TailingDebouncer debouncer = new TailingDebouncer(this::onDataChanged, 300);
this.toggleStorage.addActionListener(e -> {
toggleStorage("enable".equals(e.getActionCommand()));
debouncer.debounce();
});
this.toggleEndpoint.addActionListener(e -> {
toggleEndpoint("enable".equals(e.getActionCommand()));
debouncer.debounce();
});
this.txtStorage.setBorder(JBUI.Borders.empty(0, 2));
this.useJava8.addActionListener((e) -> debouncer.debounce());
this.useJava11.addActionListener((e) -> debouncer.debounce());
this.txtJvmOptions.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent documentEvent) {
debouncer.debounce();
}
});
this.envTable.addChangeListener((e) -> debouncer.debounce());
this.numCpu.addActionListener((e) -> debouncer.debounce());
this.numMemory.addActionListener((e) -> debouncer.debounce());
this.numInstance.addChangeListener((e) -> debouncer.debounce());
}
Aggregations