From 38269401763c5ca724ed89c4626d3ee00117f4c3 Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Mon, 29 Mar 2010 16:49:05 +0000 Subject: [PATCH] bug 307365: Do not put into marker external locations which cannot be open by editor --- .../eclipse/cdt/core/resources/ACBuilder.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ACBuilder.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ACBuilder.java index a749e3fee99..60c6e874ccd 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ACBuilder.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/resources/ACBuilder.java @@ -12,6 +12,8 @@ package org.eclipse.cdt.core.resources; +import java.net.URI; +import java.net.URISyntaxException; import java.util.Map; import org.eclipse.cdt.core.CCorePlugin; @@ -38,7 +40,7 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa private static final String CONTENTS_CONFIGURATION_IDS = "org.eclipse.cdt.make.core.configurationIds"; //$NON-NLS-1$ /** @since 5.2 */ // set to true to print build events on the console in debug mode - protected static final boolean DEBUG_EVENTS = false; + protected static final boolean DEBUG_EVENTS = true; /** * Constructor for ACBuilder */ @@ -92,10 +94,17 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa marker.setAttribute(ICModelMarker.C_MODEL_MARKER_VARIABLE, problemMarkerInfo.variableName); } if (externalLocation != null) { - marker.setAttribute(ICModelMarker.C_MODEL_MARKER_EXTERNAL_LOCATION, externalLocation); - String locationText = NLS.bind(CCorePlugin.getResourceString("ACBuilder.ProblemsView.Location"), //$NON-NLS-1$ - problemMarkerInfo.lineNumber, externalLocation); - marker.setAttribute(IMarker.LOCATION, locationText); + try { + URI uri = new URI(externalLocation); + if (uri.getScheme()!=null) { + marker.setAttribute(ICModelMarker.C_MODEL_MARKER_EXTERNAL_LOCATION, externalLocation); + String locationText = NLS.bind(CCorePlugin.getResourceString("ACBuilder.ProblemsView.Location"), //$NON-NLS-1$ + problemMarkerInfo.lineNumber, externalLocation); + marker.setAttribute(IMarker.LOCATION, locationText); + } + } catch (URISyntaxException e) { + // Just ignore those which cannot be open by editor + } } else if (problemMarkerInfo.lineNumber==0){ marker.setAttribute(IMarker.LOCATION, " "); //$NON-NLS-1$ }