use of com.intellij.openapi.editor.RangeMarker in project intellij-community by JetBrains.
the class TemplateSegments method addSegment.
public void addSegment(int start, int end) {
RangeMarker rangeMarker = myEditor.getDocument().createRangeMarker(start, end);
mySegments.add(rangeMarker);
}
use of com.intellij.openapi.editor.RangeMarker in project intellij-community by JetBrains.
the class TemplateSegments method lockSegmentAtTheSameOffsetIfAny.
/**
* IDEADEV-13618
*
* prevent two different segments to grow simultaneously if they both starts at the same offset.
*/
public void lockSegmentAtTheSameOffsetIfAny(final int number) {
if (number == -1) {
return;
}
final RangeMarker current = mySegments.get(number);
int offset = current.getStartOffset();
for (int i = 0; i < mySegments.size(); i++) {
if (i != number) {
final RangeMarker segment = mySegments.get(i);
final int startOffset2 = segment.getStartOffset();
if (offset == startOffset2) {
segment.setGreedyToLeft(false);
}
}
}
}
use of com.intellij.openapi.editor.RangeMarker in project intellij-community by JetBrains.
the class TemplateSegments method setSegmentsGreedy.
public void setSegmentsGreedy(boolean greedy) {
for (final RangeMarker segment : mySegments) {
segment.setGreedyToRight(greedy);
segment.setGreedyToLeft(greedy);
}
}
use of com.intellij.openapi.editor.RangeMarker in project intellij-community by JetBrains.
the class TemplateSegments method replaceSegmentAt.
public void replaceSegmentAt(int index, int start, int end, boolean preserveGreediness) {
RangeMarker rangeMarker = mySegments.get(index);
boolean greedyToLeft = rangeMarker.isGreedyToLeft();
boolean greedyToRight = rangeMarker.isGreedyToRight();
rangeMarker.dispose();
Document doc = myEditor.getDocument();
rangeMarker = doc.createRangeMarker(start, end);
rangeMarker.setGreedyToLeft(greedyToLeft || !preserveGreediness);
rangeMarker.setGreedyToRight(greedyToRight || !preserveGreediness);
mySegments.set(index, rangeMarker);
}
use of com.intellij.openapi.editor.RangeMarker in project intellij-community by JetBrains.
the class TemplateBuilderImpl method replaceElement.
public void replaceElement(TextRange rangeWithinElement, String varName, String dependantVariableName, boolean alwaysStopAt) {
final RangeMarker key = myDocument.createRangeMarker(rangeWithinElement.shiftRight(myContainerElement.getStartOffset()));
myAlwaysStopAtMap.put(key, alwaysStopAt ? Boolean.TRUE : Boolean.FALSE);
myVariableNamesMap.put(key, varName);
myVariableExpressions.put(key, dependantVariableName);
myElements.add(key);
}
Aggregations