diff --git a/plugins/org.eclipse.xtext/META-INF/MANIFEST.MF b/plugins/org.eclipse.xtext/META-INF/MANIFEST.MF index d99268e04..42a7480e9 100644 --- a/plugins/org.eclipse.xtext/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.xtext/META-INF/MANIFEST.MF @@ -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, diff --git a/plugins/org.eclipse.xtext/src/org/eclipse/xtext/debug/IStratumBreakpointSupport.java b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/debug/IStratumBreakpointSupport.java new file mode 100644 index 000000000..39dc22989 --- /dev/null +++ b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/debug/IStratumBreakpointSupport.java @@ -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; + } + + } +} diff --git a/plugins/org.eclipse.xtext/src/org/eclipse/xtext/generator/trace/SmapSupport.java b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/generator/trace/SmapSupport.java index e10a7e718..0a6d90ab0 100644 --- a/plugins/org.eclipse.xtext/src/org/eclipse/xtext/generator/trace/SmapSupport.java +++ b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/generator/trace/SmapSupport.java @@ -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 lineData = newLinkedHashSet(); createSmapInfo(rootTraceRegion, lineData); + if (lineData.isEmpty()) + return null; List 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; }