diff options
author | vladt | 2011-02-22 23:23:50 +0000 |
---|---|---|
committer | vladt | 2011-02-22 23:23:50 +0000 |
commit | 904e9d5bdbb77db7a686ac8d6b36d10219f7aa3c (patch) | |
tree | 37b83c40f2bc1123f9e780de56d018f3b1f98957 | |
parent | 8a8d517791142b7f7fa2948abb91809b3f136884 (diff) | |
download | m2e-core-904e9d5bdbb77db7a686ac8d6b36d10219f7aa3c.tar.gz m2e-core-904e9d5bdbb77db7a686ac8d6b36d10219f7aa3c.tar.xz m2e-core-904e9d5bdbb77db7a686ac8d6b36d10219f7aa3c.zip |
337220: Renamed MarkerLocation to SourceLocation
11 files changed, 71 insertions, 75 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/ActionMessageProblemInfo.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/ActionMessageProblemInfo.java index b1c25f72..258aac5c 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/ActionMessageProblemInfo.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/ActionMessageProblemInfo.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.m2e.core.internal.lifecycle; -import org.eclipse.m2e.core.internal.markers.MarkerLocation; +import org.eclipse.m2e.core.internal.markers.SourceLocation; import org.eclipse.m2e.core.internal.markers.MavenProblemInfo; import org.eclipse.m2e.core.project.configurator.MojoExecutionKey; @@ -22,7 +22,7 @@ public class ActionMessageProblemInfo extends MavenProblemInfo { } public ActionMessageProblemInfo(String message, int severity, MojoExecutionKey mojoExecutionKey, - MarkerLocation markerLocation) { + SourceLocation markerLocation) { //TODO Use actual location super(message, severity, markerLocation); this.mojoExecutionKey = mojoExecutionKey; diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingConfigurationException.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingConfigurationException.java index 6275f68d..dfd53910 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingConfigurationException.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingConfigurationException.java @@ -11,18 +11,18 @@ package org.eclipse.m2e.core.internal.lifecycle; -import org.eclipse.m2e.core.internal.markers.MarkerLocation; +import org.eclipse.m2e.core.internal.markers.SourceLocation; public class LifecycleMappingConfigurationException extends RuntimeException { private static final long serialVersionUID = 713512516951833457L; - private MarkerLocation location; + private SourceLocation location; public LifecycleMappingConfigurationException(String message) { super(message); } - public LifecycleMappingConfigurationException(String message, MarkerLocation location) { + public LifecycleMappingConfigurationException(String message, SourceLocation location) { super(message); this.location = location; } @@ -35,11 +35,11 @@ public class LifecycleMappingConfigurationException extends RuntimeException { super(cause.getMessage(), cause); } - public MarkerLocation getLocation() { + public SourceLocation getLocation() { return location; } - public void setLocation(MarkerLocation location) { + public void setLocation(SourceLocation location) { this.location = location; } } diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingFactory.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingFactory.java index da9fc9bb..7c05f230 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingFactory.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingFactory.java @@ -70,8 +70,8 @@ import org.eclipse.m2e.core.internal.lifecycle.model.LifecycleMappingMetadataSou import org.eclipse.m2e.core.internal.lifecycle.model.PluginExecutionAction; import org.eclipse.m2e.core.internal.lifecycle.model.PluginExecutionMetadata; import org.eclipse.m2e.core.internal.lifecycle.model.io.xpp3.LifecycleMappingMetadataSourceXpp3Reader; -import org.eclipse.m2e.core.internal.markers.MarkerLocation; -import org.eclipse.m2e.core.internal.markers.MarkerLocationHelper; +import org.eclipse.m2e.core.internal.markers.SourceLocation; +import org.eclipse.m2e.core.internal.markers.SourceLocationHelper; import org.eclipse.m2e.core.internal.markers.MavenProblemInfo; import org.eclipse.m2e.core.internal.project.registry.MavenProjectFacade; import org.eclipse.m2e.core.project.IMavenProjectFacade; @@ -339,7 +339,7 @@ public class LifecycleMappingFactory { lifecycleMapping = getLifecycleMapping(lifecycleMappingId); } if(lifecycleMapping == null) { - MarkerLocation markerLocation = MarkerLocationHelper.findPackagingLocation(facade.getMavenProject()); + SourceLocation markerLocation = SourceLocationHelper.findPackagingLocation(facade.getMavenProject()); if(lifecycleMappingId == null) { result.addProblem(new MissingLifecyclePackaging(facade.getPackaging(), markerLocation)); } else { @@ -362,7 +362,7 @@ public class LifecycleMappingFactory { if(executionMetadatas == null || executionMetadatas.isEmpty()) { if(isInterestingPhase(executionKey.getLifecyclePhase())) { - MarkerLocation markerLocation = MarkerLocationHelper.findLocation(projectFacade.getMavenProject(), + SourceLocation markerLocation = SourceLocationHelper.findLocation(projectFacade.getMavenProject(), executionKey); result.addProblem(new NotCoveredMojoExecution(executionKey, markerLocation)); } @@ -376,7 +376,7 @@ public class LifecycleMappingFactory { if(message == null) { message = NLS.bind(Messages.LifecycleConfigurationPluginExecutionErrorMessage, executionKey.toString()); } - MarkerLocation markerLocation = MarkerLocationHelper.findLocation(projectFacade.getMavenProject(), + SourceLocation markerLocation = SourceLocationHelper.findLocation(projectFacade.getMavenProject(), executionKey); result.addProblem(new ActionMessageProblemInfo(message, IMarker.SEVERITY_ERROR, executionKey, markerLocation)); @@ -384,7 +384,7 @@ public class LifecycleMappingFactory { } case execute: if(message != null) { - MarkerLocation markerLocation = MarkerLocationHelper.findLocation(projectFacade.getMavenProject(), + SourceLocation markerLocation = SourceLocationHelper.findLocation(projectFacade.getMavenProject(), executionKey); result.addProblem(new ActionMessageProblemInfo(message, IMarker.SEVERITY_WARNING, executionKey, markerLocation)); @@ -398,7 +398,7 @@ public class LifecycleMappingFactory { } } catch(LifecycleMappingConfigurationException e) { log.debug("Could not instantiate project configurator {}.", configuratorId, e); - MarkerLocation markerLocation = MarkerLocationHelper.findLocation(projectFacade.getMavenProject(), + SourceLocation markerLocation = SourceLocationHelper.findLocation(projectFacade.getMavenProject(), executionKey); result.addProblem(new MissingConfiguratorProblemInfo(configuratorId, markerLocation)); result.addProblem(new NotCoveredMojoExecution(executionKey, markerLocation)); @@ -406,7 +406,7 @@ public class LifecycleMappingFactory { break; case ignore: if(message != null) { - MarkerLocation markerLocation = MarkerLocationHelper.findLocation(projectFacade.getMavenProject(), + SourceLocation markerLocation = SourceLocationHelper.findLocation(projectFacade.getMavenProject(), executionKey); result.addProblem(new ActionMessageProblemInfo(message, IMarker.SEVERITY_WARNING, executionKey, markerLocation)); @@ -589,7 +589,7 @@ public class LifecycleMappingFactory { private static void checkCompatibleVersion(Plugin metadataPlugin) { ComparableVersion version = new ComparableVersion(metadataPlugin.getVersion()); if(!version.equals(new ComparableVersion(LIFECYCLE_MAPPING_PLUGIN_VERSION))) { - MarkerLocation location = MarkerLocationHelper.findLocation(metadataPlugin, MarkerLocationHelper.VERSION); + SourceLocation location = SourceLocationHelper.findLocation(metadataPlugin, SourceLocationHelper.VERSION); throw new LifecycleMappingConfigurationException(NLS.bind(Messages.LifecycleMappingPluginVersionIncompatible, metadataPlugin.getVersion()), location); } @@ -614,8 +614,8 @@ public class LifecycleMappingFactory { if(!"pom".equals(packagingType)) { //$NON-NLS-1$ for(LifecycleMappingMetadata lifecycleMappingMetadata : metadataSource.getLifecycleMappings()) { if(!packagingType.equals(lifecycleMappingMetadata.getPackagingType())) { - MarkerLocation location = MarkerLocationHelper.findLocation(metadataPlugin, - MarkerLocationHelper.CONFIGURATION); + SourceLocation location = SourceLocationHelper.findLocation(metadataPlugin, + SourceLocationHelper.CONFIGURATION); throw new LifecycleMappingConfigurationException(NLS.bind(Messages.LifecycleMappingPackagingMismatch, lifecycleMappingMetadata.getPackagingType(), packagingType), location); } @@ -681,7 +681,7 @@ public class LifecycleMappingFactory { mavenProject.getRemoteArtifactRepositories(), monitor); metadataSources.add(lifecycleMappingMetadataSource); } catch(LifecycleMappingConfigurationException e) { - MarkerLocation location = MarkerLocationHelper.findLocation(plugin, MarkerLocationHelper.CONFIGURATION); + SourceLocation location = SourceLocationHelper.findLocation(plugin, SourceLocationHelper.CONFIGURATION); e.setLocation(location); throw e; } diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingConfiguratorProblemInfo.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingConfiguratorProblemInfo.java index 21df12da..2e045cb3 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingConfiguratorProblemInfo.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingConfiguratorProblemInfo.java @@ -17,14 +17,14 @@ import org.eclipse.osgi.util.NLS; import org.eclipse.m2e.core.core.IMavenConstants; import org.eclipse.m2e.core.internal.Messages; -import org.eclipse.m2e.core.internal.markers.MarkerLocation; +import org.eclipse.m2e.core.internal.markers.SourceLocation; import org.eclipse.m2e.core.internal.markers.MavenProblemInfo; public class MissingConfiguratorProblemInfo extends MavenProblemInfo { private final String configuratorId; - public MissingConfiguratorProblemInfo(String configuratorId, MarkerLocation markerLocation) { + public MissingConfiguratorProblemInfo(String configuratorId, SourceLocation markerLocation) { super(NLS.bind(Messages.ProjectConfiguratorNotAvailable, configuratorId), markerLocation); this.configuratorId = configuratorId; } diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingLifecycleExtensionPoint.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingLifecycleExtensionPoint.java index d7f94e09..50e55154 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingLifecycleExtensionPoint.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingLifecycleExtensionPoint.java @@ -16,13 +16,13 @@ import org.eclipse.osgi.util.NLS; import org.eclipse.m2e.core.core.IMavenConstants; import org.eclipse.m2e.core.internal.Messages; -import org.eclipse.m2e.core.internal.markers.MarkerLocation; +import org.eclipse.m2e.core.internal.markers.SourceLocation; import org.eclipse.m2e.core.internal.markers.MavenProblemInfo; public class MissingLifecycleExtensionPoint extends MavenProblemInfo { private final String lifecycleMappingId; - MissingLifecycleExtensionPoint(String lifecycleMappingId, MarkerLocation markerLocation) { + MissingLifecycleExtensionPoint(String lifecycleMappingId, SourceLocation markerLocation) { super(NLS.bind(Messages.LifecycleMappingNotAvailable, lifecycleMappingId), markerLocation); this.lifecycleMappingId = lifecycleMappingId; } diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingLifecyclePackaging.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingLifecyclePackaging.java index 7a69c83a..a7497902 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingLifecyclePackaging.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingLifecyclePackaging.java @@ -17,14 +17,14 @@ import org.eclipse.osgi.util.NLS; import org.eclipse.m2e.core.core.IMavenConstants; import org.eclipse.m2e.core.internal.Messages; -import org.eclipse.m2e.core.internal.markers.MarkerLocation; +import org.eclipse.m2e.core.internal.markers.SourceLocation; import org.eclipse.m2e.core.internal.markers.MavenProblemInfo; public class MissingLifecyclePackaging extends MavenProblemInfo { private final String packaging; - MissingLifecyclePackaging(String packaging, MarkerLocation markerLocation) { + MissingLifecyclePackaging(String packaging, SourceLocation markerLocation) { super(NLS.bind(Messages.LifecycleMissing, packaging), markerLocation); this.packaging = packaging; } diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/NotCoveredMojoExecution.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/NotCoveredMojoExecution.java index 3d6ffaf9..772ee52b 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/NotCoveredMojoExecution.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/NotCoveredMojoExecution.java @@ -17,7 +17,7 @@ import org.eclipse.osgi.util.NLS; import org.eclipse.m2e.core.core.IMavenConstants; import org.eclipse.m2e.core.internal.Messages; -import org.eclipse.m2e.core.internal.markers.MarkerLocation; +import org.eclipse.m2e.core.internal.markers.SourceLocation; import org.eclipse.m2e.core.internal.markers.MavenProblemInfo; import org.eclipse.m2e.core.project.configurator.MojoExecutionKey; @@ -26,7 +26,7 @@ public class NotCoveredMojoExecution extends MavenProblemInfo { private final MojoExecutionKey mojoExecutionKey; - public NotCoveredMojoExecution(MojoExecutionKey mojoExecutionKey, MarkerLocation markerLocation) { + public NotCoveredMojoExecution(MojoExecutionKey mojoExecutionKey, SourceLocation markerLocation) { super(NLS.bind(Messages.LifecycleConfigurationPluginExecutionNotCovered, mojoExecutionKey.toString()), markerLocation); this.mojoExecutionKey = mojoExecutionKey; diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/markers/MavenProblemInfo.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/markers/MavenProblemInfo.java index 39375338..d40798e5 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/markers/MavenProblemInfo.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/markers/MavenProblemInfo.java @@ -21,29 +21,29 @@ import org.eclipse.m2e.core.internal.lifecycle.LifecycleMappingConfigurationExce public class MavenProblemInfo { - private final MarkerLocation location; + private final SourceLocation location; private final String message; private final int severity; public MavenProblemInfo(int line, Throwable error) { - this.location = new MarkerLocation(line, 0, 0); + this.location = new SourceLocation(line, 0, 0); this.message = error.getMessage(); this.severity = IMarker.SEVERITY_ERROR; } public MavenProblemInfo(MavenProject mavenProject, LifecycleMappingConfigurationException error) { - MarkerLocation errorLocation = error.getLocation(); + SourceLocation errorLocation = error.getLocation(); if(errorLocation != null) { if(mavenProject.getFile().getAbsolutePath().equals(errorLocation.getResourcePath())) { - this.location = new MarkerLocation(errorLocation.getLineNumber(), errorLocation.getColumnStart(), + this.location = new SourceLocation(errorLocation.getLineNumber(), errorLocation.getColumnStart(), errorLocation.getColumnEnd()); } else { - this.location = new MarkerLocation(1, 1, 1, errorLocation); + this.location = new SourceLocation(1, 1, 1, errorLocation); } } else { - this.location = new MarkerLocation(1, 0, 0); + this.location = new SourceLocation(1, 0, 0); } this.message = error.getMessage(); this.severity = IMarker.SEVERITY_ERROR; @@ -51,16 +51,16 @@ public class MavenProblemInfo { public MavenProblemInfo(int line, String message) { //TODO - this.location = new MarkerLocation(line, 0, 0); + this.location = new SourceLocation(line, 0, 0); this.message = message; this.severity = IMarker.SEVERITY_ERROR; } - public MavenProblemInfo(String message, MarkerLocation location) { + public MavenProblemInfo(String message, SourceLocation location) { this(message, IMarker.SEVERITY_ERROR, location); } - public MavenProblemInfo(String message, int severity, MarkerLocation location) { + public MavenProblemInfo(String message, int severity, SourceLocation location) { if(location == null) { throw new IllegalArgumentException("MarkerLocation.location cannot be null"); //$NON-NLS-1$ } @@ -81,11 +81,11 @@ public class MavenProblemInfo { marker.setAttribute(IMarker.LINE_NUMBER, location.getLineNumber()); marker.setAttribute(IMavenConstants.MARKER_COLUMN_START, location.getColumnStart()); marker.setAttribute(IMavenConstants.MARKER_COLUMN_END, location.getColumnEnd()); - if(location.getCauseLocation() != null) { - marker.setAttribute(IMavenConstants.MARKER_CAUSE_RESOURCE_PATH, location.getCauseLocation().getResourcePath()); - marker.setAttribute(IMavenConstants.MARKER_CAUSE_LINE_NUMBER, location.getCauseLocation().getLineNumber()); - marker.setAttribute(IMavenConstants.MARKER_CAUSE_COLUMN_START, location.getCauseLocation().getColumnStart()); - marker.setAttribute(IMavenConstants.MARKER_CAUSE_COLUMN_END, location.getCauseLocation().getColumnEnd()); + if(location.getLinkedLocation() != null) { + marker.setAttribute(IMavenConstants.MARKER_CAUSE_RESOURCE_PATH, location.getLinkedLocation().getResourcePath()); + marker.setAttribute(IMavenConstants.MARKER_CAUSE_LINE_NUMBER, location.getLinkedLocation().getLineNumber()); + marker.setAttribute(IMavenConstants.MARKER_CAUSE_COLUMN_START, location.getLinkedLocation().getColumnStart()); + marker.setAttribute(IMavenConstants.MARKER_CAUSE_COLUMN_END, location.getLinkedLocation().getColumnEnd()); } } @@ -93,7 +93,7 @@ public class MavenProblemInfo { return message; } - public MarkerLocation getLocation() { + public SourceLocation getLocation() { return location; } } diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/markers/SourceLocation.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/markers/SourceLocation.java index e5834be2..66b31ff4 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/markers/SourceLocation.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/markers/SourceLocation.java @@ -10,42 +10,42 @@ *******************************************************************************/ package org.eclipse.m2e.core.internal.markers; -public class MarkerLocation { +public class SourceLocation { /** - * Must be null if the location applies to the resource that owns the marker. + * Absolute path of the resource to which this location applies. Can be null. */ private final String resourcePath; /** - * Line number marker attribute. This attribute is 1-relative. + * This attribute is 1-relative. */ private final int lineNumber; /** - * Column start marker attribute. This attribute is 1-relative and inclusive. + * This attribute is 1-relative and inclusive. */ private final int columnStart; /** - * Column end marker attribute. This attribute is 1-relative and inclusive. + * This attribute is 1-relative and inclusive. */ private final int columnEnd; /** - * The location of the cause for this marker. Can be null. + * A location linked to this location. Can be null. */ - private MarkerLocation causeLocation; + private SourceLocation linkedLocation; - public MarkerLocation(int lineNumber, int columnStart, int columnEnd) { + public SourceLocation(int lineNumber, int columnStart, int columnEnd) { this(null /*resourcePath*/, lineNumber, columnStart, columnEnd); } - public MarkerLocation(int lineNumber, int columnStart, int columnEnd, MarkerLocation causeLocation) { + public SourceLocation(int lineNumber, int columnStart, int columnEnd, SourceLocation linkedLocation) { this(null /*resourcePath*/, lineNumber, columnStart, columnEnd); - this.causeLocation = causeLocation; + this.linkedLocation = linkedLocation; } - public MarkerLocation(String resourcePath, int lineNumber, int columnStart, int columnEnd) { + public SourceLocation(String resourcePath, int lineNumber, int columnStart, int columnEnd) { this.resourcePath = resourcePath; this.lineNumber = lineNumber; this.columnStart = columnStart; @@ -68,11 +68,7 @@ public class MarkerLocation { return columnEnd; } - public MarkerLocation getCauseLocation() { - return causeLocation; + public SourceLocation getLinkedLocation() { + return linkedLocation; } -// -// public void setCauseLocation(MarkerLocation causeLocation) { -// this.causeLocation = causeLocation; -// } } diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/markers/SourceLocationHelper.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/markers/SourceLocationHelper.java index 92a87e04..e7acc46b 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/markers/SourceLocationHelper.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/markers/SourceLocationHelper.java @@ -19,7 +19,7 @@ import org.apache.maven.project.MavenProject; import org.eclipse.m2e.core.project.configurator.MojoExecutionKey; -public class MarkerLocationHelper { +public class SourceLocationHelper { private static final String SELF = ""; //$NON-NLS-1$ private static final String PROJECT = "project"; //$NON-NLS-1$ @@ -38,31 +38,31 @@ public class MarkerLocationHelper { private static final int COLUMN_END_OFFSET = 1; - public static MarkerLocation findPackagingLocation(MavenProject mavenProject) { + public static SourceLocation findPackagingLocation(MavenProject mavenProject) { InputLocation inputLocation = mavenProject.getModel().getLocation(PACKAGING); if(inputLocation != null) { - return new MarkerLocation(inputLocation.getLineNumber(), inputLocation.getColumnNumber() - PACKAGING.length() + return new SourceLocation(inputLocation.getLineNumber(), inputLocation.getColumnNumber() - PACKAGING.length() - COLUMN_START_OFFSET, inputLocation.getColumnNumber() - COLUMN_END_OFFSET); } inputLocation = mavenProject.getModel().getLocation(SELF); - return new MarkerLocation(inputLocation.getLineNumber(), inputLocation.getColumnNumber() - PROJECT.length() + return new SourceLocation(inputLocation.getLineNumber(), inputLocation.getColumnNumber() - PROJECT.length() - COLUMN_START_OFFSET, inputLocation.getColumnNumber() - COLUMN_END_OFFSET); } - public static MarkerLocation findLocation(Plugin plugin, String attribute) { + public static SourceLocation findLocation(Plugin plugin, String attribute) { InputLocation inputLocation = plugin.getLocation(attribute); if(inputLocation != null) { - return new MarkerLocation(inputLocation.getSource().getLocation(), inputLocation.getLineNumber(), + return new SourceLocation(inputLocation.getSource().getLocation(), inputLocation.getLineNumber(), inputLocation.getColumnNumber() - attribute.length() - COLUMN_START_OFFSET, inputLocation.getColumnNumber() - COLUMN_END_OFFSET); } inputLocation = plugin.getLocation(SELF); - return new MarkerLocation(inputLocation.getSource().getLocation(), inputLocation.getLineNumber(), + return new SourceLocation(inputLocation.getSource().getLocation(), inputLocation.getLineNumber(), inputLocation.getColumnNumber() - PLUGIN.length() - COLUMN_START_OFFSET, inputLocation.getColumnNumber() - COLUMN_END_OFFSET); } - public static MarkerLocation findLocation(MavenProject mavenProject, MojoExecutionKey mojoExecutionKey) { + public static SourceLocation findLocation(MavenProject mavenProject, MojoExecutionKey mojoExecutionKey) { Plugin plugin = mavenProject.getPlugin(mojoExecutionKey.getGroupId() + ":" + mojoExecutionKey.getArtifactId()); // We need to look at groupid location because there's a bug in maven and the location is not set for inherited plugins @@ -73,11 +73,11 @@ public class MarkerLocationHelper { // Plugin is specified in the maven lifecycle definition, not explicit in current pom or parent pom inputLocation = mavenProject.getModel().getLocation(PACKAGING); if(inputLocation != null) { - return new MarkerLocation(inputLocation.getLineNumber(), inputLocation.getColumnNumber() - PACKAGING.length() + return new SourceLocation(inputLocation.getLineNumber(), inputLocation.getColumnNumber() - PACKAGING.length() - COLUMN_START_OFFSET, inputLocation.getColumnNumber() - COLUMN_END_OFFSET); } inputLocation = mavenProject.getModel().getLocation(SELF); - return new MarkerLocation(inputLocation.getLineNumber(), inputLocation.getColumnNumber() - PROJECT.length() + return new SourceLocation(inputLocation.getLineNumber(), inputLocation.getColumnNumber() - PROJECT.length() - COLUMN_START_OFFSET, inputLocation.getColumnNumber() - COLUMN_END_OFFSET); } @@ -87,16 +87,16 @@ public class MarkerLocationHelper { } if(pomFile.getAbsolutePath().equals(inputLocation.getSource().getLocation())) { // Plugin is specified in current pom - return new MarkerLocation(inputLocation.getLineNumber(), inputLocation.getColumnNumber() - PLUGIN.length() + return new SourceLocation(inputLocation.getLineNumber(), inputLocation.getColumnNumber() - PLUGIN.length() - COLUMN_START_OFFSET, inputLocation.getColumnNumber() - COLUMN_END_OFFSET); } // Plugin is specified in some parent pom - MarkerLocation causeLocation = new MarkerLocation(inputLocation.getSource().getLocation(), + SourceLocation causeLocation = new SourceLocation(inputLocation.getSource().getLocation(), inputLocation.getLineNumber(), inputLocation.getColumnNumber() - PLUGIN.length() - COLUMN_START_OFFSET, inputLocation.getColumnNumber() - COLUMN_END_OFFSET); inputLocation = mavenProject.getModel().getParent().getLocation(SELF); - return new MarkerLocation(inputLocation.getLineNumber(), inputLocation.getColumnNumber() - PARENT.length() + return new SourceLocation(inputLocation.getLineNumber(), inputLocation.getColumnNumber() - PARENT.length() - COLUMN_START_OFFSET, inputLocation.getColumnNumber() - COLUMN_END_OFFSET, causeLocation); } } diff --git a/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/WorkspaceHelpers.java b/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/WorkspaceHelpers.java index 3f8fe946..ebd25c27 100644 --- a/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/WorkspaceHelpers.java +++ b/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/WorkspaceHelpers.java @@ -38,7 +38,7 @@ import org.eclipse.core.runtime.Status; import org.codehaus.plexus.util.FileUtils; import org.eclipse.m2e.core.core.IMavenConstants; -import org.eclipse.m2e.core.internal.markers.MarkerLocation; +import org.eclipse.m2e.core.internal.markers.SourceLocation; import org.eclipse.m2e.core.project.configurator.MojoExecutionKey; @@ -309,14 +309,14 @@ public class WorkspaceHelpers { marker.getAttribute(IMavenConstants.MARKER_ATTR_LIFECYCLE_PHASE, null)); } - public static void assertMarkerLocation(MarkerLocation markerLocation, IMarker marker) throws CoreException { + public static void assertMarkerLocation(SourceLocation markerLocation, IMarker marker) throws CoreException { Assert.assertEquals("Wrong line number", markerLocation.getLineNumber(), marker.getAttribute(IMarker.LINE_NUMBER)); Assert.assertEquals("Wrong column start", markerLocation.getColumnStart(), marker.getAttribute(IMavenConstants.MARKER_COLUMN_START)); Assert.assertEquals("Wrong column end", markerLocation.getColumnEnd(), marker.getAttribute(IMavenConstants.MARKER_COLUMN_END)); - markerLocation = markerLocation.getCauseLocation(); + markerLocation = markerLocation.getLinkedLocation(); if(markerLocation == null) { return; } |