in src/main/java/org/apache/openwhisk/intellij/explorer/dialog/namespace/ui/AddNamespaceDialogForm.java [62:100]
public AddNamespaceDialogForm(Project project, WhiskEndpoint whiskEndpoint) {
this.project = project;
this.whiskEndpoint = whiskEndpoint;
/**
* 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);
}
verifyAuthKeyJButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
final String auth = new String(authKeyJPasswordField.getPassword());
final String apihost = whiskEndpoint.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('*');
}
});
}