mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 11:53:49 +07:00
cleanup
This commit is contained in:
@@ -30,8 +30,9 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
* @author Maxim.Mossienko
|
* @author Maxim.Mossienko
|
||||||
*/
|
*/
|
||||||
public class AnnotationParameterInfoHandler implements ParameterInfoHandler<PsiAnnotationParameterList,PsiAnnotationMethod>, DumbAware {
|
public class AnnotationParameterInfoHandler implements ParameterInfoHandler<PsiAnnotationParameterList,PsiAnnotationMethod>, DumbAware {
|
||||||
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public @Nullable Object[] getParametersForLookup(LookupElement item, ParameterInfoContext context) {
|
public Object[] getParametersForLookup(LookupElement item, ParameterInfoContext context) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ public class AnnotationParameterInfoHandler implements ParameterInfoHandler<PsiA
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PsiAnnotationParameterList findElementForParameterInfo(final CreateParameterInfoContext context) {
|
public PsiAnnotationParameterList findElementForParameterInfo(@NotNull final CreateParameterInfoContext context) {
|
||||||
final PsiAnnotation annotation = ParameterInfoUtils.findParentOfType(context.getFile(), context.getOffset(), PsiAnnotation.class);
|
final PsiAnnotation annotation = ParameterInfoUtils.findParentOfType(context.getFile(), context.getOffset(), PsiAnnotation.class);
|
||||||
|
|
||||||
if (annotation != null) {
|
if (annotation != null) {
|
||||||
@@ -78,18 +79,18 @@ public class AnnotationParameterInfoHandler implements ParameterInfoHandler<PsiA
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showParameterInfo(@NotNull final PsiAnnotationParameterList element, final CreateParameterInfoContext context) {
|
public void showParameterInfo(@NotNull final PsiAnnotationParameterList element, @NotNull final CreateParameterInfoContext context) {
|
||||||
context.showHint(element, element.getTextRange().getStartOffset() + 1, this);
|
context.showHint(element, element.getTextRange().getStartOffset() + 1, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PsiAnnotationParameterList findElementForUpdatingParameterInfo(final UpdateParameterInfoContext context) {
|
public PsiAnnotationParameterList findElementForUpdatingParameterInfo(@NotNull final UpdateParameterInfoContext context) {
|
||||||
final PsiAnnotation annotation = ParameterInfoUtils.findParentOfType(context.getFile(), context.getOffset(), PsiAnnotation.class);
|
final PsiAnnotation annotation = ParameterInfoUtils.findParentOfType(context.getFile(), context.getOffset(), PsiAnnotation.class);
|
||||||
return annotation != null ? annotation.getParameterList() : null;
|
return annotation != null ? annotation.getParameterList() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateParameterInfo(@NotNull final PsiAnnotationParameterList o, final UpdateParameterInfoContext context) {
|
public void updateParameterInfo(@NotNull final PsiAnnotationParameterList parameterOwner, @NotNull final UpdateParameterInfoContext context) {
|
||||||
CharSequence chars = context.getEditor().getDocument().getCharsSequence();
|
CharSequence chars = context.getEditor().getDocument().getCharsSequence();
|
||||||
int offset1 = CharArrayUtil.shiftForward(chars, context.getEditor().getCaretModel().getOffset(), " \t");
|
int offset1 = CharArrayUtil.shiftForward(chars, context.getEditor().getCaretModel().getOffset(), " \t");
|
||||||
final char c = chars.charAt(offset1);
|
final char c = chars.charAt(offset1);
|
||||||
@@ -110,19 +111,17 @@ public class AnnotationParameterInfoHandler implements ParameterInfoHandler<PsiA
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateUI(final PsiAnnotationMethod p, final ParameterInfoUIContext context) {
|
public void updateUI(final PsiAnnotationMethod p, @NotNull final ParameterInfoUIContext context) {
|
||||||
updateUIText(p, context);
|
updateUIText(p, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String updateUIText(PsiAnnotationMethod p, ParameterInfoUIContext context) {
|
public static String updateUIText(PsiAnnotationMethod p, ParameterInfoUIContext context) {
|
||||||
@NonNls StringBuilder buffer = new StringBuilder();
|
@NonNls StringBuilder buffer = new StringBuilder();
|
||||||
int highlightStartOffset;
|
|
||||||
int highlightEndOffset;
|
|
||||||
buffer.append(p.getReturnType().getPresentableText());
|
buffer.append(p.getReturnType().getPresentableText());
|
||||||
buffer.append(" ");
|
buffer.append(" ");
|
||||||
highlightStartOffset = XmlStringUtil.escapeString(buffer.toString()).length();
|
int highlightStartOffset = XmlStringUtil.escapeString(buffer.toString()).length();
|
||||||
buffer.append(p.getName());
|
buffer.append(p.getName());
|
||||||
highlightEndOffset = XmlStringUtil.escapeString(buffer.toString()).length();
|
int highlightEndOffset = XmlStringUtil.escapeString(buffer.toString()).length();
|
||||||
buffer.append("()");
|
buffer.append("()");
|
||||||
|
|
||||||
if (p.getDefaultValue() != null) {
|
if (p.getDefaultValue() != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user