Merge remote-tracking branch 'origin/master'
authorEkaterina Tuzova <Ekaterina.Tuzova@jetbrains.com>
Sat, 20 Dec 2014 11:03:09 +0000 (14:03 +0300)
committerEkaterina Tuzova <Ekaterina.Tuzova@jetbrains.com>
Sat, 20 Dec 2014 11:03:09 +0000 (14:03 +0300)
227 files changed:
NOTICE.txt
build/conf/nsis/idea.nsi
build/scripts/libLicenses.gant
community-resources/src/idea/IdeaApplicationInfo.xml
java/compiler/impl/src/com/intellij/openapi/compiler/generic/GenericCompiler.java
java/compiler/openapi/src/com/intellij/openapi/compiler/ClassInstrumentingCompiler.java
java/compiler/openapi/src/com/intellij/openapi/compiler/ClassPostProcessingCompiler.java
java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerFilter.java
java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerManager.java
java/compiler/openapi/src/com/intellij/openapi/compiler/CopyingCompiler.java
java/compiler/openapi/src/com/intellij/openapi/compiler/GeneratingCompiler.java
java/compiler/openapi/src/com/intellij/openapi/compiler/IntermediateOutputCompiler.java
java/compiler/openapi/src/com/intellij/openapi/compiler/JavaSourceTransformingCompiler.java
java/compiler/openapi/src/com/intellij/openapi/compiler/PackagingCompiler.java
java/compiler/openapi/src/com/intellij/openapi/compiler/SourceGeneratingCompiler.java
java/compiler/openapi/src/com/intellij/openapi/compiler/SourceProcessingCompiler.java
java/compiler/openapi/src/com/intellij/openapi/compiler/TranslatingCompiler.java
java/debugger/impl/src/com/intellij/debugger/engine/JavaSimpleGetterProvider.java
java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java
java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java
java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/ArrayElementDescriptorImpl.java
java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/ValueDescriptorImpl.java
java/debugger/impl/src/com/intellij/debugger/ui/tree/render/ArrayRenderer.java
java/debugger/impl/src/com/intellij/debugger/ui/tree/render/ClassRenderer.java
java/idea-ui/src/com/intellij/jarFinder/InternetAttachSourceProvider.java
java/idea-ui/src/com/intellij/openapi/wm/impl/welcomeScreen/DevelopPluginsAction.java
java/idea-ui/src/com/intellij/platform/templates/IC_template_groups.xml
java/idea-ui/src/com/intellij/platform/templates/IU_template_groups.xml
java/idea-ui/src/com/intellij/platform/templates/IU_template_groups.xsd
java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocExternalFilter.java
java/java-impl/src/com/intellij/internal/statistic/libraryJar/LibraryJarStatisticsService.java
java/java-impl/src/com/intellij/jarFinder/MavenCentralSourceSearcher.java
java/java-impl/src/com/intellij/jarFinder/SonatypeSourceSearcher.java
java/java-impl/src/com/intellij/jarFinder/SourceSearcher.java
java/java-impl/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteProcessor.java
java/java-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteJavaCalleeChooser.java [new file with mode: 0644]
java/java-impl/src/com/intellij/refactoring/safeDelete/usageInfo/SafeDeleteMethodCalleeUsageInfo.java [new file with mode: 0644]
java/java-psi-api/src/com/intellij/psi/augment/PsiAugmentProvider.java
java/java-psi-impl/src/com/intellij/psi/impl/source/PsiTypeElementImpl.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/augment/LombokVal.java [new file with mode: 0644]
java/java-tests/testData/refactoring/safeDelete/DeleteMethodCascade.java [new file with mode: 0644]
java/java-tests/testData/refactoring/safeDelete/DeleteMethodCascadeOverridden.java [new file with mode: 0644]
java/java-tests/testData/refactoring/safeDelete/DeleteMethodCascadeOverridden_after.java [new file with mode: 0644]
java/java-tests/testData/refactoring/safeDelete/DeleteMethodCascadeRecursive.java [new file with mode: 0644]
java/java-tests/testData/refactoring/safeDelete/DeleteMethodCascadeRecursive_after.java [new file with mode: 0644]
java/java-tests/testData/refactoring/safeDelete/DeleteMethodCascade_after.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/codeInsight/daemon/PsiAugmentProviderTest.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/codeInsight/javadoc/ExternalJavadocPresentationTest.java
java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java
java/java-tests/testSrc/com/intellij/ide/fileStructure/JavaFileStructureFilteringTest.java
java/java-tests/testSrc/com/intellij/refactoring/RenameClassTest.java
java/java-tests/testSrc/com/intellij/refactoring/SafeDeleteTest.java
jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java
platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java
platform/core-api/src/com/intellij/psi/stubs/package-info.java
platform/core-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java
platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java
platform/core-impl/src/com/intellij/openapi/editor/impl/IntervalTree.java
platform/core-impl/src/com/intellij/openapi/editor/impl/IntervalTreeImpl.java
platform/core-impl/src/com/intellij/openapi/editor/impl/PersistentRangeMarkerUtil.java
platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java
platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/EmptyMarkupModel.java
platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/MarkupModelImpl.java
platform/external-system-api/src/com/intellij/openapi/externalSystem/settings/AbstractExternalSystemSettings.java
platform/lang-api/src/com/intellij/codeInsight/actions/CodeInsightAction.java
platform/lang-api/src/com/intellij/facet/frameworks/LibrariesDownloadConnectionService.java
platform/lang-api/src/com/intellij/facet/frameworks/SettingsConnectionService.java
platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/std/StdArrangementExtendableSettings.java
platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/std/StdArrangementSettings.java
platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/util/TitleWithToolbar.java
platform/lang-impl/src/com/intellij/codeInsight/actions/FormatChangedTextUtil.java
platform/lang-impl/src/com/intellij/codeInsight/documentation/AbstractExternalFilter.java
platform/lang-impl/src/com/intellij/codeInsight/generation/actions/ImplementMethodsAction.java
platform/lang-impl/src/com/intellij/codeInsight/generation/actions/OverrideMethodsAction.java
platform/lang-impl/src/com/intellij/codeInsight/generation/actions/PresentableActionHandlerBasedAction.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/codeInsight/generation/actions/PresentableLanguageCodeInsightActionHandler.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/codeInsight/highlighting/TemplateLanguageErrorFilter.java
platform/lang-impl/src/com/intellij/codeInsight/navigation/CtrlMouseHandler.java
platform/lang-impl/src/com/intellij/ide/actions/CreateFromTemplateAction.java
platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateManagerImpl.java
platform/lang-impl/src/com/intellij/injected/editor/FoldingModelWindow.java
platform/lang-impl/src/com/intellij/injected/editor/FoldingRegionWindow.java
platform/lang-impl/src/com/intellij/injected/editor/RangeMarkerWindow.java
platform/lang-impl/src/com/intellij/openapi/options/colors/pages/GeneralColorsPage.java
platform/lang-impl/src/com/intellij/openapi/vfs/encoding/FileEncodingConfigurable.java
platform/lang-impl/src/com/intellij/openapi/vfs/encoding/FileEncodingConfigurableProvider.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/platform/templates/github/DownloadUtil.java
platform/lang-impl/src/com/intellij/refactoring/changeSignature/CallerChooserBase.java
platform/lang-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteProcessor.java
platform/lang-impl/src/com/intellij/util/download/impl/FileDownloaderImpl.java
platform/platform-api/src/com/intellij/execution/process/CapturingProcessHandler.java
platform/platform-api/src/com/intellij/openapi/ui/popup/JBPopupFactory.java
platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java
platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java
platform/platform-api/src/com/intellij/util/io/HttpRequests.java
platform/platform-api/src/com/intellij/util/net/HttpProxySettingsUi.java
platform/platform-impl/src/com/intellij/ide/plugins/DisabledPluginsUsagesCollector.java
platform/platform-impl/src/com/intellij/ide/plugins/RepositoryHelper.java
platform/platform-impl/src/com/intellij/idea/StartupUtil.java
platform/platform-impl/src/com/intellij/internal/statistic/AbstractApplicationUsagesCollector.java
platform/platform-impl/src/com/intellij/internal/statistic/CollectUsagesException.java
platform/platform-impl/src/com/intellij/internal/statistic/JdkInfoUsageCollector.java
platform/platform-impl/src/com/intellij/internal/statistic/OsNameUsageCollector.java
platform/platform-impl/src/com/intellij/internal/statistic/OsVersionUsageCollector.java
platform/platform-impl/src/com/intellij/internal/statistic/StatisticsUploadAssistant.java
platform/platform-impl/src/com/intellij/internal/statistic/UiInfoUsageCollector.java
platform/platform-impl/src/com/intellij/internal/statistic/UsageTrigger.java
platform/platform-impl/src/com/intellij/internal/statistic/UsagesCollector.java
platform/platform-impl/src/com/intellij/internal/statistic/beans/UsageDescriptor.java
platform/platform-impl/src/com/intellij/internal/statistic/connect/StatisticsConnectionService.java
platform/platform-impl/src/com/intellij/internal/statistic/ideSettings/IdeSettingsStatisticsService.java [deleted file]
platform/platform-impl/src/com/intellij/internal/statistic/ideSettings/IdeSettingsUsagesCollector.java [deleted file]
platform/platform-impl/src/com/intellij/internal/statistic/persistence/ApplicationStatisticsPersistence.java
platform/platform-impl/src/com/intellij/internal/statistic/persistence/ApplicationStatisticsPersistenceComponent.java
platform/platform-impl/src/com/intellij/notification/impl/NotificationsConfigurable.java
platform/platform-impl/src/com/intellij/notification/impl/NotificationsConfigurableProvider.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/DiffRangeMarker.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/SimpleChange.java
platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/AdditionalTextAttributesEP.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldRegionImpl.java
platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableWrapper.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginDownloader.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java
platform/platform-impl/src/com/intellij/openapi/vfs/impl/http/DefaultRemoteContentProvider.java
platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualFileSystemEntry.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java
platform/platform-impl/src/com/intellij/remote/RemoteSdkException.java
platform/platform-impl/src/com/intellij/ui/EditorTextFieldCellRenderer.java
platform/platform-impl/src/com/intellij/util/io/HttpRequestsImpl.java [new file with mode: 0644]
platform/platform-resources-en/src/messages/XmlBundle.properties
platform/platform-resources/src/META-INF/LangExtensions.xml
platform/platform-resources/src/META-INF/PlatformExtensions.xml
platform/platform-resources/src/idea/PlatformApplicationInfo.xml
platform/platform-resources/src/idea/PlatformLangXmlApplicationInfo.xml
platform/platform-tests/testSrc/com/intellij/ide/updates/broken.xml
platform/platform-tests/testSrc/com/intellij/ide/updates/current.xml
platform/platform-tests/testSrc/com/intellij/ide/updates/idea-new9eap.xml
platform/platform-tests/testSrc/com/intellij/ide/updates/idea-newChannel-release.xml
platform/platform-tests/testSrc/com/intellij/ide/updates/idea-newChannel.xml
platform/platform-tests/testSrc/com/intellij/ide/updates/idea-newbuild.xml
platform/platform-tests/testSrc/com/intellij/ide/updates/idea-patchAvailable.xml
platform/platform-tests/testSrc/com/intellij/ide/updates/idea-same.xml
platform/platform-tests/testSrc/com/intellij/ide/updates/oneProductOnly.xml
platform/platform-tests/testSrc/com/intellij/ide/updates/updates.xml
platform/platform-tests/testSrc/com/intellij/usagesStatistics/RemotelyConfigurableStatServiceTest.java
platform/remote-servers/impl/src/META-INF/RemoteServers.xml
platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerListConfigurable.java
platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerListConfigurableProvider.java [new file with mode: 0644]
platform/script-debugger/backend/src/org/jetbrains/debugger/ValueModifier.java
platform/util/src/com/intellij/ui/JBAutoscroller.java
platform/util/src/com/intellij/util/containers/ObjectIntHashMap.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTreeRestorer.java
plugins/InspectionGadgets/testsrc/com/siyeh/ig/IGQuickFixesTestCase.java
plugins/IntentionPowerPak/src/com/siyeh/ipp/types/ExpandOneLineLambda2CodeBlockIntention.java
plugins/commander/src/META-INF/plugin.xml
plugins/copyright/src/META-INF/java.xml
plugins/coverage/src/META-INF/junit-integration.xml
plugins/coverage/src/META-INF/testng-integration.xml
plugins/devkit/resources/fileTemplates/j2ee/plugin.xml.ft
plugins/eclipse/resources/META-INF/plugin.xml
plugins/git4idea/remote-servers-git/src/META-INF/remote-servers-git.xml
plugins/git4idea/src/META-INF/plugin.xml
plugins/google-app-engine/resources/META-INF/google-app-engine-maven-support.xml
plugins/gradle/resources/i18n/GradleDocumentationBundle.properties
plugins/gradle/src/META-INF/plugin.xml
plugins/gradle/src/org/jetbrains/plugins/gradle/service/GradleInstallationManager.java
plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleImportingTestCase.java
plugins/gradle/tooling-extension-impl/testData/testGradleSourcesSetsInterpretation/build.gradle
plugins/gradle/tooling-extension-impl/testData/testModelBuildScriptClasspathBuilder/build.gradle
plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/GroovyImplementationSearch.java
plugins/groovy/src/org/jetbrains/plugins/groovy/ivy/AbstractAttachSourceProvider.java
plugins/java-decompiler/plugin/src/META-INF/plugin.xml
plugins/maven/maven3-server-impl/src/org/jetbrains/idea/maven/server/Maven3ServerEmbedderImpl.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/indices/MavenArtifactSearchPanel.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/indices/MavenIndicesManager.java
plugins/maven/src/main/resources/META-INF/groovy-support.xml
plugins/properties/testData/propertiesFile/enter/Performance.properties
plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/YouTrackIntellisense.java
plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/YouTrackRepositoryType.java
plugins/terminal/resources/icons/OpenTerminal_13x13@2x_dark.png [new file with mode: 0644]
plugins/terminal/resources/icons/OpenTerminal_13x13_dark.png [new file with mode: 0644]
plugins/terminal/src/org/jetbrains/plugins/terminal/AbstractTerminalRunner.java
plugins/terminal/src/org/jetbrains/plugins/terminal/LocalTerminalDirectRunner.java
plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/quickfix/DownloadManager.java
plugins/xslt-debugger/src/META-INF/plugin.xml
python/edu/build/idea.nsi
python/edu/course-creator/resources/META-INF/plugin.xml
python/edu/learn-python/src/com/jetbrains/python/edu/StudyTaskManager.java
python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyWatchTutorialAction.java
python/edu/resources/idea/PyCharmEduApplicationInfo.xml
python/helpers/pydev/pydevd_resolver.py
python/helpers/pydev/pydevd_xml.py
python/helpers/python-skeletons/README.md
python/ide/src/com/jetbrains/python/configuration/PyDependenciesConfigurable.java
python/ide/src/com/jetbrains/python/configuration/PyDependenciesConfigurableProvider.java [new file with mode: 0644]
python/ide/src/com/jetbrains/python/configuration/PythonContentEntriesConfigurable.java
python/ide/src/com/jetbrains/python/configuration/PythonContentEntriesConfigurableProvider.java [new file with mode: 0644]
python/pluginResources/META-INF/plugin.xml
python/resources/idea/PyCharmCoreApplicationInfo.xml
python/src/META-INF/pycharm-core.xml
python/src/com/jetbrains/python/packaging/PyPIPackageUtil.java
python/src/com/jetbrains/python/projectView/PyRemoteLibrariesNode.java
python/testSrc/com/jetbrains/env/python/dotNet/package-info.java
resources/src/idea/TeamServerApplicationInfo.xml
spellchecker/testSrc/com/intellij/spellchecker/inspector/SplitterTest.java
updater/testData/Readme.txt
xml/impl/resources/liveTemplates/zen_html.xml
xml/impl/src/com/intellij/application/options/emmet/EmmetOptions.java
xml/impl/src/com/intellij/application/options/emmet/XmlEmmetConfigurable.form
xml/impl/src/com/intellij/application/options/emmet/XmlEmmetConfigurable.java
xml/impl/src/com/intellij/codeInsight/daemon/impl/quickfix/FetchExtResourceAction.java
xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetParser.java
xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java
xml/impl/src/com/intellij/codeInsight/template/emmet/ZenCodingTemplate.java
xml/impl/src/com/intellij/codeInsight/template/emmet/filters/BemEmmetFilter.java
xml/impl/src/com/intellij/codeInsight/template/emmet/filters/XslZenCodingFilter.java
xml/impl/src/com/intellij/codeInsight/template/emmet/generators/XmlZenCodingGenerator.java
xml/impl/src/com/intellij/codeInsight/template/emmet/generators/XmlZenCodingGeneratorImpl.java
xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/GenerationNode.java
xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/LoremNode.java
xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/TemplateNode.java
xml/impl/src/com/intellij/codeInsight/template/emmet/tokens/TemplateToken.java
xml/xml-psi-impl/src/com/intellij/embedding/IndentEatingLexer.java

index 8b8c12abe33c1fa44e90007c53999f063c002290..d9f5e1dfc3b2fbc3b3c477759721baabcc0b1a45 100644 (file)
@@ -1,3 +1,3 @@
 This software includes code from IntelliJ IDEA Community Edition
 Copyright (C) JetBrains s.r.o.
-http://www.jetbrains.com/idea/
+https://www.jetbrains.com/idea/
index 36aab224dfa3d99ef100041bfd9f62714d90796d..704880ada6c43476f145e5fb5fa0fede1b59a68b 100644 (file)
@@ -839,7 +839,7 @@ skip_properties:
   WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_WITH_VER}" \
               "Publisher" "JetBrains s.r.o."
   WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_WITH_VER}" \
-              "URLInfoAbout" "http://www.jetbrains.com/products"
+              "URLInfoAbout" "https://www.jetbrains.com/products"
   WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_WITH_VER}" \
               "InstallType" "$baseRegKey"
   WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_WITH_VER}" \
@@ -1181,6 +1181,6 @@ remove_IntelliJIdeaProjectFile:
 done:
   DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_WITH_VER}"
 ; UNCOMMENT THIS IN RELEASE BUILD
-; ExecShell "" "http://www.jetbrains.com/idea/uninstall/"
+; ExecShell "" "https://www.jetbrains.com/idea/uninstall/"
 
 SectionEnd
