mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
notnull
This commit is contained in:
+7
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -45,7 +45,7 @@ public class ReferenceParameterInfoHandler implements ParameterInfoHandler<PsiRe
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiReferenceParameterList findElementForParameterInfo(final CreateParameterInfoContext context) {
|
||||
public PsiReferenceParameterList findElementForParameterInfo(@NotNull final CreateParameterInfoContext context) {
|
||||
final PsiReferenceParameterList referenceParameterList =
|
||||
ParameterInfoUtils.findParentOfType(context.getFile(), context.getOffset(), PsiReferenceParameterList.class);
|
||||
|
||||
@@ -66,18 +66,18 @@ public class ReferenceParameterInfoHandler implements ParameterInfoHandler<PsiRe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showParameterInfo(@NotNull final PsiReferenceParameterList element, final CreateParameterInfoContext context) {
|
||||
public void showParameterInfo(@NotNull final PsiReferenceParameterList element, @NotNull final CreateParameterInfoContext context) {
|
||||
context.showHint(element, element.getTextRange().getStartOffset() + 1, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiReferenceParameterList findElementForUpdatingParameterInfo(final UpdateParameterInfoContext context) {
|
||||
public PsiReferenceParameterList findElementForUpdatingParameterInfo(@NotNull final UpdateParameterInfoContext context) {
|
||||
return ParameterInfoUtils.findParentOfType(context.getFile(), context.getOffset(), PsiReferenceParameterList.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateParameterInfo(@NotNull final PsiReferenceParameterList o, final UpdateParameterInfoContext context) {
|
||||
int index = ParameterInfoUtils.getCurrentParameterIndex(o.getNode(), context.getOffset(), JavaTokenType.COMMA);
|
||||
public void updateParameterInfo(@NotNull final PsiReferenceParameterList parameterOwner, @NotNull final UpdateParameterInfoContext context) {
|
||||
int index = ParameterInfoUtils.getCurrentParameterIndex(parameterOwner.getNode(), context.getOffset(), JavaTokenType.COMMA);
|
||||
context.setCurrentParameter(index);
|
||||
final Object[] objectsToView = context.getObjectsToView();
|
||||
context.setHighlightedParameter(index < objectsToView.length && index >= 0 ? (PsiElement)objectsToView[index]:null);
|
||||
@@ -95,7 +95,7 @@ public class ReferenceParameterInfoHandler implements ParameterInfoHandler<PsiRe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUI(PsiTypeParameter o, ParameterInfoUIContext context) {
|
||||
public void updateUI(PsiTypeParameter o, @NotNull ParameterInfoUIContext context) {
|
||||
updateTypeParameter(o, context);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -27,19 +27,20 @@ public interface ParameterInfoHandler <ParameterOwner, ParameterType> {
|
||||
|
||||
// Find element for parameter info should also set ItemsToShow in context and may set highlighted element
|
||||
@Nullable
|
||||
ParameterOwner findElementForParameterInfo(final CreateParameterInfoContext context);
|
||||
ParameterOwner findElementForParameterInfo(@NotNull CreateParameterInfoContext context);
|
||||
// Usually context.showHint
|
||||
void showParameterInfo(@NotNull final ParameterOwner element, final CreateParameterInfoContext context);
|
||||
void showParameterInfo(@NotNull final ParameterOwner element, @NotNull CreateParameterInfoContext context);
|
||||
|
||||
// Null returns leads to removing hint
|
||||
@Nullable
|
||||
ParameterOwner findElementForUpdatingParameterInfo(final UpdateParameterInfoContext context);
|
||||
void updateParameterInfo(@NotNull final ParameterOwner o, final UpdateParameterInfoContext context);
|
||||
ParameterOwner findElementForUpdatingParameterInfo(@NotNull UpdateParameterInfoContext context);
|
||||
void updateParameterInfo(@NotNull final ParameterOwner parameterOwner, @NotNull UpdateParameterInfoContext context);
|
||||
|
||||
// Can be null if parameter info does not track parameter index
|
||||
@Nullable String getParameterCloseChars();
|
||||
@Nullable
|
||||
String getParameterCloseChars();
|
||||
boolean tracksParameterIndex();
|
||||
|
||||
// context.setEnabled / context.setupUIComponentPresentation
|
||||
void updateUI(ParameterType p, ParameterInfoUIContext context);
|
||||
void updateUI(ParameterType p, @NotNull ParameterInfoUIContext context);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -118,9 +118,6 @@ public class TargetElementUtilBase {
|
||||
|
||||
/**
|
||||
* @deprecated adjust offset with PsiElement should be used instead to provide correct checking for identifier part
|
||||
* @param document
|
||||
* @param offset
|
||||
* @return
|
||||
*/
|
||||
public static int adjustOffset(Document document, final int offset) {
|
||||
return adjustOffset(null, document, offset);
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ public class GroovyAnnotationAttributeInfoHandler implements ParameterInfoHandle
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateParameterInfo(@NotNull GrAnnotationArgumentList o, @NotNull UpdateParameterInfoContext context) {
|
||||
public void updateParameterInfo(@NotNull GrAnnotationArgumentList parameterOwner, @NotNull UpdateParameterInfoContext context) {
|
||||
context.setHighlightedParameter(findAnnotationMethod(context.getFile(), context.getEditor()));
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -102,11 +102,11 @@ public class GroovyParameterInfoHandler implements ParameterInfoHandlerWithTabAc
|
||||
return ArrayUtil.EMPTY_OBJECT_ARRAY;
|
||||
}
|
||||
|
||||
public GroovyPsiElement findElementForParameterInfo(CreateParameterInfoContext context) {
|
||||
public GroovyPsiElement findElementForParameterInfo(@NotNull CreateParameterInfoContext context) {
|
||||
return findAnchorElement(context.getEditor().getCaretModel().getOffset(), context.getFile());
|
||||
}
|
||||
|
||||
public GroovyPsiElement findElementForUpdatingParameterInfo(UpdateParameterInfoContext context) {
|
||||
public GroovyPsiElement findElementForUpdatingParameterInfo(@NotNull UpdateParameterInfoContext context) {
|
||||
return findAnchorElement(context.getEditor().getCaretModel().getOffset(), context.getFile());
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ public class GroovyParameterInfoHandler implements ParameterInfoHandlerWithTabAc
|
||||
return resolveResult.isInvokedOnProperty() || resolveResult.getElement() instanceof PsiVariable;
|
||||
}
|
||||
|
||||
public void updateParameterInfo(@NotNull GroovyPsiElement place, UpdateParameterInfoContext context) {
|
||||
public void updateParameterInfo(@NotNull GroovyPsiElement place, @NotNull UpdateParameterInfoContext context) {
|
||||
final PsiElement parameterOwner = context.getParameterOwner();
|
||||
if (parameterOwner != place) {
|
||||
context.removeHint();
|
||||
@@ -318,7 +318,7 @@ public class GroovyParameterInfoHandler implements ParameterInfoHandlerWithTabAc
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateUI(Object o, ParameterInfoUIContext context) {
|
||||
public void updateUI(Object o, @NotNull ParameterInfoUIContext context) {
|
||||
CodeInsightSettings settings = CodeInsightSettings.getInstance();
|
||||
|
||||
if (o == null) return;
|
||||
|
||||
+6
-6
@@ -100,7 +100,7 @@ public class GroovyTypeParameterInfoHandler implements ParameterInfoHandlerWithT
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public GrTypeArgumentList findElementForParameterInfo(CreateParameterInfoContext context) {
|
||||
public GrTypeArgumentList findElementForParameterInfo(@NotNull CreateParameterInfoContext context) {
|
||||
final GrTypeArgumentList parameterList = ParameterInfoUtils.findParentOfType(context.getFile(), context.getOffset(), GrTypeArgumentList.class);
|
||||
|
||||
if (parameterList != null) {
|
||||
@@ -121,19 +121,19 @@ public class GroovyTypeParameterInfoHandler implements ParameterInfoHandlerWithT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showParameterInfo(@NotNull GrTypeArgumentList element, CreateParameterInfoContext context) {
|
||||
public void showParameterInfo(@NotNull GrTypeArgumentList element, @NotNull CreateParameterInfoContext context) {
|
||||
context.showHint(element, element.getTextRange().getStartOffset() + 1, this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public GrTypeArgumentList findElementForUpdatingParameterInfo(UpdateParameterInfoContext context) {
|
||||
public GrTypeArgumentList findElementForUpdatingParameterInfo(@NotNull UpdateParameterInfoContext context) {
|
||||
return ParameterInfoUtils.findParentOfType(context.getFile(), context.getOffset(), GrTypeArgumentList.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateParameterInfo(@NotNull GrTypeArgumentList o, UpdateParameterInfoContext context) {
|
||||
int index = ParameterInfoUtils.getCurrentParameterIndex(o.getNode(), context.getOffset(), getActualParameterDelimiterType());
|
||||
public void updateParameterInfo(@NotNull GrTypeArgumentList parameterOwner, @NotNull UpdateParameterInfoContext context) {
|
||||
int index = ParameterInfoUtils.getCurrentParameterIndex(parameterOwner.getNode(), context.getOffset(), getActualParameterDelimiterType());
|
||||
context.setCurrentParameter(index);
|
||||
final Object[] objectsToView = context.getObjectsToView();
|
||||
context.setHighlightedParameter(index < objectsToView.length && index >= 0 ? (PsiElement)objectsToView[index] : null);
|
||||
@@ -151,7 +151,7 @@ public class GroovyTypeParameterInfoHandler implements ParameterInfoHandlerWithT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUI(PsiTypeParameter p, ParameterInfoUIContext context) {
|
||||
public void updateUI(PsiTypeParameter p, @NotNull ParameterInfoUIContext context) {
|
||||
@NonNls StringBuilder buffer = new StringBuilder();
|
||||
buffer.append(p.getName());
|
||||
int highlightEndOffset = buffer.length();
|
||||
|
||||
@@ -43,7 +43,7 @@ public class XPathParameterInfoHandler implements ParameterInfoHandler<XPathFunc
|
||||
return ArrayUtil.EMPTY_OBJECT_ARRAY;
|
||||
}
|
||||
|
||||
public XPathFunctionCall findElementForParameterInfo(CreateParameterInfoContext context) {
|
||||
public XPathFunctionCall findElementForParameterInfo(@NotNull CreateParameterInfoContext context) {
|
||||
final XPathFunctionCall call = findFunctionCall(context.getFile(), context.getOffset());
|
||||
if (call != null) {
|
||||
final XPathFunction function = call.resolve();
|
||||
@@ -72,15 +72,15 @@ public class XPathParameterInfoHandler implements ParameterInfoHandler<XPathFunc
|
||||
return null;
|
||||
}
|
||||
|
||||
public void showParameterInfo(@NotNull XPathFunctionCall call, CreateParameterInfoContext context) {
|
||||
public void showParameterInfo(@NotNull XPathFunctionCall call, @NotNull CreateParameterInfoContext context) {
|
||||
context.showHint(call, call.getTextOffset() + 1, this);
|
||||
}
|
||||
|
||||
public XPathFunctionCall findElementForUpdatingParameterInfo(UpdateParameterInfoContext context) {
|
||||
public XPathFunctionCall findElementForUpdatingParameterInfo(@NotNull UpdateParameterInfoContext context) {
|
||||
return findFunctionCall(context.getFile(), context.getOffset());
|
||||
}
|
||||
|
||||
public void updateParameterInfo(@NotNull XPathFunctionCall call, UpdateParameterInfoContext context) {
|
||||
public void updateParameterInfo(@NotNull XPathFunctionCall call, @NotNull UpdateParameterInfoContext context) {
|
||||
int currentParameterIndex = ParameterInfoUtils.getCurrentParameterIndex(call.getNode(), context.getOffset(), XPathTokenTypes.COMMA);
|
||||
context.setCurrentParameter(currentParameterIndex);
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public class XPathParameterInfoHandler implements ParameterInfoHandler<XPathFunc
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateUI(XPathFunction function, ParameterInfoUIContext context) {
|
||||
public void updateUI(XPathFunction function, @NotNull ParameterInfoUIContext context) {
|
||||
final Function declaration = function.getDeclaration();
|
||||
if (declaration != null) {
|
||||
if (declaration.getParameters().length > 0) {
|
||||
|
||||
@@ -51,7 +51,7 @@ public class PyParameterInfoHandler implements ParameterInfoHandler<PyArgumentLi
|
||||
return ArrayUtil.EMPTY_OBJECT_ARRAY; // we don't
|
||||
}
|
||||
|
||||
public PyArgumentList findElementForParameterInfo(final CreateParameterInfoContext context) {
|
||||
public PyArgumentList findElementForParameterInfo(@NotNull final CreateParameterInfoContext context) {
|
||||
PyArgumentList arglist = findArgumentList(context);
|
||||
if (arglist != null) {
|
||||
final TypeEvalContext typeEvalContext = TypeEvalContext.userInitiated(arglist.getContainingFile());
|
||||
@@ -69,11 +69,11 @@ public class PyParameterInfoHandler implements ParameterInfoHandler<PyArgumentLi
|
||||
return ParameterInfoUtils.findParentOfType(context.getFile(), context.getOffset(), PyArgumentList.class);
|
||||
}
|
||||
|
||||
public void showParameterInfo(@NotNull final PyArgumentList element, final CreateParameterInfoContext context) {
|
||||
public void showParameterInfo(@NotNull final PyArgumentList element, @NotNull final CreateParameterInfoContext context) {
|
||||
context.showHint(element, element.getTextOffset(), this);
|
||||
}
|
||||
|
||||
public PyArgumentList findElementForUpdatingParameterInfo(final UpdateParameterInfoContext context) {
|
||||
public PyArgumentList findElementForUpdatingParameterInfo(@NotNull final UpdateParameterInfoContext context) {
|
||||
return findArgumentList(context);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class PyParameterInfoHandler implements ParameterInfoHandler<PyArgumentLi
|
||||
We cannot store an index since we cannot determine what is an argument until we actually map arguments to parameters.
|
||||
This is because a tuple in arguments may be a whole argument or map to a tuple parameter.
|
||||
*/
|
||||
public void updateParameterInfo(@NotNull final PyArgumentList arglist, final UpdateParameterInfoContext context) {
|
||||
public void updateParameterInfo(@NotNull final PyArgumentList arglist, @NotNull final UpdateParameterInfoContext context) {
|
||||
if (context.getParameterOwner() != arglist) {
|
||||
context.removeHint();
|
||||
return;
|
||||
@@ -125,7 +125,7 @@ public class PyParameterInfoHandler implements ParameterInfoHandler<PyArgumentLi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUI(final CallArgumentsMapping prevResult, final ParameterInfoUIContext context) {
|
||||
public void updateUI(final CallArgumentsMapping prevResult, @NotNull final ParameterInfoUIContext context) {
|
||||
if (prevResult == null) return;
|
||||
final PyArgumentList argList = prevResult.getArgumentList();
|
||||
if (!argList.isValid()) return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -67,7 +67,7 @@ public class XmlParameterInfoHandler implements ParameterInfoHandler<XmlTag,XmlE
|
||||
return true;
|
||||
}
|
||||
|
||||
public XmlTag findElementForParameterInfo(final CreateParameterInfoContext context) {
|
||||
public XmlTag findElementForParameterInfo(@NotNull final CreateParameterInfoContext context) {
|
||||
final XmlTag tag = findXmlTag(context.getFile(), context.getOffset());
|
||||
final XmlElementDescriptor descriptor = tag != null ? tag.getDescriptor() : null;
|
||||
|
||||
@@ -80,11 +80,11 @@ public class XmlParameterInfoHandler implements ParameterInfoHandler<XmlTag,XmlE
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void showParameterInfo(final @NotNull XmlTag element, final CreateParameterInfoContext context) {
|
||||
public void showParameterInfo(final @NotNull XmlTag element, @NotNull final CreateParameterInfoContext context) {
|
||||
context.showHint(element, element.getTextRange().getStartOffset() + 1, this);
|
||||
}
|
||||
|
||||
public XmlTag findElementForUpdatingParameterInfo(final UpdateParameterInfoContext context) {
|
||||
public XmlTag findElementForUpdatingParameterInfo(@NotNull final UpdateParameterInfoContext context) {
|
||||
final XmlTag tag = findXmlTag(context.getFile(), context.getOffset());
|
||||
if (tag != null) {
|
||||
final PsiElement currentXmlTag = context.getParameterOwner();
|
||||
@@ -94,9 +94,9 @@ public class XmlParameterInfoHandler implements ParameterInfoHandler<XmlTag,XmlE
|
||||
return null;
|
||||
}
|
||||
|
||||
public void updateParameterInfo(@NotNull final XmlTag o, final UpdateParameterInfoContext context) {
|
||||
if (context.getParameterOwner() == null || o.equals(context.getParameterOwner())) {
|
||||
context.setParameterOwner( o );
|
||||
public void updateParameterInfo(@NotNull final XmlTag parameterOwner, @NotNull final UpdateParameterInfoContext context) {
|
||||
if (context.getParameterOwner() == null || parameterOwner.equals(context.getParameterOwner())) {
|
||||
context.setParameterOwner(parameterOwner);
|
||||
} else {
|
||||
context.removeHint();
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public class XmlParameterInfoHandler implements ParameterInfoHandler<XmlTag,XmlE
|
||||
return null;
|
||||
}
|
||||
|
||||
public void updateUI(XmlElementDescriptor o, final ParameterInfoUIContext context) {
|
||||
public void updateUI(XmlElementDescriptor o, @NotNull final ParameterInfoUIContext context) {
|
||||
updateElementDescriptor(
|
||||
o,
|
||||
context,
|
||||
|
||||
Reference in New Issue
Block a user