From 3ab9cc8beb604d8bdd6d67ec72304d680d362041 Mon Sep 17 00:00:00 2001 From: Alena Laskavaia Date: Thu, 12 Mar 2009 18:32:27 +0000 Subject: [263201] - patch applied for: In Problems view - move location of errors/warnings from Description column to Location --- .../org/eclipse/cdt/core/errorparsers/ErrorPattern.java | 7 +++++-- .../src/org/eclipse/cdt/core/resources/ACBuilder.java | 17 ++++++++++++++--- .../cdt/internal/core/CCorePluginResources.properties | 1 + 3 files changed, 20 insertions(+), 5 deletions(-) (limited to 'core') diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/errorparsers/ErrorPattern.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/errorparsers/ErrorPattern.java index 20eb6519b00..c0c8d1e69cd 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/errorparsers/ErrorPattern.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/errorparsers/ErrorPattern.java @@ -140,7 +140,6 @@ public class ErrorPattern { if (file == null) { // If the file is not found in the workspace we attach the problem to the project // and add the external path to the file. - desc = fileName + " " + desc; //$NON-NLS-1$ file = eoParser.getProject(); externalPath = getLocation(fileName); } @@ -162,7 +161,11 @@ public class ErrorPattern { try { cygpath = new CygPath("cygpath"); //$NON-NLS-1$ String cygfilename = cygpath.getFileName(filename); - path = new Path(cygfilename); + IPath convertedPath = new Path(cygfilename); + file = convertedPath.toFile() ; + if (file.exists()) { + path = convertedPath; + } } catch (IOException e) { } finally { 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 03067bc862c..591f47e4912 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 @@ -21,6 +21,7 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IncrementalProjectBuilder; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Preferences; +import org.eclipse.osgi.util.NLS; public abstract class ACBuilder extends IncrementalProjectBuilder implements IMarkerGenerator { @@ -53,13 +54,20 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa /* * Try to find matching markers and don't put in duplicates */ + String externalLocation = null; + if (problemMarkerInfo.externalPath != null) { + externalLocation = problemMarkerInfo.externalPath.toOSString(); + } if ((cur != null) && (cur.length > 0)) { for (IMarker element : cur) { int line = ((Integer) element.getAttribute(IMarker.LINE_NUMBER)).intValue(); int sev = ((Integer) element.getAttribute(IMarker.SEVERITY)).intValue(); String mesg = (String) element.getAttribute(IMarker.MESSAGE); + String extloc = (String) element.getAttribute(ICModelMarker.C_MODEL_MARKER_EXTERNAL_LOCATION); if (line == problemMarkerInfo.lineNumber && sev == mapMarkerSeverity(problemMarkerInfo.severity) && mesg.equals(problemMarkerInfo.description)) { - return; + if (extloc==externalLocation || (extloc!=null && extloc.equals(externalLocation))) { + return; + } } } } @@ -73,8 +81,11 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa if (problemMarkerInfo.variableName != null) { marker.setAttribute(ICModelMarker.C_MODEL_MARKER_VARIABLE, problemMarkerInfo.variableName); } - if (problemMarkerInfo.externalPath != null) { - marker.setAttribute(ICModelMarker.C_MODEL_MARKER_EXTERNAL_LOCATION, problemMarkerInfo.externalPath.toOSString()); + 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); } } catch (CoreException e) { diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePluginResources.properties b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePluginResources.properties index 50858ce1659..ac3d5d16998 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePluginResources.properties +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CCorePluginResources.properties @@ -10,6 +10,7 @@ # Markus Schorn (Wind River Systems) # Anton Leherbauer (Wind River Systems) ############################################################################### +ACBuilder.ProblemsView.Location=line {0}, external location: {1} CBuilder.build_error= Build Error CoreModel.BinaryRunner.Binary_Search_Thread=Searching for Binaries CoreModel.CModelBuilder.Parser_Construction_Failure=Parser/Scanner construction failure. -- cgit v1.2.3