From 08f6c3b15e20ec2425abbfd1f867920d91ba83e0 Mon Sep 17 00:00:00 2001 From: Eric Milles Date: Wed, 28 Jul 2021 12:04:03 -0500 Subject: [PATCH] New Groovy Project wizard: uncheck "Create module-info.java file" java.lang.NoSuchMethodException: org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathsBlock.getSourceContainerPage() at java.base/java.lang.Class.getDeclaredMethod(Class.java:2475) at org.eclipse.jdt.groovy.core.util.ReflectionUtils.getDeclaredMethod(ReflectionUtils.java:157) at org.eclipse.jdt.groovy.core.util.ReflectionUtils.executePrivateMethod(ReflectionUtils.java:102) at org.eclipse.jdt.groovy.core.util.ReflectionUtils.executePrivateMethod(ReflectionUtils.java:97) at org.codehaus.groovy.eclipse.wizards.NewProjWizard$2.createControl(NewProjWizard.java:90) at org.eclipse.jface.wizard.Wizard.createPageControls(Wizard.java:178) at org.eclipse.jface.wizard.WizardDialog.createPageControls(WizardDialog.java:743) at org.eclipse.jface.wizard.WizardDialog.createContents(WizardDialog.java:635) at org.eclipse.jface.window.Window.create(Window.java:431) at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1094) at org.eclipse.ui.internal.actions.NewWizardShortcutAction.run(NewWizardShortcutAction.java:119) #1233 #1276 --- .../org/codehaus/groovy/eclipse/wizards/NewProjWizard.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ide/org.codehaus.groovy.eclipse.ui/src/org/codehaus/groovy/eclipse/wizards/NewProjWizard.java b/ide/org.codehaus.groovy.eclipse.ui/src/org/codehaus/groovy/eclipse/wizards/NewProjWizard.java index 2f9ae55f56..dfc29356b8 100644 --- a/ide/org.codehaus.groovy.eclipse.ui/src/org/codehaus/groovy/eclipse/wizards/NewProjWizard.java +++ b/ide/org.codehaus.groovy.eclipse.ui/src/org/codehaus/groovy/eclipse/wizards/NewProjWizard.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2020 the original author or authors. + * Copyright 2009-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.groovy.core.util.ArrayUtils; import org.eclipse.jdt.groovy.core.util.ReflectionUtils; +import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.util.ExceptionHandler; import org.eclipse.jdt.internal.ui.wizards.NewElementWizard; import org.eclipse.jdt.ui.wizards.JavaCapabilityConfigurationPage; @@ -57,6 +58,8 @@ public NewProjWizard() { @Override public void addPages() { + JavaPlugin.getDefault().getDialogSettings().put("org.eclipse.jdt.ui.last.selected.create.moduleinfo", false); + pageOne = new NewJavaProjectWizardPageOne() { @Override public IClasspathEntry[] getDefaultClasspathEntries() { @@ -80,6 +83,8 @@ public IClasspathEntry[] getDefaultClasspathEntries() { public void createControl(final Composite parent) { super.createControl(parent); + if (JavaPlugin.getDefault().getBundle().getVersion().compareTo(org.osgi.framework.Version.valueOf("3.23")) >= 0) return; + Object buildPathsBlock = ReflectionUtils.executePrivateMethod(JavaCapabilityConfigurationPage.class, "getBuildPathsBlock", this); if (buildPathsBlock != null) { Object sourceFolderPage = ReflectionUtils.executePrivateMethod(buildPathsBlock.getClass(), "getSourceContainerPage", buildPathsBlock);