diff --git a/platform/lang-impl/src/com/intellij/injected/editor/DocumentWindowImpl.java b/platform/lang-impl/src/com/intellij/injected/editor/DocumentWindowImpl.java index fe861628df4d..34c274833a4c 100644 --- a/platform/lang-impl/src/com/intellij/injected/editor/DocumentWindowImpl.java +++ b/platform/lang-impl/src/com/intellij/injected/editor/DocumentWindowImpl.java @@ -367,7 +367,7 @@ public class DocumentWindowImpl extends UserDataHolderBase implements Disposable @NotNull public RangeMarker createRangeMarker(final int startOffset, final int endOffset) { - TextRange hostRange = injectedToHost(new ProperTextRange(startOffset, endOffset)); + ProperTextRange hostRange = injectedToHost(new ProperTextRange(startOffset, endOffset)); RangeMarker hostMarker = myDelegate.createRangeMarker(hostRange); return new RangeMarkerWindow(this, (RangeMarkerEx)hostMarker); } @@ -377,7 +377,7 @@ public class DocumentWindowImpl extends UserDataHolderBase implements Disposable if (!surviveOnExternalChange) { return createRangeMarker(startOffset, endOffset); } - TextRange hostRange = injectedToHost(new ProperTextRange(startOffset, endOffset)); + ProperTextRange hostRange = injectedToHost(new ProperTextRange(startOffset, endOffset)); //todo persistent? RangeMarker hostMarker = myDelegate.createRangeMarker(hostRange.getStartOffset(), hostRange.getEndOffset(), surviveOnExternalChange); return new RangeMarkerWindow(this, (RangeMarkerEx)hostMarker); @@ -408,7 +408,7 @@ public class DocumentWindowImpl extends UserDataHolderBase implements Disposable @NotNull public RangeMarker createGuardedBlock(final int startOffset, final int endOffset) { - TextRange hostRange = injectedToHost(new ProperTextRange(startOffset, endOffset)); + ProperTextRange hostRange = injectedToHost(new ProperTextRange(startOffset, endOffset)); return myDelegate.createGuardedBlock(hostRange.getStartOffset(), hostRange.getEndOffset()); } @@ -421,7 +421,7 @@ public class DocumentWindowImpl extends UserDataHolderBase implements Disposable } public RangeMarker getRangeGuard(final int startOffset, final int endOffset) { - TextRange hostRange = injectedToHost(new ProperTextRange(startOffset, endOffset)); + ProperTextRange hostRange = injectedToHost(new ProperTextRange(startOffset, endOffset)); return myDelegate.getRangeGuard(hostRange.getStartOffset(), hostRange.getEndOffset()); } @@ -467,7 +467,7 @@ public class DocumentWindowImpl extends UserDataHolderBase implements Disposable @NotNull public RangeMarker createRangeMarker(@NotNull final TextRange textRange) { - TextRange hostRange = injectedToHost(new ProperTextRange(textRange)); + ProperTextRange hostRange = injectedToHost(new ProperTextRange(textRange)); RangeMarker hostMarker = myDelegate.createRangeMarker(hostRange); return new RangeMarkerWindow(this, (RangeMarkerEx)hostMarker); } @@ -598,7 +598,7 @@ public class DocumentWindowImpl extends UserDataHolderBase implements Disposable } @NotNull - public TextRange injectedToHost(@NotNull TextRange injected) { + public ProperTextRange injectedToHost(@NotNull TextRange injected) { ProperTextRange.assertProperRange(injected); int start = injectedToHost(injected.getStartOffset(), false); int end = injectedToHost(injected.getEndOffset(), true); diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java index 2720c186839f..8f19141260fa 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java @@ -297,7 +297,7 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { public RangeMarker createRangeMarker(int startOffset, int endOffset, boolean surviveOnExternalChange) { ApplicationManagerEx.getApplicationEx().assertReadAccessToDocumentsAllowed(); if (!(0 <= startOffset && startOffset <= endOffset && endOffset <= getTextLength())) { - LOG.error("Incorrect offsets startOffset=" + startOffset + ", endOffset=" + endOffset + ", text length=" + getTextLength()); + LOG.error("Incorrect offsets: startOffset=" + startOffset + ", endOffset=" + endOffset + ", text length=" + getTextLength()); } return surviveOnExternalChange ? new PersistentRangeMarker(this, startOffset, endOffset,true) diff --git a/platform/util/src/com/intellij/util/text/StringSearcher.java b/platform/util/src/com/intellij/util/text/StringSearcher.java index 503a0ba82d43..ce92c8a28d34 100644 --- a/platform/util/src/com/intellij/util/text/StringSearcher.java +++ b/platform/util/src/com/intellij/util/text/StringSearcher.java @@ -68,11 +68,11 @@ public class StringSearcher { return myForwardDirection; } - public int scan(CharSequence text) { + public int scan(@NotNull CharSequence text) { return scan(text,0,text.length()); } - public int scan(CharSequence text, int _start, int _end) { + public int scan(@NotNull CharSequence text, int _start, int _end) { LOG.assertTrue(_start <= _end, _start - _end); LOG.assertTrue(_end <= text.length(), text.length() - _end); if (myForwardDirection) { diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateEnvironment.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateEnvironment.java index c96dab15b2df..d05ceeee8758 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateEnvironment.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateEnvironment.java @@ -14,18 +14,13 @@ package org.zmlx.hg4idea.provider.update; import com.intellij.openapi.options.Configurable; import com.intellij.openapi.options.ConfigurationException; -import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Ref; import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.ProjectLevelVcsManager; import com.intellij.openapi.vcs.VcsException; -import com.intellij.openapi.vcs.update.SequentialUpdatesContext; -import com.intellij.openapi.vcs.update.UpdateEnvironment; -import com.intellij.openapi.vcs.update.UpdateSession; -import com.intellij.openapi.vcs.update.UpdateSessionAdapter; -import com.intellij.openapi.vcs.update.UpdatedFiles; +import com.intellij.openapi.vcs.update.*; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; @@ -59,10 +54,8 @@ public class HgUpdateEnvironment implements UpdateEnvironment { boolean result = true; for (FilePath contentRoot : contentRoots) { - if (indicator != null && indicator.isCanceled()) { - throw new ProcessCanceledException(); - } if (indicator != null) { + indicator.checkCanceled(); indicator.startNonCancelableSection(); } VirtualFile repository =