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: v201708161930 Release.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhx committed Aug 16, 2017
1 parent 9baaced commit 5cc2929
Show file tree
Hide file tree
Showing 33 changed files with 525 additions and 302 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"current": [
"* 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."
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2017 Amazon Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://aws.amazon.com/apache2.0
*
* 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;

import org.eclipse.jface.action.Action;

import com.amazonaws.eclipse.core.mobileanalytics.AwsToolkitMetricType;
import com.amazonaws.eclipse.core.mobileanalytics.ToolkitAnalyticsUtils;

public class OpenLinkAction extends Action {
private final String linkName;

public OpenLinkAction(String linkName) {
this.linkName = linkName;
}

@Override
public void run() {
ToolkitAnalyticsUtils.publishBooleansEvent(AwsToolkitMetricType.OVERVIEW_OPEN_LINK_ITEM, linkName, true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
public enum AwsToolkitMetricType {
/* AWS Overview Events */
OVERVIEW("Overview"),
OVERVIEW_OPEN_LINK_ITEM("Overview-OpenLinkItem"),
/* AWS Explorer Events */
EXPLORER_LOADING("Explorer-Loading"),
/* Explorer Dynamodb Actions */
Expand All @@ -36,7 +37,7 @@ public enum AwsToolkitMetricType {
EXPLORER_CODECOMMIT_REFRESH_REPO_EDITOR("Explorer-CodeCommitRefreshRepoEditor"),
EXPLORER_CODECOMMIT_CREATE_REPO("Explorer-CodeCommitCreateRepo"),
EXPLORER_CODECOMMIT_CLONE_REPO("Explorer-CodeCommitCloneRepo"),
EXPLORER_CODECOMMIT_DELETE_REPO("Explorer_CodeCommitDeleteRepo"),
EXPLORER_CODECOMMIT_DELETE_REPO("Explorer-CodeCommitDeleteRepo"),
EXPLORER_CODECOMMIT_OPEN_REPO_EDITOR("Explorer-CodeCommitOpenRepoEditor"),
/* Explorer Beanstalk Actions */
EXPLORER_BEANSTALK_OPEN_ENVIRONMENT_EDITOR("Explorer-BeanstalkOpenEnvironmentEditor"),
Expand All @@ -54,9 +55,34 @@ public enum AwsToolkitMetricType {
EXPLORER_S3_GENERATE_PRESIGNED_URL("Explorer-S3GeneratePresignedUrl"),
EXPLORER_S3_EDIT_OBJECT_TAGS("Explorer-S3EditObjectTags"),
EXPLORER_S3_EDIT_OBJECT_PERMISSIONS("Explorer-S3EditObjectPermissions"),
/* Explorer EC2 Actions */
EXPLORER_EC2_OPEN_VIEW("Explorer-Ec2OpenView"),
EXPLORER_EC2_OPEN_AMIS_VIEW("Explorer-Ec2OpenAmisView"),
EXPLORER_EC2_OPEN_INSTANCES_VIEW("Explorer-Ec2OpenInstancesView"),
EXPLORER_EC2_OPEN_EBS_VIEW("Explorer-Ec2OpenEbsView"),
EXPLORER_EC2_OPEN_SECURITY_GROUPS_VIEW("Explorer-Ec2OpenSecurityGroupsView"),
EXPLORER_EC2_SELECT_SECURITY_GROUP("Explorer-Ec2SelectSecurityGroup"),
EXPLORER_EC2_NEW_SECURITY_GROUP("Explorer-Ec2NewSecurityGroup"),
EXPLORER_EC2_DELETE_SECURITY_GROUP("Explorer-Ec2DeleteSecurityGroup"),
EXPLORER_EC2_ADD_PERMISSIONS_TO_SECURITY_GROUP("Explorer-Ec2AddPermissionsToSecurityGroup"),
EXPLORER_EC2_REMOVE_PERMISSIONS_FROM_SECURITY_GROUP("Explorer-Ec2RemovePermissionsFromSecurityGroup"),
EXPLORER_EC2_REFRESH_SECURITY_GROUP("Explorer-Ec2RefreshSecurityGroup"),
EXPLORER_EC2_OPEN_SHELL_ACTION("Explorer-Ec2OpenShellAction"),
EXPLORER_EC2_OPEN_SHELL_DIALOG_ACTION("Explorer-Ec2OpenShellDialogAction"),
EXPLORER_EC2_REBOOT_ACTION("Explorer-Ec2RebootAction"),
EXPLORER_EC2_TERMINATE_ACTION("Explorer-Ec2TerminateAction"),
EXPLORER_EC2_CREATE_AMI_ACTION("Explorer-Ec2CreateAmiAction"),
EXPLORER_EC2_COPY_PUBLIC_DNS_NAME_ACTION("Explorer-Ec2CopyPublicDnsNameAction"),
EXPLORER_EC2_ATTACH_NEW_VOLUME_ACTION("Explorer-Ec2AttachNewVolumeAction"),
EXPLORER_EC2_START_INSTANCES_ACTION("Explorer-Ec2StartInstancesAction"),
EXPLORER_EC2_STOP_INSTANCES_ACTION("Explorer-Ec2StopInstancesAction"),
/* Aws level Events */
AWS_NEW_JAVA_PROJECT_WIZARD("Aws-NewJavaProjectWizard"),
/* Dynamodb Events */
DYNAMODB_INSTALL_TEST_TOOL("Dynamodb-InstallTestTool"),
DYNAMODB_UNINSTALL_TEST_TOOL("Dynamodb-UninstallTestTool"),
/* Ec2 Events */
EC2_LAUNCH_INSTANCES("Ec2-LaunchInstances"),
/* Lambda Events */
LAMBDA_NEW_LAMBDA_FUNCTION_WIZARD("Lambda-NewLambdaFunctionWizard"),
LAMBDA_NEW_LAMBDA_PROJECT_WIZARD("Lambda-NewLambdaProjectWizard"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
public abstract class AbstractAwsProjectWizard extends AbstractAwsWizard implements INewWizard {
protected IStructuredSelection selection;
protected IWorkbench workbench;
private long actionStartTimeMilli;
private long actionEndTimeMilli;

protected AbstractAwsProjectWizard(String windowTitle) {
super(windowTitle);
Expand All @@ -47,6 +49,7 @@ public void init(IWorkbench workbench, IStructuredSelection selection) {
@Override
public final boolean performFinish() {
beforeExecution();
actionStartTimeMilli = System.currentTimeMillis();

IRunnableWithProgress runnable = new IRunnableWithProgress() {
@Override
Expand All @@ -58,6 +61,7 @@ public void run(IProgressMonitor monitor)
protected void execute(IProgressMonitor monitor) throws CoreException,
InvocationTargetException, InterruptedException {
IStatus status = doFinish(monitor);
actionEndTimeMilli = System.currentTimeMillis();
afterExecution(status);
if (status.getSeverity() == IStatus.ERROR) {
throw new InvocationTargetException(status.getException(), status.getMessage());
Expand Down Expand Up @@ -85,5 +89,9 @@ protected void execute(IProgressMonitor monitor) throws CoreException,
return status.isOK();
}

protected long getActionExecutionTimeMillis() {
return actionEndTimeMilli - actionStartTimeMilli;
}

protected abstract AbstractAwsPlugin getPlugin();
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.Action;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridLayout;
Expand All @@ -41,7 +42,10 @@

import com.amazonaws.eclipse.core.AwsToolkitCore;
import com.amazonaws.eclipse.core.AwsUrls;
import com.amazonaws.eclipse.core.OpenLinkAction;
import com.amazonaws.eclipse.core.diagnostic.utils.EmailMessageLauncher;
import com.amazonaws.eclipse.core.mobileanalytics.AwsToolkitMetricType;
import com.amazonaws.eclipse.core.mobileanalytics.ToolkitAnalyticsUtils;
import com.amazonaws.eclipse.core.util.RssFeed;
import com.amazonaws.eclipse.core.util.RssFeed.Item;
import com.amazonaws.eclipse.core.util.RssFeedParser;
Expand Down Expand Up @@ -168,7 +172,6 @@ public void dispose() {
super.dispose();
}


/*
* Private Interface
*/
Expand Down Expand Up @@ -207,22 +210,22 @@ private Composite createResourcesSection(Composite parent) {
composite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
overviewToolkit.newListItem(composite,
"AWS Toolkit for Eclipse Homepage",
AwsUrls.AWS_TOOLKIT_FOR_ECLIPSE_HOMEPAGE_URL, null);
AwsUrls.AWS_TOOLKIT_FOR_ECLIPSE_HOMEPAGE_URL, new OpenLinkAction("AwsToolkitForEclipseHomepage"));
overviewToolkit.newListItem(composite,
"AWS Java Development Forum",
AwsUrls.JAVA_DEVELOPMENT_FORUM_URL, null);
AwsUrls.JAVA_DEVELOPMENT_FORUM_URL, new OpenLinkAction("AwsJavaDevelopmentForum"));
overviewToolkit.newListItem(composite,
"Frequently Asked Questions",
AwsUrls.AWS_TOOLKIT_FOR_ECLIPSE_FAQ_URL, null);
AwsUrls.AWS_TOOLKIT_FOR_ECLIPSE_FAQ_URL, new OpenLinkAction("FrequentlyAskedQuestion"));
overviewToolkit.newListItem(composite,
"AWS Toolkit for Eclipse Source Code",
AwsUrls.AWS_TOOLKIT_FOR_ECLIPSE_GITHUB_URL, null);
AwsUrls.AWS_TOOLKIT_FOR_ECLIPSE_GITHUB_URL, new OpenLinkAction("AwsToolkitForEclipseSourceCode"));
overviewToolkit.newListItem(composite,
"AWS Management Console",
AwsUrls.AWS_MANAGEMENT_CONSOLE_URL, null);
AwsUrls.AWS_MANAGEMENT_CONSOLE_URL, new OpenLinkAction("AwsManagementConsole"));
overviewToolkit.newListItem(composite,
"Send Feedback to " + EmailMessageLauncher.AWS_ECLIPSE_FEEDBACK_AT_AMZN,
"mailto:" + EmailMessageLauncher.AWS_ECLIPSE_FEEDBACK_AT_AMZN, null);
"mailto:" + EmailMessageLauncher.AWS_ECLIPSE_FEEDBACK_AT_AMZN, new OpenLinkAction("SendFeedback"));

return composite;
}
Expand Down Expand Up @@ -259,13 +262,12 @@ public void run() {
for (Control control : composite.getChildren()) control.dispose();

if (items == null || items.isEmpty()) {
toolkit.newListItem(composite, "AWS Java Developer Blog", JAVA_DEVELOPER_BLOG_URL, null);

toolkit.newListItem(composite, "AWS Java Developer Blog", JAVA_DEVELOPER_BLOG_URL, new OpenLinkAction("AWS Java Developer Blog"));
} else {
for (Item message : items) {
toolkit.newListItem(composite,
message.getTitle(), message.getLink(),
null);
new OpenLinkAction("AWS Blog: " + message.getTitle()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,37 @@
package com.amazonaws.eclipse.explorer;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;

import com.amazonaws.eclipse.core.mobileanalytics.AwsToolkitMetricType;
import com.amazonaws.eclipse.core.mobileanalytics.MetricsDataModel;

public abstract class AwsAction extends Action {
private static final String END_RESULT = "EndResult";
private static final String PERFORMED = "Performed";
private static final String SUCCEEDED = "Succeeded";
private static final String FAILED = "Failed";
private static final String CANCELED = "Canceled";
public static final String END_RESULT = "EndResult";
public static final String PERFORMED = "Performed";
public static final String SUCCEEDED = "Succeeded";
public static final String FAILED = "Failed";
public static final String CANCELED = "Canceled";

private final MetricsDataModel metricsDataModel;

protected AwsAction(AwsToolkitMetricType metricType) {
metricsDataModel = new MetricsDataModel(metricType);
}

protected AwsAction(AwsToolkitMetricType metricType, String text) {
super(text);
this.metricsDataModel = new MetricsDataModel(metricType);
}

protected AwsAction(AwsToolkitMetricType metricType, String text, int style) {
super(text, style);
this.metricsDataModel= new MetricsDataModel(metricType);
this.metricsDataModel = new MetricsDataModel(metricType);
}

protected AwsAction(AwsToolkitMetricType metricType, String text, ImageDescriptor image) {
super(text, image);
this.metricsDataModel = new MetricsDataModel(metricType);
}

private final void actionPerformed() {
Expand Down Expand Up @@ -74,4 +85,9 @@ public static void publishFailedAction(AwsToolkitMetricType metricType) {
public static void publishSucceededAction(AwsToolkitMetricType metricType) {
new MetricsDataModel(metricType).addAttribute(END_RESULT, SUCCEEDED).publishEvent();
}

// Helper method to publish a performed action metric immediately
public static void publishPerformedAction(AwsToolkitMetricType metricType) {
new MetricsDataModel(metricType).addAttribute(END_RESULT, PERFORMED).publishEvent();
}
}
3 changes: 2 additions & 1 deletion bundles/com.amazonaws.eclipse.ec2/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ bin.includes = META-INF/,\
LICENSE,\
lib/jsch-0.1.40/LICENSE,\
etc/,\
lib/jsch-0.1.40/jsch-0.1.40.jar
lib/jsch-0.1.40/jsch-0.1.40.jar,\
lib/PemToPPKConverter.exe
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2017 Amazon Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://aws.amazon.com/apache2.0
*
* 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.ec2;

public class Ec2PluginConstants {
public static final String AMIS_VIEW_ID = "com.amazonaws.eclipse.ec2.ui.views.AmiBrowserView";
public static final String INSTANCES_VIEW_ID = "com.amazonaws.eclipse.ec2.ui.views.InstanceView";
public static final String EBS_VIEW_ID = "com.amazonaws.eclipse.ec2.ui.views.ElasticBlockStorageView";
public static final String SECURITY_GROUPS_VIEW_ID = "com.amazonaws.eclipse.ec2.views.SecurityGroupView";
}
Loading

0 comments on commit 5cc2929

Please sign in to comment.