use of com.intellij.ui.DocumentAdapter in project flutter-intellij by flutter.
the class FlutterSmallIDEGeneratorPeer method addSettingsStateListener.
@Override
public void addSettingsStateListener(@NotNull WebProjectGenerator.SettingsStateListener stateListener) {
final JTextComponent editorComponent = (JTextComponent) sdkPathComboWithBrowse.getComboBox().getEditor().getEditorComponent();
editorComponent.getDocument().addDocumentListener(new DocumentAdapter() {
protected void textChanged(DocumentEvent e) {
stateListener.stateChanged(validate() == null);
}
});
if (validate() != null) {
stateListener.stateChanged(false);
}
}
use of com.intellij.ui.DocumentAdapter in project google-cloud-intellij by GoogleCloudPlatform.
the class SetupCloudRepositoryDialog method createUIComponents.
private void createUIComponents() {
projectSelector = new ProjectSelector(ideProject);
projectSelector.setMinimumSize(new Dimension(400, 0));
repositorySelector = new RepositorySelector(projectSelector.getSelectedProject(), true);
remoteNameSelector = new RepositoryRemotePanel(gitRepository);
projectSelector.addProjectSelectionListener(this::updateRepositorySelector);
repositorySelector.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent event) {
remoteNameSelector.update(repositorySelector.getSelectedRepository());
updateButtons();
}
});
remoteNameSelector.getRemoteNameField().getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent event) {
updateButtons();
}
});
}
use of com.intellij.ui.DocumentAdapter in project google-cloud-intellij by GoogleCloudPlatform.
the class CloneCloudRepositoryDialog method createUIComponents.
private void createUIComponents() {
projectSelector = new ProjectSelector(project);
projectSelector.setMinimumSize(new Dimension(400, 0));
projectSelector.addProjectSelectionListener(this::updateRepositorySelector);
repositorySelector = new RepositorySelector(projectSelector.getSelectedProject(), false);
repositorySelector.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent event) {
updateButtons();
}
});
}
use of com.intellij.ui.DocumentAdapter in project google-cloud-intellij by GoogleCloudPlatform.
the class CloneCloudRepositoryDialog method initComponents.
private void initComponents() {
FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFolderDescriptor();
fcd.setShowFileSystemRoots(true);
fcd.setTitle(GctBundle.message("clonefromgcp.destination.directory.title"));
fcd.setDescription(GctBundle.message("clonefromgcp.destination.directory.description"));
fcd.setHideIgnored(false);
parentDirectory.addActionListener(new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(fcd.getTitle(), fcd.getDescription(), parentDirectory, project, fcd, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) {
@Override
protected VirtualFile getInitialFile() {
String text = getComponentText();
if (text.length() == 0) {
VirtualFile file = project.getBaseDir();
if (file != null) {
return file;
}
}
return super.getInitialFile();
}
});
final DocumentListener updateOkButtonListener = new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent event) {
updateButtons();
}
};
parentDirectory.getChildComponent().getDocument().addDocumentListener(updateOkButtonListener);
parentDirectory.setText(ProjectUtil.getBaseDir());
directoryName.getDocument().addDocumentListener(updateOkButtonListener);
setOKActionEnabled(false);
}
use of com.intellij.ui.DocumentAdapter in project google-cloud-intellij by GoogleCloudPlatform.
the class ProjectSelectionDialog method createUIComponents.
@VisibleForTesting
void createUIComponents() {
addAccountButton = new JButton();
addAccountButton.addActionListener((event) -> Services.getLoginService().logIn());
// prepare table model and rendering.
projectListTable = new JBTable();
projectListTableModel = new ProjectListTableModel();
projectListTable.setModel(projectListTableModel);
projectListTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
projectListTable.getSelectionModel().addListSelectionListener(e -> validateProjectSelection());
FilteredTextTableCellRenderer filterRenderer = new FilteredTextTableCellRenderer();
projectListTable.setDefaultRenderer(Object.class, filterRenderer);
DoubleClickListener tableDoubleClickListener = new DoubleClickListener() {
@Override
protected boolean onDoubleClick(MouseEvent event) {
dialogWrapper.clickDefaultButton();
return true;
}
};
tableDoubleClickListener.installOn(projectListTable);
// filter rows based on text field content.
filterTextField = new JBTextField();
TableRowSorter<TableModel> sorter = new TableRowSorter<>(projectListTableModel);
projectListTable.setRowSorter(sorter);
GeneralFilter filter = new GeneralFilter() {
@Override
protected boolean include(Entry value, int index) {
return value.getStringValue(index).toLowerCase().contains(filterTextField.getText().toLowerCase());
}
};
sorter.setRowFilter(filter);
// on filter types, update row filter and renderer.
filterTextField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
sorter.allRowsChanged();
filterRenderer.setFilterText(filterTextField.getText());
}
});
refreshAction = new RefreshAction();
// prepare account combobox model and rendering.
accountComboBox = new ComboBox<>();
accountComboBox.setRenderer(new AccountComboBoxRenderer());
accountComboBox.addActionListener((event) -> refreshProjectListUi((CredentialedUser) accountComboBox.getSelectedItem()));
progressBar = new JBProgressBar();
progressBar.setIndeterminate(true);
progressBar.setVisible(false);
// wrapper for center panel that holds either project selection or sign in screen.
centerPanelWrapper = new JPanel(new BorderLayout());
}
Aggregations