private void ensureInitialized()

in plugin/src/com/microsoft/alm/plugin/idea/common/ui/checkout/CheckoutForm.java [97:181]


    private void ensureInitialized() {
        if (!initialized) {
            // Ensure that the commands are set up correctly
            repositoryFilter.setActionCommand(CMD_REPO_FILTER_CHANGED);
            refreshButton.setActionCommand(CMD_REFRESH);

            // Fix HiDPI scaling for table
            SwingHelper.scaleTableRowHeight(repositoryTable);

            // Fix tabbing in table
            SwingHelper.fixTabKeys(repositoryTable);
            repositoryTable.addFocusListener(new TableFocusListener(repositoryTable));

            // Set help text and popup text
            helpPanel.addPopupCommand(TfPluginBundle.message(TfPluginBundle.KEY_VSO_LOOKUP_HELP_ENTER_URL), CMD_GOTO_TFS);
            helpPanel.addPopupCommand(TfPluginBundle.message(TfPluginBundle.KEY_VSO_LOOKUP_HELP_VIEW_ACCOUNTS), CMD_GOTO_SPS_PROFILE);
            helpPanel.setVisible(false); // Don't show this help panel until we know if it's vs.com

            // Set hint text
            repositoryFilter.setUI(new HintTextFieldUI(
                    TfPluginBundle.message(TfPluginBundle.KEY_CHECKOUT_DIALOG_FILTER_HINT)));

            // Setup folder browser
            parentDirectory.getInsets().right = 0;
            parentDirectory.addBrowseFolderListener(
                    TfPluginBundle.message(TfPluginBundle.KEY_CHECKOUT_DIALOG_PARENT_FOLDER_DIALOG_TITLE), null, null,
                    new FileChooserDescriptor(false, true, false, false, false, false));

            // Align the busy spinner with the height of the refresh button (has to be the refresh button height so the image isn't squashed and then disappears)
            // Also change the refresh button width so that the button is a perfect square
            final int refreshButtonHeight = (int) refreshButton.getMinimumSize().getHeight();
            final Dimension size = new Dimension(refreshButtonHeight, refreshButtonHeight);
            refreshButton.setMinimumSize(size);
            refreshButton.setPreferredSize(size);
            busySpinner.setMinimumSize(size);
            busySpinner.setPreferredSize(size);

            // Setup document events for filter
            // Using a timer so that we don't respond to every character typed
            // The timer is created in the create components method
            repositoryFilter.getDocument().addDocumentListener(new DocumentListener() {
                @Override
                public void insertUpdate(final DocumentEvent e) {
                    onFilterChanged();
                }

                @Override
                public void removeUpdate(final DocumentEvent e) {
                    onFilterChanged();
                }

                @Override
                public void changedUpdate(final DocumentEvent e) {
                    onFilterChanged();
                }

                private void onFilterChanged() {
                    if (timer.isRunning()) {
                        timer.restart();
                    } else {
                        timer.start();
                    }
                }
            });

            repositoryTableScrollPane.setMinimumSize(new Dimension(JBUI.scale(200), JBUI.scale(70)));

            // Initialize the advanced button (only used for TFVC right now)
            advancedCheckBox.setSelected(false);
            serverWorkspaceCheckBox.setSelected(false);
            if (repositoryType == RepositoryContext.Type.TFVC) {
                advancedCheckBox.setVisible(true);
                advancedCheckBox.setText(TfPluginBundle.message(TfPluginBundle.KEY_CHECKOUT_DIALOG_TFVC_ADVANCED));

                serverWorkspaceCheckBox.setVisible(true);
                serverWorkspaceCheckBox.setText(TfPluginBundle.message(TfPluginBundle.KEY_CHECKOUT_DIALOG_TFVC_SERVER_WORKSPACE));
            } else {
                // There are no advanced features for our Git checkout dialog
                advancedCheckBox.setVisible(false);
                serverWorkspaceCheckBox.setVisible(false);
            }

            initialized = true;
        }
    }