public EditNamespaceDialogForm()

in src/main/java/org/apache/openwhisk/intellij/explorer/dialog/namespace/ui/EditNamespaceDialogForm.java [66:108]


    public EditNamespaceDialogForm(Project project, WhiskAuth whiskAuth, WhiskNamespace whiskNamespace) {
        this.project = project;
        this.whiskAuth = whiskAuth;
        this.whiskNamespace = whiskNamespace;

        /**
         * Load endpoints
         */
        this.whiskService = ServiceManager.getService(project, WhiskService.class);
        try {
            endpoints = new ArrayList<>(JsonParserUtils.parseWhiskEndpoints(whiskService.getEndpoints())); // make mutable
        } catch (IOException e) {
            LOG.error("Endpoint parsing failed", e);
        }

        nameJTextField.setText(whiskNamespace.getPath());
        authKeyJPasswordField.setText(whiskNamespace.getAuth());

        verifyAuthKeyJButton.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                final String auth = new String(authKeyJPasswordField.getPassword());
                final String apihost = whiskAuth.getApihost();
                final WhiskAuth newWhiskAuth = new WhiskAuth(auth, apihost);
                Optional<WhiskNamespace> result = whiskNamespaceService.validateNamespace(newWhiskAuth);
                if (result.isPresent()) {
                    verifyResultJLabel.setText("Success");
                    verifyResultJLabel.setForeground(JBColor.GREEN);
                } else {
                    verifyResultJLabel.setText("Invalid authkey");
                    verifyResultJLabel.setForeground(JBColor.RED);
                }
            }
        });

        showAuthKeyJCheckbox.addItemListener(e -> {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                authKeyJPasswordField.setEchoChar((char) 0);
            } else {
                authKeyJPasswordField.setEchoChar('*');
            }
        });
    }