Skip to content

Commit

Permalink
Use custom debug model
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Wisniewski <[email protected]>
  • Loading branch information
Adam Wisniewski authored and Adam Wisniewski committed Oct 10, 2023
1 parent fe956b1 commit 577db4d
Show file tree
Hide file tree
Showing 18 changed files with 711 additions and 232 deletions.
16 changes: 15 additions & 1 deletion bundles/io.openliberty.tools.eclipse.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ Bundle-SymbolicName: io.openliberty.tools.eclipse.ui;singleton:=true
Bundle-Version: 23.0.9.qualifier
Bundle-Activator: io.openliberty.tools.eclipse.LibertyDevPlugin
Export-Package: io.openliberty.tools.eclipse;x-friends:="io.openliberty.tools.eclipse.tests",
io.openliberty.tools.eclipse.debug;x-friends:="io.openliberty.tools.eclipse.tests",
io.openliberty.tools.eclipse.ui.dashboard;x-friends:="io.openliberty.tools.eclipse.tests",
io.openliberty.tools.eclipse.ui.launch;x-friends:="io.openliberty.tools.eclipse.tests",
io.openliberty.tools.eclipse.ui.launch.shortcuts;x-friends:="io.openliberty.tools.eclipse.tests",
io.openliberty.tools.eclipse.ui.preferences;x-friends:="io.openliberty.tools.eclipse.tests"
Require-Bundle: org.eclipse.ui,
org.eclipse.equinox.preferences
org.eclipse.equinox.preferences,
org.eclipse.swt,
org.eclipse.m2e.maven.runtime,
org.eclipse.m2e.core
Bundle-RequiredExecutionEnvironment: JavaSE-17
Automatic-Module-Name: io.openliberty.tools.eclipse.ui
Bundle-ActivationPolicy: lazy
Expand All @@ -23,11 +27,18 @@ Import-Package: org.eclipse.core.commands,
org.eclipse.core.runtime.jobs,
org.eclipse.debug.core,
org.eclipse.debug.core.model,
org.eclipse.debug.core.sourcelookup,
org.eclipse.debug.ui,
org.eclipse.debug.ui.sourcelookup,
org.eclipse.jdi,
org.eclipse.jdt.core,
org.eclipse.jdt.debug.core,
org.eclipse.jdt.debug.ui.launchConfigurations,
org.eclipse.jdt.launching,
org.eclipse.jdt.launching.sourcelookup.containers,
org.eclipse.jem.util.emf.workbench,
org.eclipse.m2e.core,
org.eclipse.m2e.core.project,
org.eclipse.osgi.service.debug,
org.eclipse.osgi.util,
org.eclipse.swt.custom,
Expand All @@ -43,4 +54,7 @@ Import-Package: org.eclipse.core.commands,
org.eclipse.ui,
org.eclipse.ui.handlers,
org.eclipse.ui.plugin,
org.gradle.tooling,
org.gradle.tooling.model,
org.gradle.tooling.model.eclipse,
org.osgi.framework
19 changes: 18 additions & 1 deletion bundles/io.openliberty.tools.eclipse.ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,31 @@
</command>
</menuContribution>
</extension>

<extension point="org.eclipse.debug.core.sourceLocators">
<sourceLocator
name="Liberty Source Lookup Director"
class="io.openliberty.tools.eclipse.debug.LibertySourceLookupDirector"
id="io.openliberty.tools.eclipse.debug.libertySourceLookupDirector">
</sourceLocator>
</extension>

<extension point="org.eclipse.debug.core.sourcePathComputers">
<sourcePathComputer
class="io.openliberty.tools.eclipse.debug.LibertySourcePathComputer"
id="io.openliberty.tools.eclipse.debug.libertySourcePathComputer">
</sourcePathComputer>
</extension>

