mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
honest stats for highlight usages under caret
This commit is contained in:
+7
-2
@@ -16,6 +16,7 @@
|
||||
package com.intellij.codeInsight.highlighting;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightBundle;
|
||||
import com.intellij.featureStatistics.ProductivityFeatureNames;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
@@ -50,8 +51,6 @@ public class HighlightExitPointsHandler extends HighlightUsagesHandlerBase<PsiEl
|
||||
|
||||
@Override
|
||||
public void computeUsages(final List<PsiElement> targets) {
|
||||
//FeatureUsageTracker.getInstance().triggerFeatureUsed(ProductivityFeatureNames.CODEASSISTS_HIGHLIGHT_RETURN);
|
||||
|
||||
PsiElement parent = myTarget.getParent();
|
||||
if (!(parent instanceof PsiReturnStatement) && !(parent instanceof PsiThrowStatement)) return;
|
||||
|
||||
@@ -141,4 +140,10 @@ public class HighlightExitPointsHandler extends HighlightUsagesHandlerBase<PsiEl
|
||||
myStatusText = CodeInsightBundle.message("status.bar.exit.points.highlighted.message", exitStatements.size(),
|
||||
HighlightUsagesHandler.getShortcutText());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getFeatureId() {
|
||||
return ProductivityFeatureNames.CODEASSISTS_HIGHLIGHT_RETURN;
|
||||
}
|
||||
}
|
||||
|
||||
+8
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
@@ -16,13 +16,13 @@
|
||||
package com.intellij.codeInsight.highlighting;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightBundle;
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
import com.intellij.navigation.ItemPresentation;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.util.Consumer;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -58,7 +58,6 @@ public class HighlightOverridingMethodsHandler extends HighlightUsagesHandlerBas
|
||||
|
||||
@Override
|
||||
public void computeUsages(final List<PsiClass> classes) {
|
||||
FeatureUsageTracker.getInstance().triggerFeatureUsed("codeassists.highlight.implements");
|
||||
for (PsiMethod method : myClass.getMethods()) {
|
||||
List<HierarchicalMethodSignature> superSignatures = method.getHierarchicalMethodSignature().getSuperSignatures();
|
||||
for (HierarchicalMethodSignature superSignature : superSignatures) {
|
||||
@@ -94,4 +93,10 @@ public class HighlightOverridingMethodsHandler extends HighlightUsagesHandlerBas
|
||||
HighlightUsagesHandler.getShortcutText());
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getFeatureId() {
|
||||
return "codeassists.highlight.implements";
|
||||
}
|
||||
}
|
||||
|
||||
+8
-1
@@ -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.
|
||||
@@ -19,6 +19,7 @@ package com.intellij.codeInsight.highlighting;
|
||||
import com.intellij.codeInsight.CodeInsightBundle;
|
||||
import com.intellij.codeInsight.TargetElementUtilBase;
|
||||
import com.intellij.codeInsight.daemon.impl.IdentifierUtil;
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
import com.intellij.find.EditorSearchComponent;
|
||||
import com.intellij.find.findUsages.PsiElement2UsageTargetAdapter;
|
||||
import com.intellij.injected.editor.EditorWindow;
|
||||
@@ -74,6 +75,12 @@ public class HighlightUsagesHandler extends HighlightHandlerBase {
|
||||
|
||||
final HighlightUsagesHandlerBase handler = createCustomHandler(editor, file);
|
||||
if (handler != null) {
|
||||
final String featureId = handler.getFeatureId();
|
||||
|
||||
if (featureId != null) {
|
||||
FeatureUsageTracker.getInstance().triggerFeatureUsed(featureId);
|
||||
}
|
||||
|
||||
handler.highlightUsages();
|
||||
return;
|
||||
}
|
||||
|
||||
+6
-1
@@ -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.
|
||||
@@ -100,6 +100,11 @@ public abstract class HighlightUsagesHandlerBase<T extends PsiElement> {
|
||||
|
||||
public abstract List<T> getTargets();
|
||||
|
||||
@Nullable
|
||||
public String getFeatureId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected abstract void selectTargets(List<T> targets, Consumer<List<T>> selectionConsumer);
|
||||
|
||||
public abstract void computeUsages(List<T> targets);
|
||||
|
||||
+7
-2
@@ -16,6 +16,7 @@
|
||||
package org.jetbrains.plugins.groovy.findUsages;
|
||||
|
||||
import com.intellij.codeInsight.highlighting.HighlightUsagesHandlerBase;
|
||||
import com.intellij.featureStatistics.ProductivityFeatureNames;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -55,8 +56,6 @@ public class GrHighlightExitPointHandler extends HighlightUsagesHandlerBase<PsiE
|
||||
|
||||
@Override
|
||||
public void computeUsages(List<PsiElement> targets) {
|
||||
//FeatureUsageTracker.getInstance().triggerFeatureUsed(ProductivityFeatureNames.CODEASSISTS_HIGHLIGHT_RETURN);
|
||||
|
||||
PsiElement parent = myTarget.getParent();
|
||||
if (!(parent instanceof GrReturnStatement) && !(parent instanceof GrThrowStatement)) return;
|
||||
|
||||
@@ -77,4 +76,10 @@ public class GrHighlightExitPointHandler extends HighlightUsagesHandlerBase<PsiE
|
||||
private static boolean isCorrectReturn(@Nullable PsiElement e) {
|
||||
return e instanceof GrReturnStatement || e instanceof GrThrowStatement || e instanceof GrExpression;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getFeatureId() {
|
||||
return ProductivityFeatureNames.CODEASSISTS_HIGHLIGHT_RETURN;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-2
@@ -55,8 +55,6 @@ public class PyHighlightExitPointsHandler extends HighlightUsagesHandlerBase<Psi
|
||||
}
|
||||
|
||||
public void computeUsages(final List<PsiElement> targets) {
|
||||
//FeatureUsageTracker.getInstance().triggerFeatureUsed(ProductivityFeatureNames.CODEASSISTS_HIGHLIGHT_RETURN);
|
||||
|
||||
final PsiElement parent = myTarget.getParent();
|
||||
if (!(parent instanceof PyReturnStatement)) {
|
||||
return;
|
||||
@@ -122,4 +120,10 @@ public class PyHighlightExitPointsHandler extends HighlightUsagesHandlerBase<Psi
|
||||
}
|
||||
return statements;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getFeatureId() {
|
||||
return super.getFeatureId();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user