本文整理匯總了Java中com.intellij.openapi.editor.impl.softwrap.SoftWrapImpl類的典型用法代碼示例。如果您正苦於以下問題:Java SoftWrapImpl類的具體用法?Java SoftWrapImpl怎麽用?Java SoftWrapImpl使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SoftWrapImpl類屬於com.intellij.openapi.editor.impl.softwrap包,在下文中一共展示了SoftWrapImpl類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: registerSoftWrap
import com.intellij.openapi.editor.impl.softwrap.SoftWrapImpl; //導入依賴的package包/類
@NotNull
private SoftWrapImpl registerSoftWrap(int offset, int spaceSize, LogicalLineData lineData) {
int indentInColumns = 0;
int indentInPixels = myPainter.getMinDrawingWidth(SoftWrapDrawingType.AFTER_SOFT_WRAP);
if (myCustomIndentUsedLastTime) {
indentInColumns = myCustomIndentValueUsedLastTime + lineData.indentInColumns;
indentInPixels += lineData.indentInPixels + (myCustomIndentValueUsedLastTime * spaceSize);
}
SoftWrapImpl result = new SoftWrapImpl(
new TextChangeImpl("\n" + StringUtil.repeatSymbol(' ', indentInColumns), offset, offset),
indentInColumns + 1/* for 'after soft wrap' drawing */,
indentInPixels
);
myStorage.storeOrReplace(result);
return result;
}
示例2: matchesOldSoftWrap
import com.intellij.openapi.editor.impl.softwrap.SoftWrapImpl; //導入依賴的package包/類
boolean matchesOldSoftWrap(SoftWrap newSoftWrap, int lengthDiff) {
return Collections.binarySearch(myAffectedByUpdateSoftWraps, new SoftWrapImpl(new TextChangeImpl(newSoftWrap.getText(),
newSoftWrap.getStart() - lengthDiff,
newSoftWrap.getEnd() - lengthDiff),
newSoftWrap.getIndentInColumns(),
newSoftWrap.getIndentInPixels()),
new Comparator<SoftWrapImpl>() {
@Override
public int compare(SoftWrapImpl o1, SoftWrapImpl o2) {
int offsetDiff = o1.getStart() - o2.getStart();
if (offsetDiff != 0) {
return offsetDiff;
}
int textDiff = o1.getText().toString().compareTo(o2.getText().toString());
if (textDiff != 0) {
return textDiff;
}
int colIndentDiff = o1.getIndentInColumns() - o2.getIndentInColumns();
if (colIndentDiff != 0) {
return colIndentDiff;
}
return o1.getIndentInPixels() - o2.getIndentInPixels();
}
}) >= 0;
}
示例3: advanceSoftWrapOffsets
import com.intellij.openapi.editor.impl.softwrap.SoftWrapImpl; //導入依賴的package包/類
/**
* Applies given offsets diff to all soft wraps that lay after the given offset
*
* @param offsetsDiff offset diff to apply to the target soft wraps
* @param offset offset to use for filtering soft wraps to advance. All soft wraps which offsets are strictly greater
* than the given one should be advanced
*/
private void advanceSoftWrapOffsets(int offsetsDiff, int offset) {
if (offsetsDiff == 0) {
return;
}
int softWrapIndex = myStorage.getSoftWrapIndex(offset);
if (softWrapIndex >= 0) {
softWrapIndex++; // We want to process only soft wraps which offsets are strictly more than the given one.
}
else {
softWrapIndex = -softWrapIndex - 1;
}
List<SoftWrapImpl> softWraps = myStorage.getSoftWraps();
for (int i = softWrapIndex; i < softWraps.size(); i++) {
softWraps.get(i).advance(offsetsDiff);
}
}
示例4: registerSoftWrap
import com.intellij.openapi.editor.impl.softwrap.SoftWrapImpl; //導入依賴的package包/類
@Nonnull
private SoftWrapImpl registerSoftWrap(int offset, int spaceSize, LogicalLineData lineData) {
assert !DocumentUtil.isInsideSurrogatePair(myEditor.getDocument(), offset);
int indentInColumns = 0;
int indentInPixels = myPainter.getMinDrawingWidth(SoftWrapDrawingType.AFTER_SOFT_WRAP);
if (myCustomIndentUsedLastTime) {
indentInColumns = myCustomIndentValueUsedLastTime + lineData.indentInColumns;
indentInPixels += lineData.indentInPixels + (myCustomIndentValueUsedLastTime * spaceSize);
}
SoftWrapImpl result = new SoftWrapImpl(
new TextChangeImpl("\n" + StringUtil.repeatSymbol(' ', indentInColumns), offset, offset),
indentInColumns + 1/* for 'after soft wrap' drawing */,
indentInPixels
);
myStorage.storeOrReplace(result);
return result;
}
示例5: matchesOldSoftWrap
import com.intellij.openapi.editor.impl.softwrap.SoftWrapImpl; //導入依賴的package包/類
boolean matchesOldSoftWrap(SoftWrap newSoftWrap, int lengthDiff) {
return Collections.binarySearch(myAffectedByUpdateSoftWraps, new SoftWrapImpl(new TextChangeImpl(newSoftWrap.getText(),
newSoftWrap.getStart() - lengthDiff,
newSoftWrap.getEnd() - lengthDiff),
newSoftWrap.getIndentInColumns(),
newSoftWrap.getIndentInPixels()),
(o1, o2) -> {
int offsetDiff = o1.getStart() - o2.getStart();
if (offsetDiff != 0) {
return offsetDiff;
}
int textDiff = o1.getText().toString().compareTo(o2.getText().toString());
if (textDiff != 0) {
return textDiff;
}
int colIndentDiff = o1.getIndentInColumns() - o2.getIndentInColumns();
if (colIndentDiff != 0) {
return colIndentDiff;
}
return o1.getIndentInPixels() - o2.getIndentInPixels();
}) >= 0;
}
示例6: checkIsDoneAfterSoftWrap
import com.intellij.openapi.editor.impl.softwrap.SoftWrapImpl; //導入依賴的package包/類
private boolean checkIsDoneAfterSoftWrap() {
SoftWrapImpl lastSoftWrap = myDataMapper.getLastSoftWrap();
LOG.assertTrue(lastSoftWrap != null);
if (myContext.currentPosition.offset > myContext.rangeEndOffset
&& myDataMapper.matchesOldSoftWrap(lastSoftWrap, myEventBeingProcessed.getLengthDiff())) {
myDataMapper.removeLastCacheEntry();
return true;
}
return false;
}
示例7: advanceSoftWrapOffsets
import com.intellij.openapi.editor.impl.softwrap.SoftWrapImpl; //導入依賴的package包/類
/**
* Determines which soft wraps were not affected by recalculation, and shifts them to their new offsets.
*
* @return Change in soft wraps count after recalculation
*/
private int advanceSoftWrapOffsets(@NotNull IncrementalCacheUpdateEvent event) {
int lengthDiff = event.getLengthDiff();
int recalcEndOffsetTranslated = event.getActualEndOffset() - lengthDiff;
int firstIndex = -1;
int softWrappedLinesDiff = myStorage.getNumberOfSoftWrapsInRange(event.getStartOffset() + 1, myEditor.getDocument().getTextLength());
boolean softWrapsChanged = softWrappedLinesDiff > 0;
for (int i = 0; i < myAffectedByUpdateSoftWraps.size(); i++) {
SoftWrap softWrap = myAffectedByUpdateSoftWraps.get(i);
if (firstIndex < 0) {
if (softWrap.getStart() > recalcEndOffsetTranslated) {
firstIndex = i;
if (lengthDiff == 0) {
break;
}
} else {
softWrappedLinesDiff--;
softWrapsChanged = true;
}
}
if (firstIndex >= 0 && i >= firstIndex) {
((SoftWrapImpl)softWrap).advance(lengthDiff);
}
}
if (firstIndex >= 0) {
List<SoftWrapImpl> updated = myAffectedByUpdateSoftWraps.subList(firstIndex, myAffectedByUpdateSoftWraps.size());
SoftWrapImpl lastSoftWrap = getLastSoftWrap();
if (lastSoftWrap != null && lastSoftWrap.getStart() >= updated.get(0).getStart()) {
LOG.error("Invalid soft wrap recalculation", new Attachment("state.txt", myEditor.getSoftWrapModel().toString()));
}
myStorage.addAll(updated);
}
myAffectedByUpdateSoftWraps.clear();
if (softWrapsChanged) {
myStorage.notifyListenersAboutChange();
}
return softWrappedLinesDiff;
}
示例8: advanceSoftWrapOffsets
import com.intellij.openapi.editor.impl.softwrap.SoftWrapImpl; //導入依賴的package包/類
/**
* Determines which soft wraps were not affected by recalculation, and shifts them to their new offsets.
*
* @return Change in soft wraps count after recalculation
*/
private void advanceSoftWrapOffsets(@Nonnull IncrementalCacheUpdateEvent event) {
int lengthDiff = event.getLengthDiff();
int recalcEndOffsetTranslated = event.getActualEndOffset() - lengthDiff;
int firstIndex = -1;
int softWrappedLinesDiff = myStorage.getNumberOfSoftWrapsInRange(event.getStartOffset() + 1, myEditor.getDocument().getTextLength());
boolean softWrapsChanged = softWrappedLinesDiff > 0;
for (int i = 0; i < myAffectedByUpdateSoftWraps.size(); i++) {
SoftWrap softWrap = myAffectedByUpdateSoftWraps.get(i);
if (firstIndex < 0) {
if (softWrap.getStart() > recalcEndOffsetTranslated) {
firstIndex = i;
if (lengthDiff == 0) {
break;
}
} else {
softWrappedLinesDiff--;
softWrapsChanged = true;
}
}
if (firstIndex >= 0 && i >= firstIndex) {
((SoftWrapImpl)softWrap).advance(lengthDiff);
}
}
if (firstIndex >= 0) {
List<SoftWrapImpl> updated = myAffectedByUpdateSoftWraps.subList(firstIndex, myAffectedByUpdateSoftWraps.size());
SoftWrapImpl lastSoftWrap = getLastSoftWrap();
if (lastSoftWrap != null && lastSoftWrap.getStart() >= updated.get(0).getStart()) {
LOG.error("Invalid soft wrap recalculation", new Attachment("state.txt", myEditor.getSoftWrapModel().toString()));
}
myStorage.addAll(updated);
}
myAffectedByUpdateSoftWraps.clear();
if (softWrapsChanged) {
myStorage.notifyListenersAboutChange();
}
}
示例9: getSortingKey
import com.intellij.openapi.editor.impl.softwrap.SoftWrapImpl; //導入依賴的package包/類
@Override
protected int getSortingKey(@NotNull SoftWrapImpl data) {
return data.getStart();
}
示例10: getLastSoftWrap
import com.intellij.openapi.editor.impl.softwrap.SoftWrapImpl; //導入依賴的package包/類
@Nullable
SoftWrapImpl getLastSoftWrap() {
List<SoftWrapImpl> softWraps = myStorage.getSoftWraps();
return softWraps.isEmpty() ? null : softWraps.get(softWraps.size() - 1);
}
示例11: checkIsDoneAfterSoftWrap
import com.intellij.openapi.editor.impl.softwrap.SoftWrapImpl; //導入依賴的package包/類
private boolean checkIsDoneAfterSoftWrap() {
SoftWrapImpl lastSoftWrap = myDataMapper.getLastSoftWrap();
LOG.assertTrue(lastSoftWrap != null);
return myContext.currentPosition.offset > myContext.rangeEndOffset
&& myDataMapper.matchesOldSoftWrap(lastSoftWrap, myEventBeingProcessed.getLengthDiff());
}