index 1c497a2fb62d53fbb36b33812534bf6d6ead7b85..b0a6d06c1a97f73d2d83ae003c0552521dcd9bb3 100644 (file)
@@ -234,7 +234,7 @@ libraryLicense(name: "Jakarta ORO", libraryName: "OroMatcher", version: "2.0.8",
 libraryLicense(name: "PicoContainer", libraryName: "picocontainer", version: "1.2", license: "BSD", url: "http://www.picocontainer.org/", licenseUrl: "http://docs.codehaus.org/display/PICO/License")
 libraryLicense(name: "Plexus Utils", libraryName: "plexus-utils-1.5.5.jar", version: "1.5.5", license: "Apache 2.0", url: "http://plexus.codehaus.org/plexus-utils")
 libraryLicense(name: "Relax NG Object Model", libraryName: "rngom-20051226-patched.jar", license: "MIT", url: "http://java.net/projects/rngom/", licenseUrl: "http://www.opensource.org/licenses/mit-license.php")
-libraryLicense(name: "RMI Stubs", attachedTo: "xslt-debugger-engine", license: "Apache 2.0", url: "http://confluence.jetbrains.com/display/CONTEST/XSLT-Debugger", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
+libraryLicense(name: "RMI Stubs", attachedTo: "xslt-debugger-engine", license: "Apache 2.0", url: "https://confluence.jetbrains.com/display/CONTEST/XSLT-Debugger", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
 libraryLicense(name: "Saxon-9HE", version: "9", license: "Mozilla Public License", url: "http://saxon.sourceforge.net/", licenseUrl: "http://www.mozilla.org/MPL/")
 libraryLicense(name: "Saxon-6.5.5", version: "6.5.5", license: "Mozilla Public License", url: "http://saxon.sourceforge.net/", licenseUrl: "http://www.mozilla.org/MPL/")
 libraryLicense(name: "Sonatype Nexus: Indexer", libraryName: "nexus-indexer-1.2.3.jar", version: "1.2.3", license: "Eclipse Public License v1.0", url: "http://nexus.sonatype.org/", licenseUrl: "http://www.eclipse.org/org/documents/epl-v10.html")
index f26c8286ac8276213d071be9439969a201c60dbe..e0444ad58660b71b5b36b5c09490707d61b24206 100644 (file)
@@ -1,6 +1,6 @@
 <component>
   <version codename="Community Edition" major="14" minor="1" eap="true"/>
-  <company name="JetBrains s.r.o." url="http://www.jetbrains.com/?fromIDE"/>
+  <company name="JetBrains s.r.o." url="https://www.jetbrains.com/?fromIDE"/>
   <build number="__BUILD_NUMBER__" date="__BUILD_DATE__"/>
   <install-over minbuild="129.1" maxbuild="139.9999" version="14"/>
   <logo url="/idea_community_logo.png" textcolor="aaaaaa" progressColor="FDA916" progressY="230" progressTailIcon="/community_progress_tail.png"/>
                   caption-url="/welcomeCaption_community.png"
                   slogan-url="/developSlogan_community.png"/>
 
-  <third-party url="http://www.jetbrains.org/"/>
+  <third-party url="https://www.jetbrains.org/"/>
 
   <editor background-url="/idea_logo_welcome.png"/>
 
-  <update-urls check="http://www.jetbrains.com/updates/updates.xml"
-               patches="http://download.jetbrains.com/idea/"/>
+  <update-urls check="https://www.jetbrains.com/updates/updates.xml"
+               patches="https://download.jetbrains.com/idea/"/>
 
   <help file="ideahelp.jar" root="idea"/>
-  <documentation url="http://www.jetbrains.com/idea/documentation"/>
-  <support url="http://www.jetbrains.com/support/idea/index.html"/>
-  <feedback eap-url="http://youtrack.jetbrains.com/newissue?project=IDEA&amp;clearDraft=true&amp;c=Affected+versions+$BUILD&amp;description=$DESCR"
-            release-url="http://www.jetbrains.com/feedback/feedback.jsp?product=IDEA&amp;build=$BUILD&amp;timezone=$TIMEZONE&amp;eval=$EVAL"/>
-  <plugins url="http://plugins.jetbrains.com"/>
-  <whatsnew url="http://www.jetbrains.com/idea/whatsnew/index.html"/>
-  <keymap win="http://www.jetbrains.com/idea/docs/IntelliJIDEA_ReferenceCard.pdf"
-          mac="http://www.jetbrains.com/idea/docs/IntelliJIDEA_ReferenceCard_Mac.pdf"/>
+  <documentation url="https://www.jetbrains.com/idea/documentation"/>
+  <support url="https://www.jetbrains.com/support/idea/index.html"/>
+  <feedback eap-url="https://youtrack.jetbrains.com/newissue?project=IDEA&amp;clearDraft=true&amp;c=Affected+versions+$BUILD&amp;description=$DESCR"
+            release-url="https://www.jetbrains.com/feedback/feedback.jsp?product=IDEA&amp;build=$BUILD&amp;timezone=$TIMEZONE&amp;eval=$EVAL"/>
+  <plugins url="https://plugins.jetbrains.com"/>
+  <whatsnew url="https://www.jetbrains.com/idea/whatsnew/index.html"/>
+  <keymap win="https://www.jetbrains.com/idea/docs/IntelliJIDEA_ReferenceCard.pdf"
+          mac="https://www.jetbrains.com/idea/docs/IntelliJIDEA_ReferenceCard_Mac.pdf"/>
 
   <plugins-page category="VCS Integration" title="Select VCS Integration Plugins"/>
   <plugins-page title="Select Other Plugins"/>
 
-  <statistics settings="http://jetbrains.com/idea/statistics/stat-assistant.xml" service="http://jetbrains.com/idea/statistics/index.jsp"/>
+  <statistics settings="https://www.jetbrains.com/idea/statistics/stat-assistant.xml" service="https://www.jetbrains.com/idea/statistics/index.jsp"/>
 </component>
index 3a81718443bfa51b34bc7a38aea299442a2fa807..05250e619ed0e9da1420b2599261d0289d8c54d2 100644 (file)
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.NotNull;
  * @author nik
  *
  * @deprecated this interface is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
+ * integrate into 'external build system' instead (https://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
  * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
  */
 public abstract class GenericCompiler<Key, SourceState, OutputState> implements Compiler {
index 4e5143aee4953f910d8dfad7e9ad56cd54162e6a..71d924aada85ce847a492511bc1258666ab9c7de 100644 (file)
@@ -23,7 +23,7 @@ package com.intellij.openapi.compiler;
  * SourceGeneratingCompiler -> SourceInstrumentingCompiler -> TranslatingCompiler ->  ClassInstrumentingCompiler -> ClassPostProcessingCompiler -> PackagingCompiler -> Validator
  *
  * @deprecated this interface is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
+ * integrate into 'external build system' instead (https://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
  * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
  */
 public interface ClassInstrumentingCompiler extends FileProcessingCompiler {
index c4c3e8b40cf18eaa9e6800505933746bf610141d..07d3d6ce75b0a267605e18dd8fc68df751032539 100644 (file)
@@ -23,7 +23,7 @@ package com.intellij.openapi.compiler;
  * SourceGeneratingCompiler -> SourceInstrumentingCompiler -> TranslatingCompiler ->  ClassInstrumentingCompiler -> ClassPostProcessingCompiler -> PackagingCompiler -> Validator
  *
  * @deprecated this interface is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
+ * integrate into 'external build system' instead (https://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
  * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
  */
 public interface ClassPostProcessingCompiler extends FileProcessingCompiler {
index 36b2e5fd8a5cbe7408e15f931e793b3365896764..4d2472acfab3b675847b1abde4850a5be2c7ba70 100644 (file)
@@ -17,7 +17,7 @@ package com.intellij.openapi.compiler;
 
 /**
  * @deprecated this interface is a part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
+ * integrate into 'external build system' instead (https://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
  * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
  */
 public interface CompilerFilter {
index 58e540578f3373e70b887f252c5a408d879632e2..055233b90c02e64277992c0dd34a6dacdbe2ff8b 100644 (file)
@@ -66,7 +66,7 @@ public abstract class CompilerManager {
    * @param outputTypes a set of filetypes that compiler can generate
    *
    * @deprecated this method is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
-   * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
+   * integrate into 'external build system' instead (https://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
    * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
    */
   public abstract void addTranslatingCompiler(@NotNull TranslatingCompiler compiler, Set<FileType> inputTypes, Set<FileType> outputTypes);
index 758524e924268f507ba9c0a7cde755b54ba8766b..2d7704786e5b12ee95b96633d8581ca2a019b7ba 100644 (file)
@@ -34,7 +34,7 @@ import java.util.List;
  * Compiler which copies the compiled files to a different directory.
  *
  * @deprecated this interface is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
+ * integrate into 'external build system' instead (https://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
  * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
  */
 public abstract class CopyingCompiler implements PackagingCompiler{
index af1fb1eb8dd7bc40a2958ace76597a2f6228513c..eacb272357401228c3a784fc9f6986ea5a512bec 100644 (file)
@@ -23,7 +23,7 @@ import com.intellij.openapi.vfs.VirtualFile;
  * Actual implementation should implement one of its subinterfaces. Currently only {@link SourceGeneratingCompiler} is available.
  *
  * @deprecated this interface is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
+ * integrate into 'external build system' instead (https://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
  * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
  */
 public interface GeneratingCompiler extends Compiler, ValidityStateFactory, IntermediateOutputCompiler {
index a55136eaccb698e2ec9608331f01be9776315c0b..a5bd314b373db1d8d5533a48e6e7983e85739a1a 100644 (file)
@@ -20,7 +20,7 @@ package com.intellij.openapi.compiler;
  * and can be used as input to another compiler 
  *
  * @deprecated this interface is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
+ * integrate into 'external build system' instead (https://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
  * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
  */
 public interface IntermediateOutputCompiler extends Compiler{
index 1194efcccba3b7eced1095bc68f768ce85d17879..5328a1336f93196b16431ab2cb3b62c7b82ec630 100644 (file)
@@ -21,7 +21,7 @@ import com.intellij.openapi.vfs.VirtualFile;
  * This compiler is called right before the java sources compiler.
  *
  * @deprecated this interface is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
+ * integrate into 'external build system' instead (https://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
  * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
  */
 public interface JavaSourceTransformingCompiler extends Compiler {
index 3055e0ff654f5c7b9dc57dad2f45ed904251f725..c4dd497dd2a584f0849933365f87583bef546f72 100644 (file)
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
  * SourceGeneratingCompiler -> SourceInstrumentingCompiler -> TranslatingCompiler ->  ClassInstrumentingCompiler -> ClassPostProcessingCompiler -> PackagingCompiler -> Validator
  *
  * @deprecated this interface is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
+ * integrate into 'external build system' instead (https://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
  * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
  */
 public interface PackagingCompiler extends FileProcessingCompiler{
index 2fe36ba202baa1325f539392c8fd76b2e8835db9..279b1d7fe7aaeae70d1bd7fc4b978f8bf5d6a8a4 100644 (file)
@@ -25,7 +25,7 @@ import com.intellij.openapi.vfs.VirtualFile;
  * SourceGeneratingCompiler -> SourceInstrumentingCompiler -> TranslatingCompiler ->  ClassInstrumentingCompiler -> ClassPostProcessingCompiler -> PackagingCompiler -> Validator
  *
  * @deprecated this interface is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
+ * integrate into 'external build system' instead (https://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
  * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
  */
 public interface SourceGeneratingCompiler extends GeneratingCompiler {
index 64d287ad3c11dfc979f8acd12b42766e92430476..e24a016a3a39921291a2a6351993d8a121749a3a 100644 (file)
@@ -17,7 +17,7 @@ package com.intellij.openapi.compiler;
 
 /**
  * @deprecated this interface is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
+ * integrate into 'external build system' instead (https://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
  * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
  */
 public interface SourceProcessingCompiler extends FileProcessingCompiler, IntermediateOutputCompiler {
index c5ce012c9ce6d06ec41221529d180f376086caf3..75f9c0d6ed98051aab694f7c15b4c1206a36b1ba 100644 (file)
@@ -28,7 +28,7 @@ import java.util.Collection;
  * SourceGeneratingCompiler -> SourceInstrumentingCompiler -> TranslatingCompiler ->  ClassInstrumentingCompiler -> ClassPostProcessingCompiler -> PackagingCompiler -> Validator
  *
  * @deprecated this interface is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
- * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
+ * integrate into 'external build system' instead (https://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
  * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
  */
 public interface TranslatingCompiler extends Compiler {
index 28d6718b43d6e89c4d8053043fb5535325b7b637..6d2913b6db2e2c9253f6363092842d988b45c9fd 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.intellij.debugger.engine;
 
+import com.intellij.openapi.util.Comparing;
 import com.intellij.psi.*;
 
 /**
@@ -59,6 +60,6 @@ public class JavaSimpleGetterProvider implements SimpleGetterProvider {
       return false;
     }
 
-    return ((PsiField)referent).getContainingClass().equals(method.getContainingClass());
+    return Comparing.equal(((PsiField)referent).getContainingClass(), method.getContainingClass());
   }
 }
index 695bd43a8f266bfe5e181d93e5fddf447372aa63..4597928e1849a4e5b225b4b2181aa579eaca3727 100644 (file)
@@ -177,7 +177,7 @@ public class JavaStackFrame extends XStackFrame {
 
       final ObjectReference thisObjectReference = myDescriptor.getThisObject();
       if (thisObjectReference != null) {
-        ValueDescriptorImpl thisDescriptor = myNodeManager.getThisDescriptor(myDescriptor, thisObjectReference);
+        ValueDescriptorImpl thisDescriptor = myNodeManager.getThisDescriptor(null, thisObjectReference);
         children.add(JavaValue.create(thisDescriptor, evaluationContext, myNodeManager));
       }
       else {
index f576711e12b2d76ebdc4ffcfbae566a7cdaf5313..45166acce45d1e09fb1e5efd2d0a3da014b11bbb 100644 (file)
@@ -140,14 +140,10 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider, XV
           public void labelChanged() {
             Icon nodeIcon = DebuggerTreeRenderer.getValueIcon(myValueDescriptor);
             final String value = getValueString();
-            String type = splitValue(myValueDescriptor.getIdLabel())[0];
-            if (StringUtil.isEmpty(type)) {
-              type = splitValue(myValueDescriptor.getValueText())[0];
-            }
             XValuePresentation presentation;
             @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
             EvaluateException exception = myValueDescriptor.getEvaluateException();
-            presentation = new JavaValuePresentation(value, type, exception != null ? exception.getMessage() : null, myValueDescriptor);
+            presentation = new JavaValuePresentation(value, myValueDescriptor.getIdLabel(), exception != null ? exception.getMessage() : null, myValueDescriptor);
 
             if (myValueDescriptor.getLastRenderer() instanceof FullValueEvaluatorProvider) {
               node.setFullValueEvaluator(((FullValueEvaluatorProvider)myValueDescriptor.getLastRenderer()).getFullValueEvaluator(myEvaluationContext, myValueDescriptor));
@@ -208,7 +204,7 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider, XV
     @Nullable
     @Override
     public String getType() {
-      return myType;
+      return StringUtil.nullize(myType);
     }
 
     @Override
@@ -289,17 +285,7 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider, XV
 
   @NotNull
   String getValueString() {
-    return splitValue(StringUtil.notNullize(myValueDescriptor.getValueText()))[1];
-  }
-
-  private static String[] splitValue(String value) {
-    if (StringUtil.startsWithChar(value, '{')) {
-      int end = value.indexOf('}');
-      if (end > 0) {
-        return new String[]{value.substring(1, end), value.substring(end+1)};
-      }
-    }
-    return new String[]{null, value};
+    return myValueDescriptor.getValueText();
   }
 
   private int currentStart = 0;
index 93982cc3ebdf93ea82624bd1971eee9296091e63..584b09bca900cca1e5af9a156dc11b83e8b028ba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -60,8 +60,12 @@ public class ArrayElementDescriptorImpl extends ValueDescriptorImpl implements A
   }
 
   public Value calcValue(EvaluationContextImpl evaluationContext) throws EvaluateException {
+    return getArrayElement(myArray, myIndex);
+  }
+
+  public static Value getArrayElement(ArrayReference reference, int idx) throws EvaluateException {
     try {
-      return myArray.getValue(myIndex);
+      return reference.getValue(idx);
     }
     catch (ObjectCollectedException e) {
       throw EvaluateExceptionUtil.ARRAY_WAS_COLLECTED;
index 34efd89882b1d6953f8e0d966848b8bad6126c6a..e881787357ae8966757f51e21a053e66f2ad96fa 100644 (file)
@@ -32,11 +32,13 @@ import com.intellij.debugger.ui.tree.render.*;
 import com.intellij.debugger.ui.tree.render.Renderer;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.PsiExpression;
 import com.intellij.util.StringBuilderSpinAllocator;
 import com.intellij.util.concurrency.Semaphore;
 import com.intellij.xdebugger.impl.ui.tree.ValueMarkup;
 import com.sun.jdi.*;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
@@ -308,26 +310,22 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements
     return ""; // we have overridden getLabel
   }
 
-  private String getIdLabel(String label) {
+  private String calcIdLabel() {
     //translate only strings in quotes
-    String customLabel = null;
     if(isShowIdLabel() && myValueReady) {
       final Value value = getValue();
       Renderer lastRenderer = getLastRenderer();
       final EvaluationContextImpl evalContext = myStoredEvaluationContext;
-      final String idLabel = evalContext != null && lastRenderer != null && !evalContext.getSuspendContext().isResumed()?
+      return evalContext != null && lastRenderer != null && !evalContext.getSuspendContext().isResumed()?
                              ((NodeRendererImpl)lastRenderer).getIdLabel(value, evalContext.getDebugProcess()) :
                              null;
-      if(idLabel != null && !label.startsWith(idLabel)) {
-        return idLabel;
-      }
     }
-    return "";
+    return null;
   }
 
   @Override
   public String getLabel() {
-    return calcValueName() + " = " + myIdLabel + myValueText;
+    return calcValueName() + " = " + getValueLabel();
   }
 
   public ValueDescriptorImpl getFullValueDescriptor() {
@@ -357,7 +355,7 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements
       label = DebuggerUtilsEx.truncateString(label);
     }
     myValueText = label;
-    myIdLabel = getIdLabel(label);
+    myIdLabel = calcIdLabel();
   }
 
   @Override
@@ -478,7 +476,7 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements
         !classRenderer.SHOW_DECLARED_TYPE ||
         (!(objRef instanceof StringReference) && !(objRef instanceof ClassObjectReference) && !isEnumConstant(objRef));
       if (showConcreteType || classRenderer.SHOW_OBJECT_ID) {
-        buf.append('{');
+        //buf.append('{');
         if (showConcreteType) {
           buf.append(classRenderer.renderTypeName(objRef.type().name()));
         }
@@ -492,7 +490,7 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements
             buf.append(objRef.uniqueID());
           }
         }
-        buf.append('}');
+        //buf.append('}');
       }
 
       if (objRef instanceof ArrayReference) {
@@ -518,16 +516,22 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements
     return myValueReady && !myIsSynthetic && isLvalue();
   }
 
+  @NotNull
   public String getIdLabel() {
-    return myIdLabel;
+    return StringUtil.notNullize(myIdLabel);
   }
 
   public String getValueLabel() {
-    return myIdLabel + myValueText;
+    String label = getIdLabel();
+    if (!StringUtil.isEmpty(label)) {
+      return '{' + label + '}' + getValueText();
+    }
+    return getValueText();
   }
 
+  @NotNull
   public String getValueText() {
-    return myValueText;
+    return StringUtil.notNullize(myValueText);
   }
 
   //Context is set to null
index ae764a24a3fa62827914a6e8c5660839e15118cd..3106617a7d3db9e1182e5925c37a6252f93ece9e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -20,12 +20,10 @@ import com.intellij.debugger.DebuggerContext;
 import com.intellij.debugger.engine.DebuggerManagerThreadImpl;
 import com.intellij.debugger.engine.evaluation.EvaluateException;
 import com.intellij.debugger.engine.evaluation.EvaluationContext;
-import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
 import com.intellij.debugger.settings.ViewsGeneralSettings;
 import com.intellij.debugger.ui.impl.watch.ArrayElementDescriptorImpl;
 import com.intellij.debugger.ui.impl.watch.MessageDescriptor;
 import com.intellij.debugger.ui.impl.watch.NodeManagerImpl;
-import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
 import com.intellij.debugger.ui.tree.DebuggerTreeNode;
 import com.intellij.debugger.ui.tree.NodeDescriptor;
 import com.intellij.debugger.ui.tree.NodeDescriptorFactory;
@@ -49,7 +47,6 @@ import org.jetbrains.annotations.NonNls;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.ListIterator;
 
 /**
  * User: lex
@@ -133,15 +130,11 @@ public class ArrayRenderer extends NodeRendererImpl{
         int idx;
 
         for (idx = start; idx <= end; idx++) {
-          DebuggerTreeNode arrayItemNode = nodeManager.createNode(descriptorFactory.getArrayItemDescriptor(builder.getParentDescriptor(), array, idx), evaluationContext);
+          if (ViewsGeneralSettings.getInstance().HIDE_NULL_ARRAY_ELEMENTS && elementIsNull(array, idx)) continue;
 
+          DebuggerTreeNode arrayItemNode = nodeManager.createNode(descriptorFactory.getArrayItemDescriptor(builder.getParentDescriptor(), array, idx), evaluationContext);
           if (arrayItemNode == null) continue;
-          if (ViewsGeneralSettings.getInstance().HIDE_NULL_ARRAY_ELEMENTS) {
-            // need to init value to be able to ask for null
-            ValueDescriptorImpl descriptor = (ValueDescriptorImpl)arrayItemNode.getDescriptor();
-            descriptor.setContext((EvaluationContextImpl)evaluationContext);
-            if (descriptor.isNull()) continue;
-          }
+
           //if(added >= (ENTRIES_LIMIT  + 1)/ 2) break;
           children.add(arrayItemNode);
           added++;
@@ -200,6 +193,15 @@ public class ArrayRenderer extends NodeRendererImpl{
     builder.setChildren(children);
   }
 
+  private static boolean elementIsNull(ArrayReference arrayReference, int index) {
+    try {
+      return ArrayElementDescriptorImpl.getArrayElement(arrayReference, index) == null;
+    }
+    catch (EvaluateException e) {
+      return false;
+    }
+  }
+
   public void readExternal(Element element) throws InvalidDataException {
     super.readExternal(element);
     DefaultJDOMExternalizer.readExternal(this, element);
index 720e3ce2456b973018bf1dbe65ea20da83d98a86..7445778ea2f716c712ae582b8dd9b2db3feb267a 100644 (file)
@@ -131,7 +131,7 @@ public class ClassRenderer extends NodeRendererImpl{
           }
         }
         else {
-          return ValueDescriptorImpl.getIdLabel(objRef);
+          return "";
         }
       }
     }
index 532fe3234218adffb56cfd60f9e025133a415bf1..c6bb1f199b0ef4a0306a7e4baed232d6538d4cfb 100644 (file)
@@ -34,14 +34,14 @@ import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VfsUtilCore;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.PsiFile;
-import com.intellij.util.io.HttpRequests;
 import com.intellij.util.SystemProperties;
 import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.net.NetUtils;
+import com.intellij.util.io.HttpRequests;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
 import java.util.*;
 import java.util.regex.Pattern;
 
@@ -167,21 +167,8 @@ public class InternetAttachSourceProvider implements AttachSourcesProvider {
             }
 
             try {
-              File tmpDownload = HttpRequests.request(artifactUrl).connect(new HttpRequests.RequestProcessor<File>() {
-                @Override
-                public File process(@NotNull HttpRequests.Request request) throws IOException {
-                  File tmpDownload = FileUtil.createTempFile(libSourceDir, "download.", ".tmp", false, false);
-                  OutputStream out = new BufferedOutputStream(new FileOutputStream(tmpDownload));
-                  try {
-                    NetUtils.copyStreamContent(indicator, request.getInputStream(), out, request.getConnection().getContentLength());
-                  }
-                  finally {
-                    out.close();
-                  }
-                  return tmpDownload;
-                }
-              });
-
+              File tmpDownload = FileUtil.createTempFile(libSourceDir, "download.", ".tmp", false, false);
+              HttpRequests.request(artifactUrl).saveToFile(tmpDownload, indicator);
               if (!sourceFile.exists() && !tmpDownload.renameTo(sourceFile)) {
                 LOG.warn("Failed to rename file " + tmpDownload + " to " + sourceFileName);
               }
index 5e37d69ebcc450291436f0bb183af6859ee35885..677c86ebac41c5e4e828b2fecc30ad9e5f053145 100644 (file)
@@ -29,7 +29,7 @@ import java.io.File;
  */
 public class DevelopPluginsAction extends AnAction implements DumbAware {
   @NonNls private static final String PLUGIN_URL = PathManager.getHomePath() + "/Plugin Development Readme.html";
-  @NonNls private static final String PLUGIN_WEBSITE = "http://www.jetbrains.com/idea/plugins/plugin_developers.html";
+  @NonNls private static final String PLUGIN_WEBSITE = "https://www.jetbrains.com/idea/plugins/plugin_developers.html";
 
   @Override
   public void actionPerformed(final AnActionEvent e) {
index f750a26f80635f997313e066375806ae42a4c69b..bc2f609a5344682da2a73f01fc27b62cc33b2b7d 100644 (file)
@@ -1,4 +1,4 @@
-<template-groups xmlns="http://www.jetbrains.com/projectTemplates">
+<template-groups xmlns="https://www.jetbrains.com/projectTemplates">
   <group>
     <name>Java Samples</name>
     <path>Java</path>
index 92725d311e4a4f32766d3566f62e210096f6a26b..885cf97234ecf2502ee8dd6f4c4b628c25998f67 100644 (file)
@@ -1,4 +1,4 @@
-<template-groups xmlns="http://www.jetbrains.com/projectTemplates">
+<template-groups xmlns="https://www.jetbrains.com/projectTemplates">
   <group>
     <name>Java Samples</name>
     <path>Java</path>
index 19d59f6c716dd4a5922126d6159ef9a6fdaef40a..b7e5aca7baba1dac807b21580fa52802d44b646d 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"
-           targetNamespace="http://www.jetbrains.com/projectTemplates">
+           targetNamespace="https://www.jetbrains.com/projectTemplates">
   <xs:element name="template-groups" type="template-groupsType"/>
   <xs:complexType name="groupType">
     <xs:sequence>
index cac3b57eb90d7d6240820fe7d2138b1a38fe5fcb..16dfdc78709796a508285557ef95a4ed7fe45b5d 100644 (file)
@@ -102,7 +102,7 @@ public class JavaDocExternalFilter extends AbstractExternalFilter {
   }
 
   @Override
-  protected RefConvertor[] getRefConvertors() {
+  protected RefConvertor[] getRefConverters() {
     return myReferenceConvertors;
   }
 
index 1473184bc93b2c84eda6b40f5ebf0cc370373ec0..7ab6ee5c6c57d9acb01559a2067fc113684f0ece 100644 (file)
@@ -37,9 +37,8 @@ import java.net.URL;
  * @author Ivan Chirkov
  */
 public class LibraryJarStatisticsService extends SettingsConnectionService implements StartupActivity, DumbAware {
-
   private static final String FILE_NAME = "statistics/library-jar-statistics.xml";
-  private static final String DEFAULT_SETTINGS_URL = "http://www.jetbrains.com/idea/download-assistant.xml";
+  private static final String DEFAULT_SETTINGS_URL = "https://www.jetbrains.com/idea/download-assistant.xml";
   private static final String DEFAULT_SERVICE_URL = "http://frameworks.jetbrains.com";
 
   private static final LibraryJarStatisticsService myInstance = new LibraryJarStatisticsService();
index deaed59885ec0001dc3ff26de0479adda2a235e5..aeb6c7574a01b54261abe7cd9b3524106dc91f81 100644 (file)
@@ -2,7 +2,6 @@ package com.intellij.jarFinder;
 
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.progress.ProgressIndicator;
-import org.jdom.Document;
 import org.jdom.Element;
 import org.jdom.JDOMException;
 import org.jdom.xpath.XPath;
@@ -16,45 +15,37 @@ import java.util.List;
  * @author Sergey Evdokimov
  */
 public class MavenCentralSourceSearcher extends SourceSearcher {
-
   private static final Logger LOG = Logger.getInstance(MavenCentralSourceSearcher.class);
 
   @Nullable
   @Override
   protected String findSourceJar(@NotNull ProgressIndicator indicator,
-                                               @NotNull String artifactId,
-                                               @NotNull String version) throws SourceSearchException {
+                                 @NotNull String artifactId,
+                                 @NotNull String version) throws SourceSearchException {
     try {
-      indicator.setIndeterminate(true);
-      indicator.setText("Connecting to http://search.maven.org");
-
-      indicator.checkCanceled();
-
-      String url = "http://search.maven.org/solrsearch/select?rows=3&wt=xml&q=a:%22" + artifactId + "%22%20AND%20v:%22" + version + "%22%20AND%20l:%22sources%22";
-      Document document = readDocumentCancelable(indicator, url);
+      indicator.setText("Connecting to https://search.maven.org");
 
       indicator.checkCanceled();
 
-      List<Element> artifactList = (List<Element>)XPath.newInstance("/response/result/doc/str[@name='g']").selectNodes(document);
+      String url = "https://search.maven.org/solrsearch/select?rows=3&wt=xml&q=a:%22" + artifactId + "%22%20AND%20v:%22" + version + "%22%20AND%20l:%22sources%22";
+      @SuppressWarnings("unchecked")
+      List<Element> artifactList = (List<Element>)XPath.newInstance("/response/result/doc/str[@name='g']").selectNodes(readDocumentCancelable(indicator, url));
       if (artifactList.isEmpty()) {
         return null;
       }
 
-      Element element;
-
       if (artifactList.size() == 1) {
-        element = artifactList.get(0);
+        return "https://search.maven.org/remotecontent?filepath=" +
+               artifactList.get(0).getValue().replace('.', '/') + '/' +
+               artifactId + '/' +
+               version + '/' +
+               artifactId + '-' +
+               version + "-sources.jar";
       }
       else {
         // TODO handle
         return null;
       }
-
-      String groupId = element.getValue();
-
-      String downloadUrl = "http://search.maven.org/remotecontent?filepath=" + groupId.replace('.', '/') + '/' + artifactId + '/' + version + '/' + artifactId + '-' + version + "-sources.jar";
-
-      return downloadUrl;
     }
     catch (JDOMException e) {
       LOG.warn(e);
index 2a942cca8946286cd63fa5d8f5ddc8d240cabafd..b4251970fc1033f13c9a32e8210124a4bbbfa55c 100644 (file)
@@ -1,10 +1,7 @@
 package com.intellij.jarFinder;
 
-import com.intellij.notification.NotificationType;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.util.Pair;
-import org.jdom.Document;
 import org.jdom.Element;
 import org.jdom.JDOMException;
 import org.jdom.xpath.XPath;
@@ -18,7 +15,6 @@ import java.util.List;
  * @author Sergey Evdokimov
  */
 public class SonatypeSourceSearcher extends SourceSearcher {
-
   private static final Logger LOG = Logger.getInstance(SonatypeSourceSearcher.class);
 
   @Nullable
@@ -32,11 +28,7 @@ public class SonatypeSourceSearcher extends SourceSearcher {
       indicator.checkCanceled();
 
       String url = "https://oss.sonatype.org/service/local/lucene/search?collapseresults=true&c=sources&a=" + artifactId + "&v=" + version;
-      Document document = readDocumentCancelable(indicator, url);
-
-      indicator.checkCanceled();
-
-      List<Element> artifactList = (List<Element>)XPath.newInstance("/searchNGResponse/data/artifact").selectNodes(document);
+      List<Element> artifactList = (List<Element>)XPath.newInstance("/searchNGResponse/data/artifact").selectNodes(readDocumentCancelable(indicator, url));
       if (artifactList.isEmpty()) {
         return null;
       }
@@ -61,17 +53,11 @@ public class SonatypeSourceSearcher extends SourceSearcher {
       String groupId = element.getChildTextTrim("groupId");
       String repositoryId = artifactHintList.get(0).getChildTextTrim("repositoryId");
 
-      String downloadUrl = "https://oss.sonatype.org/service/local/artifact/maven/redirect?r=" +
-                           repositoryId +
-                           "&g=" +
-                           groupId +
-                           "&a=" +
-                           artifactId +
-                           "&v=" +
-                           version +
-                           "&e=jar&c=sources";
-
-      return downloadUrl;
+      return "https://oss.sonatype.org/service/local/artifact/maven/redirect?r=" +
+                           repositoryId + "&g=" +
+                           groupId + "&a=" +
+                           artifactId + "&v=" +
+                           version + "&e=jar&c=sources";
     }
     catch (JDOMException e) {
       LOG.warn(e);
index ef945aceefbcf1f6ebf7b395f7d4f1022a617511..19c1fec11a4cc68f40d19dd328a788ba2acfe5b9 100644 (file)
@@ -1,16 +1,16 @@
 package com.intellij.jarFinder;
 
 import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.util.net.HttpConfigurable;
+import com.intellij.openapi.progress.util.ProgressStream;
+import com.intellij.openapi.util.JDOMUtil;
+import com.intellij.util.io.HttpRequests;
 import org.jdom.Document;
 import org.jdom.JDOMException;
-import org.jdom.input.SAXBuilder;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.HttpURLConnection;
 
 /**
  * @author Sergey Evdokimov
@@ -25,45 +25,21 @@ public abstract class SourceSearcher {
   @Nullable
   protected abstract String findSourceJar(@NotNull final ProgressIndicator indicator, @NotNull String artifactId, @NotNull String version) throws SourceSearchException;
 
-  protected static Document readDocumentCancelable(final ProgressIndicator indicator, String url) throws JDOMException, IOException {
-    final HttpURLConnection urlConnection = HttpConfigurable.getInstance().openHttpConnection(url);
-
-    Thread t = new Thread(new Runnable() {
-      @Override
-      public void run() {
-        try {
-          //noinspection InfiniteLoopStatement
-          while (true) {
-            if (indicator.isCanceled()) {
-              urlConnection.disconnect();
-            }
-
-            //noinspection BusyWait
-            Thread.sleep(100);
+  protected static Document readDocumentCancelable(final ProgressIndicator indicator, String url) throws IOException {
+    return HttpRequests.request(url)
+      .accept("application/xml")
+      .connect(new HttpRequests.RequestProcessor<Document>() {
+        @Override
+        public Document process(@NotNull HttpRequests.Request request) throws IOException {
+          InputStream inputStream = request.getInputStream();
+          try {
+            return JDOMUtil.loadDocument(new ProgressStream(0, request.getConnection().getContentLength(), inputStream, indicator));
+          }
+          catch (JDOMException e) {
+            throw new IOException(e);
           }
         }
-        catch (InterruptedException ignored) {
-
-        }
-      }
-    });
-
-    t.start();
-
-    try {
-      urlConnection.setRequestProperty("accept", "application/xml");
-
-      InputStream inputStream = urlConnection.getInputStream();
-      try {
-        return new SAXBuilder().build(inputStream);
-      }
-      finally {
-        inputStream.close();
-      }
-    }
-    finally {
-      t.interrupt();
-    }
+      });
   }
 }
 
@@ -72,5 +48,4 @@ class SourceSearchException extends Exception {
   SourceSearchException(String message) {
     super(message);
   }
-
 }
\ No newline at end of file
index 897036618d0d9b2afd2b8353db32a47af3a994d1..dee26d6d80bb042c28a43880de5e348b2bd32c7c 100644 (file)
@@ -48,7 +48,9 @@ import com.intellij.refactoring.util.RefactoringUIUtil;
 import com.intellij.usageView.UsageInfo;
 import com.intellij.usageView.UsageViewUtil;
 import com.intellij.usages.*;
-import com.intellij.util.*;
+import com.intellij.util.ArrayUtil;
+import com.intellij.util.IncorrectOperationException;
+import com.intellij.util.Processor;
 import com.intellij.util.containers.HashMap;
 import com.intellij.util.containers.MultiMap;
 import com.intellij.util.ui.tree.TreeUtil;
@@ -56,7 +58,6 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.*;
-import java.util.HashSet;
 
 public class JavaSafeDeleteProcessor extends SafeDeleteProcessorDelegateBase {
   private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.safeDelete.JavaSafeDeleteProcessor");
@@ -262,10 +263,14 @@ public class JavaSafeDeleteProcessor extends SafeDeleteProcessorDelegateBase {
     final ArrayList<UsageInfo> result = new ArrayList<UsageInfo>();
     final ArrayList<UsageInfo> overridingMethods = new ArrayList<UsageInfo>();
     final ArrayList<SafeDeleteParameterCallHierarchyUsageInfo> delegatingParams = new ArrayList<SafeDeleteParameterCallHierarchyUsageInfo>();
+    final ArrayList<SafeDeleteMethodCalleeUsageInfo> calleesSafeToDelete = new ArrayList<SafeDeleteMethodCalleeUsageInfo>();
     for (UsageInfo usage : usages) {
       if (usage.isNonCodeUsage) {
         result.add(usage);
       }
+      else if (usage instanceof SafeDeleteMethodCalleeUsageInfo) {
+        calleesSafeToDelete.add((SafeDeleteMethodCalleeUsageInfo)usage);
+      }
       else if (usage instanceof SafeDeleteOverridingMethodUsageInfo) {
         overridingMethods.add(usage);
       }
@@ -291,7 +296,7 @@ public class JavaSafeDeleteProcessor extends SafeDeleteProcessorDelegateBase {
     }
 
     if (delegatingParams.size() == 1) {
-      final SafeDeleteParameterCallHierarchyUsageInfo parameterHierarchyUsageInfo = (SafeDeleteParameterCallHierarchyUsageInfo)delegatingParams.get(0);
+      final SafeDeleteParameterCallHierarchyUsageInfo parameterHierarchyUsageInfo = delegatingParams.get(0);
       if (ApplicationManager.getApplication().isUnitTestMode()) {
         result.addAll(delegatingParams);
       } else {
@@ -316,6 +321,38 @@ public class JavaSafeDeleteProcessor extends SafeDeleteProcessorDelegateBase {
       }
     }
 
+    if (!calleesSafeToDelete.isEmpty()) {
+      if (ApplicationManager.getApplication().isUnitTestMode()) {
+        result.addAll(calleesSafeToDelete);
+      }
+      else {
+        final PsiMethod method = calleesSafeToDelete.get(0).getCallerMethod();
+        final ArrayList<UsageInfo> list = new ArrayList<UsageInfo>();
+        JavaCallerChooser chooser = new SafeDeleteJavaCalleeChooser(method, project, list) {
+          @Override
+          protected ArrayList<SafeDeleteMethodCalleeUsageInfo> getTopLevelItems() {
+            return calleesSafeToDelete;
+          }
+        };
+        TreeUtil.expand(chooser.getTree(), 2);
+        if (!chooser.showAndGet()) {
+          return null;
+        }
+        result.addAll(list);
+        final List<PsiElement> methodsToDelete = new ArrayList<PsiElement>();
+        for (UsageInfo info : list) {
+          methodsToDelete.add(info.getElement());
+        }
+        methodsToDelete.add(method);
+        final Condition<PsiElement> insideDeletedCondition = getUsageInsideDeletedFilter(methodsToDelete.toArray(new PsiElement[methodsToDelete.size()]));
+        for (UsageInfo info : list) {
+          SafeDeleteProcessor.addNonCodeUsages(info.getElement(), result, insideDeletedCondition, 
+                                               JavaRefactoringSettings.getInstance().RENAME_SEARCH_FOR_TEXT_FOR_METHOD, 
+                                               JavaRefactoringSettings.getInstance().RENAME_SEARCH_IN_COMMENTS_FOR_METHOD );
+        }
+      }
+    }
+
     return result.toArray(new UsageInfo[result.size()]);
   }
 
@@ -498,7 +535,7 @@ public class JavaSafeDeleteProcessor extends SafeDeleteProcessorDelegateBase {
   }
 
   @Nullable
-  private static Condition<PsiElement> findMethodUsages(PsiMethod psiMethod, final PsiElement[] allElementsToDelete, List<UsageInfo> usages) {
+  private static Condition<PsiElement> findMethodUsages(final PsiMethod psiMethod, final PsiElement[] allElementsToDelete, List<UsageInfo> usages) {
     final Collection<PsiReference> references = ReferencesSearch.search(psiMethod).findAll();
 
     if(psiMethod.isConstructor()) {
@@ -524,6 +561,14 @@ public class JavaSafeDeleteProcessor extends SafeDeleteProcessorDelegateBase {
         usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(element, psiMethod, PsiTreeUtil.getParentOfType(element, PsiImportStaticStatement.class) != null));
       }
     }
+
+    final List<PsiMethod> calleesSafeToDelete = SafeDeleteJavaCalleeChooser.computeCalleesSafeToDelete(psiMethod);
+    if (calleesSafeToDelete != null) {
+      for (PsiMethod method : calleesSafeToDelete) {
+        usages.add(new SafeDeleteMethodCalleeUsageInfo(method, psiMethod));
+      }
+    }
+
     return new Condition<PsiElement>() {
       public boolean value(PsiElement usage) {
         if(usage instanceof PsiFile) return false;
diff --git a/java/java-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteJavaCalleeChooser.java b/java/java-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteJavaCalleeChooser.java
new file mode 100644 (file)
index 0000000..0ae06ff
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+ * 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.
+ */
+package com.intellij.refactoring.safeDelete;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Condition;
+import com.intellij.psi.*;
+import com.intellij.psi.search.searches.ReferencesSearch;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.refactoring.changeSignature.MethodNodeBase;
+import com.intellij.refactoring.changeSignature.inCallers.JavaCallerChooser;
+import com.intellij.refactoring.changeSignature.inCallers.JavaMethodNode;
+import com.intellij.refactoring.safeDelete.usageInfo.SafeDeleteMethodCalleeUsageInfo;
+import com.intellij.refactoring.safeDelete.usageInfo.SafeDeleteReferenceJavaDeleteUsageInfo;
+import com.intellij.usageView.UsageInfo;
+import com.intellij.util.CommonProcessors;
+import com.intellij.util.Consumer;
+import com.intellij.util.Function;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.*;
+
+abstract class SafeDeleteJavaCalleeChooser extends JavaCallerChooser {
+  private final Project myProject;
+
+  public SafeDeleteJavaCalleeChooser(final PsiMethod method, Project project, final ArrayList<UsageInfo> result) {
+    super(method, project, "Select Methods To Cascade Safe Delete", null, new Consumer<Set<PsiMethod>>() {
+      @Override
+      public void consume(Set<PsiMethod> methods) {
+        result.addAll(ContainerUtil.map(methods, new Function<PsiMethod, SafeDeleteReferenceJavaDeleteUsageInfo>() {
+          @Override
+          public SafeDeleteReferenceJavaDeleteUsageInfo fun(PsiMethod m) {
+            return new SafeDeleteReferenceJavaDeleteUsageInfo(m, m, true);
+          }
+        }));
+      }
+    });
+    myProject = project;
+  }
+
+  @Nullable
+  static List<PsiMethod> computeCalleesSafeToDelete(final PsiMethod psiMethod) {
+    final PsiCodeBlock body = psiMethod.getBody();
+    if (body != null) {
+      final PsiClass containingClass = psiMethod.getContainingClass();
+      if (containingClass != null) {
+        final Set<PsiMethod> methodsToCheck = new HashSet<PsiMethod>();
+        body.accept(new JavaRecursiveElementWalkingVisitor() {
+          @Override
+          public void visitMethodCallExpression(PsiMethodCallExpression expression) {
+            super.visitMethodCallExpression(expression);
+            ContainerUtil.addAllNotNull(methodsToCheck, expression.resolveMethod());
+          }
+        });
+
+        return ContainerUtil.filter(methodsToCheck, new Condition<PsiMethod>() {
+          @Override
+          public boolean value(final PsiMethod m) {
+            return containingClass.equals(m.getContainingClass()) &&
+                   !psiMethod.equals(m) &&
+                   m.findDeepestSuperMethods().length == 0 &&
+                   ReferencesSearch.search(m).forEach(new CommonProcessors.CollectProcessor<PsiReference>() {
+                     @Override
+                     public boolean process(PsiReference reference) {
+                       final PsiElement element = reference.getElement();
+                       return PsiTreeUtil.isAncestor(psiMethod, element, true) ||
+                              PsiTreeUtil.isAncestor(m, element, true);
+                     }
+                   });
+          }
+        });
+      }
+    }
+    return null;
+  }
+
+  protected abstract ArrayList<SafeDeleteMethodCalleeUsageInfo> getTopLevelItems();
+
+  @Override
+  protected JavaMethodNode createTreeNode(PsiMethod nodeMethod,
+                                          com.intellij.util.containers.HashSet<PsiMethod> callees,
+                                          Runnable cancelCallback) {
+    final SafeDeleteJavaMethodNode node = new SafeDeleteJavaMethodNode(nodeMethod, callees, cancelCallback, nodeMethod != null ? nodeMethod.getProject() : myProject);
+    if (getTopMethod().equals(nodeMethod)) {
+      node.setEnabled(false);
+      node.setChecked(true);
+    }
+    return node;
+  }
+
+  @Override
+  protected MethodNodeBase<PsiMethod> getCalleeNode(MethodNodeBase<PsiMethod> node) {
+    return node;
+  }
+
+  @Override
+  protected MethodNodeBase<PsiMethod> getCallerNode(MethodNodeBase<PsiMethod> node) {
+    return (MethodNodeBase<PsiMethod>)node.getParent();
+  }
+
+  private class SafeDeleteJavaMethodNode extends JavaMethodNode {
+
+    public SafeDeleteJavaMethodNode(PsiMethod currentMethod,
+                                    HashSet<PsiMethod> callees,
+                                    Runnable cancelCallback,
+                                    Project project) {
+      super(currentMethod, callees, project, cancelCallback);
+      
+    }
+
+    @Override
+    protected MethodNodeBase<PsiMethod> createNode(PsiMethod caller, HashSet<PsiMethod> callees) {
+      return new SafeDeleteJavaMethodNode(caller, callees, myCancelCallback, myProject);
+    }
+
+    @Override
+    protected List<PsiMethod> computeCallers() {
+      if (getTopMethod().equals(getMethod())) {
+        return ContainerUtil.map(getTopLevelItems(), new Function<SafeDeleteMethodCalleeUsageInfo, PsiMethod>() {
+          @Override
+          public PsiMethod fun(SafeDeleteMethodCalleeUsageInfo info) {
+            return info.getCalledMethod();
+          }
+        });
+      }
+
+      final List<PsiMethod> callees = computeCalleesSafeToDelete(getMethod());
+      return callees != null ? callees : Collections.<PsiMethod>emptyList();
+    }
+
+    @Override
+    protected Condition<PsiMethod> getFilter() {
+      return new Condition<PsiMethod>() {
+        @Override
+        public boolean value(PsiMethod method) {
+          return !myMethod.equals(method);
+        }
+      };
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/refactoring/safeDelete/usageInfo/SafeDeleteMethodCalleeUsageInfo.java b/java/java-impl/src/com/intellij/refactoring/safeDelete/usageInfo/SafeDeleteMethodCalleeUsageInfo.java
new file mode 100644 (file)
index 0000000..d7a49f7
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+package com.intellij.refactoring.safeDelete.usageInfo;
+
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiParameter;
+import com.intellij.util.IncorrectOperationException;
+
+public class SafeDeleteMethodCalleeUsageInfo extends SafeDeleteUsageInfo implements SafeDeleteCustomUsageInfo {
+
+  private final PsiMethod myCalledMethod;
+  private final PsiMethod myCallerMethod;
+
+  public SafeDeleteMethodCalleeUsageInfo(PsiMethod calledMethod, PsiMethod callerMethod) {
+    super(calledMethod, calledMethod);
+    myCalledMethod = calledMethod;
+    myCallerMethod = callerMethod;
+  }
+
+  public void performRefactoring() throws IncorrectOperationException {
+    final PsiMethod callee = myCalledMethod;
+    if (callee != null && callee.isValid()) {
+      callee.delete();
+    }
+  }
+
+  public PsiMethod getCalledMethod() {
+    return myCalledMethod;
+  }
+
+  public PsiMethod getCallerMethod() {
+    return myCallerMethod;
+  }
+}
index 90c99703fa977ecb339ec5e7623c472dfa3194a2..b404c94b83d25eea011fbd4af13fd9b769a31352 100644 (file)
@@ -18,7 +18,10 @@ package com.intellij.psi.augment;
 import com.intellij.openapi.extensions.ExtensionPointName;
 import com.intellij.openapi.extensions.Extensions;
 import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiType;
+import com.intellij.psi.PsiTypeElement;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -44,4 +47,28 @@ public abstract class PsiAugmentProvider {
 
     return result;
   }
+
+  /**
+   * Extends {@link PsiTypeElement#getType()} so type could be retrieved from external place
+   * e.g. from variable initializer in lombok case (http://projectlombok.org/features/val.html)
+   * 
+   * @param typeElement place where inference takes place, 
+   *                    also nested PsiTypeElement-s (e.g. for List<String> PsiTypeElements corresponding to both List and String would be suggested)
+   * @return inferred type or null, if inference is not applicable
+   */
+  @Nullable
+  protected PsiType inferType(PsiTypeElement typeElement) {
+    return null;
+  }
+
+  @Nullable
+  public static PsiType getInferredType(PsiTypeElement typeElement) {
+    for (PsiAugmentProvider provider : Extensions.getExtensions(EP_NAME)) {
+      final PsiType type = provider.inferType(typeElement);
+      if (type != null) {
+        return type;
+      }
+    }
+    return null;
+  }
 }
index 9c7ebcfa0e407fbaae3e39dc509e6a648f6c86b1..0fbbf3db20e7bdaee29f5d506bf81447f0f148c7 100644 (file)
@@ -17,6 +17,7 @@ package com.intellij.psi.impl.source;
 
 import com.intellij.lang.ASTNode;
 import com.intellij.psi.*;
+import com.intellij.psi.augment.PsiAugmentProvider;
 import com.intellij.psi.impl.PsiImplUtil;
 import com.intellij.psi.impl.source.codeStyle.CodeEditUtil;
 import com.intellij.psi.impl.source.tree.CompositePsiElement;
@@ -76,6 +77,11 @@ public class PsiTypeElementImpl extends CompositePsiElement implements PsiTypeEl
   }
 
   private PsiType calculateType() {
+    final PsiType inferredType = PsiAugmentProvider.getInferredType(this);
+    if (inferredType != null) {
+      return inferredType;
+    }
+
     PsiType type = null;
     SmartList<PsiAnnotation> annotations = new SmartList<PsiAnnotation>();
 
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/augment/LombokVal.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/augment/LombokVal.java
new file mode 100644 (file)
index 0000000..5d2fa94
--- /dev/null
@@ -0,0 +1,25 @@
+import lombok.val;
+
+import java.util.*;
+
+class Test {
+  <error descr="Incompatible types. Found: 'int', required: 'lombok.val'">val field = 0;</error>
+
+  void method(val param) {
+    <error descr="Incompatible types. Found: 'lombok.val', required: 'int'">int p = param;</error>
+
+    val i = 0;
+    int j = i + 1;
+
+    val a = new ArrayList<String>();
+    Object o = a.get(0);
+
+    val b = new ArrayList<>();
+    <error descr="Incompatible types. Found: 'java.lang.Object', required: 'java.lang.String'">String s = b.get(0);</error>
+    o = b.get(0);
+
+    for (val v : a) {
+      String vStr = v;
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/safeDelete/DeleteMethodCascade.java b/java/java-tests/testData/refactoring/safeDelete/DeleteMethodCascade.java
new file mode 100644 (file)
index 0000000..4872367
--- /dev/null
@@ -0,0 +1,11 @@
+class Test {
+    void f<caret>oo() {
+        bar();
+    }
+
+    void bar(){
+        baz();
+    }
+
+    void baz(){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/safeDelete/DeleteMethodCascadeOverridden.java b/java/java-tests/testData/refactoring/safeDelete/DeleteMethodCascadeOverridden.java
new file mode 100644 (file)
index 0000000..9656aa0
--- /dev/null
@@ -0,0 +1,14 @@
+interface I {
+    void bar();
+}
+class Test implements I{
+    void f<caret>oo() {
+        bar();
+    }
+
+    public void bar(){
+        baz();
+    }
+
+    void baz(){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/safeDelete/DeleteMethodCascadeOverridden_after.java b/java/java-tests/testData/refactoring/safeDelete/DeleteMethodCascadeOverridden_after.java
new file mode 100644 (file)
index 0000000..852cd23
--- /dev/null
@@ -0,0 +1,11 @@
+interface I {
+    void bar();
+}
+class Test implements I{
+
+    public void bar(){
+        baz();
+    }
+
+    void baz(){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/safeDelete/DeleteMethodCascadeRecursive.java b/java/java-tests/testData/refactoring/safeDelete/DeleteMethodCascadeRecursive.java
new file mode 100644 (file)
index 0000000..1b4702b
--- /dev/null
@@ -0,0 +1,17 @@
+class Test {
+    void f<caret>oo() {
+        bar();
+        if (false) {
+            foo();
+        }
+    }
+
+    void bar(){
+        baz();
+        if (false) {
+            bar();
+        }
+    }
+
+    void baz(){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/safeDelete/DeleteMethodCascadeRecursive_after.java b/java/java-tests/testData/refactoring/safeDelete/DeleteMethodCascadeRecursive_after.java
new file mode 100644 (file)
index 0000000..a6ce335
--- /dev/null
@@ -0,0 +1,4 @@
+class Test {
+
+    void baz(){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/safeDelete/DeleteMethodCascade_after.java b/java/java-tests/testData/refactoring/safeDelete/DeleteMethodCascade_after.java
new file mode 100644 (file)
index 0000000..a6ce335
--- /dev/null
@@ -0,0 +1,4 @@
+class Test {
+
+    void baz(){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/PsiAugmentProviderTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/PsiAugmentProviderTest.java
new file mode 100644 (file)
index 0000000..300d951
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+package com.intellij.codeInsight.daemon;
+
+import com.intellij.JavaTestUtil;
+import com.intellij.codeInsight.daemon.impl.analysis.JavaGenericsUtil;
+import com.intellij.psi.*;
+import com.intellij.psi.augment.PsiAugmentProvider;
+import com.intellij.psi.util.TypeConversionUtil;
+import com.intellij.testFramework.PlatformTestUtil;
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collections;
+import java.util.List;
+
+public class PsiAugmentProviderTest extends LightCodeInsightFixtureTestCase {
+
+  private static final String LOMBOK_VAL_FQN = "lombok.val";
+  private static final String LOMBOK_VAL_SHORT_NAME = "val";
+
+  public void testLombokVal() {
+    PlatformTestUtil.registerExtension(PsiAugmentProvider.EP_NAME, new PsiAugmentProvider() {
+      @NotNull
+      @Override
+      public <Psi extends PsiElement> List<Psi> getAugments(@NotNull PsiElement element, @NotNull Class<Psi> type) {
+        return Collections.<Psi>emptyList();
+      }
+
+      @Nullable
+      @Override
+      protected PsiType inferType(PsiTypeElement typeElement) {
+        final PsiElement parent = typeElement.getParent();
+        if (parent instanceof PsiLocalVariable && ((PsiLocalVariable)parent).getInitializer() != null || 
+            parent instanceof PsiParameter && ((PsiParameter)parent).getDeclarationScope() instanceof PsiForeachStatement) {
+          final String text = typeElement.getText();
+          if (LOMBOK_VAL_SHORT_NAME.equals(text) || LOMBOK_VAL_FQN.equals(text)) {
+            final PsiJavaCodeReferenceElement referenceElement = typeElement.getInnermostComponentReferenceElement();
+            if (referenceElement != null) {
+              final PsiElement resolve = referenceElement.resolve();
+              if (resolve instanceof PsiClass) {
+                if (parent instanceof PsiLocalVariable) {
+                  final PsiExpression initializer = ((PsiVariable)parent).getInitializer();
+                  assertNotNull(initializer);
+                  final PsiType initializerType = initializer.getType();
+                  if (initializer instanceof PsiNewExpression) {
+                    final PsiJavaCodeReferenceElement reference = ((PsiNewExpression)initializer).getClassOrAnonymousClassReference();
+                    if (reference != null) {
+                      final PsiReferenceParameterList parameterList = reference.getParameterList();
+                      if (parameterList != null) {
+                        final PsiTypeElement[] elements = parameterList.getTypeParameterElements();
+                        if (elements.length == 1 && elements[0].getType() instanceof PsiDiamondType) {
+                          return TypeConversionUtil.erasure(initializerType);
+                        }
+                      }
+                    }
+                  }
+                  return initializerType;
+                }
+                final PsiForeachStatement foreachStatement = (PsiForeachStatement)((PsiParameter)parent).getDeclarationScope();
+                assertNotNull(foreachStatement);
+                final PsiExpression iteratedValue = foreachStatement.getIteratedValue();
+                if (iteratedValue != null) {
+                  return JavaGenericsUtil.getCollectionItemType(iteratedValue);
+                }
+              }
+            }
+          }
+        }
+        return null;
+      }
+    }, myTestRootDisposable);
+    myFixture.addClass("package lombok; public @interface val{}");
+    myFixture.testHighlighting(false, false, false, getTestName(false) + ".java");
+  }
+
+  @Override
+  protected String getTestDataPath() {
+    return JavaTestUtil.getJavaTestDataPath() + "/codeInsight/daemonCodeAnalyzer/augment";
+  }
+
+}
index 3a14a4ef539c8440153828d5e155510f5ad000e5..9d51c0ccb5082a1c6e9907277f5ae6d8be641257 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -71,12 +71,12 @@ public class ExternalJavadocPresentationTest extends LightCodeInsightTestCase {
       }
 
       @Override
-      public void doBuildFromStream(String surl, Reader input, StringBuffer data, boolean search4Encoding) throws IOException {
-        super.doBuildFromStream(surl, input, data, search4Encoding);
+      public void doBuildFromStream(String url, Reader input, StringBuilder data, boolean search4Encoding) throws IOException {
+        super.doBuildFromStream(url, input, data, search4Encoding);
       }
     }
     JavadocExternalTestFilter filter = new JavadocExternalTestFilter(getProject());
-    final StringBuffer extractedData = new StringBuffer();
+    StringBuilder extractedData = new StringBuilder();
     filter.doBuildFromStream(url, new StringReader(LoadTextUtil.loadText(pageTextFile).toString()), extractedData, false);
     assertEquals(LoadTextUtil.loadText(expectedTextFile).toString(), extractedData.toString());
   }
index 90e7d127b8b58d030120bd9f014a27383050a5af..999ad6ecb90fc4e6e421b99c1c42b8ac9753ef25 100644 (file)
@@ -191,7 +191,7 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
   public void testRememberLocalTransientFieldState() { doTest(); }
   public void testFinalFieldDuringInitialization() { doTest(); }
   public void testFinalFieldDuringSuperInitialization() { doTest(); }
-  public void _testSymmetricUncheckedCast() { doTest(); } // http://youtrack.jetbrains.com/issue/IDEABKL-6871
+  public void _testSymmetricUncheckedCast() { doTest(); } // https://youtrack.jetbrains.com/issue/IDEABKL-6871
   public void testNullCheckDoesntAffectUncheckedCast() { doTest(); }
   public void testThrowNull() { doTest(); }
 
@@ -350,5 +350,5 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
     myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
   }
 
-  public void _testNullCheckBeforeInstanceof() { doTest(); } // http://youtrack.jetbrains.com/issue/IDEA-113220
+  public void _testNullCheckBeforeInstanceof() { doTest(); } // https://youtrack.jetbrains.com/issue/IDEA-113220
 }
index d54297af2a60c9467aede0b41235f56a4709eea2..40ed171181d62e93ce21fa943ec446f5da785c5d 100644 (file)
@@ -39,5 +39,5 @@ public class JavaFileStructureFilteringTest extends JavaFileStructureTestCase {
   public void testMatcher1()          {checkTree("ico");}
   public void testMatcher2()          {checkTree("ico");}
   
-  public void _testAnonymousMatcher2() {checkTree("ico");} //http://youtrack.jetbrains.com/issue/IDEABKL-6906
+  public void _testAnonymousMatcher2() {checkTree("ico");} //https://youtrack.jetbrains.com/issue/IDEABKL-6906
 }
index 6bf0f408214ac98c98da7b22efc38e9f288278e4..272b8d6e7918586bc70f36cc302baf4a663508f8 100644 (file)
@@ -46,6 +46,7 @@ public class RenameClassTest extends MultiFileTestCase {
   }
 
   public void testImport() throws Exception {
+    //noinspection SpellCheckingInspection
     doTest("a.Blubfoo", "BlubFoo");
   }
 
index 428f978b93272afc3c9779b2b4ed1070fd0a8cc9..819922c4016f805648a95bbca8cf5c11a7648225 100644 (file)
@@ -88,6 +88,18 @@ public class SafeDeleteTest extends MultiFileTestCase {
     doSingleFileTest();
   }
 
+  public void testDeleteMethodCascade() throws Exception {
+    doSingleFileTest();
+  }
+
+  public void testDeleteMethodCascadeRecursive() throws Exception {
+    doSingleFileTest();
+  }
+
+  public void testDeleteMethodCascadeOverridden() throws Exception {
+    doSingleFileTest();
+  }
+
   public void testDeleteConstructorParameterWithAnonymousClassUsage() throws Exception {
     doSingleFileTest();
   }
index afcbe30bafac3322efa9542c95bd6d0adbaa3f44..4ce05d3d09bfde684d02067a79963455d0ce14ee 100644 (file)
@@ -56,6 +56,8 @@ import org.jetbrains.jps.model.java.compiler.*;
 import org.jetbrains.jps.model.library.sdk.JpsSdk;
 import org.jetbrains.jps.model.module.JpsModule;
 import org.jetbrains.jps.model.module.JpsModuleType;
+import org.jetbrains.jps.model.serialization.JpsModelSerializationDataService;
+import org.jetbrains.jps.model.serialization.PathMacroUtil;
 import org.jetbrains.jps.service.JpsServiceManager;
 
 import javax.tools.*;
@@ -594,7 +596,19 @@ public class JavaBuilder extends ModuleLevelBuilder {
       assert cached != null : context;
     }
 
-    List<String> options = new ArrayList<String>(cached);
+    List<String> options = new ArrayList<String>();
+    JpsModule module = chunk.representativeTarget().getModule();
+    File baseDirectory = JpsModelSerializationDataService.getBaseDirectory(module);
+    if (baseDirectory != null) {
+      //this is a temporary workaround to allow passing per-module compiler options for Eclipse compiler in form
+      // -properties $MODULE_DIR$/.settings/org.eclipse.jdt.core.prefs
+      for (String s : cached) {
+        options.add(StringUtil.replace(s, "$" + PathMacroUtil.MODULE_DIR_MACRO_NAME + "$", baseDirectory.getAbsolutePath()));
+      }
+    }
+    else {
+      options.addAll(cached);
+    }
     addCompilationOptions(options, context, chunk, profile);
     return options;
   }
index f2f61525ad2fd34b8342f5840efc6991449da797..306c478306bef00e788cb3d53f292aed8be0e648 100644 (file)
@@ -25,7 +25,6 @@ import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.encoding.EncodingRegistry;
 import com.intellij.testFramework.LightVirtualFile;
 import com.intellij.util.LineSeparator;
-import com.intellij.util.PathUtil;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -740,7 +739,7 @@ public abstract class VirtualFile extends UserDataHolderBase implements Modifica
   }
 
   public static boolean isValidName(@NotNull String name) {
-    return PathUtil.isValidFileName(name);
+    return name.length() > 0 && name.indexOf('\\') < 0 && name.indexOf('/') < 0;
   }
 
   private static final Key<String> DETECTED_LINE_SEPARATOR_KEY = Key.create("DETECTED_LINE_SEPARATOR_KEY");
index aad148a9f3374646de44845e2be0204d358b6612..96780fbb1fca5148f020cf1d2bb8357364a9188a 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * @see <a href="http://confluence.jetbrains.com/display/IDEADEV/Indexing+and+PSI+Stubs+in+IntelliJ+IDEA">Indexing and PSI Stubs in IntelliJ IDEA</a>
+ * @see <a href="https://confluence.jetbrains.com/display/IDEADEV/Indexing+and+PSI+Stubs+in+IntelliJ+IDEA">Indexing and PSI Stubs in IntelliJ IDEA</a>
  *
  * @see <a href="http://devnet.jetbrains.com/message/5485343#_ga=1.104383616.1427417469.1367843132">Lifecycle of stub creation</a>
  */
index 9bce1758c35fb6c2405e173236fd7527b27a7af9..ba141f4227aa32fa80bbbd5dbf690692bf0946ba 100644 (file)
@@ -49,7 +49,7 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
   private String myBuildNumber = null;
   private String myApiVersion = null;
   private String myCompanyName = "JetBrains s.r.o.";
-  private String myCompanyUrl = "http://www.jetbrains.com/";
+  private String myCompanyUrl = "https://www.jetbrains.com/";
   private Color myProgressColor = null;
   private Color myCopyrightForeground = JBColor.BLACK;
   private Color myAboutForeground = JBColor.BLACK;
@@ -93,7 +93,7 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
   private boolean myHasContextHelp = true;
   @NonNls private String myHelpFileName = "ideahelp.jar";
   @NonNls private String myHelpRootName = "idea";
-  @NonNls private String myWebHelpUrl = "http://www.jetbrains.com/idea/webhelp/";
+  @NonNls private String myWebHelpUrl = "https://www.jetbrains.com/idea/webhelp/";
   private List<PluginChooserPage> myPluginChooserPages = new ArrayList<PluginChooserPage>();
   private String myStatisticsSettingsUrl;
   private String myStatisticsServiceUrl;
@@ -732,8 +732,8 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
       myStatisticsServiceKey  = statisticsElement.getAttributeValue(ATTRIBUTE_STATISTICS_SERVICE_KEY);
     }
     else {
-      myStatisticsSettingsUrl = "http://jetbrains.com/idea/statistics/stat-assistant.xml";
-      myStatisticsServiceUrl  = "http://jetbrains.com/idea/statistics/index.jsp";
+      myStatisticsSettingsUrl = "https://www.jetbrains.com/idea/statistics/stat-assistant.xml";
+      myStatisticsServiceUrl  = "https://www.jetbrains.com/idea/statistics/index.jsp";
       myStatisticsServiceKey  = null;
     }
 
index 0fec2015778f4aa10c1d1cfb7b7ce059fc75215b..a9ac8c8805216d6cede0e8e6281ed851cd7821e0 100644 (file)
@@ -58,6 +58,7 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
   private final Ref<DocumentListener[]> myCachedDocumentListeners = Ref.create(null);
   private final List<DocumentListener> myDocumentListeners = ContainerUtil.createLockFreeCopyOnWriteList();
   private final RangeMarkerTree<RangeMarkerEx> myRangeMarkers = new RangeMarkerTree<RangeMarkerEx>(this);
+  private final RangeMarkerTree<RangeMarkerEx> myPersistentRangeMarkers = new RangeMarkerTree<RangeMarkerEx>(this);
   private final List<RangeMarker> myGuardedBlocks = new ArrayList<RangeMarker>();
   private ReadonlyFragmentModificationHandler myReadonlyFragmentModificationHandler;
 
@@ -344,9 +345,12 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
     return !myIsReadOnly;
   }
 
+  private  RangeMarkerTree<RangeMarkerEx> treeFor(@NotNull RangeMarkerEx rangeMarker) {
+    return rangeMarker instanceof PersistentRangeMarker ? myPersistentRangeMarkers : myRangeMarkers;
+  }
   @Override
   public boolean removeRangeMarker(@NotNull RangeMarkerEx rangeMarker) {
-    return myRangeMarkers.removeInterval(rangeMarker);
+    return treeFor(rangeMarker).removeInterval(rangeMarker);
   }
 
   @Override
@@ -356,17 +360,17 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
                                   boolean greedyToLeft,
                                   boolean greedyToRight,
                                   int layer) {
-    myRangeMarkers.addInterval(rangeMarker, start, end, greedyToLeft, greedyToRight, layer);
+    treeFor(rangeMarker).addInterval(rangeMarker, start, end, greedyToLeft, greedyToRight, layer);
   }
 
   @TestOnly
   public int getRangeMarkersSize() {
-    return myRangeMarkers.size();
+    return myRangeMarkers.size() + myPersistentRangeMarkers.size();
   }
 
   @TestOnly
   public int getRangeMarkersNodeSize() {
-    return myRangeMarkers.nodeSize();
+    return myRangeMarkers.nodeSize()+myPersistentRangeMarkers.size();
   }
 
   @Override
@@ -1046,12 +1050,20 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
 
   @Override
   public boolean processRangeMarkers(@NotNull Processor<RangeMarker> processor) {
-    return myRangeMarkers.process(processor);
+    return processRangeMarkersOverlappingWith(0, getTextLength(), processor);
   }
 
   @Override
   public boolean processRangeMarkersOverlappingWith(int start, int end, @NotNull Processor<RangeMarker> processor) {
-    return myRangeMarkers.processOverlappingWith(start, end, processor);
+    TextRangeInterval interval = new TextRangeInterval(start, end);
+    IntervalTreeImpl.PeekableIterator<RangeMarkerEx> iterator = IntervalTreeImpl
+      .mergingOverlappingIterator(myRangeMarkers, interval, myPersistentRangeMarkers, interval, RangeMarker.BY_START_OFFSET);
+    try {
+      return ContainerUtil.process(iterator, processor);
+    }
+    finally {
+      iterator.dispose();
+    }
   }
 
   @NotNull
index fcb5e9c6ba993f2d6333e4a1d0596d589e19f557..5180838ad8491e175a7009251e454ebd5bb4fb6c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * 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.
@@ -18,10 +18,7 @@ package com.intellij.openapi.editor.impl;
 import com.intellij.util.Processor;
 import org.jetbrains.annotations.NotNull;
 
-/**
- * User: cdr
- */
-public interface IntervalTree<T extends Interval> {
+interface IntervalTree<T extends Interval> {
   boolean process(@NotNull Processor<? super T> processor);
   boolean processOverlappingWith(int start, int end, @NotNull Processor<? super T> processor);
   boolean processContaining(int offset, @NotNull Processor<? super T> processor);
index 671bcc3890897c09dd926b7871633f3751c272fc..b07f0b373c29853b843a93860f0716b49e3aa94b 100644 (file)
@@ -17,8 +17,6 @@ package com.intellij.openapi.editor.impl;
 
 import com.intellij.openapi.editor.ex.DisposableIterator;
 import com.intellij.openapi.util.Getter;
-import com.intellij.openapi.util.Ref;
-import com.intellij.openapi.util.TextRange;
 import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.Processor;
 import com.intellij.util.SmartList;
@@ -30,9 +28,11 @@ import org.jetbrains.annotations.NotNull;
 
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
+import java.util.Comparator;
 import java.util.ConcurrentModificationException;
 import java.util.List;
 import java.util.NoSuchElementException;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -40,7 +40,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
 /**
  * User: cdr
  */
-public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBlackTree<T> implements IntervalTree<T> {
+abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBlackTree<T> implements IntervalTree<T> {
   private int keySize; // number of all intervals, counting all duplicates, some of them maybe gced
   protected final ReadWriteLock l = new ReentrantReadWriteLock();
 
@@ -48,12 +48,12 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
   private final ReferenceQueue<T> myReferenceQueue = new ReferenceQueue<T>();
   private int deadReferenceCount;
 
-  protected static class IntervalNode<E extends MutableInterval> extends RedBlackTree.Node<E> implements MutableInterval {
+  static class IntervalNode<E extends MutableInterval> extends RedBlackTree.Node<E> implements MutableInterval {
     private volatile int myStart;
     private volatile int myEnd;
     private static final int ATTACHED_TO_TREE_FLAG = COLOR_FLAG+1; // true if the node is inserted to the tree
     protected final List<Getter<E>> intervals;
-    protected int maxEnd; // max of all intervalEnd()s among all children.
+    int maxEnd; // max of all intervalEnd()s among all children.
     protected int delta;  // delta of startOffset. getStartOffset() = myStartOffset + Sum of deltas up to root
 
     private volatile long cachedDeltaUpToRoot; // field (packed to long for atomicity) containing deltaUpToRoot, node modCount and allDeltasUpAreNull flag
@@ -148,7 +148,7 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
       setFlag(ATTACHED_TO_TREE_FLAG, attached);
     }
 
-    public void removeIntervalInternal(int i) {
+    void removeIntervalInternal(int i) {
       intervals.remove(i);
       if (isAttachedToTree()) {   // for detached node, do not update tree node count
         assert myIntervalTree.keySize > 0 : myIntervalTree.keySize;
@@ -156,7 +156,7 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
       }
     }
 
-    public void addInterval(@NotNull E interval) {
+    void addInterval(@NotNull E interval) {
       myIntervalTree.assertUnderWriteLock();
       intervals.add(createGetter(interval));
       if (isAttachedToTree()) { // for detached node, do not update tree node count
@@ -170,7 +170,7 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
     }
 
     private static class WeakReferencedGetter<T> extends WeakReference<T> implements Getter<T> {
-      public WeakReferencedGetter(T referent, ReferenceQueue<? super T> q) {
+      private WeakReferencedGetter(T referent, ReferenceQueue<? super T> q) {
         super(referent, q);
       }
 
@@ -181,7 +181,7 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
       }
     }
 
-    protected int computeDeltaUpToRoot() {
+    int computeDeltaUpToRoot() {
       restart:
       while (true) { // have to restart on failure to update cached offsets in case of concurrent modification
         if (!isValid()) return 0;
@@ -244,14 +244,14 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
       }
     }
 
-    protected int changeDelta(int change) {
+    int changeDelta(int change) {
       if (change != 0) {
         setCachedValues(0, false, 0); // deltaUpToRoot is not valid anymore
         return delta += change;
       }
       return delta;
     }
-    protected void clearDelta() {
+    void clearDelta() {
       if (delta != 0) {
         setCachedValues(0, false, 0); // deltaUpToRoot is not valid anymore
         delta = 0;
@@ -268,7 +268,7 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
       return myEnd = end;
     }
 
-    protected static final int VALID_FLAG = ATTACHED_TO_TREE_FLAG + 1;
+    static final int VALID_FLAG = ATTACHED_TO_TREE_FLAG + 1;
     @Override
     public boolean isValid() {
       return isFlagSet(VALID_FLAG);
@@ -476,7 +476,7 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
     return processOverlappingWith(root.getRight(), start, end, processor, modCountBefore, delta);
   }
 
-  public boolean processOverlappingWithOutside(int start, int end, @NotNull Processor<? super T> processor) {
+  boolean processOverlappingWithOutside(int start, int end, @NotNull Processor<? super T> processor) {
     try {
       l.readLock().lock();
       checkMax(true);
@@ -558,7 +558,7 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
     return processContaining(root.getRight(), offset, processor, modCountBefore, delta);
   }
 
-  public interface PeekableIterator<T> extends DisposableIterator<T> {
+  interface PeekableIterator<T> extends DisposableIterator<T> {
     T peek();
     PeekableIterator EMPTY = new PeekableIterator() {
       @Override
@@ -589,8 +589,7 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
   }
 
   @NotNull
-  PeekableIterator<T> overlappingIterator(@NotNull final TextRangeInterval rangeInterval) {
-
+  private PeekableIterator<T> overlappingIterator(@NotNull final TextRangeInterval rangeInterval) {
     l.readLock().lock();
 
     try {
@@ -599,6 +598,7 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
       final IntervalNode<T> firstOverlap = findMinOverlappingWith(getRoot(), rangeInterval, modCount, 0);
       if (firstOverlap == null) {
         l.readLock().unlock();
+        //noinspection unchecked
         return PeekableIterator.EMPTY;
       }
       final int firstOverlapDelta = firstOverlap.computeDeltaUpToRoot();
@@ -725,7 +725,7 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
     return rangeInterval.intersects(start, end);
   }
 
-  protected IntervalNode<T> findOrInsert(@NotNull IntervalNode<T> node) {
+  IntervalNode<T> findOrInsert(@NotNull IntervalNode<T> node) {
     assertUnderWriteLock();
     node.setRed();
     node.setParent(null);
@@ -814,15 +814,15 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
   }
 
   // returns true if all markers are valid
-  public boolean checkMax(boolean assertInvalid) {
+  boolean checkMax(boolean assertInvalid) {
     return VERIFY && doCheckMax(assertInvalid);
   }
 
-  protected boolean doCheckMax(boolean assertInvalid) {
+  private boolean doCheckMax(boolean assertInvalid) {
     try {
       l.readLock().lock();
 
-      Ref<Boolean> allValid = new Ref<Boolean>(true);
+      AtomicBoolean allValid = new AtomicBoolean(true);
       int[] keyCounter = new int[1];
       int[] nodeCounter = new int[1];
       TLongHashSet ids = new TLongHashSet(keySize);
@@ -853,12 +853,13 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
 
   // returns real (minStart, maxStart, maxEnd)
   private IntTrinity checkMax(IntervalNode<T> root,
-                                                    int deltaUpToRootExclusive,
-                                                    boolean assertInvalid,
-                                                    Ref<Boolean> allValid,
-                                                    int[] keyCounter,
-                                                    int[] nodeCounter,
-                                                    TLongHashSet ids, boolean allDeltasUpAreNull) {
+                              int deltaUpToRootExclusive,
+                              boolean assertInvalid,
+                              AtomicBoolean allValid,
+                              int[] keyCounter,
+                              int[] nodeCounter,
+                              TLongHashSet ids,
+                              boolean allDeltasUpAreNull) {
     if (root == null) return new IntTrinity(Integer.MAX_VALUE,Integer.MIN_VALUE,Integer.MIN_VALUE);
     long packedOffsets = root.cachedDeltaUpToRoot;
     if (IntervalNode.modCount(packedOffsets) == modCount) {
@@ -1004,7 +1005,7 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
   }
 
   // returns true if all deltas involved are still 0
-  protected boolean pushDelta(IntervalNode<T> root) {
+  boolean pushDelta(IntervalNode<T> root) {
     if (root == null || !root.isValid()) return true;
     IntervalNode<T> parent = root.getParent();
     assertAllDeltasAreNull(parent);
@@ -1113,7 +1114,7 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
   }
 
   // max of n.left's maxend, n.right's maxend and its own interval endOffset
-  protected void correctMax(@NotNull IntervalNode<T> node, int deltaUpToRoot) {
+  void correctMax(@NotNull IntervalNode<T> node, int deltaUpToRoot) {
     if (!node.isValid()) return;
     int realMax = Math.max(Math.max(maxEndOf(node.getLeft(), deltaUpToRoot), maxEndOf(node.getRight(), deltaUpToRoot)),
                            deltaUpToRoot + node.intervalEnd());
@@ -1234,7 +1235,7 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
     return findMinOverlappingWith(root.getRight(), interval, modCountBefore, delta);
   }
 
-  public void changeData(T interval, int start, int end, boolean greedyToLeft, boolean greedyToRight, int layer) {
+  void changeData(T interval, int start, int end, boolean greedyToLeft, boolean greedyToRight, int layer) {
     try {
       l.writeLock().lock();
 
@@ -1360,4 +1361,63 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
   private int maxHeight(Node<T> root) {
     return root == null ? 0 : 1 + Math.max(maxHeight(root.left), maxHeight(root.right));
   }
+
+  // combines iterators for two trees in one using specified comparator
+  @NotNull
+  static <T extends MutableInterval> PeekableIterator<T> mergingOverlappingIterator(@NotNull IntervalTreeImpl<T> tree1,
+                                                                                    @NotNull TextRangeInterval tree1Range,
+                                                                                    @NotNull IntervalTreeImpl<T> tree2,
+                                                                                    @NotNull TextRangeInterval tree2Range,
+                                                                                    @NotNull Comparator<? super T> comparator) {
+    PeekableIterator<T> exact = tree1.overlappingIterator(tree1Range);
+    PeekableIterator<T> lines = tree2.overlappingIterator(tree2Range);
+    return mergeIterators(exact, lines, comparator);
+  }
+
+  @NotNull
+  static <T extends MutableInterval> PeekableIterator<T> mergeIterators(@NotNull final PeekableIterator<T> iterator1,
+                                                                        @NotNull final PeekableIterator<T> iterator2,
+                                                                        @NotNull final Comparator<? super T> comparator) {
+    return new PeekableIterator<T>() {
+      @Override
+      public void dispose() {
+        iterator1.dispose();
+        iterator2.dispose();
+      }
+
+      @Override
+      public boolean hasNext() {
+        return iterator1.hasNext() || iterator2.hasNext();
+      }
+
+      @Override
+      public T next() {
+        return choose().next();
+      }
+
+      @NotNull
+      private PeekableIterator<T> choose() {
+        T t1 = iterator1.hasNext() ? iterator1.peek() : null;
+        T t2 = iterator2.hasNext() ? iterator2.peek() : null;
+        if (t1 == null) {
+          return iterator2;
+        }
+        if (t2 == null) {
+          return iterator1;
+        }
+        int compare = comparator.compare(t1, t2);
+        return compare < 0 ? iterator1 : iterator2;
+      }
+
+      @Override
+      public void remove() {
+        throw new NoSuchElementException();
+      }
+
+      @Override
+      public T peek() {
+        return choose().peek();
+      }
+    };
+  }
 }
index 2e78c2cc067b475f79b41ea6a61f3f1bfb126861..a5bc62c1d2e76b9591305780ea6dc639ce236eb6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * 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.
@@ -23,11 +23,7 @@ import org.jetbrains.annotations.NotNull;
  * @author Denis Zhdanov
  * @since 12/27/10 4:26 PM
  */
-public class PersistentRangeMarkerUtil {
-
-  private PersistentRangeMarkerUtil() {
-  }
-
+class PersistentRangeMarkerUtil {
   /**
    * Answers if document region identified by the given range marker should be translated via diff algorithm on document change
    * identified by the given event.
@@ -37,7 +33,7 @@ public class PersistentRangeMarkerUtil {
    * @return              <code>true</code> if target document range referenced by the given range marker should be translated via
    *                      diff algorithm; <code>false</code> otherwise
    */
-  public static boolean shouldTranslateViaDiff(@NotNull DocumentEventImpl e, @NotNull RangeMarker rangeMarker) {
+  static boolean shouldTranslateViaDiff(@NotNull DocumentEventImpl e, @NotNull RangeMarker rangeMarker) {
     if (e.isWholeTextReplaced()) {
       // Perform translation if the whole text is replaced.
       return true;
index 00747fd4460e23552566c88e07edfc83dacba6a2..f69f416bb07fce1d9fa8b1766d016aca5e6a659f 100644 (file)
@@ -341,7 +341,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
 
   private void scheduleDropCachesWithInvalidStubPsi() {
     // invokeLater even if already on EDT, because
-    // we might be inside an index query and write actions might result in deadlocks there (http://youtrack.jetbrains.com/issue/IDEA-123118)
+    // we might be inside an index query and write actions might result in deadlocks there (https://youtrack.jetbrains.com/issue/IDEA-123118)
     ApplicationManager.getApplication().invokeLater(new Runnable() {
       @Override
       public void run() {
index a87dc9aeaa9395c377d39d08ef7e1096a667c1b4..f925311935a62ffc605028e8f3429a052f1f4fc9 100644 (file)
@@ -140,7 +140,7 @@ public class EmptyMarkupModel implements MarkupModelEx {
   @NotNull
   @Override
   public DisposableIterator<RangeHighlighterEx> overlappingIterator(int startOffset, int endOffset) {
-    return DisposableIterator.EMPTY;
+    return IntervalTreeImpl.PeekableIterator.EMPTY;
   }
 
   @Override
index ecde87920328659329318c964f1ff8ed4e325576..20d2f3f6b816efc7475755975361a0e3b1412e08 100644 (file)
@@ -48,7 +48,6 @@ import org.jetbrains.annotations.Nullable;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.NoSuchElementException;
 
 public class MarkupModelImpl extends UserDataHolderBase implements MarkupModelEx {
   private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.editor.impl.MarkupModelImpl");
@@ -285,54 +284,9 @@ public class MarkupModelImpl extends UserDataHolderBase implements MarkupModelEx
   public IntervalTreeImpl.PeekableIterator<RangeHighlighterEx> overlappingIterator(int startOffset, int endOffset) {
     startOffset = Math.max(0,startOffset);
     endOffset = Math.max(startOffset, endOffset);
-    IntervalTreeImpl.PeekableIterator<RangeHighlighterEx> exact = myHighlighterTree.overlappingIterator(new TextRangeInterval(startOffset, endOffset));
-    IntervalTreeImpl.PeekableIterator<RangeHighlighterEx> lines = myHighlighterTreeForLines.overlappingIterator(roundToLineBoundaries(startOffset, endOffset));
-    return merge(exact, lines);
-  }
-
-  @NotNull
-  protected static <T extends RangeHighlighterEx> IntervalTreeImpl.PeekableIterator<T> merge(@NotNull final IntervalTreeImpl.PeekableIterator<T> iterator1, @NotNull final IntervalTreeImpl.PeekableIterator<T> iterator2) {
-    return new IntervalTreeImpl.PeekableIterator<T>() {
-      @Override
-      public void dispose() {
-        iterator1.dispose();
-        iterator2.dispose();
-      }
-
-      @Override
-      public boolean hasNext() {
-        return iterator1.hasNext() || iterator2.hasNext();
-      }
-
-      @Override
-      public T next() {
-        return choose().next();
-      }
-
-      @NotNull
-      private IntervalTreeImpl.PeekableIterator<T> choose() {
-        T t1 = iterator1.hasNext() ? iterator1.peek() : null;
-        T t2 = iterator2.hasNext() ? iterator2.peek() : null;
-        if (t1 == null) {
-          return iterator2;
-        }
-        if (t2 == null) {
-          return iterator1;
-        }
-        int compare = RangeHighlighterEx.BY_AFFECTED_START_OFFSET.compare(t1, t2);
-        return compare < 0 ? iterator1 : iterator2;
-      }
-
-      @Override
-      public void remove() {
-        throw new NoSuchElementException();
-      }
-
-      @Override
-      public T peek() {
-        return choose().peek();
-      }
-    };
+    return IntervalTreeImpl
+      .mergingOverlappingIterator(myHighlighterTree, new TextRangeInterval(startOffset, endOffset), myHighlighterTreeForLines,
+                                  roundToLineBoundaries(startOffset, endOffset), RangeHighlighterEx.BY_AFFECTED_START_OFFSET);
   }
 
   @NotNull
index 9e8beb103165e91b80dc37720b07c673cbb4e6d4..2cef0b6f12f39e52157450174894d11ee3d0bbd9 100644 (file)
@@ -68,7 +68,7 @@ public abstract class AbstractExternalSystemSettings<
 
   /**
    * Every time particular external system setting is changed corresponding message is sent via ide
-   * <a href="http://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+Messaging+infrastructure">messaging sub-system</a>.
+   * <a href="https://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+Messaging+infrastructure">messaging sub-system</a>.
    * The problem is that every external system implementation defines it's own topic/listener pair. Listener interface is derived
    * from the common {@link ExternalSystemSettingsListener} interface and is specific to external sub-system implementation.
    * However, it's possible that a client wants to perform particular actions based only on {@link ExternalSystemSettingsListener}
index 1cbd57ad710dde1f0ae7124fb1b88a2c7258822d..6496a1ddd74b91f4e4f80600e6280ad2d12f6fe6 100644 (file)
@@ -89,7 +89,16 @@ public abstract class CodeInsightAction extends AnAction {
     }
 
     final PsiFile file = PsiUtilBase.getPsiFileInEditor(editor, project);
-    presentation.setEnabled(file != null && isValidForFile(project, editor, file));
+    if (file == null) {
+      presentation.setEnabled(false);
+      return;
+    }
+
+    update(presentation, project, editor, file);
+  }
+
+  protected void update(@NotNull Presentation presentation, @NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
+    presentation.setEnabled(isValidForFile(project, editor, file));
   }
 
   protected boolean isValidForFile(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
index 2d5a3ddc9685ec89d78306ce633b360e5845d334..4b4411ae7e2c80143960ad51ebce28b5c260cb38 100644 (file)
@@ -24,7 +24,7 @@ public class LibrariesDownloadConnectionService extends SettingsConnectionServic
   }
 
   private LibrariesDownloadConnectionService() {
-    super("http://jetbrains.com/idea/download-assistant.xml", "http://frameworks.jetbrains.com");
+    super("https://www.jetbrains.com/idea/download-assistant.xml", "http://frameworks.jetbrains.com");
   }
 
 }
index fd124c633337e148ee093cb6725ae209ddc17945..4e3e9ef56f8fead39c32cf2de10fdb32b61aef1d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * 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.
@@ -17,22 +17,17 @@ package com.intellij.facet.frameworks;
 
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.JDOMUtil;
-import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.net.HttpConfigurable;
-import org.jdom.Document;
+import com.intellij.util.containers.ContainerUtilRt;
+import com.intellij.util.io.HttpRequests;
 import org.jdom.Element;
 import org.jdom.JDOMException;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.io.IOException;
-import java.io.InputStream;
 import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
+import java.util.Collections;
 import java.util.Map;
 
 public abstract class SettingsConnectionService {
@@ -40,23 +35,24 @@ public abstract class SettingsConnectionService {
 
   protected static final String SERVICE_URL_ATTR_NAME = "url";
 
-  private static final String myAgentID = "IntelliJ IDEA";
-
   private Map<String, String> myAttributesMap;
 
   @NotNull
   protected String[] getAttributeNames() {
-       return new String[] {SERVICE_URL_ATTR_NAME};
+    return new String[]{SERVICE_URL_ATTR_NAME};
   }
 
   private final String mySettingsUrl;
-  @Nullable private final String myDefaultServiceUrl;
+  @Nullable
+  private final String myDefaultServiceUrl;
 
   protected SettingsConnectionService(@NotNull String settingsUrl, @Nullable String defaultServiceUrl) {
     mySettingsUrl = settingsUrl;
     myDefaultServiceUrl = defaultServiceUrl;
   }
 
+  @SuppressWarnings("unused")
+  @Deprecated
   public String getSettingsUrl() {
     return mySettingsUrl;
   }
@@ -67,55 +63,39 @@ public abstract class SettingsConnectionService {
   }
 
   @Nullable
-  private Map<String, String> readSettings(String... attributes) {
-    Map<String, String> settings = ContainerUtil.newLinkedHashMap();
-    try {
-      String url = getSettingsUrl();
-      HttpConfigurable.getInstance().prepareURL(url);
-      String text = FileUtil.loadTextAndClose(getStream(new URL(url)));
-      if (text.startsWith("<html>") || text.startsWith("<!DOCTYPE html>")) {
-        LOG.info("HTML text obtained from " + url + ": " + StringUtil.first(text, 300, true));
-        return settings;
-      }
-      try {
-        Document document = JDOMUtil.loadDocument(text);
-        Element root = document.getRootElement();
-        for (String s : attributes) {
-          String attributeValue = root.getAttributeValue(s);
-          if (StringUtil.isNotEmpty(attributeValue)) {
-            settings.put(s, attributeValue);
+  private Map<String, String> readSettings(final String... attributes) {
+    return HttpRequests.request(mySettingsUrl)
+      .userAgent()
+      .connect(new HttpRequests.RequestProcessor<Map<String, String>>() {
+        @Override
+        public Map<String, String> process(@NotNull HttpRequests.Request request) throws IOException {
+          if (!request.isSuccessful()) {
+            HttpURLConnection connection = (HttpURLConnection)request.getConnection();
+            LOG.warn(connection.getResponseCode() + " " + connection.getResponseMessage());
+            return Collections.emptyMap();
           }
-        }
-      }
-      catch (JDOMException e) {
-        LOG.error("", e, text);
-      }
-    }
-    catch (MalformedURLException e) {
-      LOG.error(e);
-    }
-    catch (IOException e) {
-      // no route to host, unknown host, etc.
-    }
-    catch (Exception e) {
-      LOG.error(e);
-    }
 
-    return settings;
-  }
-
-  private static InputStream getStream(URL url) throws IOException {
-    final URLConnection connection = url.openConnection();
-    if (connection instanceof HttpURLConnection) {
-      connection.setRequestProperty("User-agent", myAgentID);
-    }
-    return connection.getInputStream();
+          Map<String, String> settings = ContainerUtilRt.newLinkedHashMap();
+          try {
+            Element root = JDOMUtil.load(request.getInputStream());
+            for (String s : attributes) {
+              String attributeValue = root.getAttributeValue(s);
+              if (StringUtil.isNotEmpty(attributeValue)) {
+                settings.put(s, attributeValue);
+              }
+            }
+          }
+          catch (JDOMException e) {
+            LOG.error(e);
+          }
+          return settings;
+        }
+      }, Collections.<String, String>emptyMap(), LOG);
   }
 
   @Nullable
   public String getServiceUrl() {
     final String serviceUrl = getSettingValue(SERVICE_URL_ATTR_NAME);
-
     return serviceUrl == null ? getDefaultServiceUrl() : serviceUrl;
   }
 
index 99955141d874edc808fdd610e794619a82d060ba..2412549c3f6cdb2c635e3f12315a2429d5b73f9f 100644 (file)
@@ -41,7 +41,7 @@ public class StdArrangementExtendableSettings extends StdArrangementSettings imp
   @NotNull private final Set<StdArrangementRuleAliasToken> myRulesAliases = new THashSet<StdArrangementRuleAliasToken>();
 
   // cached values
-  @NotNull private final List<ArrangementSectionRule> myExtendedSectionRules = new ArrayList<ArrangementSectionRule>();
+  @NotNull private final List<ArrangementSectionRule> myExtendedSectionRules = Collections.synchronizedList(new ArrayList<ArrangementSectionRule>());
 
   public StdArrangementExtendableSettings() {
     super();
@@ -79,20 +79,22 @@ public class StdArrangementExtendableSettings extends StdArrangementSettings imp
 
   @Override
   public List<ArrangementSectionRule> getExtendedSectionRules() {
-    if (myExtendedSectionRules.isEmpty()) {
-      final Map<String, StdArrangementRuleAliasToken> tokenIdToDefinition = new THashMap<String, StdArrangementRuleAliasToken>(myRulesAliases.size());
-      for (StdArrangementRuleAliasToken alias : myRulesAliases) {
-        final String id = alias.getId();
-        tokenIdToDefinition.put(id, alias);
-      }
+    synchronized (myExtendedSectionRules) {
+      if (myExtendedSectionRules.isEmpty()) {
+        final Map<String, StdArrangementRuleAliasToken> tokenIdToDefinition = new THashMap<String, StdArrangementRuleAliasToken>(myRulesAliases.size());
+        for (StdArrangementRuleAliasToken alias : myRulesAliases) {
+          final String id = alias.getId();
+          tokenIdToDefinition.put(id, alias);
+        }
 
-      final List<ArrangementSectionRule> sections = getSections();
-      for (ArrangementSectionRule section : sections) {
-        final List<StdArrangementMatchRule> extendedRules = new ArrayList<StdArrangementMatchRule>();
-        for (StdArrangementMatchRule rule : section.getMatchRules()) {
-          appendExpandedRules(rule, extendedRules, tokenIdToDefinition);
+        final List<ArrangementSectionRule> sections = getSections();
+        for (ArrangementSectionRule section : sections) {
+          final List<StdArrangementMatchRule> extendedRules = new ArrayList<StdArrangementMatchRule>();
+          for (StdArrangementMatchRule rule : section.getMatchRules()) {
+            appendExpandedRules(rule, extendedRules, tokenIdToDefinition);
+          }
+          myExtendedSectionRules.add(ArrangementSectionRule.create(section.getStartComment(), section.getEndComment(), extendedRules));
         }
-        myExtendedSectionRules.add(ArrangementSectionRule.create(section.getStartComment(), section.getEndComment(), extendedRules));
       }
     }
     return myExtendedSectionRules;
@@ -164,18 +166,21 @@ public class StdArrangementExtendableSettings extends StdArrangementSettings imp
 
   @Override
   public void addRule(@NotNull StdArrangementMatchRule rule) {
-    super.addRule(rule);
+    addSectionRule(rule);
+    myRulesByPriority.clear();
     myExtendedSectionRules.clear();
   }
 
   @NotNull
   @Override
   public List<? extends ArrangementMatchRule> getRulesSortedByPriority() {
-    if (myRulesByPriority.isEmpty()) {
-      for (ArrangementSectionRule rule : getExtendedSectionRules()) {
-        myRulesByPriority.addAll(rule.getMatchRules());
+    synchronized (myExtendedSectionRules) {
+      if (myRulesByPriority.isEmpty()) {
+        for (ArrangementSectionRule rule : getExtendedSectionRules()) {
+          myRulesByPriority.addAll(rule.getMatchRules());
+        }
+        ContainerUtil.sort(myRulesByPriority);
       }
-      ContainerUtil.sort(myRulesByPriority);
     }
     return myRulesByPriority;
   }
index 966ba69a2a0af18d4bdbbbe4c0fd96148c4f9d6c..7bda6a6c2fe57e9d32c4a026e142fa75278224ff 100644 (file)
@@ -35,7 +35,8 @@ public class StdArrangementSettings implements ArrangementSettings {
   @NotNull private final   List<ArrangementGroupingRule> myGroupings       = new ArrayList<ArrangementGroupingRule>();
 
   // cached values
-  @NotNull protected final List<StdArrangementMatchRule> myRulesByPriority = new ArrayList<StdArrangementMatchRule>();
+  @NotNull protected final List<StdArrangementMatchRule> myRulesByPriority =
+    Collections.synchronizedList(new ArrayList<StdArrangementMatchRule>());
 
   public StdArrangementSettings() {
   }
@@ -105,22 +106,24 @@ public class StdArrangementSettings implements ArrangementSettings {
   @NotNull
   @Override
   public List<? extends ArrangementMatchRule> getRulesSortedByPriority() {
-    if (myRulesByPriority.isEmpty()) {
-      for (ArrangementSectionRule rule : mySectionRules) {
-        myRulesByPriority.addAll(rule.getMatchRules());
+    synchronized (myRulesByPriority) {
+      if (myRulesByPriority.isEmpty()) {
+        for (ArrangementSectionRule rule : mySectionRules) {
+          myRulesByPriority.addAll(rule.getMatchRules());
+        }
+        ContainerUtil.sort(myRulesByPriority);
       }
-      ContainerUtil.sort(myRulesByPriority);
     }
     return myRulesByPriority;
   }
 
   public void addRule(@NotNull StdArrangementMatchRule rule) {
-    addRule(ArrangementSectionRule.create(rule));
+    addSectionRule(rule);
+    myRulesByPriority.clear();
   }
 
-  public void addRule(@NotNull ArrangementSectionRule rule) {
-    mySectionRules.add(rule);
-    myRulesByPriority.clear();
+  public void addSectionRule(@NotNull StdArrangementMatchRule rule) {
+    mySectionRules.add(ArrangementSectionRule.create(rule));
   }
 
   public void addGrouping(@NotNull ArrangementGroupingRule rule) {
index 0c1aa24f52d705404c466108f476c25461a26c4e..c9722adc4ea37c99050dbf65d6f08e2460312245 100644 (file)
@@ -42,23 +42,31 @@ public class TitleWithToolbar extends JPanel {
     ActionGroup group = (ActionGroup)actionManager.getAction(actionGroupId);
     ActionToolbar actionToolbar = actionManager.createActionToolbar(place, group, true);
     actionToolbar.setTargetComponent(targetComponent);
+    actionToolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
 
     add(new MyTitleComponent(title), new GridBag().weightx(1).anchor(GridBagConstraints.WEST).fillCellHorizontally());
     add(actionToolbar.getComponent(), new GridBag().anchor(GridBagConstraints.CENTER));
   }
 
   private class MyTitleComponent extends JComponent {
-    
+
+    private final Dimension myMinimumSize;
     @NotNull private final Border myBorder;
 
     MyTitleComponent(@NotNull String title) {
       myBorder = IdeBorderFactory.createTitledBorder(title);
+      Insets insets = myBorder.getBorderInsets(TitleWithToolbar.this);
+      myMinimumSize = new Dimension(1, insets.top);
     }
 
     @Override
     public Dimension getPreferredSize() {
-      Insets insets = myBorder.getBorderInsets(TitleWithToolbar.this);
-      return new Dimension(1, insets.top);
+      return myMinimumSize;
+    }
+
+    @Override
+    public Dimension getMinimumSize() {
+      return myMinimumSize;
     }
 
     @Override
index 72fe48a46e429f39bf28f968ec8a92f28607d7d0..45effe8e781eb68a901067b62080f4ab2a763f4d 100644 (file)
@@ -42,6 +42,7 @@ import com.intellij.psi.PsiDirectory;
 import com.intellij.psi.PsiDocumentManager;
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiManager;
+import com.intellij.util.Function;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.ContainerUtilRt;
 import com.intellij.util.diff.FilesTooBigForDiffException;
@@ -229,20 +230,27 @@ public class FormatChangedTextUtil {
   }
 
   @NotNull
-  public static List<PsiFile> getChangedFiles(@NotNull Project project, @NotNull Collection<Change> changes) {
-    List<PsiFile> files = ContainerUtil.newArrayList();
-    for (Change change : changes) {
-      VirtualFile vFile = change.getVirtualFile();
-      if (vFile != null) {
-        PsiFile file = PsiManager.getInstance(project).findFile(vFile);
-        if (file != null) files.add(file);
+  public static List<PsiFile> getChangedFiles(@NotNull final Project project, @NotNull Collection<Change> changes) {
+    Function<Change, PsiFile> changeToPsiFileMapper = new Function<Change, PsiFile>() {
+      private PsiManager myPsiManager = PsiManager.getInstance(project);
+
+      @Override
+      public PsiFile fun(Change change) {
+        VirtualFile vFile = change.getVirtualFile();
+        return vFile != null ? myPsiManager.findFile(vFile) : null;
       }
-    }
-    return files;
+    };
+
+    return ContainerUtil.mapNotNull(changes, changeToPsiFileMapper);
   }
 
   @NotNull
   public static List<TextRange> getChangedTextRanges(@NotNull Project project, @NotNull PsiFile file) throws FilesTooBigForDiffException {
+    List<TextRange> cachedChangedLines = getCachedChangedLines(project, file);
+    if (cachedChangedLines != null) {
+      return cachedChangedLines;
+    }
+
     Change change = ChangeListManager.getInstance(project).getChange(file.getVirtualFile());
     if (change == null) {
       return ContainerUtilRt.emptyList();
@@ -256,6 +264,22 @@ public class FormatChangedTextUtil {
                                   : ContainerUtil.<TextRange>emptyList();
   }
 
+  @Nullable
+  private static List<TextRange> getCachedChangedLines(@NotNull Project project, @NotNull PsiFile file) {
+    Document document = PsiDocumentManager.getInstance(project).getDocument(file);
+    if (document == null) {
+      return ContainerUtil.emptyList();
+    }
+
+    LineStatusTracker tracker = LineStatusTrackerManager.getInstance(project).getLineStatusTracker(document);
+    if (tracker != null) {
+      List<Range> ranges = tracker.getRanges();
+      return getChangedTextRanges(document, ranges);
+    }
+
+    return null;
+  }
+
   @Nullable
   private static String getRevisionedContentFrom(@NotNull Change change) {
     ContentRevision revision = change.getBeforeRevision();
@@ -284,15 +308,7 @@ public class FormatChangedTextUtil {
       return ContainerUtil.emptyList();
     }
 
-    List<Range> changedRanges;
-    LineStatusTracker tracker = LineStatusTrackerManager.getInstance(project).getLineStatusTracker(document);
-    if (tracker != null) {
-      changedRanges = tracker.getRanges();
-    }
-    else {
-      changedRanges = new RangesBuilder(document, documentFromVcs).getRanges();
-    }
-
+    List<Range> changedRanges = new RangesBuilder(document, documentFromVcs).getRanges();
     return getChangedTextRanges(document, changedRanges);
   }
 
index 3cc859da0d25558f04b25b7da009c11d29182598..a64917f88e4ec7e373802b86f1b26c4bd45d8857 100644 (file)
@@ -20,8 +20,6 @@ import com.intellij.openapi.application.Application;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.progress.ProcessCanceledException;
-import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.progress.util.ProgressIndicatorBase;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.Computable;
 import com.intellij.openapi.util.Trinity;
@@ -31,8 +29,8 @@ import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.*;
 import com.intellij.psi.PsiElement;
 import com.intellij.util.SystemProperties;
-import com.intellij.util.io.UrlConnectionUtil;
-import com.intellij.util.net.HttpConfigurable;
+import com.intellij.util.ThrowableConsumer;
+import com.intellij.util.io.HttpRequests;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -40,54 +38,53 @@ import org.jetbrains.annotations.Nullable;
 import java.io.*;
 import java.net.URL;
 import java.net.URLConnection;
+import java.util.Locale;
 import java.util.concurrent.Future;
 import java.util.jar.JarFile;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.zip.ZipEntry;
 
-/**
- * @author db
- * @since May 2, 2003
- */
 public abstract class AbstractExternalFilter {
+  private static final Logger LOG = Logger.getInstance(AbstractExternalFilter.class);
 
   private static final boolean EXTRACT_IMAGES_FROM_JARS = SystemProperties.getBooleanProperty("extract.doc.images", true);
 
-  @NotNull public static final String QUICK_DOC_DIR_NAME = "quickdoc";
-
-  private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.javadoc.JavaDocExternalFilter");
+  @NotNull
+  @NonNls
+  public static final String QUICK_DOC_DIR_NAME = "quickdoc";
 
-  private static final Pattern ourClassDataStartPattern  = Pattern.compile("START OF CLASS DATA", Pattern.CASE_INSENSITIVE);
-  private static final Pattern ourClassDataEndPattern    = Pattern.compile("SUMMARY ========", Pattern.CASE_INSENSITIVE);
+  private static final Pattern ourClassDataStartPattern = Pattern.compile("START OF CLASS DATA", Pattern.CASE_INSENSITIVE);
+  private static final Pattern ourClassDataEndPattern = Pattern.compile("SUMMARY ========", Pattern.CASE_INSENSITIVE);
   private static final Pattern ourNonClassDataEndPattern = Pattern.compile("<A NAME=", Pattern.CASE_INSENSITIVE);
 
-  protected static @NonNls final Pattern          ourAnchorsuffix         = Pattern.compile("#(.*)$");
-  protected static @NonNls final Pattern          ourHTMLFilesuffix       = Pattern.compile("/([^/]*[.][hH][tT][mM][lL]?)$");
-  private static @NonNls final   Pattern          ourAnnihilator          = Pattern.compile("/[^/^.]*/[.][.]/");
-  private static @NonNls final   Pattern          ourIMGselector          =
+  @NonNls
+  protected static final Pattern ourAnchorSuffix = Pattern.compile("#(.*)$");
+  protected static @NonNls final Pattern ourHtmlFileSuffix = Pattern.compile("/([^/]*[.][hH][tT][mM][lL]?)$");
+  private static @NonNls final Pattern ourAnnihilator = Pattern.compile("/[^/^.]*/[.][.]/");
+  private static @NonNls final Pattern ourImgSelector =
     Pattern.compile("<IMG[ \\t\\n\\r\\f]+SRC=\"([^>]*?)\"", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
-  private static @NonNls final   Pattern          ourPathInsideJarPattern = Pattern.compile(
+  private static @NonNls final Pattern ourPathInsideJarPattern = Pattern.compile(
     String.format("%s(.+\\.jar)!/(.+?)[^/]+", JarFileSystem.PROTOCOL_PREFIX),
     Pattern.CASE_INSENSITIVE | Pattern.DOTALL
   );
-  private static @NonNls final   String           JAR_PROTOCOL            = "jar:";
-  @NonNls private static final   String           HR                      = "<HR>";
-  @NonNls private static final   String           P                       = "<P>";
-  @NonNls private static final   String           DL                      = "<DL>";
-  @NonNls protected static final String           H2                      = "</H2>";
-  @NonNls protected static final String           HTML_CLOSE              = "</HTML>";
-  @NonNls protected static final String           HTML                    = "<HTML>";
-  @NonNls private static final   String           BR                      = "<BR>";
-  @NonNls private static final   String           DT                      = "<DT>";
-  private static final           Pattern          CHARSET_META_PATTERN    =
+  private static @NonNls final String JAR_PROTOCOL = "jar:";
+  @NonNls private static final String HR = "<HR>";
+  @NonNls private static final String P = "<P>";
+  @NonNls private static final String DL = "<DL>";
+  @NonNls protected static final String H2 = "</H2>";
+  @NonNls protected static final String HTML_CLOSE = "</HTML>";
+  @NonNls protected static final String HTML = "<HTML>";
+  @NonNls private static final String BR = "<BR>";
+  @NonNls private static final String DT = "<DT>";
+  private static final Pattern CHARSET_META_PATTERN =
     Pattern.compile("<meta[^>]+\\s*charset=\"?([\\w\\-]*)\\s*\">", Pattern.CASE_INSENSITIVE);
-  private static final           String           FIELD_SUMMARY           = "<!-- =========== FIELD SUMMARY =========== -->";
-  private static final           String           CLASS_SUMMARY           = "<div class=\"summary\">";
-  private final                  HttpConfigurable myHttpConfigurable      = HttpConfigurable.getInstance();
+  private static final String FIELD_SUMMARY = "<!-- =========== FIELD SUMMARY =========== -->";
+  private static final String CLASS_SUMMARY = "<div class=\"summary\">";
 
   protected static abstract class RefConvertor {
-    @NotNull private final Pattern mySelector;
+    @NotNull
+    private final Pattern mySelector;
 
     public RefConvertor(@NotNull Pattern selector) {
       mySelector = selector;
@@ -124,7 +121,7 @@ public abstract class AbstractExternalFilter {
     }
   }
 
-  protected final RefConvertor myIMGConvertor = new RefConvertor(ourIMGselector) {
+  protected final RefConvertor myIMGConvertor = new RefConvertor(ourImgSelector) {
     @Override
     protected String convertReference(String root, String href) {
       if (StringUtil.startsWithChar(href, '#')) {
@@ -192,7 +189,7 @@ public abstract class AbstractExternalFilter {
           root = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, "/" + path);
         }
       }
-      return ourHTMLFilesuffix.matcher(root).replaceAll("/") + href;
+      return ourHtmlFileSuffix.matcher(root).replaceAll("/") + href;
     }
   };
 
@@ -210,39 +207,40 @@ public abstract class AbstractExternalFilter {
   public String correctRefs(String root, String read) {
     String result = read;
 
-    for (RefConvertor myReferenceConvertor : getRefConvertors()) {
+    for (RefConvertor myReferenceConvertor : getRefConverters()) {
       result = myReferenceConvertor.refFilter(root, result);
     }
 
     return result;
   }
 
-  protected abstract RefConvertor[] getRefConvertors();
+  protected abstract RefConvertor[] getRefConverters();
 
-  @Nullable
-  private static Reader getReaderByUrl(final String surl, final HttpConfigurable httpConfigurable, final ProgressIndicator pi)
-    throws IOException
-  {
-    if (surl.startsWith(JAR_PROTOCOL)) {
-      VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(BrowserUtil.getDocURL(surl));
-
-      if (file == null) {
-        return null;
+  private static void getReaderByUrl(@NotNull String url, final @NotNull ThrowableConsumer<Reader, IOException> consumer)
+    throws IOException {
+    if (url.startsWith(JAR_PROTOCOL)) {
+      VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(BrowserUtil.getDocURL(url));
+      if (file != null) {
+        consumer.consume(new StringReader(VfsUtilCore.loadText(file)));
       }
-
-      return new StringReader(VfsUtilCore.loadText(file));
+      return;
     }
 
-    URL url = BrowserUtil.getURL(surl);
-    if (url == null) {
-      return null;
+    final URL parsedUrl = BrowserUtil.getURL(url);
+    if (parsedUrl == null) {
+      return;
     }
-    final URLConnection urlConnection = httpConfigurable.openConnection(url.toString());
-    final String contentEncoding = guessEncoding(url);
-    final InputStream inputStream =
-      pi != null ? UrlConnectionUtil.getConnectionInputStreamWithException(urlConnection, pi) : urlConnection.getInputStream();
-    //noinspection IOResourceOpenedButNotSafelyClosed
-    return contentEncoding != null ? new MyReader(inputStream, contentEncoding) : new MyReader(inputStream);
+
+    HttpRequests.request(parsedUrl.toString()).connect(new HttpRequests.RequestProcessor<Void>() {
+      @Override
+      public Void process(@NotNull HttpRequests.Request request) throws IOException {
+        String contentEncoding = guessEncoding(parsedUrl);
+        InputStream inputStream = request.getInputStream();
+        //noinspection IOResourceOpenedButNotSafelyClosed
+        consumer.consume(contentEncoding != null ? new MyReader(inputStream, contentEncoding) : new MyReader(inputStream));
+        return null;
+      }
+    });
   }
 
   private static String guessEncoding(URL url) {
@@ -264,31 +262,34 @@ public abstract class AbstractExternalFilter {
     catch (IOException ignored) {
     }
     finally {
-      if (reader != null)
+      if (reader != null) {
         try {
           reader.close();
         }
         catch (IOException ignored) {
         }
+      }
     }
     return result;
   }
 
   @Nullable
   @SuppressWarnings({"HardCodedStringLiteral"})
-  public String getExternalDocInfo(final String surl) throws Exception {
+  public String getExternalDocInfo(final String url) throws Exception {
     Application app = ApplicationManager.getApplication();
     if (!app.isUnitTestMode() && app.isDispatchThread() || app.isWriteAccessAllowed()) {
       LOG.error("May block indefinitely: shouldn't be called from EDT or under write lock");
       return null;
     }
 
-    if (surl == null) return null;
+    if (url == null) {
+      return null;
+    }
     if (MyJavadocFetcher.isFree()) {
-      final MyJavadocFetcher fetcher = new MyJavadocFetcher(surl, new MyDocBuilder() {
+      final MyJavadocFetcher fetcher = new MyJavadocFetcher(url, new MyDocBuilder() {
         @Override
-        public void buildFromStream(String surl, Reader input, StringBuffer result) throws IOException {
-          doBuildFromStream(surl, input, result);
+        public void buildFromStream(String url, Reader input, StringBuilder result) throws IOException {
+          doBuildFromStream(url, input, result);
         }
       });
       final Future<?> fetcherFuture = app.executeOnPooledThread(fetcher);
@@ -304,7 +305,7 @@ public abstract class AbstractExternalFilter {
         throw exception;
       }
 
-      final String docText = correctRefs(ourAnchorsuffix.matcher(surl).replaceAll(""), fetcher.getData());
+      final String docText = correctRefs(ourAnchorSuffix.matcher(url).replaceAll(""), fetcher.getData());
       if (LOG.isDebugEnabled()) {
         LOG.debug("Filtered JavaDoc: " + docText + "\n");
       }
@@ -318,13 +319,12 @@ public abstract class AbstractExternalFilter {
     return getExternalDocInfo(docURL);
   }
 
-  protected void doBuildFromStream(String surl, Reader input, StringBuffer data) throws IOException {
-    doBuildFromStream(surl, input, data, true);
+  protected void doBuildFromStream(String url, Reader input, StringBuilder data) throws IOException {
+    doBuildFromStream(url, input, data, true);
   }
 
-  protected void doBuildFromStream(String surl, Reader input, StringBuffer data, boolean search4Encoding) throws IOException {
-    BufferedReader buf = new BufferedReader(input);
-    Trinity<Pattern, Pattern, Boolean> settings = getParseSettings(surl);
+  protected void doBuildFromStream(final String url, Reader input, final StringBuilder data, boolean search4Encoding) throws IOException {
+    Trinity<Pattern, Pattern, Boolean> settings = getParseSettings(url);
     @NonNls Pattern startSection = settings.first;
     @NonNls Pattern endSection = settings.second;
     boolean useDt = settings.third;
@@ -349,6 +349,8 @@ public abstract class AbstractExternalFilter {
 
     String read;
     String contentEncoding = null;
+    @SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
+    BufferedReader buf = new BufferedReader(input);
     do {
       read = buf.readLine();
       if (read != null && search4Encoding && read.contains("charset")) {
@@ -360,21 +362,23 @@ public abstract class AbstractExternalFilter {
     }
     while (read != null && !startSection.matcher(StringUtil.toUpperCase(read)).find());
 
-    if (input instanceof MyReader && contentEncoding != null) {
-      if (!contentEncoding.equalsIgnoreCase(CharsetToolkit.UTF8) &&
-          !contentEncoding.equals(((MyReader)input).getEncoding()))
-      { //restart page parsing with correct encoding
-        Reader stream;
-        try {
-          stream = getReaderByUrl(surl, myHttpConfigurable, new ProgressIndicatorBase());
-        }
-        catch (ProcessCanceledException e) {
-          return;
-        }
-        data.delete(0, data.length());
-        doBuildFromStream(surl, new MyReader(((MyReader)stream).getInputStream(), contentEncoding), data, false);
+    if (input instanceof MyReader && contentEncoding != null && !contentEncoding.equalsIgnoreCase(CharsetToolkit.UTF8) &&
+        !contentEncoding.equals(((MyReader)input).getEncoding())) {
+      //restart page parsing with correct encoding
+      try {
+        final String finalContentEncoding = contentEncoding;
+        getReaderByUrl(url, new ThrowableConsumer<Reader, IOException>() {
+          @Override
+          public void consume(Reader reader) throws IOException {
+            data.delete(0, data.length());
+            doBuildFromStream(url, new MyReader(((MyReader)reader).getInputStream(), finalContentEncoding), data, false);
+          }
+        });
+      }
+      catch (ProcessCanceledException e) {
         return;
       }
+      return;
     }
 
     if (read == null) {
@@ -386,7 +390,7 @@ public abstract class AbstractExternalFilter {
       boolean skip = false;
 
       do {
-        if (StringUtil.toUpperCase(read).contains(H2) && !read.toUpperCase().contains("H2")) { // read=class name in <H2>
+        if (StringUtil.toUpperCase(read).contains(H2) && !read.toUpperCase(Locale.ENGLISH).contains("H2")) { // read=class name in <H2>
           data.append(H2);
           skip = true;
         }
@@ -403,8 +407,7 @@ public abstract class AbstractExternalFilter {
 
       data.append(DL);
 
-      StringBuffer classDetails = new StringBuffer();
-
+      StringBuilder classDetails = new StringBuilder();
       while (((read = buf.readLine()) != null) && !StringUtil.toUpperCase(read).equals(HR) && !StringUtil.toUpperCase(read).equals(P)) {
         if (reachTheEnd(data, read, classDetails)) return;
         appendLine(classDetails, read);
@@ -438,9 +441,9 @@ public abstract class AbstractExternalFilter {
   /**
    * Decides what settings should be used for parsing content represented by the given url.
    *
-   * @param url  url which points to the target content
-   * @return     following data: (start interested data boundary pattern; end interested data boundary pattern;
-   *             replace table data by &lt;dt&gt;)
+   * @param url url which points to the target content
+   * @return following data: (start interested data boundary pattern; end interested data boundary pattern;
+   * replace table data by &lt;dt&gt;)
    */
   @NotNull
   protected Trinity<Pattern, Pattern, Boolean> getParseSettings(@NotNull String url) {
@@ -448,7 +451,7 @@ public abstract class AbstractExternalFilter {
     Pattern endSection = ourClassDataEndPattern;
     boolean useDt = true;
 
-    Matcher anchorMatcher = ourAnchorsuffix.matcher(url);
+    Matcher anchorMatcher = ourAnchorSuffix.matcher(url);
     if (anchorMatcher.find()) {
       useDt = false;
       startSection = Pattern.compile(Pattern.quote("<a name=\"" + anchorMatcher.group(1) + "\""), Pattern.CASE_INSENSITIVE);
@@ -457,10 +460,9 @@ public abstract class AbstractExternalFilter {
     return Trinity.create(startSection, endSection, useDt);
   }
 
-  private static boolean reachTheEnd(StringBuffer data, String read, StringBuffer classDetails) {
+  private static boolean reachTheEnd(StringBuilder data, String read, StringBuilder classDetails) {
     if (StringUtil.indexOfIgnoreCase(read, FIELD_SUMMARY, 0) != -1 ||
-        StringUtil.indexOfIgnoreCase(read, CLASS_SUMMARY, 0) != -1)
-    {
+        StringUtil.indexOfIgnoreCase(read, CLASS_SUMMARY, 0) != -1) {
       data.append(classDetails);
       data.append(HTML_CLOSE);
       return true;
@@ -470,8 +472,9 @@ public abstract class AbstractExternalFilter {
 
   @Nullable
   static String parseContentEncoding(@NotNull String htmlLine) {
-    if (!htmlLine.contains("charset"))
+    if (!htmlLine.contains("charset")) {
       return null;
+    }
     final Matcher matcher = CHARSET_META_PATTERN.matcher(htmlLine);
     if (matcher.find()) {
       return matcher.group(1);
@@ -479,28 +482,27 @@ public abstract class AbstractExternalFilter {
     return null;
   }
 
-  private static void appendLine(final StringBuffer buffer, final String read) {
+  private static void appendLine(StringBuilder buffer, final String read) {
     buffer.append(read);
     buffer.append("\n");
   }
 
   private interface MyDocBuilder {
-    void buildFromStream(String surl, Reader input, StringBuffer result) throws IOException;
+    void buildFromStream(String url, Reader input, StringBuilder result) throws IOException;
   }
 
   private static class MyJavadocFetcher implements Runnable {
-    private static boolean      ourFree = true;
-    private final  StringBuffer data    = new StringBuffer();
-    private final String       surl;
+    private static boolean ourFree = true;
+    private final StringBuilder data = new StringBuilder();
+    private final String url;
     private final MyDocBuilder myBuilder;
-    private final Exception[] myExceptions = new Exception[1];
-    private final HttpConfigurable myHttpConfigurable;
+    private Exception myException;
 
-    public MyJavadocFetcher(final String surl, MyDocBuilder builder) {
-      this.surl = surl;
+    public MyJavadocFetcher(String url, MyDocBuilder builder) {
+      this.url = url;
       myBuilder = builder;
+      //noinspection AssignmentToStaticFieldFromInstanceMethod
       ourFree = false;
-      myHttpConfigurable = HttpConfigurable.getInstance();
     }
 
     public static boolean isFree() {
@@ -514,51 +516,36 @@ public abstract class AbstractExternalFilter {
     @Override
     public void run() {
       try {
-        if (surl == null) {
+        if (url == null) {
           return;
         }
 
-        Reader stream = null;
         try {
-          stream = getReaderByUrl(surl, myHttpConfigurable, new ProgressIndicatorBase());
+          getReaderByUrl(url, new ThrowableConsumer<Reader, IOException>() {
+            @Override
+            public void consume(Reader reader) throws IOException {
+              myBuilder.buildFromStream(url, reader, data);
+            }
+          });
         }
-        catch (ProcessCanceledException e) {
-          return;
+        catch (ProcessCanceledException ignored) {
         }
         catch (IOException e) {
-          myExceptions[0] = e;
-        }
-
-        if (stream == null) {
-          return;
-        }
-
-        try {
-          myBuilder.buildFromStream(surl, stream, data);
-        }
-        catch (final IOException e) {
-          myExceptions[0] = e;
-        }
-        finally {
-          try {
-            stream.close();
-          }
-          catch (IOException e) {
-            myExceptions[0] = e;
-          }
+          myException = e;
         }
       }
       finally {
+        //noinspection AssignmentToStaticFieldFromInstanceMethod
         ourFree = true;
       }
     }
 
     public Exception getException() {
-      return myExceptions[0];
+      return myException;
     }
 
     public void cleanup() {
-      myExceptions[0] = null;
+      myException = null;
     }
   }
 
index 27c2a4645a16829facfb34267d1a7c8bf95690b6..8a634a0f4ea852acf60d93ac555a372327eead9d 100644 (file)
 package com.intellij.codeInsight.generation.actions;
 
 import com.intellij.codeInsight.CodeInsightActionHandler;
-import com.intellij.codeInsight.actions.BaseCodeInsightAction;
 import com.intellij.codeInsight.generation.ImplementMethodsHandler;
 import com.intellij.lang.CodeInsightActions;
-import com.intellij.lang.Language;
 import com.intellij.lang.LanguageCodeInsightActionHandler;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.util.PsiUtilCore;
+import com.intellij.lang.LanguageExtension;
 import org.jetbrains.annotations.NotNull;
 
-public class ImplementMethodsAction extends BaseCodeInsightAction {
+public class ImplementMethodsAction extends PresentableActionHandlerBasedAction {
   @NotNull
   @Override
   protected CodeInsightActionHandler getHandler() {
     return new ImplementMethodsHandler();
   }
 
+  @NotNull
   @Override
-  protected boolean isValidForFile(@NotNull Project project, @NotNull Editor editor, @NotNull final PsiFile file) {
-    final Language language = PsiUtilCore.getLanguageAtOffset(file, editor.getCaretModel().getOffset());
-    final LanguageCodeInsightActionHandler codeInsightActionHandler = CodeInsightActions.IMPLEMENT_METHOD.forLanguage(language);
-    return codeInsightActionHandler != null && codeInsightActionHandler.isValidFor(editor, file);
-  }
-
-  @Override
-  public void update(final AnActionEvent event) {
-    if (CodeInsightActions.IMPLEMENT_METHOD.hasAnyExtensions()) {
-      event.getPresentation().setVisible(true);
-      super.update(event);
-    }
-    else {
-      event.getPresentation().setVisible(false);
-    }
+  protected LanguageExtension<LanguageCodeInsightActionHandler> getLanguageExtension() {
+    return CodeInsightActions.IMPLEMENT_METHOD;
   }
 }
\ No newline at end of file
index 134bba4eb3ee9af2c70418751c37365d0f9071a2..f4913284fd6bb1549d1b6d1441f681ecd1df5832 100644 (file)
 package com.intellij.codeInsight.generation.actions;
 
 import com.intellij.codeInsight.CodeInsightActionHandler;
-import com.intellij.codeInsight.actions.BaseCodeInsightAction;
 import com.intellij.codeInsight.generation.OverrideMethodsHandler;
 import com.intellij.lang.CodeInsightActions;
-import com.intellij.lang.Language;
 import com.intellij.lang.LanguageCodeInsightActionHandler;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.util.PsiUtilCore;
+import com.intellij.lang.LanguageExtension;
 import org.jetbrains.annotations.NotNull;
 
-public class OverrideMethodsAction extends BaseCodeInsightAction {
+public class OverrideMethodsAction extends PresentableActionHandlerBasedAction {
 
   @NotNull
   @Override
@@ -37,24 +31,9 @@ public class OverrideMethodsAction extends BaseCodeInsightAction {
     return new OverrideMethodsHandler();
   }
 
+  @NotNull
   @Override
-  protected boolean isValidForFile(@NotNull Project project, @NotNull Editor editor, @NotNull final PsiFile file) {
-    Language language = PsiUtilCore.getLanguageAtOffset(file, editor.getCaretModel().getOffset());
-    final LanguageCodeInsightActionHandler codeInsightActionHandler = CodeInsightActions.OVERRIDE_METHOD.forLanguage(language);
-    if (codeInsightActionHandler != null) {
-      return codeInsightActionHandler.isValidFor(editor, file);
-    }
-    return false;
-  }
-
-  @Override
-  public void update(final AnActionEvent event) {
-    if (CodeInsightActions.OVERRIDE_METHOD.hasAnyExtensions()) {
-      event.getPresentation().setVisible(true);
-      super.update(event);
-    }
-    else {
-      event.getPresentation().setVisible(false);
-    }
+  protected LanguageExtension<LanguageCodeInsightActionHandler> getLanguageExtension() {
+    return CodeInsightActions.OVERRIDE_METHOD;
   }
 }
\ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/generation/actions/PresentableActionHandlerBasedAction.java b/platform/lang-impl/src/com/intellij/codeInsight/generation/actions/PresentableActionHandlerBasedAction.java
new file mode 100644 (file)
index 0000000..5cd34ce
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+package com.intellij.codeInsight.generation.actions;
+
+import com.intellij.codeInsight.actions.BaseCodeInsightAction;
+import com.intellij.lang.Language;
+import com.intellij.lang.LanguageCodeInsightActionHandler;
+import com.intellij.lang.LanguageExtension;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.Presentation;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.util.PsiUtilCore;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public abstract class PresentableActionHandlerBasedAction extends BaseCodeInsightAction {
+  @Override
+  public void update(AnActionEvent event) {
+    // since previous handled may have changed the presentation, we need to restore it; otherwise it will stick. 
+    event.getPresentation().copyFrom(getTemplatePresentation());
+    super.update(event);
+  }
+
+  @Override
+  protected void update(@NotNull Presentation presentation, @NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
+    // avoid evaluating isValidFor several times unnecessary
+    
+    LanguageCodeInsightActionHandler handler = getValidHandler(editor, file);
+    presentation.setEnabled(handler != null);
+
+    if (handler instanceof PresentableLanguageCodeInsightActionHandler) {
+      ((PresentableLanguageCodeInsightActionHandler)handler).update(editor, file, presentation);
+    }
+  }
+
+  @Override
+  protected boolean isValidForFile(@NotNull Project project, @NotNull Editor editor, @NotNull final PsiFile file) {
+    return getValidHandler(editor, file) != null;
+  }
+
+  @Nullable
+  private LanguageCodeInsightActionHandler getValidHandler(@NotNull Editor editor, @NotNull PsiFile file) {
+    Language language = PsiUtilCore.getLanguageAtOffset(file, editor.getCaretModel().getOffset());
+    final LanguageCodeInsightActionHandler codeInsightActionHandler = getLanguageExtension().forLanguage(language);
+    if (codeInsightActionHandler != null && codeInsightActionHandler.isValidFor(editor, file)) return codeInsightActionHandler;
+    return null;
+  }
+
+  @NotNull
+  protected abstract LanguageExtension<LanguageCodeInsightActionHandler> getLanguageExtension();
+}
\ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/generation/actions/PresentableLanguageCodeInsightActionHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/generation/actions/PresentableLanguageCodeInsightActionHandler.java
new file mode 100644 (file)
index 0000000..ecf3ff4
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+package com.intellij.codeInsight.generation.actions;
+
+import com.intellij.lang.LanguageCodeInsightActionHandler;
+import com.intellij.openapi.actionSystem.Presentation;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.psi.PsiFile;
+import org.jetbrains.annotations.NotNull;
+
+public interface PresentableLanguageCodeInsightActionHandler extends LanguageCodeInsightActionHandler {
+  void update(@NotNull Editor editor, @NotNull PsiFile file, Presentation presentation);
+}
index 823fa1761b33078674c448be1f184b138c2b4c9c..04c9bcf535699f73ed558f1c5b52ad7dbcecc6ec 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * 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.
@@ -96,7 +96,7 @@ public abstract class TemplateLanguageErrorFilter extends HighlightErrorFilter {
     return true;
   }
 
-  private boolean shouldIgnoreErrorAt(@NotNull FileViewProvider viewProvider, int offset) {
+  protected boolean shouldIgnoreErrorAt(@NotNull FileViewProvider viewProvider, int offset) {
     PsiElement element = viewProvider.findElementAt(offset, viewProvider.getBaseLanguage());
     if (element instanceof PsiWhiteSpace) element = element.getNextSibling();
     if (element != null && myTemplateExpressionStartTokens.contains(element.getNode().getElementType())) {
index 36b1822e26f62f2d21bf2d73352d41c0dfeea4f9..44368e996ca41499ea6f7ecfc6dccb7d3d34565c 100644 (file)
@@ -712,7 +712,7 @@ public class CtrlMouseHandler extends AbstractProjectComponent {
 
   /**
    * It's possible that we need to expand quick doc control's width in order to provide better visual representation
-   * (see http://youtrack.jetbrains.com/issue/IDEA-101425). This method calculates that width expand.
+   * (see https://youtrack.jetbrains.com/issue/IDEA-101425). This method calculates that width expand.
    *
    * @param buttonWidth  icon button's width
    * @param updatedText  text which will be should at the quick doc control
index 26ecb5616972249f9270187a335840ab26ff6bf6..e17a49944cbada8f486db68133f4cb28d55e787e 100644 (file)
@@ -127,7 +127,7 @@ public abstract class CreateFromTemplateAction<T extends PsiElement> extends AnA
   }
 
   //todo append $END variable to templates?
-  protected static void moveCaretAfterNameIdentifier(PsiNameIdentifierOwner createdElement) {
+  public static void moveCaretAfterNameIdentifier(PsiNameIdentifierOwner createdElement) {
     final Project project = createdElement.getProject();
     final Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
     if (editor != null) {
index cf6f4d19d616117caa680c99f70de8880cf8c57a..5776f483264575a94ccdf70192f76a019059dc31 100644 (file)
@@ -133,8 +133,14 @@ public class FileTemplateManagerImpl extends FileTemplateManager implements Pers
 
   @Override
   public void setCurrentScheme(@NotNull FileTemplatesScheme scheme) {
-    for (FTManager child : myAllManagers) {
-      child.saveTemplates();
+    setScheme(scheme, true);
+  }
+
+  private void setScheme(@NotNull FileTemplatesScheme scheme, boolean saveBefore) {
+    if (saveBefore) {
+      for (FTManager child : myAllManagers) {
+        child.saveTemplates();
+      }
     }
     myScheme = scheme;
     for (FTManager manager : myAllManagers) {
@@ -434,7 +440,7 @@ public class FileTemplateManagerImpl extends FileTemplateManager implements Pers
   @Override
   public void loadState(State state) {
     XmlSerializerUtil.copyBean(state, myState);
-    setCurrentScheme(myProjectScheme != null && myProjectScheme.getName().equals(state.SCHEME) ? myProjectScheme : FileTemplatesScheme.DEFAULT);
+    setScheme(myProjectScheme != null && myProjectScheme.getName().equals(state.SCHEME) ? myProjectScheme : FileTemplatesScheme.DEFAULT, false);
   }
 
   public static class State {
index 3c839f2083127666ecd8f7bfb36941ab551475f5..0fe1a2f2ef4a8af39b50a072c30feeddefc9d162 100644 (file)
@@ -21,7 +21,6 @@ import com.intellij.openapi.editor.FoldRegion;
 import com.intellij.openapi.editor.FoldingGroup;
 import com.intellij.openapi.editor.ex.FoldingListener;
 import com.intellij.openapi.editor.ex.FoldingModelEx;
-import com.intellij.openapi.editor.impl.FoldRegionImpl;
 import com.intellij.openapi.editor.markup.TextAttributes;
 import com.intellij.openapi.util.Key;
 import com.intellij.openapi.util.TextRange;
@@ -35,12 +34,12 @@ import java.util.List;
 /**
  * @author cdr
  */
-public class FoldingModelWindow implements FoldingModelEx{
+class FoldingModelWindow implements FoldingModelEx{
   private final FoldingModelEx myDelegate;
   private final DocumentWindow myDocumentWindow;
   private final EditorWindow myEditorWindow;
 
-  public FoldingModelWindow(@NotNull FoldingModelEx delegate, @NotNull DocumentWindow documentWindow, @NotNull EditorWindow editorWindow) {
+  FoldingModelWindow(@NotNull FoldingModelEx delegate, @NotNull DocumentWindow documentWindow, @NotNull EditorWindow editorWindow) {
     myDelegate = delegate;
     myDocumentWindow = documentWindow;
     myEditorWindow = editorWindow;
@@ -82,12 +81,12 @@ public class FoldingModelWindow implements FoldingModelEx{
 
   @Override
   public boolean addFoldRegion(@NotNull final FoldRegion region) {
-    return myDelegate.addFoldRegion(((FoldingRegionWindow)region).getDelegate());
+    return myDelegate.addFoldRegion((FoldRegion)((FoldingRegionWindow)region).getDelegate());
   }
 
   @Override
   public void removeFoldRegion(@NotNull FoldRegion region) {
-    myDelegate.removeFoldRegion(((FoldingRegionWindow)region).getDelegate());
+    myDelegate.removeFoldRegion((FoldRegion)((FoldingRegionWindow)region).getDelegate());
   }
 
   @Override
@@ -172,7 +171,7 @@ public class FoldingModelWindow implements FoldingModelEx{
     FoldRegion hostRegion = myDelegate.createFoldRegion(hostRange.getStartOffset(), hostRange.getEndOffset(), placeholder, group, neverExpands);
     int startShift = Math.max(0, myDocumentWindow.hostToInjected(hostRange.getStartOffset()) - startOffset);
     int endShift = Math.max(0, endOffset - myDocumentWindow.hostToInjected(hostRange.getEndOffset()) - startShift);
-    FoldingRegionWindow window = new FoldingRegionWindow(myDocumentWindow, myEditorWindow, (FoldRegionImpl)hostRegion, startShift, endShift);
+    FoldingRegionWindow window = new FoldingRegionWindow(myDocumentWindow, myEditorWindow, hostRegion, startShift, endShift);
     hostRegion.putUserData(FOLD_REGION_WINDOW, window);
     return window;
   }
index 74b4bc32e1ec7648a51f4c3eb12e41985be85763..8a382f4c018a29765d2bd1e7f19e9e0e541231b3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -18,24 +18,24 @@ package com.intellij.injected.editor;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.FoldRegion;
 import com.intellij.openapi.editor.FoldingGroup;
-import com.intellij.openapi.editor.impl.FoldRegionImpl;
+import com.intellij.openapi.editor.ex.RangeMarkerEx;
 import org.jetbrains.annotations.NotNull;
 
 /**
  * User: cdr
  */
-public class FoldingRegionWindow extends RangeMarkerWindow implements FoldRegion {
+class FoldingRegionWindow extends RangeMarkerWindow implements FoldRegion {
   private final EditorWindow myEditorWindow;
 
-  private final FoldRegionImpl myHostRegion;
+  private final FoldRegion myHostRegion;
 
-  public FoldingRegionWindow(@NotNull DocumentWindow documentWindow,
-                             @NotNull EditorWindow editorWindow,
-                             @NotNull FoldRegionImpl hostRegion,
-                             int startShift,
-                             int endShift)
+  FoldingRegionWindow(@NotNull DocumentWindow documentWindow,
+                      @NotNull EditorWindow editorWindow,
+                      @NotNull FoldRegion hostRegion,
+                      int startShift,
+                      int endShift)
   {
-    super(documentWindow, hostRegion, startShift, endShift);
+    super(documentWindow, (RangeMarkerEx)hostRegion, startShift, endShift);
     myEditorWindow = editorWindow;
     myHostRegion = hostRegion;
   }
@@ -72,7 +72,7 @@ public class FoldingRegionWindow extends RangeMarkerWindow implements FoldRegion
   }
 
   @Override
-  public FoldRegionImpl getDelegate() {
-    return myHostRegion;
+  public RangeMarkerEx getDelegate() {
+    return (RangeMarkerEx)myHostRegion;
   }
 }
index fbe0d3070009e912d302dc839e83c0be0b953ecd..59dacc78eba7c90b9815fa91c8af936a9ec94f86 100644 (file)
@@ -29,12 +29,11 @@ import com.intellij.openapi.util.Key;
 import com.intellij.psi.PsiLanguageInjectionHost;
 import org.jetbrains.annotations.NotNull;
 
-public class RangeMarkerWindow implements RangeMarkerEx {
-
+class RangeMarkerWindow implements RangeMarkerEx {
   private final DocumentWindow myDocumentWindow;
-  private final RangeMarkerEx  myHostMarker;
-  private final int            myStartShift;
-  private final int            myEndShift;
+  private final RangeMarkerEx myHostMarker;
+  private final int myStartShift;
+  private final int myEndShift;
 
   /**
    * Creates new <code>RangeMarkerWindow</code> object with the given data.
@@ -51,7 +50,7 @@ public class RangeMarkerWindow implements RangeMarkerEx {
    * @param endShift        similar to the 'startShift' argument but specifies difference between the target injected host end offset
    *                        and end offset of the given host range marker at the injected text
    */
-  public RangeMarkerWindow(@NotNull DocumentWindow documentWindow, RangeMarkerEx hostMarker, int startShift, int endShift) {
+  RangeMarkerWindow(@NotNull DocumentWindow documentWindow, RangeMarkerEx hostMarker, int startShift, int endShift) {
     myDocumentWindow = documentWindow;
     myHostMarker = hostMarker;
     myStartShift = startShift;
index c0dd305dfb1698446f0d538534604562f3c50bfe..0e08183cd32d2eabacc2ead2a58767be18ddbdee 100644 (file)
@@ -45,7 +45,7 @@ public class GeneralColorsPage implements ColorSettingsPage, InspectionColorSett
     "\n" +
     "<todo>//TODO: Visit JB Web resources:</todo>\n"+
     "JetBrains Home Page: <hyperlink_f>http://www.jetbrains.com</hyperlink_f>\n" +
-    "JetBrains Developer Community: <hyperlink>http://www.jetbrains.com/devnet</hyperlink>\n" +
+    "JetBrains Developer Community: <hyperlink>https://www.jetbrains.com/devnet</hyperlink>\n" +
     "\n" +
     "Search:\n" +
     "  <search_result_wr>result</search_result_wr> = \"<search_text>text</search_text>, <search_text>text</search_text>, <search_text>text</search_text>\";\n" +
index e3157d5626c072e1bc04e07cb624720351cf8ac8..eec2fe76fa7f078d69f79fbf1973e52e0ce25b87 100644 (file)
@@ -44,7 +44,7 @@ import java.awt.*;
 import java.nio.charset.Charset;
 import java.util.Map;
 
-public class FileEncodingConfigurable implements SearchableConfigurable, OptionalConfigurable, Configurable.NoScroll {
+public class FileEncodingConfigurable implements SearchableConfigurable, Configurable.NoScroll {
   private final Project myProject;
   private EncodingFileTreeTable myTreeView;
   private JScrollPane myTreePanel;
@@ -205,10 +205,4 @@ public class FileEncodingConfigurable implements SearchableConfigurable, Optiona
   private void createUIComponents() {
     myTreePanel = ScrollPaneFactory.createScrollPane(new JBTable());
   }
-
-  @Override
-  public boolean needDisplay() {
-    // TODO[yole] cleaner API
-    return !PlatformUtils.isRubyMine();
-  }
 }
diff --git a/platform/lang-impl/src/com/intellij/openapi/vfs/encoding/FileEncodingConfigurableProvider.java b/platform/lang-impl/src/com/intellij/openapi/vfs/encoding/FileEncodingConfigurableProvider.java
new file mode 100644 (file)
index 0000000..86fb891
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+package com.intellij.openapi.vfs.encoding;
+
+import com.intellij.openapi.options.Configurable;
+import com.intellij.openapi.options.ConfigurableProvider;
+import com.intellij.openapi.project.Project;
+import com.intellij.util.PlatformUtils;
+
+/**
+ * @author Sergey.Malenkov
+ */
+public final class FileEncodingConfigurableProvider extends ConfigurableProvider {
+  private final Project myProject;
+
+  public FileEncodingConfigurableProvider(Project project) {
+    myProject = project;
+  }
+
+  @Override
+  public boolean canCreateConfigurable() {
+    return !PlatformUtils.isRubyMine();
+  }
+
+  @Override
+  public Configurable createConfigurable() {
+    return new FileEncodingConfigurable(myProject);
+  }
+}
index b66e76de48581424bdac78eba9c707ca47b31f70..5199133d7259017d28f5f0897ae987f3473bcd4b 100644 (file)
@@ -1,6 +1,5 @@
 package com.intellij.platform.templates.github;
 
-import com.intellij.openapi.application.ex.ApplicationInfoEx;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.progress.ProgressManager;
@@ -175,7 +174,7 @@ public class DownloadUtil {
 
     try {
       HttpRequests.request(location)
-        .userAgent(ApplicationInfoEx.getInstanceEx().getFullApplicationName())
+        .userAgent()
         .connect(new HttpRequests.RequestProcessor<Object>() {
           @Override
           public Object process(@NotNull HttpRequests.Request request) throws IOException {
index a56554696d0f9ffbf26d9c657ff24444ec66e07c..6e0ec0b218c357d602ee2ce89de3f41335a155ea 100644 (file)
@@ -143,8 +143,9 @@ public abstract class CallerChooserBase<M extends PsiElement> extends DialogWrap
   }
 
   private void updateEditorTexts(final MethodNodeBase<M> node) {
-    final MethodNodeBase<M> parentNode = (MethodNodeBase)node.getParent();
-    final String callerText = node != myRoot ? getText(node.getMethod()) : getEmptyCallerText();
+    final MethodNodeBase<M> parentNode = getCalleeNode(node);
+    final MethodNodeBase<M> callerNode = getCallerNode(node);
+    final String callerText = node != myRoot ? getText(callerNode.getMethod()) : getEmptyCallerText();
     final Document callerDocument = myCallerEditor.getDocument();
     final String calleeText = node != myRoot ? getText(parentNode.getMethod()) : getEmptyCalleeText();
     final Document calleeDocument = myCalleeEditor.getDocument();
@@ -157,7 +158,7 @@ public abstract class CallerChooserBase<M extends PsiElement> extends DialogWrap
       }
     });
 
-    final M caller = node.getMethod();
+    final M caller = callerNode.getMethod();
     final PsiElement callee = parentNode != null ? parentNode.getElementToSearch() : null;
     if (caller != null && caller.isPhysical() && callee != null) {
       HighlightManager highlighter = HighlightManager.getInstance(myProject);
@@ -171,6 +172,14 @@ public abstract class CallerChooserBase<M extends PsiElement> extends DialogWrap
     }
   }
 
+  protected MethodNodeBase<M> getCalleeNode(MethodNodeBase<M> node) {
+    return (MethodNodeBase<M>)node.getParent();
+  }
+
+  protected MethodNodeBase<M> getCallerNode(MethodNodeBase<M> node) {
+    return node;
+  }
+
   protected Collection<PsiElement> findElementsToHighlight(M caller, PsiElement callee) {
     Query<PsiReference> references = ReferencesSearch.search(callee, new LocalSearchScope(caller), false);
     return ContainerUtil.mapNotNull(references, new Function<PsiReference, PsiElement>() {
index 8d95afea60d13c8197734cb1171215873b1ffb1a..db18408e09b5a6d9464043ed8194e3a0bcb07baa 100644 (file)
@@ -138,7 +138,8 @@ public class SafeDeleteProcessor extends BaseRefactoringProcessor {
           final NonCodeUsageSearchInfo filter = delegate.findUsages(element, myElements, usages);
           if (filter != null) {
             for(PsiElement nonCodeUsageElement: filter.getElementsToSearch()) {
-              addNonCodeUsages(nonCodeUsageElement, usages, filter.getInsideDeletedCondition());
+              addNonCodeUsages(nonCodeUsageElement, usages, filter.getInsideDeletedCondition(), mySearchNonJava,
+                               mySearchInCommentsAndStrings);
             }
           }
           handled = true;
@@ -147,7 +148,7 @@ public class SafeDeleteProcessor extends BaseRefactoringProcessor {
       }
       if (!handled && element instanceof PsiNamedElement) {
         findGenericElementUsages(element, usages, myElements);
-        addNonCodeUsages(element, usages, getDefaultInsideDeletedCondition(myElements));
+        addNonCodeUsages(element, usages, getDefaultInsideDeletedCondition(myElements), mySearchNonJava, mySearchInCommentsAndStrings);
       }
     }
     final UsageInfo[] result = usages.toArray(new UsageInfo[usages.size()]);
@@ -421,7 +422,11 @@ public class SafeDeleteProcessor extends BaseRefactoringProcessor {
   }
 
 
-  private void addNonCodeUsages(final PsiElement element, List<UsageInfo> usages, @Nullable final Condition<PsiElement> insideElements) {
+  public static void addNonCodeUsages(final PsiElement element,
+                                      List<UsageInfo> usages,
+                                      @Nullable final Condition<PsiElement> insideElements,
+                                      boolean searchNonJava,
+                                      boolean searchInCommentsAndStrings) {
     UsageInfoFactory nonCodeUsageFactory = new UsageInfoFactory() {
       @Override
       public UsageInfo createUsageInfo(@NotNull PsiElement usage, int startOffset, int endOffset) {
@@ -431,13 +436,13 @@ public class SafeDeleteProcessor extends BaseRefactoringProcessor {
         return new SafeDeleteReferenceSimpleDeleteUsageInfo(usage, element, startOffset, endOffset, true, false);
       }
     };
-    if (mySearchInCommentsAndStrings) {
+    if (searchInCommentsAndStrings) {
       String stringToSearch = ElementDescriptionUtil.getElementDescription(element, NonCodeSearchDescriptionLocation.STRINGS_AND_COMMENTS);
       TextOccurrencesUtil.addUsagesInStringsAndComments(element, stringToSearch, usages, nonCodeUsageFactory);
     }
-    if (mySearchNonJava) {
+    if (searchNonJava) {
       String stringToSearch = ElementDescriptionUtil.getElementDescription(element, NonCodeSearchDescriptionLocation.NON_JAVA);
-      TextOccurrencesUtil.addTextOccurences(element, stringToSearch, GlobalSearchScope.projectScope(myProject), usages, nonCodeUsageFactory);
+      TextOccurrencesUtil.addTextOccurences(element, stringToSearch, GlobalSearchScope.projectScope(element.getProject()), usages, nonCodeUsageFactory);
     }
   }
 
index 2c0919ae77c76088a605608ef457feb13bc780e1..e1530abb1bff770edbdb1a3a0dfb0addb5a6e611 100644 (file)
@@ -37,19 +37,19 @@ import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.*;
-import com.intellij.util.io.HttpRequests;
 import com.intellij.util.concurrency.BoundedTaskExecutor;
 import com.intellij.util.containers.hash.LinkedHashMap;
 import com.intellij.util.download.DownloadableFileDescription;
 import com.intellij.util.download.FileDownloader;
+import com.intellij.util.io.HttpRequests;
 import com.intellij.util.net.IOExceptionDialog;
-import com.intellij.util.net.NetUtils;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.ide.PooledThreadExecutor;
 
 import javax.swing.*;
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Callable;
@@ -315,22 +315,8 @@ public class FileDownloaderImpl implements FileDownloader {
           return existingFile;
         }
 
-        File tempFile = FileUtil.createTempFile("download.", ".tmp");
-        boolean deleteFile = true;
-        OutputStream out = new BufferedOutputStream(new FileOutputStream(tempFile));
-        try {
-          indicator.setText2(IdeBundle.message("progress.download.file.text", description.getPresentableFileName(), presentableUrl));
-          indicator.setIndeterminate(size == -1);
-          NetUtils.copyStreamContent(indicator, request.getInputStream(), out, size);
-          deleteFile = false;
-          return tempFile;
-        }
-        finally {
-          out.close();
-          if (deleteFile) {
-            FileUtil.delete(tempFile);
-          }
-        }
+        indicator.setText2(IdeBundle.message("progress.download.file.text", description.getPresentableFileName(), presentableUrl));
+        return request.saveToFile(FileUtil.createTempFile("download.", ".tmp"), indicator);
       }
     });
   }
index 28bf035e654462ae97ca1e1f96a13d2f7ef29290..c1a8d5b62c16ff0e13b45ba59cdc5b57fdfd0168 100644 (file)
@@ -130,27 +130,4 @@ public class CapturingProcessHandler extends OSProcessHandler {
     return myOutput;
   }
 
-  @NotNull
-  public ProcessOutput runProcessCheckingCanceled() throws ProcessCanceledException {
-    startNotify();
-    while (!waitFor(20)) {
-      try {
-        ProgressManager.checkCanceled();
-      }
-      catch (ProcessCanceledException e) {
-        if (!isProcessTerminating() && !isProcessTerminated()) {
-          destroyProcess();
-        }
-        throw e;
-      }
-    }
-    if (waitFor()) {
-      myOutput.setExitCode(getProcess().exitValue());
-    }
-    else {
-      LOG.info("runProcess: exit value unavailable");
-    }
-    return myOutput;
-  }
-
 }
\ No newline at end of file
index 605f970a681d06b14b9d57c3857d640b0758d674..fdb9b9db4b2e6a24e70cbd2a25198bcb1fe23bd0 100644 (file)
@@ -127,6 +127,10 @@ public abstract class JBPopupFactory {
     List<JBPopup> popups = getChildPopups(parent);
     for (JBPopup each : popups) {
       if (each.isFocused()) return each;
+      JBPopup childFocusedPopup = getChildFocusedPopup(each.getContent());
+      if (childFocusedPopup != null) {
+        return childFocusedPopup;
+      }
     }
     return null;
   }
index 9d91d726d42a8d6220ec7eda88ab171d9dc1fd01..27039804b6d53d828aef0eff3725b63ddb7ca557 100644 (file)
@@ -827,6 +827,9 @@ public class JBTabsImpl extends JComponent
 
   @NotNull
   private ActionCallback _setSelected(final TabInfo info, final boolean requestFocus) {
+    if (!isEnabled()) {
+      return ActionCallback.REJECTED;
+    }
     if (mySelectionChangeHandler != null) {
       return mySelectionChangeHandler.execute(info, requestFocus, new ActiveRunnable() {
         @NotNull
index 7f9b96dc28b0a1b5d2adf34c3f678dec0993ffab..e79b8ac77603259bfaff11fc3e0991f6672cf562 100644 (file)
@@ -304,7 +304,7 @@ public class Tree extends JTree implements ComponentWithEmptyText, ComponentWith
   }
 
   protected boolean shouldShowBusyIconIfNeeded() {
-    // http://youtrack.jetbrains.com/issue/IDEA-101422 "Rotating wait symbol in Project list whenever typing"
+    // https://youtrack.jetbrains.com/issue/IDEA-101422 "Rotating wait symbol in Project list whenever typing"
     return hasFocus();
   }
 
index ccdeabe79ab3ad60fa91df9026256c9c1a48f85a..22abd66527bce804f74434f9b248d79eb9858314 100644 (file)
@@ -17,17 +17,23 @@ package com.intellij.util.io;
 
 import com.intellij.ide.IdeBundle;
 import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.components.ServiceManager;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.util.SystemInfo;
+import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream;
+import com.intellij.openapi.util.io.FileUtilRt;
 import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.util.ArrayUtil;
 import com.intellij.util.SystemProperties;
 import com.intellij.util.net.HttpConfigurable;
+import com.intellij.util.net.NetUtils;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.HttpsURLConnection;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.net.URLClassLoader;
@@ -44,20 +50,33 @@ import java.util.zip.GZIPInputStream;
  * });
  * }</pre>
  */
-public final class HttpRequests {
+public abstract class HttpRequests {
   private static final boolean ourWrapClassLoader =
     SystemInfo.isJavaVersionAtLeast("1.7") && !SystemProperties.getBooleanProperty("idea.parallel.class.loader", true);
 
   public interface Request {
-    @NotNull URLConnection getConnection() throws IOException;
-    @NotNull InputStream getInputStream() throws IOException;
+    @NotNull
+    URLConnection getConnection() throws IOException;
+
+    @NotNull
+    InputStream getInputStream() throws IOException;
+
+    boolean isSuccessful() throws IOException;
+
+    @NotNull
+    File saveToFile(@NotNull File file, @Nullable ProgressIndicator indicator) throws IOException;
+
+    byte[] toBytes(@Nullable ProgressIndicator indicator) throws IOException;
   }
 
   public interface RequestProcessor<T> {
     T process(@NotNull Request request) throws IOException;
   }
 
-  public static class RequestBuilder {
+  protected HttpRequests() {
+  }
+
+  public abstract static class RequestBuilder {
     private final String myUrl;
     private int myConnectTimeout = HttpConfigurable.CONNECTION_TIMEOUT;
     private int myTimeout = HttpConfigurable.READ_TIMEOUT;
@@ -66,8 +85,9 @@ public final class HttpRequests {
     private boolean myForceHttps;
     private HostnameVerifier myHostnameVerifier;
     private String myUserAgent;
+    private String myAccept;
 
-    private RequestBuilder(@NotNull String url) {
+    protected RequestBuilder(@NotNull String url) {
       myUrl = url;
     }
 
@@ -113,6 +133,15 @@ public final class HttpRequests {
       return this;
     }
 
+    @NotNull
+    public abstract RequestBuilder userAgent();
+
+    @NotNull
+    public RequestBuilder accept(@Nullable String mimeType) {
+      myAccept = mimeType;
+      return this;
+    }
+
     public <T> T connect(@NotNull RequestProcessor<T> processor) throws IOException {
       // todo[r.sh] drop condition in IDEA 15
       if (ourWrapClassLoader) {
@@ -122,13 +151,47 @@ public final class HttpRequests {
         return process(this, processor);
       }
     }
+
+    public <T> T connect(@NotNull RequestProcessor<T> processor, T errorValue, @Nullable Logger logger) {
+      try {
+        return connect(processor);
+      }
+      catch (Throwable e) {
+        if (logger != null) {
+          logger.warn(e);
+        }
+        return errorValue;
+      }
+    }
+
+    public void saveToFile(@NotNull final File file, @Nullable final ProgressIndicator indicator) throws IOException {
+      connect(new HttpRequests.RequestProcessor<Void>() {
+        @Override
+        public Void process(@NotNull HttpRequests.Request request) throws IOException {
+          request.saveToFile(file, indicator);
+          return null;
+        }
+      });
+    }
+
+    @NotNull
+    public byte[] toBytes(@Nullable final ProgressIndicator indicator) throws IOException {
+      return connect(new HttpRequests.RequestProcessor<byte[]>() {
+        @Override
+        public byte[] process(@NotNull HttpRequests.Request request) throws IOException {
+          return request.toBytes(indicator);
+        }
+      });
+    }
   }
 
   @NotNull
   public static RequestBuilder request(@NotNull String url) {
-    return new RequestBuilder(url);
+    return ServiceManager.getService(HttpRequests.class).createRequestBuilder(url);
   }
 
+  protected abstract RequestBuilder createRequestBuilder(@NotNull String url);
+
   private static <T> T wrapAndProcess(RequestBuilder builder, RequestProcessor<T> processor) throws IOException {
     // hack-around for class loader lock in sun.net.www.protocol.http.NegotiateAuthentication (IDEA-131621)
     ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
@@ -168,6 +231,12 @@ public final class HttpRequests {
         return myInputStream;
       }
 
+      @Override
+      public boolean isSuccessful() throws IOException {
+        URLConnection connection = getConnection();
+        return !(connection instanceof HttpURLConnection) || ((HttpURLConnection)connection).getResponseCode() == 200;
+      }
+
       private void cleanup() throws IOException {
         if (myInputStream != null) {
           myInputStream.close();
@@ -176,6 +245,53 @@ public final class HttpRequests {
           ((HttpURLConnection)myConnection).disconnect();
         }
       }
+
+      @NotNull
+      public byte[] toBytes(@Nullable ProgressIndicator indicator) throws IOException {
+        int contentLength = getConnection().getContentLength();
+        BufferExposingByteArrayOutputStream out = new BufferExposingByteArrayOutputStream(contentLength > 0 ? contentLength : 32 * 1024);
+        NetUtils.copyStreamContent(indicator, getInputStream(), out, contentLength);
+        return ArrayUtil.realloc(out.getInternalBuffer(), out.size());
+      }
+
+      @NotNull
+      public File saveToFile(@NotNull File file, @Nullable ProgressIndicator indicator) throws IOException {
+        OutputStream out = null;
+        boolean deleteFile = true;
+        try {
+          if (indicator != null) {
+            indicator.checkCanceled();
+          }
+
+          FileUtilRt.createParentDirs(file);
+          out = new FileOutputStream(file);
+          NetUtils.copyStreamContent(indicator, getInputStream(), out, getConnection().getContentLength());
+          deleteFile = false;
+        }
+        catch (IOException e) {
+          URLConnection connection = getConnection();
+          String errorMessage = "Cannot download '" + builder.myUrl + ", headers: " + connection.getHeaderFields();
+          if (connection instanceof HttpURLConnection) {
+            HttpURLConnection httpConnection = (HttpURLConnection)connection;
+            errorMessage += "', response code: " + httpConnection.getResponseCode()
+                            + ", response message: " + httpConnection.getResponseMessage();
+          }
+          throw new IOException(errorMessage, e);
+        }
+        finally {
+          try {
+            if (out != null) {
+              out.close();
+            }
+          }
+          finally {
+            if (deleteFile) {
+              FileUtilRt.delete(file);
+            }
+          }
+        }
+        return file;
+      }
     }
 
     RequestImpl request = new RequestImpl();
@@ -217,6 +333,9 @@ public final class HttpRequests {
       if (builder.myGzip) {
         connection.setRequestProperty("Accept-Encoding", "gzip");
       }
+      if (builder.myAccept != null) {
+        connection.setRequestProperty("Accept", builder.myAccept);
+      }
       connection.setUseCaches(false);
 
       if (connection instanceof HttpURLConnection) {
index 804e09bc1a009b6e209549d375e7f1911a2b8e64..e4f8d0237ebe606cc43816a6e2ff0d175f8f331a 100644 (file)
@@ -176,16 +176,17 @@ class HttpProxySettingsUi implements ConfigurableUi<HttpConfigurable> {
             try {
               //already checked for null above
               //noinspection ConstantConditions
-              HttpRequests.request(answer).connectTimeout(3 * 1000).readTimeout(3 * 1000).connect(new HttpRequests.RequestProcessor<Object>() {
-                @Override
-                public Object process(@NotNull HttpRequests.Request request) throws IOException {
-                  int responseCode = ((HttpURLConnection)request.getConnection()).getResponseCode();
-                  if (responseCode != HttpURLConnection.HTTP_OK) {
-                    exceptionReference.set(new IOException("Error code: " + responseCode));
+              HttpRequests.request(answer)
+                .readTimeout(3 * 1000)
+                .connect(new HttpRequests.RequestProcessor<Void>() {
+                  @Override
+                  public Void process(@NotNull HttpRequests.Request request) throws IOException {
+                    if (!request.isSuccessful()) {
+                      exceptionReference.set(new IOException("Error code: " + ((HttpURLConnection)request.getConnection()).getResponseCode()));
+                    }
+                    return null;
                   }
-                  return null;
-                }
-              });
+                });
             }
             catch (IOException e) {
               exceptionReference.set(e);
index c55b4d19f5b794f734db51fa4291dd5241471433..8e48bbe9227737acf95b750a2ec85f6c87a2c98d 100644 (file)
  */
 package com.intellij.ide.plugins;
 
-import com.intellij.openapi.project.Project;
 import com.intellij.internal.statistic.UsagesCollector;
 import com.intellij.internal.statistic.beans.GroupDescriptor;
 import com.intellij.internal.statistic.beans.UsageDescriptor;
+import com.intellij.openapi.project.Project;
 import com.intellij.util.Function;
 import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.NotNull;
@@ -36,7 +36,7 @@ public class DisabledPluginsUsagesCollector extends UsagesCollector {
 
   @NotNull
   public Set<UsageDescriptor> getUsages(@Nullable Project project) {
-    return ContainerUtil.map2Set(PluginManager.getDisabledPlugins(), new Function<String, UsageDescriptor>() {
+    return ContainerUtil.map2Set(PluginManagerCore.getDisabledPlugins(), new Function<String, UsageDescriptor>() {
       @Override
       public UsageDescriptor fun(String descriptor) {
         return new UsageDescriptor(descriptor, 1);
index 0c626909e9205fa0e8ff212ae2adb477827cfea0..dea22800f6e5a00f9a1bc4dd649705881898dea3 100644 (file)
@@ -27,7 +27,6 @@ import com.intellij.openapi.util.BuildNumber;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.util.io.HttpRequests;
 import com.intellij.util.io.URLUtil;
-import com.intellij.util.net.NetUtils;
 import org.apache.http.client.utils.URIBuilder;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -36,7 +35,10 @@ import org.xml.sax.SAXException;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-import java.io.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.net.HttpURLConnection;
 import java.net.URISyntaxException;
 import java.net.URLConnection;
@@ -125,13 +127,7 @@ public class RepositoryHelper {
         if (pluginListFile != null) {
           synchronized (RepositoryHelper.class) {
             FileUtil.ensureExists(pluginListFile.getParentFile());
-            OutputStream output = new FileOutputStream(pluginListFile);
-            try {
-              NetUtils.copyStreamContent(indicator, request.getInputStream(), output, connection.getContentLength());
-            }
-            finally {
-              output.close();
-            }
+            request.saveToFile(pluginListFile, indicator);
             return loadPluginList(pluginListFile);
           }
         }
index 657a32909ea17024b1a4ba441408c63edc0a6f50..2833b2b38e6635570492142f858e27e27c0c4a97 100644 (file)
@@ -227,6 +227,8 @@ public class StartupUtil {
   }
 
   private static void fixProcessEnvironment(Logger log) {
+    // winp should not unpack dlls into parent directory
+    System.setProperty("winp.unpack.dll.to.parent.dir", "false");
     if (!Main.isCommandLine()) {
       System.setProperty("__idea.mac.env.lock", "unlocked");
     }
index e96d3361e05bcc4b4b58a1938c6c19c5f875a022..fe9b8797ec6726c5d9d6babae09eb32d52b26382 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -20,74 +20,80 @@ import com.intellij.internal.statistic.persistence.ApplicationStatisticsPersiste
 import com.intellij.internal.statistic.persistence.ApplicationStatisticsPersistenceComponent;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
-import com.intellij.util.Function;
-import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.containers.hash.HashMap;
+import com.intellij.util.containers.ObjectIntHashMap;
+import gnu.trove.THashSet;
+import gnu.trove.TObjectIntProcedure;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import java.util.Map;
+import java.util.Collections;
 import java.util.Set;
 
 public abstract class AbstractApplicationUsagesCollector extends UsagesCollector {
-    private static final Logger LOG = Logger.getInstance("#com.intellij.internal.statistic.AbstractApplicationUsagesCollector");
+  private static final Logger LOG = Logger.getInstance(AbstractApplicationUsagesCollector.class);
 
-    public void persistProjectUsages(@NotNull Project project) {
-      try {
-        final Set<UsageDescriptor> projectUsages = getProjectUsages(project);
-        persistProjectUsages(project, projectUsages);
-      }
-      catch (CollectUsagesException e) {
-        LOG.info(e);
-      }
+  public void persistProjectUsages(@NotNull Project project) {
+    try {
+      persistProjectUsages(project, getProjectUsages(project));
     }
-
-    public void persistProjectUsages(@NotNull Project project, @NotNull Set<UsageDescriptor> usages) {
-        persistProjectUsages(project, usages, ApplicationStatisticsPersistenceComponent.getInstance());
+    catch (CollectUsagesException e) {
+      LOG.info(e);
     }
+  }
 
-    public void persistProjectUsages(@NotNull Project project,
-                                     @NotNull Set<UsageDescriptor> usages,
-                                     @NotNull ApplicationStatisticsPersistence persistence) {
-        persistence.persistUsages(getGroupId(), project, usages);
-    }
+  public void persistProjectUsages(@NotNull Project project, @NotNull Set<UsageDescriptor> usages) {
+    persistProjectUsages(project, usages, ApplicationStatisticsPersistenceComponent.getInstance());
+  }
 
-    @NotNull
-    public Set<UsageDescriptor> getApplicationUsages() {
-        return getApplicationUsages(ApplicationStatisticsPersistenceComponent.getInstance());
-    }
+  public void persistProjectUsages(@NotNull Project project,
+                                   @NotNull Set<UsageDescriptor> usages,
+                                   @NotNull ApplicationStatisticsPersistence persistence) {
+    persistence.persistUsages(getGroupId(), project, usages);
+  }
 
-    @NotNull
-    public Set<UsageDescriptor> getApplicationUsages(@NotNull final ApplicationStatisticsPersistence persistence) {
-        final Map<String, Integer> result = new HashMap<String, Integer>();
+  @NotNull
+  public Set<UsageDescriptor> getApplicationUsages() {
+    return getApplicationUsages(ApplicationStatisticsPersistenceComponent.getInstance());
+  }
 
-        for (Set<UsageDescriptor> usageDescriptors : persistence.getApplicationData(getGroupId()).values()) {
-            for (UsageDescriptor usageDescriptor : usageDescriptors) {
-                final String key = usageDescriptor.getKey();
-                final Integer count = result.get(key);
-                result.put(key, count == null ? 1 : count.intValue() + 1);
-            }
+  @NotNull
+  public Set<UsageDescriptor> getApplicationUsages(@NotNull ApplicationStatisticsPersistence persistence) {
+    ObjectIntHashMap<String> result = new ObjectIntHashMap<String>();
+    for (Set<UsageDescriptor> usageDescriptors : persistence.getApplicationData(getGroupId()).values()) {
+      if (!usageDescriptors.isEmpty()) {
+        result.ensureCapacity(usageDescriptors.size());
+        for (UsageDescriptor usageDescriptor : usageDescriptors) {
+          String key = usageDescriptor.getKey();
+          result.put(key, result.get(key, 0) + 1);
         }
-
-        return ContainerUtil.map2Set(result.entrySet(), new Function<Map.Entry<String, Integer>, UsageDescriptor>() {
-            @Override
-            public UsageDescriptor fun(Map.Entry<String, Integer> entry) {
-                return new UsageDescriptor(entry.getKey(), entry.getValue());
-            }
-        });
+      }
     }
 
-    @Override
-    @NotNull
-    public Set<UsageDescriptor> getUsages(@Nullable Project project) throws CollectUsagesException {
-        if (project != null) {
-          final Set<UsageDescriptor> projectUsages = getProjectUsages(project);
-          persistProjectUsages(project, projectUsages);
+    if (result.isEmpty()){
+      return Collections.emptySet();
+    }
+    else {
+      final THashSet<UsageDescriptor> descriptors = new THashSet<UsageDescriptor>(result.size());
+      result.forEachEntry(new TObjectIntProcedure<String>() {
+        @Override
+        public boolean execute(String key, int value) {
+          descriptors.add(new UsageDescriptor(key, value));
+          return true;
         }
+      });
+      return descriptors;
+    }
+  }
 
-        return getApplicationUsages();
+  @Override
+  @NotNull
+  public Set<UsageDescriptor> getUsages(@Nullable Project project) throws CollectUsagesException {
+    if (project != null) {
+      persistProjectUsages(project, getProjectUsages(project));
     }
+    return getApplicationUsages();
+  }
 
-    @NotNull
-    public abstract Set<UsageDescriptor> getProjectUsages(@NotNull Project project) throws CollectUsagesException;
+  @NotNull
+  public abstract Set<UsageDescriptor> getProjectUsages(@NotNull Project project) throws CollectUsagesException;
 }
index 7c5d473759c51184000cc266f240379845bd2618..1827884e974a5615877bff1a0bf06a677264adb0 100644 (file)
@@ -19,7 +19,6 @@ package com.intellij.internal.statistic;
  * @author Nikolay Matveev
  */
 public class CollectUsagesException extends Exception {
-
   public CollectUsagesException(String message) {
     super(message);
   }
index 5bd268bee864f3d07184d0c53615aa9f22b9b2f0..d23f274b1c89135674d2f048f3cd074ec7886ac9 100644 (file)
@@ -28,7 +28,7 @@ import java.util.Set;
 /**
  * @author Konstantin Bulenkov
  */
-public class JdkInfoUsageCollector extends UsagesCollector {
+class JdkInfoUsageCollector extends UsagesCollector {
   @NotNull
   @Override
   public Set<UsageDescriptor> getUsages(@Nullable Project project) throws CollectUsagesException {
index 771fec028ce51aa2c9b7b2997e35a83336f46462..76f8caebd3171a0461f0cc93c017ba1e7fdbefb0 100644 (file)
@@ -28,7 +28,7 @@ import java.util.Set;
 /**
  * @author peter
  */
-public class OsNameUsageCollector extends UsagesCollector {
+class OsNameUsageCollector extends UsagesCollector {
   @NotNull
   @Override
   public Set<UsageDescriptor> getUsages(@Nullable Project project) throws CollectUsagesException {
index 53ed4105f66c20e54fb8189b76dd2a1e741acc98..156d2d8cfa0e719824a2d9fec1e420e05680ea3c 100644 (file)
@@ -28,7 +28,7 @@ import java.util.Set;
 /**
  * @author peter
  */
-public class OsVersionUsageCollector extends UsagesCollector {
+class OsVersionUsageCollector extends UsagesCollector {
   @NotNull
   @Override
   public Set<UsageDescriptor> getUsages(@Nullable Project project) throws CollectUsagesException {
index b81fbe54e9f36fac9d9376fd6bca716ee06d09d6..cb7fc3cf7e08b81e81cf3cd1fae11a507c5d44c9 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -29,245 +29,234 @@ import com.intellij.internal.statistic.persistence.SentUsagesPersistence;
 import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent;
 import com.intellij.openapi.application.impl.ApplicationInfoImpl;
 import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.project.ProjectManager;
 import com.intellij.openapi.util.Condition;
 import com.intellij.openapi.util.KeyedExtensionCollector;
 import com.intellij.openapi.util.Pair;
+import com.intellij.openapi.vfs.CharsetToolkit;
 import com.intellij.util.Function;
 import com.intellij.util.Time;
 import com.intellij.util.containers.ContainerUtil;
+import gnu.trove.THashSet;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.*;
 
 public class StatisticsUploadAssistant {
+  private static final Logger LOG = Logger.getInstance(StatisticsUploadAssistant.class);
 
-    private static final Logger LOG = Logger.getInstance("#com.intellij.internal.statistic.StatisticsUploadAssistant");
+  public String getData() {
+    return getData(Collections.<String>emptySet());
+  }
 
-    public String getData() {
-        return getData(Collections.<String>emptySet());
-    }
+  public static boolean showNotification() {
+    return UsageStatisticsPersistenceComponent.getInstance().isShowNotification() &&
+           (System.currentTimeMillis() - Time.DAY > ((FeatureUsageTrackerImpl)FeatureUsageTracker.getInstance()).getFirstRunTime());
+  }
 
-    public static boolean showNotification() {
-        return UsageStatisticsPersistenceComponent.getInstance().isShowNotification() &&
-               (System.currentTimeMillis() - Time.DAY > ((FeatureUsageTrackerImpl)FeatureUsageTracker.getInstance()).getFirstRunTime()) ;
-    }
+  public static boolean isTimeToSend() {
+    return isTimeToSend(UsageStatisticsPersistenceComponent.getInstance());
+  }
 
-    public static boolean isTimeToSend() {
-        return isTimeToSend(UsageStatisticsPersistenceComponent.getInstance());
-    }
+  public static boolean isTimeToSend(UsageStatisticsPersistenceComponent settings) {
+    final long timeDelta = System.currentTimeMillis() - settings.getLastTimeSent();
 
-    public static boolean isTimeToSend(UsageStatisticsPersistenceComponent settings) {
-        final long timeDelta = System.currentTimeMillis() - settings.getLastTimeSent();
+    return Math.abs(timeDelta) > settings.getPeriod().getMillis();
+  }
 
-        return Math.abs(timeDelta) > settings.getPeriod().getMillis();
-    }
+  public static boolean isSendAllowed() {
+    return isSendAllowed(UsageStatisticsPersistenceComponent.getInstance());
+  }
 
-    public static boolean isSendAllowed() {
-        return isSendAllowed(UsageStatisticsPersistenceComponent.getInstance());
-    }
+  public static boolean isSendAllowed(final SentUsagesPersistence settings) {
+    return settings != null && settings.isAllowed();
+  }
 
-    public static boolean isSendAllowed(final SentUsagesPersistence settings) {
-        return settings != null && settings.isAllowed();
-    }
+  public String getData(@NotNull Set<String> disabledGroups) {
+    return getStringPatch(disabledGroups, ProjectManager.getInstance().getOpenProjects());
+  }
 
-    public String getData(@NotNull Set<String> disabledGroups) {
-        return getStringPatch(disabledGroups, ProjectManager.getInstance().getOpenProjects());
-    }
+  public static void persistSentPatch(@NotNull String patchStr) {
+    persistSentPatch(patchStr, UsageStatisticsPersistenceComponent.getInstance());
+  }
 
-    public static void persistSentPatch(@NotNull String patchStr) {
-        persistSentPatch(patchStr, UsageStatisticsPersistenceComponent.getInstance());
+  public static void persistSentPatch(@NotNull String patchStr, @NotNull SentUsagesPersistence persistenceComponent) {
+    Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages = mapToPatchedUsagesMap(ConvertUsagesUtil.convertString(patchStr));
+    if (!patchedUsages.isEmpty()) {
+      persistenceComponent.persistPatch(patchedUsages);
     }
-
-    public static void persistSentPatch(@NotNull String patchStr, @NotNull SentUsagesPersistence persistenceComponent) {
-        Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages = mapToPatchedUsagesMap(ConvertUsagesUtil.convertString(patchStr));
-
-        if (patchedUsages.size() > 0) persistenceComponent.persistPatch(patchedUsages);
+  }
+
+  @NotNull
+  public static String getStringPatch(@NotNull Set<String> disabledGroups, Project... project) {
+    return getStringPatch(disabledGroups, project, UsageStatisticsPersistenceComponent.getInstance(), 0);
+  }
+
+  @NotNull
+  public static String getStringPatch(@NotNull Set<String> disabledGroups,
+                                      @NotNull Project[] projects,
+                                      @NotNull SentUsagesPersistence usagesPersistence,
+                                      int maxSize) {
+    return getStringPatch(getPatchedUsages(disabledGroups, projects, usagesPersistence), maxSize);
+  }
+
+  public static String getStringPatch(@NotNull Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages, int maxSize) {
+    if (patchedUsages.isEmpty()) {
+      return "";
     }
 
-    @NotNull
-    public static String getStringPatch(@NotNull Set<String> disabledGroups, Project... project) {
-        return getStringPatch(disabledGroups, project, UsageStatisticsPersistenceComponent.getInstance(), 0);
+    String patchStr = ConvertUsagesUtil.convertUsages(patchedUsages);
+    return maxSize > 0 && patchStr.getBytes(CharsetToolkit.UTF8_CHARSET).length > maxSize ? ConvertUsagesUtil.cutPatchString(patchStr, maxSize) : patchStr;
+  }
+
+  @NotNull
+  public static Map<GroupDescriptor, Set<PatchedUsage>> getPatchedUsages(@NotNull Set<String> disabledGroups,
+                                                                         @NotNull Project[] projects,
+                                                                         @NotNull SentUsagesPersistence usagesPersistence) {
+    Map<GroupDescriptor, Set<PatchedUsage>> usages = new LinkedHashMap<GroupDescriptor, Set<PatchedUsage>>();
+    for (Project project : projects) {
+      Map<GroupDescriptor, Set<UsageDescriptor>> allUsages = getAllUsages(project, disabledGroups);
+      Map<GroupDescriptor, Set<UsageDescriptor>> sentUsages = filterDisabled(disabledGroups, usagesPersistence.getSentUsages());
+      usages.putAll(getPatchedUsages(allUsages, sentUsages));
     }
-
-    @NotNull
-    public static String getStringPatch(@NotNull Set<String> disabledGroups,
-                                        @NotNull Project[] projects,
-                                        @NotNull SentUsagesPersistence usagesPersistence,
-                                        int maxSize) {
-        final Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages = getPatchedUsages(disabledGroups, projects, usagesPersistence);
-
-        return getStringPatch(patchedUsages, maxSize);
+    return usages;
+  }
+
+  @NotNull
+  private static Map<GroupDescriptor, Set<UsageDescriptor>> filterDisabled(@NotNull Set<String> disabledGroups, @NotNull Map<GroupDescriptor, Set<UsageDescriptor>> usages) {
+    Map<GroupDescriptor, Set<UsageDescriptor>> filtered = new LinkedHashMap<GroupDescriptor, Set<UsageDescriptor>>();
+    for (Map.Entry<GroupDescriptor, Set<UsageDescriptor>> usage : usages.entrySet()) {
+      if (!disabledGroups.contains(usage.getKey().getId())) {
+        filtered.put(usage.getKey(), usage.getValue());
+      }
     }
-
-    public static String getStringPatch(@NotNull Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages, int maxSize) {
-        if (patchedUsages.size() == 0) return "";
-
-        String patchStr = ConvertUsagesUtil.convertUsages(patchedUsages);
-        if (maxSize > 0 && patchStr.getBytes().length > maxSize) {
-            patchStr = ConvertUsagesUtil.cutPatchString(patchStr, maxSize);
+    return filtered;
+  }
+
+  @NotNull
+  public static Map<GroupDescriptor, Set<PatchedUsage>> getPatchedUsages(@NotNull final Map<GroupDescriptor, Set<UsageDescriptor>> allUsages,
+                                                                         @NotNull SentUsagesPersistence usagesPersistence) {
+    return getPatchedUsages(allUsages, usagesPersistence.getSentUsages());
+  }
+
+  @NotNull
+  public static Map<GroupDescriptor, Set<PatchedUsage>> getPatchedUsages(@NotNull Map<GroupDescriptor, Set<UsageDescriptor>> allUsages,
+                                                                         Map<GroupDescriptor, Set<UsageDescriptor>> sentUsageMap) {
+    Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages = mapToPatchedUsagesMap(allUsages);
+    for (Map.Entry<GroupDescriptor, Set<UsageDescriptor>> sentUsageEntry : sentUsageMap.entrySet()) {
+      final GroupDescriptor sentUsageGroupDescriptor = sentUsageEntry.getKey();
+
+      final Set<UsageDescriptor> sentUsages = sentUsageEntry.getValue();
+
+      for (UsageDescriptor sentUsage : sentUsages) {
+        final PatchedUsage descriptor = findDescriptor(patchedUsages, Pair.create(sentUsageGroupDescriptor, sentUsage.getKey()));
+        if (descriptor == null) {
+          if (!patchedUsages.containsKey(sentUsageGroupDescriptor)) {
+            patchedUsages.put(sentUsageGroupDescriptor, new LinkedHashSet<PatchedUsage>());
+          }
+          patchedUsages.get(sentUsageGroupDescriptor).add(new PatchedUsage(sentUsage.getKey(), -sentUsage.getValue()));
         }
-
-        return patchStr;
-    }
-
-    @NotNull
-    public static Map<GroupDescriptor, Set<PatchedUsage>> getPatchedUsages(@NotNull Set<String> disabledGroups,
-                                                                           @NotNull Project[] projects,
-                                                                           @NotNull SentUsagesPersistence usagesPersistence) {
-        Map<GroupDescriptor, Set<PatchedUsage>> usages = new LinkedHashMap<GroupDescriptor, Set<PatchedUsage>>();
-
-        for (Project project : projects) {
-            final Map<GroupDescriptor, Set<UsageDescriptor>> allUsages = getAllUsages(project, disabledGroups);
-            final Map<GroupDescriptor, Set<UsageDescriptor>> sentUsages = filterDisabled(disabledGroups, usagesPersistence.getSentUsages());
-
-            usages.putAll(getPatchedUsages(allUsages, sentUsages));
+        else {
+          descriptor.subValue(sentUsage.getValue());
         }
-        return usages;
+      }
     }
 
-    @NotNull
-    private static Map<GroupDescriptor, Set<UsageDescriptor>> filterDisabled(@NotNull Set<String> disabledGroups, @NotNull Map<GroupDescriptor, Set<UsageDescriptor>> usages) {
-        Map<GroupDescriptor, Set<UsageDescriptor>> filtered = new LinkedHashMap<GroupDescriptor, Set<UsageDescriptor>>();
-
-        for (Map.Entry<GroupDescriptor, Set<UsageDescriptor>> usage : usages.entrySet()) {
-            if (!disabledGroups.contains(usage.getKey().getId())) {
-                filtered.put(usage.getKey(), usage.getValue());
-            }
+    return packCollection(patchedUsages, new Condition<PatchedUsage>() {
+      @Override
+      public boolean value(PatchedUsage patchedUsage) {
+        return patchedUsage.getDelta() != 0;
+      }
+    });
+  }
+
+  private static Map<GroupDescriptor, Set<PatchedUsage>> mapToPatchedUsagesMap(@NotNull Map<GroupDescriptor, Set<UsageDescriptor>> allUsages) {
+    Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages = new LinkedHashMap<GroupDescriptor, Set<PatchedUsage>>();
+    for (Map.Entry<GroupDescriptor, Set<UsageDescriptor>> entry : allUsages.entrySet()) {
+      patchedUsages.put(entry.getKey(), new THashSet<PatchedUsage>(ContainerUtil.map2Set(entry.getValue(), new Function<UsageDescriptor, PatchedUsage>() {
+        @Override
+        public PatchedUsage fun(UsageDescriptor usageDescriptor) {
+          return new PatchedUsage(usageDescriptor);
         }
-        return filtered;
+      })));
     }
-
-    @NotNull
-    public static Map<GroupDescriptor, Set<PatchedUsage>> getPatchedUsages(@NotNull final Map<GroupDescriptor, Set<UsageDescriptor>> allUsages,
-                                                                           @NotNull SentUsagesPersistence usagesPersistence) {
-        return getPatchedUsages(allUsages, usagesPersistence.getSentUsages());
+    return patchedUsages;
+  }
+
+  @NotNull
+  private static Map<GroupDescriptor, Set<PatchedUsage>> packCollection(@NotNull Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages, Condition<PatchedUsage> condition) {
+    Map<GroupDescriptor, Set<PatchedUsage>> result = new LinkedHashMap<GroupDescriptor, Set<PatchedUsage>>();
+    for (GroupDescriptor descriptor : patchedUsages.keySet()) {
+      Set<PatchedUsage> usages = packCollection(patchedUsages.get(descriptor), condition);
+      if (!usages.isEmpty()) {
+        result.put(descriptor, usages);
+      }
     }
 
-    @NotNull
-    public static Map<GroupDescriptor, Set<PatchedUsage>> getPatchedUsages(@NotNull final Map<GroupDescriptor, Set<UsageDescriptor>> allUsages, final Map<GroupDescriptor, Set<UsageDescriptor>> sentUsageMap) {
-        Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages = mapToPatchedUsagesMap(allUsages);
-
-        for (Map.Entry<GroupDescriptor, Set<UsageDescriptor>> sentUsageEntry : sentUsageMap.entrySet()) {
-            final GroupDescriptor sentUsageGroupDescriptor = sentUsageEntry.getKey();
+    return result;
+  }
 
-            final Set<UsageDescriptor> sentUsages = sentUsageEntry.getValue();
-
-            for (UsageDescriptor sentUsage : sentUsages) {
-                final PatchedUsage descriptor = findDescriptor(patchedUsages, Pair.create(sentUsageGroupDescriptor, sentUsage.getKey()));
-                if (descriptor == null) {
-                    if (!patchedUsages.containsKey(sentUsageGroupDescriptor)) {
-                        patchedUsages.put(sentUsageGroupDescriptor, new LinkedHashSet<PatchedUsage>());
-                    }
-                    patchedUsages.get(sentUsageGroupDescriptor).add(new PatchedUsage(sentUsage.getKey(), -sentUsage.getValue()));
-                } else {
-                    descriptor.subValue(sentUsage.getValue());
-                }
-            }
-
-        }
-
-        return packCollection(patchedUsages, new Condition<PatchedUsage>() {
-            @Override
-            public boolean value(PatchedUsage patchedUsage) {
-                return patchedUsage.getDelta() != 0;
-            }
-        });
-    }
-
-    private static Map<GroupDescriptor, Set<PatchedUsage>> mapToPatchedUsagesMap(Map<GroupDescriptor, Set<UsageDescriptor>> allUsages) {
-        Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages = new LinkedHashMap<GroupDescriptor, Set<PatchedUsage>>();
-        for (Map.Entry<GroupDescriptor, Set<UsageDescriptor>> entry : allUsages.entrySet()) {
-            patchedUsages.put(entry.getKey(), new HashSet<PatchedUsage>(ContainerUtil.map2Set(entry.getValue(), new Function<UsageDescriptor, PatchedUsage>() {
-                @Override
-                public PatchedUsage fun(UsageDescriptor usageDescriptor) {
-                    return new PatchedUsage(usageDescriptor);
-                }
-            })));
-        }
-        return patchedUsages;
+  @NotNull
+  private static <T> Set<T> packCollection(@NotNull Collection<T> set, @NotNull Condition<T> condition) {
+    final Set<T> result = new LinkedHashSet<T>();
+    for (T t : set) {
+      if (condition.value(t)) {
+        result.add(t);
+      }
     }
-
-    @NotNull
-    private static Map<GroupDescriptor, Set<PatchedUsage>> packCollection(@NotNull Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages, Condition<PatchedUsage> condition) {
-        Map<GroupDescriptor, Set<PatchedUsage>> result = new LinkedHashMap<GroupDescriptor, Set<PatchedUsage>>();
-        for (GroupDescriptor descriptor : patchedUsages.keySet()) {
-            final Set<PatchedUsage> usages = packCollection(patchedUsages.get(descriptor), condition);
-            if (usages.size() > 0) {
-                result.put(descriptor, usages);
-            }
-        }
-
-        return result;
+    return result;
+  }
+
+  @Nullable
+  public static <T extends UsageDescriptor> T findDescriptor(@NotNull Map<GroupDescriptor, Set<T>> descriptors,
+                                                             @NotNull final Pair<GroupDescriptor, String> id) {
+    final Set<T> usages = descriptors.get(id.getFirst());
+    if (usages == null) {
+      return null;
     }
 
-    @NotNull
-    private static <T> Set<T> packCollection(@NotNull Collection<T> set, @NotNull Condition<T> condition) {
-        final Set<T> result = new LinkedHashSet<T>();
-        for (T t : set) {
-            if (condition.value(t)) {
-                result.add(t);
-            }
+    return ContainerUtil.find(usages, new Condition<T>() {
+      @Override
+      public boolean value(T t) {
+        return id.getSecond().equals(t.getKey());
+      }
+    });
+  }
+
+  @NotNull
+  public static Map<GroupDescriptor, Set<UsageDescriptor>> getAllUsages(@Nullable Project project, @NotNull Set<String> disabledGroups) {
+    Map<GroupDescriptor, Set<UsageDescriptor>> usageDescriptors = new LinkedHashMap<GroupDescriptor, Set<UsageDescriptor>>();
+    for (UsagesCollector usagesCollector : UsagesCollector.EP_NAME.getExtensions()) {
+      GroupDescriptor groupDescriptor = usagesCollector.getGroupId();
+      if (!disabledGroups.contains(groupDescriptor.getId())) {
+        try {
+          usageDescriptors.put(groupDescriptor, usagesCollector.getUsages(project));
         }
-        return result;
-    }
-
-    @Nullable
-    public static <T extends UsageDescriptor> T findDescriptor(@NotNull Map<GroupDescriptor, Set<T>> descriptors,
-                                                               @NotNull final Pair<GroupDescriptor, String> id) {
-        final Set<T> usages = descriptors.get(id.getFirst());
-        if (usages == null) return null;
-
-        return ContainerUtil.find(usages, new Condition<T>() {
-            @Override
-            public boolean value(T t) {
-                return id.getSecond().equals(t.getKey());
-            }
-        });
-    }
-
-    @NotNull
-    public static Map<GroupDescriptor, Set<UsageDescriptor>> getAllUsages(@Nullable Project project, @NotNull Set<String> disabledGroups) {
-        Map<GroupDescriptor, Set<UsageDescriptor>> usageDescriptors = new LinkedHashMap<GroupDescriptor, Set<UsageDescriptor>>();
-
-        for (UsagesCollector usagesCollector : Extensions.getExtensions(UsagesCollector.EP_NAME)) {
-            final GroupDescriptor groupDescriptor = usagesCollector.getGroupId();
-
-            if (!disabledGroups.contains(groupDescriptor.getId())) {
-              try {
-                final Set<UsageDescriptor> usages = usagesCollector.getUsages(project);
-                usageDescriptors.put(groupDescriptor, usages);
-              }
-              catch (CollectUsagesException e) {
-                LOG.info(e);
-              }
-            }
+        catch (CollectUsagesException e) {
+          LOG.info(e);
         }
-
-        return usageDescriptors;
+      }
     }
+    return usageDescriptors;
+  }
 
-    private static final KeyedExtensionCollector<StatisticsService, String> COLLECTOR;
+  private static final KeyedExtensionCollector<StatisticsService, String> COLLECTOR;
 
-    static {
-        COLLECTOR = new KeyedExtensionCollector<StatisticsService, String>("com.intellij.statisticsService");
-    }
-
-    public static StatisticsService getStatisticsService() {
-        String key = ((ApplicationInfoImpl)ApplicationInfoImpl.getShadowInstance()).getStatisticsServiceKey();
-
-        StatisticsService service = key == null ? null : COLLECTOR.findSingle(key);
-
-        if (service != null) {
-            return service;
-        }
+  static {
+    COLLECTOR = new KeyedExtensionCollector<StatisticsService, String>("com.intellij.statisticsService");
+  }
 
-        return new RemotelyConfigurableStatisticsService(new StatisticsConnectionService(),
-                                                         new StatisticsHttpClientSender(),
-                                                         new StatisticsUploadAssistant());
+  public static StatisticsService getStatisticsService() {
+    String key = ((ApplicationInfoImpl)ApplicationInfoImpl.getShadowInstance()).getStatisticsServiceKey();
+    StatisticsService service = key == null ? null : COLLECTOR.findSingle(key);
+    if (service != null) {
+      return service;
     }
 
+    return new RemotelyConfigurableStatisticsService(new StatisticsConnectionService(),
+                                                     new StatisticsHttpClientSender(),
+                                                     new StatisticsUploadAssistant());
+  }
 }
index 406ef4637b64028e0c1f271b809d16dc3902912e..65f8c011533d8bedfdcf26360136b7fa0c0b7d59 100644 (file)
@@ -22,21 +22,21 @@ import com.intellij.internal.statistic.beans.UsageDescriptor;
 import com.intellij.openapi.editor.ex.EditorSettingsExternalizable;
 import com.intellij.openapi.project.Project;
 import com.intellij.util.ui.UIUtil;
+import gnu.trove.THashSet;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
-import java.util.HashSet;
 import java.util.Set;
 
 /**
  * @author Konstantin Bulenkov
  */
-public class UiInfoUsageCollector extends UsagesCollector {
+class UiInfoUsageCollector extends UsagesCollector {
   @NotNull
   @Override
   public Set<UsageDescriptor> getUsages(@Nullable Project project) throws CollectUsagesException {
-    final HashSet<UsageDescriptor> set = new HashSet<UsageDescriptor>();
+    Set<UsageDescriptor> set = new THashSet<UsageDescriptor>();
 
     add(set, "Nav Bar visible", navbar() ? 1 : 0);
     add(set, "Nav Bar floating", navbar() ? 0 : 1);
@@ -72,7 +72,7 @@ public class UiInfoUsageCollector extends UsagesCollector {
     return GroupDescriptor.create("UI Features");
   }
 
-  private static void add(HashSet<UsageDescriptor> set, String key, int value) {
+  private static void add(Set<UsageDescriptor> set, String key, int value) {
     set.add(new UsageDescriptor(key, value));
   }
 
index 99e62b9da29299d9e0c45d7726ad98f9cd57271d..1576a0eabcf41621ccb7179ceba2ae99b1e66030 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -31,16 +31,12 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
-/**
- * User: ksafonov
- */
 @State(
   name = "UsageTrigger",
-  storages = {@Storage(file = StoragePathMacros.APP_CONFIG + "/statistics.application.usages.xml", roamingType = RoamingType.DISABLED)}
+  storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/statistics.application.usages.xml", roamingType = RoamingType.DISABLED)
 )
 public class UsageTrigger implements PersistentStateComponent<UsageTrigger.State> {
-
-  public static class State {
+  final static class State {
     @Tag("counts")
     @MapAnnotation(surroundWithTag = false, keyAttributeName = "feature", valueAttributeName = "count")
     public Map<String, Integer> myValues = new HashMap<String, Integer>();
@@ -75,14 +71,13 @@ public class UsageTrigger implements PersistentStateComponent<UsageTrigger.State
     myState = state;
   }
 
-
-  public static class MyCollector extends UsagesCollector {
-
+  final static class MyCollector extends UsagesCollector {
     private static final GroupDescriptor GROUP = GroupDescriptor.create("features counts", GroupDescriptor.HIGHER_PRIORITY);
 
     @NotNull
     public Set<UsageDescriptor> getUsages(@Nullable final Project project) {
-      final State state = UsageTrigger.getInstance().getState();
+      State state = getInstance().getState();
+      assert state != null;
       return ContainerUtil.map2Set(state.myValues.entrySet(), new Function<Map.Entry<String, Integer>, UsageDescriptor>() {
         public UsageDescriptor fun(final Map.Entry<String, Integer> e) {
           return new UsageDescriptor(e.getKey(), e.getValue());
@@ -95,5 +90,4 @@ public class UsageTrigger implements PersistentStateComponent<UsageTrigger.State
       return GROUP;
     }
   }
-
 }
index e0c03c33625fd9a9d075b5b5c122491820eb13e1..17d0104406ea422aea81001d7652f61a756dd321 100644 (file)
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
 import java.util.Set;
 
 public abstract class UsagesCollector {
-  public static ExtensionPointName<UsagesCollector> EP_NAME = ExtensionPointName.create("com.intellij.statistics.usagesCollector");