private boolean autoSelectUsingStatistics() { final String filter = getSpeedSearch().getFilter(); if (!StringUtil.isEmpty(filter)) { int maxUseCount = -1; int mostUsedValue = -1; int elementsCount = myListModel.getSize(); for (int i = 0; i < elementsCount; i++) { Object value = myListModel.getElementAt(i); final String text = getListStep().getTextFor(value); final int count = StatisticsManager.getInstance() .getUseCount( new StatisticsInfo("#list_popup:" + myStep.getTitle() + "#" + filter, text)); if (count > maxUseCount) { maxUseCount = count; mostUsedValue = i; } } if (mostUsedValue > 0) { ListScrollingUtil.selectItem(myList, mostUsedValue); return true; } } return false; }
protected PsiClass getPreselection() { PsiClass preselection = RefactoringHierarchyUtil.getNearestBaseClass(myClass, false); final String statKey = PULL_UP_STATISTICS_KEY + myClass.getQualifiedName(); for (StatisticsInfo info : StatisticsManager.getInstance().getAllValues(statKey)) { final String superClassName = info.getValue(); PsiClass superClass = null; for (PsiClass aClass : mySuperClasses) { if (Comparing.strEqual(superClassName, aClass.getQualifiedName())) { superClass = aClass; break; } } if (superClass != null && StatisticsManager.getInstance().getUseCount(info) > 0) { preselection = superClass; break; } } return preselection; }
@NotNull private static StatisticsInfo calcBaseInfo( LookupElement item, @NotNull CompletionLocation location) { if (!ApplicationManager.getApplication().isUnitTestMode()) { LOG.assertTrue(!ApplicationManager.getApplication().isDispatchThread()); } StatisticsInfo info = StatisticsManager.serialize(CompletionService.STATISTICS_KEY, item, location); return info == null ? StatisticsInfo.EMPTY : info; }
private void valuesSelected(final Object[] values) { final String filter = getSpeedSearch().getFilter(); if (!StringUtil.isEmpty(filter)) { for (Object value : values) { final String text = getListStep().getTextFor(value); StatisticsManager.getInstance() .incUseCount( new StatisticsInfo("#list_popup:" + getListStep().getTitle() + "#" + filter, text)); } } }
protected void doAction() { if (!myCallback.checkConflicts(this)) return; JavaRefactoringSettings.getInstance().PULL_UP_MEMBERS_JAVADOC = myJavaDocPanel.getPolicy(); final PsiClass superClass = getSuperClass(); String name = superClass.getQualifiedName(); if (name != null) { StatisticsManager.getInstance() .incUseCount( new StatisticsInfo(PULL_UP_STATISTICS_KEY + myClass.getQualifiedName(), name)); } List<MemberInfo> infos = getSelectedMemberInfos(); invokeRefactoring( new PullUpProcessor( myClass, superClass, infos.toArray(new MemberInfo[infos.size()]), new DocCommentPolicy(getJavaDocPolicy()))); close(OK_EXIT_CODE); }