mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
some @NotNulls/Nullables
This commit is contained in:
@@ -41,7 +41,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
@@ -75,11 +74,11 @@ public class CommonRefactoringUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static void showErrorHint(final Project project,
|
||||
@Nullable final Editor editor,
|
||||
@Nls final String message,
|
||||
@Nls final String title,
|
||||
@Nullable final String helpId) {
|
||||
public static void showErrorHint(@NotNull Project project,
|
||||
@Nullable Editor editor,
|
||||
@NotNull @Nls String message,
|
||||
@NotNull @Nls String title,
|
||||
@Nullable String helpId) {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) throw new RefactoringErrorHintException(message);
|
||||
|
||||
ApplicationManager.getApplication().invokeLater(() -> {
|
||||
@@ -92,7 +91,7 @@ public class CommonRefactoringUtil {
|
||||
});
|
||||
}
|
||||
|
||||
public static String htmlEmphasize(String text) {
|
||||
public static String htmlEmphasize(@NotNull String text) {
|
||||
return StringUtil.htmlEmphasize(text);
|
||||
}
|
||||
|
||||
@@ -113,7 +112,7 @@ public class CommonRefactoringUtil {
|
||||
return checkReadOnlyStatus(project, Collections.<PsiElement>emptySet(), elements, RefactoringBundle.message("refactoring.cannot.be.performed"), notifyOnFail);
|
||||
}
|
||||
|
||||
public static boolean checkReadOnlyStatus(@NotNull PsiElement element, @NotNull Project project, String messagePrefix) {
|
||||
public static boolean checkReadOnlyStatus(@NotNull PsiElement element, @NotNull Project project, @NotNull String messagePrefix) {
|
||||
return element.isWritable() || checkReadOnlyStatus(project, Collections.<PsiElement>emptySet(), Collections.singleton(element), messagePrefix, true);
|
||||
}
|
||||
|
||||
@@ -246,11 +245,11 @@ public class CommonRefactoringUtil {
|
||||
});
|
||||
}
|
||||
|
||||
public static String capitalize(String text) {
|
||||
public static String capitalize(@NotNull String text) {
|
||||
return StringUtil.capitalize(text);
|
||||
}
|
||||
|
||||
public static boolean isAncestor(final PsiElement resolved, final Collection<? extends PsiElement> scopes) {
|
||||
public static boolean isAncestor(@NotNull PsiElement resolved, @NotNull Collection<? extends PsiElement> scopes) {
|
||||
for (final PsiElement scope : scopes) {
|
||||
if (PsiTreeUtil.isAncestor(scope, resolved, false)) return true;
|
||||
}
|
||||
|
||||
+7
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -175,7 +175,7 @@ public abstract class AbstractInplaceIntroducer<V extends PsiNameIdentifierOwner
|
||||
* @return the declaration
|
||||
*/
|
||||
@Nullable
|
||||
protected abstract V createFieldToStartTemplateOn(boolean replaceAll, String[] names);
|
||||
protected abstract V createFieldToStartTemplateOn(boolean replaceAll, @NotNull String[] names);
|
||||
|
||||
/**
|
||||
* Returns the suggested names for the introduced element.
|
||||
@@ -184,6 +184,7 @@ public abstract class AbstractInplaceIntroducer<V extends PsiNameIdentifierOwner
|
||||
* @param variable introduced element declaration, if already created.
|
||||
* @return the suggested names
|
||||
*/
|
||||
@NotNull
|
||||
protected abstract String[] suggestNames(boolean replaceAll, @Nullable V variable);
|
||||
|
||||
protected abstract void performIntroduce();
|
||||
@@ -192,13 +193,15 @@ public abstract class AbstractInplaceIntroducer<V extends PsiNameIdentifierOwner
|
||||
public abstract boolean isReplaceAllOccurrences();
|
||||
public abstract void setReplaceAllOccurrences(boolean allOccurrences);
|
||||
@Override
|
||||
@Nullable
|
||||
protected abstract JComponent getComponent();
|
||||
|
||||
protected abstract void saveSettings(@NotNull V variable);
|
||||
@Override
|
||||
@Nullable
|
||||
protected abstract V getVariable();
|
||||
|
||||
public abstract E restoreExpression(PsiFile containingFile, V variable, RangeMarker marker, String exprText);
|
||||
public abstract E restoreExpression(@NotNull PsiFile containingFile, @NotNull V variable, @NotNull RangeMarker marker, @Nullable String exprText);
|
||||
|
||||
/**
|
||||
* Begins the in-place refactoring operation.
|
||||
@@ -595,7 +598,7 @@ public abstract class AbstractInplaceIntroducer<V extends PsiNameIdentifierOwner
|
||||
protected String getRefactoringId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean startsOnTheSameElement(RefactoringActionHandler handler, PsiElement element) {
|
||||
return super.startsOnTheSameElement(handler, element) || getLocalVariable() == element;
|
||||
|
||||
Reference in New Issue
Block a user