Java源码示例:org.eclipse.xtext.util.ITextRegionWithLineInformation
示例1
@Override
protected IssueLocation getLocationForNode(INode node) {
ITextRegionWithLineInformation nodeRegion = node.getTextRegionWithLineInformation();
N4JSIssueLocation result = new N4JSIssueLocation();
result.offset = nodeRegion.getOffset();
result.length = nodeRegion.getLength();
LineAndColumn lineAndColumnStart = NodeModelUtils.getLineAndColumn(node, result.offset);
result.lineNumber = lineAndColumnStart.getLine();
result.column = lineAndColumnStart.getColumn();
LineAndColumn lineAndColumnEnd = NodeModelUtils.getLineAndColumn(node, result.offset + result.length);
result.lineNumberEnd = lineAndColumnEnd.getLine();
result.columnEnd = lineAndColumnEnd.getColumn();
return result;
}
示例2
protected boolean isValidLineForBreakpoint(ICompositeNode node, int line) {
for (INode n : node.getChildren()) {
ITextRegionWithLineInformation textRegion = n.getTextRegionWithLineInformation();
if (textRegion.getLineNumber()<= line && textRegion.getEndLineNumber() >= line) {
EObject eObject = n.getSemanticElement();
if (eObject instanceof XExpression && !(eObject.eClass() == XbasePackage.Literals.XBLOCK_EXPRESSION)) {
return true;
}
if (n instanceof ICompositeNode && isValidLineForBreakpoint((ICompositeNode) n, line)) {
return true;
}
}
if (textRegion.getLineNumber() > line) {
return false;
}
}
return false;
}
示例3
protected boolean isMultiline(final XExpression expression, final FormattableDocument doc) {
final INode node = this._nodeModelAccess.nodeForEObject(expression);
boolean _and = false;
if (!(node != null)) {
_and = false;
} else {
boolean _xblockexpression = false;
{
final ITextRegionWithLineInformation textRegion = node.getTextRegionWithLineInformation();
int _lineNumber = textRegion.getLineNumber();
int _endLineNumber = textRegion.getEndLineNumber();
_xblockexpression = (_lineNumber != _endLineNumber);
}
_and = _xblockexpression;
}
return _and;
}
示例4
@Test
public void testNoRedundantRegions() {
ITextRegionWithLineInformation redundant = new TextRegionWithLineInformation(47, 11, 12, 137);
ITextRegionWithLineInformation second = new TextRegionWithLineInformation(8, 15, 12, 137);
expectedRegions = Arrays.asList(redundant, redundant, second).iterator();
TreeAppendable appendable = new TreeAppendable(new ImportManager(false), this, this, this, content, " ", "\n");
appendable.append("initial");
appendable.trace(content).append("first");
appendable.trace(content).append("second");
assertEquals("initialfirstsecond", appendable.getContent());
AbstractTraceRegion traceRegion = appendable.getTraceRegion();
assertNotNull(traceRegion);
assertEquals(47, traceRegion.getMergedAssociatedLocation().getOffset());
assertEquals(11, traceRegion.getMergedAssociatedLocation().getLength());
assertEquals(0, traceRegion.getMyOffset());
assertEquals("initialfirstsecond".length(), traceRegion.getMyLength());
List<AbstractTraceRegion> nestedRegions = traceRegion.getNestedRegions();
assertEquals(1, nestedRegions.size());
AbstractTraceRegion child = nestedRegions.get(0);
assertEquals(8, child.getMergedAssociatedLocation().getOffset());
assertEquals(15, child.getMergedAssociatedLocation().getLength());
assertEquals("initialfirst".length(), child.getMyOffset());
assertEquals("second".length(), child.getMyLength());
}
示例5
@Test
public void testInsertionIsProhibited() {
ITextRegionWithLineInformation root = new TextRegionWithLineInformation(47, 11, 12, 137);
ITextRegionWithLineInformation child = new TextRegionWithLineInformation(8, 15, 12, 137);
expectedRegions = Arrays.asList(root, child).iterator();
TreeAppendable appendable = new TreeAppendable(new ImportManager(false), this, this, this, content, " ", "\n");
TreeAppendable traced = appendable.trace(content);
appendable.append("test");
// don't use @Test(expected=..) since we want to be sure about the cause
try {
traced.append("insertion");
fail("Expected IllegalStateException");
} catch(IllegalStateException e) {
// expected
}
}
示例6
@Override
protected void computeObjectFolding(EObject eObject,
IFoldingRegionAcceptor<ITextRegion> foldingRegionAcceptor) {
ILocationInFileProvider locationInFileProvider = getLocationInFileProvider();
ITextRegion region = locationInFileProvider.getFullTextRegion(eObject);
ITextRegionWithLineInformation regionWithLineInformation = (ITextRegionWithLineInformation) region;
if (region != null) {
ITextRegion significant = locationInFileProvider
.getSignificantTextRegion(eObject);
if (significant == null)
throw new NullPointerException(
"significant region may not be null"); //$NON-NLS-1$
if (!isAlreadyAccepted(regionWithLineInformation)) {
foldingRegionAcceptor.accept(region.getOffset(),
region.getLength(), significant);
acceptedRegions.add(regionWithLineInformation);
}
}
}
示例7
/**
* @since 2.3
*/
protected ITextRegion createRegion(List<INode> nodes, RegionDescription query) {
if (query == RegionDescription.FULL || query == RegionDescription.SIGNIFICANT)
return createRegion(nodes);
ITextRegion result = ITextRegion.EMPTY_REGION;
for (INode node : nodes) {
for(INode leafNode: node.getLeafNodes()) {
if (!isHidden(leafNode, query)) {
ITextRegionWithLineInformation region = leafNode.getTextRegionWithLineInformation();
if (region.getLength() != 0) {
result = result.merge(toZeroBasedRegion(region));
}
}
}
}
return result;
}
示例8
@Test public void testBug353969_01() throws Exception {
Processor p = (Processor) model.getComponents().get(0);
EList<Mode> modes = p.getMode();
assertEquals(2, modes.size());
Mode m1 = modes.get(0);
ITextRegionWithLineInformation m1FullRegion = (ITextRegionWithLineInformation) locationInFileProvider.getFullTextRegion(m1);
assertEquals(modelAsString.indexOf("mode m1;"), m1FullRegion.getOffset());
assertEquals("mode m1;".length(), m1FullRegion.getLength());
assertEquals(3, m1FullRegion.getLineNumber());
assertEquals(3, m1FullRegion.getEndLineNumber());
ITextRegionWithLineInformation m1SignificantRegion = (ITextRegionWithLineInformation) locationInFileProvider.getSignificantTextRegion(m1);
assertEquals(modelAsString.indexOf("m1;"), m1SignificantRegion.getOffset());
assertEquals("m1".length(), m1SignificantRegion.getLength());
assertEquals(3, m1SignificantRegion.getLineNumber());
assertEquals(3, m1SignificantRegion.getEndLineNumber());
}
示例9
@Test public void testBug353969_02() throws Exception {
Processor p = (Processor) model.getComponents().get(0);
EList<Mode> modes = p.getMode();
assertEquals(2, modes.size());
Mode m2 = modes.get(1);
ITextRegionWithLineInformation m2FullRegion = (ITextRegionWithLineInformation) locationInFileProvider.getFullTextRegion(m2);
assertEquals(modelAsString.indexOf("mode m2;"), m2FullRegion.getOffset());
assertEquals("mode m2;".length(), m2FullRegion.getLength());
assertEquals(4, m2FullRegion.getLineNumber());
assertEquals(4, m2FullRegion.getEndLineNumber());
ITextRegionWithLineInformation m2SignificantRegion = (ITextRegionWithLineInformation) locationInFileProvider.getSignificantTextRegion(m2);
assertEquals(modelAsString.indexOf("m2;"), m2SignificantRegion.getOffset());
assertEquals("m2".length(), m2SignificantRegion.getLength());
assertEquals(4, m2SignificantRegion.getLineNumber());
assertEquals(4, m2SignificantRegion.getEndLineNumber());
}
示例10
@Test public void testBug353969_03() throws Exception {
Bus b = (Bus) model.getComponents().get(1);
EList<Mode> modes = b.getMode();
assertEquals(2, modes.size());
Mode mb1 = modes.get(0);
ITextRegionWithLineInformation mb1FullRegion = (ITextRegionWithLineInformation) locationInFileProvider.getFullTextRegion(mb1);
assertEquals(modelAsString.indexOf("mode mb1;"), mb1FullRegion.getOffset());
assertEquals("mode mb1;".length(), mb1FullRegion.getLength());
assertEquals(8, mb1FullRegion.getLineNumber());
assertEquals(8, mb1FullRegion.getEndLineNumber());
ITextRegionWithLineInformation mb1SignificantRegion = (ITextRegionWithLineInformation) locationInFileProvider.getSignificantTextRegion(mb1);
assertEquals(modelAsString.indexOf("mb1;"), mb1SignificantRegion.getOffset());
assertEquals("mb1".length(), mb1SignificantRegion.getLength());
assertEquals(8, mb1SignificantRegion.getLineNumber());
assertEquals(8, mb1SignificantRegion.getEndLineNumber());
}
示例11
@Test public void testBug353969_04() throws Exception {
Bus b = (Bus) model.getComponents().get(1);
EList<Mode> modes = b.getMode();
assertEquals(2, modes.size());
Mode mb2 = modes.get(1);
ITextRegionWithLineInformation mb2FullRegion = (ITextRegionWithLineInformation) locationInFileProvider.getFullTextRegion(mb2);
assertEquals(modelAsString.indexOf("mode mb2;"), mb2FullRegion.getOffset());
assertEquals("mode mb2;".length(), mb2FullRegion.getLength());
assertEquals(9, mb2FullRegion.getLineNumber());
assertEquals(9, mb2FullRegion.getEndLineNumber());
ITextRegionWithLineInformation mb2SignificantRegion = (ITextRegionWithLineInformation) locationInFileProvider.getSignificantTextRegion(mb2);
assertEquals(modelAsString.indexOf("mb2;"), mb2SignificantRegion.getOffset());
assertEquals("mb2".length(), mb2SignificantRegion.getLength());
assertEquals(9, mb2SignificantRegion.getLineNumber());
assertEquals(9, mb2SignificantRegion.getEndLineNumber());
}
示例12
protected ITextRegionWithLineInformation toTextRegionWithLineInformation(EObject obj, ITextRegion textRegion) {
if (textRegion == null) {
return ITextRegionWithLineInformation.EMPTY_REGION;
}
if (textRegion instanceof ITextRegionWithLineInformation) {
return (ITextRegionWithLineInformation) textRegion;
}
ICompositeNode node = NodeModelUtils.getNode(obj);
if (node == null) {
return new TextRegionWithLineInformation(textRegion.getOffset(), textRegion.getLength(), 0, 0);
}
int startLine = NodeModelUtils.getLineAndColumn(node, textRegion.getOffset()).getLine() - 1;
int endLine = NodeModelUtils.getLineAndColumn(node, textRegion.getOffset() + textRegion.getLength()).getLine()
- 1;
return new TextRegionWithLineInformation(textRegion.getOffset(), textRegion.getLength(), startLine, endLine);
}
示例13
protected ILocationData toLocationData(List<INode> nodes) {
ITextRegionWithLineInformation result = ITextRegionWithLineInformation.EMPTY_REGION;
for (INode node : nodes) {
if (!isHidden(node)) {
ITextRegionWithLineInformation region = node.getTextRegionWithLineInformation();
if (region.getLength() != 0) {
result = result.merge(new TextRegionWithLineInformation(region.getOffset(), region.getLength(), region.getLineNumber() - 1, region.getEndLineNumber() - 1));
}
}
}
if (result.getLength() == 0)
return null;
return new LocationData(result.getOffset(), result.getLength(), result.getLineNumber(),
result.getEndLineNumber(), null);
}
示例14
protected static ILocationData createLocationData(ITraceURIConverter converter, EObject object, ITextRegionWithLineInformation textRegion) {
Resource resource = object.eResource();
SourceRelativeURI uriForTrace = null;
if (converter != null) {
uriForTrace = converter.getURIForTrace(resource);
}
ILocationData newData = new LocationData(textRegion, uriForTrace);
return newData;
}
示例15
public ITreeAppendable traceSignificant(ITreeAppendable appendable, EObject source, boolean useForDebugging) {
if (appendable instanceof TreeAppendable) {
return ((TreeAppendable) appendable).trace(source,
ILocationInFileProviderExtension.RegionDescription.SIGNIFICANT, useForDebugging);
} else {
ITextRegionWithLineInformation it = (ITextRegionWithLineInformation) locationProvider
.getSignificantTextRegion(source);
if (it != null && it != ITextRegion.EMPTY_REGION) {
return appendable.trace(new LocationData(it.getOffset(), it.getLength(), it.getLineNumber(),
it.getEndLineNumber(), null), useForDebugging);
} else {
return appendable;
}
}
}
示例16
protected ITreeAppendable generateDocumentation(final String text, final List<INode> documentationNodes, final ITreeAppendable appendable, final GeneratorConfig config) {
ITreeAppendable _xblockexpression = null;
{
StringConcatenation _builder = new StringConcatenation();
_builder.append("/**");
final StringConcatenation doc = ((StringConcatenation) _builder);
doc.newLine();
doc.append(" * ");
doc.append(text, " * ");
doc.newLine();
doc.append(" */");
ITreeAppendable _xifexpression = null;
boolean _isEmpty = documentationNodes.isEmpty();
boolean _not = (!_isEmpty);
if (_not) {
ITreeAppendable _xblockexpression_1 = null;
{
ITextRegionWithLineInformation documentationTrace = ITextRegionWithLineInformation.EMPTY_REGION;
for (final INode node : documentationNodes) {
documentationTrace = documentationTrace.merge(node.getTextRegionWithLineInformation());
}
LocationData _locationData = new LocationData(documentationTrace, null);
appendable.trace(_locationData).append(doc.toString());
_xblockexpression_1 = appendable.newLine();
}
_xifexpression = _xblockexpression_1;
} else {
_xifexpression = appendable.append(doc.toString()).newLine();
}
_xblockexpression = _xifexpression;
}
return _xblockexpression;
}
示例17
@Test
public void testEmpty() {
expectedRegions = Collections.<ITextRegionWithLineInformation>singleton(new TextRegionWithLineInformation(47, 11, 12, 137)).iterator();
TreeAppendable appendable = new TreeAppendable(new ImportManager(false), this, this, this, content, " ", "\n");
assertEquals("", appendable.getContent());
AbstractTraceRegion traceRegion = appendable.getTraceRegion();
assertNotNull(traceRegion);
assertEquals(47, traceRegion.getMergedAssociatedLocation().getOffset());
assertEquals(11, traceRegion.getMergedAssociatedLocation().getLength());
assertEquals(getURIForTrace(resource), traceRegion.getAssociatedSrcRelativePath());
assertTrue(traceRegion.getNestedRegions().isEmpty());
}
示例18
@Test
public void testNoEmptyLeafs() {
ITextRegionWithLineInformation root = new TextRegionWithLineInformation(47, 11, 12, 137);
ITextRegionWithLineInformation emptyChild = new TextRegionWithLineInformation(8, 15, 12, 137);
ITextRegionWithLineInformation emptyGrandChild = new TextRegionWithLineInformation(123, 321, 12, 137);
expectedRegions = Arrays.asList(root, emptyChild, emptyGrandChild).iterator();
TreeAppendable appendable = new TreeAppendable(new ImportManager(false), this, this, this, content, " ", "\n");
appendable.append("initial");
appendable.trace(content).trace(content);
appendable.append("end");
assertEquals("initialend", appendable.getContent());
AbstractTraceRegion traceRegion = appendable.getTraceRegion();
assertTrue(traceRegion.getNestedRegions().isEmpty());
}
示例19
@Test
public void testUnsafeInsertionIsOk() {
ITextRegionWithLineInformation root = new TextRegionWithLineInformation(47, 11, 12, 137);
ITextRegionWithLineInformation child = new TextRegionWithLineInformation(8, 15, 12, 137);
expectedRegions = Arrays.asList(root, child).iterator();
TreeAppendable appendable = new TreeAppendable(new ImportManager(false), this, this, this, content, " ", "\n");
TreeAppendable traced = appendable.trace(content);
appendable.append("test");
traced.appendUnsafe("insertion");
assertEquals("insertiontest", appendable.getContent());
}
示例20
@Test
public void testLineNumbers() {
expectedRegions = new AbstractIterator<ITextRegionWithLineInformation>() {
int start = 0;
@Override
protected ITextRegionWithLineInformation computeNext() {
return new TextRegionWithLineInformation(start++, 1, 1, 1);
}
};
TreeAppendable appendable = new TreeAppendable(new ImportManager(false), this, this, this, content, " ", "\n");
appendable.append("start line").increaseIndentation();
appendable.newLine().trace(content).append("1");
appendable.trace(content).newLine().append("2");
appendable.newLine().trace(content).append("3\n4");
appendable.decreaseIndentation().newLine().append("last line");
assertEquals(
"start line\n" +
" 1\n" +
" 2\n" +
" 3\n" +
" 4\n" +
"last line", appendable.getContent());
AbstractTraceRegion rootTraceRegion = appendable.getTraceRegion();
assertEquals(0, rootTraceRegion.getMyLineNumber());
assertEquals(5, rootTraceRegion.getMyEndLineNumber());
AbstractTraceRegion firstChild = rootTraceRegion.getNestedRegions().get(0);
assertEquals(1, firstChild.getMyLineNumber());
assertEquals(1, firstChild.getMyEndLineNumber());
AbstractTraceRegion secondChild = rootTraceRegion.getNestedRegions().get(1);
assertEquals(2, secondChild.getMyLineNumber());
assertEquals(2, secondChild.getMyEndLineNumber());
AbstractTraceRegion thirdChild = rootTraceRegion.getNestedRegions().get(2);
assertEquals(3, thirdChild.getMyLineNumber());
assertEquals(4, thirdChild.getMyEndLineNumber());
expectedRegions = null;
}
示例21
@Test
public void testNewlineIndents() {
expectedRegions = Collections.<ITextRegionWithLineInformation>singleton(ITextRegionWithLineInformation.EMPTY_REGION).iterator();
TreeAppendable appendable = new TreeAppendable(new ImportManager(false), this, this, this, content, "aa", "bb");
assertEquals("bb", appendable.newLine().getContent());
appendable.increaseIndentation();
assertEquals("bbbbaa", appendable.newLine().getContent());
appendable.decreaseIndentation();
assertEquals("bbbbaabb", appendable.newLine().getContent());
}
示例22
@Test
public void testAppendedTextIsIndented() {
expectedRegions = Collections.<ITextRegionWithLineInformation>singleton(ITextRegionWithLineInformation.EMPTY_REGION).iterator();
TreeAppendable appendable = new TreeAppendable(new ImportManager(false), this, this, this, content, "aa", "bb");
appendable.increaseIndentation();
appendable.append("my \n text \r more \r\n end");
assertEquals("my bbaa text bbaa more bbaa end", appendable.getContent());
}
示例23
/**
* Find occurrences of the element at the given offset.
*/
public OccurrencesResult findOccurrences(XtextWebDocumentAccess document, int offset) {
return document.readOnly(new CancelableUnitOfWork<OccurrencesResult, IXtextWebDocument>() {
@Override
public OccurrencesResult exec(IXtextWebDocument doc, CancelIndicator cancelIndicator) throws Exception {
EObject element = elementAtOffsetUtil.getElementAt(doc.getResource(), offset);
OccurrencesResult occurrencesResult = new OccurrencesResult(doc.getStateId());
if (element != null && filter(element)) {
URI elementURI = EcoreUtil2.getPlatformResourceOrNormalizedURI(element);
TargetURIs targetURIs = targetURIsProvider.get();
targetURIs.addURI(elementURI);
IReferenceFinder.Acceptor acceptor = new IReferenceFinder.Acceptor() {
@Override
public void accept(EObject source, URI sourceURI, EReference eReference, int index,
EObject targetOrProxy, URI targetURI) {
ITextRegion region = locationInFileProvider.getSignificantTextRegion(source, eReference,
index);
occurrencesResult.getReadRegions()
.add(new TextRegion(region.getOffset(), region.getLength()));
}
@Override
public void accept(IReferenceDescription description) {
}
};
referenceFinder.findReferences(targetURIs, doc.getResource(), acceptor,
new CancelIndicatorProgressMonitor(cancelIndicator));
if (Objects.equal(element.eResource(), doc.getResource())) {
ITextRegion definitionRegion = locationInFileProvider.getSignificantTextRegion(element);
if (definitionRegion != null
&& definitionRegion != ITextRegionWithLineInformation.EMPTY_REGION) {
occurrencesResult.getWriteRegions()
.add(new TextRegion(definitionRegion.getOffset(), definitionRegion.getLength()));
}
}
}
return occurrencesResult;
}
});
}
示例24
@Override
public ITextRegionWithLineInformation getTextRegion(EObject owner, EStructuralFeature feature, int indexInList) {
Assignment assignment = GrammarUtil.containingAssignment(owner);
if (assignment != null) {
return getTextRegion(assignment);
}
return super.getTextRegion(owner, feature, indexInList);
}
示例25
@Override
public ITextRegionWithLineInformation getTextRegion(EObject owner, EStructuralFeature feature, int indexInList) {
Property property = EcoreUtil2.getContainerOfType(owner, Property.class);
if (property != null) {
ITextRegion textRegion = locationInFileProvider.getFullTextRegion(property);
return toTextRegionWithLineInformation(property, textRegion);
}
return super.getTextRegion(owner, feature, indexInList);
}
示例26
@Override
public ITextRegionWithLineInformation getTextRegion(EObject owner, EStructuralFeature feature,
int indexInList) {
if (owner instanceof FunctionCall) {
ITextRegion textRegion = this.locationInFileProvider.getFullTextRegion(owner);
return toTextRegionWithLineInformation(owner, textRegion);
}
return super.getTextRegion(owner, feature, indexInList);
}
示例27
protected String getRegionLabel() {
if (region instanceof ITextRegionWithLineInformation) {
ITextRegionWithLineInformation lines = ((ITextRegionWithLineInformation) region);
if (lines.getLineNumber() == lines.getEndLineNumber())
return String.format("line %d", lines.getLineNumber());
return String.format("lines %d-%d", lines.getLineNumber(), lines.getEndLineNumber());
} else if (region != null) {
return String.format("offset %d, lenght %d", region.getOffset(), region.getLength());
}
return "";
}
示例28
private int getJavaLineNumber(final IJavaStratumLineBreakpoint breakpoint) throws CoreException {
ILocationInEclipseResource javaLocation = getJavaLocation(breakpoint);
if (javaLocation == null)
return -1;
IStorage storage = javaLocation.getPlatformResource();
if (storage == null) {
ITextRegionWithLineInformation textRegion = javaLocation.getTextRegion();
if (textRegion == null)
return -1;
return textRegion.getEndLineNumber();
} else {
AbstractEclipseTrace sourceTrace = (AbstractEclipseTrace) traceForStorageProvider.getTraceToSource(storage);
if (sourceTrace == null)
return -1;
AbstractTraceRegion rootTraceRegion = sourceTrace.getRootTraceRegion();
if (rootTraceRegion == null)
return -1;
List<LineMapping> lineMappings = lineMappingProvider.getLineMapping(rootTraceRegion);
if (lineMappings == null) {
return -1;
}
for (LineMapping lineMapping : lineMappings) {
if (lineMapping.sourceStartLine == breakpoint.getLineNumber()) {
return lineMapping.targetEndLine + 1;
}
}
return -1;
}
}
示例29
private void copyProblemMarker(IFile javaFile, IEclipseTrace traceToSource, Set<IMarker> problemsInJava, IFile srcFile)
throws CoreException {
String sourceMarkerType = null;
for (IMarker marker : problemsInJava) {
String message = (String) marker.getAttribute(IMarker.MESSAGE);
if (message == null) {
continue;
}
Integer charStart = marker.getAttribute(IMarker.CHAR_START, 0);
Integer charEnd = marker.getAttribute(IMarker.CHAR_END, 0);
int severity = MarkerUtilities.getSeverity(marker);
ILocationInEclipseResource associatedLocation = traceToSource.getBestAssociatedLocation(new TextRegion(charStart,
charEnd - charStart));
if (associatedLocation != null) {
if (sourceMarkerType == null) {
sourceMarkerType = determinateMarkerTypeByURI(associatedLocation.getSrcRelativeResourceURI());
}
if (!srcFile.equals(findIFile(associatedLocation, srcFile.getWorkspace()))) {
LOG.error("File in associated location is not the same as main source file.");
}
IMarker xtendMarker = srcFile.createMarker(sourceMarkerType);
xtendMarker.setAttribute(IMarker.MESSAGE, "Java problem: " + message);
xtendMarker.setAttribute(IMarker.SEVERITY, severity);
ITextRegionWithLineInformation region = associatedLocation.getTextRegion();
xtendMarker.setAttribute(IMarker.LINE_NUMBER, region.getLineNumber());
xtendMarker.setAttribute(IMarker.CHAR_START, region.getOffset());
xtendMarker.setAttribute(IMarker.CHAR_END, region.getOffset() + region.getLength());
xtendMarker.setAttribute(COPIED_FROM_FILE, javaFile.getFullPath().toString());
}
}
}
示例30
private boolean isAlreadyAccepted(
ITextRegionWithLineInformation regionWithLineInformation) {
for (ITextRegionWithLineInformation acceptedRegion : acceptedRegions) {
if (equals(regionWithLineInformation, acceptedRegion)) {
return true;
}
}
return false;
}