本文整理汇总了Java中com.intellij.openapi.fileEditor.FileEditorLocation类的典型用法代码示例。如果您正苦于以下问题:Java FileEditorLocation类的具体用法?Java FileEditorLocation怎么用?Java FileEditorLocation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileEditorLocation类属于com.intellij.openapi.fileEditor包,在下文中一共展示了FileEditorLocation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compare
import com.intellij.openapi.fileEditor.FileEditorLocation; //导入依赖的package包/类
@Override
public int compare(UsageNode c1, UsageNode c2) {
if (c1 instanceof StringNode) return 1;
if (c2 instanceof StringNode) return -1;
Usage o1 = c1.getUsage();
Usage o2 = c2.getUsage();
int weight1 = o1 == USAGES_OUTSIDE_SCOPE_SEPARATOR ? 2 : o1 == MORE_USAGES_SEPARATOR ? 1 : 0;
int weight2 = o2 == USAGES_OUTSIDE_SCOPE_SEPARATOR ? 2 : o2 == MORE_USAGES_SEPARATOR ? 1 : 0;
if (weight1 != weight2) return weight1 - weight2;
VirtualFile v1 = UsageListCellRenderer.getVirtualFile(o1);
VirtualFile v2 = UsageListCellRenderer.getVirtualFile(o2);
String name1 = v1 == null ? null : v1.getName();
String name2 = v2 == null ? null : v2.getName();
int i = Comparing.compare(name1, name2);
if (i != 0) return i;
if (o1 instanceof Comparable && o2 instanceof Comparable) {
//noinspection unchecked
return ((Comparable)o1).compareTo(o2);
}
FileEditorLocation loc1 = o1.getLocation();
FileEditorLocation loc2 = o2.getLocation();
return Comparing.compare(loc1, loc2);
}
示例2: compare
import com.intellij.openapi.fileEditor.FileEditorLocation; //导入依赖的package包/类
@Override
public int compare(UsageNode c1, UsageNode c2) {
if (c1 instanceof StringNode) return 1;
if (c2 instanceof StringNode) return -1;
Usage o1 = c1.getUsage();
Usage o2 = c2.getUsage();
if (o1 == MORE_USAGES_SEPARATOR) return 1;
if (o2 == MORE_USAGES_SEPARATOR) return -1;
VirtualFile v1 = UsageListCellRenderer.getVirtualFile(o1);
VirtualFile v2 = UsageListCellRenderer.getVirtualFile(o2);
String name1 = v1 == null ? null : v1.getName();
String name2 = v2 == null ? null : v2.getName();
int i = Comparing.compare(name1, name2);
if (i != 0) return i;
if (o1 instanceof Comparable && o2 instanceof Comparable) {
return ((Comparable)o1).compareTo(o2);
}
FileEditorLocation loc1 = o1.getLocation();
FileEditorLocation loc2 = o2.getLocation();
return Comparing.compare(loc1, loc2);
}
示例3: compare
import com.intellij.openapi.fileEditor.FileEditorLocation; //导入依赖的package包/类
@Override
public int compare(UsageNode c1, UsageNode c2) {
if (c1 instanceof StringNode) return 1;
if (c2 instanceof StringNode) return -1;
Usage o1 = c1.getUsage();
Usage o2 = c2.getUsage();
if (o1 == MORE_USAGES_SEPARATOR) return 1;
if (o2 == MORE_USAGES_SEPARATOR) return -1;
VirtualFile v1 = UsageListCellRenderer.getVirtualFile(o1);
VirtualFile v2 = UsageListCellRenderer.getVirtualFile(o2);
String name1 = v1 == null ? null : v1.getName();
String name2 = v2 == null ? null : v2.getName();
int i = Comparing.compare(name1, name2);
if (i != 0) return i;
if (o1 instanceof Comparable && o2 instanceof Comparable) {
return ((Comparable) o1).compareTo(o2);
}
FileEditorLocation loc1 = o1.getLocation();
FileEditorLocation loc2 = o2.getLocation();
return Comparing.compare(loc1, loc2);
}
示例4: findUsagesInEditor
import com.intellij.openapi.fileEditor.FileEditorLocation; //导入依赖的package包/类
private void findUsagesInEditor(@NotNull final PsiElement[] primaryElements,
@NotNull final PsiElement[] secondaryElements,
@NotNull FindUsagesHandler handler,
@NotNull PsiFile scopeFile,
@NotNull FileSearchScope direction,
@NotNull final FindUsagesOptions findUsagesOptions,
@NotNull FileEditor fileEditor) {
initLastSearchElement(findUsagesOptions, primaryElements, secondaryElements);
clearStatusBar();
final FileEditorLocation currentLocation = fileEditor.getCurrentLocation();
final UsageSearcher usageSearcher = createUsageSearcher(primaryElements, secondaryElements, handler, findUsagesOptions, scopeFile);
AtomicBoolean usagesWereFound = new AtomicBoolean();
Usage fUsage = findSiblingUsage(usageSearcher, direction, currentLocation, usagesWereFound, fileEditor);
if (fUsage != null) {
fUsage.navigate(true);
fUsage.selectInEditor();
}
else if (!usagesWereFound.get()) {
String message = getNoUsagesFoundMessage(primaryElements[0]) + " in " + scopeFile.getName();
showHintOrStatusBarMessage(message, fileEditor);
}
else {
fileEditor.putUserData(KEY_START_USAGE_AGAIN, VALUE_START_USAGE_AGAIN);
showHintOrStatusBarMessage(getSearchAgainMessage(primaryElements[0], direction), fileEditor);
}
}
示例5: findUsagesInEditor
import com.intellij.openapi.fileEditor.FileEditorLocation; //导入依赖的package包/类
private void findUsagesInEditor(@NotNull UsageInfoToUsageConverter.TargetElementsDescriptor descriptor,
@NotNull FindUsagesHandler handler,
@NotNull PsiFile scopeFile,
@NotNull FileSearchScope direction,
@NotNull final FindUsagesOptions findUsagesOptions,
@NotNull FileEditor fileEditor) {
initLastSearchElement(findUsagesOptions, descriptor);
clearStatusBar();
final FileEditorLocation currentLocation = fileEditor.getCurrentLocation();
final UsageSearcher usageSearcher = createUsageSearcher(descriptor, handler, findUsagesOptions, scopeFile);
AtomicBoolean usagesWereFound = new AtomicBoolean();
Usage fUsage = findSiblingUsage(usageSearcher, direction, currentLocation, usagesWereFound, fileEditor);
if (fUsage != null) {
fUsage.navigate(true);
fUsage.selectInEditor();
}
else if (!usagesWereFound.get()) {
String message = getNoUsagesFoundMessage(descriptor.getPrimaryElements()[0]) + " in " + scopeFile.getName();
showHintOrStatusBarMessage(message, fileEditor);
}
else {
fileEditor.putUserData(KEY_START_USAGE_AGAIN, VALUE_START_USAGE_AGAIN);
showHintOrStatusBarMessage(getSearchAgainMessage(descriptor.getPrimaryElements()[0], direction), fileEditor);
}
}
示例6: findUsagesInEditor
import com.intellij.openapi.fileEditor.FileEditorLocation; //导入依赖的package包/类
private void findUsagesInEditor(@Nonnull final PsiElement[] primaryElements,
@Nonnull final PsiElement[] secondaryElements,
@Nonnull FindUsagesHandler handler,
@Nonnull PsiFile scopeFile,
@Nonnull FileSearchScope direction,
@Nonnull final FindUsagesOptions findUsagesOptions,
@Nonnull FileEditor fileEditor) {
initLastSearchElement(findUsagesOptions, primaryElements, secondaryElements);
clearStatusBar();
final FileEditorLocation currentLocation = fileEditor.getCurrentLocation();
PsiElement2UsageTargetAdapter[] primaryTargets = PsiElement2UsageTargetAdapter.convert(primaryElements);
PsiElement2UsageTargetAdapter[] secondaryTargets = PsiElement2UsageTargetAdapter.convert(primaryElements);
final UsageSearcher usageSearcher = createUsageSearcher(primaryTargets, secondaryTargets, handler, findUsagesOptions, scopeFile);
AtomicBoolean usagesWereFound = new AtomicBoolean();
Usage fUsage = findSiblingUsage(usageSearcher, direction, currentLocation, usagesWereFound, fileEditor);
if (fUsage != null) {
fUsage.navigate(true);
fUsage.selectInEditor();
}
else if (!usagesWereFound.get()) {
String message = getNoUsagesFoundMessage(primaryElements[0]) + " in " + scopeFile.getName();
showHintOrStatusBarMessage(message, fileEditor);
}
else {
fileEditor.putUserData(KEY_START_USAGE_AGAIN, VALUE_START_USAGE_AGAIN);
showHintOrStatusBarMessage(getSearchAgainMessage(primaryElements[0], direction), fileEditor);
}
}
示例7: getCurrentLocation
import com.intellij.openapi.fileEditor.FileEditorLocation; //导入依赖的package包/类
@Nullable
@Override
public FileEditorLocation getCurrentLocation() {
return null;
}
示例8: getCurrentLocation
import com.intellij.openapi.fileEditor.FileEditorLocation; //导入依赖的package包/类
@Nullable
@Override
public FileEditorLocation getCurrentLocation() {
return swaggerEditor.getCurrentLocation();
}
示例9: getLocation
import com.intellij.openapi.fileEditor.FileEditorLocation; //导入依赖的package包/类
@Override
public FileEditorLocation getLocation() {
return null;
}
示例10: getLocation
import com.intellij.openapi.fileEditor.FileEditorLocation; //导入依赖的package包/类
@Nullable
FileEditorLocation getLocation();
示例11: getCurrentLocation
import com.intellij.openapi.fileEditor.FileEditorLocation; //导入依赖的package包/类
@Override
public FileEditorLocation getCurrentLocation() {
TextEditor textEditor = getTextEditor();
return textEditor == null ? null : textEditor.getCurrentLocation();
}
示例12: getEditorFor
import com.intellij.openapi.fileEditor.FileEditorLocation; //导入依赖的package包/类
@Nullable
private static Editor getEditorFor(@NotNull Usage usage) {
FileEditorLocation location = usage.getLocation();
FileEditor newFileEditor = location == null ? null : location.getEditor();
return newFileEditor instanceof TextEditor ? ((TextEditor)newFileEditor).getEditor() : null;
}
示例13: findSiblingUsage
import com.intellij.openapi.fileEditor.FileEditorLocation; //导入依赖的package包/类
private static Usage findSiblingUsage(@NotNull final UsageSearcher usageSearcher,
@NotNull FileSearchScope dir,
final FileEditorLocation currentLocation,
@NotNull final AtomicBoolean usagesWereFound,
@NotNull FileEditor fileEditor) {
if (fileEditor.getUserData(KEY_START_USAGE_AGAIN) != null) {
dir = dir == FileSearchScope.AFTER_CARET ? FileSearchScope.FROM_START : FileSearchScope.FROM_END;
}
final FileSearchScope direction = dir;
final AtomicReference<Usage> foundUsage = new AtomicReference<Usage>();
usageSearcher.generate(new Processor<Usage>() {
@Override
public boolean process(Usage usage) {
usagesWereFound.set(true);
if (direction == FileSearchScope.FROM_START) {
foundUsage.compareAndSet(null, usage);
return false;
}
if (direction == FileSearchScope.FROM_END) {
foundUsage.set(usage);
}
else if (direction == FileSearchScope.AFTER_CARET) {
if (Comparing.compare(usage.getLocation(), currentLocation) > 0) {
foundUsage.set(usage);
return false;
}
}
else if (direction == FileSearchScope.BEFORE_CARET) {
if (Comparing.compare(usage.getLocation(), currentLocation) >= 0) {
return false;
}
while (true) {
Usage found = foundUsage.get();
if (found == null) {
if (foundUsage.compareAndSet(null, usage)) break;
}
else {
if (Comparing.compare(found.getLocation(), usage.getLocation()) < 0 && foundUsage.compareAndSet(found, usage)) break;
}
}
}
return true;
}
});
fileEditor.putUserData(KEY_START_USAGE_AGAIN, null);
return foundUsage.get();
}
示例14: getLocation
import com.intellij.openapi.fileEditor.FileEditorLocation; //导入依赖的package包/类
public FileEditorLocation getLocation() {
return null;
}
示例15: getCurrentLocation
import com.intellij.openapi.fileEditor.FileEditorLocation; //导入依赖的package包/类
public FileEditorLocation getCurrentLocation() {
return null;
}