mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
FUS-452 Implement collector for Find sessions (Find in File, Find in Path)
GitOrigin-RevId: 0d52045449f1550dad8487bd984c1540c9c3b4cd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6ac6e6da4c
commit
f5c89ee773
@@ -198,6 +198,8 @@ public class EditorSearchSession implements SearchSession,
|
||||
}
|
||||
}
|
||||
}, myDisposable);
|
||||
|
||||
FindUtil.triggerUsedOptionsStats("FindInEditor", findModel);
|
||||
}
|
||||
|
||||
public Editor getEditor() {
|
||||
|
||||
@@ -5,6 +5,7 @@ package com.intellij.find;
|
||||
import com.intellij.codeInsight.hint.HintManager;
|
||||
import com.intellij.codeInsight.hint.HintManagerImpl;
|
||||
import com.intellij.codeInsight.hint.HintUtil;
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
import com.intellij.find.findUsages.PsiElement2UsageTargetAdapter;
|
||||
import com.intellij.find.impl.FindInProjectUtil;
|
||||
import com.intellij.find.replaceInProject.ReplaceInProjectManager;
|
||||
@@ -1004,4 +1005,15 @@ public class FindUtil {
|
||||
return caretShiftFromSelectionStart < 0
|
||||
? findResult.getEndOffset() : Math.min(findResult.getStartOffset() + caretShiftFromSelectionStart, findResult.getEndOffset());
|
||||
}
|
||||
|
||||
public static void triggerUsedOptionsStats(@NotNull String prefix, @NotNull FindModel model) {
|
||||
FeatureUsageTracker tracker = FeatureUsageTracker.getInstance();
|
||||
if (model.isCaseSensitive()) tracker.triggerFeatureUsed(prefix + ".MatchCaseOn");
|
||||
if (model.isWholeWordsOnly()) tracker.triggerFeatureUsed(prefix + ".WholeWordsOn");
|
||||
if (model.isRegularExpressions()) tracker.triggerFeatureUsed(prefix + ".RegexOn");
|
||||
if (model.getFileFilter() != null) tracker.triggerFeatureUsed(prefix + ".FileFilterOn");
|
||||
if (model.getSearchContext() != FindModel.SearchContext.ANY) {
|
||||
tracker.triggerFeatureUsed(prefix + ".Context." + model.getSearchContext());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package com.intellij.find.impl;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
import com.intellij.find.*;
|
||||
import com.intellij.find.actions.ShowUsagesAction;
|
||||
import com.intellij.find.replaceInProject.ReplaceInProjectManager;
|
||||
@@ -167,6 +168,8 @@ public class FindPopupPanel extends JBPanel implements FindUI {
|
||||
|
||||
initComponents();
|
||||
initByModel();
|
||||
|
||||
FindUtil.triggerUsedOptionsStats("FindInPath", myHelper.getModel());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -405,17 +408,17 @@ public class FindPopupPanel extends JBPanel implements FindUI {
|
||||
//myTitleLabel.setBorder(JBUI.Borders.emptyRight(16));
|
||||
myLoadingDecorator = new LoadingDecorator(new JLabel(EmptyIcon.ICON_16), getDisposable(), 250, true, new AsyncProcessIcon("FindInPathLoading"));
|
||||
myLoadingDecorator.setLoadingText("");
|
||||
myCbCaseSensitive = createCheckBox("find.popup.case.sensitive");
|
||||
myCbCaseSensitive = createCheckBox("find.popup.case.sensitive", "FindPopupPanel$ToggleCaseSensitive");
|
||||
ItemListener liveResultsPreviewUpdateListener = __ -> scheduleResultsUpdate();
|
||||
myCbCaseSensitive.addItemListener(liveResultsPreviewUpdateListener);
|
||||
myCbPreserveCase = createCheckBox("find.options.replace.preserve.case");
|
||||
myCbPreserveCase = createCheckBox("find.options.replace.preserve.case", "FindPopupPanel$TogglePreserveSensitive");
|
||||
myCbPreserveCase.addItemListener(liveResultsPreviewUpdateListener);
|
||||
myCbPreserveCase.setVisible(myHelper.getModel().isReplaceState());
|
||||
myCbWholeWordsOnly = createCheckBox("find.popup.whole.words");
|
||||
myCbWholeWordsOnly = createCheckBox("find.popup.whole.words", "FindPopupPanel$ToggleWholeWords");
|
||||
myCbWholeWordsOnly.addItemListener(liveResultsPreviewUpdateListener);
|
||||
myCbRegularExpressions = createCheckBox("find.popup.regex");
|
||||
myCbRegularExpressions = createCheckBox("find.popup.regex", "FindPopupPanel$ToggleRegex");
|
||||
myCbRegularExpressions.addItemListener(liveResultsPreviewUpdateListener);
|
||||
myCbFileFilter = createCheckBox("find.popup.filemask");
|
||||
myCbFileFilter = createCheckBox("find.popup.filemask", "FindPopupPanel$ToggleFileFilter");
|
||||
myCbFileFilter.addItemListener(__ -> {
|
||||
if (myCbFileFilter.isSelected()) {
|
||||
myFileMaskField.setEnabled(true);
|
||||
@@ -902,8 +905,9 @@ public class FindPopupPanel extends JBPanel implements FindUI {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static StateRestoringCheckBox createCheckBox(String message) {
|
||||
private static StateRestoringCheckBox createCheckBox(String message, String featureId) {
|
||||
StateRestoringCheckBox checkBox = new StateRestoringCheckBox(FindBundle.message(message));
|
||||
checkBox.addActionListener(__ -> FeatureUsageTracker.getInstance().triggerFeatureUsed(featureId));
|
||||
checkBox.setFocusable(false);
|
||||
return checkBox;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user