2929import java .io .File ;
3030import java .lang .reflect .InvocationTargetException ;
3131import java .net .URI ;
32- import java .util .Arrays ;
3332import java .util .Collection ;
34- import java .util .Collections ;
3533import java .util .EnumSet ;
3634import java .util .List ;
3735import java .util .Properties ;
5755 */
5856public class DataflowProjectCreator implements IRunnableWithProgress {
5957
60- private static final String DEFAULT_JAVA_VERSION = JavaCore .VERSION_1_8 ;
61- private static final List <String > JAVA_VERSION_BLACKLIST =
62- Collections .unmodifiableList (Arrays .asList (JavaCore .VERSION_1_1 , JavaCore .VERSION_1_2 ,
63- JavaCore .VERSION_1_3 , JavaCore .VERSION_1_4 , JavaCore .VERSION_1_5 ,
64- JavaCore .VERSION_1_6 , JavaCore .VERSION_1_7 , JavaCore .VERSION_CLDC_1_1 ));
65-
6658 private final IProjectConfigurationManager projectConfigurationManager ;
6759
6860 private DataflowProjectArchetype template ;
@@ -170,7 +162,8 @@ public void run(IProgressMonitor monitor)
170162 archetype .setArtifactId (template .getArtifactId ());
171163
172164 Properties archetypeProperties = new Properties ();
173- archetypeProperties .setProperty ("targetPlatform" , getTargetPlatform ());
165+ // only support 1.8 until we support Beam
166+ archetypeProperties .setProperty ("targetPlatform" , JavaCore .VERSION_1_8 );
174167
175168 IPath location = null ;
176169 if (customLocation ) {
@@ -224,32 +217,6 @@ private void setPreferences(IProject project) {
224217 prefs .save ();
225218 }
226219
227- /**
228- * Gets the target platform of the environment's JDT plugin. If not found, use the default target
229- * platform. If not supported, throw a {@link ProjectCreationException}.
230- */
231- private static String getTargetPlatform () throws ProjectCreationException {
232- String targetPlatform = JavaCore .getOption (JavaCore .COMPILER_CODEGEN_TARGET_PLATFORM );
233- if (targetPlatform == null || JAVA_VERSION_BLACKLIST .contains (targetPlatform )) {
234- DataflowCorePlugin .logWarning (
235- "Couldn't find supported target platform. Got %s. Using default version %s" ,
236- targetPlatform , DEFAULT_JAVA_VERSION );
237- targetPlatform = DEFAULT_JAVA_VERSION ;
238- } else {
239- targetPlatform = targetPlatform .toString ();
240- }
241- return targetPlatform ;
242- }
243-
244- private DataflowProjectValidationStatus validateTargetPlatform () {
245- try {
246- getTargetPlatform ();
247- return DataflowProjectValidationStatus .OK ;
248- } catch (ProjectCreationException e ) {
249- return DataflowProjectValidationStatus .UNSUPPORTED_TARGET_PLATFORM ;
250- }
251- }
252-
253220 private void checkCancelled (IProgressMonitor monitor ) {
254221 if (monitor .isCanceled ()) {
255222 throw new OperationCanceledException ();
@@ -267,7 +234,6 @@ private Collection<DataflowProjectValidationStatus> failedValidations() {
267234 statuses .add (validateMavenGroupId ());
268235 statuses .add (validateMavenArtifactId ());
269236 statuses .add (validatePackage ());
270- statuses .add (validateTargetPlatform ());
271237
272238 // Must be last: Remove OK so the set contains only failed validations.
273239 statuses .remove (DataflowProjectValidationStatus .OK );
0 commit comments