mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+15
-13
@@ -26,6 +26,7 @@ import com.intellij.ide.util.projectWizard.ModuleBuilder;
|
||||
import com.intellij.ide.util.projectWizard.ProjectBuilder;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.module.ModifiableModuleModel;
|
||||
import com.intellij.openapi.module.Module;
|
||||
@@ -54,7 +55,6 @@ import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.packaging.artifacts.ModifiableArtifactModel;
|
||||
import com.intellij.projectImport.ProjectImportBuilder;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import java.util.HashMap;
|
||||
import gnu.trove.THashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -461,20 +461,22 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
|
||||
if (result != Messages.YES) {
|
||||
return false;
|
||||
}
|
||||
for (ModuleEditor editor : selectedEditors) {
|
||||
myModuleEditors.remove(editor.getModule());
|
||||
WriteAction.run(() -> {
|
||||
for (ModuleEditor editor : selectedEditors) {
|
||||
myModuleEditors.remove(editor.getModule());
|
||||
|
||||
final Module moduleToRemove = editor.getModule();
|
||||
// remove all dependencies on the module which is about to be removed
|
||||
List<ModifiableRootModel> modifiableRootModels = new ArrayList<>();
|
||||
for (final ModuleEditor moduleEditor : myModuleEditors.values()) {
|
||||
final ModifiableRootModel modifiableRootModel = moduleEditor.getModifiableRootModelProxy();
|
||||
ContainerUtil.addIfNotNull(modifiableRootModels, modifiableRootModel);
|
||||
final Module moduleToRemove = editor.getModule();
|
||||
// remove all dependencies on the module which is about to be removed
|
||||
List<ModifiableRootModel> modifiableRootModels = new ArrayList<>();
|
||||
for (final ModuleEditor moduleEditor : myModuleEditors.values()) {
|
||||
final ModifiableRootModel modifiableRootModel = moduleEditor.getModifiableRootModelProxy();
|
||||
ContainerUtil.addIfNotNull(modifiableRootModels, modifiableRootModel);
|
||||
}
|
||||
|
||||
ModuleDeleteProvider.removeModule(moduleToRemove, modifiableRootModels, myModuleModel);
|
||||
Disposer.dispose(editor);
|
||||
}
|
||||
|
||||
ModuleDeleteProvider.removeModule(moduleToRemove, modifiableRootModels, myModuleModel);
|
||||
Disposer.dispose(editor);
|
||||
}
|
||||
});
|
||||
processModuleCountChanged();
|
||||
|
||||
return true;
|
||||
|
||||
+1
@@ -83,6 +83,7 @@ public class ExtractedParameter {
|
||||
if (myType instanceof PsiEllipsisType) {
|
||||
type = ((PsiEllipsisType)myType).toArrayType();
|
||||
}
|
||||
type = GenericsUtil.getVariableTypeByExpressionType(type);
|
||||
return type.getCanonicalText();
|
||||
}
|
||||
|
||||
|
||||
@@ -410,6 +410,7 @@
|
||||
bundle="messages.JavadocBundle"/>
|
||||
<editorAppearanceConfigurable instance="com.intellij.codeInsight.hints.AnnotationHintsConfigurable"/>
|
||||
|
||||
<wordBoundaryFilter language="JAVA" implementationClass="com.intellij.codeInsight.editorActions.JavaWordBoundaryFilter"/>
|
||||
<editorActionHandler action="PrevParameter" implementationClass="com.intellij.codeInsight.editorActions.JavaVarArgPrevParameterHandler"/>
|
||||
<editorActionHandler action="NextParameter" implementationClass="com.intellij.codeInsight.editorActions.JavaVarArgNextParameterHandler"/>
|
||||
<editorActionHandler action="EditorLineStart" implementationClass="com.intellij.codeInsight.editorActions.JavadocLineStartHandler"/>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.editorActions;
|
||||
|
||||
import com.intellij.openapi.editor.actions.WordBoundaryFilter;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class JavaWordBoundaryFilter extends WordBoundaryFilter {
|
||||
@Override
|
||||
public boolean isWordBoundary(@NotNull IElementType previousTokenType, @NotNull IElementType tokenType) {
|
||||
if (previousTokenType == JavaTokenType.GT && tokenType == JavaTokenType.EQ) return false;
|
||||
return super.isWordBoundary(previousTokenType, tokenType);
|
||||
}
|
||||
}
|
||||
@@ -36,4 +36,6 @@ public interface AbstractExtractDialog {
|
||||
boolean isOK();
|
||||
|
||||
default boolean isPreviewUsages() {return false;}
|
||||
|
||||
default boolean showInTransaction() {return false;}
|
||||
}
|
||||
@@ -697,4 +697,9 @@ public class ExtractMethodDialog extends RefactoringDialog implements AbstractEx
|
||||
public PsiType getReturnType() {
|
||||
return mySelector != null ? mySelector.getSelectedType() : myReturnType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showInTransaction() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+17
-8
@@ -16,6 +16,7 @@ import com.intellij.ide.DataManager;
|
||||
import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.ide.util.PsiClassListCellRenderer;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.TransactionGuard;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -26,10 +27,7 @@ import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.Pass;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
@@ -577,10 +575,21 @@ public class ExtractMethodProcessor implements MatchProvider {
|
||||
|
||||
public boolean showDialog(final boolean direct) {
|
||||
AbstractExtractDialog dialog = createExtractMethodDialog(direct);
|
||||
dialog.show();
|
||||
if (!dialog.isOK()) return false;
|
||||
apply(dialog);
|
||||
return true;
|
||||
Ref<Boolean> result = Ref.create(Boolean.FALSE);
|
||||
Runnable showAndApply = () -> {
|
||||
dialog.show();
|
||||
if (dialog.isOK()) {
|
||||
apply(dialog);
|
||||
result.set(Boolean.TRUE);
|
||||
}
|
||||
};
|
||||
if (dialog.showInTransaction()) {
|
||||
TransactionGuard.getInstance().submitTransactionAndWait(showAndApply);
|
||||
}
|
||||
else {
|
||||
showAndApply.run();
|
||||
}
|
||||
return result.get();
|
||||
}
|
||||
|
||||
protected void apply(final AbstractExtractDialog dialog) {
|
||||
|
||||
+5
@@ -59,6 +59,11 @@ class JUnitRunConfigurationProperties {
|
||||
testClassPatterns = []
|
||||
}
|
||||
|
||||
String forkMode = first(configuration.fork_mode)?.@value
|
||||
if (forkMode != null && forkMode != "none") {
|
||||
messages.error("Cannot run $file.name configuration: fork mode '$forkMode' is not supported")
|
||||
}
|
||||
|
||||
List<String> requiredArtifacts =
|
||||
first(configuration.method)?.option?.
|
||||
find { it.@name == "BuildArtifacts" && it.@enabled == "true" }?.
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="test class fork" type="JUnit" factoryName="JUnit">
|
||||
<module name="main-module"/>
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false"/>
|
||||
<option name="MAIN_CLASS_NAME" value="com.example.test.MainTest"/>
|
||||
<option name="TEST_OBJECT" value="class"/>
|
||||
<option name="VM_PARAMETERS" value="-ea -Xmx512m"/>
|
||||
<option name="PARAMETERS" value=""/>
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/bin"/>
|
||||
<option name="PASS_PARENT_ENVS" value="true"/>
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="moduleWithDependencies"/>
|
||||
</option>
|
||||
<fork_mode value="method"/>
|
||||
</configuration>
|
||||
</component>
|
||||
+6
@@ -4,6 +4,7 @@
|
||||
package org.jetbrains.intellij.build
|
||||
|
||||
import com.intellij.util.io.URLUtil
|
||||
import junit.framework.AssertionFailedError
|
||||
import org.jetbrains.intellij.build.impl.JUnitRunConfigurationProperties
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
@@ -40,6 +41,11 @@ class JUnitRunConfigurationPropertiesTest {
|
||||
assertEquals(emptyList<String>(), properties.requiredArtifacts)
|
||||
}
|
||||
|
||||
@Test(expected = AssertionFailedError::class)
|
||||
fun `load test with method fork mode`() {
|
||||
loadRunConfiguration("test_method_fork_mode.xml")
|
||||
}
|
||||
|
||||
private fun loadRunConfiguration(fileName: String): JUnitRunConfigurationProperties {
|
||||
val url = JUnitRunConfigurationPropertiesTest::class.java.getResource("runConfigurations/$fileName")
|
||||
return JUnitRunConfigurationProperties.loadRunConfiguration(URLUtil.urlToFile(url), MockBuildMessages())
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.editor.actions;
|
||||
|
||||
import com.intellij.lang.LanguageExtension;
|
||||
|
||||
public class LanguageWordBoundaryFilter extends LanguageExtension<WordBoundaryFilter> {
|
||||
public static final LanguageWordBoundaryFilter INSTANCE = new LanguageWordBoundaryFilter();
|
||||
|
||||
private LanguageWordBoundaryFilter() {
|
||||
super("com.intellij.wordBoundaryFilter", new WordBoundaryFilter());
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.editor.actions;
|
||||
|
||||
import com.intellij.openapi.editor.highlighter.EditorHighlighter;
|
||||
import com.intellij.openapi.editor.highlighter.HighlighterIterator;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Defines boundaries between language tokens which should be used as stops for next/prev-word caret movements.
|
||||
* <p>
|
||||
* Currently it can be specified as a language-level extension (see {@link LanguageWordBoundaryFilter}).
|
||||
*/
|
||||
public class WordBoundaryFilter {
|
||||
/**
|
||||
* Given types of two distinct subsequent tokens returned by {@link HighlighterIterator#getTokenType()}, says whether a boundary
|
||||
* between them should be recognized by 'Move Caret to Prev/Next Word' actions.
|
||||
* <p>
|
||||
* Default implementation assumes a word boundary between any two distinct tokens. Override this method to adjust the logic to the
|
||||
* specifics of particular programming language.
|
||||
*
|
||||
* @see HighlighterIterator
|
||||
* @see EditorHighlighter
|
||||
*/
|
||||
public boolean isWordBoundary(@NotNull IElementType previousTokenType, @NotNull IElementType tokenType) {
|
||||
return !Comparing.equal(previousTokenType, tokenType);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 222 B After Width: | Height: | Size: 350 B |
Binary file not shown.
|
Before Width: | Height: | Size: 437 B After Width: | Height: | Size: 673 B |
+1
-1
@@ -18,7 +18,7 @@ import com.intellij.codeInspection.SuppressIntentionActionFromFix;
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
import com.intellij.featureStatistics.FeatureUsageTrackerImpl;
|
||||
import com.intellij.injected.editor.EditorWindow;
|
||||
import com.intellij.internal.statistic.customUsageCollectors.actions.IntentionsCollector;
|
||||
import com.intellij.internal.statistic.collectors.fus.actions.persistence.IntentionsCollector;
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.TransactionGuard;
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.intellij.ide.ui.search.OptionDescription;
|
||||
import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.ide.util.gotoByName.*;
|
||||
import com.intellij.ide.util.treeView.smartTree.TreeElement;
|
||||
import com.intellij.internal.statistic.customUsageCollectors.ui.ToolbarClicksCollector;
|
||||
import com.intellij.internal.statistic.collectors.fus.ui.persistence.ToolbarClicksCollector;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.lang.LanguagePsiElementExternalizer;
|
||||
import com.intellij.navigation.ItemPresentation;
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.fileTypes;
|
||||
|
||||
import com.intellij.internal.statistic.AbstractProjectsUsagesCollector;
|
||||
import com.intellij.internal.statistic.CollectUsagesException;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.project.ProjectKt;
|
||||
import com.intellij.psi.search.FileTypeIndex;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.util.NotNullFunction;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Nikolay Matveev
|
||||
*/
|
||||
public class FileTypeUsagesCollector extends AbstractProjectsUsagesCollector {
|
||||
private static final String GROUP_ID = "file-type";
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GroupDescriptor.create(GROUP_ID);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getProjectUsages(@NotNull final Project project) throws CollectUsagesException {
|
||||
final Set<FileType> usedFileTypes = new HashSet<>();
|
||||
final FileTypeManager fileTypeManager = FileTypeManager.getInstance();
|
||||
if (fileTypeManager == null) {
|
||||
throw new CollectUsagesException("Cannot get instance of FileTypeManager");
|
||||
}
|
||||
final FileType[] registeredFileTypes = fileTypeManager.getRegisteredFileTypes();
|
||||
for (final FileType fileType : registeredFileTypes) {
|
||||
if (project.isDisposed()) {
|
||||
throw new CollectUsagesException("Project is disposed");
|
||||
}
|
||||
ApplicationManager.getApplication().runReadAction(() -> {
|
||||
FileTypeIndex.processFiles(fileType, file -> {
|
||||
//skip files from .idea directory otherwise 99% of projects would have XML and PLAIN_TEXT file types
|
||||
if (!ProjectKt.getStateStore(project).isProjectFile(file)) {
|
||||
usedFileTypes.add(fileType);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}, GlobalSearchScope.projectScope(project));
|
||||
});
|
||||
}
|
||||
return ContainerUtil.map2Set(usedFileTypes, (NotNullFunction<FileType, UsageDescriptor>)fileType -> new UsageDescriptor(fileType.getName(), 1));
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -51,9 +51,8 @@ public class NonPhysicalReferenceSearcher extends QueryExecutorBase<PsiReference
|
||||
}
|
||||
final PsiManager psiManager = PsiManager.getInstance(project);
|
||||
for (VirtualFile virtualFile : FileEditorManager.getInstance(project).getOpenFiles()) {
|
||||
if (virtualFile.getFileType().isBinary()) {
|
||||
continue;
|
||||
}
|
||||
if (!virtualFile.isValid()) continue;
|
||||
if (virtualFile.getFileType().isBinary()) continue;
|
||||
PsiFile file = psiManager.findFile(virtualFile);
|
||||
if (isApplicableTo(file)) {
|
||||
final LocalSearchScope fileScope = new LocalSearchScope(file);
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.plugins.IdeaPluginDescriptor;
|
||||
import com.intellij.ide.plugins.PluginManagerCore;
|
||||
import com.intellij.ide.plugins.PluginNode;
|
||||
import com.intellij.internal.statistic.customUsageCollectors.ideSettings.IdeInitialConfigButtonUsages;
|
||||
import com.intellij.internal.statistic.collectors.legacy.ideSettings.IdeInitialConfigButtonUsages;
|
||||
import com.intellij.openapi.extensions.PluginId;
|
||||
import com.intellij.openapi.progress.util.AbstractProgressIndicatorExBase;
|
||||
import com.intellij.openapi.ui.VerticalFlowLayout;
|
||||
|
||||
@@ -17,7 +17,7 @@ package com.intellij.ide.customize;
|
||||
|
||||
import com.intellij.ide.cloudConfig.CloudConfigProvider;
|
||||
import com.intellij.ide.startup.StartupActionScriptManager;
|
||||
import com.intellij.internal.statistic.customUsageCollectors.ideSettings.IdeInitialConfigButtonUsages;
|
||||
import com.intellij.internal.statistic.collectors.legacy.ideSettings.IdeInitialConfigButtonUsages;
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
package com.intellij.ide.customize;
|
||||
|
||||
import com.intellij.ide.plugins.PluginManager;
|
||||
import com.intellij.internal.statistic.customUsageCollectors.ideSettings.IdeInitialConfigButtonUsages;
|
||||
import com.intellij.internal.statistic.collectors.legacy.ideSettings.IdeInitialConfigButtonUsages;
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.VerticalFlowLayout;
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Deprecated // to be removed in 2018.2
|
||||
public abstract class UsagesCollector {
|
||||
|
||||
public static final ExtensionPointName<UsagesCollector> EP_NAME = ExtensionPointName.create("com.intellij.statistics.usagesCollector");
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus;
|
||||
|
||||
import com.intellij.featureStatistics.FeatureDescriptor;
|
||||
import com.intellij.featureStatistics.ProductivityFeaturesRegistry;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.FUStatisticsDifferenceSender;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class ProductivityUsageCollector extends ApplicationUsagesCollector implements FUStatisticsDifferenceSender {
|
||||
|
||||
private static final String GROUP_ID = "statistics.productivity";
|
||||
@NotNull
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return GROUP_ID;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
Set<UsageDescriptor> usages = ContainerUtil.newHashSet();
|
||||
|
||||
final ProductivityFeaturesRegistry registry = ProductivityFeaturesRegistry.getInstance();
|
||||
for (String featureId : registry.getFeatureIds()) {
|
||||
final FeatureDescriptor featureDescriptor = registry.getFeatureDescriptor(featureId);
|
||||
if (featureDescriptor != null) {
|
||||
int count = featureDescriptor.getUsageCount();
|
||||
if (count > 0) {
|
||||
usages.add(new UsageDescriptor(featureId, count));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return usages;
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.actions;
|
||||
|
||||
import com.intellij.ide.actions.ActionsCollector;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.FUStatisticsDifferenceSender;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.UsageDescriptorKeyValidator;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public final class ActionUsagesCollector extends ApplicationUsagesCollector implements FUStatisticsDifferenceSender {
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
ActionsCollector.State state = ActionsCollector.getInstance().getState();
|
||||
assert state != null;
|
||||
return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(UsageDescriptorKeyValidator.ensureProperKey(e.getKey()), e.getValue()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getGroupId() {
|
||||
return "statistics.actions.performed";
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.actions;
|
||||
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.collectors.fus.actions.persistence.IntentionsCollector;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.FUStatisticsDifferenceSender;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import static com.intellij.internal.statistic.service.fus.collectors.UsageDescriptorKeyValidator.ensureProperKey;
|
||||
|
||||
public final class IntentionUsagesCollector extends ApplicationUsagesCollector implements FUStatisticsDifferenceSender {
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
IntentionsCollector.State state = IntentionsCollector.getInstance().getState();
|
||||
assert state != null;
|
||||
return ContainerUtil.map2Set(state.myIntentions.entrySet(), e -> new UsageDescriptor(ensureProperKey(e.getKey()), e.getValue()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getGroupId() {
|
||||
return "statistics.actions.intentions";
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.actions;
|
||||
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.collectors.fus.actions.persistence.MainMenuCollector;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.FUStatisticsDifferenceSender;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import static com.intellij.internal.statistic.service.fus.collectors.UsageDescriptorKeyValidator.ensureProperKey;
|
||||
|
||||
public final class MainMenuUsagesCollector extends ApplicationUsagesCollector implements FUStatisticsDifferenceSender {
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
MainMenuCollector.State state = MainMenuCollector.getInstance().getState();
|
||||
assert state != null;
|
||||
return ContainerUtil.map2Set(state.myValues.entrySet(), e -> {
|
||||
String key = e.getKey().replaceAll(" -> ", "-");
|
||||
return new UsageDescriptor(ensureProperKey(key), e.getValue());
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getGroupId() {
|
||||
return "statistics.actions.main.menu";
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.actions.persistence;
|
||||
|
||||
public interface ActionIdProvider {
|
||||
String getId();
|
||||
}
|
||||
+1
-41
@@ -1,25 +1,17 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.customUsageCollectors.actions;
|
||||
package com.intellij.internal.statistic.collectors.fus.actions.persistence;
|
||||
|
||||
import com.intellij.ide.actions.ActionsCollector;
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.ConvertUsagesUtil;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.eventLog.FeatureUsageLogger;
|
||||
import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.FUStatisticsDifferenceSender;
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.components.RoamingType;
|
||||
import com.intellij.openapi.components.State;
|
||||
import com.intellij.openapi.components.Storage;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
@@ -56,36 +48,4 @@ public class ActionsCollectorImpl extends ActionsCollector implements Persistent
|
||||
public void loadState(@NotNull State state) {
|
||||
myState = state;
|
||||
}
|
||||
|
||||
@Deprecated // old statistics service format
|
||||
final static class ActionUsagesCollector extends UsagesCollector {
|
||||
private static final GroupDescriptor GROUP = GroupDescriptor.create("Actions", GroupDescriptor.HIGHER_PRIORITY);
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
State state = getInstance().getState();
|
||||
assert state != null;
|
||||
return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GROUP;
|
||||
}
|
||||
}
|
||||
|
||||
final static class ActionUsagesCollectorNew extends ApplicationUsagesCollector implements FUStatisticsDifferenceSender {
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
State state = getInstance().getState();
|
||||
assert state != null;
|
||||
return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getGroupId() {
|
||||
return "statistics.actions";
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-21
@@ -1,18 +1,15 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.customUsageCollectors.actions;
|
||||
package com.intellij.internal.statistic.collectors.fus.actions.persistence;
|
||||
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.codeInsight.intention.IntentionActionDelegate;
|
||||
import com.intellij.codeInspection.LocalQuickFix;
|
||||
import com.intellij.codeInspection.ex.QuickFixWrapper;
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.xmlb.annotations.MapAnnotation;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -89,26 +86,10 @@ public class IntentionsCollector implements PersistentStateComponent<IntentionsC
|
||||
return ServiceManager.getService(IntentionsCollector.class);
|
||||
}
|
||||
|
||||
final static class State {
|
||||
public final static class State {
|
||||
@Tag("Intentions")
|
||||
@MapAnnotation(surroundWithTag = false, keyAttributeName = "name", valueAttributeName = "count")
|
||||
public Map<String, Integer> myIntentions = new HashMap<>();
|
||||
}
|
||||
|
||||
final static class IntentionUsagesCollector extends UsagesCollector {
|
||||
private static final GroupDescriptor GROUP = GroupDescriptor.create("Intentions");
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
State state = getInstance().getState();
|
||||
assert state != null;
|
||||
return ContainerUtil.map2Set(state.myIntentions.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GROUP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-21
@@ -1,16 +1,13 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.customUsageCollectors.actions;
|
||||
package com.intellij.internal.statistic.collectors.fus.actions.persistence;
|
||||
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.ConvertUsagesUtil;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.impl.ActionMenu;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.xmlb.annotations.MapAnnotation;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -125,25 +122,9 @@ public class MainMenuCollector implements PersistentStateComponent<MainMenuColle
|
||||
}
|
||||
|
||||
|
||||
final static class State {
|
||||
public final static class State {
|
||||
@Tag("counts")
|
||||
@MapAnnotation(surroundWithTag = false, keyAttributeName = "path", valueAttributeName = "count")
|
||||
public Map<String, Integer> myValues = new HashMap<>();
|
||||
}
|
||||
|
||||
final static class MainMenuUsagesCollector extends UsagesCollector {
|
||||
private static final GroupDescriptor GROUP = GroupDescriptor.create("Main Menu", GroupDescriptor.HIGHER_PRIORITY);
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
State state = getInstance().getState();
|
||||
assert state != null;
|
||||
return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GROUP;
|
||||
}
|
||||
}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.fileTypes;
|
||||
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ProjectUsagesCollector;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.project.ProjectKt;
|
||||
import com.intellij.psi.search.FileTypeIndex;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.util.NotNullFunction;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Nikolay Matveev
|
||||
*/
|
||||
public class FileTypeUsagesCollector extends ProjectUsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return "statistics.file.types";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages(@NotNull final Project project) {
|
||||
return getDescriptors(project);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Set<UsageDescriptor> getDescriptors(@NotNull Project project) {
|
||||
final Set<FileType> usedFileTypes = new HashSet<>();
|
||||
final FileTypeManager fileTypeManager = FileTypeManager.getInstance();
|
||||
if (fileTypeManager == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
final FileType[] registeredFileTypes = fileTypeManager.getRegisteredFileTypes();
|
||||
for (final FileType fileType : registeredFileTypes) {
|
||||
if (project.isDisposed()) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
ApplicationManager.getApplication().runReadAction(() -> {
|
||||
FileTypeIndex.processFiles(fileType, file -> {
|
||||
//skip files from .idea directory otherwise 99% of projects would have XML and PLAIN_TEXT file types
|
||||
if (!ProjectKt.getStateStore(project).isProjectFile(file)) {
|
||||
usedFileTypes.add(fileType);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}, GlobalSearchScope.projectScope(project));
|
||||
});
|
||||
}
|
||||
return ContainerUtil
|
||||
.map2Set(usedFileTypes, (NotNullFunction<FileType, UsageDescriptor>)fileType -> new UsageDescriptor(fileType.getName(), 1));
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.jdk;
|
||||
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
|
||||
import com.intellij.util.lang.JavaVersion;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.intellij.internal.statistic.service.fus.collectors.UsageDescriptorKeyValidator.ensureProperKey;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class JdkInfoUsageCollector extends ApplicationUsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
final String vendor = System.getProperty("java.vendor", "Unknown");
|
||||
final String version = "1." + JavaVersion.current().feature;
|
||||
return Collections.singleton(new UsageDescriptor(ensureProperKey(vendor + "." + version), 1));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return "statistics.jdk.user";
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.os;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.UsageDescriptorKeyValidator;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.intellij.internal.statistic.service.fus.collectors.UsageDescriptorKeyValidator.ensureProperKey;
|
||||
|
||||
public class OsNameUsageCollector extends ApplicationUsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
String osName = SystemInfo.isLinux ? "Linux" : SystemInfo.isMac ? "Mac.OS.X" : SystemInfo.isWindows ? "Windows" : SystemInfo.OS_NAME;
|
||||
return ImmutableSet.of(new UsageDescriptor(ensureProperKey(osName), 1));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getGroupId() { return "statistics.os.name"; }
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.os;
|
||||
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.UsageDescriptorKeyValidator;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.Version;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class OsVersionUsageCollector extends ApplicationUsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
return getDescriptors();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Set<UsageDescriptor> getDescriptors() {
|
||||
UsageDescriptor descriptor;
|
||||
|
||||
if (SystemInfo.isLinux) {
|
||||
String releaseId = null, releaseVersion = null;
|
||||
|
||||
try {
|
||||
Map<String, String> values = Files.lines(Paths.get("/etc/os-release"))
|
||||
.map(line -> StringUtil.split(line, "="))
|
||||
.filter(parts -> parts.size() == 2)
|
||||
.collect(
|
||||
Collectors.toMap(parts -> parts.get(0), parts -> StringUtil.unquoteString(parts.get(1))));
|
||||
releaseId = values.get("ID");
|
||||
releaseVersion = values.get("VERSION_ID");
|
||||
}
|
||||
catch (IOException ignored) {
|
||||
}
|
||||
|
||||
if (releaseId == null) releaseId = "unknown";
|
||||
|
||||
if (releaseVersion == null) {
|
||||
releaseVersion = SystemInfo.OS_VERSION;
|
||||
Version version = Version.parseVersion(releaseVersion);
|
||||
if (version != null) {
|
||||
releaseVersion = version.toCompactString();
|
||||
}
|
||||
}
|
||||
|
||||
descriptor = new UsageDescriptor("Linux/" + releaseId + " " + releaseVersion, 1);
|
||||
}
|
||||
else {
|
||||
descriptor = new UsageDescriptor(UsageDescriptorKeyValidator.ensureProperKey(SystemInfo.OS_NAME + "." + SystemInfo.OS_VERSION), 1);
|
||||
}
|
||||
|
||||
return Collections.singleton(descriptor);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getGroupId() { return "statistics.os.version"; }
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.plugins;
|
||||
|
||||
import com.intellij.ide.plugins.PluginManagerCore;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class DisabledPluginsUsagesCollector extends ApplicationUsagesCollector {
|
||||
|
||||
@NotNull
|
||||
public String getGroupId() {
|
||||
return "statistics.plugins.disabled";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
return ContainerUtil.map2Set(PluginManagerCore.getDisabledPlugins(), descriptor -> new UsageDescriptor(descriptor, 1));
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.plugins;
|
||||
|
||||
import com.intellij.ide.plugins.IdeaPluginDescriptor;
|
||||
import com.intellij.ide.plugins.PluginManagerCore;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class NonBundledPluginsUsagesCollector extends ApplicationUsagesCollector {
|
||||
@NotNull
|
||||
public String getGroupId() {
|
||||
return "statistics.plugins.non.bundled";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
final IdeaPluginDescriptor[] plugins = PluginManagerCore.getPlugins();
|
||||
final List<IdeaPluginDescriptor> nonBundledEnabledPlugins = ContainerUtil.filter(plugins, d -> d.isEnabled() && !d.isBundled() && d.getPluginId() != null);
|
||||
|
||||
return ContainerUtil.map2Set(nonBundledEnabledPlugins, descriptor -> new UsageDescriptor(descriptor.getPluginId().getIdString(), 1));
|
||||
}
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.ui;
|
||||
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.util.ui.accessibility.ScreenReader;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author tav
|
||||
*/
|
||||
public class A11YUsagesCollector extends ApplicationUsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
String activity = ScreenReader.isActive() ? "ENABLED" : "DISABLED";
|
||||
String os = SystemInfo.isWindows ? "Windows" : SystemInfo.isLinux ? "Linux" : SystemInfo.isMac ? "Mac" : "Unknown OS";
|
||||
return Collections.singleton(new UsageDescriptor(os + ".screen.reader." + activity, 1));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return "statistics.ui.a11y.screen.reader";
|
||||
}
|
||||
}
|
||||
|
||||
+14
-24
@@ -1,26 +1,11 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.editor.colors.impl;
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.ui;
|
||||
|
||||
import com.intellij.internal.statistic.CollectUsagesException;
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
import com.intellij.openapi.editor.colors.impl.AbstractColorsScheme;
|
||||
import com.intellij.openapi.options.SchemeManager;
|
||||
import com.intellij.ui.ColorUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -30,7 +15,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class EditorColorSchemesUsagesCollector extends UsagesCollector {
|
||||
public class EditorColorSchemesUsagesCollector extends ApplicationUsagesCollector {
|
||||
|
||||
public static final String GROUP_ID = "Color Schemes";
|
||||
public static final String SCHEME_NAME_OTHER = "Other";
|
||||
@@ -53,7 +38,12 @@ public class EditorColorSchemesUsagesCollector extends UsagesCollector {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() throws CollectUsagesException {
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
return getDescriptors();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Set<UsageDescriptor> getDescriptors() {
|
||||
EditorColorsScheme currentScheme = EditorColorsManager.getInstance().getGlobalScheme();
|
||||
Set<UsageDescriptor> usages = ContainerUtil.newHashSet();
|
||||
String schemeName = SCHEME_NAME_OTHER;
|
||||
@@ -71,7 +61,7 @@ public class EditorColorSchemesUsagesCollector extends UsagesCollector {
|
||||
schemeName = knownName;
|
||||
}
|
||||
boolean isDark = ColorUtil.isDark(currentScheme.getDefaultBackground());
|
||||
schemeName += " (" + (isDark ? "Dark" : "Light") + ")";
|
||||
schemeName += "[" + (isDark ? "Dark" : "Light") + "]";
|
||||
}
|
||||
usages.add(new UsageDescriptor(schemeName, 1));
|
||||
}
|
||||
@@ -90,8 +80,8 @@ public class EditorColorSchemesUsagesCollector extends UsagesCollector {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GroupDescriptor.create(GROUP_ID);
|
||||
public String getGroupId() {
|
||||
return "statistics.ui.editor.color.schemes";
|
||||
}
|
||||
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.ui
|
||||
|
||||
import com.intellij.ide.ui.UISettings
|
||||
import com.intellij.ide.util.PropertiesComponent
|
||||
import com.intellij.internal.statistic.CollectUsagesException
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector
|
||||
import com.intellij.internal.statistic.service.fus.collectors.UsageDescriptorKeyValidator.ensureProperKey
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager
|
||||
import com.intellij.openapi.editor.colors.impl.AppEditorFontOptions
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
class FontSizeInfoUsageCollector : ApplicationUsagesCollector() {
|
||||
@Throws(CollectUsagesException::class)
|
||||
override fun getUsages(): Set<UsageDescriptor> {
|
||||
val scheme = EditorColorsManager.getInstance().globalScheme
|
||||
val ui = UISettings.shadowInstance
|
||||
var usages = setOf(
|
||||
UsageDescriptor("UI.font.size[${ui.fontSize}]"),
|
||||
UsageDescriptor(ensureProperKey("UI.font.name[${ui.fontFace}]")),
|
||||
UsageDescriptor("Presentation.mode.font.size[${ui.presentationModeFontSize}]")
|
||||
)
|
||||
if (!scheme.isUseAppFontPreferencesInEditor) {
|
||||
usages += setOf(
|
||||
UsageDescriptor("Editor.font.size[${scheme.editorFontSize}]"),
|
||||
UsageDescriptor(ensureProperKey("Editor.font.name[${scheme.editorFontName}]"))
|
||||
)
|
||||
}
|
||||
else {
|
||||
val appPrefs = AppEditorFontOptions.getInstance().fontPreferences
|
||||
usages += setOf(
|
||||
UsageDescriptor("IDE.editor.font.size[${appPrefs.getSize(appPrefs.fontFamily)}]"),
|
||||
UsageDescriptor(ensureProperKey("IDE.editor.font.name[${appPrefs.fontFamily}]"))
|
||||
)
|
||||
}
|
||||
if (!scheme.isUseEditorFontPreferencesInConsole) {
|
||||
usages += setOf(
|
||||
UsageDescriptor("Console.font.size[${scheme.consoleFontSize}]"),
|
||||
UsageDescriptor(ensureProperKey("Console.font.name[${scheme.consoleFontName}]"))
|
||||
)
|
||||
}
|
||||
val quickDocFontSize = PropertiesComponent.getInstance().getValue("quick.doc.font.size")
|
||||
if (quickDocFontSize != null) {
|
||||
usages += setOf(
|
||||
UsageDescriptor("QuickDoc.font.size[" + quickDocFontSize +"]")
|
||||
)
|
||||
}
|
||||
return usages
|
||||
}
|
||||
|
||||
override fun getGroupId(): String {
|
||||
return "statistics.ui.fonts"
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.ui;
|
||||
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author tav
|
||||
*/
|
||||
public class HiDPIModeUsagesCollector extends ApplicationUsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
String mode = UIUtil.isJreHiDPIEnabled() ? "per_monitor_dpi" : "system_dpi";
|
||||
String os = SystemInfo.isWindows ? "Windows" : SystemInfo.isLinux ? "Linux" : SystemInfo.isMac ? "Mac" : "UnknownOS";
|
||||
return Collections.singleton(new UsageDescriptor(os + "." + mode, 1));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return "statistics.ui.hidpi.mode";
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.ui;
|
||||
|
||||
import com.intellij.ide.ui.LafManager;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.UsageDescriptorKeyValidator;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.intellij.internal.statistic.service.fus.collectors.UsageDescriptorKeyValidator.ensureProperKey;
|
||||
|
||||
public class LaFUsagesCollector extends ApplicationUsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
UIManager.LookAndFeelInfo laf = LafManager.getInstance().getCurrentLookAndFeel();
|
||||
String key = SystemInfo.OS_NAME + ".";
|
||||
if (!StringUtil.isEmptyOrSpaces(SystemInfo.SUN_DESKTOP)) {
|
||||
key=key.replaceAll(" ", "_");
|
||||
key += SystemInfo.SUN_DESKTOP + ".";
|
||||
}
|
||||
return laf != null ? Collections.singleton(new UsageDescriptor(ensureProperKey(key + laf.getName()), 1))
|
||||
: Collections.emptySet();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getGroupId() { return "statistics.ui.look.and.feel"; }
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.ui;
|
||||
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import org.jdesktop.swingx.util.OS;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author tav
|
||||
*/
|
||||
public class ScaleInfoUsageCollector extends ApplicationUsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
return getDescriptors();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Set<UsageDescriptor> getDescriptors() {
|
||||
float scale = JBUI.sysScale();
|
||||
|
||||
int scaleBase = (int)Math.floor(scale);
|
||||
float scaleFract = scale - scaleBase;
|
||||
|
||||
if (scaleFract == 0.0f) scaleFract = 0.0f; // count integer scale on a precise match only
|
||||
else if (scaleFract < 0.375f) scaleFract = 0.25f;
|
||||
else if (scaleFract < 0.625f) scaleFract = 0.5f;
|
||||
else scaleFract = 0.75f;
|
||||
|
||||
scale = scaleBase + scaleFract;
|
||||
|
||||
String os = OS.isWindows() ? "Windows" : OS.isLinux() ? "Linux" : OS.isMacOSX() ? "Mac" : "UnknownOS";
|
||||
return Collections.singleton(new UsageDescriptor(os + "_" + scale, 1));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getGroupId() { return "statistics.ui.screen.scale"; }
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.ui;
|
||||
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.collectors.fus.ui.persistence.ShortcutsCollector;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.FUStatisticsDifferenceSender;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.UsageDescriptorKeyValidator;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import static com.intellij.internal.statistic.service.fus.collectors.UsageDescriptorKeyValidator.*;
|
||||
|
||||
public final class ShortcutUsagesCollector extends ApplicationUsagesCollector implements FUStatisticsDifferenceSender {
|
||||
|
||||
private static String getGroupName() {
|
||||
if (SystemInfo.isMac) return "statistics.ui.shortcuts.on.mac";
|
||||
if (SystemInfo.isWindows) return "statistics.ui.shortcuts.on.windows";
|
||||
if (SystemInfo.isLinux) return "statistics.ui.shortcuts.on.linux";
|
||||
return "statistics.ui.shortcuts.on.other.os";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
ShortcutsCollector.MyState state = ShortcutsCollector.getInstance().getState();
|
||||
return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(ensureProperKey(e.getKey()), e.getValue()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getGroupId() {
|
||||
return getGroupName();
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.ui;
|
||||
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.collectors.fus.ui.persistence.ToolbarClicksCollector;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.FUStatisticsDifferenceSender;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.UsageDescriptorKeyValidator;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import static com.intellij.internal.statistic.service.fus.collectors.UsageDescriptorKeyValidator.*;
|
||||
|
||||
public final class ToolbarClicksUsagesCollector extends ApplicationUsagesCollector implements FUStatisticsDifferenceSender {
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
ToolbarClicksCollector.ClicksState state = ToolbarClicksCollector.getInstance().getState();
|
||||
assert state != null;
|
||||
return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(ensureProperKey(e.getKey()), e.getValue()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getGroupId() {
|
||||
return "statistics.ui.toolbar.clicks";
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.fus.ui;
|
||||
|
||||
import com.intellij.ide.GeneralSettings;
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
|
||||
import com.intellij.openapi.editor.ex.EditorSettingsExternalizable;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.intellij.internal.statistic.utils.StatisticsUtilKt.getBooleanUsage;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class UiInfoUsageCollector extends ApplicationUsagesCollector {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
return getDescriptors();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Set<UsageDescriptor> getDescriptors() {
|
||||
Set<UsageDescriptor> set = new THashSet<>();
|
||||
|
||||
add(set, "Nav.Bar.visible", navbar() ? 1 : 0);
|
||||
add(set, "Nav.Bar.floating", navbar() ? 0 : 1);
|
||||
add(set, "Toolbar.visible", toolbar() ? 1 : 0);
|
||||
add(set, "Toolbar.hidden", toolbar() ? 0 : 1);
|
||||
add(set, "Toolbar.and.NavBar", !toolbar() && navbar() ? 1 : 0);
|
||||
add(set, "Toolbar.and.NavBar.hidden", !toolbar() && !navbar() ? 1 : 0);
|
||||
add(set, "Status.bar.visible", status() ? 1 : 0);
|
||||
add(set, "Status.bar.hidden", status() ? 0 : 1);
|
||||
add(set, "Tool.Window.buttons.visible", stripes() ? 1 : 0);
|
||||
add(set, "Tool.Window.buttons.hidden", stripes() ? 0 : 1);
|
||||
add(set, "Recent.Files[15]", recent() == 15 ? 1 : 0);
|
||||
add(set, "Recent.Files[15_30]", 15 < recent() && recent() < 31 ? 1 : 0);
|
||||
add(set, "Recent.Files[30_50]", 30 < recent() && recent() < 51 ? 1 : 0);
|
||||
add(set, "Recent.Files[more.than.50]", 50 < recent() ? 1 : 0);
|
||||
add(set, "Block.cursor", EditorSettingsExternalizable.getInstance().isBlockCursor() ? 1 : 0);
|
||||
add(set, "Line.Numbers", EditorSettingsExternalizable.getInstance().isLineNumbersShown() ? 1 : 0);
|
||||
add(set, "Gutter.Icons", EditorSettingsExternalizable.getInstance().areGutterIconsShown() ? 1 : 0);
|
||||
add(set, "Soft.Wraps", EditorSettingsExternalizable.getInstance().isUseSoftWraps() ? 1 : 0);
|
||||
add(set, "Tabs.None", tabPlace() == 0 ? 1 : 0);
|
||||
add(set, "Tabs.Top", tabPlace() == SwingConstants.TOP ? 1 : 0);
|
||||
add(set, "Tabs.Bottom", tabPlace() == SwingConstants.BOTTOM ? 1 : 0);
|
||||
add(set, "Tabs.Left", tabPlace() == SwingConstants.LEFT ? 1 : 0);
|
||||
add(set, "Tabs.Right", tabPlace() == SwingConstants.RIGHT ? 1 : 0);
|
||||
add(set, "Retina", UIUtil.isRetina() ? 1 : 0);
|
||||
add(set, "Show.tips.on.startup", GeneralSettings.getInstance().isShowTipsOnStartup() ? 1 : 0);
|
||||
set.add(getBooleanUsage("Allow.merging.buttons", UISettings.getInstance().getAllowMergeButtons()));
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return "statistics.ui.info.features";
|
||||
}
|
||||
|
||||
private static void add(Set<UsageDescriptor> set, String key, int value) {
|
||||
set.add(new UsageDescriptor(key, value));
|
||||
}
|
||||
|
||||
private static int tabPlace() {
|
||||
return UISettings.getInstance().getEditorTabPlacement();
|
||||
}
|
||||
|
||||
private static int recent() {
|
||||
return UISettings.getInstance().getRecentFilesLimit();
|
||||
}
|
||||
|
||||
private static boolean stripes() {
|
||||
return UISettings.getInstance().getHideToolStripes();
|
||||
}
|
||||
|
||||
private static boolean status() {
|
||||
return UISettings.getInstance().getShowStatusBar();
|
||||
}
|
||||
|
||||
private static boolean toolbar() {
|
||||
return UISettings.getInstance().getShowMainToolbar();
|
||||
}
|
||||
|
||||
private static boolean navbar() {
|
||||
return UISettings.getInstance().getShowNavigationBar();
|
||||
}
|
||||
}
|
||||
+7
-30
@@ -1,15 +1,11 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.customUsageCollectors.ui;
|
||||
package com.intellij.internal.statistic.collectors.fus.ui.persistence;
|
||||
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.KeyboardShortcut;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.xmlb.annotations.MapAnnotation;
|
||||
@@ -19,7 +15,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
import javax.swing.*;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.awt.event.InputEvent.ALT_GRAPH_MASK;
|
||||
@@ -41,7 +40,7 @@ import static java.awt.event.KeyEvent.*;
|
||||
}
|
||||
)
|
||||
public class ShortcutsCollector implements PersistentStateComponent<ShortcutsCollector.MyState> {
|
||||
final static class MyState {
|
||||
public final static class MyState {
|
||||
@Tag("counts")
|
||||
@MapAnnotation(surroundWithTag = false, keyAttributeName = "shortcut", valueAttributeName = "count")
|
||||
public final Map<String, Integer> myValues = new HashMap<>();
|
||||
@@ -104,32 +103,10 @@ public class ShortcutsCollector implements PersistentStateComponent<ShortcutsCol
|
||||
}
|
||||
|
||||
|
||||
private static ShortcutsCollector getInstance() {
|
||||
public static ShortcutsCollector getInstance() {
|
||||
return ServiceManager.getService(ShortcutsCollector.class);
|
||||
}
|
||||
|
||||
final static class ShortcutUsagesCollector extends UsagesCollector {
|
||||
private static final GroupDescriptor GROUP = GroupDescriptor.create(getGroupName(), GroupDescriptor.HIGHER_PRIORITY);
|
||||
|
||||
private static String getGroupName() {
|
||||
if (SystemInfo.isMac) return "Shortcuts on Mac";
|
||||
if (SystemInfo.isWindows) return "Shortcuts on Windows";
|
||||
if (SystemInfo.isLinux) return "Shortcuts on Linux";
|
||||
return "Shortcuts on OtherOs";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
MyState state = getInstance().getState();
|
||||
return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GROUP;
|
||||
}
|
||||
}
|
||||
|
||||
private static String getLocaleUnawareKeyText(int keyCode) {
|
||||
if (keyCode >= VK_0 && keyCode <= VK_9 ||
|
||||
keyCode >= VK_A && keyCode <= VK_Z) {
|
||||
+4
-25
@@ -1,23 +1,18 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.customUsageCollectors.ui;
|
||||
package com.intellij.internal.statistic.collectors.fus.ui.persistence;
|
||||
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.ConvertUsagesUtil;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.ActionWithDelegate;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.xmlb.annotations.MapAnnotation;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
@@ -30,7 +25,7 @@ import java.util.Set;
|
||||
}
|
||||
)
|
||||
public class ToolbarClicksCollector implements PersistentStateComponent<ToolbarClicksCollector.ClicksState> {
|
||||
final static class ClicksState {
|
||||
public final static class ClicksState {
|
||||
@Tag("counts")
|
||||
@MapAnnotation(surroundWithTag = false, keyAttributeName = "action", valueAttributeName = "count")
|
||||
public Map<String, Integer> myValues = new HashMap<>();
|
||||
@@ -71,23 +66,7 @@ public class ToolbarClicksCollector implements PersistentStateComponent<ToolbarC
|
||||
}
|
||||
}
|
||||
|
||||
private static ToolbarClicksCollector getInstance() {
|
||||
public static ToolbarClicksCollector getInstance() {
|
||||
return ServiceManager.getService(ToolbarClicksCollector.class);
|
||||
}
|
||||
|
||||
final static class ToolbarClicksUsagesCollector extends UsagesCollector {
|
||||
private static final GroupDescriptor GROUP = GroupDescriptor.create("Toolbar Clicks", GroupDescriptor.HIGHER_PRIORITY);
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
ClicksState state = getInstance().getState();
|
||||
assert state != null;
|
||||
return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GROUP;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.customUsageCollectors;
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy;
|
||||
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
@@ -14,6 +14,7 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
@Deprecated // to be removed in 2018.2
|
||||
public class ExperimentalFeaturesUsageCollector extends UsagesCollector {
|
||||
private static final GroupDescriptor GROUP_ID = GroupDescriptor.create("Experimental Features");
|
||||
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.customUsageCollectors;
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy;
|
||||
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
@@ -13,7 +13,8 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class RegistryUsagesCollector extends UsagesCollector {
|
||||
@Deprecated // to be removed in 2018.2
|
||||
public class LegacyRegistryUsagesCollector extends UsagesCollector {
|
||||
private static final GroupDescriptor GROUP_ID = GroupDescriptor.create("Registry");
|
||||
|
||||
@NotNull
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.actions;
|
||||
|
||||
import com.intellij.ide.actions.ActionsCollector;
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Deprecated // old statistics service format
|
||||
public final class LegacyActionUsagesCollector extends UsagesCollector {
|
||||
private static final GroupDescriptor GROUP = GroupDescriptor.create("Actions", GroupDescriptor.HIGHER_PRIORITY);
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
ActionsCollector.State state = ActionsCollector.getInstance().getState();
|
||||
assert state != null;
|
||||
return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GROUP;
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.actions;
|
||||
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.collectors.fus.actions.persistence.IntentionsCollector;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Deprecated // to be removed in 2018.2
|
||||
public final class LegacyIntentionUsagesCollector extends UsagesCollector {
|
||||
private static final GroupDescriptor GROUP = GroupDescriptor.create("Intentions");
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
IntentionsCollector.State state = IntentionsCollector.getInstance().getState();
|
||||
assert state != null;
|
||||
return ContainerUtil.map2Set(state.myIntentions.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GROUP;
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.actions;
|
||||
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.collectors.fus.actions.persistence.MainMenuCollector;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Deprecated // to be removed in 2018.2
|
||||
public final class LegacyMainMenuUsagesCollector extends UsagesCollector {
|
||||
private static final GroupDescriptor GROUP = GroupDescriptor.create("Main Menu", GroupDescriptor.HIGHER_PRIORITY);
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
MainMenuCollector.State state = MainMenuCollector.getInstance().getState();
|
||||
assert state != null;
|
||||
return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GROUP;
|
||||
}
|
||||
}
|
||||
+3
-16
@@ -1,19 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.internal.statistic.customUsageCollectors.build;
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.build;
|
||||
|
||||
import com.intellij.internal.statistic.CollectUsagesException;
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
@@ -28,6 +14,7 @@ import java.util.Set;
|
||||
/**
|
||||
* @author Ivan Chirkov
|
||||
*/
|
||||
@Deprecated // to be removed in 2018.2
|
||||
public class BuildNumberUsageCollector extends UsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.fileTypes;
|
||||
|
||||
import com.intellij.internal.statistic.AbstractProjectsUsagesCollector;
|
||||
import com.intellij.internal.statistic.CollectUsagesException;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.collectors.fus.fileTypes.FileTypeUsagesCollector;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Nikolay Matveev
|
||||
*/
|
||||
public class LegacyFileTypeUsagesCollector extends AbstractProjectsUsagesCollector {
|
||||
private static final String GROUP_ID = "file-type";
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GroupDescriptor.create(GROUP_ID);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getProjectUsages(@NotNull final Project project) throws CollectUsagesException {
|
||||
return FileTypeUsagesCollector.getDescriptors(project);
|
||||
}
|
||||
}
|
||||
+2
-16
@@ -1,19 +1,5 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.internal.statistic.customUsageCollectors.ideSettings;
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.ideSettings;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Collections;
|
||||
+3
-17
@@ -1,19 +1,5 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.internal.statistic.customUsageCollectors.ideSettings;
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.ideSettings;
|
||||
|
||||
import com.intellij.ide.WelcomeWizardUtil;
|
||||
import com.intellij.internal.statistic.CollectUsagesException;
|
||||
@@ -28,7 +14,7 @@ import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.intellij.internal.statistic.customUsageCollectors.ideSettings.IdeInitialConfigButtonUsages.*;
|
||||
import static com.intellij.internal.statistic.collectors.legacy.ideSettings.IdeInitialConfigButtonUsages.*;
|
||||
|
||||
public final class IdeInitialConfigUsageCollectors {
|
||||
public static class ConfigImport extends Base {
|
||||
+3
-16
@@ -1,19 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.internal.statistic.customUsageCollectors.jdk
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.jdk
|
||||
|
||||
import com.intellij.internal.statistic.UsagesCollector
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor
|
||||
@@ -24,6 +10,7 @@ import java.util.function.Function
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
@Deprecated("") // to be removed in 2018.2
|
||||
class JdkSettingsUsageCollector : UsagesCollector() {
|
||||
override fun getUsages(): Set<UsageDescriptor> {
|
||||
return ManagementFactory.getRuntimeMXBean().inputArguments
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.customUsageCollectors.jdk;
|
||||
package com.intellij.internal.statistic.collectors.legacy.jdk;
|
||||
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
@@ -13,7 +13,8 @@ import java.util.Set;
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
class JdkInfoUsageCollector extends UsagesCollector {
|
||||
@Deprecated // to be removed in 2018.2
|
||||
class LegacyJdkInfoUsageCollector extends UsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
+4
-17
@@ -1,19 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.internal.statistic.customUsageCollectors.os;
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.os;
|
||||
|
||||
import com.intellij.internal.statistic.CollectUsagesException;
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
@@ -28,7 +14,8 @@ import java.util.Set;
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
class OsNameUsageCollector extends UsagesCollector {
|
||||
@Deprecated // to be removed in 2018.2
|
||||
class LegacyOsNameUsageCollector extends UsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() throws CollectUsagesException {
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.os;
|
||||
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.collectors.fus.os.OsVersionUsageCollector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
@Deprecated
|
||||
// to be removed in 2018.2
|
||||
class LegacyOsVersionUsageCollector extends UsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
return OsVersionUsageCollector.getDescriptors();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GroupDescriptor.create("user.os.version");
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.plugins;
|
||||
|
||||
import com.intellij.ide.plugins.PluginManagerCore;
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Deprecated // to be removed in 2018.2
|
||||
public class LegacyDisabledPluginsUsagesCollector extends UsagesCollector {
|
||||
private static final String GROUP_ID = "disabled-plugins";
|
||||
|
||||
@NotNull
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GroupDescriptor.create(GROUP_ID, GroupDescriptor.HIGHER_PRIORITY);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
return ContainerUtil.map2Set(PluginManagerCore.getDisabledPlugins(), descriptor -> new UsageDescriptor(descriptor, 1));
|
||||
}
|
||||
}
|
||||
+6
-19
@@ -1,32 +1,19 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.ide.plugins;
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.plugins;
|
||||
|
||||
import com.intellij.ide.plugins.IdeaPluginDescriptor;
|
||||
import com.intellij.ide.plugins.PluginManagerCore;
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class NonBundledPluginsUsagesCollector extends UsagesCollector {
|
||||
@Deprecated // to be removed in 2018.2
|
||||
public class LegacyNonBundledPluginsUsagesCollector extends UsagesCollector {
|
||||
private static final String GROUP_ID = "non-bundled-plugins";
|
||||
|
||||
@NotNull
|
||||
+6
-17
@@ -1,20 +1,8 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.featureStatistics;
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.productivity;
|
||||
|
||||
import com.intellij.featureStatistics.FeatureDescriptor;
|
||||
import com.intellij.featureStatistics.ProductivityFeaturesRegistry;
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
@@ -23,7 +11,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class FeaturesUsageCollector extends UsagesCollector {
|
||||
@Deprecated // to be removed in 2018.2
|
||||
public class LegacyProductivityFeaturesUsageCollector extends UsagesCollector {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.customUsageCollectors.ui;
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.ui;
|
||||
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
@@ -14,7 +14,8 @@ import java.util.Set;
|
||||
/**
|
||||
* @author tav
|
||||
*/
|
||||
public class A11YUsagesCollector extends UsagesCollector {
|
||||
@Deprecated // to be removed in 2018.2
|
||||
public class LegacyA11YUsagesCollector extends UsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.ui;
|
||||
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.collectors.fus.ui.EditorColorSchemesUsagesCollector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Deprecated // to be removed in 2018.2
|
||||
public class LegacyEditorColorSchemesUsagesCollector extends UsagesCollector {
|
||||
|
||||
public static final String GROUP_ID = "Color Schemes";
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
return EditorColorSchemesUsagesCollector.getDescriptors();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GroupDescriptor.create(GROUP_ID);
|
||||
}
|
||||
|
||||
}
|
||||
+3
-17
@@ -1,19 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.internal.statistic.customUsageCollectors.ui
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.ui
|
||||
|
||||
import com.intellij.ide.ui.UISettings
|
||||
import com.intellij.ide.util.PropertiesComponent
|
||||
@@ -27,7 +13,7 @@ import com.intellij.openapi.editor.colors.impl.AppEditorFontOptions
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
class FontSizeInfoUsageCollector : UsagesCollector() {
|
||||
class LegacyFontSizeInfoUsageCollector : UsagesCollector() {
|
||||
@Throws(CollectUsagesException::class)
|
||||
override fun getUsages(): Set<UsageDescriptor> {
|
||||
val scheme = EditorColorsManager.getInstance().globalScheme
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.customUsageCollectors.ui;
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.ui;
|
||||
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
@@ -14,7 +14,8 @@ import java.util.Set;
|
||||
/**
|
||||
* @author tav
|
||||
*/
|
||||
public class HiDPIModeUsagesCollector extends UsagesCollector {
|
||||
@Deprecated // to be removed in 2018.2
|
||||
public class LegacyHiDPIModeUsagesCollector extends UsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
+5
-19
@@ -1,22 +1,7 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.internal.statistic.customUsageCollectors.ui;
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.ui;
|
||||
|
||||
import com.intellij.ide.ui.LafManager;
|
||||
import com.intellij.internal.statistic.CollectUsagesException;
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
@@ -28,10 +13,11 @@ import javax.swing.*;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
public class LaFUsagesCollector extends UsagesCollector {
|
||||
@Deprecated // to be removed in 2018.2
|
||||
public class LegacyLaFUsagesCollector extends UsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() throws CollectUsagesException {
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
UIManager.LookAndFeelInfo laf = LafManager.getInstance().getCurrentLookAndFeel();
|
||||
String key = SystemInfo.OS_NAME + " - ";
|
||||
if (!StringUtil.isEmptyOrSpaces(SystemInfo.SUN_DESKTOP)) {
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.ui;
|
||||
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.collectors.fus.ui.ScaleInfoUsageCollector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author tav
|
||||
*/
|
||||
@Deprecated // to be removed in 2018.2
|
||||
public class LegacyScaleInfoUsageCollector extends UsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
return ScaleInfoUsageCollector.getDescriptors();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GroupDescriptor.create("user.ui.screen.scale");
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.ui;
|
||||
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.collectors.fus.ui.persistence.ShortcutsCollector;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Deprecated // to be removed in 2018.2
|
||||
public final class LegacyShortcutUsagesCollector extends UsagesCollector {
|
||||
private static final GroupDescriptor GROUP = GroupDescriptor.create(getGroupName(), GroupDescriptor.HIGHER_PRIORITY);
|
||||
|
||||
private static String getGroupName() {
|
||||
if (SystemInfo.isMac) return "Shortcuts on Mac";
|
||||
if (SystemInfo.isWindows) return "Shortcuts on Windows";
|
||||
if (SystemInfo.isLinux) return "Shortcuts on Linux";
|
||||
return "Shortcuts on OtherOs";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
ShortcutsCollector.MyState state = ShortcutsCollector.getInstance().getState();
|
||||
return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GROUP;
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.ui;
|
||||
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.collectors.fus.ui.persistence.ToolbarClicksCollector;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Deprecated // to be removed in 2018.2
|
||||
public final class LegacyToolbarClicksUsagesCollector extends UsagesCollector {
|
||||
private static final GroupDescriptor GROUP = GroupDescriptor.create("Toolbar Clicks", GroupDescriptor.HIGHER_PRIORITY);
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
ToolbarClicksCollector.ClicksState state = ToolbarClicksCollector.getInstance().getState();
|
||||
assert state != null;
|
||||
return ContainerUtil.map2Set(state.myValues.entrySet(), e -> new UsageDescriptor(e.getKey(), e.getValue()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GROUP;
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.collectors.legacy.ui;
|
||||
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.collectors.fus.ui.UiInfoUsageCollector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
@Deprecated // to be removed in 2018.2
|
||||
class LegacyUiInfoUsageCollector extends UsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
return UiInfoUsageCollector.getDescriptors();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GroupDescriptor.create("UI Features");
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.internal.statistic.customUsageCollectors.actions;
|
||||
|
||||
public interface ActionIdProvider {
|
||||
String getId();
|
||||
}
|
||||
-81
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.internal.statistic.customUsageCollectors.os;
|
||||
|
||||
import com.intellij.internal.statistic.CollectUsagesException;
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.Version;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
class OsVersionUsageCollector extends UsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() throws CollectUsagesException {
|
||||
UsageDescriptor descriptor;
|
||||
|
||||
if (SystemInfo.isLinux) {
|
||||
String releaseId = null, releaseVersion = null;
|
||||
|
||||
try {
|
||||
Map<String, String> values = Files.lines(Paths.get("/etc/os-release"))
|
||||
.map(line -> StringUtil.split(line, "="))
|
||||
.filter(parts -> parts.size() == 2)
|
||||
.collect(Collectors.toMap(parts -> parts.get(0), parts -> StringUtil.unquoteString(parts.get(1))));
|
||||
releaseId = values.get("ID");
|
||||
releaseVersion = values.get("VERSION_ID");
|
||||
}
|
||||
catch (IOException ignored) { }
|
||||
|
||||
if (releaseId == null) releaseId = "unknown";
|
||||
|
||||
if (releaseVersion == null) {
|
||||
releaseVersion = SystemInfo.OS_VERSION;
|
||||
Version version = Version.parseVersion(releaseVersion);
|
||||
if (version != null) {
|
||||
releaseVersion = version.toCompactString();
|
||||
}
|
||||
}
|
||||
|
||||
descriptor = new UsageDescriptor("Linux/" + releaseId + " " + releaseVersion, 1);
|
||||
}
|
||||
else {
|
||||
descriptor = new UsageDescriptor(SystemInfo.OS_NAME + " " + SystemInfo.OS_VERSION, 1);
|
||||
}
|
||||
|
||||
return Collections.singleton(descriptor);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GroupDescriptor.create("user.os.version");
|
||||
}
|
||||
}
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.internal.statistic.customUsageCollectors.ui;
|
||||
|
||||
import com.intellij.internal.statistic.CollectUsagesException;
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import org.jdesktop.swingx.util.OS;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author tav
|
||||
*/
|
||||
public class ScaleInfoUsageCollector extends UsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() throws CollectUsagesException {
|
||||
float scale = JBUI.sysScale();
|
||||
|
||||
int scaleBase = (int)Math.floor(scale);
|
||||
float scaleFract = scale - scaleBase;
|
||||
|
||||
if (scaleFract == 0.0f) scaleFract = 0.0f; // count integer scale on a precise match only
|
||||
else if (scaleFract < 0.375f) scaleFract = 0.25f;
|
||||
else if (scaleFract < 0.625f) scaleFract = 0.5f;
|
||||
else scaleFract = 0.75f;
|
||||
|
||||
scale = scaleBase + scaleFract;
|
||||
|
||||
String os = OS.isWindows() ? "Windows" : OS.isLinux() ? "Linux" : OS.isMacOSX() ? "Mac" : "Unknown OS";
|
||||
return Collections.singleton(new UsageDescriptor(os + " " + scale, 1));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GroupDescriptor.create("user.ui.screen.scale");
|
||||
}
|
||||
}
|
||||
-105
@@ -1,105 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.internal.statistic.customUsageCollectors.ui;
|
||||
|
||||
import com.intellij.ide.GeneralSettings;
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.openapi.editor.ex.EditorSettingsExternalizable;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.intellij.internal.statistic.utils.StatisticsUtilKt.getBooleanUsage;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
class UiInfoUsageCollector extends UsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages() {
|
||||
Set<UsageDescriptor> set = new THashSet<>();
|
||||
|
||||
add(set, "Nav Bar visible", navbar() ? 1 : 0);
|
||||
add(set, "Nav Bar floating", navbar() ? 0 : 1);
|
||||
add(set, "Toolbar visible", toolbar() ? 1 : 0);
|
||||
add(set, "Toolbar hidden", toolbar() ? 0 : 1);
|
||||
add(set, "Toolbar + NavBar", !toolbar() && navbar() ? 1 : 0);
|
||||
add(set, "Toolbar and NavBar hidden", !toolbar() && !navbar() ? 1 : 0);
|
||||
add(set, "Status bar visible", status() ? 1 : 0);
|
||||
add(set, "Status bar hidden", status() ? 0 : 1);
|
||||
add(set, "Tool Window buttons visible", stripes() ? 1 : 0);
|
||||
add(set, "Tool Window buttons hidden", stripes() ? 0 : 1);
|
||||
add(set, "Recent Files = 15", recent() == 15 ? 1 : 0);
|
||||
add(set, "Recent Files (15, 30]", 15 < recent() && recent() < 31 ? 1 : 0);
|
||||
add(set, "Recent Files (30, 50]", 30 < recent() && recent() < 51 ? 1 : 0);
|
||||
add(set, "Recent Files > 50", 50 < recent() ? 1 : 0);
|
||||
add(set, "Block cursor", EditorSettingsExternalizable.getInstance().isBlockCursor() ? 1 : 0);
|
||||
add(set, "Line Numbers", EditorSettingsExternalizable.getInstance().isLineNumbersShown() ? 1 : 0);
|
||||
add(set, "Gutter Icons", EditorSettingsExternalizable.getInstance().areGutterIconsShown() ? 1 : 0);
|
||||
add(set, "Soft Wraps", EditorSettingsExternalizable.getInstance().isUseSoftWraps() ? 1 : 0);
|
||||
add(set, "Tabs None", tabPlace() == 0 ? 1 : 0);
|
||||
add(set, "Tabs Top", tabPlace() == SwingConstants.TOP ? 1 : 0);
|
||||
add(set, "Tabs Bottom", tabPlace() == SwingConstants.BOTTOM ? 1 : 0);
|
||||
add(set, "Tabs Left", tabPlace() == SwingConstants.LEFT ? 1 : 0);
|
||||
add(set, "Tabs Right", tabPlace() == SwingConstants.RIGHT ? 1 : 0);
|
||||
add(set, "Retina", UIUtil.isRetina() ? 1 : 0);
|
||||
add(set, "Show tips on startup", GeneralSettings.getInstance().isShowTipsOnStartup() ? 1 : 0);
|
||||
set.add(getBooleanUsage("Allow merging buttons", UISettings.getInstance().getAllowMergeButtons()));
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GroupDescriptor.create("UI Features");
|
||||
}
|
||||
|
||||
private static void add(Set<UsageDescriptor> set, String key, int value) {
|
||||
set.add(new UsageDescriptor(key, value));
|
||||
}
|
||||
|
||||
private static int tabPlace() {
|
||||
return UISettings.getInstance().getEditorTabPlacement();
|
||||
}
|
||||
|
||||
private static int recent() {
|
||||
return UISettings.getInstance().getRecentFilesLimit();
|
||||
}
|
||||
|
||||
private static boolean stripes() {
|
||||
return UISettings.getInstance().getHideToolStripes();
|
||||
}
|
||||
|
||||
private static boolean status() {
|
||||
return UISettings.getInstance().getShowStatusBar();
|
||||
}
|
||||
|
||||
private static boolean toolbar() {
|
||||
return UISettings.getInstance().getShowMainToolbar();
|
||||
}
|
||||
|
||||
private static boolean navbar() {
|
||||
return UISettings.getInstance().getShowNavigationBar();
|
||||
}
|
||||
}
|
||||
+2
-9
@@ -2,6 +2,7 @@
|
||||
package com.intellij.internal.statistic.service.fus.beans;
|
||||
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.UsageDescriptorKeyValidator;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -11,24 +12,16 @@ import java.util.Set;
|
||||
|
||||
public class FSGroup {
|
||||
|
||||
private static final String FORBIDDEN_PATTERN = "[,\\s\\n]+";
|
||||
private static final String FORBIDDEN_PATTERN_REPLACEMENT = "[??]";
|
||||
|
||||
public String id;
|
||||
public Map<String, Integer> metrics ;
|
||||
|
||||
private FSGroup(String id, Set<UsageDescriptor> usages) {
|
||||
this.id = id;
|
||||
for (UsageDescriptor usage : usages) {
|
||||
getMetrics().put(replaceForbiddenPattern(usage), usage.getValue());
|
||||
getMetrics().put(UsageDescriptorKeyValidator.replaceForbiddenSymbols(usage.getKey()), usage.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String replaceForbiddenPattern(@NotNull UsageDescriptor usage) {
|
||||
return usage.getKey().replaceAll(FORBIDDEN_PATTERN, FORBIDDEN_PATTERN_REPLACEMENT);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Map<String, Integer> getMetrics() {
|
||||
if (metrics == null) {
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal.statistic.service.fus.collectors;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class UsageDescriptorKeyValidator {
|
||||
public static final String FORBIDDEN_PATTERN = "[,\\s\\n]+";
|
||||
public static final String FORBIDDEN_PATTERN_REPLACEMENT = "[??]";
|
||||
|
||||
@NotNull
|
||||
public static String replaceForbiddenSymbols(@NotNull String key) {
|
||||
return key.replaceAll(FORBIDDEN_PATTERN, FORBIDDEN_PATTERN_REPLACEMENT);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String ensureProperKey(@NotNull String key) {
|
||||
return key.replaceAll(FORBIDDEN_PATTERN, ".");
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ package com.intellij.openapi.actionSystem.impl;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.ide.HelpTooltip;
|
||||
import com.intellij.internal.statistic.customUsageCollectors.ui.ToolbarClicksCollector;
|
||||
import com.intellij.internal.statistic.collectors.fus.ui.persistence.ToolbarClicksCollector;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionButtonLook;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
|
||||
|
||||
+2
-2
@@ -10,8 +10,8 @@ import com.intellij.ide.plugins.IdeaPluginDescriptor;
|
||||
import com.intellij.ide.plugins.PluginManager;
|
||||
import com.intellij.ide.plugins.PluginManagerCore;
|
||||
import com.intellij.idea.IdeaLogger;
|
||||
import com.intellij.internal.statistic.customUsageCollectors.actions.ActionIdProvider;
|
||||
import com.intellij.internal.statistic.customUsageCollectors.actions.ActionsCollectorImpl;
|
||||
import com.intellij.internal.statistic.collectors.fus.actions.persistence.ActionIdProvider;
|
||||
import com.intellij.internal.statistic.collectors.fus.actions.persistence.ActionsCollectorImpl;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ package com.intellij.openapi.actionSystem.impl;
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.ide.ui.laf.IconCache;
|
||||
import com.intellij.internal.statistic.customUsageCollectors.actions.MainMenuCollector;
|
||||
import com.intellij.internal.statistic.collectors.fus.actions.persistence.MainMenuCollector;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.ide.HelpTooltip;
|
||||
import com.intellij.ide.impl.DataManagerImpl;
|
||||
import com.intellij.internal.statistic.customUsageCollectors.ui.ToolbarClicksCollector;
|
||||
import com.intellij.internal.statistic.collectors.fus.ui.persistence.ToolbarClicksCollector;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionButtonLook;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
package com.intellij.openapi.application;
|
||||
|
||||
import com.intellij.ide.cloudConfig.CloudConfigProvider;
|
||||
import com.intellij.internal.statistic.customUsageCollectors.ideSettings.IdeInitialConfigButtonUsages;
|
||||
import com.intellij.internal.statistic.collectors.legacy.ideSettings.IdeInitialConfigButtonUsages;
|
||||
import com.intellij.openapi.MnemonicHelper;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.openapi.editor.actions;
|
||||
|
||||
@@ -18,7 +18,6 @@ import com.intellij.openapi.editor.highlighter.HighlighterIterator;
|
||||
import com.intellij.openapi.editor.impl.EditorImpl;
|
||||
import com.intellij.openapi.editor.impl.FoldingModelImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
@@ -235,7 +234,8 @@ public class EditorActionUtil {
|
||||
IElementType rightToken = it.getTokenType();
|
||||
it.retreat();
|
||||
IElementType leftToken = it.getTokenType();
|
||||
return !Comparing.equal(leftToken, rightToken);
|
||||
if (leftToken == null || rightToken == null) return false;
|
||||
return LanguageWordBoundaryFilter.INSTANCE.forLanguage(leftToken.getLanguage()).isWordBoundary(leftToken, rightToken);
|
||||
}
|
||||
|
||||
public static boolean isWordStart(@NotNull CharSequence text, int offset, boolean isCamel) {
|
||||
|
||||
+8
-12
@@ -274,23 +274,19 @@ public class EditorsSplitters extends IdePanePanel implements UISettingsListener
|
||||
mySplittersElement = element;
|
||||
}
|
||||
|
||||
@NotNull public VirtualFile[] getOpenFiles() {
|
||||
final Set<VirtualFile> files = new ArrayListSet<>();
|
||||
for (final EditorWindow myWindow : myWindows) {
|
||||
final EditorWithProviderComposite[] editors = myWindow.getEditors();
|
||||
for (final EditorWithProviderComposite editor : editors) {
|
||||
VirtualFile file = editor.getFile();
|
||||
// background thread may call this method when invalid file is being removed
|
||||
// do not return it here as it will quietly drop out soon
|
||||
if (file.isValid()) {
|
||||
files.add(file);
|
||||
}
|
||||
@NotNull
|
||||
public VirtualFile[] getOpenFiles() {
|
||||
Set<VirtualFile> files = new ArrayListSet<>();
|
||||
for (EditorWindow myWindow : myWindows) {
|
||||
for (EditorWithProviderComposite editor : myWindow.getEditors()) {
|
||||
files.add(editor.getFile());
|
||||
}
|
||||
}
|
||||
return VfsUtilCore.toVirtualFileArray(files);
|
||||
}
|
||||
|
||||
@NotNull public VirtualFile[] getSelectedFiles() {
|
||||
@NotNull
|
||||
public VirtualFile[] getSelectedFiles() {
|
||||
final Set<VirtualFile> files = new ArrayListSet<>();
|
||||
for (final EditorWindow window : myWindows) {
|
||||
final VirtualFile file = window.getSelectedFile();
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ import com.intellij.ide.DataManager;
|
||||
import com.intellij.ide.IdeEventQueue;
|
||||
import com.intellij.ide.ProhibitAWTEvents;
|
||||
import com.intellij.ide.impl.DataManagerImpl;
|
||||
import com.intellij.internal.statistic.customUsageCollectors.ui.ShortcutsCollector;
|
||||
import com.intellij.internal.statistic.collectors.fus.ui.persistence.ShortcutsCollector;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package com.intellij.openapi.keymap.impl;
|
||||
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.ide.IdeEventQueue;
|
||||
import com.intellij.internal.statistic.customUsageCollectors.ui.ShortcutsCollector;
|
||||
import com.intellij.internal.statistic.collectors.fus.ui.persistence.ShortcutsCollector;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.ide.ui.UISettingsListener;
|
||||
import com.intellij.internal.statistic.customUsageCollectors.ui.ToolbarClicksCollector;
|
||||
import com.intellij.internal.statistic.collectors.fus.ui.persistence.ToolbarClicksCollector;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package com.intellij.ui.plaf.beg;
|
||||
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.internal.statistic.customUsageCollectors.actions.MainMenuCollector;
|
||||
import com.intellij.internal.statistic.collectors.fus.actions.persistence.MainMenuCollector;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.impl.ActionMenuItem;
|
||||
|
||||
@@ -54,6 +54,11 @@
|
||||
<extensionPoint name="codeInsight.unresolvedReferenceQuickFixProvider"
|
||||
interface="com.intellij.codeInsight.quickfix.UnresolvedReferenceQuickFixProvider"/>
|
||||
|
||||
<extensionPoint name="wordBoundaryFilter"
|
||||
beanClass="com.intellij.lang.LanguageExtensionPoint">
|
||||
<with attribute="implementationClass" implements="com.intellij.openapi.editor.actions.WordBoundaryFilter"/>
|
||||
</extensionPoint>
|
||||
|
||||
<extensionPoint name="bidiRegionsSeparator"
|
||||
beanClass="com.intellij.lang.LanguageExtensionPoint">
|
||||
<with attribute="implementationClass" implements="com.intellij.openapi.editor.bidi.BidiRegionsSeparator"/>
|
||||
|
||||
@@ -906,11 +906,13 @@
|
||||
<copyPastePostProcessor implementation="com.intellij.codeInsight.editorActions.CopyPasteIndentProcessor"/>
|
||||
<copyPastePostProcessor implementation="com.intellij.codeInsight.editorActions.CopyPasteFoldingProcessor"/>
|
||||
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.fileTypes.LegacyFileTypeUsagesCollector"/>
|
||||
<statistics.projectUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.fileTypes.FileTypeUsagesCollector"/>
|
||||
|
||||
<statistics.usagesCollector implementation="com.intellij.facet.impl.statistics.FrameworkUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.facet.impl.statistics.ModuleTypeUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.execution.impl.statistics.RunConfigurationTypeUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.execution.impl.statistics.TemporaryRunConfigurationTypeUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.openapi.fileTypes.FileTypeUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.editor.LegacyEditorSettingsStatisticsCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.editor.LegacyEditorSettingsStatisticsCollector$ProjectUsages"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.editor.EditorSettingsStatisticsCollector"/>
|
||||
|
||||
@@ -202,12 +202,12 @@
|
||||
|
||||
<applicationService serviceImplementation="com.intellij.internal.statistic.UsageTrigger"/>
|
||||
<projectService serviceImplementation="com.intellij.internal.statistic.service.fus.collectors.FUSUsageTrigger"/>
|
||||
<applicationService serviceImplementation="com.intellij.internal.statistic.customUsageCollectors.ui.ToolbarClicksCollector"/>
|
||||
<applicationService serviceImplementation="com.intellij.internal.statistic.customUsageCollectors.ui.ShortcutsCollector"/>
|
||||
<applicationService serviceImplementation="com.intellij.internal.statistic.collectors.fus.ui.persistence.ToolbarClicksCollector"/>
|
||||
<applicationService serviceImplementation="com.intellij.internal.statistic.collectors.fus.ui.persistence.ShortcutsCollector"/>
|
||||
<applicationService serviceInterface="com.intellij.ide.actions.ActionsCollector"
|
||||
serviceImplementation="com.intellij.internal.statistic.customUsageCollectors.actions.ActionsCollectorImpl"/>
|
||||
<applicationService serviceImplementation="com.intellij.internal.statistic.customUsageCollectors.actions.MainMenuCollector"/>
|
||||
<applicationService serviceImplementation="com.intellij.internal.statistic.customUsageCollectors.actions.IntentionsCollector"/>
|
||||
serviceImplementation="com.intellij.internal.statistic.collectors.fus.actions.persistence.ActionsCollectorImpl"/>
|
||||
<applicationService serviceImplementation="com.intellij.internal.statistic.collectors.fus.actions.persistence.MainMenuCollector"/>
|
||||
<applicationService serviceImplementation="com.intellij.internal.statistic.collectors.fus.actions.persistence.IntentionsCollector"/>
|
||||
|
||||
<applicationService serviceImplementation="com.intellij.openapi.util.DimensionService"/>
|
||||
<applicationService serviceInterface="com.intellij.openapi.util.WindowStateService"
|
||||
@@ -387,42 +387,66 @@
|
||||
|
||||
<keymapExtension implementation="com.intellij.ide.actions.ToolWindowKeymapExtension"/>
|
||||
|
||||
<statistics.usagesCollector implementation="com.intellij.ide.plugins.DisabledPluginsUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.ide.plugins.NonBundledPluginsUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.featureStatistics.FeaturesUsageCollector"/>
|
||||
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.featureStatistics.fusCollectors.ProductivityUsageCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.ProductivityUsageCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.plugins.DisabledPluginsUsagesCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.plugins.NonBundledPluginsUsagesCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.ui.ToolbarClicksUsagesCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.ui.EditorColorSchemesUsagesCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.actions.ActionUsagesCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.actions.IntentionUsagesCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.actions.MainMenuUsagesCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.jdk.JdkInfoUsageCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.os.OsNameUsageCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.os.OsVersionUsageCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.ui.FontSizeInfoUsageCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.ui.HiDPIModeUsagesCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.ui.LaFUsagesCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.ui.ScaleInfoUsageCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.ui.ShortcutUsagesCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.ui.UiInfoUsageCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.collectors.fus.ui.A11YUsagesCollector"/>
|
||||
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.productivity.LegacyProductivityFeaturesUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.plugins.LegacyDisabledPluginsUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.plugins.LegacyNonBundledPluginsUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.ui.LegacyToolbarClicksUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.ui.LegacyEditorColorSchemesUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.actions.LegacyActionUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.actions.LegacyIntentionUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.actions.LegacyMainMenuUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.jdk.LegacyJdkInfoUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.os.LegacyOsNameUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.os.LegacyOsVersionUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.ui.LegacyFontSizeInfoUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.ui.LegacyHiDPIModeUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.ui.LegacyLaFUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.ui.LegacyScaleInfoUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.ui.LegacyShortcutUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.ui.LegacyUiInfoUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.ui.LegacyUiInfoUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.ui.LegacyA11YUsagesCollector"/>
|
||||
|
||||
<statistics.projectUsagesCollector implementation="com.intellij.openapi.vcs.statistics.VcsOptionsUsagesCollector"/>
|
||||
<statistics.projectUsagesCollector implementation="com.intellij.openapi.vcs.statistics.VcsStatsUsagesCollector"/>
|
||||
<statistics.projectUsagesCollector implementation="com.intellij.openapi.vcs.statistics.VcsNamesUsagesCollector"/>
|
||||
|
||||
<statistics.usagesCollector implementation="com.intellij.openapi.vcs.statistics.LegacyVcsOptionsUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.openapi.vcs.statistics.LegacyVcsStatsUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.openapi.vcs.statistics.LegacyVcsUsagesCollector"/>
|
||||
|
||||
<statistics.usagesCollector implementation="com.intellij.openapi.vcs.statistics.VcsUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.openapi.vcs.statistics.VcsOptionsUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.openapi.vcs.statistics.VcsStatsUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.UsageTrigger$MyCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.ui.ToolbarClicksCollector$ToolbarClicksUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.ui.ShortcutsCollector$ShortcutUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.actions.ActionsCollectorImpl$ActionUsagesCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.actions.ActionsCollectorImpl$ActionUsagesCollectorNew"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.actions.IntentionsCollector$IntentionUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.ExperimentalFeaturesUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.RegistryUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.actions.MainMenuCollector$MainMenuUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.ui.LaFUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.os.OsNameUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.os.OsVersionUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.ui.UiInfoUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.jdk.JdkInfoUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.jdk.JdkSettingsUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.ui.FontSizeInfoUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.build.BuildNumberUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.ui.ScaleInfoUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.ui.HiDPIModeUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.ui.A11YUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.ideSettings.IdeInitialConfigUsageCollectors$ConfigImport"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.ideSettings.IdeInitialConfigUsageCollectors$SkipSteps"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.ideSettings.IdeInitialConfigUsageCollectors$SelectedLAF"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.ideSettings.IdeInitialConfigUsageCollectors$SelectedKeymap"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.ideSettings.IdeInitialConfigUsageCollectors$DisabledPlugins"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.customUsageCollectors.ideSettings.IdeInitialConfigUsageCollectors$DownloadedPlugins"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.openapi.editor.colors.impl.EditorColorSchemesUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.ExperimentalFeaturesUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.LegacyRegistryUsagesCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.jdk.JdkSettingsUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.build.BuildNumberUsageCollector"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.ideSettings.IdeInitialConfigUsageCollectors$ConfigImport"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.ideSettings.IdeInitialConfigUsageCollectors$SkipSteps"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.ideSettings.IdeInitialConfigUsageCollectors$SelectedLAF"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.ideSettings.IdeInitialConfigUsageCollectors$SelectedKeymap"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.ideSettings.IdeInitialConfigUsageCollectors$DisabledPlugins"/>
|
||||
<statistics.usagesCollector implementation="com.intellij.internal.statistic.collectors.legacy.ideSettings.IdeInitialConfigUsageCollectors$DownloadedPlugins"/>
|
||||
|
||||
|
||||
<statistic.eventLog.featureUsageEventLogger implementation="com.intellij.internal.statistic.eventLog.FeatureUsageFileEventLogger"/>
|
||||
|
||||
|
||||
+7
-15
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.editor.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
@@ -57,6 +43,12 @@ public class NextPrevWordTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
myFixture.checkResult("class Foo { String s = \"a\\x<caret>b\"; }");
|
||||
}
|
||||
|
||||
public void testNextWordAtGreaterThanEqualOperator() {
|
||||
myFixture.configureByText("Foo.java", "class Foo { boolean b = 1 <caret>>= 2; }");
|
||||
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_NEXT_WORD);
|
||||
myFixture.checkResult("class Foo { boolean b = 1 >= <caret>2; }");
|
||||
}
|
||||
|
||||
public void testPrevNextWordWithFolding() {
|
||||
myFixture.configureByText("a.txt", "<caret>brown fox");
|
||||
EditorTestUtil.addFoldRegion(myFixture.getEditor(), 4, 7, "...", true);
|
||||
|
||||
+2
-1
@@ -17,6 +17,7 @@ package com.intellij.openapi.fileTypes;
|
||||
|
||||
import com.intellij.internal.statistic.CollectUsagesException;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.collectors.legacy.fileTypes.LegacyFileTypeUsagesCollector;
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
|
||||
import com.intellij.util.NotNullFunction;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -32,7 +33,7 @@ import java.util.Set;
|
||||
public class FileTypeUsagesCollectorTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
|
||||
private void doTest(@NotNull Collection<FileType> fileTypes) throws CollectUsagesException {
|
||||
final Set<UsageDescriptor> usages = new FileTypeUsagesCollector().getProjectUsages(getProject());
|
||||
final Set<UsageDescriptor> usages = new LegacyFileTypeUsagesCollector().getProjectUsages(getProject());
|
||||
for (UsageDescriptor usage : usages) {
|
||||
assertEquals(1, usage.getValue());
|
||||
}
|
||||
|
||||
@@ -1122,6 +1122,13 @@ cidr.test.framework.targetTypeFromHeaderDetectionEnable.description=Checks the t
|
||||
cidr.show.breadcrumbs=true
|
||||
cidr.show.breadcrumbs.description="Show breadcrumbs for C/C++/ObjC languages"
|
||||
|
||||
cidr.indent.lexer.only.objc=false
|
||||
cidr.indent.lexer.only.objc.description=Enables indentation in the Objective-C files from the information of the lexer \
|
||||
(fast, but may lose an alignment when typing).
|
||||
cidr.indent.lexer.only.cpp=false
|
||||
cidr.indent.lexer.only.cpp.description=Enables indentation in the C and C++ files from the information of the lexer \
|
||||
(fast, but may lose an alignment when typing).
|
||||
|
||||
clion.enable.objc.settings=false
|
||||
clion.enable.objc.settings.description=Enables Objective-C-specific code style, colors etc. settings.
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ public class ChangeListWorker {
|
||||
tracker.initChangeTracking(myDefault.id, ContainerUtil.map(myLists, list -> list.id), oldList != null ? oldList.id : null);
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug(String.format("[registerChangeTracker] path: %s", filePath));
|
||||
LOG.debug(String.format("[registerChangeTracker] path: %s, old list: %s", filePath, oldList != null ? oldList.id : "null"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,21 +177,24 @@ public class ChangeListWorker {
|
||||
PartialChangeTracker oldTracker = myPartialChangeTrackers.remove(filePath);
|
||||
if (!Comparing.equal(oldTracker, tracker)) {
|
||||
LOG.error(String.format("Wrong tracker removed: %s; expected: %s; passed: %s", filePath, oldTracker, tracker));
|
||||
return;
|
||||
}
|
||||
|
||||
ListData newList = null;
|
||||
Change change = getChangeForAfterPath(filePath);
|
||||
if (change != null) {
|
||||
putChangeMapping(change, getMainList(oldTracker));
|
||||
newList = getMainList(oldTracker);
|
||||
putChangeMapping(change, newList);
|
||||
}
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug(String.format("[unregisterChangeTracker] path: %s", filePath));
|
||||
LOG.debug(String.format("[unregisterChangeTracker] path: %s, new list: %s, tracker lists: %s",
|
||||
filePath, newList != null ? newList.id : "null", oldTracker.getAffectedChangeListsIds()));
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private ListData getMainList(@Nullable PartialChangeTracker oldTracker) {
|
||||
if (oldTracker == null) return myDefault;
|
||||
private ListData getMainList(@NotNull PartialChangeTracker oldTracker) {
|
||||
List<String> changelistIds = oldTracker.getAffectedChangeListsIds();
|
||||
if (changelistIds.size() == 1) {
|
||||
ListData list = getDataByIdVerify(changelistIds.get(0));
|
||||
@@ -846,7 +849,7 @@ public class ChangeListWorker {
|
||||
return String.format("list: %s (%s) changes: %s", list.name, list.id, StringUtil.join(getChangesIn(list), ", "));
|
||||
}, "\n");
|
||||
String trackers = StringUtil.join(myPartialChangeTrackers.keySet(), ",");
|
||||
return String.format("ChangeListWorker{ lists = {\n%s }\ntrackers = %s\n}", lists, trackers);
|
||||
return String.format("ChangeListWorker{ default = %s, lists = {\n%s }\ntrackers = %s\n}", myDefault.id, lists, trackers);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,11 +15,13 @@
|
||||
*/
|
||||
package com.intellij.openapi.vcs.checkout;
|
||||
|
||||
import com.intellij.internal.statistic.customUsageCollectors.actions.ActionIdProvider;
|
||||
import com.intellij.internal.statistic.collectors.fus.actions.persistence.ActionIdProvider;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.project.*;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.vcs.CheckoutProvider;
|
||||
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
|
||||
|
||||
|
||||
@@ -165,6 +165,8 @@ class PartialLocalLineStatusTracker(project: Project,
|
||||
}
|
||||
}
|
||||
|
||||
updateAffectedChangeLists()
|
||||
|
||||
dropExistingUndoActions()
|
||||
if (isValid()) eventDispatcher.multicaster.onBecomingValid(this)
|
||||
}
|
||||
|
||||
@@ -61,10 +61,10 @@ import com.intellij.openapi.wm.ToolWindowManager
|
||||
import com.intellij.testFramework.LightVirtualFile
|
||||
import com.intellij.util.EventDispatcher
|
||||
import com.intellij.util.concurrency.AppExecutorUtil
|
||||
import com.intellij.util.concurrency.Semaphore
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import com.intellij.vcsUtil.VcsUtil
|
||||
import org.jetbrains.annotations.CalledInAny
|
||||
import org.jetbrains.annotations.CalledInAwt
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.annotations.*
|
||||
import java.nio.charset.Charset
|
||||
import java.util.*
|
||||
|
||||
@@ -152,7 +152,7 @@ class LineStatusTrackerManager(
|
||||
}
|
||||
trackers.clear()
|
||||
|
||||
loader.clear()
|
||||
loader.dispose()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -476,7 +476,7 @@ class LineStatusTrackerManager(
|
||||
}
|
||||
}
|
||||
|
||||
private inner class MyBaseRevisionLoader() : SingleThreadLoader<RefreshRequest, RefreshData>(project) {
|
||||
private inner class MyBaseRevisionLoader : SingleThreadLoader<RefreshRequest, RefreshData>() {
|
||||
override fun loadRequest(request: RefreshRequest): Result<RefreshData> {
|
||||
if (isDisposed) return Result.Canceled()
|
||||
val document = request.document
|
||||
@@ -527,67 +527,60 @@ class LineStatusTrackerManager(
|
||||
return Result.Success(RefreshData(converted, newContentInfo))
|
||||
}
|
||||
|
||||
@CalledInAwt
|
||||
override fun handleResult(request: RefreshRequest, result: Result<RefreshData>) {
|
||||
val document = request.document
|
||||
when (result) {
|
||||
is Result.Canceled -> {
|
||||
synchronized(LOCK) {
|
||||
val virtualFile = fileDocumentManager.getFile(document)
|
||||
if (virtualFile == null) return
|
||||
val virtualFile = fileDocumentManager.getFile(document) ?: return
|
||||
|
||||
val state = fileStatesAwaitingRefresh.remove(virtualFile)
|
||||
if (state == null) return
|
||||
val state = synchronized(LOCK) {
|
||||
fileStatesAwaitingRefresh.remove(virtualFile) ?: return
|
||||
}
|
||||
|
||||
runInEdt(ModalityState.any()) {
|
||||
val tracker = getLineStatusTracker(document)
|
||||
if (tracker is PartialLocalLineStatusTracker) {
|
||||
tracker.restoreState(state)
|
||||
log("Loading canceled: state restored", virtualFile)
|
||||
}
|
||||
}
|
||||
val tracker = getLineStatusTracker(document)
|
||||
if (tracker is PartialLocalLineStatusTracker) {
|
||||
tracker.restoreState(state)
|
||||
log("Loading canceled: state restored", virtualFile)
|
||||
}
|
||||
}
|
||||
is Result.Error -> {
|
||||
runInEdt(ModalityState.any()) {
|
||||
synchronized(LOCK) {
|
||||
val data = trackers[document] ?: return@runInEdt
|
||||
synchronized(LOCK) {
|
||||
val data = trackers[document] ?: return
|
||||
|
||||
data.tracker.dropBaseRevision()
|
||||
data.contentInfo = null
|
||||
data.tracker.dropBaseRevision()
|
||||
data.contentInfo = null
|
||||
|
||||
checkIfTrackerCanBeReleased(document)
|
||||
}
|
||||
checkIfTrackerCanBeReleased(document)
|
||||
}
|
||||
}
|
||||
is Result.Success -> {
|
||||
runInEdt(ModalityState.any()) {
|
||||
val virtualFile = fileDocumentManager.getFile(document)!!
|
||||
val refreshData = result.data
|
||||
val virtualFile = fileDocumentManager.getFile(document)!!
|
||||
val refreshData = result.data
|
||||
|
||||
synchronized(LOCK) {
|
||||
val data = trackers[document]
|
||||
if (data == null) {
|
||||
log("Loading finished: tracker already released", virtualFile)
|
||||
return@runInEdt
|
||||
}
|
||||
if (!shouldBeUpdated(data.contentInfo, refreshData.info)) {
|
||||
log("Loading finished: no need to update", virtualFile)
|
||||
return@runInEdt
|
||||
}
|
||||
|
||||
data.contentInfo = refreshData.info
|
||||
synchronized(LOCK) {
|
||||
val data = trackers[document]
|
||||
if (data == null) {
|
||||
log("Loading finished: tracker already released", virtualFile)
|
||||
return
|
||||
}
|
||||
if (!shouldBeUpdated(data.contentInfo, refreshData.info)) {
|
||||
log("Loading finished: no need to update", virtualFile)
|
||||
return
|
||||
}
|
||||
|
||||
val tracker = getLineStatusTracker(document)!!
|
||||
tracker.setBaseRevision(refreshData.text)
|
||||
log("Loading finished: success", virtualFile)
|
||||
data.contentInfo = refreshData.info
|
||||
}
|
||||
|
||||
if (tracker is PartialLocalLineStatusTracker) {
|
||||
val state = fileStatesAwaitingRefresh.remove(tracker.virtualFile)
|
||||
if (state != null) {
|
||||
tracker.restoreState(state)
|
||||
log("Loading finished: state restored", virtualFile)
|
||||
}
|
||||
val tracker = getLineStatusTracker(document)!!
|
||||
tracker.setBaseRevision(refreshData.text)
|
||||
log("Loading finished: success", virtualFile)
|
||||
|
||||
if (tracker is PartialLocalLineStatusTracker) {
|
||||
val state = fileStatesAwaitingRefresh.remove(tracker.virtualFile)
|
||||
if (state != null) {
|
||||
tracker.restoreState(state)
|
||||
log("Loading finished: state restored", virtualFile)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -962,6 +955,43 @@ class LineStatusTrackerManager(
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@TestOnly
|
||||
fun waitUntilBaseContentsLoaded() {
|
||||
val semaphore = Semaphore()
|
||||
semaphore.down()
|
||||
|
||||
loader.addAfterUpdateRunnable(Runnable {
|
||||
semaphore.up()
|
||||
})
|
||||
|
||||
val start = System.currentTimeMillis()
|
||||
while (true) {
|
||||
if (ApplicationManager.getApplication().isDispatchThread) {
|
||||
UIUtil.dispatchAllInvocationEvents()
|
||||
}
|
||||
if (semaphore.waitFor(10)) {
|
||||
return
|
||||
}
|
||||
if (System.currentTimeMillis() - start > 2000) {
|
||||
throw IllegalStateException("Couldn't await base contents")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
fun releaseAllTrackers() {
|
||||
synchronized(LOCK) {
|
||||
forcedDocuments.clear()
|
||||
|
||||
for (data in trackers.values) {
|
||||
unregisterTrackerInCLM(data)
|
||||
data.tracker.release()
|
||||
}
|
||||
trackers.clear()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -971,7 +1001,7 @@ class LineStatusTrackerManager(
|
||||
* - Allows to check whether request is scheduled or is waiting for completion.
|
||||
* - Notifies callbacks when queue is exhausted.
|
||||
*/
|
||||
private abstract class SingleThreadLoader<Request, T>(private val project: Project) {
|
||||
private abstract class SingleThreadLoader<Request, T> {
|
||||
private val LOG = Logger.getInstance(SingleThreadLoader::class.java)
|
||||
private val LOCK: Any = Any()
|
||||
|
||||
@@ -983,15 +1013,19 @@ private abstract class SingleThreadLoader<Request, T>(private val project: Proje
|
||||
private val callbacksWaitingUpdateCompletion = ArrayList<Runnable>()
|
||||
|
||||
private var isScheduled: Boolean = false
|
||||
private var isDisposed: Boolean = false
|
||||
|
||||
|
||||
@CalledInBackground
|
||||
protected abstract fun loadRequest(request: Request): Result<T>
|
||||
|
||||
@CalledInAwt
|
||||
protected abstract fun handleResult(request: Request, result: Result<T>)
|
||||
|
||||
|
||||
@CalledInAwt
|
||||
fun scheduleRefresh(request: Request) {
|
||||
if (isDisposed()) return
|
||||
if (isDisposed) return
|
||||
|
||||
synchronized(LOCK) {
|
||||
if (taskQueue.contains(request)) return
|
||||
@@ -1002,9 +1036,10 @@ private abstract class SingleThreadLoader<Request, T>(private val project: Proje
|
||||
}
|
||||
|
||||
@CalledInAwt
|
||||
fun clear() {
|
||||
fun dispose() {
|
||||
val callbacks = mutableListOf<Runnable>()
|
||||
synchronized(LOCK) {
|
||||
isDisposed = true
|
||||
taskQueue.clear()
|
||||
waitingForRefresh.clear()
|
||||
|
||||
@@ -1050,7 +1085,7 @@ private abstract class SingleThreadLoader<Request, T>(private val project: Proje
|
||||
|
||||
|
||||
private fun schedule() {
|
||||
if (isDisposed()) return
|
||||
if (isDisposed) return
|
||||
|
||||
synchronized(LOCK) {
|
||||
if (isScheduled) return
|
||||
@@ -1068,7 +1103,7 @@ private abstract class SingleThreadLoader<Request, T>(private val project: Proje
|
||||
val request = synchronized(LOCK) {
|
||||
val request = taskQueue.poll()
|
||||
|
||||
if (isDisposed() || request == null) {
|
||||
if (isDisposed || request == null) {
|
||||
isScheduled = false
|
||||
return
|
||||
}
|
||||
@@ -1091,14 +1126,18 @@ private abstract class SingleThreadLoader<Request, T>(private val project: Proje
|
||||
}
|
||||
|
||||
runInEdt(ModalityState.any()) {
|
||||
handleResult(request, result)
|
||||
notifyTrackerRefreshed(request)
|
||||
try {
|
||||
handleResult(request, result)
|
||||
}
|
||||
finally {
|
||||
notifyTrackerRefreshed(request)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@CalledInAwt
|
||||
private fun notifyTrackerRefreshed(request: Request) {
|
||||
if (isDisposed()) return
|
||||
if (isDisposed) return
|
||||
|
||||
val callbacks = mutableListOf<Runnable>()
|
||||
synchronized(LOCK) {
|
||||
@@ -1124,8 +1163,6 @@ private abstract class SingleThreadLoader<Request, T>(private val project: Proje
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun isDisposed() = project.isDisposed
|
||||
}
|
||||
|
||||
private sealed class Result<T> {
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.vcs.statistics;
|
||||
|
||||
import com.intellij.internal.statistic.AbstractProjectsUsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Deprecated // to be removed in 2018.2
|
||||
public class LegacyVcsOptionsUsagesCollector extends AbstractProjectsUsagesCollector {
|
||||
private static final String GROUP_ID = "vcs-options";
|
||||
|
||||
@NotNull
|
||||
public GroupDescriptor getGroupId() {
|
||||
return GroupDescriptor.create(GROUP_ID);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<UsageDescriptor> getProjectUsages(@NotNull Project project) {
|
||||
return VcsOptionsUsagesCollector.getDescriptors(project);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user