Skip to content

Commit

Permalink
New Groovy Project wizard: uncheck "Create module-info.java file"
Browse files Browse the repository at this point in the history
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
  • Loading branch information
eric-milles committed Jul 28, 2021
1 parent 88d2a87 commit 08f6c3b
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand All @@ -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);
Expand Down

0 comments on commit 08f6c3b

Please sign in to comment.