From 7fc3a2c0e7b11d0d67c8da5af9e21aa356159f58 Mon Sep 17 00:00:00 2001 From: zhangzhx Date: Thu, 12 Oct 2017 06:26:11 +0000 Subject: [PATCH] AWS Toolkit for Eclipse: v201710120027 Release. --- CHANGELOG.json | 39 ++++++++++--------- .../eclipse/core/AWSClientFactory.java | 30 +++++++------- .../ui/ToolkitAnalyticsPreferencePage.java | 13 +++++-- .../invoke/ui/InvokeFunctionInputDialog.java | 36 ++++++----------- .../LambdaFunctionProjectMetadata.java | 2 +- .../com.amazonaws.eclipse.oxygen.target | 2 +- tests/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- 8 files changed, 60 insertions(+), 66 deletions(-) diff --git a/CHANGELOG.json b/CHANGELOG.json index 3ac505d3..3dacb80f 100644 --- a/CHANGELOG.json +++ b/CHANGELOG.json @@ -1,23 +1,26 @@ { "current": [ - "* **Support Lambda function versioning and alias**", - "", - " * Upload Lambda function to AWS with alias and S3 Server-Side-Encryption.", - "![LambdaVersioningEncryption-upload](https://s3.amazonaws.com/aws-eclipse-toolkit/eclipse/release/LambdaVersioningEncryption-upload.gif)", - "", - " * Check the result in AWS Lambda and Amazon S3 in AWS console.", - "![LambdaVersioningEncryption-result](https://s3.amazonaws.com/aws-eclipse-toolkit/eclipse/release/LambdaVersioningEncryption-result.gif)", - "", - "* **Better support right click in the Project Explorer. Previously, it only supports project level right click.**", - "![BetterSupportProjectExplorerForAwsLambdaActions](https://s3.amazonaws.com/aws-eclipse-toolkit/eclipse/release/BetterSupportProjectExplorerForAwsLambdaActions.png)", - "", - "* **Move Decorators from project level to java class level to record the mapping remote AWS Lambda function**", - "![LambdaProjectDecorator](https://s3.amazonaws.com/aws-eclipse-toolkit/eclipse/release/LambdaProjectDecorator.png)", - "", - "* **Update the Invoke function dialog UI for supporting choosing from multiple handlers instead of invoking only the last deployed function.**", - "![InvokeLambda](https://s3.amazonaws.com/aws-eclipse-toolkit/eclipse/release/InvokeLambda.png)", - "", - "* **Resolving Issue: #56, #58, #66, #72.**" + "* **Resolving Issues: #50, #82.**" + ], + "v201709262229 ": [ + "* **Support Lambda function versioning and alias**", + "", + " * Upload Lambda function to AWS with alias and S3 Server-Side-Encryption.", + "![LambdaVersioningEncryption-upload](https://s3.amazonaws.com/aws-eclipse-toolkit/eclipse/release/LambdaVersioningEncryption-upload.gif)", + "", + " * Check the result in AWS Lambda and Amazon S3 in AWS console.", + "![LambdaVersioningEncryption-result](https://s3.amazonaws.com/aws-eclipse-toolkit/eclipse/release/LambdaVersioningEncryption-result.gif)", + "", + "* **Better support right click in the Project Explorer. Previously, it only supports project level right click.**", + "![BetterSupportProjectExplorerForAwsLambdaActions](https://s3.amazonaws.com/aws-eclipse-toolkit/eclipse/release/BetterSupportProjectExplorerForAwsLambdaActions.png)", + "", + "* **Move Decorators from project level to java class level to record the mapping remote AWS Lambda function**", + "![LambdaProjectDecorator](https://s3.amazonaws.com/aws-eclipse-toolkit/eclipse/release/LambdaProjectDecorator.png)", + "", + "* **Update the Invoke function dialog UI for supporting choosing from multiple handlers instead of invoking only the last deployed function.**", + "![InvokeLambda](https://s3.amazonaws.com/aws-eclipse-toolkit/eclipse/release/InvokeLambda.png)", + "", + "* **Resolving Issue: #56, #58, #66, #72.**" ], "201709081818 ": [ "* Merge Pull Request: #81", diff --git a/bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/AWSClientFactory.java b/bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/AWSClientFactory.java index 530d83bd..23c1f28a 100644 --- a/bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/AWSClientFactory.java +++ b/bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/AWSClientFactory.java @@ -120,10 +120,12 @@ public class AWSClientFactory { /** Manages the cached client objects by region. **/ private CachedClients cachedClients = new CachedClients(); + private final String accountId; + /** * The account info for accessing the user's credentials. */ - private final AccountInfo accountInfo; + private AccountInfo accountInfo; /** * Constructs a client factory that uses the given account identifier to @@ -133,24 +135,22 @@ public AWSClientFactory(String accountId) { AwsToolkitCore plugin = AwsToolkitCore.getDefault(); + this.accountId = accountId; accountInfo = plugin.getAccountManager().getAccountInfo(accountId); - plugin.getProxyService().addProxyChangeListener(new IProxyChangeListener() { - @Override - public void proxyInfoChanged(IProxyChangeEvent event) { - cachedClientsByEndpoint.invalidateClients(); - cachedClients.invalidateClients(); - } - }); + plugin.getProxyService().addProxyChangeListener(this::onProxyChange); + plugin.getAccountManager().addAccountInfoChangeListener(this::onAccountInfoChange); + } - plugin.getAccountManager().addAccountInfoChangeListener(new AccountInfoChangeListener() { - @Override - public void onAccountInfoChange() { - cachedClientsByEndpoint.invalidateClients(); - cachedClients.invalidateClients(); - } + private void onProxyChange(IProxyChangeEvent e) { + onAccountInfoChange(); + } - }); + private void onAccountInfoChange() { + // When the system AWS accounts refresh, we need to refresh the member variable accountInfo as well in case it is still referencing the previous credentials. + accountInfo = AwsToolkitCore.getDefault().getAccountManager().getAccountInfo(accountId); + cachedClientsByEndpoint.invalidateClients(); + cachedClients.invalidateClients(); } // Returns an anonymous S3 client in us-east-1 region for fetching public-read files. diff --git a/bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/mobileanalytics/ui/ToolkitAnalyticsPreferencePage.java b/bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/mobileanalytics/ui/ToolkitAnalyticsPreferencePage.java index 9e95c994..06ba484f 100644 --- a/bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/mobileanalytics/ui/ToolkitAnalyticsPreferencePage.java +++ b/bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/mobileanalytics/ui/ToolkitAnalyticsPreferencePage.java @@ -25,7 +25,9 @@ import com.amazonaws.eclipse.core.AwsToolkitCore; import com.amazonaws.eclipse.core.preferences.PreferenceConstants; +import com.amazonaws.eclipse.core.ui.WebLinkListener; import com.amazonaws.eclipse.core.ui.preferences.AwsToolkitPreferencePage; +import com.amazonaws.eclipse.core.ui.wizards.WizardWidgetFactory; public class ToolkitAnalyticsPreferencePage extends AwsToolkitPreferencePage implements IWorkbenchPreferencePage { @@ -53,12 +55,15 @@ protected Control createContents(Composite parent) { gridData.widthHint = 300; composite.setLayoutData(gridData); - analyticsEnabledButton = new Button(composite, SWT.CHECK | SWT.MULTI | SWT.WRAP); - analyticsEnabledButton.setText( + WizardWidgetFactory.newLink(composite, new WebLinkListener(), String.format( "By leaving this box checked, you agree that AWS may anonymously " + "collect analytics about your usage of AWS Toolkit. AWS will handle " + - "all information received in accordance with the AWS Privacy Policy " + - "(http://aws.amazon.com/privacy/)"); + "all information received in accordance with the AWS Privacy Policy.", + "http://aws.amazon.com/privacy/"), + 1); + + analyticsEnabledButton = new Button(composite, SWT.CHECK | SWT.MULTI | SWT.WRAP); + analyticsEnabledButton.setText("Enable anonymous collection of analytics"); analyticsEnabledButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); analyticsEnabledButton.setSelection(getPreferenceStore().getBoolean( PreferenceConstants.P_TOOLKIT_ANALYTICS_COLLECTION_ENABLED)); diff --git a/bundles/com.amazonaws.eclipse.lambda/src/com/amazonaws/eclipse/lambda/invoke/ui/InvokeFunctionInputDialog.java b/bundles/com.amazonaws.eclipse.lambda/src/com/amazonaws/eclipse/lambda/invoke/ui/InvokeFunctionInputDialog.java index 49f8c2b0..44f31e62 100644 --- a/bundles/com.amazonaws.eclipse.lambda/src/com/amazonaws/eclipse/lambda/invoke/ui/InvokeFunctionInputDialog.java +++ b/bundles/com.amazonaws.eclipse.lambda/src/com/amazonaws/eclipse/lambda/invoke/ui/InvokeFunctionInputDialog.java @@ -115,7 +115,7 @@ public void widgetSelected(SelectionEvent e) { jsonInputFileButton = newRadioButton(container, "Select one of the JSON files as input: ", 1, false, new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - onJsonInputFileButtonSelected(); + onRadioButtonSelected(); } }); jsonInputFileCombo = newCombo(container, 1); @@ -130,7 +130,7 @@ public void widgetSelected(SelectionEvent e) { jsonInputButton = newRadioButton(container, "Enter the JSON input for your function", 2, false, new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - onJsonInputButtonSelected(); + onRadioButtonSelected(); } }); @@ -247,9 +247,9 @@ private void loadJsonFilesAsync() { jsonInputFileCombo.setItems(new String[] {NONE_FOUND}); jsonInputFileCombo.select(0); jsonInputFileCombo.setEnabled(false); - jsonInputFileButton.setEnabled(false); - jsonInputButton.setEnabled(true); jsonInputButton.setSelection(true); + jsonInputFileButton.setSelection(false); + onRadioButtonSelected(); } else { jsonInputFileCombo.removeAll(); for (IFile jsonFile : jsonFiles) { @@ -296,36 +296,22 @@ private void onLambdaHandlerComboSelected() { String handlerClass = lambdaHandlerCombo.getItem(lambdaHandlerCombo.getSelectionIndex()); md.setLastInvokeHandler(handlerClass); jsonInputFileButton.setSelection(md.getLastInvokeSelectJsonFile()); - int index = jsonInputFileCombo.indexOf(md.getLastInvokeJsonFile()); - if (index < 0) { - index = 0; - } - jsonInputFileCombo.select(index); - onJsonInputFileButtonSelected(); - jsonInputButton.setSelection(md.getLastInvokeSelectJsonInput()); - onJsonInputButtonSelected(); + jsonInputButton.setSelection(!md.getLastInvokeSelectJsonFile()); + onRadioButtonSelected(); showLiveLogButton.setSelection(md.getLastInvokeShowLiveLog()); } - private void onJsonInputFileButtonSelected() { + private void onRadioButtonSelected() { jsonInputFileCombo.setEnabled(jsonInputFileButton.getSelection()); - inputBox.setEditable(!jsonInputFileButton.getSelection()); + inputBox.setEditable(jsonInputButton.getSelection()); md.setLastInvokeSelectJsonFile(jsonInputFileButton.getSelection()); - md.setLastInvokeSelectJsonInput(!jsonInputFileButton.getSelection()); + md.setLastInvokeSelectJsonInput(jsonInputButton.getSelection()); if (jsonInputFileButton.getSelection()) { onJsonFileSelectionChange(); - } - } - - private void onJsonInputButtonSelected() { - jsonInputFileCombo.setEnabled(!jsonInputButton.getSelection()); - inputBox.setEditable(jsonInputButton.getSelection()); - md.setLastInvokeSelectJsonFile(jsonInputButton.getSelection()); - md.setLastInvokeSelectJsonInput(!jsonInputButton.getSelection()); - if (jsonInputButton.getSelection()) { + } else if (jsonInputButton.getSelection()) { inputBox.setText(md.getLastInvokeInput()); } - } + } private void onJsonFileSelectionChange() { if (jsonInputFileButton.getSelection() == false) { diff --git a/bundles/com.amazonaws.eclipse.lambda/src/com/amazonaws/eclipse/lambda/project/metadata/LambdaFunctionProjectMetadata.java b/bundles/com.amazonaws.eclipse.lambda/src/com/amazonaws/eclipse/lambda/project/metadata/LambdaFunctionProjectMetadata.java index 680e91a0..4b491ff3 100644 --- a/bundles/com.amazonaws.eclipse.lambda/src/com/amazonaws/eclipse/lambda/project/metadata/LambdaFunctionProjectMetadata.java +++ b/bundles/com.amazonaws.eclipse.lambda/src/com/amazonaws/eclipse/lambda/project/metadata/LambdaFunctionProjectMetadata.java @@ -162,7 +162,7 @@ public void setLastInvokeShowLiveLog(boolean showLiveLog) { @JsonIgnore public boolean getLastInvokeSelectJsonFile() { LambdaFunctionInvokeMetadata lastInvoke = getLastInvoke(); - return lastInvoke == null ? true : lastInvoke.isSelectJsonFile(); + return lastInvoke == null ? false : lastInvoke.isSelectJsonFile(); } @JsonIgnore diff --git a/releng/com.amazonaws.eclipse.oxygen/com.amazonaws.eclipse.oxygen.target b/releng/com.amazonaws.eclipse.oxygen/com.amazonaws.eclipse.oxygen.target index c3f49708..da32cd30 100644 --- a/releng/com.amazonaws.eclipse.oxygen/com.amazonaws.eclipse.oxygen.target +++ b/releng/com.amazonaws.eclipse.oxygen/com.amazonaws.eclipse.oxygen.target @@ -19,7 +19,7 @@ - + diff --git a/tests/pom.xml b/tests/pom.xml index d5d6a411..ec891339 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -57,4 +57,4 @@ - \ No newline at end of file + diff --git a/thirdparty/com.amazonaws.eclipse.javasdk/META-INF/MANIFEST.MF b/thirdparty/com.amazonaws.eclipse.javasdk/META-INF/MANIFEST.MF index 8fb599e5..752ae4d6 100644 --- a/thirdparty/com.amazonaws.eclipse.javasdk/META-INF/MANIFEST.MF +++ b/thirdparty/com.amazonaws.eclipse.javasdk/META-INF/MANIFEST.MF @@ -171,7 +171,7 @@ Bundle-Name: AWS Toolkit for Eclipse Java SDK Bundle Bundle-Version: 1.11.130 Built-By: zhaoxiz Bundle-ManifestVersion: 2 -Bnd-LastModified: 1504630313552 +Bnd-LastModified: 1507767784574 Created-By: Apache Maven Bundle Plugin Tool: Bnd-0.0.357 Build-Jdk: 1.8.0_141