Browse files

fixed custom source path is not working

This was a regression introduced by the workaround for 368212.

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
  • Loading branch information...
1 parent c63e01e commit a584aa9fb5e6e11cf0a6223e350073b85e52d7a0 @ifedorenko committed Feb 14, 2012
View
21 ...okup/src/com/ifedorenko/m2e/sourcelookup/internal/SourceLookupMavenLaunchParticipant.java
@@ -10,14 +10,15 @@
*******************************************************************************/
package com.ifedorenko.m2e.sourcelookup.internal;
-import java.util.Collections;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
+import org.eclipse.jdt.launching.sourcelookup.containers.JavaSourceLookupParticipant;
import org.eclipse.m2e.internal.launch.IMavenLaunchParticipant;
import org.eclipse.m2e.internal.launch.MavenLaunchUtils;
import org.slf4j.Logger;
@@ -57,6 +58,22 @@ public String getVMArguments( ILaunchConfiguration configuration, ILaunch launch
public List<ISourceLookupParticipant> getSourceLookupParticipants( ILaunchConfiguration configuration,
ILaunch launch, IProgressMonitor monitor )
{
- return Collections.<ISourceLookupParticipant> singletonList( new SourceLookupParticipant() );
+ List<ISourceLookupParticipant> participants = new ArrayList<ISourceLookupParticipant>();
+ participants.add( new SourceLookupParticipant() );
+
+ // as a workaround for 368212, javaagent mangles standard java jsr45 strata, which breaks custom source
+ // code lookup configuration. To make this work, contribute m2e-aware JavaSourceLookupParticipant, which
+ // uses source path information from m2e strata
+ participants.add( new JavaSourceLookupParticipant()
+ {
+ @Override
+ public String getSourceName( Object object )
+ throws CoreException
+ {
+ String sourcePath = JDIHelpers.getSourcePath( object );
+ return sourcePath != null ? sourcePath : super.getSourceName( object );
+ }
+ } );
+ return participants;
}
}

0 comments on commit a584aa9

Please sign in to comment.