mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
location should support placing markers on any resource not only file
This commit is contained in:
parent
fdeec42574
commit
7b9acc4aae
3 changed files with 70 additions and 3 deletions
17
codan/org.eclipse.cdt.codan.core/.settings/.api_filters
Normal file
17
codan/org.eclipse.cdt.codan.core/.settings/.api_filters
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<component id="org.eclipse.cdt.codan.core" version="2">
|
||||
<resource path="src/org/eclipse/cdt/codan/core/model/AbstractProblemLocation.java" type="org.eclipse.cdt.codan.core.model.AbstractProblemLocation">
|
||||
<filter comment="getFile method should return IResource not IFile according to interface. Don't know how it compiled before like that..." id="338792546">
|
||||
<message_arguments>
|
||||
<message_argument value="org.eclipse.cdt.codan.core.model.AbstractProblemLocation"/>
|
||||
<message_argument value="getFile()"/>
|
||||
</message_arguments>
|
||||
</filter>
|
||||
<filter comment="upgrade file attribute to IResource from IFile - it is backward compatible" id="388161617">
|
||||
<message_arguments>
|
||||
<message_argument value="org.eclipse.cdt.codan.core.model.AbstractProblemLocation"/>
|
||||
<message_argument value="file"/>
|
||||
</message_arguments>
|
||||
</filter>
|
||||
</resource>
|
||||
</component>
|
|
@ -11,6 +11,7 @@
|
|||
package org.eclipse.cdt.codan.core.model;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
||||
/**
|
||||
* Abstract Implementation of IProblemLocation
|
||||
|
@ -23,13 +24,20 @@ import org.eclipse.core.resources.IFile;
|
|||
* </p>
|
||||
*/
|
||||
public abstract class AbstractProblemLocation implements IProblemLocation {
|
||||
protected IFile file;
|
||||
protected IResource file;
|
||||
protected int line;
|
||||
protected int posStart;
|
||||
protected int posEnd;
|
||||
protected Object extra;
|
||||
|
||||
protected AbstractProblemLocation(IFile file, int line) {
|
||||
this((IResource) file, line);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
protected AbstractProblemLocation(IResource file, int line) {
|
||||
this.file = file;
|
||||
this.line = line;
|
||||
this.posStart = -1;
|
||||
|
@ -37,6 +45,13 @@ public abstract class AbstractProblemLocation implements IProblemLocation {
|
|||
}
|
||||
|
||||
protected AbstractProblemLocation(IFile file, int startChar, int endChar) {
|
||||
this((IResource) file, startChar, endChar);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
protected AbstractProblemLocation(IResource file, int startChar, int endChar) {
|
||||
this.file = file;
|
||||
this.line = -1;
|
||||
this.posStart = startChar;
|
||||
|
@ -66,7 +81,15 @@ public abstract class AbstractProblemLocation implements IProblemLocation {
|
|||
*
|
||||
* @see org.eclipse.cdt.codan.core.model.IProblemLocation#getFile()
|
||||
*/
|
||||
public IFile getFile() {
|
||||
public IResource getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return resource for which marker is created
|
||||
* @since 1.1
|
||||
*/
|
||||
public IResource getResource() {
|
||||
return file;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,22 +12,49 @@ package org.eclipse.cdt.codan.internal.core.model;
|
|||
|
||||
import org.eclipse.cdt.codan.core.model.AbstractProblemLocation;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
||||
/**
|
||||
* Codan Problem Location, so far same as abstract class
|
||||
*
|
||||
*/
|
||||
public class CodanProblemLocation extends AbstractProblemLocation {
|
||||
/**
|
||||
* @param file - resource
|
||||
* @param startChar - start chart, absolute file offset starts with 0
|
||||
* @param endChar - end char, absolute file offset, exclusive
|
||||
* @param line - line number
|
||||
*/
|
||||
public CodanProblemLocation(IResource file, int startChar, int endChar,
|
||||
int line) {
|
||||
super(file, startChar, endChar);
|
||||
this.line = line;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #CodanProblemLocation(IResource, int, int, int)}
|
||||
* otherwise no line number will be shown
|
||||
* @param file
|
||||
* @param startChar
|
||||
* @param endChar
|
||||
*/
|
||||
@Deprecated
|
||||
public CodanProblemLocation(IFile file, int startChar, int endChar) {
|
||||
super(file, startChar, endChar);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param file - resource
|
||||
* @param startChar - start chart, absolute file offset starts with 0
|
||||
* @param endChar - end char, absolute file offset, exclusive
|
||||
* @param line - line number
|
||||
*/
|
||||
public CodanProblemLocation(IFile file, int startChar, int endChar, int line) {
|
||||
super(file, startChar, endChar);
|
||||
this.line = line;
|
||||
}
|
||||
|
||||
protected CodanProblemLocation(IFile file, int line) {
|
||||
protected CodanProblemLocation(IResource file, int line) {
|
||||
super(file, line);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue