use of org.jetbrains.android.compiler.artifact.ChooseKeyDialog in project android by JetBrains.
the class AndroidUiUtil method initSigningSettingsForm.
public static void initSigningSettingsForm(@NotNull final Project project, @NotNull final ApkSigningSettingsForm form) {
form.getLoadKeyStoreButton().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final String defaultPath = form.getKeyStorePathField().getText().trim();
final VirtualFile defaultFile = LocalFileSystem.getInstance().findFileByPath(defaultPath);
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
final VirtualFile file = FileChooser.chooseFile(descriptor, form.getPanel(), project, defaultFile);
if (file != null) {
form.getKeyStorePathField().setText(FileUtil.toSystemDependentName(file.getPath()));
}
}
});
form.getCreateKeyStoreButton().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final NewKeyStoreDialog dialog = new NewKeyStoreDialog(project, form.getKeyStorePathField().getText());
dialog.show();
if (dialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
form.getKeyStorePathField().setText(dialog.getKeyStorePath());
form.getKeyStorePasswordField().setText(String.valueOf(dialog.getKeyStorePassword()));
form.getKeyAliasField().setText(dialog.getKeyAlias());
form.getKeyPasswordField().setText(String.valueOf(dialog.getKeyPassword()));
}
}
});
form.getKeyAliasField().getButton().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final List<String> keys = loadExistingKeys(form);
if (keys == null) {
return;
}
final ChooseKeyDialog dialog = new ChooseKeyDialog(project, form.getKeyStorePathField().getText().trim(), form.getKeyStorePasswordField().getPassword(), keys, form.getKeyAliasField().getText().trim());
dialog.show();
if (dialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
final String chosenKey = dialog.getChosenKey();
if (chosenKey != null) {
form.getKeyAliasField().setText(chosenKey);
}
final char[] password = dialog.getChosenKeyPassword();
if (password != null) {
form.getKeyPasswordField().setText(String.valueOf(password));
}
}
}
});
}
Aggregations