mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
+9
-13
@@ -104,16 +104,12 @@ public class ShowIntentionActionsHandler implements CodeInsightActionHandler {
|
||||
}
|
||||
|
||||
// returns editor,file where the action is available or null if there are none
|
||||
public static boolean availableFor(@NotNull PsiFile file, @NotNull Editor editor, @NotNull IntentionAction action) {
|
||||
if (!file.isValid()) return false;
|
||||
public static boolean availableFor(@NotNull PsiFile psiFile, @NotNull Editor editor, @NotNull IntentionAction action) {
|
||||
if (!psiFile.isValid()) return false;
|
||||
|
||||
int offset = editor.getCaretModel().getOffset();
|
||||
PsiElement element = file.findElementAt(offset);
|
||||
boolean inProject = file.getManager().isInProject(file);
|
||||
return isAvailableHere(editor, file, element, inProject, action);
|
||||
}
|
||||
|
||||
private static boolean isAvailableHere(Editor editor, PsiFile psiFile, PsiElement psiElement, boolean inProject, IntentionAction action) {
|
||||
PsiElement psiElement = psiFile.findElementAt(offset);
|
||||
boolean inProject = psiFile.getManager().isInProject(psiFile);
|
||||
try {
|
||||
Project project = psiFile.getProject();
|
||||
if (action instanceof SuppressIntentionActionFromFix) {
|
||||
@@ -170,11 +166,11 @@ public class ShowIntentionActionsHandler implements CodeInsightActionHandler {
|
||||
return chooseActionAndInvoke(hostFile, hostEditor, action, text, project);
|
||||
}
|
||||
|
||||
public static boolean chooseActionAndInvoke(@NotNull PsiFile hostFile,
|
||||
@Nullable final Editor hostEditor,
|
||||
@NotNull final IntentionAction action,
|
||||
@NotNull String text,
|
||||
@NotNull final Project project) {
|
||||
static boolean chooseActionAndInvoke(@NotNull PsiFile hostFile,
|
||||
@Nullable final Editor hostEditor,
|
||||
@NotNull final IntentionAction action,
|
||||
@NotNull String text,
|
||||
@NotNull final Project project) {
|
||||
FeatureUsageTracker.getInstance().triggerFeatureUsed("codeassists.quickFix");
|
||||
((FeatureUsageTrackerImpl)FeatureUsageTracker.getInstance()).getFixesStats().registerInvocation();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -201,7 +201,7 @@ public class EncodingUtil {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
// returns existing charset (null means N/A), failReason: null means enabled, notnull means disabled and contains error message
|
||||
// returns pair (existing charset (null means N/A); failReason: null means enabled, notnull means disabled and contains error message)
|
||||
public static Pair<Charset, String> checkCanReload(@NotNull VirtualFile virtualFile) {
|
||||
if (virtualFile.isDirectory()) {
|
||||
return Pair.create(null, "file is a directory");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -23,6 +23,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public interface NotNullFunction<Param, Result> extends NullableFunction<Param, Result> {
|
||||
@Override
|
||||
@NotNull
|
||||
Result fun(final Param dom);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user