This commit is contained in:
Alexey Kudravtsev
2014-03-06 13:25:57 +04:00
parent 9e433b69e6
commit 8aab3af082
8 changed files with 21 additions and 25 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,12 +44,12 @@ public class FilePathReferenceProvider extends PsiReferenceProvider {
}
@NotNull
public PsiReference[] getReferencesByElement(PsiElement element, String text, int offset, final boolean soft) {
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, String text, int offset, final boolean soft) {
return getReferencesByElement(element, text, offset, soft, Module.EMPTY_ARRAY);
}
@NotNull
public PsiReference[] getReferencesByElement(PsiElement element,
public PsiReference[] getReferencesByElement(@NotNull PsiElement element,
String text,
int offset,
final boolean soft,
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -75,7 +75,7 @@ public class PathListReferenceProvider extends PsiReferenceProvider {
return ',';
}
protected PsiReference[] createReferences(PsiElement element, String s, int offset, final boolean soft) {
protected PsiReference[] createReferences(@NotNull PsiElement element, String s, int offset, final boolean soft) {
int contentOffset = StringUtil.findFirst(s, CharFilter.NOT_WHITESPACE_FILTER);
if (contentOffset >= 0) {
offset += contentOffset;
@@ -83,7 +83,7 @@ public class FileReferenceSet {
@Nullable private FileType[] mySuitableFileTypes;
public FileReferenceSet(String str,
PsiElement element,
@NotNull PsiElement element,
int startInElement,
PsiReferenceProvider provider,
boolean caseSensitive,
@@ -93,7 +93,7 @@ public class FileReferenceSet {
}
public FileReferenceSet(String str,
PsiElement element,
@NotNull PsiElement element,
int startInElement,
PsiReferenceProvider provider,
boolean caseSensitive,
@@ -131,19 +131,16 @@ public class FileReferenceSet {
return Collections.emptyList();
}
public static FileReferenceSet createSet(PsiElement element,
public static FileReferenceSet createSet(@NotNull PsiElement element,
final boolean soft,
boolean endingSlashNotAllowed,
final boolean urlEncoded) {
String text;
int offset;
final ElementManipulator<PsiElement> manipulator = ElementManipulators.getManipulator(element);
assert manipulator != null;
final TextRange range = manipulator.getRangeInElement(element);
offset = range.getStartOffset();
text = range.substring(element.getText());
int offset = range.getStartOffset();
String text = range.substring(element.getText());
for (final FileReferenceHelper helper : FileReferenceHelperRegistrar.getHelpers()) {
text = helper.trimUrl(text);
}
@@ -163,7 +160,7 @@ public class FileReferenceSet {
public FileReferenceSet(String str,
PsiElement element,
@NotNull PsiElement element,
int startInElement,
@Nullable PsiReferenceProvider provider,
final boolean isCaseSensitive) {
@@ -172,7 +169,7 @@ public class FileReferenceSet {
public FileReferenceSet(@NotNull String str,
PsiElement element,
@NotNull PsiElement element,
int startInElement,
PsiReferenceProvider provider,
final boolean isCaseSensitive,
@@ -181,7 +178,6 @@ public class FileReferenceSet {
}
public FileReferenceSet(@NotNull final PsiElement element) {
myElement = element;
TextRange range = ElementManipulators.getValueTextRange(element);
myStartInElement = range.getStartOffset();
@@ -44,7 +44,7 @@ public class ElementManipulators extends ClassExtension<ElementManipulator> {
return INSTANCE.forClass(element.getClass());
}
public static int getOffsetInElement(final PsiElement element) {
public static int getOffsetInElement(@NotNull PsiElement element) {
final ElementManipulator<PsiElement> manipulator = getNotNullManipulator(element);
return manipulator.getRangeInElement(element).getStartOffset();
}
@@ -36,7 +36,7 @@ public class JavaFxFileReferenceProvider extends PsiReferenceProvider {
return value;
}
public static PsiReference[] getReferences(final PsiElement element, String value, final String acceptedExtension) {
public static PsiReference[] getReferences(@NotNull PsiElement element, String value, final String acceptedExtension) {
final PsiDirectory directory = element.getContainingFile().getOriginalFile().getParent();
if (directory == null) return PsiReference.EMPTY_ARRAY;
final boolean startsWithSlash = value.startsWith("/");
@@ -78,7 +78,7 @@ class JavaFxLocationReferenceProvider extends PsiReferenceProvider {
}
}
private static PsiReference[] collectRefs(PsiElement element, String value, final int startInElement, final FileType... acceptedFileTypes) {
private static PsiReference[] collectRefs(@NotNull PsiElement element, String value, final int startInElement, final FileType... acceptedFileTypes) {
final FileReferenceSet set = new FileReferenceSet(value, element, startInElement, null, true){
@Override
protected Condition<PsiFileSystemItem> getReferenceCompletionFilter() {
@@ -37,7 +37,7 @@ import java.util.Collection;
*/
public class RootFileReferenceSet extends FileReferenceSet {
public RootFileReferenceSet(String str,
PsiElement element,
@NotNull PsiElement element,
int startInElement,
PsiReferenceProvider provider,
boolean caseSensitive,
@@ -46,7 +46,7 @@ public class RootFileReferenceSet extends FileReferenceSet {
super(str, element, startInElement, provider, caseSensitive, endingSlashNotAllowed, suitableFileTypes);
}
public RootFileReferenceSet(String s, PsiElement element, int offset, PsiReferenceProvider provider, boolean sensitive) {
public RootFileReferenceSet(String s, @NotNull PsiElement element, int offset, PsiReferenceProvider provider, boolean sensitive) {
super(s, element, offset, provider, sensitive);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,11 +41,11 @@ import java.util.List;
public class TemplateFileReferenceSet extends FileReferenceSet {
private final String mySeparatorString;
public TemplateFileReferenceSet(PsiElement element, @Nullable PsiReferenceProvider provider) {
public TemplateFileReferenceSet(@NotNull PsiElement element, @Nullable PsiReferenceProvider provider) {
this(str(element), element, provider);
}
public TemplateFileReferenceSet(String text, PsiElement element,
public TemplateFileReferenceSet(String text, @NotNull PsiElement element,
@Nullable PsiReferenceProvider provider) {
super(text, element, detectShift(element, text), provider,
SystemInfo.isFileSystemCaseSensitive);
@@ -53,7 +53,7 @@ public class TemplateFileReferenceSet extends FileReferenceSet {
reparse();
}
private static String str(PsiElement element) {
private static String str(@NotNull PsiElement element) {
return PythonStringUtil.stripQuotesAroundValue(element.getText());
}