[debug] some more fixes and fine-tuning around breakpoints and debugging.

This commit is contained in:
Sven Efftinge 2012-03-07 11:16:30 +01:00
parent 644bb665d2
commit 69092a288f
3 changed files with 38 additions and 3 deletions

View file

@ -15,6 +15,7 @@ Export-Package: org.eclipse.xtext,
org.eclipse.xtext.common.services,
org.eclipse.xtext.conversion,
org.eclipse.xtext.conversion.impl,
org.eclipse.xtext.debug;x-internal:=true,
org.eclipse.xtext.diagnostics,
org.eclipse.xtext.documentation,
org.eclipse.xtext.documentation.impl,

View file

@ -0,0 +1,29 @@
/*******************************************************************************
* Copyright (c) 2012 itemis AG (http://www.itemis.eu) and others.
* 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
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.eclipse.xtext.debug;
import org.eclipse.xtext.resource.XtextResource;
import com.google.inject.ImplementedBy;
/**
* @author Sven Efftinge - Initial contribution and API
*/
@ImplementedBy(IStratumBreakpointSupport.DefaultImpl.class)
public interface IStratumBreakpointSupport {
public boolean isValidLineForBreakPoint(XtextResource resource, int line);
public static class DefaultImpl implements IStratumBreakpointSupport {
public boolean isValidLineForBreakPoint(XtextResource resource, int line) {
return false;
}
}
}

View file

@ -24,6 +24,7 @@ import java.util.Set;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.emf.common.util.URI;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.xtext.LanguageInfo;
import org.eclipse.xtext.resource.IResourceServiceProvider;
import org.eclipse.xtext.smap.SDEInstaller;
@ -43,11 +44,14 @@ public class SmapSupport {
@Inject private IResourceServiceProvider.Registry serviceProviderRegistry;
public String generateSmap(AbstractTraceRegion rootTraceRegion, String outputFileName) {
public @Nullable String generateSmap(AbstractTraceRegion rootTraceRegion, String outputFileName) {
final Set<LineMapping> lineData = newLinkedHashSet();
createSmapInfo(rootTraceRegion, lineData);
if (lineData.isEmpty())
return null;
List<LineMapping> lineInfo = normalizeLineInfo(lineData);
if (lineInfo.isEmpty())
return null;
return toSmap(outputFileName, lineInfo);
}
@ -98,7 +102,8 @@ public class SmapSupport {
current = new LineMapping(mapping.sourceStartLine, mapping.targetStartLine, mapping.targetEndLine, mapping.source);
}
}
result.add(0, current);
if (current != null)
result.add(0, current);
return result;
}