Merge "Google Login ui changes: make list items left-justified" into idea133
diff --git a/lib-working/google-gct-login-context-pg.jar b/lib-working/google-gct-login-context-pg.jar
new file mode 100644
index 0000000..a0e8f00
--- /dev/null
+++ b/lib-working/google-gct-login-context-pg.jar
Binary files differ
diff --git a/login/login.iml b/login/login.iml
index 1f48ab9..897f97a 100644
--- a/login/login.iml
+++ b/login/login.iml
@@ -77,6 +77,15 @@
       </library>
     </orderEntry>
     <orderEntry type="module" module-name="platform-impl" />
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/../lib-working/google-gct-login-context-pg.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
   </component>
 </module>
 
diff --git a/login/src/com/google/gct/login/GoogleLogin.java b/login/src/com/google/gct/login/GoogleLogin.java
index 20ae592..8db1356 100644
--- a/login/src/com/google/gct/login/GoogleLogin.java
+++ b/login/src/com/google/gct/login/GoogleLogin.java
@@ -55,9 +55,7 @@
 // TODO: explore changing class to an application service
 public class GoogleLogin {
 
-  private static final String CLIENT_ID = "ANDROID_CLIENT_ID";
-  private static final String CLIENT_SECRET = "ANDROID_CLIENT_SECRET";
-  private ClientIdSecretPair clientInfo;
+  private ClientInfo clientInfo;
   private AndroidUiFacade uiFacade;
   private AndroidPreferencesOAuthDataStore dataStore;
   private CredentialedUserRoster users;
@@ -69,7 +67,7 @@
    * Constructor
    */
   private GoogleLogin() {
-    this.clientInfo = getClientIdAndSecretFromExtensionPoints();
+    this.clientInfo = getClientInfo();
     this.uiFacade = new AndroidUiFacade();
     this.users = new CredentialedUserRoster();
     this.dataStore =  new AndroidPreferencesOAuthDataStore();
@@ -437,8 +435,8 @@
   private GoogleLoginState createGoogleLoginState() {
     GoogleLoginState state =
       new GoogleLoginState(
-        clientInfo.getClientId(),
-        clientInfo.getClientSecret(),
+        clientInfo.getId(),
+        clientInfo.getInfo(),
         OAuthScopeRegistry.getScopes(),
         new AndroidPreferencesOAuthDataStore(),
         uiFacade,
@@ -449,18 +447,18 @@
   }
 
   /**
-   * Returns the OAuth 2.0 Client ID and Secret for Android Studio in a {@link ClientIdSecretPair}.
-   * @return the OAuth 2.0 Client ID and Secret for Android Studio in a {@link ClientIdSecretPair}.
+   * Returns the Client Info for Android Studio in a {@link com.google.gct.login.GoogleLogin.ClientInfo}.
+   * @return the Client Info for Android Studio in a {@link com.google.gct.login.GoogleLogin.ClientInfo}.
    */
-  private ClientIdSecretPair getClientIdAndSecretFromExtensionPoints() {
-      String clientId = System.getenv().get(CLIENT_ID);
-      String clientSecret = System.getenv().get(CLIENT_SECRET);
-      if (clientId != null && clientId.trim().length() > 0
-          && clientSecret != null && clientSecret.trim().length() > 0) {
-        return new ClientIdSecretPair(clientId, clientSecret);
+  private ClientInfo getClientInfo() {
+      String id = LoginContext.getId();
+      String info = LoginContext.getInfo();
+      if (id != null && id.trim().length() > 0
+          && info != null && info.trim().length() > 0) {
+        return new ClientInfo(id, info);
     }
 
-    throw new IllegalStateException("The Google OAuth 2.0 Client id and/or secret for Android Studio was not found");
+    throw new IllegalStateException("The client information for Android Studio was not found");
   }
 
   // TODO: update code to specify parent
@@ -480,24 +478,24 @@
   }
 
   /**
-   * A pair consisting of the OAuth client ID and OAuth client secret for a client application.
+   * The client information for an application.
    */
   @Immutable
-  private static class ClientIdSecretPair {
-    private final String clientId;
-    private final String clientSecret;
+  private static class ClientInfo {
+    private final String id;
+    private final String info;
 
-    public ClientIdSecretPair(String clientId, String clientSecret) {
-      this.clientId = clientId;
-      this.clientSecret = clientSecret;
+    public ClientInfo(String id, String info) {
+      this.id = id;
+      this.info = info;
     }
 
-    public String getClientId() {
-      return clientId;
+    public String getId() {
+      return id;
     }
 
-    public String getClientSecret() {
-      return clientSecret;
+    public String getInfo() {
+      return info;
     }
   }
 
@@ -531,7 +529,7 @@
       }
 
       AuthorizationCodeRequestUrl authCodeRequestUrl =
-        new AuthorizationCodeRequestUrl(GoogleOAuthConstants.AUTHORIZATION_SERVER_URL, clientInfo.getClientId())
+        new AuthorizationCodeRequestUrl(GoogleOAuthConstants.AUTHORIZATION_SERVER_URL, clientInfo.getId())
           .setRedirectUri(redirectUrl)
           .setScopes(OAuthScopeRegistry.getScopes());
 
diff --git a/resources/templates/GcmEndpoints/template.xml b/resources/templates/GcmEndpoints/template.xml
index 1d67bd0..d853856 100644
--- a/resources/templates/GcmEndpoints/template.xml
+++ b/resources/templates/GcmEndpoints/template.xml
@@ -27,7 +27,7 @@
   <parameter id="endpointOwnerDomain" name="Endpoint Owner Domain" type="string" constraints="package" default="mycompany.com"/>
   <parameter id="endpointPackagePath" name="Endpoint Package Path" type="string" constraints="package" default="myapp"/>
   <parameter id="apiKey" name="Gcm Api Key" type="string" default="REPLACE WITH YOUR API KEY"/>
-  <parameter id="appEngineVersion" name="AppEngine Version" type="string" default="1.9.4" />
+  <parameter id="appEngineVersion" name="AppEngine Version" type="string" default="1.9.6" />
   <parameter id="docUrl" name="Doc URL" type="string" visibility="false"
              default="https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/GcmEndpoints"/>
   <parameter id="sideIconPath" name="Side icon path" type="string" visibility="false"
diff --git a/resources/templates/HelloEndpoints/template.xml b/resources/templates/HelloEndpoints/template.xml
index e749226..78ed749 100644
--- a/resources/templates/HelloEndpoints/template.xml
+++ b/resources/templates/HelloEndpoints/template.xml
@@ -26,7 +26,7 @@
   <parameter id="appId" name="Application Id" type="string" constraints="nonempty" default="myApplicationId"/>
   <parameter id="endpointOwnerDomain" name="Endpoint Owner Domain" type="string" constraints="package" default="mycompany.com"/>
   <parameter id="endpointPackagePath" name="Endpoint Package Path" type="string" constraints="package" default="myapp"/>
-  <parameter id="appEngineVersion" name="AppEngine Version" type="string" default="1.9.4" />
+  <parameter id="appEngineVersion" name="AppEngine Version" type="string" default="1.9.6" />
   <parameter id="docUrl" name="Doc URL" type="string" visibility="false"
              default="https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/HelloEndpoints"/>
 
diff --git a/resources/templates/HelloWorld/template.xml b/resources/templates/HelloWorld/template.xml
index f6b73ab..8be72c9 100644
--- a/resources/templates/HelloWorld/template.xml
+++ b/resources/templates/HelloWorld/template.xml
@@ -24,7 +24,7 @@
 
   <parameter id="packageName" name="Package name" type="string" constraints="package|nonempty" default="com.mycompany.myapp"/>
   <parameter id="appId" name="Application Id" type="string" constraints="nonempty" default="myApplicationId"/>
-  <parameter id="appEngineVersion" name="AppEngine Version" type="string" default="1.9.4" />
+  <parameter id="appEngineVersion" name="AppEngine Version" type="string" default="1.9.6" />
   <parameter id="docUrl" name="Doc URL" type="string" visibility="false"
              default="https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/HelloWorld"/>
   <parameter id="sideIconPath" name="Side icon path" type="string" visibility="false"
diff --git a/src/META-INF/plugin.xml b/src/META-INF/plugin.xml
index e05db4d..72f3034 100644
--- a/src/META-INF/plugin.xml
+++ b/src/META-INF/plugin.xml
@@ -104,10 +104,6 @@
   </extensions>
 
   <actions>
-    <action id="GoogleCloudTools.NewAppEngineModule"
-            class="com.google.gct.idea.appengine.wizard.NewAppEngineModuleAction"
-            text="Add App Engine Backend"
-            icon="/icons/appEngine.png"/>
     <action id="GoogleCloudTools.InstallClientLibraries"
             class="com.google.gct.idea.appengine.gradle.action.InstallClientLibrariesAction"
             text="Install Client Libraries"
@@ -121,7 +117,6 @@
            description="Endpoints Actions"
            popup="true"
            icon="/icons/cloudPlatform.png">
-      <reference id="GoogleCloudTools.NewAppEngineModule"/>
       <reference id="GoogleCloudTools.InstallClientLibraries"/>
       <reference id="GoogleCloudTools.GenerateEndpoint"/>
       <add-to-group group-id="ToolsMenu" anchor="last"/>
diff --git a/src/com/google/gct/idea/appengine/wizard/NewAppEngineModuleAction.java b/src/com/google/gct/idea/appengine/wizard/NewAppEngineModuleAction.java
index ef447c8..0d2874d 100644
--- a/src/com/google/gct/idea/appengine/wizard/NewAppEngineModuleAction.java
+++ b/src/com/google/gct/idea/appengine/wizard/NewAppEngineModuleAction.java
@@ -56,7 +56,7 @@
 
 /**
  * Action to generate client libraries for an AppEngine endpoints project and copy them to an associated android project
- * Currently hidden from UI in plugin.xml
+ * TODO : No Longer in use, transition constants to WizardPath and remove this mechanism
  */
 public class NewAppEngineModuleAction extends AnAction {