Adopt Boot Launch to the latest Java launch changes
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Broadcom, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.boot.launch;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaDependenciesTab;
|
||||
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
|
||||
import org.springframework.ide.eclipse.boot.core.SpringBootCore;
|
||||
import org.springsource.ide.eclipse.commons.livexp.util.Log;
|
||||
|
||||
public class BootDependenciesTab extends JavaDependenciesTab {
|
||||
|
||||
@Override
|
||||
public void initializeFrom(ILaunchConfiguration conf) {
|
||||
//See bug: https://github.com/spring-projects/spring-ide/issues/222
|
||||
// If user did not create boot launch config via boot dash and tries to immediately edit classpath
|
||||
// an incorrect default classpath will be computed because of the missing classpath provider.
|
||||
// So make sure the classpath provider is present.
|
||||
IProject project = BootLaunchConfigurationDelegate.getProject(conf);
|
||||
try {
|
||||
if (project!=null && project.hasNature(SpringBootCore.M2E_NATURE) && !conf.hasAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER)) {
|
||||
ILaunchConfigurationWorkingCopy wc = conf.getWorkingCopy();
|
||||
BootLaunchConfigurationDelegate.enableMavenClasspathProviders(wc);
|
||||
conf = wc;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
Log.log(e);
|
||||
}
|
||||
super.initializeFrom(conf);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,16 +11,19 @@
|
||||
package org.springframework.ide.eclipse.boot.launch;
|
||||
|
||||
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
|
||||
import org.eclipse.debug.ui.CommonTab;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
import org.eclipse.debug.ui.EnvironmentTab;
|
||||
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
|
||||
import org.eclipse.debug.ui.ILaunchConfigurationTab;
|
||||
import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
|
||||
import org.eclipse.debug.ui.PrototypeTab;
|
||||
import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
|
||||
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
|
||||
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab;
|
||||
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab;
|
||||
import org.eclipse.jdt.launching.JavaRuntime;
|
||||
|
||||
public class BootLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
|
||||
|
||||
@@ -28,14 +31,17 @@ public class BootLaunchConfigurationTabGroup extends AbstractLaunchConfiguration
|
||||
* @see ILaunchConfigurationTabGroup#createTabs(ILaunchConfigurationDialog, String)
|
||||
*/
|
||||
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
|
||||
ILaunchConfiguration configuration = DebugUITools.getLaunchConfiguration(dialog);
|
||||
boolean isModularConfiguration = configuration != null && JavaRuntime.isModularConfiguration(configuration);
|
||||
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
|
||||
new BootMainTab(),
|
||||
new JavaArgumentsTab(),
|
||||
new JavaJRETab(),
|
||||
new BootClasspathTab(),
|
||||
isModularConfiguration ? new BootDependenciesTab() : new BootClasspathTab(),
|
||||
new SourceLookupTab(),
|
||||
new EnvironmentTab(),
|
||||
new CommonTab()
|
||||
new CommonTab(),
|
||||
new PrototypeTab()
|
||||
};
|
||||
setTabs(tabs);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user