Skip to content

Commit 168d2b7

Browse files
committed
Address review comments
1 parent 74cdc56 commit 168d2b7

5 files changed

Lines changed: 31 additions & 29 deletions

File tree

plugins/com.google.cloud.tools.eclipse.appengine.newproject.maven/META-INF/MANIFEST.MF

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Import-Package: com.google.cloud.tools.eclipse.appengine.facets,
3030
com.google.cloud.tools.eclipse.ui.util,
3131
com.google.cloud.tools.eclipse.usagetracker,
3232
com.google.cloud.tools.eclipse.util,
33+
com.google.cloud.tools.eclipse.util.service,
3334
com.google.cloud.tools.eclipse.util.status,
3435
org.apache.maven.archetype.catalog;provider=m2e,
3536
org.apache.maven.artifact;provider=m2e,

plugins/com.google.cloud.tools.eclipse.appengine.newproject.maven/plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<wizard
66
id="com.google.cloud.tools.eclipse.appengine.newproject.MavenAppEngineStandard"
77
name="%mavenwizard.name"
8-
class="com.google.cloud.tools.eclipse.appengine.newproject.maven.MavenArchetypeProjectWizard"
8+
class="com.google.cloud.tools.eclipse.util.service.ServiceContextFactory:com.google.cloud.tools.eclipse.appengine.newproject.maven.MavenArchetypeProjectWizard"
99
icon="platform:/plugin/com.google.cloud.tools.eclipse.appengine.ui/icons/gae-16x16.png"
1010
project="true"
1111
finalPerspective="org.eclipse.jst.j2ee.J2EEPerspective"

plugins/com.google.cloud.tools.eclipse.appengine.newproject.maven/src/com/google/cloud/tools/eclipse/appengine/newproject/maven/MavenArchetypeProjectWizard.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@
3030
import com.google.cloud.tools.eclipse.util.status.StatusUtil;
3131
import java.io.File;
3232
import java.lang.reflect.InvocationTargetException;
33+
import javax.inject.Inject;
3334
import org.eclipse.core.resources.IFile;
34-
import org.eclipse.core.runtime.CoreException;
3535
import org.eclipse.core.runtime.IConfigurationElement;
36-
import org.eclipse.core.runtime.IExecutableExtension;
3736
import org.eclipse.core.runtime.IProgressMonitor;
3837
import org.eclipse.core.runtime.IStatus;
3938
import org.eclipse.core.runtime.Status;
@@ -44,12 +43,19 @@
4443
import org.eclipse.ui.IWorkbench;
4544
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
4645

46+
/**
47+
* Creates a new Maven-based App Engine Standard project using an archetype.
48+
* <p>
49+
* Expected to be created via the {@link ServiceContextFactory}.
50+
*/
4751
public class MavenArchetypeProjectWizard extends Wizard
48-
implements INewWizard, IExecutableExtension {
52+
implements INewWizard {
4953
private MavenAppEngineStandardWizardPage page;
5054
private MavenAppEngineStandardArchetypeWizardPage archetypePage;
5155
private File cloudSdkLocation;
5256
private IWorkbench workbench;
57+
58+
@Inject
5359
private IConfigurationElement configElement;
5460

5561
public MavenArchetypeProjectWizard() {
@@ -144,11 +150,4 @@ public void init(IWorkbench workbench, IStructuredSelection selection) {
144150
// if the user doesn't provide the Cloud SDK then we'll error in performFinish() too
145151
}
146152
}
147-
148-
@Override
149-
public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
150-
throws CoreException {
151-
this.configElement = config;
152-
}
153-
154153
}

plugins/com.google.cloud.tools.eclipse.appengine.newproject/src/com/google/cloud/tools/eclipse/appengine/newproject/AppEngineProjectWizard.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@
4343
import org.eclipse.ui.ide.undo.WorkspaceUndoUtil;
4444
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
4545

46-
/** Expected to be created via the {@link ServiceContextFactory}. */
46+
/**
47+
* Base class for App Engine projection creation.
48+
* <p>
49+
* Expected to be created via the {@link ServiceContextFactory}.
50+
*/
4751
public abstract class AppEngineProjectWizard extends Wizard implements INewWizard {
4852

4953
private AppEngineWizardPage page = null;

plugins/com.google.cloud.tools.eclipse.util/src/com/google/cloud/tools/eclipse/util/service/ServiceContextFactory.java

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,22 @@ public class ServiceContextFactory implements IExecutableExtensionFactory, IExec
2121
@Override
2222
public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
2323
throws CoreException {
24-
if (data == null || !(data instanceof String)) {
25-
throw new CoreException(StatusUtil.error(getClass(), "Data must be a class name"));
26-
}
24+
if (data == null || !(data instanceof String)) {
25+
throw new CoreException(StatusUtil.error(getClass(), "Data must be a class name"));
26+
}
2727
configElement = config;
28-
String className = (String) data;
29-
String bundleSymbolicName = config.getNamespaceIdentifier();
30-
Bundle bundle = Platform.getBundle(bundleSymbolicName);
31-
if (bundle == null) {
32-
throw new CoreException(StatusUtil.error(this, "Missing bundle " + bundleSymbolicName));
33-
}
34-
try {
35-
clazz = bundle.loadClass(className);
36-
} catch (ClassNotFoundException ex) {
37-
throw new CoreException(StatusUtil.error(this,
38-
"Could not load class " + className
39-
+ " from bundle " + bundle.getSymbolicName(),
40-
ex));
41-
}
28+
String className = (String) data;
29+
String bundleSymbolicName = config.getNamespaceIdentifier();
30+
Bundle bundle = Platform.getBundle(bundleSymbolicName);
31+
if (bundle == null) {
32+
throw new CoreException(StatusUtil.error(this, "Missing bundle " + bundleSymbolicName));
33+
}
34+
try {
35+
clazz = bundle.loadClass(className);
36+
} catch (ClassNotFoundException ex) {
37+
throw new CoreException(StatusUtil.error(this,
38+
"Could not load class " + className + " from bundle " + bundle.getSymbolicName(), ex));
39+
}
4240
}
4341

4442
@Override

0 commit comments

Comments
 (0)