Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
AWS Toolkit for Eclipse: v201710231659 Release.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhx committed Oct 23, 2017
1 parent 7fc3a2c commit 0095935
Show file tree
Hide file tree
Showing 43 changed files with 470 additions and 268 deletions.
10 changes: 7 additions & 3 deletions CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"current": [
"* Refine the Maven configuration component to have consistent behavior.",
"* Update AWS logo."
],
"v201710120027": [
"* **Resolving Issues: #50, #82.**"
],
"v201709262229 ": [
"v201709262229": [
"* **Support Lambda function versioning and alias**",
"",
" * Upload Lambda function to AWS with alias and S3 Server-Side-Encryption.",
Expand All @@ -22,12 +26,12 @@
"",
"* **Resolving Issue: #56, #58, #66, #72.**"
],
"201709081818 ": [
"v201709081818": [
"* Merge Pull Request: #81",
"* Resolving Issues: #80",
"* Move the bug report to the ErrorReport platform."
],
"v201708161930 ": [
"v201708161930": [
"* Merge Pull Request: #78",
"* Resolving Issues: #25, #61, #71, and #77",
"* Adding more metrics for AWS Overview Editor, Amazon EC2 Explorer, and Create a new AWS Java Project."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private void createUsernamePasswordSection() {
.composite(this)
.dataBindingContext(dataBindingContext)
.pojoObservableValue(PojoObservables.observeValue(dataModel, P_USERNAME))
.validator(usernameValidator == null ? new NotEmptyValidator("User name must be provided!") : usernameValidator)
.addValidator(usernameValidator == null ? new NotEmptyValidator("User name must be provided!") : usernameValidator)
.labelValue("User name:")
.defaultValue(dataModel.getUsername())
.build();
Expand All @@ -130,7 +130,7 @@ private void createUsernamePasswordSection() {
.composite(this)
.dataBindingContext(dataBindingContext)
.pojoObservableValue(PojoObservables.observeValue(dataModel, P_PASSWORD))
.validator(passwordValidator == null ? new NotEmptyValidator("Password must be provided!") : passwordValidator)
.addValidator(passwordValidator == null ? new NotEmptyValidator("Password must be provided!") : passwordValidator)
.labelValue("Password: ")
.defaultValue(dataModel.getPassword())
.build();
Expand Down
Binary file modified bundles/com.amazonaws.eclipse.core/icons/logo_aws.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
/**
* A helper class used to perform common Maven related operations.
*/
@SuppressWarnings("restriction")
public class MavenFactory {

private static final String MAVEN_SOURCE_FOLDER = "src/main/java";
Expand Down Expand Up @@ -191,11 +190,10 @@ public static String getLatestArtifactVersion(String groupId, String artifactId)

/**
* Assume package name from the group id and artifact id: concatenating them with a dot '.'.
* Return null if the parameter is not valid.
* Return empty string if the parameter is not valid.
*/
public static String assumePackageName(String groupId, String artifactId) {

return StringUtils.isNullOrEmpty(groupId) || StringUtils.isNullOrEmpty(artifactId)
? null : groupId + "." + artifactId;
? "" : groupId + "." + artifactId;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.eclipse.core.model;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.function.Consumer;
import java.util.function.Supplier;

/**
* Abstract data model with the property change support.
*/
public abstract class AbstractAwsToolkitDataModel {
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);

protected <T> void setProperty(String propertyName, T newProperty, Supplier<T> getter, Consumer<T> setter) {
T oldValue = getter.get();
setter.accept(newProperty);
pcs.firePropertyChange(propertyName, oldValue, newProperty);
}

public void addPropertyChangeListener(PropertyChangeListener listener) {
pcs.addPropertyChangeListener(listener);
}

public void removePropertyChangeListener(PropertyChangeListener listener) {
pcs.removePropertyChangeListener(listener);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,47 @@
/**
* Data model for Maven project configuration composite.
*/
public class MavenConfigurationDataModel {
public class MavenConfigurationDataModel extends AbstractAwsToolkitDataModel {

public static final String P_GROUP_ID = "groupId";
public static final String P_ARTIFACT_ID = "artifactId";
public static final String P_PACKAGE_NAME = "packageName";
public static final String P_VERSION = "version";

private String groupId;
private String artifactId;
private String version;
private String packageName;
private String groupId = "com.amazonaws";
private String artifactId = "samples";
private String version = "1.0.0";
private String packageName = MavenFactory.assumePackageName(groupId, artifactId);

public String getGroupId() {
return groupId;
}

public void setGroupId(String groupId) {
this.groupId = groupId;
}

public String getArtifactId() {
return artifactId;
}

public void setArtifactId(String artifactId) {
this.artifactId = artifactId;
}

public String getVersion() {
return version;
}

public void setVersion(String version) {
this.version = version;
}

public void setPackageName(String packageName) {
this.packageName = packageName;
this.setProperty(P_PACKAGE_NAME, packageName, this::getPackageName, (newValue) -> this.packageName = newValue);
}

public String getPackageName() {
return packageName != null ? packageName
: MavenFactory.assumePackageName(groupId, artifactId);
return packageName;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private void createControl(DataBindingContext context, ImportFileDataModel dataM
.dataBindingContext(context)
.pojoObservableValue(PojoObservables.observeValue(dataModel, P_FILE_PATH))
.labelValue("Import:")
.validator(filePathValidator)
.addValidator(filePathValidator)
.defaultValue(dataModel.getFilePath())
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;

import com.amazonaws.eclipse.core.maven.MavenFactory;
import com.amazonaws.eclipse.core.model.MavenConfigurationDataModel;
import com.amazonaws.eclipse.core.validator.PackageNameValidator;
import com.amazonaws.eclipse.core.widget.TextComplex;
Expand All @@ -37,31 +38,21 @@ public class MavenConfigurationComposite extends Composite {
private TextComplex packageComplex;

public MavenConfigurationComposite(Composite parent, DataBindingContext context, MavenConfigurationDataModel dataModel) {
this(parent, context, dataModel, null, null, false);
}

public MavenConfigurationComposite(Composite parent, DataBindingContext context, MavenConfigurationDataModel dataModel,
ModifyListener groupIdModifyListener, ModifyListener artifactIdModifyListener) {
this(parent, context, dataModel, groupIdModifyListener, artifactIdModifyListener, false);
}

public MavenConfigurationComposite(Composite parent, DataBindingContext context, MavenConfigurationDataModel dataModel,
ModifyListener groupIdModifyListener, ModifyListener artifactIdModifyListener, boolean creatVerionAndPackage) {
super(parent, SWT.NONE);
setLayout(new GridLayout(2, false));
setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
createControl(context, dataModel, groupIdModifyListener, artifactIdModifyListener, creatVerionAndPackage);
createControl(context, dataModel);
}

private void createControl(DataBindingContext context, MavenConfigurationDataModel dataModel,
ModifyListener groupIdModifyListener, ModifyListener artifactIdModifyListener, boolean creatVerionAndPackage) {

private void createControl(DataBindingContext context, MavenConfigurationDataModel dataModel) {
groupIdComplex = TextComplex.builder()
.composite(this)
.dataBindingContext(context)
.pojoObservableValue(PojoObservables.observeValue(dataModel, MavenConfigurationDataModel.P_GROUP_ID))
.validator(new NotEmptyValidator("Group ID must be provided!"))
.modifyListener(groupIdModifyListener)
.addValidator(new NotEmptyValidator("Group ID must be provided!"))
.modifyListener((e) -> {
onMavenConfigurationChange();
})
.labelValue("Group ID:")
.defaultValue(dataModel.getGroupId())
.build();
Expand All @@ -70,30 +61,38 @@ private void createControl(DataBindingContext context, MavenConfigurationDataMod
.composite(this)
.dataBindingContext(context)
.pojoObservableValue(PojoObservables.observeValue(dataModel, MavenConfigurationDataModel.P_ARTIFACT_ID))
.validator(new NotEmptyValidator("Artifact ID must be provided!"))
.modifyListener(artifactIdModifyListener)
.addValidator(new NotEmptyValidator("Artifact ID must be provided!"))
.modifyListener((e) -> {
onMavenConfigurationChange();
})
.labelValue("Artifact ID:")
.defaultValue(dataModel.getArtifactId())
.build();

if (creatVerionAndPackage) {
versionComplex = TextComplex.builder()
.composite(this)
.dataBindingContext(context)
.pojoObservableValue(PojoObservables.observeValue(dataModel, MavenConfigurationDataModel.P_VERSION))
.validator(new NotEmptyValidator("Version must be provided!"))
.labelValue("Version:")
.defaultValue(dataModel.getVersion())
.build();
versionComplex = TextComplex.builder()
.composite(this)
.dataBindingContext(context)
.pojoObservableValue(PojoObservables.observeValue(dataModel, MavenConfigurationDataModel.P_VERSION))
.addValidator(new NotEmptyValidator("Version must be provided!"))
.labelValue("Version:")
.defaultValue(dataModel.getVersion())
.build();

packageComplex = TextComplex.builder()
.composite(this)
.dataBindingContext(context)
.pojoObservableValue(PojoObservables.observeValue(dataModel, MavenConfigurationDataModel.P_PACKAGE_NAME))
.addValidator(new PackageNameValidator("Package name must be provided!"))
.labelValue("Package name:")
.defaultValue(dataModel.getPackageName())
.build();
}

packageComplex = TextComplex.builder()
.composite(this)
.dataBindingContext(context)
.pojoObservableValue(PojoObservables.observeValue(dataModel, MavenConfigurationDataModel.P_PACKAGE_NAME))
.validator(new PackageNameValidator("Package name must be provided!"))
.labelValue("Package name:")
.defaultValue(dataModel.getPackageName())
.build();
private void onMavenConfigurationChange() {
if (packageComplex != null && groupIdComplex != null && artifactIdComplex != null) {
String groupId = groupIdComplex.getText().getText();
String artifactId = artifactIdComplex.getText().getText();
packageComplex.setText(MavenFactory.assumePackageName(groupId, artifactId));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private void createControl(DataBindingContext context, ProjectNameDataModel data
.composite(this)
.dataBindingContext(context)
.pojoObservableValue(PojoObservables.observeValue(dataModel, ProjectNameDataModel.P_PROJECT_NAME))
.validator(new ProjectNameValidator())
.addValidator(new ProjectNameValidator())
.defaultValue(dataModel.getProjectName())
.labelValue("Project name:")
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,6 @@ public TextComplexBuilder pojoObservableValue(IObservableValue pojoObservableVal
return this;
}

@Deprecated
public TextComplexBuilder validator(IValidator validator) {
this.validators.add(validator);
return this;
}

public TextComplexBuilder addValidator(IValidator validator) {
this.validators.add(validator);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void createControl(Composite parent) {
private void createMavenConfigurationComposite(Composite composite) {
Group group = newGroup(composite, "Maven configuration");
this.mavenConfigurationComposite = new MavenConfigurationComposite(
group, bindingContext, dataModel.getMavenConfigurationDataModel(), null, null, true);
group, bindingContext, dataModel.getMavenConfigurationDataModel());
}

private void createSessionManagerGroup(Composite composite) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.eclipse.ui.statushandlers.StatusManager;

import com.amazonaws.eclipse.core.AwsToolkitCore;
import com.amazonaws.eclipse.core.maven.MavenFactory;
import com.amazonaws.eclipse.core.model.MavenConfigurationDataModel;
import com.amazonaws.eclipse.elasticbeanstalk.ElasticBeanstalkAnalytics;
import com.amazonaws.eclipse.elasticbeanstalk.ElasticBeanstalkPlugin;
Expand All @@ -36,6 +37,7 @@ public class NewAwsJavaWebProjectWizard extends Wizard implements INewWizard {
private static final String DEFAULT_GROUP_ID = "com.amazonaws.beanstalk";
private static final String DEFAULT_ARTIFACT_ID = "webproject";
private static final String DEFAULT_VERSION = "1.0.0";
private static final String DEFAULT_PACKAGE_NAME = MavenFactory.assumePackageName(DEFAULT_GROUP_ID, DEFAULT_ARTIFACT_ID);

private NewAwsJavaWebProjectDataModel dataModel = new NewAwsJavaWebProjectDataModel();

Expand Down Expand Up @@ -77,6 +79,7 @@ public void initDataModel() {
mavenConfig.setGroupId(DEFAULT_GROUP_ID);
mavenConfig.setArtifactId(DEFAULT_ARTIFACT_ID);
mavenConfig.setVersion(DEFAULT_VERSION);
mavenConfig.setPackageName(DEFAULT_PACKAGE_NAME);
}

/*
Expand Down
1 change: 1 addition & 0 deletions bundles/com.amazonaws.eclipse.lambda/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Bundle-ActivationPolicy: lazy
Export-Package: com.amazonaws.eclipse.lambda.blueprint,
com.amazonaws.eclipse.lambda.project.template,
com.amazonaws.eclipse.lambda.project.template.data,
com.amazonaws.eclipse.lambda.project.wizard.model,
com.amazonaws.eclipse.lambda.serverless,
com.amazonaws.eclipse.lambda.serverless.model,
com.amazonaws.eclipse.lambda.serverless.model.transform,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<excludes>
<exclude>com.amazonaws:aws-lambda-java-events</exclude>
<exclude>com.amazonaws:aws-lambda-java-core</exclude>
</excludes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<excludes>
<exclude>com.amazonaws:aws-lambda-java-events</exclude>
<exclude>com.amazonaws:aws-lambda-java-core</exclude>
</excludes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<excludes>
<exclude>com.amazonaws:aws-lambda-java-events</exclude>
<exclude>com.amazonaws:aws-lambda-java-core</exclude>
</excludes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
Expand Down
Loading

0 comments on commit 0095935

Please sign in to comment.