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

Commit 0095935

Browse files
author
zhangzhx
committed
AWS Toolkit for Eclipse: v201710231659 Release.
1 parent 7fc3a2c commit 0095935

File tree

43 files changed

+470
-268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+470
-268
lines changed

CHANGELOG.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{
22
"current": [
3+
"* Refine the Maven configuration component to have consistent behavior.",
4+
"* Update AWS logo."
5+
],
6+
"v201710120027": [
37
"* **Resolving Issues: #50, #82.**"
48
],
5-
"v201709262229 ": [
9+
"v201709262229": [
610
"* **Support Lambda function versioning and alias**",
711
"",
812
" * Upload Lambda function to AWS with alias and S3 Server-Side-Encryption.",
@@ -22,12 +26,12 @@
2226
"",
2327
"* **Resolving Issue: #56, #58, #66, #72.**"
2428
],
25-
"201709081818 ": [
29+
"v201709081818": [
2630
"* Merge Pull Request: #81",
2731
"* Resolving Issues: #80",
2832
"* Move the bug report to the ErrorReport platform."
2933
],
30-
"v201708161930 ": [
34+
"v201708161930": [
3135
"* Merge Pull Request: #78",
3236
"* Resolving Issues: #25, #61, #71, and #77",
3337
"* Adding more metrics for AWS Overview Editor, Amazon EC2 Explorer, and Create a new AWS Java Project."

bundles/com.amazonaws.eclipse.codecommit/src/com/amazonaws/eclipse/codecommit/widgets/GitCredentialsComposite.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ private void createUsernamePasswordSection() {
121121
.composite(this)
122122
.dataBindingContext(dataBindingContext)
123123
.pojoObservableValue(PojoObservables.observeValue(dataModel, P_USERNAME))
124-
.validator(usernameValidator == null ? new NotEmptyValidator("User name must be provided!") : usernameValidator)
124+
.addValidator(usernameValidator == null ? new NotEmptyValidator("User name must be provided!") : usernameValidator)
125125
.labelValue("User name:")
126126
.defaultValue(dataModel.getUsername())
127127
.build();
@@ -130,7 +130,7 @@ private void createUsernamePasswordSection() {
130130
.composite(this)
131131
.dataBindingContext(dataBindingContext)
132132
.pojoObservableValue(PojoObservables.observeValue(dataModel, P_PASSWORD))
133-
.validator(passwordValidator == null ? new NotEmptyValidator("Password must be provided!") : passwordValidator)
133+
.addValidator(passwordValidator == null ? new NotEmptyValidator("Password must be provided!") : passwordValidator)
134134
.labelValue("Password: ")
135135
.defaultValue(dataModel.getPassword())
136136
.build();
4.57 KB
Loading

bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/maven/MavenFactory.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
/**
3232
* A helper class used to perform common Maven related operations.
3333
*/
34-
@SuppressWarnings("restriction")
3534
public class MavenFactory {
3635

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

192191
/**
193192
* Assume package name from the group id and artifact id: concatenating them with a dot '.'.
194-
* Return null if the parameter is not valid.
193+
* Return empty string if the parameter is not valid.
195194
*/
196195
public static String assumePackageName(String groupId, String artifactId) {
197-
198196
return StringUtils.isNullOrEmpty(groupId) || StringUtils.isNullOrEmpty(artifactId)
199-
? null : groupId + "." + artifactId;
197+
? "" : groupId + "." + artifactId;
200198
}
201199
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
package com.amazonaws.eclipse.core.model;
16+
17+
import java.beans.PropertyChangeListener;
18+
import java.beans.PropertyChangeSupport;
19+
import java.util.function.Consumer;
20+
import java.util.function.Supplier;
21+
22+
/**
23+
* Abstract data model with the property change support.
24+
*/
25+
public abstract class AbstractAwsToolkitDataModel {
26+
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
27+
28+
protected <T> void setProperty(String propertyName, T newProperty, Supplier<T> getter, Consumer<T> setter) {
29+
T oldValue = getter.get();
30+
setter.accept(newProperty);
31+
pcs.firePropertyChange(propertyName, oldValue, newProperty);
32+
}
33+
34+
public void addPropertyChangeListener(PropertyChangeListener listener) {
35+
pcs.addPropertyChangeListener(listener);
36+
}
37+
38+
public void removePropertyChangeListener(PropertyChangeListener listener) {
39+
pcs.removePropertyChangeListener(listener);
40+
}
41+
}

bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/model/MavenConfigurationDataModel.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,47 @@
1919
/**
2020
* Data model for Maven project configuration composite.
2121
*/
22-
public class MavenConfigurationDataModel {
22+
public class MavenConfigurationDataModel extends AbstractAwsToolkitDataModel {
2323

2424
public static final String P_GROUP_ID = "groupId";
2525
public static final String P_ARTIFACT_ID = "artifactId";
2626
public static final String P_PACKAGE_NAME = "packageName";
2727
public static final String P_VERSION = "version";
2828

29-
private String groupId;
30-
private String artifactId;
31-
private String version;
32-
private String packageName;
29+
private String groupId = "com.amazonaws";
30+
private String artifactId = "samples";
31+
private String version = "1.0.0";
32+
private String packageName = MavenFactory.assumePackageName(groupId, artifactId);
3333

3434
public String getGroupId() {
3535
return groupId;
3636
}
37+
3738
public void setGroupId(String groupId) {
3839
this.groupId = groupId;
3940
}
41+
4042
public String getArtifactId() {
4143
return artifactId;
4244
}
45+
4346
public void setArtifactId(String artifactId) {
4447
this.artifactId = artifactId;
4548
}
4649

4750
public String getVersion() {
4851
return version;
4952
}
53+
5054
public void setVersion(String version) {
5155
this.version = version;
5256
}
57+
5358
public void setPackageName(String packageName) {
54-
this.packageName = packageName;
59+
this.setProperty(P_PACKAGE_NAME, packageName, this::getPackageName, (newValue) -> this.packageName = newValue);
5560
}
5661

5762
public String getPackageName() {
58-
return packageName != null ? packageName
59-
: MavenFactory.assumePackageName(groupId, artifactId);
63+
return packageName;
6064
}
61-
}
65+
}

bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/ui/ImportFileComposite.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private void createControl(DataBindingContext context, ImportFileDataModel dataM
6262
.dataBindingContext(context)
6363
.pojoObservableValue(PojoObservables.observeValue(dataModel, P_FILE_PATH))
6464
.labelValue("Import:")
65-
.validator(filePathValidator)
65+
.addValidator(filePathValidator)
6666
.defaultValue(dataModel.getFilePath())
6767
.build();
6868

bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/ui/MavenConfigurationComposite.java

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.eclipse.swt.layout.GridLayout;
2323
import org.eclipse.swt.widgets.Composite;
2424

25+
import com.amazonaws.eclipse.core.maven.MavenFactory;
2526
import com.amazonaws.eclipse.core.model.MavenConfigurationDataModel;
2627
import com.amazonaws.eclipse.core.validator.PackageNameValidator;
2728
import com.amazonaws.eclipse.core.widget.TextComplex;
@@ -37,31 +38,21 @@ public class MavenConfigurationComposite extends Composite {
3738
private TextComplex packageComplex;
3839

3940
public MavenConfigurationComposite(Composite parent, DataBindingContext context, MavenConfigurationDataModel dataModel) {
40-
this(parent, context, dataModel, null, null, false);
41-
}
42-
43-
public MavenConfigurationComposite(Composite parent, DataBindingContext context, MavenConfigurationDataModel dataModel,
44-
ModifyListener groupIdModifyListener, ModifyListener artifactIdModifyListener) {
45-
this(parent, context, dataModel, groupIdModifyListener, artifactIdModifyListener, false);
46-
}
47-
48-
public MavenConfigurationComposite(Composite parent, DataBindingContext context, MavenConfigurationDataModel dataModel,
49-
ModifyListener groupIdModifyListener, ModifyListener artifactIdModifyListener, boolean creatVerionAndPackage) {
5041
super(parent, SWT.NONE);
5142
setLayout(new GridLayout(2, false));
5243
setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
53-
createControl(context, dataModel, groupIdModifyListener, artifactIdModifyListener, creatVerionAndPackage);
44+
createControl(context, dataModel);
5445
}
5546

56-
private void createControl(DataBindingContext context, MavenConfigurationDataModel dataModel,
57-
ModifyListener groupIdModifyListener, ModifyListener artifactIdModifyListener, boolean creatVerionAndPackage) {
58-
47+
private void createControl(DataBindingContext context, MavenConfigurationDataModel dataModel) {
5948
groupIdComplex = TextComplex.builder()
6049
.composite(this)
6150
.dataBindingContext(context)
6251
.pojoObservableValue(PojoObservables.observeValue(dataModel, MavenConfigurationDataModel.P_GROUP_ID))
63-
.validator(new NotEmptyValidator("Group ID must be provided!"))
64-
.modifyListener(groupIdModifyListener)
52+
.addValidator(new NotEmptyValidator("Group ID must be provided!"))
53+
.modifyListener((e) -> {
54+
onMavenConfigurationChange();
55+
})
6556
.labelValue("Group ID:")
6657
.defaultValue(dataModel.getGroupId())
6758
.build();
@@ -70,30 +61,38 @@ private void createControl(DataBindingContext context, MavenConfigurationDataMod
7061
.composite(this)
7162
.dataBindingContext(context)
7263
.pojoObservableValue(PojoObservables.observeValue(dataModel, MavenConfigurationDataModel.P_ARTIFACT_ID))
73-
.validator(new NotEmptyValidator("Artifact ID must be provided!"))
74-
.modifyListener(artifactIdModifyListener)
64+
.addValidator(new NotEmptyValidator("Artifact ID must be provided!"))
65+
.modifyListener((e) -> {
66+
onMavenConfigurationChange();
67+
})
7568
.labelValue("Artifact ID:")
7669
.defaultValue(dataModel.getArtifactId())
7770
.build();
7871

79-
if (creatVerionAndPackage) {
80-
versionComplex = TextComplex.builder()
81-
.composite(this)
82-
.dataBindingContext(context)
83-
.pojoObservableValue(PojoObservables.observeValue(dataModel, MavenConfigurationDataModel.P_VERSION))
84-
.validator(new NotEmptyValidator("Version must be provided!"))
85-
.labelValue("Version:")
86-
.defaultValue(dataModel.getVersion())
87-
.build();
72+
versionComplex = TextComplex.builder()
73+
.composite(this)
74+
.dataBindingContext(context)
75+
.pojoObservableValue(PojoObservables.observeValue(dataModel, MavenConfigurationDataModel.P_VERSION))
76+
.addValidator(new NotEmptyValidator("Version must be provided!"))
77+
.labelValue("Version:")
78+
.defaultValue(dataModel.getVersion())
79+
.build();
80+
81+
packageComplex = TextComplex.builder()
82+
.composite(this)
83+
.dataBindingContext(context)
84+
.pojoObservableValue(PojoObservables.observeValue(dataModel, MavenConfigurationDataModel.P_PACKAGE_NAME))
85+
.addValidator(new PackageNameValidator("Package name must be provided!"))
86+
.labelValue("Package name:")
87+
.defaultValue(dataModel.getPackageName())
88+
.build();
89+
}
8890

89-
packageComplex = TextComplex.builder()
90-
.composite(this)
91-
.dataBindingContext(context)
92-
.pojoObservableValue(PojoObservables.observeValue(dataModel, MavenConfigurationDataModel.P_PACKAGE_NAME))
93-
.validator(new PackageNameValidator("Package name must be provided!"))
94-
.labelValue("Package name:")
95-
.defaultValue(dataModel.getPackageName())
96-
.build();
91+
private void onMavenConfigurationChange() {
92+
if (packageComplex != null && groupIdComplex != null && artifactIdComplex != null) {
93+
String groupId = groupIdComplex.getText().getText();
94+
String artifactId = artifactIdComplex.getText().getText();
95+
packageComplex.setText(MavenFactory.assumePackageName(groupId, artifactId));
9796
}
9897
}
9998
}

bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/ui/ProjectNameComposite.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private void createControl(DataBindingContext context, ProjectNameDataModel data
4444
.composite(this)
4545
.dataBindingContext(context)
4646
.pojoObservableValue(PojoObservables.observeValue(dataModel, ProjectNameDataModel.P_PROJECT_NAME))
47-
.validator(new ProjectNameValidator())
47+
.addValidator(new ProjectNameValidator())
4848
.defaultValue(dataModel.getProjectName())
4949
.labelValue("Project name:")
5050
.build();

bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/widget/TextComplex.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,6 @@ public TextComplexBuilder pojoObservableValue(IObservableValue pojoObservableVal
136136
return this;
137137
}
138138

139-
@Deprecated
140-
public TextComplexBuilder validator(IValidator validator) {
141-
this.validators.add(validator);
142-
return this;
143-
}
144-
145139
public TextComplexBuilder addValidator(IValidator validator) {
146140
this.validators.add(validator);
147141
return this;

0 commit comments

Comments
 (0)