<!-- Launch configuration -->
<extension point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
name="Liberty"
delegate="io.openliberty.tools.eclipse.ui.launch.LaunchConfigurationDelegateLauncher"
modes="run, debug"
id="io.openliberty.tools.eclipse.launch.type">
id="io.openliberty.tools.eclipse.launch.type"
sourceLocatorId="io.openliberty.tools.eclipse.debug.libertySourceLookupDirector"
sourcePathComputerId="io.openliberty.tools.eclipse.debug.libertySourcePathComputer">
</launchConfigurationType>
</extension>
<extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;

import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.osgi.util.NLS;

import io.openliberty.tools.eclipse.logging.Trace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jface.viewers.ISelection;
Expand All @@ -46,6 +47,7 @@

import io.openliberty.tools.eclipse.CommandBuilder.CommandNotFoundException;
import io.openliberty.tools.eclipse.Project.BuildType;
import io.openliberty.tools.eclipse.debug.DebugModeHandler;
import io.openliberty.tools.eclipse.logging.Logger;
import io.openliberty.tools.eclipse.logging.Trace;
import io.openliberty.tools.eclipse.messages.Messages;
Expand Down Expand Up @@ -151,7 +153,7 @@ public static DevModeOperations getInstance() {
* @param javaHomePath The configuration java installation home to be set in the terminal running dev mode.
* @param mode The configuration mode.
*/
public void start(IProject iProject, String parms, String javaHomePath, String mode) {
public void start(IProject iProject, String parms, String javaHomePath, ILaunch launch, String mode) {

if (Trace.isEnabled()) {
Trace.getTracer().traceEntry(Trace.TRACE_TOOLS, new Object[] { iProject, parms, javaHomePath, mode });
Expand Down Expand Up @@ -232,13 +234,13 @@ public void start(IProject iProject, String parms, String javaHomePath, String m
+ "does not appear to be a Maven or Gradle built project.");
}

// Start a terminal and run the application in dev mode.
startDevMode(cmd, projectName, projectPath, javaHomePath);

// If there is a debugPort, start the job to attach the debugger to the Liberty server JVM.
if (debugPort != null) {
debugModeHandler.startDebugAttacher(project, debugPort);
debugModeHandler.startDebugAttacher(project, launch, debugPort);
}

// Start a terminal and run the application in dev mode.
startDevMode(cmd, projectName, projectPath, javaHomePath);
} catch (CommandNotFoundException e) {
String msg = "Maven or Gradle command not found for project " + projectName;
if (Trace.isEnabled()) {
Expand Down Expand Up @@ -266,7 +268,7 @@ public void start(IProject iProject, String parms, String javaHomePath, String m
* @param javaHomePath The configuration java installation home to be set in the terminal running dev mode.
* @param mode The configuration mode.
*/
public void startInContainer(IProject iProject, String parms, String javaHomePath, String mode) {
public void startInContainer(IProject iProject, String parms, String javaHomePath, ILaunch launch, String mode) {

if (Trace.isEnabled()) {
Trace.getTracer().traceEntry(Trace.TRACE_TOOLS, new Object[] { iProject, parms, javaHomePath, mode });
Expand Down Expand Up @@ -347,13 +349,13 @@ public void startInContainer(IProject iProject, String parms, String javaHomePat
+ "does not appear to be a Maven or Gradle built project.");
}

// Start a terminal and run the application in dev mode.
startDevMode(cmd, projectName, projectPath, javaHomePath);

// If there is a debugPort, start the job to attach the debugger to the Liberty server JVM.
if (debugPort != null) {
debugModeHandler.startDebugAttacher(project, debugPort);
debugModeHandler.startDebugAttacher(project, launch, debugPort);
}

// Start a terminal and run the application in dev mode.
startDevMode(cmd, projectName, projectPath, javaHomePath);
} catch (Exception e) {
String msg = "An error was detected during the start in container request on project " + projectName;
if (Trace.isEnabled()) {
Expand Down
Loading

0 comments on commit 577db4d

Please sign in to comment.