Package com.google.appengine.tools.admin.AppAdminFactory

Examples of com.google.appengine.tools.admin.AppAdminFactory.PasswordPrompt


        final String password = SecurePreferencesFactory.getDefault()
            .get(Activator.PLUGIN_ID + "." + appId, null);
        if (userId != null && userId.length() != 0 && password != null) {
          ConnectOptions connectOptions = new ConnectOptions();
          connectOptions.setUserId(userId);
          connectOptions.setPasswordPrompt(new PasswordPrompt() {

            public String getPassword() {
              return password;
            }
          });
          return connectOptions;
        }
      } catch (final StorageException e) {
        Display.getDefault().syncExec(new Runnable() {

          public void run() {
            MessageDialog.openError(Display.getDefault()
                .getActiveShell(), "Error", e.getMessage());
          }
        });

      }
    }
    final Options options = new Options();
    options.usId = userId;
    if (storePass) {
      try {
        options.password = SecurePreferencesFactory.getDefault().get(
            Activator.PLUGIN_ID + "." + appId, null);
      } catch (final StorageException e) {
        Display.getDefault().syncExec(new Runnable() {

          public void run() {
            MessageDialog.openError(Display.getDefault()
                .getActiveShell(), "Error", e.getMessage());
          }
        });
      }
    }

    options.alwaysUse = alwaysUse;
    Display.getDefault().syncExec(new Runnable() {

      public void run() {
        CompositeEditor compositeEditor = new CompositeEditor(options,
            true);

        Binding binding = (Binding) compositeEditor.getBinding();
        binding.setName("Credentials");
        binding
            .setDescription("Authentification to Google Account for application: "
                + appId);
        compositeEditor.add(new OneLineTextElement<String>(binding
            .getBinding("usId")));
        OneLineTextElement<String> element = new OneLineTextElement<String>(
            binding.getBinding("password"));
        element.setIsPassword(true);
        Binding binding2 = binding.getBinding("alwaysUse");
        binding2
            .setName("Remember password(Could trigger secure storage login)");
        ButtonSelector sl = new ButtonSelector(binding2);
        compositeEditor.add(element);
        compositeEditor.add(sl);

        TitledDialog t = new TitledDialog(compositeEditor);
        DisposeBindingListener.linkBindingLifeCycle(binding,
            compositeEditor);
        int open = t.open();
        options.ok = open == Dialog.OK;
      }
    });
    if (options.ok) {
      ConnectOptions cm = new ConnectOptions();
      cm.setUserId(options.usId);
      cm.setPasswordPrompt(new PasswordPrompt() {

        public String getPassword() {
          return options.password;
        }
      });
View Full Code Here

TOP

Related Classes of com.google.appengine.tools.admin.AppAdminFactory.PasswordPrompt

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.