本文整理汇总了Java中com.intellij.openapi.diff.DiffNavigationContext类的典型用法代码示例。如果您正苦于以下问题:Java DiffNavigationContext类的具体用法?Java DiffNavigationContext怎么用?Java DiffNavigationContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DiffNavigationContext类属于com.intellij.openapi.diff包,在下文中一共展示了DiffNavigationContext类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doScrollToContext
import com.intellij.openapi.diff.DiffNavigationContext; //导入依赖的package包/类
protected boolean doScrollToContext(@NotNull DiffNavigationContext context) {
ChangedLinesIterator changedLinesIterator = new ChangedLinesIterator(Side.RIGHT);
NavigationContextChecker checker = new NavigationContextChecker(changedLinesIterator, context);
int line = checker.contextMatchCheck();
if (line == -1) {
// this will work for the case, when spaces changes are ignored, and corresponding fragments are not reported as changed
// just try to find target line -> +-
AllLinesIterator allLinesIterator = new AllLinesIterator(Side.RIGHT);
NavigationContextChecker checker2 = new NavigationContextChecker(allLinesIterator, context);
line = checker2.contextMatchCheck();
}
if (line == -1) return false;
scrollToLine(Side.RIGHT, line);
return true;
}
示例2: doScrollToContext
import com.intellij.openapi.diff.DiffNavigationContext; //导入依赖的package包/类
protected boolean doScrollToContext(@NotNull DiffNavigationContext context) {
if (getSide().isLeft()) return false;
AllLinesIterator allLinesIterator = new AllLinesIterator();
NavigationContextChecker checker2 = new NavigationContextChecker(allLinesIterator, context);
int line = checker2.contextMatchCheck();
if (line == -1) return false;
scrollToLine(line);
return true;
}
示例3: createDiffNavigationContext
import com.intellij.openapi.diff.DiffNavigationContext; //导入依赖的package包/类
private DiffNavigationContext createDiffNavigationContext(final int actualLine) {
final ContentsLines contentsLines = new ContentsLines(myFileAnnotation.getAnnotatedContent());
final Pair<Integer, String> pair = correctActualLineIfTextEmpty(contentsLines, actualLine);
return new DiffNavigationContext(new Iterable<String>() {
@Override
public Iterator<String> iterator() {
return new CacheOneStepIterator<String>(new ContextLineIterator(contentsLines, myFileAnnotation, pair.getFirst()));
}
}, pair.getSecond());
}
示例4: convertRequestFair
import com.intellij.openapi.diff.DiffNavigationContext; //导入依赖的package包/类
@Nullable
private static DiffRequest convertRequestFair(@NotNull com.intellij.openapi.diff.DiffRequest oldRequest) {
if (oldRequest.getOnOkRunnable() != null) return null;
//if (oldRequest.getBottomComponent() != null) return null; // TODO: we need EDT to make this check. Let's ignore bottom component.
// TODO: migrate layers
com.intellij.openapi.diff.DiffContent[] contents = oldRequest.getContents();
String[] titles = oldRequest.getContentTitles();
List<DiffContent> newContents = new ArrayList<DiffContent>(contents.length);
for (int i = 0; i < contents.length; i++) {
DiffContent convertedContent = convertContent(oldRequest.getProject(), contents[i]);
if (convertedContent == null) return null;
newContents.add(convertedContent);
}
SimpleDiffRequest newRequest = new SimpleDiffRequest(oldRequest.getWindowTitle(), newContents, Arrays.asList(titles));
newRequest.putUserData(DiffUserDataKeys.CONTEXT_ACTIONS, Collections.<AnAction>singletonList(new MyShowDiffAction(oldRequest)));
DiffNavigationContext navigationContext = (DiffNavigationContext)oldRequest.getGenericData().get(DiffTool.SCROLL_TO_LINE.getName());
if (navigationContext != null) {
newRequest.putUserData(DiffUserDataKeysEx.NAVIGATION_CONTEXT, navigationContext);
}
return newRequest;
}
示例5: doScrollToContext
import com.intellij.openapi.diff.DiffNavigationContext; //导入依赖的package包/类
protected boolean doScrollToContext(@Nonnull DiffNavigationContext context) {
ChangedLinesIterator changedLinesIterator = new ChangedLinesIterator();
int line = context.contextMatchCheck(changedLinesIterator);
if (line == -1) {
// this will work for the case, when spaces changes are ignored, and corresponding fragments are not reported as changed
// just try to find target line -> +-
AllLinesIterator allLinesIterator = new AllLinesIterator(getEditor(Side.RIGHT).getDocument());
line = context.contextMatchCheck(allLinesIterator);
}
if (line == -1) return false;
scrollToLine(Side.RIGHT, line);
return true;
}
示例6: doScrollToContext
import com.intellij.openapi.diff.DiffNavigationContext; //导入依赖的package包/类
protected boolean doScrollToContext(@Nonnull DiffNavigationContext context) {
if (getSide().isLeft()) return false;
AllLinesIterator allLinesIterator = new AllLinesIterator(getEditor().getDocument());
int line = context.contextMatchCheck(allLinesIterator);
if (line == -1) return false;
scrollToLine(line);
return true;
}
示例7: NavigationContextChecker
import com.intellij.openapi.diff.DiffNavigationContext; //导入依赖的package包/类
public NavigationContextChecker(@NotNull Iterator<Pair<Integer, CharSequence>> changedLinesIterator,
@NotNull DiffNavigationContext context) {
myChangedLinesIterator = changedLinesIterator;
myContext = context;
}
示例8: getDiffNavigationContext
import com.intellij.openapi.diff.DiffNavigationContext; //导入依赖的package包/类
public DiffNavigationContext getDiffNavigationContext() {
return myDiffNavigationContext;
}
示例9: setDiffNavigationContext
import com.intellij.openapi.diff.DiffNavigationContext; //导入依赖的package包/类
public void setDiffNavigationContext(DiffNavigationContext diffNavigationContext) {
myDiffNavigationContext = diffNavigationContext;
}
示例10: NavigationContextChecker
import com.intellij.openapi.diff.DiffNavigationContext; //导入依赖的package包/类
public NavigationContextChecker(@Nonnull Iterator<Pair<Integer, CharSequence>> changedLinesIterator,
@Nonnull DiffNavigationContext context) {
myChangedLinesIterator = changedLinesIterator;
myContext = context;
}