Merge remote-tracking branch 'origin/master'
authorDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Tue, 22 Nov 2011 17:49:33 +0000 (18:49 +0100)
committerDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Tue, 22 Nov 2011 17:49:33 +0000 (18:49 +0100)
228 files changed:
.idea/modules.xml
RegExpSupport/src/META-INF/RegExpPlugin.xml
RegExpSupport/src/org/intellij/lang/regexp/RegExpWordSelectionFilter.java [new file with mode: 0644]
images/src/META-INF/ImagesPlugin.xml
images/src/org/intellij/images/ImagesBundle.properties
java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryOptionsPanel.java
java/idea-ui/src/com/intellij/ide/util/projectWizard/JdkChooserPanel.java
java/idea-ui/src/com/intellij/ide/util/projectWizard/ProjectJdkListRenderer.java
java/idea-ui/src/com/intellij/openapi/roots/ui/OrderEntryAppearanceServiceImpl.java
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JdkComboBox.java
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModuleJdkConfigurable.java
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectJdkConfigurable.java
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/classpath/ClasspathPanelImpl.java
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/dependencyAnalysis/AnalyzeDependenciesComponent.java
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/dependencyAnalysis/ModuleDependenciesAnalyzer.java
java/idea-ui/src/com/intellij/util/ui/classpath/ChooseLibrariesDialogBase.java [moved from platform/lang-impl/src/com/intellij/util/ui/classpath/ChooseLibrariesDialogBase.java with 99% similarity]
java/idea-ui/src/com/intellij/util/ui/classpath/ChooseLibrariesFromTablesDialog.java [moved from platform/lang-impl/src/com/intellij/util/ui/classpath/ChooseLibrariesFromTablesDialog.java with 100% similarity]
java/java-impl/src/com/intellij/codeInsight/CodeInsightUtil.java
java/java-impl/src/com/intellij/codeInsight/completion/JavaCharFilter.java
java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java
java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java
java/java-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java
java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java
java/java-impl/src/com/intellij/codeInsight/daemon/impl/actions/AddImportAction.java
java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java
java/java-impl/src/com/intellij/codeInsight/editorActions/StringLiteralCopyPasteProcessor.java
java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaElementSignatureProvider.java
java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocUtil.java
java/java-impl/src/com/intellij/lang/java/JavaRefactoringSupportProvider.java
java/java-impl/src/com/intellij/psi/impl/search/VariableInIncompleteCodeSearcher.java
java/java-impl/src/com/intellij/psi/util/proximity/ReferenceListWeigher.java [new file with mode: 0644]
java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeInfo.java
java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeInfoImpl.java
java/java-impl/src/com/intellij/refactoring/copy/CopyClassesHandler.java
java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpHelper.java
java/java-psi-api/src/com/intellij/psi/util/MethodSignatureUtil.java
java/java-tests/testData/codeInsight/completion/normal/ClassBeforeCast.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completion/normal/ClassBeforeCast_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completion/normal/DoubleConstant.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completion/normal/VoidMethodsInNonVoidContext.java [deleted file]
java/java-tests/testData/codeInsight/completion/normal/VoidMethodsInNonVoidContext_after.java [deleted file]
java/java-tests/testData/codeInsight/completion/normalSorting/PreferClassesInExtends.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completion/normalSorting/PreferInterfacesInImplements.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy
java/openapi/src/com/intellij/openapi/roots/ui/OrderEntryAppearanceService.java [moved from platform/lang-api/src/com/intellij/openapi/roots/ui/OrderEntryAppearanceService.java with 79% similarity]
jps/jps-builders/src/org/jetbrains/jps/incremental/Builder.java
jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java
jps/jps-builders/src/org/jetbrains/jps/incremental/groovy/GroovyBuilder.java
jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java
jps/jps-builders/src/org/jetbrains/jps/incremental/resourses/ResourcesBuilder.java
platform/core-impl/src/com/intellij/psi/SingleRootFileViewProvider.java
platform/icons/src/ide/rating.png [new file with mode: 0644]
platform/icons/src/ide/rating1.png [new file with mode: 0644]
platform/icons/src/ide/rating2.png [new file with mode: 0644]
platform/icons/src/ide/rating3.png [new file with mode: 0644]
platform/icons/src/ide/rating4.png [new file with mode: 0644]
platform/lang-api/src/com/intellij/execution/filters/Filter.java
platform/lang-impl/src/com/intellij/application/options/InitialConfigurationDialog.java
platform/lang-impl/src/com/intellij/application/options/colors/SimpleEditorPreview.java
platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java
platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java
platform/lang-impl/src/com/intellij/codeInsight/editorActions/AutoHardWrapHandler.java
platform/lang-impl/src/com/intellij/codeInsight/editorActions/CodeBlockProvider.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/codeInsight/editorActions/CodeBlockProviders.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/codeInsight/editorActions/CodeBlockUtil.java
platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/BaseIndentEnterHandler.java
platform/lang-impl/src/com/intellij/codeInsight/editorActions/moveUpDown/MoverWrapper.java
platform/lang-impl/src/com/intellij/codeInsight/folding/impl/AbstractElementSignatureProvider.java
platform/lang-impl/src/com/intellij/codeInsight/folding/impl/OffsetsElementSignatureProvider.java
platform/lang-impl/src/com/intellij/codeInsight/folding/impl/PsiNamesElementSignatureProvider.java
platform/lang-impl/src/com/intellij/codeInsight/highlighting/EscapeHandler.java
platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java
platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateSegments.java
platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java
platform/lang-impl/src/com/intellij/conversion/impl/ui/ConvertProjectDialog.java
platform/lang-impl/src/com/intellij/ide/navigationToolbar/ui/AbstractNavBarUI.java
platform/lang-impl/src/com/intellij/ide/navigationToolbar/ui/AquaNavBarUI.java
platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/NamedLibraryElementNode.java
platform/lang-impl/src/com/intellij/injected/editor/DocumentWindowImpl.java
platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/SdkConfigurationUtil.java
platform/lang-impl/src/com/intellij/packageDependencies/ui/DirectoryNode.java
platform/lang-impl/src/com/intellij/psi/impl/PsiDocumentManagerImpl.java
platform/lang-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureDetectorAction.java
platform/lang-impl/src/com/intellij/refactoring/changeSignature/ChangeSignaturePassFactory.java
platform/lang-impl/src/com/intellij/refactoring/rename/inplace/MemberInplaceRenamer.java
platform/lang-impl/src/com/intellij/refactoring/rename/inplace/VariableInplaceRenamer.java
platform/platform-api/src/com/intellij/ide/projectView/PresentationData.java
platform/platform-api/src/com/intellij/ide/util/PropertiesComponent.java
platform/platform-api/src/com/intellij/ui/components/JBLoadingPanel.java
platform/platform-api/src/com/intellij/ui/components/JBLoadingPanelListener.java [new file with mode: 0644]
platform/platform-api/src/com/intellij/ui/tabs/impl/JBEditorTabs.java
platform/platform-api/src/com/intellij/ui/tabs/impl/TabLabel.java
platform/platform-impl/src/com/intellij/diagnostic/ITNReporter.java
platform/platform-impl/src/com/intellij/errorreport/ErrorReportSender.java
platform/platform-impl/src/com/intellij/errorreport/bean/ErrorBean.java
platform/platform-impl/src/com/intellij/errorreport/error/UpdateAvailableException.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/errorreport/itn/ITNProxy.java
platform/platform-impl/src/com/intellij/execution/process/ScriptRunnerUtil.java
platform/platform-impl/src/com/intellij/ide/actions/CloseActiveTabAction.java
platform/platform-impl/src/com/intellij/ide/plugins/AvailablePluginColumnInfo.java
platform/platform-impl/src/com/intellij/ide/plugins/AvailablePluginsManagerMain.java
platform/platform-impl/src/com/intellij/ide/plugins/AvailablePluginsTableModel.java
platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerColumnInfo.java
platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java
platform/platform-impl/src/com/intellij/ide/plugins/PluginNode.java
platform/platform-impl/src/com/intellij/ide/plugins/RepositoryContentHandler.java
platform/platform-impl/src/com/intellij/notification/LogModel.java
platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionToolbarImpl.java
platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/Utils.java
platform/platform-impl/src/com/intellij/openapi/command/impl/CommandMerger.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/external/BinaryDiffTool.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/mergeTool/MergeVersion.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/util/DiffPanelOutterComponent.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CacheEntry.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CachingSoftWrapDataMapper.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapAwareDocumentParsingListener.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapAwareVisualSizeManager.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/TabData.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorsSplitters.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/Stripe.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowsPane.java
platform/platform-impl/testSrc/com/intellij/ide/ActivityMonitorTest.java
platform/platform-impl/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceOnDocumentModificationTest.java
platform/platform-resources-en/src/messages/ActionsBundle.properties
platform/platform-resources-en/src/messages/DiagnosticBundle.properties
platform/platform-resources-en/src/messages/IdeBundle.properties
platform/platform-resources-en/src/tips/CtrlW.html
platform/platform-resources/src/META-INF/LangExtensionPoints.xml
platform/platform-resources/src/META-INF/PlatformExtensions.xml
platform/util/src/com/intellij/openapi/ui/Splitter.java
platform/util/src/com/intellij/util/containers/Queue.java
platform/util/src/com/intellij/util/ui/UIUtil.java
platform/vcs-api/src/com/intellij/openapi/diff/impl/patch/PatchReader.java
platform/vcs-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffPanel.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesFragmentedDiffPanel.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesBrowser.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java
platform/vcs-impl/src/com/intellij/openapi/vcs/impl/LocalChangesUnderRoots.java
platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerTestUtil.java
plugins/InspectionGadgets/src/META-INF/plugin.xml
plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties
plugins/InspectionGadgets/src/com/siyeh/ig/style/SimplifiableAnnotationInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/visibility/AmbiguousFieldAccessInspection.java [new file with mode: 0644]
plugins/InspectionGadgets/src/com/siyeh/ig/visibility/AmbiguousMethodCallInspection.java
plugins/InspectionGadgets/src/inspectionDescriptions/AmbiguousFieldAccess.html [new file with mode: 0644]
plugins/InspectionGadgets/src/inspectionDescriptions/AmbiguousMethodCall.html
plugins/InspectionGadgets/src/inspectionDescriptions/SimplifiableAnnotation.html
plugins/InspectionGadgets/src/inspectionDescriptions/ThrowsRuntimeException.html
plugins/InspectionGadgets/test/com/siyeh/igtest/style/simplifiable_annotation/SimplifiableAnnotation.java
plugins/InspectionGadgets/test/com/siyeh/igtest/style/simplifiable_annotation/expected.xml
plugins/InspectionGadgets/test/com/siyeh/igtest/visibility/ambiguous/expected.xml
plugins/InspectionGadgets/test/com/siyeh/igtest/visibility/ambiguous_field_access/AmbiguousFieldAccess.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igtest/visibility/ambiguous_field_access/expected.xml [new file with mode: 0644]
plugins/InspectionGadgets/testsrc/com/siyeh/ig/visibility/AmbiguousFieldAccessInspectionTest.java [new file with mode: 0644]
plugins/IntelliLang/src/intentionDescriptions/QuickEditAction/after.java.template
plugins/IntelliLang/src/intentionDescriptions/QuickEditAction/before.java.template
plugins/android/src/org/jetbrains/android/compiler/AndroidAptCompiler.java
plugins/android/src/org/jetbrains/android/compiler/AndroidCompileUtil.java
plugins/android/src/org/jetbrains/android/compiler/AndroidMavenResourcesCompiler.java
plugins/android/src/org/jetbrains/android/compiler/ResourceEntry.java [new file with mode: 0644]
plugins/android/src/org/jetbrains/android/compiler/ResourceNamesValidityState.java [new file with mode: 0644]
plugins/android/src/org/jetbrains/android/facet/AndroidFacet.java
plugins/android/src/org/jetbrains/android/facet/AndroidResourceFilesListener.java
plugins/android/src/org/jetbrains/android/logcat/AndroidLogcatToolWindowView.form
plugins/android/src/org/jetbrains/android/logcat/AndroidLogcatToolWindowView.java
plugins/android/src/org/jetbrains/android/resourceManagers/ResourceManager.java
plugins/android/src/org/jetbrains/android/sdk/AndroidSdkImpl.java
plugins/android/src/org/jetbrains/android/uipreview/RenderServiceFactory.java
plugins/android/src/org/jetbrains/android/uipreview/RenderUtil.java
plugins/android/src/org/jetbrains/android/uipreview/VirtualFileWrapper.java [new file with mode: 0644]
plugins/android/src/org/jetbrains/android/uipreview/VirtualFolderWrapper.java [new file with mode: 0644]
plugins/android/src/org/jetbrains/android/util/BufferingFileWrapper.java [new file with mode: 0644]
plugins/android/src/org/jetbrains/android/util/BufferingFolderWrapper.java [new file with mode: 0644]
plugins/ant/src/com/intellij/lang/ant/config/impl/configuration/AntUIUtil.java
plugins/ant/src/com/intellij/lang/ant/config/impl/configuration/BuildFilePropertiesPanel.java
plugins/devkit/src/dom/impl/ExtensionDomExtender.java
plugins/git4idea/src/git4idea/commands/GitFileUtils.java
plugins/git4idea/src/git4idea/history/wholeTree/GitLogUI.java
plugins/git4idea/src/git4idea/push/GitPushResult.java
plugins/git4idea/src/git4idea/repo/GitRepository.java
plugins/git4idea/src/git4idea/repo/GitRepositoryFiles.java
plugins/git4idea/src/git4idea/repo/GitRepositoryManager.java
plugins/git4idea/src/git4idea/repo/GitUntrackedFilesHolder.java [moved from plugins/git4idea/src/git4idea/status/GitUntrackedFilesHolder.java with 95% similarity]
plugins/git4idea/src/git4idea/rollback/GitRollbackEnvironment.java
plugins/git4idea/src/git4idea/stash/GitShelveChangesSaver.java
plugins/git4idea/src/git4idea/status/GitNewChangesCollector.java
plugins/git4idea/tests/git4idea/repo/GitRepositoryTest.java
plugins/git4idea/tests/git4idea/tests/GitChangeProviderUnversionedTest.java
plugins/groovy/resources/intentionDescriptions/InvertIfIntention/after.groovy.template [moved from plugins/IntelliLang/src/intentionDescriptions/InvertIfIntention/after.groovy.template with 100% similarity]
plugins/groovy/resources/intentionDescriptions/InvertIfIntention/before.groovy.template [moved from plugins/IntelliLang/src/intentionDescriptions/InvertIfIntention/before.groovy.template with 100% similarity]
plugins/groovy/resources/intentionDescriptions/InvertIfIntention/description.html [moved from plugins/IntelliLang/src/intentionDescriptions/InvertIfIntention/description.html with 100% similarity]
plugins/groovy/src/META-INF/plugin.xml
plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java
plugins/groovy/src/org/jetbrains/plugins/groovy/editor/selection/GroovyLiteralSelectioner.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/weighers/GrReferenceListWeigher.java [new file with mode: 0644]
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/editor/GroovyLiteralCopyPasteProcessor.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrReferenceElementImpl.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrReferenceExpressionImpl.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/path/GrIndexPropertyImpl.java
plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/changeSignature/GrChangeInfoImpl.java
plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/changeSignature/GrChangeSignatureUsageProcessor.java
plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/changeSignature/GrMethodCallUsageInfo.java
plugins/groovy/src/org/jetbrains/plugins/groovy/runner/GroovyScriptRunConfiguration.java
plugins/groovy/test/org/jetbrains/plugins/groovy/GroovyCopyPasteTest.groovy
plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyCompletionTest.groovy
plugins/groovy/testdata/groovy/completion/PreferInterfacesInImplements.groovy [new file with mode: 0644]
plugins/svn4ideaOld/testData/svn/bin/svn [changed mode: 0644->0755]
resources/src/META-INF/IdeaPlugin.xml
resources/src/idea/RichPlatformPlugin.xml
xml/dom-impl/src/com/intellij/util/xml/impl/AbstractDomChildDescriptionImpl.java
xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java
xml/dom-impl/src/com/intellij/util/xml/reflect/DomExtensionImpl.java
xml/dom-impl/src/com/intellij/xml/impl/dom/DomElementXmlDescriptor.java
xml/dom-openapi/src/com/intellij/util/xml/reflect/AbstractDomChildrenDescription.java
xml/dom-openapi/src/com/intellij/util/xml/reflect/DomExtension.java
xml/impl/src/com/intellij/codeInsight/folding/impl/XmlElementSignatureProvider.java
xml/impl/src/com/intellij/javaee/HtmlLanguageLevelForm.form
xml/impl/src/com/intellij/psi/impl/source/xml/XmlTagImpl.java
xml/impl/src/com/intellij/xml/util/XmlUtil.java
xml/relaxng/test/org/intellij/plugins/relaxNG/RncParsingTest.java

index 91e527ee947d9b80fd8385c2b6d92e42dbd70a8a..968acca3e62db0b8ddcfb94dd66c8d7d600a51d5 100644 (file)
@@ -88,6 +88,8 @@
       <module fileurl="file://$PROJECT_DIR$/plugins/spellchecker/spellchecker.iml" filepath="$PROJECT_DIR$/plugins/spellchecker/spellchecker.iml" group="plugins" />
       <module fileurl="file://$PROJECT_DIR$/plugins/svn4ideaOld/svn4ideaOld.iml" filepath="$PROJECT_DIR$/plugins/svn4ideaOld/svn4ideaOld.iml" group="plugins/VCS" />
       <module fileurl="file://$PROJECT_DIR$/plugins/svn4ideaOld/svn4idea-testsOld.iml" filepath="$PROJECT_DIR$/plugins/svn4ideaOld/svn4idea-testsOld.iml" group="plugins/VCS" />
+      <module fileurl="file://$PROJECT_DIR$/plugins/svn4idea/svn4idea.iml" filepath="$PROJECT_DIR$/plugins/svn4idea/svn4idea.iml" group="plugins/VCS" />
+      <module fileurl="file://$PROJECT_DIR$/plugins/svn4idea/svn4idea-tests.iml" filepath="$PROJECT_DIR$/plugins/svn4idea/svn4idea-tests.iml" group="plugins/VCS" />
       <module fileurl="file://$PROJECT_DIR$/plugins/tasks/tasks-api/tasks-api.iml" filepath="$PROJECT_DIR$/plugins/tasks/tasks-api/tasks-api.iml" group="plugins/tasks" />
       <module fileurl="file://$PROJECT_DIR$/plugins/tasks/tasks-core/tasks-core.iml" filepath="$PROJECT_DIR$/plugins/tasks/tasks-core/tasks-core.iml" group="plugins/tasks" />
       <module fileurl="file://$PROJECT_DIR$/plugins/tasks/tasks-java/tasks-java.iml" filepath="$PROJECT_DIR$/plugins/tasks/tasks-java/tasks-java.iml" group="plugins/tasks" />
index 54f6f622997a3ccf8631b87cfef79fe503a7ef2e..3c37bbbac87590985df6c1c51da30b9d3c28aebf 100644 (file)
@@ -9,5 +9,6 @@
     <lang.braceMatcher language="RegExp" implementationClass="org.intellij.lang.regexp.RegExpBraceMatcher"/>
     <lang.surroundDescriptor language="RegExp" implementationClass="org.intellij.lang.regexp.surroundWith.SimpleSurroundDescriptor"/>
     <colorSettingsPage implementation="org.intellij.lang.regexp.RegExpColorsPage"/>
+    <basicWordSelectionFilter implementation="org.intellij.lang.regexp.RegExpWordSelectionFilter"/>
   </extensions>
 </idea-plugin>
diff --git a/RegExpSupport/src/org/intellij/lang/regexp/RegExpWordSelectionFilter.java b/RegExpSupport/src/org/intellij/lang/regexp/RegExpWordSelectionFilter.java
new file mode 100644 (file)
index 0000000..29ce387
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2000-2011 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.intellij.lang.regexp;
+
+import com.intellij.openapi.util.Condition;
+import com.intellij.psi.PsiElement;
+import org.intellij.lang.regexp.psi.RegExpChar;
+
+/**
+ * @author yole
+ */
+public class RegExpWordSelectionFilter implements Condition<PsiElement> {
+  @Override
+  public boolean value(PsiElement element) {
+    if (element.getNode().getElementType() == RegExpTT.CHARACTER || element instanceof RegExpChar) {
+      return false;
+    }
+    return true;
+  }
+}
index 08dd5593068fe7d69d2b31131348a7b99e87985f..44ea70670b056c042969d883b8def4ce01bbe485 100644 (file)
@@ -2,8 +2,6 @@
 
   <vendor>Alexey Efimov</vendor>
 
-  <resource-bundle>org.intellij.images.ImagesBundle</resource-bundle>
-
   <extensions defaultExtensionNs="com.intellij">
     <errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
     <applicationConfigurable instance="org.intellij.images.options.impl.OptionsConfigurabe"/>
index 58cd915acb3eb0cc9701128277026588ae64822d..37ddc5e459146e5f8995b5c13b9ef5a255e0351e 100644 (file)
@@ -34,42 +34,6 @@ external.editor.executable.path=Executable &path:
 external.editor.border.title=External Editor
 main.page.border.title=Editor
 
-
-# actions
-action.Images.EditExternaly.text=Jump to External Editor
-action.Images.EditExternaly.description=Open image in external editor
-
-action.Images.ToggleTransparencyChessboard.text=Transparency Chessboard
-action.Images.ToggleTransparencyChessboard.description=Toggle transparency chessboard under image
-
-action.Images.Editor.ToggleGrid.text=Grid
-action.Images.Editor.ToggleGrid.description=Toggle grid lines over image
-
-action.Images.Editor.ZoomIn.text=Zoom In
-action.Images.Editor.ZoomIn.description=Increase image view
-
-action.Images.Editor.ZoomOut.text=Zoom Out
-action.Images.Editor.ZoomOut.description=Reduce image view
-
-action.Images.Editor.ActualSize.text=Actual Size
-action.Images.Editor.ActualSize.description=Resize image to actual size
-
-action.Images.Thumbnails.UpFolder.text=Level up
-action.Images.Thumbnails.UpFolder.description=Level up
-
-action.Images.Thumbnails.EnterAction.text=Browse
-action.Images.Thumbnails.EnterAction.description=Browse directory
-
-action.Images.Thumbnails.ToggleRecursive.text=Recursive
-action.Images.Thumbnails.ToggleRecursive.description=Toggle recursive browsing
-
-action.Images.Thumbnails.Hide.text=Close thumbnails
-action.Images.Thumbnails.Hide.description=Close thumbnails window
-
-
-action.Images.ShowThumbnails.text=Show Thumbnails
-action.Images.ShowThumbnails.description=Show thumbnails view for current directory
-
 plugin.Images.description=Provides image viewing and thumbnail browsing
 
 unknown.format=Unknown Format
index cd7e1726e73f3d477bea856498105aaa472072ce..75b7103796ebd1df9ae794a516464cfecfbb0537 100644 (file)
@@ -198,7 +198,7 @@ public class LibraryOptionsPanel implements Disposable {
         else if (value instanceof ExistingLibraryEditor) {
           final Library library = ((ExistingLibraryEditor)value).getLibrary();
           final boolean invalid = !((LibraryEx)library).getInvalidRootUrls(OrderRootType.CLASSES).isEmpty();
-          OrderEntryAppearanceService.getInstance(getProject()).forLibrary(library, invalid).customize(this);
+          OrderEntryAppearanceService.getInstance().forLibrary(getProject(), library, invalid).customize(this);
         }
         else if (value instanceof NewLibraryEditor) {
           setIcon(PlatformIcons.LIBRARY_ICON);
index 81001678cdccc16843e30031ec4f7e5d965fae59..ce9c42de07decbd9a0829283d10ece0cef889d3d 100644 (file)
@@ -34,7 +34,6 @@ import com.intellij.ui.ScrollPaneFactory;
 import com.intellij.ui.components.JBList;
 import com.intellij.util.ArrayUtil;
 import gnu.trove.TIntArrayList;
-import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
@@ -50,16 +49,16 @@ public class JdkChooserPanel extends JPanel {
   private JList myList = null;
   private DefaultListModel myListModel = null;
   private Sdk myCurrentJdk;
-  private final Project myProject;
+  @Nullable private final Project myProject;
   private SdkType[] myAllowedJdkTypes = null;
 
-  public JdkChooserPanel(@NotNull final Project project) {
+  public JdkChooserPanel(@Nullable final Project project) {
     super(new BorderLayout());
     myProject = project;
     myListModel = new DefaultListModel();
     myList = new JBList(myListModel);
     myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-    myList.setCellRenderer(new ProjectJdkListRenderer(myList.getCellRenderer(), project));
+    myList.setCellRenderer(new ProjectJdkListRenderer(myList.getCellRenderer()));
     //noinspection HardCodedStringLiteral
     myList.setPrototypeCellValue("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
 
index 3da29c098ca9fba479e34e2da380ca770bcaae50..011f6fa87e907ba0101bff406defef1ce70f645f 100644 (file)
  */
 package com.intellij.ide.util.projectWizard;
 
-import com.intellij.openapi.project.Project;
 import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.roots.ui.OrderEntryAppearanceService;
 import com.intellij.ui.HtmlListCellRenderer;
 import com.intellij.ui.SimpleTextAttributes;
-import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
 
@@ -29,17 +27,14 @@ import javax.swing.*;
  * @since May 18, 2005
  */
 public class ProjectJdkListRenderer extends HtmlListCellRenderer {
-  private final Project myProject;
-
-  public ProjectJdkListRenderer(final ListCellRenderer listCellRenderer, @NotNull final Project project) {
+  public ProjectJdkListRenderer(final ListCellRenderer listCellRenderer) {
     super(listCellRenderer);
-    myProject = project;
   }
 
   @Override
   public void doCustomize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
     if (value == null || value instanceof Sdk) {
-      OrderEntryAppearanceService.getInstance(myProject).forJdk((Sdk)value, false, selected, index != -1).customize(this);
+      OrderEntryAppearanceService.getInstance().forJdk((Sdk)value, false, selected, index != -1).customize(this);
     }
     else {
       final String str = value.toString();
index 2b13bb47642e087fe74932f5241ccf464d776a40..fdc1568b27a73895a09683cdd9aba9eb98684f66 100644 (file)
@@ -49,15 +49,9 @@ public class OrderEntryAppearanceServiceImpl extends OrderEntryAppearanceService
 
   private static final String NO_JDK = ProjectBundle.message("jdk.missing.item");
 
-  private final Project myProject;
-
-  public OrderEntryAppearanceServiceImpl(@NotNull final Project project) {
-    myProject = project;
-  }
-
   @NotNull
   @Override
-  public CellAppearanceEx forOrderEntry(@NotNull final OrderEntry orderEntry, final boolean selected) {
+  public CellAppearanceEx forOrderEntry(Project project, @NotNull final OrderEntry orderEntry, final boolean selected) {
     if (orderEntry instanceof JdkOrderEntry) {
       JdkOrderEntry jdkLibraryEntry = (JdkOrderEntry)orderEntry;
       Sdk jdk = jdkLibraryEntry.getJdk();
@@ -77,7 +71,7 @@ public class OrderEntryAppearanceServiceImpl extends OrderEntryAppearanceService
       }
       Library library = libraryOrderEntry.getLibrary();
       assert library != null : libraryOrderEntry;
-      return forLibrary(library, false);
+      return forLibrary(project, library, false);
     }
     else if (orderEntry.isSynthetic()) {
       String presentableName = orderEntry.getPresentableName();
@@ -95,8 +89,8 @@ public class OrderEntryAppearanceServiceImpl extends OrderEntryAppearanceService
 
   @NotNull
   @Override
-  public CellAppearanceEx forLibrary(@NotNull final Library library, final boolean hasInvalidRoots) {
-    final StructureConfigurableContext context = ProjectStructureConfigurable.getInstance(myProject).getContext();
+  public CellAppearanceEx forLibrary(Project project, @NotNull final Library library, final boolean hasInvalidRoots) {
+    final StructureConfigurableContext context = ProjectStructureConfigurable.getInstance(project).getContext();
     final Icon icon = LibraryPresentationManager.getInstance().getCustomIcon(library, context);
 
     final String name = library.getName();
index 09d0ec08649c431185141a0a0e616829c0fb1225..e70b585dac5bf7b6feb17e8d6476e8a971528f3e 100644 (file)
@@ -50,9 +50,9 @@ import java.util.Comparator;
 class JdkComboBox extends ComboBoxWithWidePopup {
   private final JButton myEditButton = new JButton(ApplicationBundle.message("button.edit"));
 
-  public JdkComboBox(@NotNull final ProjectSdksModel jdkModel, @NotNull final Project project) {
+  public JdkComboBox(@NotNull final ProjectSdksModel jdkModel) {
     super(new JdkComboBoxModel(jdkModel));
-    setRenderer(new ProjectJdkListRenderer(getRenderer(), project) {
+    setRenderer(new ProjectJdkListRenderer(getRenderer()) {
       @Override
       public void doCustomize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
         if (JdkComboBox.this.isEnabled()) {
index c623a851fb69393424038fa66271220a482591e5..718f923efcea41898c1a2910c603a4261faaa2af 100644 (file)
@@ -101,7 +101,7 @@ public abstract class ModuleJdkConfigurable implements Disposable {
 
   private void init() {
     myJdkPanel = new JPanel(new GridBagLayout());
-    myCbModuleJdk = new JdkComboBox(myJdksModel, myModuleEditor.myProject);
+    myCbModuleJdk = new JdkComboBox(myJdksModel);
     myCbModuleJdk.insertItemAt(new JdkComboBox.ProjectJdkComboBoxItem(), 0);
     myCbModuleJdk.addActionListener(new ActionListener() {
       public void actionPerformed(ActionEvent e) {
index 41a92354294e5ac3eb455a574379205169f40ad5..54a36d3c569f6d58359aee78a02e3635c33ef075 100644 (file)
@@ -69,7 +69,6 @@ public class ProjectJdkConfigurable implements UnnamedConfigurable {
     myProject = project;
     myJdksModel = jdksModel;
     myJdksModel.addListener(myListener);
-    init();
   }
 
   @Nullable
@@ -78,6 +77,28 @@ public class ProjectJdkConfigurable implements UnnamedConfigurable {
   }
 
   public JComponent createComponent() {
+    if (myJdkPanel == null) {
+      myJdkPanel = new JPanel(new GridBagLayout());
+      myCbProjectJdk = new JdkComboBox(myJdksModel);
+      myCbProjectJdk.insertItemAt(new JdkComboBox.NoneJdkComboBoxItem(), 0);
+      myCbProjectJdk.addActionListener(new ActionListener() {
+        public void actionPerformed(ActionEvent e) {
+          if (myFreeze) return;
+          myJdksModel.setProjectSdk(myCbProjectJdk.getSelectedJdk());
+          clearCaches();
+        }
+      });
+      myJdkPanel.add(new JLabel(ProjectBundle.message("module.libraries.target.jdk.project.radio")), new GridBagConstraints(0, 0, 3, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 4, 0), 0, 0));
+      myJdkPanel.add(myCbProjectJdk, new GridBagConstraints(0, 1, 1, 1, 0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 4, 0, 0), 0, 0));
+      final JButton setUpButton = myCbProjectJdk.createSetupButton(myProject, myJdksModel, new JdkComboBox.NoneJdkComboBoxItem());
+      myJdkPanel.add(setUpButton, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 4, 0, 0), 0, 0));
+      myCbProjectJdk.appendEditButton(myProject, myJdkPanel, new GridBagConstraints(GridBagConstraints.RELATIVE, 1, 1, 1, 1.0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 4, 0, 0), 0, 0), new Computable<Sdk>() {
+        @Nullable
+        public Sdk compute() {
+          return myJdksModel.getProjectSdk();
+        }
+      });
+    }
     return myJdkPanel;
   }
 
@@ -100,29 +121,6 @@ public class ProjectJdkConfigurable implements UnnamedConfigurable {
     myFreeze = false;
   }
 
-  private void init() {
-    myJdkPanel = new JPanel(new GridBagLayout());
-    myCbProjectJdk = new JdkComboBox(myJdksModel, myProject);
-    myCbProjectJdk.insertItemAt(new JdkComboBox.NoneJdkComboBoxItem(), 0);
-    myCbProjectJdk.addActionListener(new ActionListener() {
-      public void actionPerformed(ActionEvent e) {
-        if (myFreeze) return;
-        myJdksModel.setProjectSdk(myCbProjectJdk.getSelectedJdk());
-        clearCaches();
-      }
-    });
-    myJdkPanel.add(new JLabel(ProjectBundle.message("module.libraries.target.jdk.project.radio")), new GridBagConstraints(0, 0, 3, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 4, 0), 0, 0));
-    myJdkPanel.add(myCbProjectJdk, new GridBagConstraints(0, 1, 1, 1, 0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 4, 0, 0), 0, 0));
-    final JButton setUpButton = myCbProjectJdk.createSetupButton(myProject, myJdksModel, new JdkComboBox.NoneJdkComboBoxItem());
-    myJdkPanel.add(setUpButton, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 4, 0, 0), 0, 0));
-    myCbProjectJdk.appendEditButton(myProject, myJdkPanel, new GridBagConstraints(GridBagConstraints.RELATIVE, 1, 1, 1, 1.0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 4, 0, 0), 0, 0), new Computable<Sdk>() {
-      @Nullable
-      public Sdk compute() {
-        return myJdksModel.getProjectSdk();
-      }
-    });
-  }
-
   private void clearCaches() {
     final ModuleStructureConfigurable rootConfigurable = ModuleStructureConfigurable.getInstance(myProject);
     Module[] modules = rootConfigurable.getModules();
index 44282063b90973d508be659e9f45176a762d2671..30bdd38f93f021d937f979ce5b4934a3e80e4b09 100644 (file)
@@ -604,14 +604,14 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
   private static CellAppearanceEx getCellAppearance(final ClasspathTableItem<?> item,
                                                     final StructureConfigurableContext context,
                                                     final boolean selected) {
-    final OrderEntryAppearanceService service = OrderEntryAppearanceService.getInstance(context.getProject());
+    final OrderEntryAppearanceService service = OrderEntryAppearanceService.getInstance();
     if (item instanceof InvalidJdkItem) {
       return service.forJdk(null, false, selected, true);
     }
     else {
       final OrderEntry entry = item.getEntry();
       assert entry != null : item;
-      return service.forOrderEntry(entry, selected);
+      return service.forOrderEntry(context.getProject(), entry, selected);
     }
   }
 
index 86723688984f462151270ebedfc2e5b3d413ce7f..56b11bd4709f18e68767e804b36b227b18d8f6c6 100644 (file)
@@ -636,10 +636,10 @@ public class AnalyzeDependenciesComponent extends MasterDetailsComponent {
           };
         }
         else {
-          return OrderEntryAppearanceService.getInstance(myModule.getProject()).forModule(e.getOwnerModule());
+          return OrderEntryAppearanceService.getInstance().forModule(e.getOwnerModule());
         }
       }
-      return OrderEntryAppearanceService.getInstance(myModule.getProject()).forOrderEntry(myExplanation.entry(), selected);
+      return OrderEntryAppearanceService.getInstance().forOrderEntry(myModule.getProject(), myExplanation.entry(), selected);
     }
 
     /**
index 678d6da86a1ec1a24b7f1ad680cd9624404e0f6e..2f6943e30d663b0293c483ad92477a96455e2311 100644 (file)
@@ -369,7 +369,7 @@ public class ModuleDependenciesAnalyzer {
     @NotNull
     @Override
     public CellAppearanceEx getAppearance(boolean isSelected) {
-      return OrderEntryAppearanceService.getInstance(myEntry.getOwnerModule().getProject()).forOrderEntry(myEntry, isSelected);
+      return OrderEntryAppearanceService.getInstance().forOrderEntry(myEntry.getOwnerModule().getProject(), myEntry, isSelected);
     }
   }
 
similarity index 99%
rename from platform/lang-impl/src/com/intellij/util/ui/classpath/ChooseLibrariesDialogBase.java
rename to java/idea-ui/src/com/intellij/util/ui/classpath/ChooseLibrariesDialogBase.java
index 02e4515890d230f30949166f980591d82fd80445..2598cc73098102966321a2d1ace3eb3a85f704fa 100644 (file)
@@ -314,7 +314,7 @@ public abstract class ChooseLibrariesDialogBase extends DialogWrapper {
   private static class LibraryDescriptor extends LibrariesTreeNodeBase<Library> {
     protected LibraryDescriptor(final Project project, final NodeDescriptor parentDescriptor, final Library element) {
       super(project, parentDescriptor, element);
-      final CellAppearanceEx appearance = OrderEntryAppearanceService.getInstance(project).forLibrary(element, false);
+      final CellAppearanceEx appearance = OrderEntryAppearanceService.getInstance().forLibrary(project, element, false);
       final SimpleColoredComponent coloredComponent = new SimpleColoredComponent();
       appearance.customize(coloredComponent);
       final PresentationData templatePresentation = getTemplatePresentation();
index 6ff82509ba5021e01dc7f037fb147ab29a928410..b036d3ab848702688914af731a8a89e597838cd3 100644 (file)
@@ -162,10 +162,11 @@ public class CodeInsightUtil {
     return null;
   }
 
-  public static void sortIdenticalShortNameClasses(PsiClass[] classes, @NotNull PsiElement context) {
+  public static void sortIdenticalShortNameClasses(PsiClass[] classes, @NotNull PsiReference context) {
     if (classes.length <= 1) return;
 
-    Arrays.sort(classes, new PsiProximityComparator(context));
+    PsiElement leaf = context.getElement().getFirstChild(); // the same proximity weighers are used in completion, where the leafness is critical
+    Arrays.sort(classes, new PsiProximityComparator(leaf));
   }
 
   public static PsiExpression[] findExpressionOccurrences(PsiElement scope, PsiExpression expr) {
index 8c8289d98fcd01950929b69603ed921e73d594f5..0a7274a33f073f38a2f820149b1d98b1fb495883 100644 (file)
@@ -55,14 +55,29 @@ public class JavaCharFilter extends CharFilter {
     
     Object o = item.getObject();
     if (o instanceof PsiClass && ((PsiClass)o).getName().length() > lookup.itemPattern(item).length()) {
-      if (PsiShortNamesCache.getInstance(file.getProject()).getClassesByName(lookup.itemPattern(item), file.getResolveScope()).length > 0) {
-        return true;
+      for (PsiClass aClass : PsiShortNamesCache.getInstance(file.getProject()).getClassesByName(lookup.itemPattern(item), file.getResolveScope())) {
+        if (!isObfuscated(aClass)) {
+          return true;
+        }
       }
     }
     
     return false;
   }
 
+  private static boolean isObfuscated(PsiClass psiClass) {
+    if (!(psiClass instanceof PsiCompiledElement)) {
+      return false;
+    }
+
+    String name = psiClass.getName();
+    if (name == null) {
+      return false;
+    }
+    
+    return name.length() == 1 && Character.isLowerCase(name.charAt(0));
+  }
+
   public Result acceptChar(char c, final int prefixLength, final Lookup lookup) {
     if (!lookup.isCompletion()) return null;
 
index fceb3ec7c267f62a3981f4437b5745227518e6e6..94135a94b346d51b6110e9bb64e21bfa533f59e0 100644 (file)
@@ -267,8 +267,6 @@ public class JavaCompletionContributor extends CompletionContributor {
         if (reference instanceof PsiJavaReference) {
           final ElementFilter filter = getReferenceFilter(position);
           if (filter != null) {
-            boolean filterVoid = JavaSmartCompletionContributor.getExpectedTypes(parameters).length > 0 && parameters.getInvocationCount() < 2;
-
             final boolean isSwitchLabel = SWITCH_LABEL.accepts(position);
             final PsiFile originalFile = parameters.getOriginalFile();
             for (LookupElement element : JavaCompletionUtil.processJavaReference(position,
@@ -290,11 +288,6 @@ public class JavaCompletionContributor extends CompletionContributor {
                   item.setTailType(TailType.NONE);
                 }
 
-                Object object = element.getObject();
-                if (filterVoid && object instanceof PsiMethod && PsiType.VOID.equals(((PsiMethod)object).getReturnType())) {
-                  continue;
-                }
-
                 result.addElement(element);
               }
             }
index 89a7723598a494cd8ea0fc40deba512f4d40551b..ba94d013feb2eb192f6eee8f27bede4e6a450818 100644 (file)
@@ -23,7 +23,6 @@ import com.intellij.codeInsight.completion.util.ParenthesesInsertHandler;
 import com.intellij.codeInsight.daemon.impl.quickfix.StaticImportMethodFix;
 import com.intellij.codeInsight.guess.GuessManager;
 import com.intellij.codeInsight.lookup.*;
-import com.intellij.lang.ASTNode;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.Editor;
@@ -47,7 +46,6 @@ import com.intellij.psi.filters.element.ExcludeSillyAssignment;
 import com.intellij.psi.html.HtmlTag;
 import com.intellij.psi.impl.source.PsiImmediateClassType;
 import com.intellij.psi.impl.source.codeStyle.CodeEditUtil;
-import com.intellij.psi.impl.source.tree.TreeUtil;
 import com.intellij.psi.javadoc.PsiDocToken;
 import com.intellij.psi.scope.BaseScopeProcessor;
 import com.intellij.psi.scope.ElementClassFilter;
@@ -725,15 +723,15 @@ public class JavaCompletionUtil {
 
         if (psiClass.isValid() && !psiClass.getManager().areElementsEquivalent(psiClass, resolveReference(ref))) {
           final boolean staticImport = ref instanceof PsiImportStaticReferenceElement;
-          PsiElement newElement = staticImport
-                                  ? ((PsiImportStaticReferenceElement)ref).bindToTargetClass(psiClass)
-                                  : ref.bindToElement(psiClass);
-
-          ASTNode newNode = newElement.getNode();
-          CodeEditUtil.disablePostponedFormatting(newNode);
-          ASTNode next = TreeUtil.nextLeaf(newNode);
-          if (next != null) {
-            CodeEditUtil.disablePostponedFormatting(next);
+          CodeEditUtil.setAllowSuspendNodesReformatting(true);
+          PsiElement newElement;
+          try {
+            newElement = staticImport
+                                    ? ((PsiImportStaticReferenceElement)ref).bindToTargetClass(psiClass)
+                                    : ref.bindToElement(psiClass);
+          }
+          finally {
+            CodeEditUtil.setAllowSuspendNodesReformatting(false);
           }
 
           newElement = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(newElement);
index 504ead34f034bbe6c163c55e84c825ea57bac205..5f95ae74e467698af1259cdd1066f5e80e0d4391 100644 (file)
@@ -16,7 +16,7 @@
 package com.intellij.codeInsight.completion.scope;
 
 import com.intellij.psi.*;
-import com.intellij.psi.util.PsiUtilCore;
+import org.jetbrains.annotations.Nullable;
 
 /**
  * Created by IntelliJ IDEA.
@@ -26,16 +26,12 @@ import com.intellij.psi.util.PsiUtilCore;
  * To change this template use Options | File Templates.
  */
 public class CompletionElement{
-  private final PsiType myQualifier;
-  private final PsiClass myQualifierClass;
   private final Object myElement;
   private final PsiSubstitutor mySubstitutor;
 
-  public CompletionElement(PsiType qualifier, Object element, PsiSubstitutor substitutor, final PsiClass qualifierClass){
+  public CompletionElement(Object element, PsiSubstitutor substitutor) {
     myElement = element;
-    myQualifier = qualifier;
     mySubstitutor = substitutor;
-    myQualifierClass = qualifierClass;
   }
 
   public PsiSubstitutor getSubstitutor(){
@@ -46,34 +42,22 @@ public class CompletionElement{
     return myElement;
   }
 
-  public Object getUniqueId(){
-    final String name;
+  @Nullable
+  Object getUniqueId(){
     if(myElement instanceof PsiClass){
-      name = ((PsiClass)myElement).getQualifiedName();
+      return ((PsiClass)myElement).getQualifiedName();
     }
-    else if(myElement instanceof PsiPackage){
-      name = ((PsiPackage)myElement).getQualifiedName();
+    if(myElement instanceof PsiPackage){
+      return ((PsiPackage)myElement).getQualifiedName();
     }
-    else if(myElement instanceof PsiMethod){
+    if(myElement instanceof PsiMethod){
       return ((PsiMethod)myElement).getSignature(mySubstitutor);
     }
-    else if (myElement instanceof PsiField) {
-      final PsiField field = (PsiField)myElement;
-      final String s = field.getName();
-      if (myQualifierClass != null || !field.hasModifierProperty(PsiModifier.STATIC)) return "#" + s;
-      return field.getContainingClass().getQualifiedName() + "#" + s;
-    }
-    else if(myElement instanceof PsiElement){
-      name = PsiUtilCore.getName((PsiElement)myElement);
-    }
-    else{
-      name = "";
+    if (myElement instanceof PsiVariable) {
+      return "#" + ((PsiVariable)myElement).getName();
     }
 
-    return name;
+    return null;
   }
 
-  public PsiType getQualifier(){
-    return myQualifier;
-  }
 }
index df2dccdbe9d9375c44add8ace2c675580fadd979..95c74648027aef5ef9eb65a564f02dddb53f898e 100644 (file)
@@ -224,7 +224,7 @@ public class JavaCompletionProcessor extends BaseScopeProcessor implements Eleme
     }
 
     if (satisfies(element, state) && isAccessible(element)) {
-      CompletionElement element1 = new CompletionElement(myQualifierType, element, state.get(PsiSubstitutor.KEY), myQualifierClass);
+      CompletionElement element1 = new CompletionElement((PsiNamedElement)element, state.get(PsiSubstitutor.KEY));
       if (myResultNames.add(element1.getUniqueId())) {
         myResults.add(element1);
       }
@@ -257,7 +257,7 @@ public class JavaCompletionProcessor extends BaseScopeProcessor implements Eleme
 
   public void setCompletionElements(@NotNull Object[] elements) {
     for (Object element: elements) {
-      myResults.add(new CompletionElement(null, element, PsiSubstitutor.EMPTY, myQualifierClass));
+      myResults.add(new CompletionElement(element, PsiSubstitutor.EMPTY));
     }
   }
 
index 2419388d5c0a50113caf05d2153b0fbe9414a337..4eb80b51c0e4ff79f31c056b958aaad392325c8c 100644 (file)
@@ -19,6 +19,7 @@ package com.intellij.codeInsight.daemon.impl.actions;
 import com.intellij.application.options.editor.AutoImportOptionsConfigurable;
 import com.intellij.application.options.editor.JavaAutoImportOptions;
 import com.intellij.codeInsight.CodeInsightSettings;
+import com.intellij.codeInsight.CodeInsightUtil;
 import com.intellij.codeInsight.CodeInsightUtilBase;
 import com.intellij.codeInsight.actions.OptimizeImportsProcessor;
 import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
@@ -39,7 +40,6 @@ import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiReference;
 import com.intellij.psi.statistics.JavaStatisticsManager;
 import com.intellij.psi.statistics.StatisticsManager;
-import com.intellij.psi.util.proximity.PsiProximityComparator;
 import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.ObjectUtils;
 import com.intellij.util.containers.ContainerUtil;
@@ -47,7 +47,6 @@ import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 public class AddImportAction implements QuestionAction {
@@ -92,7 +91,7 @@ public class AddImportAction implements QuestionAction {
   }
 
   private void chooseClassAndImport() {
-    Arrays.sort(myTargetClasses, new PsiProximityComparator(myReference.getElement()));
+    CodeInsightUtil.sortIdenticalShortNameClasses(myTargetClasses, myReference);
 
     final BaseListPopupStep<PsiClass> step =
       new BaseListPopupStep<PsiClass>(QuickFixBundle.message("class.to.import.chooser.title"), myTargetClasses) {
index c7d7e0891c22ded7a551212581e7d404d806228e..e60f67bc6c97bf0fbe6982966d0a79a95a003400 100644 (file)
@@ -132,7 +132,7 @@ public abstract class ImportClassFixBase<T extends PsiElement & PsiReference> im
     }
     PsiClass[] classes = classesToImport.toArray(new PsiClass[classesToImport.size()]);
     final Project project = myRef.getProject();
-    CodeInsightUtil.sortIdenticalShortNameClasses(classes, psiFile);
+    CodeInsightUtil.sortIdenticalShortNameClasses(classes, myRef);
 
     final QuestionAction action = createAddImportAction(classes, project, editor);
 
@@ -241,7 +241,6 @@ public abstract class ImportClassFixBase<T extends PsiElement & PsiReference> im
       public void run() {
         List<PsiClass> classesToImport = getClassesToImport();
         PsiClass[] classes = classesToImport.toArray(new PsiClass[classesToImport.size()]);
-        CodeInsightUtil.sortIdenticalShortNameClasses(classes, file);
         if (classes.length == 0) return;
 
         AddImportAction action = createAddImportAction(classes, project, editor);
index 1fe5de1d8951fabb75f7ed931f72e093a867b43f..2f55b0e977f64bb96c0332c96ee401596121e8de 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.intellij.codeInsight.editorActions;
 
+import com.intellij.lang.ASTNode;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.RawText;
@@ -23,7 +24,10 @@ import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.TextRange;
 import com.intellij.openapi.util.text.LineTokenizer;
 import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.psi.*;
+import com.intellij.psi.JavaTokenType;
+import com.intellij.psi.PsiDocumentManager;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
 import com.intellij.psi.codeStyle.CodeStyleSettings;
 import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
 import com.intellij.psi.util.PsiTreeUtil;
@@ -123,21 +127,31 @@ public class StringLiteralCopyPasteProcessor implements CopyPastePreProcessor {
     }
 
     if (isStringLiteral(token)) {
-      if (rawText != null && rawText.rawText != null) return rawText.rawText; // Copied from the string literal. Copy as is.
+      boolean escapeSlashes = true;
+      if (rawText != null && rawText.rawText != null) {
+        //is is assumed that all slashes are escaped in the raw text but some unescaped symbols can present (for example " copied from CharLiteral '"')
+        //so we should escape all needed symbols except slash.
+        escapeSlashes = false;
+        text = rawText.rawText;
+      }
 
       StringBuilder buffer = new StringBuilder(text.length());
       @NonNls String breaker = getLineBreaker(token);
       final String[] lines = LineTokenizer.tokenize(text.toCharArray(), false, true);
       for (int i = 0; i < lines.length; i++) {
         String line = lines[i];
-        buffer.append(escapeCharCharacters(line, token));
+        buffer.append(escapeCharCharacters(line, token, escapeSlashes));
         if (i != lines.length - 1) buffer.append(breaker);
       }
       text = buffer.toString();
     }
     else if (isCharLiteral(token)) {
-      if (rawText != null && rawText.rawText != null) return rawText.rawText; // Copied from the string literal. Copy as is.
-      return escapeCharCharacters(text, token);
+      if (rawText != null && rawText.rawText != null) {
+        return escapeCharCharacters(rawText.rawText, token, false);
+      }
+      else {
+        return escapeCharCharacters(text, token, true);
+      }
     }
     return text;
   }
@@ -176,17 +190,19 @@ public class StringLiteralCopyPasteProcessor implements CopyPastePreProcessor {
   }
 
   protected boolean isCharLiteral(@NotNull PsiElement token) {
-    return token.getNode().getElementType() == JavaTokenType.CHARACTER_LITERAL;
+    ASTNode node = token.getNode();
+    return node != null && node.getElementType() == JavaTokenType.CHARACTER_LITERAL;
   }
 
   protected boolean isStringLiteral(@NotNull PsiElement token) {
-    return token.getNode().getElementType() == JavaTokenType.STRING_LITERAL;
+    ASTNode node = token.getNode();
+    return node != null && node.getElementType() == JavaTokenType.STRING_LITERAL;
   }
 
   @NotNull
-  protected String escapeCharCharacters(@NotNull String s, @NotNull PsiElement token) {
+  protected String escapeCharCharacters(@NotNull String s, @NotNull PsiElement token, boolean escapeSlashes) {
     StringBuilder buffer = new StringBuilder();
-    StringUtil.escapeStringCharacters(s.length(), s, isStringLiteral(token) ? "\"" : "\'", buffer);
+    StringUtil.escapeStringCharacters(s.length(), s, isStringLiteral(token) ? "\"" : "\'",escapeSlashes, buffer);
     return buffer.toString();
   }
 }
index b92c9796bb2d3353dfa9fb629811f0b8faf5f560..3bbbba17c091d5b824b1f37666a49be4289f26bc 100644 (file)
@@ -152,7 +152,12 @@ public class JavaElementSignatureProvider extends AbstractElementSignatureProvid
     return null;
   }
 
-  protected PsiElement restoreBySignatureTokens(@NotNull PsiFile file, @NotNull PsiElement parent, @NotNull String type, @NotNull StringTokenizer tokenizer) {
+  protected PsiElement restoreBySignatureTokens(@NotNull PsiFile file,
+                                                @NotNull PsiElement parent,
+                                                @NotNull String type,
+                                                @NotNull StringTokenizer tokenizer,
+                                                @Nullable StringBuilder processingInfoStorage)
+  {
     if (type.equals("imports")) {
       if (!(file instanceof PsiJavaFile)) return null;
       return ((PsiJavaFile)file).getImportList();
index 6cbce8c1ba28582531cbe8c26842c9ecfb659e0d..f5de67ebd889283e4534890f4d2f5b178e5fbe9a 100644 (file)
@@ -157,10 +157,12 @@ public class JavaDocUtil {
 
         for (int k = 0; k < parms.length; k++) {
           PsiParameter parm = parms[k];
+          final PsiType parmType = parm.getType();
           if (
             types[k] != null &&
-            !TypeConversionUtil.erasure(parm.getType()).getCanonicalText().equals(types[k].getCanonicalText()) &&
-            !parm.getType().getCanonicalText().equals(types[k].getCanonicalText())
+            !TypeConversionUtil.erasure(parmType).getCanonicalText().equals(types[k].getCanonicalText()) &&
+            !parmType.getCanonicalText().equals(types[k].getCanonicalText()) &&
+            !TypeConversionUtil.isAssignable(parmType, types[k])
             ) {
             continue MethodsLoop;
           }
index 57a806fd449c60081970de7d96c59f7394b38473..4ff4ec49cf6a98b7c43e6f335075bd44353636a0 100644 (file)
@@ -65,7 +65,6 @@ public class JavaRefactoringSupportProvider extends RefactoringSupportProvider {
 
   @Override
   public boolean isMemberInplaceRenameAvailable(PsiElement elementToRename, PsiElement context) {
-    if (context != null && context.getContainingFile() != elementToRename.getContainingFile()) return false;
     if (elementToRename instanceof PsiMethod && ((PsiMethod)elementToRename).findDeepestSuperMethods().length > 0) {
       return false;
     }
index 75f7e1aafb9e04b3a39c4c98693a402050c8fc58..19a75a872c26e7f59eb09bd1f1272c5bfbcfdd85 100644 (file)
@@ -36,7 +36,7 @@ public class VariableInIncompleteCodeSearcher extends QueryExecutorBase<PsiRefer
   @Override
   public void processQuery(@NotNull final ReferencesSearch.SearchParameters p, @NotNull final Processor<PsiReference> consumer) {
     final PsiElement refElement = p.getElementToSearch();
-    if (!(refElement instanceof PsiLocalVariable || refElement instanceof PsiParameter)) return;
+    if (!refElement.isValid() || !(refElement instanceof PsiLocalVariable || refElement instanceof PsiParameter)) return;
 
     final String name = ((PsiVariable)refElement).getName();
     if (name == null) return;
diff --git a/java/java-impl/src/com/intellij/psi/util/proximity/ReferenceListWeigher.java b/java/java-impl/src/com/intellij/psi/util/proximity/ReferenceListWeigher.java
new file mode 100644 (file)
index 0000000..1fd3075
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2000-2011 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.psi.util.proximity;
+
+import com.intellij.openapi.util.Condition;
+import com.intellij.patterns.PlatformPatterns;
+import com.intellij.psi.*;
+import com.intellij.psi.util.InheritanceUtil;
+import com.intellij.psi.util.ProximityLocation;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author peter
+ */
+public class ReferenceListWeigher extends ProximityWeigher {
+
+  protected static final Condition<PsiClass> PREFER_INTERFACES = new Condition<PsiClass>() {
+    @Override
+    public boolean value(PsiClass psiClass) {
+      return psiClass.isInterface();
+    }
+  };
+  protected static final Condition<PsiClass> PREFER_CLASSES = new Condition<PsiClass>() {
+    @Override
+    public boolean value(PsiClass psiClass) {
+      return !psiClass.isInterface();
+    }
+  };
+  protected static final Condition<PsiClass> PREFER_EXCEPTIONS = new Condition<PsiClass>() {
+    @Override
+    public boolean value(PsiClass psiClass) {
+      return InheritanceUtil.isInheritor(psiClass, CommonClassNames.JAVA_LANG_THROWABLE);
+    }
+  };
+
+  @Nullable
+  protected Condition<PsiClass> getPreferredCondition(@NotNull ProximityLocation location) {
+    PsiElement position = location.getPosition();
+    if (PlatformPatterns.psiElement().withParents(PsiJavaCodeReferenceElement.class, PsiReferenceList.class).accepts(position)) {
+      assert position != null;
+      PsiReferenceList list = (PsiReferenceList)position.getParent().getParent();
+      PsiReferenceList.Role role = list.getRole();
+      if (shouldContainInterfaces(list, role)) {
+        return PREFER_INTERFACES;
+      }
+      if (role == PsiReferenceList.Role.EXTENDS_LIST) {
+        return PREFER_CLASSES;
+      }
+      if (role == PsiReferenceList.Role.THROWS_LIST) {
+        return PREFER_EXCEPTIONS;
+
+      }
+    }
+    return null;
+  }
+
+  private static boolean shouldContainInterfaces(PsiReferenceList list, PsiReferenceList.Role role) {
+    if (role == PsiReferenceList.Role.EXTENDS_LIST) {
+      PsiElement parent = list.getParent();
+      return parent instanceof PsiClass && ((PsiClass)parent).isInterface();
+    }
+    if (role == PsiReferenceList.Role.IMPLEMENTS_LIST) {
+      return true;
+    }
+    return false;
+  }
+
+  @Override
+  public Integer weigh(@NotNull PsiElement element, @NotNull ProximityLocation location) {
+    if (element instanceof PsiClass) {
+      Condition<PsiClass> condition = getPreferredCondition(location);
+      if (condition != null) {
+        return condition.value((PsiClass)element) ? 1 : -1;
+      }
+    }
+
+    return 0;
+  }
+}
index 2156dab04a242bfe053de84a576ba447a0ab001c..2c64ba6949870510c6afa1f140a39186886b2f3e 100644 (file)
@@ -19,6 +19,8 @@ import com.intellij.psi.*;
 import com.intellij.refactoring.util.CanonicalTypes;
 import org.jetbrains.annotations.NotNull;
 
+import java.util.Collection;
+
 /**
  * @author Maxim.Medvedev
  */
@@ -64,4 +66,6 @@ public interface JavaChangeInfo extends ChangeInfo {
   PsiExpression getValue(int i, PsiCallExpression callExpression);
 
   void updateMethod(PsiMethod psiMethod);
+
+  Collection<PsiMethod> getMethodsToPropagateParameters();
 }
index 05f065776a3a0ccf3f6e48475c60496a227e3e41..71d79e106759ff7fa3267c3c00e024e52767064d 100644 (file)
@@ -30,10 +30,7 @@ import com.intellij.util.IncorrectOperationException;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 class JavaChangeInfoImpl implements JavaChangeInfo {
   private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.changeSignature.JavaChangeInfoImpl");
@@ -286,6 +283,11 @@ class JavaChangeInfoImpl implements JavaChangeInfo {
     this.method = method;
   }
 
+  @Override
+  public Collection<PsiMethod> getMethodsToPropagateParameters() {
+    return propagateParametersMethods;
+  }
+
   public ParameterInfoImpl[] getCreatedParmsInfoWithoutVarargs() {
     List<ParameterInfoImpl> result = new ArrayList<ParameterInfoImpl>();
     for (ParameterInfoImpl newParm : newParms) {
index b803afed118ac6a589edbaf16884cba323a9128a..707ddb9510531f78ee339b2ed89264ba6841b861 100644 (file)
@@ -125,11 +125,16 @@ public class CopyClassesHandler implements CopyHandlerDelegate {
       VirtualFile sourceRootForFile = ProjectRootManager.getInstance(project).getFileIndex()
         .getSourceRootForFile(defaultTargetDirectory.getVirtualFile());
       if (sourceRootForFile == null) {
-        final PsiFile[] files = new PsiFile[elements.length];
+        final List<PsiElement> files = new ArrayList<PsiElement>();
         for (int i = 0, elementsLength = elements.length; i < elementsLength; i++) {
-          files[i] = elements[i].getContainingFile();
+          PsiFile containingFile = elements[i].getContainingFile();
+          if (containingFile != null) {
+            files.add(containingFile);
+          } else if (elements[i] instanceof PsiDirectory) {
+            files.add(elements[i]);
+          }
         }
-        CopyFilesOrDirectoriesHandler.copyAsFiles(files, defaultTargetDirectory, project);
+        CopyFilesOrDirectoriesHandler.copyAsFiles(files.toArray(new PsiElement[files.size()]), defaultTargetDirectory, project);
         return;
       }
     }
index 1d4bb97805db56557cf9dca4e4e2150cdfe241f6..212c653780f49adfe50ed9acf94c2d12bf464083 100644 (file)
@@ -133,6 +133,7 @@ public class PullUpHelper extends BaseRefactoringProcessor{
   }
 
   private void processMethodsDuplicates() {
+    if (!myTargetSuperClass.isValid()) return;
     ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
       @Override
       public void run() {
index 08e228cfa94e05ba718eb2792d246b531bff50c8..c2ba055c7733c71e358f0501f905fc67a6d6d6c2 100644 (file)
@@ -144,7 +144,7 @@ public class MethodSignatureUtil {
     final boolean isConstructor2 = sig2.isConstructor();
     if (isConstructor1 != isConstructor2) return false;
 
-    if (!isConstructor1 && !isConstructor2) {
+    if (!isConstructor1 && !isConstructor2 || !(sig1 instanceof HierarchicalMethodSignature || sig2 instanceof HierarchicalMethodSignature)) {
       final String name1 = sig1.getName();
       final String name2 = sig2.getName();
       if (!name1.equals(name2)) return false;
diff --git a/java/java-tests/testData/codeInsight/completion/normal/ClassBeforeCast.java b/java/java-tests/testData/codeInsight/completion/normal/ClassBeforeCast.java
new file mode 100644 (file)
index 0000000..24c9369
--- /dev/null
@@ -0,0 +1,6 @@
+public class Foo {
+    public static void fpp(Object o) {
+        FileInpSt<caret>
+        ((Object) o).notify();
+    }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/normal/ClassBeforeCast_after.java b/java/java-tests/testData/codeInsight/completion/normal/ClassBeforeCast_after.java
new file mode 100644 (file)
index 0000000..5be44d8
--- /dev/null
@@ -0,0 +1,8 @@
+import java.io.FileInputStream;
+
+public class Foo {
+    public static void fpp(Object o) {
+        FileInputStream<caret>
+        ((Object) o).notify();
+    }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/normal/DoubleConstant.java b/java/java-tests/testData/codeInsight/completion/normal/DoubleConstant.java
new file mode 100644 (file)
index 0000000..3d2d9b3
--- /dev/null
@@ -0,0 +1,8 @@
+interface Intf { Intf FOO = null; }
+interface Intf2 extends Intf { Intf2 FOO = null; }
+
+public class Bar implements Intf2 {
+  public static void fpp() {
+    F<caret>
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/normal/VoidMethodsInNonVoidContext.java b/java/java-tests/testData/codeInsight/completion/normal/VoidMethodsInNonVoidContext.java
deleted file mode 100644 (file)
index b0564b6..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-public class Foo {
-  Object foo(){
-    return noti<caret>
-  }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/normal/VoidMethodsInNonVoidContext_after.java b/java/java-tests/testData/codeInsight/completion/normal/VoidMethodsInNonVoidContext_after.java
deleted file mode 100644 (file)
index 6e13895..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-public class Foo {
-  Object foo(){
-    return notify<caret>
-  }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/normalSorting/PreferClassesInExtends.java b/java/java-tests/testData/codeInsight/completion/normalSorting/PreferClassesInExtends.java
new file mode 100644 (file)
index 0000000..5da8a5c
--- /dev/null
@@ -0,0 +1,8 @@
+interface Foo_Intf {}
+class FooClass {}
+
+class Goo extends Foo<caret> {
+    int boo() {}
+    int doo() {}
+    int foo() {}
+}
diff --git a/java/java-tests/testData/codeInsight/completion/normalSorting/PreferInterfacesInImplements.java b/java/java-tests/testData/codeInsight/completion/normalSorting/PreferInterfacesInImplements.java
new file mode 100644 (file)
index 0000000..4809d42
--- /dev/null
@@ -0,0 +1,8 @@
+interface FooIntf {}
+class FooClass {}
+
+class Goo implements Foo<caret> {
+    int boo() {}
+    int doo() {}
+    int foo() {}
+}
index 6a1a00c2141fdf425e042b7d983ec810afa3860a..739d2460116a55e173a327ed93cde36de04dce55 100644 (file)
@@ -47,7 +47,7 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase {
   }
 
   public void testReturnF() throws Throwable {
-    checkPreferredItems(0, "false");
+    checkPreferredItems(0, "false", "finalize");
   }
 
   public void testPreferDefaultTypeToExpected() throws Throwable {
@@ -207,6 +207,14 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase {
     checkPreferredItems(0, "foo", "boo", "doo", "hashCode");
   }
 
+  public void testPreferInterfacesInImplements() {
+    checkPreferredItems(0, "FooIntf", "FooClass");
+  }
+
+  public void testPreferClassesInExtends() {
+    checkPreferredItems(0, "FooClass", "Foo_Intf");
+  }
+
   public void testPreferClassOverItsStaticMembers() {
     checkPreferredItems(0, "Zoo");
   }
index a0fcb1848b4875a7bb0856185ab99d6d236ededf..5dafd05d950baf27ccb103052aff0a38be0ada00 100644 (file)
@@ -494,6 +494,11 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
     assertStringItems("boolean", "byte")
   }
 
+  public void testDoubleConstant() throws Throwable {
+    configure()
+    assertStringItems("FOO", "Float")
+  }
+
   public void testNotOnlyKeywordsInsideSwitch() throws Throwable {
     doTest();
   }
@@ -607,6 +612,8 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
 
   public void testSpacesAroundEq() throws Throwable { doTest('='); }
 
+  public void testClassBeforeCast() throws Throwable { doTest '\n' }
+
   public void testNoAllClassesOnQualifiedReference() throws Throwable {
     configureByFile(getTestName(false) + ".java");
     assertEmpty(myItems);
@@ -727,7 +734,7 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
 
   public void testDoubleFalse() throws Throwable {
     configureByFile(getTestName(false) + ".java");
-    assertStringItems("false", "fefefef");
+    assertStringItems("false", "fefefef", "finalize");
   }
 
   public void testSameNamedVariableInNestedClasses() throws Throwable {
@@ -895,16 +902,6 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
     }
   }
 
-  public void testVoidMethodsInNonVoidContext() throws Throwable {
-    configure()
-    checkResultByFile(getTestName(false) + ".java")
-    assertEmpty(myItems)
-    assertNull(getLookup());
-
-    myFixture.complete(CompletionType.BASIC, 2)
-    checkResult()
-  }
-
   public void testEnumConstantFromEnumMember() throws Throwable { doTest(); }
 
   public void testPrimitiveMethodParameter() throws Throwable { doTest(); }
similarity index 79%
rename from platform/lang-api/src/com/intellij/openapi/roots/ui/OrderEntryAppearanceService.java
rename to java/openapi/src/com/intellij/openapi/roots/ui/OrderEntryAppearanceService.java
index b7359020ca0442035971a36f30fb18605453d023..85cb7d3598215e29636b65057288723f2d74ddd4 100644 (file)
@@ -26,15 +26,15 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 public abstract class OrderEntryAppearanceService {
-  public static OrderEntryAppearanceService getInstance(@NotNull final Project project) {
-    return ServiceManager.getService(project, OrderEntryAppearanceService.class);
+  public static OrderEntryAppearanceService getInstance() {
+    return ServiceManager.getService(OrderEntryAppearanceService.class);
   }
 
   @NotNull
-  public abstract CellAppearanceEx forOrderEntry(@NotNull OrderEntry orderEntry, boolean selected);
+  public abstract CellAppearanceEx forOrderEntry(Project project, @NotNull OrderEntry orderEntry, boolean selected);
 
   @NotNull
-  public abstract CellAppearanceEx forLibrary(@NotNull Library library, boolean hasInvalidRoots);
+  public abstract CellAppearanceEx forLibrary(Project project, @NotNull Library library, boolean hasInvalidRoots);
 
   @NotNull
   public abstract CellAppearanceEx forJdk(@Nullable Sdk jdk, boolean isInComboBox, boolean selected, boolean showVersion);
index 724726006d8b137f63941d18391f5b5ccc6ca4b4..d47140d2ecd111c271be9c30f92444b8dbb749e1 100644 (file)
@@ -103,6 +103,7 @@ public abstract class Builder {
 
   private static boolean chunkContainsAffectedFiles(CompileContext context, ModuleChunk chunk, final Set<File> affected) throws Exception {
     final Ref<Boolean> result = new Ref<Boolean>(false);
+    // todo: avoid calling processFiles to implement this logic
     context.processFiles(chunk, new FileProcessor() {
       public boolean apply(Module module, File file, String sourceRoot) throws Exception {
         if (affected.contains(file)) {
index 936e59b4ff8bfda75ca52f68ad67cba5db2ac114..8ca6753e584c1ff1f575603cf07880b10b928cc2 100644 (file)
@@ -42,7 +42,10 @@ public class IncProjectBuilder {
   public void addMessageHandler(MessageHandler handler) {
     myMessageHandlers.add(handler);
   }
-
+  
+  // todo: pass dirty and removed sources from outside
+  
+  
   public void build(CompileScope scope, final boolean isMake) {
 
     final CompileContext context = createContext(scope, isMake);
@@ -223,6 +226,8 @@ public class IncProjectBuilder {
          // TODO: check how the output-source storage is filled and!
       if (context.isMake()) {
         // cleanup outputs
+        
+        // todo: use dirty and removed paths passed from IDEA instead of collecting all chunk sources
         final HashSet<File> allChunkSources = new HashSet<File>();
         context.processFiles(chunk, new FilesCollector(allChunkSources, FilesCollector.ALL_FILES));
 
index db491aed1ccc418eb2fa9274d66a35a0224c452e..0915a3952d037135b813d6112a299e8b89659d04 100644 (file)
@@ -20,7 +20,7 @@ import org.jetbrains.jps.incremental.storage.TimestampStorage;
 import org.jetbrains.jps.server.ClasspathBootstrap;
 import org.objectweb.asm.ClassReader;
 
-import java.io.*;
+import java.io.File;
 import java.util.*;
 
 /**
@@ -46,6 +46,7 @@ public class GroovyBuilder extends Builder {
     final List<File> toCompile = new ArrayList<File>();
     try {
       final TimestampStorage tsStorage = context.getBuildDataManager().getTimestampStorage(getName());
+      // todo: use dirty files passed from outside
       context.processFiles(chunk, new FileProcessor() {
         @Override
         public boolean apply(Module module, File file, String sourceRoot) throws Exception {
index 584edeb7998f2c2dea1d736579400ecf14b921df..fb1dcabfb72d2ab06194a3f2e21b31adadabe2cd 100644 (file)
@@ -118,10 +118,11 @@ public class JavaBuilder extends Builder{
       final Set<File> filesToCompile = new LinkedHashSet<File>();
       final List<File> formsToCompile = new ArrayList<File>();
       final List<File> upToDateForms = new ArrayList<File>();
+      // todo: read srcRoots from JPS model
       final Set<String> srcRoots = new HashSet<String>();
 
       final boolean wholeModuleRebuildRequired = context.isDirty(chunk);
-
+      // todo: only process all sources if wholeModuleRebuild == true
       context.processFiles(chunk, new FileProcessor() {
         public boolean apply(Module module, File file, String sourceRoot) throws Exception {
           if (JAVA_SOURCES_FILTER.accept(file)) {
@@ -142,6 +143,8 @@ public class JavaBuilder extends Builder{
         }
       });
 
+      // todo: change logic below so that complete forms list is not required
+      
       // force compilation of bound source file if the form is dirty
       for (File form : formsToCompile) {
         for (String root : srcRoots) {
index 80f89a9d869846a4269e21c22888f5c0c5e361fa..1fb186fb4d496358de0e5b9e766b0db329d63431 100644 (file)
@@ -50,6 +50,8 @@ public class ResourcesBuilder extends Builder{
       final TimestampStorage tsStorage = context.getBuildDataManager().getTimestampStorage(BUILDER_NAME);
       final OutputToSourceMapping outputToSourceMapping = context.getBuildDataManager().getOutputToSourceStorage();
       final ResourcePatterns finalPatterns = patterns;
+      // todo: process all files in case of rebuild or wholeModuleDirty
+      // todo: otherwise avoid traverwing the whole module and use dirty file list taken from params
       context.processFiles(chunk, new FileProcessor() {
         public boolean apply(final Module module, final File file, final String sourceRoot) throws Exception {
           if (finalPatterns.isResourceFile(file, sourceRoot)) {
index e5bf892857fbad942f5ea958212ab219f4dfadfb..6a57065d852a2a1d94f37147f1f4737fd6f72532 100644 (file)
@@ -18,6 +18,7 @@ package com.intellij.psi;
 import com.intellij.lang.Language;
 import com.intellij.lang.LanguageParserDefinitions;
 import com.intellij.lang.ParserDefinition;
+import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.command.undo.UndoConstants;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
@@ -28,6 +29,7 @@ import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
 import com.intellij.openapi.fileTypes.*;
 import com.intellij.openapi.progress.ProcessCanceledException;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Computable;
 import com.intellij.openapi.util.Key;
 import com.intellij.openapi.util.UserDataHolderBase;
 import com.intellij.openapi.vfs.NonPhysicalFileSystem;
@@ -499,7 +501,11 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi
         return getContents();
       }
       if (myContent != null) return myContent;
-      return myContent = myFile.calcTreeElement().getText();
+      return myContent = ApplicationManager.getApplication().runReadAction(new Computable<CharSequence>() {
+        public CharSequence compute() {
+          return myFile.calcTreeElement().getText();
+        }
+      });
     }
 
     @Override
diff --git a/platform/icons/src/ide/rating.png b/platform/icons/src/ide/rating.png
new file mode 100644 (file)
index 0000000..606ffba
Binary files /dev/null and b/platform/icons/src/ide/rating.png differ
diff --git a/platform/icons/src/ide/rating1.png b/platform/icons/src/ide/rating1.png
new file mode 100644 (file)
index 0000000..4b65538
Binary files /dev/null and b/platform/icons/src/ide/rating1.png differ
diff --git a/platform/icons/src/ide/rating2.png b/platform/icons/src/ide/rating2.png
new file mode 100644 (file)
index 0000000..a949d4e
Binary files /dev/null and b/platform/icons/src/ide/rating2.png differ
diff --git a/platform/icons/src/ide/rating3.png b/platform/icons/src/ide/rating3.png
new file mode 100644 (file)
index 0000000..f038a64
Binary files /dev/null and b/platform/icons/src/ide/rating3.png differ
diff --git a/platform/icons/src/ide/rating4.png b/platform/icons/src/ide/rating4.png
new file mode 100644 (file)
index 0000000..559ce91
Binary files /dev/null and b/platform/icons/src/ide/rating4.png differ
index 83ef58fd741f46b7898c67f75acb36787aaa2aa2..149f4487d5e577eb062f08a5c40bf360fa5f41a6 100644 (file)
@@ -23,6 +23,9 @@ import org.jetbrains.annotations.Nullable;
  * @version 1.0
  */
 public interface Filter {
+
+  Filter[] EMPTY_ARRAY = new Filter[0];
+
   class Result{
     public final int highlightStartOffset;
     public final int highlightEndOffset;
index f85aea3d82f04f27add0967ad745c43cc2cea906..689e77a9687248b94d14c478fa8d45476c525354 100644 (file)
@@ -168,7 +168,7 @@ public class InitialConfigurationDialog extends DialogWrapper {
     myPreviewOptions.selectScheme(((EditorColorsScheme)myColorSchemeComboBox.getSelectedItem()).getName());
     final NewColorAndFontPanel page = myPreviewOptions.findPage(myColorSettingsPage);
     assert page != null;
-    myPreviewEditor = new SimpleEditorPreview(myPreviewOptions, page.getSettingsPage());
+    myPreviewEditor = new SimpleEditorPreview(myPreviewOptions, page.getSettingsPage(), false);
     myPreviewEditor.updateView();
     myColorPreviewPanel.add(myPreviewEditor.getPanel(), BorderLayout.CENTER);
     myColorPreviewPanel.revalidate();
index 58218b81dc1109a61a546f0b6dde62cb4e513eaf..975a8d5e1613de3fda1225391e14975f3dab87c2 100644 (file)
@@ -57,6 +57,10 @@ public class SimpleEditorPreview implements PreviewPanel{
   private final EventDispatcher<ColorAndFontSettingsListener> myDispatcher = EventDispatcher.create(ColorAndFontSettingsListener.class);
 
   public SimpleEditorPreview(final ColorAndFontOptions options, final ColorSettingsPage page) {
+    this(options, page, true);
+  }
+
+  public SimpleEditorPreview(final ColorAndFontOptions options, final ColorSettingsPage page, final boolean navigatable) {
     myOptions = options;
     myPage = page;
 
@@ -70,17 +74,16 @@ public class SimpleEditorPreview implements PreviewPanel{
 
     FontEditorPreview.installTrafficLights(myEditor);
     myBlinkingAlarm = new Alarm().setActivationComponent(myEditor.getComponent());
+    if (navigatable) {
+      addMouseMotionListener(myEditor, page.getHighlighter(), myHighlightData, false);
 
-    addMouseMotionListener(myEditor, page.getHighlighter(), myHighlightData, false);
-
-    CaretListener listener = new CaretListener() {
-      public void caretPositionChanged(CaretEvent e) {
-        navigate(myEditor, true, e.getNewPosition(), page.getHighlighter(), myHighlightData, false);
-      }
-    };
-    myEditor.getCaretModel().addCaretListener(listener);
-
-
+      CaretListener listener = new CaretListener() {
+        public void caretPositionChanged(CaretEvent e) {
+          navigate(myEditor, true, e.getNewPosition(), page.getHighlighter(), myHighlightData, false);
+        }
+      };
+      myEditor.getCaretModel().addCaretListener(listener);
+    }
   }
 
   private void addMouseMotionListener(final Editor view,
index 7eb1b64e03ef89f33ebf7ef29b38d09e29c80f60..04fdb13567ea9b1346e0a7e28a6dd66343330403 100644 (file)
@@ -474,8 +474,7 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler {
     if (decision == AutoCompletionDecision.SHOW_LOOKUP) {
       CompletionServiceImpl.setCompletionPhase(new CompletionPhase.ItemsCalculated(indicator));
       indicator.getLookup().setCalculating(false);
-      indicator.showLookup();
-      if (isAutocompleteCommonPrefixOnInvocation() && items.length > 1) {
+      if (indicator.showLookup() && isAutocompleteCommonPrefixOnInvocation() && items.length > 1) {
         indicator.fillInCommonPrefix(false);
       }
     }
@@ -860,6 +859,9 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler {
     private void watchTail(int offset) {
       stopWatching();
       tailWatcher = (RangeMarkerEx)getDocument().createRangeMarker(offset, offset);
+      if (!tailWatcher.isValid()) {
+        throw new AssertionError(getDocument() + "; offset=" + offset);
+      }
       tailWatcher.setGreedyToRight(true);
       spy = new RangeMarkerSpy(tailWatcher) {
         @Override
index 96e49d55dc021755d281f443256464211a063f0f..1d7a85c4c861185e4dfe00118187169c5b88a2be 100644 (file)
@@ -304,8 +304,8 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
     return "Completion" + hashCode();
   }
 
-  public void showLookup() {
-    updateLookup();
+  public boolean showLookup() {
+    return updateLookup();
   }
 
   public CompletionParameters getParameters() {
@@ -320,14 +320,14 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
     return myLookup;
   }
 
-  private void updateLookup() {
+  private boolean updateLookup() {
     ApplicationManager.getApplication().assertIsDispatchThread();
-    if (isOutdated()) return;
+    if (isOutdated()) return false;
 
     boolean justShown = false;
     if (!myLookup.isShown() && shouldShowLookup()) {
       if (hideAutopopupIfMeaningless()) {
-        return;
+        return false;
       }
 
       if (StringUtil.isEmpty(myLookup.getAdvertisementText()) && !isAutopopupCompletion()) {
@@ -338,7 +338,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
       }
 
       if (!myLookup.showLookup()) {
-        return;
+        return false;
       }
       justShown = true;
     }
@@ -347,6 +347,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
     if (justShown) {
       myLookup.ensureSelectionVisible();
     }
+    return true;
   }
 
   private boolean shouldShowLookup() {
index 37e5b881a871a360ba0ff9877f5389bce1e0ed47..82c31d32b61a02afb4e5e994c437c123152bbda9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2011 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -85,7 +85,7 @@ public class AutoHardWrapHandler {
    * @param dataContext                     current data context
    * @param modificationStampBeforeTyping   document modification stamp before the current symbols typing
    */
-  public void wrapLineIfNecessary(Editor editor, @NotNull DataContext dataContext, long modificationStampBeforeTyping) {
+  public void wrapLineIfNecessary(@NotNull Editor editor, @NotNull DataContext dataContext, long modificationStampBeforeTyping) {
     Project project = editor.getProject();
     Document document = editor.getDocument();
     AutoWrapChange change = myAutoWrapChanges.get(document);
@@ -94,9 +94,9 @@ public class AutoHardWrapHandler {
     }
 
     // Return eagerly if we don't need to auto-wrap line on right margin exceeding.
-    if (project == null ||
-        !editor.getSettings().isWrapWhenTypingReachesRightMargin(project) ||
-        TemplateManager.getInstance(project).getActiveTemplate(editor) != null) {
+    if (project == null || !editor.getSettings().isWrapWhenTypingReachesRightMargin(project)
+        || (TemplateManager.getInstance(project) != null && TemplateManager.getInstance(project).getActiveTemplate(editor) != null))
+    {
       return;
     }
 
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/CodeBlockProvider.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/CodeBlockProvider.java
new file mode 100644 (file)
index 0000000..dd82d88
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2000-2011 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInsight.editorActions;
+
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.psi.PsiFile;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Used for "goto code block start/end" and "highlight current scope".
+ *
+ * @author yole
+ */
+public interface CodeBlockProvider {
+  @Nullable
+  TextRange getCodeBlockRange(Editor editor, PsiFile psiFile);
+}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/CodeBlockProviders.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/CodeBlockProviders.java
new file mode 100644 (file)
index 0000000..af8b742
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2000-2011 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInsight.editorActions;
+
+import com.intellij.lang.LanguageExtension;
+
+/**
+ * @author yole
+ */
+public class CodeBlockProviders extends LanguageExtension<CodeBlockProvider> {
+  public static CodeBlockProviders INSTANCE = new CodeBlockProviders();
+  
+  private CodeBlockProviders() {
+    super("com.intellij.codeBlockProvider");
+  }
+}
index c58cdd7dbcb498ddbb3337e694f6aafc8ddfefaf..e2255134622baec1fedb0000dcd4c911b17a58cf 100644 (file)
@@ -32,6 +32,7 @@ import com.intellij.openapi.editor.highlighter.HighlighterIterator;
 import com.intellij.openapi.fileEditor.ex.IdeDocumentHistory;
 import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.TextRange;
 import com.intellij.psi.PsiDocumentManager;
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.tree.IElementType;
@@ -52,14 +53,23 @@ public class CodeBlockUtil {
     if (file == null) return;
 
     IdeDocumentHistory.getInstance(project).includeCurrentCommandAsNavigation();
-    final IndentGuideDescriptor guide = editor.getIndentsModel().getCaretIndentGuide();
-    if (guide != null) {
-      editor.getCaretModel().moveToLogicalPosition(new LogicalPosition(guide.endLine, guide.indentLevel));
+    final CodeBlockProvider provider = CodeBlockProviders.INSTANCE.forLanguage(file.getLanguage());
+    if (provider != null) {
+      final TextRange range = provider.getCodeBlockRange(editor, file);
+      if (range != null) {
+        editor.getCaretModel().moveToOffset(range.getEndOffset());
+      }
     }
     else {
-      int endOffset = calcBlockEndOffset(editor, file);
-      if (endOffset != -1) {
-        editor.getCaretModel().moveToOffset(endOffset);
+      final IndentGuideDescriptor guide = editor.getIndentsModel().getCaretIndentGuide();
+      if (guide != null) {
+        editor.getCaretModel().moveToLogicalPosition(new LogicalPosition(guide.endLine, guide.indentLevel));
+      }
+      else {
+        int endOffset = calcBlockEndOffset(editor, file);
+        if (endOffset != -1) {
+          editor.getCaretModel().moveToOffset(endOffset);
+        }
       }
     }
 
@@ -80,16 +90,27 @@ public class CodeBlockUtil {
     if (file == null) return;
 
     IdeDocumentHistory.getInstance(project).includeCurrentCommandAsNavigation();
-    final IndentGuideDescriptor guide = editor.getIndentsModel().getCaretIndentGuide();
-    if (guide != null) {
-      editor.getCaretModel().moveToLogicalPosition(new LogicalPosition(guide.startLine, guide.indentLevel));
+
+    final CodeBlockProvider provider = CodeBlockProviders.INSTANCE.forLanguage(file.getLanguage());
+    if (provider != null) {
+      final TextRange range = provider.getCodeBlockRange(editor, file);
+      if (range != null) {
+        editor.getCaretModel().moveToOffset(range.getStartOffset());
+      }
     }
     else {
-      int start = calcBlockStartOffset(editor, file);
-      if (start < 0) return;
-      editor.getCaretModel().moveToOffset(start);
+      final IndentGuideDescriptor guide = editor.getIndentsModel().getCaretIndentGuide();
+      if (guide != null) {
+        editor.getCaretModel().moveToLogicalPosition(new LogicalPosition(guide.startLine, guide.indentLevel));
+      }
+      else {
+        int start = calcBlockStartOffset(editor, file);
+        if (start < 0) return;
+        editor.getCaretModel().moveToOffset(start);
+      }
     }
 
+
     editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
 
     if (isWithSelection) {
@@ -101,6 +122,7 @@ public class CodeBlockUtil {
   }
 
   private static int calcBlockEndOffset(Editor editor, PsiFile file) {
+
     Document document = editor.getDocument();
     int offset = editor.getCaretModel().getOffset();
     final FileType fileType = file.getFileType();
index 3664639fcb7a12b0b90e4552ef95328b5aa10ddb..e96aa03e9c21dfed455626d1f1e05ae64eb6cb94 100644 (file)
@@ -32,7 +32,9 @@ import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.PsiDocumentManager;
 import com.intellij.psi.PsiFile;
+import com.intellij.psi.codeStyle.CodeStyleSettings;
 import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
+import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
 import com.intellij.psi.tree.IElementType;
 import com.intellij.psi.tree.TokenSet;
 import org.jetbrains.annotations.NotNull;
@@ -126,7 +128,9 @@ public class BaseIndentEnterHandler extends EnterHandlerDelegateAdapter {
   }
 
   protected String getSingleIndent(final PsiFile file) {
-    return StringUtil.repeatSymbol(' ', CodeStyleSettingsManager.getInstance().getCurrentSettings().getIndentSize(myLanguage.getAssociatedFileType()));
+    CodeStyleSettings currantSettings = CodeStyleSettingsManager.getSettings(file.getProject());
+    CommonCodeStyleSettings.IndentOptions indentOptions = currantSettings.getIndentOptions(file.getFileType());
+    return StringUtil.repeatSymbol(' ', indentOptions.INDENT_SIZE);
   }
 
   @Nullable
index 3aca77d9a8f4311b4aee0fc750608329bc716f45..8ed24949c8e269671ed00cd44fbbce089ff74157 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2011 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -110,7 +110,11 @@ class MoverWrapper {
     document.deleteString(myInfo.range1.getStartOffset()+textToInsert2.length(), myInfo.range1.getEndOffset());
 
     document.insertString(myInfo.range2.getStartOffset(), textToInsert);
-    document.deleteString(myInfo.range2.getStartOffset()+textToInsert.length(), myInfo.range2.getEndOffset());
+    int s = myInfo.range2.getStartOffset() + textToInsert.length();
+    int e = myInfo.range2.getEndOffset();
+    if (e > s) {
+      document.deleteString(s, e);
+    }
 
     final Project project = file.getProject();
     PsiDocumentManager.getInstance(project).commitAllDocuments();
index 4ffbdb14c1329c4f3dd2809890314288c15d2f2f..3e67a264121339c629a1bde9f640b2e7cdb5636d 100644 (file)
@@ -42,7 +42,9 @@ public abstract class AbstractElementSignatureProvider implements ElementSignatu
     if (semicolonIndex >= 0) {
       String parentSignature = signature.substring(semicolonIndex + 1);
       if (processingInfoStorage != null) {
-        processingInfoStorage.append(String.format("Restoring parent by signature '%s'...%n", parentSignature));
+        processingInfoStorage.append(String.format(
+          "Provider '%s'. Restoring parent by signature '%s'...%n", getClass().getName(), parentSignature
+        ));
       }
       parent = restoreBySignature(file, parentSignature, processingInfoStorage);
       if (processingInfoStorage != null) {
@@ -59,17 +61,19 @@ public abstract class AbstractElementSignatureProvider implements ElementSignatu
     String type = tokenizer.nextToken();
     if (processingInfoStorage != null) {
       processingInfoStorage.append(String.format(
-        "Restoring target element by signature '%s'. Parent: %s, same as the given parent: %b%n", signature, parent, parent == file
+        "Provider '%s'. Restoring target element by signature '%s'. Parent: %s, same as the given parent: %b%n",
+        getClass().getName(), signature, parent, parent == file
       ));
     }
-    return restoreBySignatureTokens(file, parent, type, tokenizer);
+    return restoreBySignatureTokens(file, parent, type, tokenizer, processingInfoStorage);
   }
 
   @Nullable
   protected abstract PsiElement restoreBySignatureTokens(@NotNull PsiFile file,
                                                          @NotNull PsiElement parent,
                                                          @NotNull String type,
-                                                         @NotNull StringTokenizer tokenizer);
+                                                         @NotNull StringTokenizer tokenizer,
+                                                         @Nullable StringBuilder processingInfoStorage);
 
   protected static <T extends PsiNamedElement> int getChildIndex(T element, PsiElement parent, String name, Class<T> hisClass) {
     PsiElement[] children = parent.getChildren();
index a930d1859c641619e9cddbfe98bf0df6ee3b975f..6cb1fba7da5a090f54bf86a9acab49dc64200c5c 100644 (file)
@@ -19,6 +19,7 @@ import com.intellij.openapi.util.TextRange;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiFile;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import java.util.StringTokenizer;
 
@@ -38,9 +39,16 @@ public class OffsetsElementSignatureProvider extends AbstractElementSignaturePro
   protected PsiElement restoreBySignatureTokens(@NotNull PsiFile file,
                                                 @NotNull PsiElement parent,
                                                 @NotNull String type,
-                                                @NotNull StringTokenizer tokenizer)
+                                                @NotNull StringTokenizer tokenizer,
+                                                @Nullable StringBuilder processingInfoStorage)
   {
     if (!TYPE_MARKER.equals(type)) {
+      if (processingInfoStorage != null) {
+        processingInfoStorage.append(String.format(
+          "Stopping '%s' provider because given signature doesn't have expected type - can work with '%s' but got '%s'",
+          getClass().getName(), TYPE_MARKER, type
+        ));
+      }
       return null;
     }
     int start;
@@ -52,15 +60,28 @@ public class OffsetsElementSignatureProvider extends AbstractElementSignaturePro
     catch (NumberFormatException e) {
       return null;
     }
+    if (processingInfoStorage != null) {
+      processingInfoStorage.append(String.format("Parsed target offsets - [%d; %d)", start, end));
+    }
+    
     PsiElement element = file.findElementAt(start);
+    if (processingInfoStorage != null) {
+      processingInfoStorage.append(String.format("Found the following element at start offset - '%s'", element));
+    }
     if (element == null) {
       return null;
     }
     
     TextRange range = element.getTextRange();
+    if (processingInfoStorage != null) {
+      processingInfoStorage.append(String.format("Target element range is %s", range));
+    }
     while (range != null && range.getStartOffset() == start && range.getEndOffset() < end) {
       element = element.getParent();
       range = element.getTextRange();
+      if (processingInfoStorage != null) {
+        processingInfoStorage.append(String.format("Expanding element to '%s' and range to '%s'", element, range));
+      }
     }
     if (range == null || range.getStartOffset() != start || range.getEndOffset() != end) {
       return null;
@@ -82,10 +103,17 @@ public class OffsetsElementSignatureProvider extends AbstractElementSignaturePro
       indexFromRoot++;
     }
 
+    if (processingInfoStorage != null) {
+      processingInfoStorage.append(String.format("Target element index is %d. Current index from root is %d", index, indexFromRoot));
+    }
+    
     if (index > indexFromRoot) {
       int steps = index - indexFromRoot;
       PsiElement result = element;
       for (PsiElement e = result.getFirstChild(); steps > 0 && e != null && range.equals(e.getTextRange()); steps--, e = e.getFirstChild()) {
+        if (processingInfoStorage != null) {
+          processingInfoStorage.append(String.format("Clarifying target element to '%s', its range is %s", result, result.getTextRange()));
+        }
         result = e;
       }
       return result;
@@ -95,15 +123,21 @@ public class OffsetsElementSignatureProvider extends AbstractElementSignaturePro
     PsiElement result = element;
     while (--steps >= 0) {
       result = result.getParent();
+      if (processingInfoStorage != null) {
+        processingInfoStorage.append(String.format("Reducing target element to '%s', its range is %s", result, result.getTextRange()));
+      }
     }
     return result;
   }
 
   @Override
   public String getSignature(@NotNull PsiElement element) {
+    TextRange range = element.getTextRange();
+    if (range.isEmpty()) {
+      return null;
+    }
     StringBuilder buffer = new StringBuilder();
     buffer.append(TYPE_MARKER).append("#");
-    TextRange range = element.getTextRange();
     buffer.append(range.getStartOffset());
     buffer.append(ELEMENT_TOKENS_SEPARATOR);
     buffer.append(range.getEndOffset());
index f70f5b2ac41d6b534007ec8bdfbcbfb0fca7a728..c117e7eb3242abf38d7b6facbf6f0701d06ad1fd 100644 (file)
@@ -19,6 +19,7 @@ import com.intellij.psi.*;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import java.util.Arrays;
 import java.util.StringTokenizer;
 
 /**
@@ -41,9 +42,16 @@ public class PsiNamesElementSignatureProvider extends AbstractElementSignaturePr
   protected PsiElement restoreBySignatureTokens(@NotNull PsiFile file,
                                                 @NotNull PsiElement parent,
                                                 @NotNull final String type,
-                                                @NotNull StringTokenizer tokenizer)
+                                                @NotNull StringTokenizer tokenizer,
+                                                @Nullable StringBuilder processingInfoStorage)
   {
     if (!TYPE_MARKER.equals(type)) {
+      if (processingInfoStorage != null) {
+        processingInfoStorage.append(String.format(
+          "Stopping '%s' provider because given signature doesn't have expected type - can work with '%s' but got '%s'",
+          getClass().getName(), TYPE_MARKER, type
+        ));
+      }
       return null;
     }
     String elementMarker = tokenizer.nextToken();
@@ -58,6 +66,12 @@ public class PsiNamesElementSignatureProvider extends AbstractElementSignaturePr
           result = child;
         }
         else {
+          if (processingInfoStorage != null) {
+            processingInfoStorage.append(String.format(
+              "Stopping '%s' provider because it has top level marker but more than one non white-space child: %s",
+              getClass().getName(), Arrays.toString(children)
+            ));
+          }
           // More than one top-level non-white space children. Can't match.
           return null;
         }
index 0d0cbc9e8083b64281e78269071e7884b75cea20..9cdd33cc804a71b6bfc37bb1ce92526fe26b9d6c 100644 (file)
 
 package com.intellij.codeInsight.highlighting;
 
-import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
-import com.intellij.openapi.actionSystem.LangDataKeys;
-import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.editor.markup.RangeHighlighter;
+import com.intellij.find.FindManager;
+import com.intellij.find.FindModel;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.actionSystem.PlatformDataKeys;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
+import com.intellij.openapi.editor.markup.RangeHighlighter;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.wm.WindowManager;
-import com.intellij.find.FindManager;
-import com.intellij.find.FindModel;
-import com.intellij.psi.PsiFile;
-import com.intellij.refactoring.changeSignature.ChangeSignatureGestureDetector;
 
 import java.util.Map;
 
@@ -75,10 +71,6 @@ public class EscapeHandler extends EditorActionHandler {
           }
         }
       }
-      final PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
-      if (file != null && ChangeSignatureGestureDetector.getInstance(project).containsChangeSignatureChange(file)) {
-        return true;
-      }
     }
 
     return myOriginalHandler.isEnabled(editor, dataContext);
index 4ec86542218f114cd8aa095be99aadc4b047a7d6..6ed8cd6df4931bd2b2e261ebb56dea61c3000920 100644 (file)
@@ -32,7 +32,9 @@ import com.intellij.lang.LangBundle;
 import com.intellij.openapi.Disposable;
 import com.intellij.openapi.actionSystem.ActionManager;
 import com.intellij.openapi.actionSystem.IdeActions;
+import com.intellij.openapi.application.AccessToken;
 import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.application.WriteAction;
 import com.intellij.openapi.command.CommandProcessor;
 import com.intellij.openapi.command.WriteCommandAction;
 import com.intellij.openapi.diagnostic.Logger;
@@ -718,18 +720,19 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
   }
 
   public void finishLookup(char completionChar, @Nullable final LookupElement item) {
-    doHide(false, true);
     if (item == null ||
         item instanceof EmptyLookupItem ||
         item.getObject() instanceof DeferredUserLookupValue &&
         item.as(LookupItem.CLASS_CONDITION_KEY) != null &&
         !((DeferredUserLookupValue)item.getObject()).handleUserSelection(item.as(LookupItem.CLASS_CONDITION_KEY), myProject)) {
+      doHide(false, true);
       fireItemSelected(null, completionChar);
       return;
     }
 
     final PsiFile file = getPsiFile();
     if (file != null && !WriteCommandAction.ensureFilesWritable(myProject, Arrays.asList(file))) {
+      doHide(false, true);
       fireItemSelected(null, completionChar);
       return;
     }
@@ -744,13 +747,21 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
     if (!plainMatch) {
       FeatureUsageTracker.getInstance().triggerFeatureUsed(CodeCompletionFeatures.EDITING_COMPLETION_CAMEL_HUMPS);
     }
-
-    ApplicationManager.getApplication().runWriteAction(new Runnable() {
+    
+    performGuardedChange(new Runnable() {
       public void run() {
-        insertLookupString(item, prefix);
+        AccessToken token = WriteAction.start();
+        try {
+          insertLookupString(item, prefix);
+        }
+        finally {
+          token.finish();
+        }
       }
     });
 
+    doHide(false, true);
+
     fireItemSelected(item, completionChar);
   }
 
index abb26c704eba894847efda71dfc88469f5703310..8325c4c66ff29dfbe35517f0195d8ed268ecaf83 100644 (file)
@@ -19,8 +19,6 @@ package com.intellij.codeInsight.template.impl;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.RangeMarker;
-import com.intellij.openapi.editor.ex.DocumentEx;
-import com.intellij.openapi.editor.ex.RangeMarkerEx;
 
 import java.util.ArrayList;
 
@@ -129,4 +127,8 @@ public class TemplateSegments {
 
     return -1;
   }
+
+  public int getSegmentsCount() {
+    return mySegments.size();
+  }
 }
\ No newline at end of file
index 3ed94133a53fe6adb355cfda599760a32679b716..89c6a1a21a123dd2c22ab2abb5262c01195cc250 100644 (file)
@@ -230,6 +230,14 @@ public class TemplateState implements Disposable {
 
     return new TextRange(mySegments.getSegmentStart(segment), mySegments.getSegmentEnd(segment));
   }
+  
+  public int getSegmentsCount() {
+    return mySegments.getSegmentsCount();
+  }
+
+  public TextRange getSegmentRange(int segment){
+    return new TextRange(mySegments.getSegmentStart(segment), mySegments.getSegmentEnd(segment));
+  }
 
   public boolean isFinished() {
     return myCurrentVariableNumber < 0;
index 4df11088be717e0e3786f5a4a491e3723ebd8e8f..bf6306bdde9af30530a4f2d63c27f07fd556467d 100644 (file)
@@ -72,7 +72,7 @@ public class ConvertProjectDialog extends DialogWrapper {
     }
     else {
       message.append(IdeBundle.message("conversion.dialog.text.1", context.getProjectFile().getName(),
-                                       ApplicationNamesInfo.getInstance().getProductName()));
+                                       ApplicationNamesInfo.getInstance().getFullProductName()));
     }
     message.append(IdeBundle.message("conversion.dialog.text.2", myBackupDir.getAbsolutePath()));
     message.append("</html>");
@@ -155,7 +155,7 @@ public class ConvertProjectDialog extends DialogWrapper {
     List<File> files = getReadOnlyFiles();
     if (!files.isEmpty()) {
       final String message = IdeBundle.message("message.text.unlock.read.only.files",
-                                               ApplicationNamesInfo.getInstance().getProductName(),
+                                               ApplicationNamesInfo.getInstance().getFullProductName(),
                                                getFilesString(files));
       final String[] options = {CommonBundle.getContinueButtonText(), CommonBundle.getCancelButtonText()};
       if (Messages.showOkCancelDialog(myMainPanel, message, IdeBundle.message("dialog.title.convert.project"), options[0], options[1], null) != 0) {
index 1c446b6367b0ab026dc1deb9095ef45342e7e63d..6cd6f71d0f8900cfe789424c570074beef8ec47a 100644 (file)
@@ -83,7 +83,7 @@ public abstract class AbstractNavBarUI implements NavBarUI {
     int h = item.getHeight();
 
     final Paint bg = floating ? Color.WHITE : new GradientPaint(0, 0, new Color(255, 255, 255, 30), 0, h, new Color(255, 255, 255, 10));
-    final Color selection = floating ? UIUtil.getListSelectionBackground() : new Color(0, 0, 0, 60);
+    final Color selection = UIUtil.getListSelectionBackground();
     
     final boolean selected = item.isSelected() && item.isFocused();
     
@@ -173,8 +173,7 @@ public abstract class AbstractNavBarUI implements NavBarUI {
 
   @Override
   public Insets getWrapperPanelInsets(Insets insets) {
-    return new Insets(insets.top + (shouldPaintWrapperPanel() ? 5 : 0), insets.left, 
-                      insets.bottom + (shouldPaintWrapperPanel() ? 5 : 0), insets.right);
+    return new Insets(insets.top + (shouldPaintWrapperPanel() ? 1 : 0), insets.left, insets.bottom, insets.right);
   }
   
   private static boolean shouldPaintWrapperPanel() {
@@ -182,7 +181,7 @@ public abstract class AbstractNavBarUI implements NavBarUI {
   }
 
   protected Color getBackgroundColor() {
-    return new Color(0, 0, 0, 35);
+    return UIUtil.getSlightlyDarkerColor(UIUtil.getPanelBackground());
   }
   
   @Override
index 3c4f3ba88b3d6da7c47b93960534ceec68cb5bfb..b49ce25eebacb26540f2ffb9b68b0bc719798e0f 100644 (file)
@@ -16,6 +16,7 @@
 package com.intellij.ide.navigationToolbar.ui;
 
 import com.intellij.ide.navigationToolbar.NavBarItem;
+import com.intellij.util.ui.SameColor;
 import com.intellij.util.ui.UIUtil;
 
 import java.awt.*;
@@ -41,6 +42,6 @@ public class AquaNavBarUI extends AbstractNavBarUI {
 
   @Override
   protected Color getBackgroundColor() {
-    return new Color(0, 0, 0, 35);
+    return UIUtil.getSlightlyDarkerColor(new SameColor(200));
   }
 }
index 1958ae98acb4924a47aad31e395a302498302442..8704225360b8215ad8462524867da83a4779ad2c 100644 (file)
@@ -31,7 +31,7 @@ import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService;
 import com.intellij.openapi.util.IconLoader;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.pom.NavigatableWithText;
 import org.jetbrains.annotations.NotNull;
@@ -88,7 +88,7 @@ public class NamedLibraryElementNode extends ProjectViewNode<NamedLibraryElement
     if (!orderEntry.isValid()) return false;
     VirtualFile[] files = orderEntry.getFiles(orderType);
     for (VirtualFile virtualFile : files) {
-      boolean ancestor = VfsUtil.isAncestor(virtualFile, file, false);
+      boolean ancestor = VfsUtilCore.isAncestor(virtualFile, file, false);
       if (ancestor) return true;
     }
     return false;
@@ -108,7 +108,7 @@ public class NamedLibraryElementNode extends ProjectViewNode<NamedLibraryElement
           presentation.setLocationString(FileUtil.toSystemDependentName(path));
         }
       }
-      presentation.setTooltip(IdeBundle.message("node.projectview.jdk"));
+      presentation.setTooltip(null);
     }
     else {
       presentation.setTooltip(StringUtil.capitalize(IdeBundle.message("node.projectview.library", ((LibraryOrderEntry)orderEntry).getLibraryLevel())));
index 502d13547b560c4f756ab66ac0c9792298dc8fd6..051a7eaf6f39045c5b73d4f2dda445a6599a8aa0 100644 (file)
 
 package com.intellij.injected.editor;
 
-import com.intellij.ide.DataManager;
 import com.intellij.openapi.Disposable;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.EditorFactory;
 import com.intellij.openapi.editor.LogicalPosition;
 import com.intellij.openapi.editor.RangeMarker;
 import com.intellij.openapi.editor.event.DocumentListener;
@@ -629,10 +628,10 @@ public class DocumentWindowImpl extends UserDataHolderBase implements Disposable
     int offsetInRightFragment = injectedToHost(offset, false);
     if (offsetInLeftFragment == offsetInRightFragment) return offsetInLeftFragment;
 
-    // heuristics: return offset closest to caret
-    Editor editor = PlatformDataKeys.EDITOR.getData(DataManager.getInstance().getDataContext());
-    if (editor instanceof EditorWindow) editor = ((EditorWindow)editor).getDelegate();
-    if (editor != null) {
+    // heuristics: return offset closest to the caret
+    Editor[] editors = EditorFactory.getInstance().getEditors(getDelegate());
+    for (Editor editor : editors) {
+      if (editor instanceof EditorWindow) editor = ((EditorWindow)editor).getDelegate();
       int caret = editor.getCaretModel().getOffset();
       return Math.abs(caret - offsetInLeftFragment) < Math.abs(caret - offsetInRightFragment) ? offsetInLeftFragment : offsetInRightFragment;
     }
@@ -649,10 +648,10 @@ public class DocumentWindowImpl extends UserDataHolderBase implements Disposable
       if (offset < 0) {
         return preferLeftFragment ? prevEnd : currentRange.getStartOffset() - 1;
       }
-      else if (offset == 0) {
+      if (offset == 0) {
         return preferLeftFragment && i != 0 ? prevEnd : currentRange.getStartOffset();
       }
-      else if (offset < length || offset == length && preferLeftFragment) {
+      if (offset < length || offset == length && preferLeftFragment) {
         return currentRange.getStartOffset() + offset;
       }
       offset -= length;
index ebaec05ce7b98be9159edee0e4fe98f4b21da644..30db6d35e0e9b079d5c30e33832189d965265d0d 100644 (file)
@@ -184,20 +184,20 @@ public class SdkConfigurationUtil {
     });
   }
 
-  public static void configureDirectoryProjectSdk(final Project project, final SdkType... sdkTypes) {
+  public static void configureDirectoryProjectSdk(final Project project, @Nullable Comparator<Sdk> preferredSdkComparator, final SdkType... sdkTypes) {
     Sdk existingSdk = ProjectRootManager.getInstance(project).getProjectSdk();
     if (existingSdk != null && ArrayUtil.contains(existingSdk.getSdkType(), sdkTypes)) {
       return;
     }
 
-    Sdk sdk = findOrCreateSdk(sdkTypes);
+    Sdk sdk = findOrCreateSdk(preferredSdkComparator, sdkTypes);
     if (sdk != null) {
       setDirectoryProjectSdk(project, sdk);
     }
   }
 
   @Nullable
-  public static Sdk findOrCreateSdk(final SdkType... sdkTypes) {
+  public static Sdk findOrCreateSdk(@Nullable Comparator<Sdk> comparator, final SdkType... sdkTypes) {
     final Project defaultProject = ProjectManager.getInstance().getDefaultProject();
     final Sdk sdk = ProjectRootManager.getInstance(defaultProject).getProjectSdk();
     if (sdk != null) {
@@ -210,6 +210,9 @@ public class SdkConfigurationUtil {
     for (SdkType type : sdkTypes) {
       List<Sdk> sdks = ProjectJdkTable.getInstance().getSdksOfType(type);
       if (sdks.size() > 0) {
+        if (comparator != null) {
+          Collections.sort(sdks, comparator);
+        }
         return sdks.get(0);
       }
     }
index ebe65aadcd1af808cc81068e587e41f95040a53e..48c96d92884fd4be0718d0932f1552653c8d3286 100644 (file)
@@ -156,7 +156,7 @@ public class DirectoryNode extends PackageDependenciesNode {
   @Nullable
   private PsiDirectory getPsiDirectory() {
     if (myDirectory == null) {
-      if (myVDirectory.isValid()) {
+      if (myVDirectory.isValid() && !myProject.isDisposed()) {
         myDirectory = PsiManager.getInstance(myProject).findDirectory(myVDirectory);
       }
     }
index e0cb7644c63e8fea5cf718926bcfed845ca7ef9f..bf3eca1e8b6d9a8b60f5a42615a7ad734fbed5af 100644 (file)
@@ -689,7 +689,7 @@ public class PsiDocumentManagerImpl extends PsiDocumentManager implements Projec
 
   private boolean isRelevant(FileViewProvider viewProvider) {
     VirtualFile virtualFile = viewProvider.getVirtualFile();
-    return !virtualFile.getFileType().isBinary() && viewProvider.getManager() == myPsiManager && !myPsiManager.getProject().isDisposed();
+    return !virtualFile.getFileType().isBinary() && viewProvider.getManager() == myPsiManager && !myPsiManager.getProject().isDisposed() && !myProject.isDefault();
   }
 
   public static boolean checkConsistency(PsiFile psiFile, Document document) {
@@ -773,4 +773,10 @@ public class PsiDocumentManagerImpl extends PsiDocumentManager implements Projec
     // Ensure all documents are committed on save so file content dependent indices, that use PSI to build have consistent content.
     commitAllDocuments();
   }
+
+  @NonNls
+  @Override
+  public String toString() {
+    return super.toString() + " for the project "+myProject + ".";
+  }
 }
index a440cf6977bdd724f1229d5b062824ed2127f487..5f7ef77ae2ebfd3a4b2a16f19bba430e4280fcc0 100644 (file)
@@ -38,7 +38,8 @@ public class ChangeSignatureDetectorAction extends RefactoringBaseIntention {
   @NotNull
   @Override
   public String getText() {
-    return myAcceptText;
+    final String text = myAcceptText;
+    return text != null ? text : CHANGE_SIGNATURE;
   }
 
   @NotNull
index d679327406778359a3a1b2bf632829ce70bed0b5..57b93f5a6fc0e5f294943202c807c0678f172d76 100644 (file)
@@ -59,7 +59,7 @@ public class ChangeSignaturePassFactory extends AbstractProjectComponent impleme
   }
 
   private static class ChangeSignaturePass extends TextEditorHighlightingPass {
-    @NonNls private static final String SIGNATURE_SHOULD_BE_POSSIBLY_CHANGED = "Signature should be possibly changed";
+    @NonNls private static final String SIGNATURE_SHOULD_BE_POSSIBLY_CHANGED = "Signature change was detected";
     private final Project myProject;
     private PsiFile myFile;
     private Editor myEditor;
@@ -81,7 +81,8 @@ public class ChangeSignaturePassFactory extends AbstractProjectComponent impleme
       if (changeInfo != null) {
         final PsiElement element = changeInfo.getMethod();
         int offset = myEditor.getCaretModel().getOffset();
-        if (!element.getTextRange().contains(offset)) return;
+        final TextRange elementTextRange = element.getTextRange();
+        if (elementTextRange == null || !elementTextRange.contains(offset)) return;
         final TextRange range = getHighlightingRange(changeInfo);
         if (range != null && detector.isChangeSignatureAvailable(element)) {
           myRange = range;
index e0ef53a6f84dd5df183b1a5c9fa7465875a14c7a..353b9b581bab85ef56c1c5928bac38ac642556b7 100644 (file)
@@ -23,6 +23,7 @@ import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.command.CommandProcessor;
 import com.intellij.openapi.command.impl.FinishMarkAction;
 import com.intellij.openapi.command.impl.StartMarkAction;
+import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.util.Pair;
@@ -39,7 +40,9 @@ import com.intellij.refactoring.rename.RenamePsiElementProcessor;
 import com.intellij.refactoring.rename.naming.AutomaticRenamerFactory;
 import com.intellij.usageView.UsageViewUtil;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -61,19 +64,61 @@ public class MemberInplaceRenamer extends VariableInplaceRenamer {
   protected PsiElement checkLocalScope() {
     PsiElement scope = super.checkLocalScope();
     if (scope == null) {
-      final PsiNamedElement namedElement = getVariable();
-      if (namedElement != null) {
-        return namedElement.getContainingFile();
+      PsiFile currentFile = PsiDocumentManager.getInstance(myProject).getPsiFile(myEditor.getDocument());
+      if (currentFile != null) {
+        return currentFile;
       }
     }
     return scope;
   }
 
+  @Override
+  protected PsiElement getNameIdentifier() {
+    final PsiFile currentFile = PsiDocumentManager.getInstance(myProject).getPsiFile(myEditor.getDocument());
+    if (currentFile == myElementToRename.getContainingFile()){
+      return super.getNameIdentifier();
+    }
+    if (currentFile != null) {
+      final PsiElement elementAt = currentFile.findElementAt(myEditor.getCaretModel().getOffset());
+      if (elementAt != null) {
+        final PsiElement referenceExpression = elementAt.getParent();
+        if (referenceExpression != null) {
+          final PsiReference reference = referenceExpression.getReference();
+          if (reference != null && reference.resolve() == myElementToRename) {
+            return elementAt;
+          }
+        }
+      }
+      return null;
+    }
+    return null;
+  }
+
+  @Override
+  protected Collection<PsiReference> collectRefs(SearchScope referencesSearchScope) {
+    final ArrayList<PsiReference> references = new ArrayList<PsiReference>(super.collectRefs(referencesSearchScope));
+    final PsiNamedElement variable = getVariable();
+    if (variable != null) {
+      final RenamePsiElementProcessor processor = RenamePsiElementProcessor.forElement(variable);
+      final PsiElement substituted = processor.substituteElementToRename(variable, myEditor);
+      if (substituted != null && substituted != variable) {
+        references.addAll(ReferencesSearch.search(substituted, referencesSearchScope, false).findAll());
+      }
+    }
+    return references;
+  }
+
+  @Override
+  protected boolean notSameFile(@Nullable VirtualFile file, PsiFile containingFile) {
+    final PsiFile currentFile = PsiDocumentManager.getInstance(myProject).getPsiFile(myEditor.getDocument());
+    return currentFile == null || containingFile != currentFile;
+  }
+
   @Override
   protected SearchScope getReferencesSearchScope(VirtualFile file) {
-    PsiNamedElement variable = getVariable();
-    return variable != null ? new LocalSearchScope(variable.getContainingFile())
-                            : ProjectScope.getProjectScope(myProject);
+    PsiFile currentFile = PsiDocumentManager.getInstance(myProject).getPsiFile(myEditor.getDocument());
+    return currentFile != null ? new LocalSearchScope(currentFile)
+                               : ProjectScope.getProjectScope(myProject);
   }
 
   @Override
@@ -87,9 +132,8 @@ public class MemberInplaceRenamer extends VariableInplaceRenamer {
         appendAdditionalElement(stringUsages, variable, substituted);
         processor = RenamePsiElementProcessor.forElement(substituted);
         final HashMap<PsiElement, String> allRenames = new HashMap<PsiElement, String>();
-
-        processor.prepareRenaming(substituted, "", allRenames, new LocalSearchScope(variable.getContainingFile()));
-
+        PsiFile currentFile = PsiDocumentManager.getInstance(myProject).getPsiFile(myEditor.getDocument());
+        processor.prepareRenaming(substituted, "", allRenames, new LocalSearchScope(currentFile));
         for (PsiElement element : allRenames.keySet()) {
           appendAdditionalElement(stringUsages, variable, element);
         }
@@ -98,10 +142,11 @@ public class MemberInplaceRenamer extends VariableInplaceRenamer {
     return showChooser;
   }
 
-  private static void appendAdditionalElement(List<Pair<PsiElement, TextRange>> stringUsages,
-                                              PsiNamedElement variable,
-                                              PsiElement element) {
-    if (element != variable && element instanceof PsiNameIdentifierOwner) {
+  private void appendAdditionalElement(List<Pair<PsiElement, TextRange>> stringUsages,
+                                       PsiNamedElement variable,
+                                       PsiElement element) {
+    if (element != variable && element instanceof PsiNameIdentifierOwner &&
+        !notSameFile(null, element.getContainingFile())) {
       final PsiElement identifier = ((PsiNameIdentifierOwner)element).getNameIdentifier();
       if (identifier != null) {
         stringUsages.add(Pair.create(identifier, new TextRange(0, identifier.getTextLength())));
@@ -126,7 +171,6 @@ public class MemberInplaceRenamer extends VariableInplaceRenamer {
   
           final String commandName = RefactoringBundle
             .message("renaming.0.1.to.2", UsageViewUtil.getType(variable), UsageViewUtil.getDescriptiveName(variable), newName);
-          restore(variable, commandName);
           CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
             public void run() {
               final RenamePsiElementProcessor elementProcessor = RenamePsiElementProcessor.forElement(substitutedElement);
@@ -158,53 +202,24 @@ public class MemberInplaceRenamer extends VariableInplaceRenamer {
     //do not highlight non-code usages in file
   }
 
-  private void restore(final PsiNamedElement variable, String commandName) {
-    final RenamePsiElementProcessor processor = RenamePsiElementProcessor.forElement(variable);
-    final PsiElement substituted = processor.substituteElementToRename(variable, myEditor);
-    if (substituted != null) {
-      final RenamePsiElementProcessor substProcessor = RenamePsiElementProcessor.forElement(substituted);
-      final LocalSearchScope localSearchScope = new LocalSearchScope(variable.getContainingFile());
-      final Collection<PsiReference> references = ReferencesSearch.search(substituted, localSearchScope).findAll();
-      CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
-        public void run() {
-          ApplicationManager.getApplication().runWriteAction(new Runnable() {
-            public void run() {
-
-              final HashMap<PsiElement, String> allRenames = new HashMap<PsiElement, String>();
-
-
-              substProcessor.prepareRenaming(substituted, "", allRenames, localSearchScope);
-
-              if (substituted != variable && substituted instanceof PsiNameIdentifierOwner) {
-                ((PsiNameIdentifierOwner)substituted).setName(myOldName);
-              }
-
-              for (PsiElement element : allRenames.keySet()) {
-                if (element instanceof PsiNameIdentifierOwner && element != variable) {
-                  ((PsiNameIdentifierOwner)element).setName(myOldName);
-                }
-              }
-              for (PsiReference reference : references) {
-                reference.handleElementRename(myOldName);
-              }
-
-
-              variable.setName(myOldName);
-            }
-          });
-        }
-      }, commandName, null);
-                }
-  }
-
   @Override
-  protected void moveOffsetAfter(boolean success) {
-    super.moveOffsetAfter(success);
-    if (!success) {
-      if (myElementToRename != null && myElementToRename.isValid()) {
-        restore(myElementToRename, RENAME_TITLE);
+  protected void restoreStateBeforeTemplateIsFinished() {
+    CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
+      public void run() {
+        ApplicationManager.getApplication().runWriteAction(new Runnable() {
+          public void run() {
+            final TemplateState state = TemplateManagerImpl.getTemplateState(myEditor);
+            assert state != null;
+            final int segmentsCount = state.getSegmentsCount();
+            final Document document = myEditor.getDocument();
+            for (int i = 0; i < segmentsCount; i++) {
+              final TextRange segmentRange = state.getSegmentRange(i);
+              document.replaceString(segmentRange.getStartOffset(), segmentRange.getEndOffset(), myOldName);
+            }
+          }
+        });
       }
-    }
+    }, RENAME_TITLE, null);
   }
 
   @Override
index 9fc3dcc41a3577344755fec3577fb68ca9546872..196c9f95f25e596083b2772e52fa509d9cfd39c7 100644 (file)
@@ -143,14 +143,14 @@ public class VariableInplaceRenamer {
 
     SearchScope referencesSearchScope = getReferencesSearchScope(file);
 
-    final Collection<PsiReference> refs = ReferencesSearch.search(myElementToRename, referencesSearchScope, false).findAll();
+    final Collection<PsiReference> refs = collectRefs(referencesSearchScope);
 
     addReferenceAtCaret(refs);
 
     for (PsiReference ref : refs) {
-      final FileViewProvider usageViewProvider = ref.getElement().getContainingFile().getViewProvider();
+      final PsiFile containingFile = ref.getElement().getContainingFile();
 
-      if (getTopLevelVirtualFile(usageViewProvider) != file) {
+      if (notSameFile(file, containingFile)) {
         return false;
       }
     }
@@ -186,6 +186,14 @@ public class VariableInplaceRenamer {
     return true;
   }
 
+  protected Collection<PsiReference> collectRefs(SearchScope referencesSearchScope) {
+    return ReferencesSearch.search(myElementToRename, referencesSearchScope, false).findAll();
+  }
+
+  protected boolean notSameFile(VirtualFile file, PsiFile containingFile) {
+    return getTopLevelVirtualFile(containingFile.getViewProvider()) != file;
+  }
+
   protected SearchScope getReferencesSearchScope(VirtualFile file) {
     return file == null || ProjectRootManager.getInstance(myProject).getFileIndex().isInContent(file)
       ? ProjectScope.getProjectScope(myElementToRename.getProject())
@@ -209,7 +217,7 @@ public class VariableInplaceRenamer {
 
   protected void collectAdditionalElementsToRename(boolean processTextOccurrences, final List<Pair<PsiElement, TextRange>> stringUsages) {
     final String stringToSearch = myElementToRename.getName();
-    final PsiFile currentFile = myElementToRename.getContainingFile();
+    final PsiFile currentFile = PsiDocumentManager.getInstance(myProject).getPsiFile(myEditor.getDocument());
     if (processTextOccurrences && stringToSearch != null) {
       TextOccurrencesUtil
         .processUsagesInStringsAndComments(myElementToRename, stringToSearch, true, new PairProcessor<PsiElement, TextRange>() {
@@ -243,7 +251,7 @@ public class VariableInplaceRenamer {
       resolveSnapshotProvider.createSnapshot(scope):null;
     final TemplateBuilderImpl builder = new TemplateBuilderImpl(scope);
 
-    PsiElement nameIdentifier = myElementToRename instanceof PsiNameIdentifierOwner ? ((PsiNameIdentifierOwner)myElementToRename).getNameIdentifier() : null;
+    PsiElement nameIdentifier = getNameIdentifier();
     int offset = myEditor.getCaretModel().getOffset();
     PsiElement selectedElement = getSelectedInEditorElement(nameIdentifier, refs, stringUsages, offset);
 
@@ -304,6 +312,7 @@ public class VariableInplaceRenamer {
                     }
                   }
                 }
+                restoreStateBeforeTemplateIsFinished();
               }
 
               @Override
@@ -376,6 +385,13 @@ public class VariableInplaceRenamer {
     return true;
   }
 
+  protected void restoreStateBeforeTemplateIsFinished() {}
+
+  @Nullable
+  protected PsiElement getNameIdentifier() {
+    return myElementToRename instanceof PsiNameIdentifierOwner ? ((PsiNameIdentifierOwner)myElementToRename).getNameIdentifier() : null;
+  }
+
   protected void restoreStateBeforeDialogWouldBeShown() {
   }
 
@@ -528,12 +544,11 @@ public class VariableInplaceRenamer {
                                           Collection<PsiReference> refs,
                                           Collection<Pair<PsiElement, TextRange>> stringUsages) {
     EditorColorsManager colorsManager = EditorColorsManager.getInstance();
-    if (myElementToRename instanceof PsiNameIdentifierOwner) {
-      PsiElement nameId = ((PsiNameIdentifierOwner)myElementToRename).getNameIdentifier();
-      LOG.assertTrue(nameId != null, myElementToRename);
-      final TextRange textRange = nameId.getTextRange();
-      LOG.assertTrue(textRange != null, nameId);
-      TextRange range = InjectedLanguageManager.getInstance(myProject).injectedToHost(nameId, textRange);
+    PsiElement nameIdentifier = getNameIdentifier();
+    if (nameIdentifier != null) {
+      final TextRange textRange = nameIdentifier.getTextRange();
+      LOG.assertTrue(textRange != null, nameIdentifier);
+      TextRange range = InjectedLanguageManager.getInstance(myProject).injectedToHost(nameIdentifier, textRange);
       rangesToHighlight.put(range, colorsManager.getGlobalScheme().getAttributes(EditorColors.WRITE_SEARCH_RESULT_ATTRIBUTES));
     }
 
index 7dbcd6ec9a041ac7ca953cafdac3d17576779959..0f9a05a5565304028a52ff8c426d82ddb833eeca 100644 (file)
@@ -204,7 +204,7 @@ public class PresentationData implements ColoredItemPresentation, ComparableObje
     return myTooltip;
   }
 
-  public void setTooltip(final String tooltip) {
+  public void setTooltip(@Nullable final String tooltip) {
     myTooltip = tooltip;
   }
 
index 71b70528b4b8f4a8933b4f991756090e2cece391..30fd1006901b7f98e3f98699f3fa06f17b97f266 100644 (file)
@@ -48,6 +48,14 @@ public abstract class PropertiesComponent {
     return isValueSet(name) ? getValue(name) : defaultValue;
   }
 
+  public final long getOrInitLong(@NonNls String name, long defaultValue) {
+    try {
+      return Long.parseLong(getValue(name));
+    } catch (NumberFormatException e) {
+      return defaultValue;
+    }
+  }
+
   public String getOrInit(@NonNls String name, String defaultValue) {
     if (!isValueSet(name)) {
       setValue(name, defaultValue);
index 2f09317e285bc2c1d7299025dff4129cc2a60e23..9ca79753357ef470bed19b0f8b86e0773bcd8d5f 100644 (file)
@@ -24,6 +24,8 @@ import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
 import java.awt.*;
+import java.util.ArrayList;
+import java.util.Collection;
 
 /**
  * @author Konstantin Bulenkov
@@ -31,6 +33,7 @@ import java.awt.*;
 public class JBLoadingPanel extends JPanel {
   private final JPanel myPanel;
   final LoadingDecorator myDecorator;
+  private Collection<JBLoadingPanelListener> myListeners = new ArrayList<JBLoadingPanelListener>();
 
   public JBLoadingPanel(@Nullable LayoutManager manager, @NotNull Disposable parent) {
     super(new BorderLayout());
@@ -58,6 +61,9 @@ public class JBLoadingPanel extends JPanel {
 
   public void stopLoading() {
     myDecorator.stopLoading();
+    for (JBLoadingPanelListener listener : myListeners) {
+      listener.onLoadingFinish();
+    }
   }
 
   public boolean isLoading() {
@@ -66,6 +72,17 @@ public class JBLoadingPanel extends JPanel {
 
   public void startLoading() {
     myDecorator.startLoading(false);
+    for (JBLoadingPanelListener listener : myListeners) {
+      listener.onLoadingStart();
+    }
+  }
+  
+  public void addListener(@NotNull JBLoadingPanelListener listener) {
+    myListeners.add(listener);
+  }
+
+  public boolean removeListener(@NotNull JBLoadingPanelListener listener) {
+    return myListeners.remove(listener);
   }
 
   @Override
diff --git a/platform/platform-api/src/com/intellij/ui/components/JBLoadingPanelListener.java b/platform/platform-api/src/com/intellij/ui/components/JBLoadingPanelListener.java
new file mode 100644 (file)
index 0000000..ae6db81
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2000-2011 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.ui.components;
+
+/**
+ * @author Konstantin Bulenkov
+ */
+public interface JBLoadingPanelListener {
+  void onLoadingStart();
+
+  void onLoadingFinish();
+
+
+  abstract class Adapter implements JBLoadingPanelListener {
+    @Override
+    public void onLoadingStart() {
+    }
+
+    @Override
+    public void onLoadingFinish() {
+    }
+  }
+}
index cf8372b3945422d37265c613fd618e82698d36fd..fa976ff25a984cec39ddf73d7212e0bbf7c84a9d 100644 (file)
@@ -18,7 +18,6 @@ package com.intellij.ui.tabs.impl;
 import com.intellij.openapi.Disposable;
 import com.intellij.openapi.actionSystem.ActionManager;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.registry.Registry;
 import com.intellij.openapi.wm.IdeFocusManager;
 import com.intellij.ui.tabs.JBTabsPosition;
 import com.intellij.ui.tabs.TabInfo;
@@ -28,7 +27,6 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.awt.*;
-import java.awt.geom.GeneralPath;
 import java.util.List;
 
 /**
@@ -42,14 +40,14 @@ public class JBEditorTabs extends JBTabsImpl {
 
   @Override
   protected void paintFirstGhost(Graphics2D g2d) {
-    if (!isNewTabsActive()) {
+    if (!isEditorTabs()) {
       super.paintFirstGhost(g2d);
     }
   }
 
   @Override
   protected void paintLastGhost(Graphics2D g2d) {
-    if (!isNewTabsActive()) {
+    if (!isEditorTabs()) {
       super.paintLastGhost(g2d);
     }
   }
@@ -63,25 +61,21 @@ public class JBEditorTabs extends JBTabsImpl {
                                  TabLabel label,
                                  Rectangle effectiveBounds,
                                  boolean rightGhostExists) {
-    if (!isNewTabsActive()) {
-      super.doPaintInactive(g2d, leftGhostExists, label, effectiveBounds, rightGhostExists);
-      return;
-    }
-
     Insets insets = getTabsBorder().getEffectiveBorder();
 
     int _x = effectiveBounds.x + insets.left;
     int _y = effectiveBounds.y + insets.top;
-    int _width = effectiveBounds.width - insets.left - insets.right;
+    int _width = effectiveBounds.width - insets.left - insets.right + (getTabsPosition() == JBTabsPosition.right ? 1 : 0);
     int _height = effectiveBounds.height - insets.top - insets.bottom;
     
     
     Color tabColor = label.getInfo().getTabColor();
     if (tabColor != null) {
-      g2d.setPaint(new GradientPaint(_x, _y, new SameColor(200), _x, _y + effectiveBounds.height, new SameColor(140)));
+      //g2d.setPaint(new LinearGradientPaint(_x, _y, _x, _y + effectiveBounds.height, new float[] {.3f, .6f, 1f}, new Color[] {new SameColor(170), new SameColor(150), new SameColor(90)}));
+      g2d.setPaint(new GradientPaint(_x, _y, new SameColor(170), _x, _y + effectiveBounds.height, new SameColor(150)));
       g2d.fillRect(_x, _y, _width, _height);
 
-      g2d.setColor(new Color(tabColor.getRed(), tabColor.getGreen(), tabColor.getBlue(), 110));
+      g2d.setColor(new Color(tabColor.getRed(), tabColor.getGreen(), tabColor.getBlue(), 150));
       g2d.fillRect(_x, _y, _width, _height);
     } else {
       g2d.setPaint(new GradientPaint(_x, _y, new Color(255, 255, 255, 140), _x, _y + effectiveBounds.height, new Color(255, 255, 255, 90)));
@@ -96,13 +90,9 @@ public class JBEditorTabs extends JBTabsImpl {
     return new Color(c.getRed() * c.getRed() / 255, c.getGreen() * c.getGreen() / 255, c.getBlue() * c.getBlue() / 255);
   }
 
-  public boolean isNewTabsActive() {
-    return Registry.is("editor.use.new.tabs");
-  }
-
   @Override
   protected void doPaintBackground(Graphics2D g2d, Rectangle clip) {
-    if (isNewTabsActive() && isEditorTabs()) {
+    if (isEditorTabs()) {
       g2d.setColor(UIUtil.getPanelBackground());
       g2d.fill(clip);
       
@@ -134,7 +124,7 @@ public class JBEditorTabs extends JBTabsImpl {
 
       Rectangle rectangle;
       if (vertical) {
-        rectangle = new Rectangle(insets.left, maxOffset, maxLength - insets.left - insets.right,
+        rectangle = new Rectangle(insets.left, maxOffset, getWidth(),
                                   r2.height - maxOffset - insets.top - insets.bottom);
       } else {
         int y = r2.y + insets.top;
@@ -160,65 +150,115 @@ public class JBEditorTabs extends JBTabsImpl {
   }
 
   protected void paintSelectionAndBorder(Graphics2D g2d) {
-    if (!isNewTabsActive()) {
-      super.paintSelectionAndBorder(g2d);
-      return;
-    }
-    
     if (getSelectedInfo() == null) return;
 
     TabLabel label = getSelectedLabel();
     Rectangle r = label.getBounds();
 
+    ShapeInfo selectedShape = _computeSelectedLabelShape();
+    
     Insets insets = getTabsBorder().getEffectiveBorder();
+    Insets i = selectedShape.path.transformInsets(insets);
+
+    int _x = r.x;
+    int _y = r.y;
+    int _height = r.height;
+    
+    //g2d.setColor(Color.WHITE);
+    //g2d.draw(
+    //  selectedShape.labelPath.transformLine(i.left, selectedShape.labelPath.getMaxY()
+    //    - selectedShape.labelPath.deltaY(3), selectedShape.path.getMaxX(), selectedShape.labelPath.getMaxY() - selectedShape.labelPath.deltaY(3)));
 
-    int _x = r.x + insets.left;
-    int _y = r.y + insets.top;
-    int _width = r.width - insets.left - insets.right;
-    int _height = r.height - insets.top - insets.bottom;
+
+    g2d.setColor(new Color(0, 0, 0, 45));
+    g2d.draw(
+      selectedShape.labelPath.transformLine(i.left, selectedShape.labelPath.getMaxY()
+        - selectedShape.labelPath.deltaY(4), selectedShape.path.getMaxX(), selectedShape.labelPath.getMaxY() - selectedShape.labelPath.deltaY(4)));
+    
+    g2d.setColor(new Color(0, 0, 0, 15));
+    g2d.draw(
+      selectedShape.labelPath.transformLine(i.left, selectedShape.labelPath.getMaxY()
+        - selectedShape.labelPath.deltaY(5), selectedShape.path.getMaxX(), selectedShape.labelPath.getMaxY() - selectedShape.labelPath.deltaY(5)));
 
     Color tabColor = label.getInfo().getTabColor();
     if (tabColor != null) {
       g2d.setColor(multiplyColor(tabColor));
-      g2d.fillRect(_x, _y, _width, _height);
+      g2d.fill(selectedShape.fillPath.getShape());
       
       g2d.setPaint(new GradientPaint(_x, _y, new Color(255, 255, 255, 150), _x, _y + _height, new Color(255, 255, 255, 0)));
     } else {
-      g2d.setPaint(new GradientPaint(_x, _y, new SameColor(255), _x, _y + _height, new SameColor(210)));
+      g2d.setPaint(new GradientPaint(_x, _y, new SameColor(255), _x, _y + _height, new SameColor(230)));
     }
 
-    g2d.fillRect(_x, _y, _width, _height);
+    g2d.fill(selectedShape.fillPath.getShape());
     
     g2d.setColor(new Color(255, 255, 255, 180));
-    g2d.drawRect(_x, _y, _width - 1, _height - 1);
-  }
-  
-  private static Shape createColorShape(int x, int y, int height) {
-    GeneralPath shape = new GeneralPath();
-    shape.moveTo(x, y);
-    shape.lineTo(x + height / 2, y);
-    shape.lineTo(x, y + height / 2);
-    shape.closePath();
-    return shape;
-  }
-  
-  private static void drawColorCornerAt(Graphics2D g2d, int _x, int _y, int _height, Color tabColor) {
-    g2d.setColor(multiplyColor(tabColor));
-    Shape shape = createColorShape(_x + 1, _y + 1, _height);
-    g2d.fill(shape);
-    g2d.setPaint(new GradientPaint(_x + 1, _y + 1, new Color(0, 0, 0, 50), _x + 1, _y + 1 + _height / 5, new Color(0, 0, 0, 0)));
-    g2d.fill(shape);
-
-    g2d.setColor(new Color(0, 0, 0, 100));
-    g2d.drawLine(_x + 1, _y + 1, _x + _height / 2, _y + 1);
-    g2d.setColor(new Color(0, 0, 0, 75));
-    g2d.drawLine(_x + 1, _y + 1, _x + 1, _y + _height / 2);
-    g2d.setColor(new Color(255, 255, 255, 130));
-    g2d.drawLine(_x + _height / 2 + 1, _y + 1, _x + 1, _y + _height / 2 + 1);
+    g2d.draw(selectedShape.fillPath.getShape());
+    
+    // fix right side due to swing stupidity (fill & draw will occupy different shapes)
+    g2d.draw(selectedShape.labelPath
+               .transformLine(selectedShape.labelPath.getMaxX() - selectedShape.labelPath.deltaX(1), selectedShape.labelPath.getY() +
+                                                                                                     selectedShape.labelPath.deltaY(1),
+                              selectedShape.labelPath.getMaxX() - selectedShape.labelPath.deltaX(1), selectedShape.labelPath.getMaxY() - 
+               selectedShape.labelPath.deltaY(4)));
+    
+    // side shadow
+    g2d.setColor(new Color(0, 0, 0, 30));
+    g2d.draw(selectedShape.labelPath
+               .transformLine(selectedShape.labelPath.getMaxX() + selectedShape.labelPath.deltaX(1), selectedShape.labelPath.getY() +
+                                                                                                     selectedShape.labelPath.deltaY(1),
+                              selectedShape.labelPath.getMaxX() + selectedShape.labelPath.deltaX(1), selectedShape.labelPath.getMaxY() - 
+               selectedShape.labelPath.deltaY(4)));
+    
+    boolean horizontal = getPosition() == JBTabsPosition.top || getPosition() == JBTabsPosition.bottom;
+    
+    g2d.draw(selectedShape.labelPath
+               .transformLine(selectedShape.labelPath.getX() - selectedShape.labelPath.deltaX(horizontal ? 2 : 1), selectedShape.labelPath.getY() +
+                                                                                                     selectedShape.labelPath.deltaY(1),
+                              selectedShape.labelPath.getX() - selectedShape.labelPath.deltaX(horizontal ? 2 : 1), selectedShape.labelPath.getMaxY() - 
+               selectedShape.labelPath.deltaY(4)));
+
+    g2d.setColor(new Color(0, 0, 0, 50));
+    g2d.draw(selectedShape.labelPath.transformLine(i.left, selectedShape.labelPath.getMaxY(),
+                                                   selectedShape.path.getMaxX(), selectedShape.labelPath.getMaxY()));
   }
 
   @Override
   public Color getBackground() {
     return new SameColor(142);
   }
+  
+  protected ShapeInfo _computeSelectedLabelShape() {
+    final ShapeInfo shape = new ShapeInfo();
+
+    shape.path = getEffectiveLayout().createShapeTransform(getSize());
+    shape.insets = shape.path.transformInsets(getLayoutInsets());
+    shape.labelPath = shape.path.createTransform(getSelectedLabel().getBounds());
+    
+    shape.labelBottomY = shape.labelPath.getMaxY() - shape.labelPath.deltaY(3);
+    shape.labelTopY =
+      shape.labelPath.getY() + (getPosition() == JBTabsPosition.top || getPosition() == JBTabsPosition.bottom ? shape.labelPath.deltaY(1) : 0) ;
+    shape.labelLeftX = shape.labelPath.getX() + (getPosition() == JBTabsPosition.top || getPosition() == JBTabsPosition.bottom ? 0 : shape.labelPath.deltaX(
+      1));
+    shape.labelRightX = shape.labelPath.getMaxX() - shape.labelPath.deltaX(1);
+
+    int leftX = shape.insets.left + (getPosition() == JBTabsPosition.top || getPosition() == JBTabsPosition.bottom ? 0 : shape.labelPath.deltaX(1));
+    
+    shape.path.moveTo(leftX, shape.labelBottomY);
+    shape.path.lineTo(shape.labelLeftX, shape.labelBottomY);
+    shape.path.lineTo(shape.labelLeftX, shape.labelTopY);
+    shape.path.lineTo(shape.labelRightX, shape.labelTopY);
+    shape.path.lineTo(shape.labelRightX, shape.labelBottomY);
+
+    int lastX = shape.path.getWidth() - shape.path.deltaX(shape.insets.right);
+
+    shape.path.lineTo(lastX, shape.labelBottomY);
+    shape.path.lineTo(lastX, shape.labelBottomY + shape.labelPath.deltaY(3));
+    shape.path.lineTo(leftX, shape.labelBottomY + shape.labelPath.deltaY(3));
+    
+    shape.path.closePath();
+    shape.fillPath = shape.path.copy();
+    
+    return shape;
+  }
 }
index 8a506789a19f9e44e249172a989a84eca637f470..6d958b1affe19d1165fe888bc931d77edd7ffdd2 100644 (file)
@@ -16,6 +16,7 @@
 package com.intellij.ui.tabs.impl;
 
 import com.intellij.ide.DataManager;
+import com.intellij.ide.ui.UISettings;
 import com.intellij.openapi.actionSystem.ActionGroup;
 import com.intellij.openapi.actionSystem.ActionPlaces;
 import com.intellij.openapi.actionSystem.DefaultActionGroup;
@@ -68,7 +69,7 @@ public class TabLabel extends JPanel {
     myInfo = info;
     myLabel.setOpaque(false);
     myLabel.setBorder(null);
-    myLabel.setIconTextGap(tabs instanceof JBEditorTabs && ((JBEditorTabs)tabs).isNewTabsActive() ? 2 : new JLabel().getIconTextGap());
+    myLabel.setIconTextGap(tabs.isEditorTabs() ? 2 : new JLabel().getIconTextGap());
     myLabel.setIconOpaque(false);
     myLabel.setIpad(new Insets(0, 0, 0, 0));
     setOpaque(false);
@@ -103,6 +104,18 @@ public class TabLabel extends JPanel {
     });
   }
 
+  @Override
+  public Insets getInsets() {
+    Insets insets = super.getInsets();
+    if (myTabs.isEditorTabs()) {
+      if (UISettings.getInstance().SHOW_CLOSE_BUTTON) {
+        return new Insets(insets.top, insets.left, insets.bottom, 3);
+      }
+    }
+    
+    return insets;
+  }
+
   public void setAligmentToCenter(boolean toCenter) {
     if (myCentered == toCenter && myLabel.getParent() != null) return;
 
index a7bd989d84d4fd6a19d5622c40960ae4d342f6f0..7e62fa2c85a5e3df58e5328ea3a79cb635a3c154 100644 (file)
@@ -20,6 +20,7 @@ import com.intellij.errorreport.ErrorReportSender;
 import com.intellij.errorreport.bean.ErrorBean;
 import com.intellij.errorreport.error.InternalEAPException;
 import com.intellij.errorreport.error.NoSuchEAPUserException;
+import com.intellij.errorreport.error.UpdateAvailableException;
 import com.intellij.ide.BrowserUtil;
 import com.intellij.ide.DataManager;
 import com.intellij.ide.plugins.IdeaPluginDescriptor;
@@ -28,7 +29,9 @@ import com.intellij.idea.IdeaLogger;
 import com.intellij.notification.*;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.actionSystem.PlatformDataKeys;
+import com.intellij.openapi.application.ApplicationInfo;
 import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.application.ex.ApplicationInfoEx;
 import com.intellij.openapi.diagnostic.ErrorReportSubmitter;
 import com.intellij.openapi.diagnostic.IdeaLoggingEvent;
 import com.intellij.openapi.diagnostic.SubmittedReportInfo;
@@ -75,15 +78,6 @@ public class ITNReporter extends ErrorReportSubmitter {
                                 String additionalInfo,
                                 final Component parentComponent,
                                 final Consumer<SubmittedReportInfo> callback) {
-    String newBuild = ErrorReportSender.checkNewBuild();
-    if (newBuild != null) {
-      Messages.showMessageDialog(parentComponent,
-                                 DiagnosticBundle.message("error.report.new.eap.build.message", newBuild), CommonBundle.getWarningTitle(),
-                                 Messages.getWarningIcon());
-      callback.consume(new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED));
-      return false;
-    }
-
     ErrorBean errorBean = new ErrorBean(event.getThrowable(), IdeaLogger.ourLastActionId);
 
     return doSubmit(event, parentComponent, callback, errorBean, additionalInfo);
@@ -108,18 +102,36 @@ public class ITNReporter extends ErrorReportSubmitter {
       }
     }
 
-    @NonNls String login = errorReportConfigurable.ITN_LOGIN;
-    @NonNls String password = errorReportConfigurable.getPlainItnPassword();
-    if (login.trim().length() == 0 && password.trim().length() == 0) {
-      login = "idea_anonymous";
-      password = "guest";
+    errorBean.setDescription(description);
+    errorBean.setMessage(event.getMessage());
+
+    if (previousExceptionThreadId != 0) {
+      errorBean.setPreviousException(previousExceptionThreadId);
+    }
+
+    Throwable t = event.getThrowable();
+    if (t != null) {
+      final PluginId pluginId = IdeErrorsDialog.findPluginId(t);
+      if (pluginId != null) {
+        final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(pluginId);
+        if (ideaPluginDescriptor != null && !ideaPluginDescriptor.isBundled()) {
+          errorBean.setPluginName(ideaPluginDescriptor.getName());
+          errorBean.setPluginVersion(ideaPluginDescriptor.getVersion());
+        }
+      }
     }
 
-    errorBean.setDescription(buildDescription(event, description));
     if (event.getData() instanceof LogMessageEx) {
       errorBean.setAttachments(((LogMessageEx)event.getData()).getAttachments());
     }
 
+    @NonNls String login = errorReportConfigurable.ITN_LOGIN;
+    @NonNls String password = errorReportConfigurable.getPlainItnPassword();
+    if (login.trim().length() == 0 && password.trim().length() == 0) {
+      login = "idea_anonymous";
+      password = "guest";
+    }
+    
     ErrorReportSender.sendError(project, login, password, errorBean, new Consumer<Integer>() {
       @SuppressWarnings({"AssignmentToStaticFieldFromInstanceMethod"})
       @Override
@@ -172,7 +184,14 @@ public class ITNReporter extends ErrorReportSubmitter {
             else {
               msg = DiagnosticBundle.message("error.report.sending.failure");
             }
-            if (Messages.showYesNoDialog(parentComponent, msg,
+            if (e instanceof UpdateAvailableException) {
+              ApplicationInfoEx appInfo = (ApplicationInfoEx) ApplicationManager.getApplication().getComponent(ApplicationInfo.class);
+              String message = DiagnosticBundle.message(
+                appInfo.isEAP() ? "error.report.new.eap.build.message" : "error.report.new.build.message", e.getMessage());
+              Messages.showMessageDialog(parentComponent, message, CommonBundle.getWarningTitle(), Messages.getWarningIcon());
+              callback.consume(new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED));
+            }
+            else if (Messages.showYesNoDialog(parentComponent, msg,
                                          ReportMessages.ERROR_REPORT, Messages.getErrorIcon()) != 0) {
               callback.consume(new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED));
             }
@@ -200,39 +219,4 @@ public class ITNReporter extends ErrorReportSubmitter {
     });
     return true;
   }
-
-  private static String buildDescription(IdeaLoggingEvent event, String description) {
-    String message = event.getMessage();
-
-    @NonNls StringBuilder descBuilder = new StringBuilder();
-    if (!StringUtil.isEmpty(description)) {
-      descBuilder.append("User description: ").append(description).append("\n");
-    }
-    if (message != null) {
-      descBuilder.append("Error message: ").append(message).append("\n");
-    }
-
-    Throwable t = event.getThrowable();
-    if (t != null) {
-      final PluginId pluginId = IdeErrorsDialog.findPluginId(t);
-      if (pluginId != null) {
-        final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(pluginId);
-        if (ideaPluginDescriptor != null && !ideaPluginDescriptor.isBundled()) {
-          descBuilder.append("Plugin ").append(ideaPluginDescriptor.getName()).append(" version: ").append(ideaPluginDescriptor.getVersion()).append("\n");
-        }
-      }
-    }
-
-    if (IdeaLogger.ourLastActionId != null) {
-      descBuilder.append("Last action: ").append(IdeaLogger.ourLastActionId);
-    }
-
-    if (previousExceptionThreadId != 0) {
-      descBuilder.append("Previous exception is: ").append(URL_HEADER).append(previousExceptionThreadId).append("\n");
-    }
-    if (wasException) {
-      descBuilder.append("There was at least one exception before this one.\n");
-    }
-    return descBuilder.toString();
-  }
 }
index 6101049d3264220e9dae8fedb6ae16debb5b4ed9..7cce2895fd859baf4e5d1d5fdcc1eae3deb5d79d 100644 (file)
@@ -24,15 +24,11 @@ import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.progress.ProgressManager;
 import com.intellij.openapi.progress.Task;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.updateSettings.impl.BuildInfo;
-import com.intellij.openapi.updateSettings.impl.CheckForUpdateResult;
-import com.intellij.openapi.updateSettings.impl.UpdateChecker;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.util.Consumer;
 import com.intellij.util.net.HttpConfigurable;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 
 /**
  * Created by IntelliJ IDEA.
@@ -47,13 +43,6 @@ public class ErrorReportSender {
   private ErrorReportSender() {
   }
 
-  @Nullable
-  public static String checkNewBuild() {
-    final CheckForUpdateResult result = UpdateChecker.checkForUpdates();
-    final BuildInfo newBuild = result.getNewBuildInSelectedChannel();
-    return (newBuild != null && newBuild.getNumber() != null ? newBuild.getNumber().asString() : null);
-  }
-
   static class SendTask {
     private final Project myProject;
     private String myLogin;
index ffd36e9d54e90bddd8c85f146aac43d7161ee72a..6af88334011dcae4b3fef87415bf6bad4e981609 100644 (file)
 package com.intellij.errorreport.bean;
 
 import com.intellij.diagnostic.errordialog.Attachment;
-import com.intellij.util.SystemProperties;
 import org.jetbrains.annotations.NonNls;
 
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
 import java.util.Collections;
-import java.util.Date;
 import java.util.List;
 
 /**
@@ -33,38 +31,49 @@ import java.util.List;
  * To change this template use Options | File Templates.
  */
 public class ErrorBean {
-  private Date date;
-  private String os;
   private String lastAction;
-  private String description;
-
+  private String pluginName;
+  private String pluginVersion;
+  private Integer previousException;
   private String message;
   private String stackTrace;
+  private String description;
 
-  private String exceptionClass = "";
   private List<Attachment> attachments = Collections.emptyList();
 
   public ErrorBean(Throwable throwable, String lastAction) {
     if (throwable != null) {
-      exceptionClass = throwable.getClass().getName();
-
       message = throwable.getMessage();
 
       ByteArrayOutputStream baos = new ByteArrayOutputStream();
       throwable.printStackTrace(new PrintStream(baos, true));
       stackTrace = baos.toString();
     }
-    os = SystemProperties.getOsName();
-    date = new Date();
     this.lastAction = lastAction;
   }
 
-  public Date getDate() {
-    return date;
+  public Integer getPreviousException() {
+    return previousException;
+  }
+
+  public void setPreviousException(Integer previousException) {
+    this.previousException = previousException;
+  }
+
+  public String getPluginName() {
+    return pluginName;
   }
 
-  public String getOs() {
-    return os;
+  public void setPluginName(String pluginName) {
+    this.pluginName = pluginName;
+  }
+
+  public String getPluginVersion() {
+    return pluginVersion;
+  }
+
+  public void setPluginVersion(String pluginVersion) {
+    this.pluginVersion = pluginVersion;
   }
 
   public String getLastAction() {
@@ -79,10 +88,6 @@ public class ErrorBean {
     this.description = description;
   }
 
-  public String getExceptionClass() {
-    return exceptionClass;
-  }
-
   public String getStackTrace() {
     return stackTrace;
   }
@@ -91,6 +96,10 @@ public class ErrorBean {
     return message;
   }
 
+  public void setMessage(String message) {
+    this.message = message;
+  }
+
   public void setAttachments(List<Attachment> attachments) {
     this.attachments = attachments;
   }
diff --git a/platform/platform-impl/src/com/intellij/errorreport/error/UpdateAvailableException.java b/platform/platform-impl/src/com/intellij/errorreport/error/UpdateAvailableException.java
new file mode 100644 (file)
index 0000000..ee9b40e
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2000-2011 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.errorreport.error;
+
+public class UpdateAvailableException extends Exception {
+    public UpdateAvailableException(String update) {
+        super(update);
+    }
+}
index 3fb251f94d7a463ee682c6a0b3b0d10430b96934..4de169090788dac1b2b3382b1a2a4b1e96c9405c 100644 (file)
@@ -20,8 +20,8 @@ import com.intellij.diagnostic.errordialog.Attachment;
 import com.intellij.errorreport.bean.ErrorBean;
 import com.intellij.errorreport.error.InternalEAPException;
 import com.intellij.errorreport.error.NoSuchEAPUserException;
+import com.intellij.errorreport.error.UpdateAvailableException;
 import com.intellij.openapi.application.ApplicationInfo;
-import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.ApplicationNamesInfo;
 import com.intellij.openapi.application.ex.ApplicationInfoEx;
 import com.intellij.openapi.util.Pair;
@@ -29,15 +29,13 @@ import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.util.SystemProperties;
 import org.jetbrains.annotations.NonNls;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
 import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLEncoder;
-import java.text.MessageFormat;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.List;
 
 /**
@@ -48,163 +46,164 @@ import java.util.List;
  * To change this template use Options | File Templates.
  */
 public class ITNProxy {
-  @NonNls public static final String ENCODE = "UTF8";
-  public static final String POST_DELIMETER = "&";
+  @NonNls public static final String ENCODING = "UTF8";
+  public static final String POST_DELIMITER = "&";
 
   @NonNls public static final String NEW_THREAD_URL = "http://www.intellij.net/trackerRpc/idea/createScr";
 
-  public static final String THREAD_SUBJECT = "[{0}]";
   @NonNls private static final String HTTP_CONTENT_LENGTH = "Content-Length";
   @NonNls private static final String HTTP_CONTENT_TYPE = "Content-Type";
   @NonNls private static final String HTTP_WWW_FORM = "application/x-www-form-urlencoded";
   @NonNls private static final String HTTP_POST = "POST";
 
-  private static HttpURLConnection post (String url, List<Pair<String,String>> params) throws IOException {
-    HttpURLConnection connection = (HttpURLConnection) new URL (url).openConnection();
-    connection.setReadTimeout(10 * 1000);
-    connection.setConnectTimeout(10 * 1000);
-    connection.setRequestMethod(HTTP_POST);
-    connection.setDoInput(true);
-    connection.setDoOutput(true);
-    connection.setRequestProperty(HTTP_CONTENT_TYPE, HTTP_WWW_FORM);
+  public static int postNewThread (String login, String password, ErrorBean error, String compilationTimestamp)
+    throws IOException, NoSuchEAPUserException, InternalEAPException, UpdateAvailableException {
 
-    StringBuilder buffer = new StringBuilder();
-    for (Pair<String, String> param : params) {
-      if (StringUtil.isNotEmpty(param.first) && StringUtil.isNotEmpty(param.second))
-        buffer.append(param.first + "=" + URLEncoder.encode(param.second, ENCODE) + POST_DELIMETER);
-      else
-        throw new IllegalArgumentException(param.toString());
+    @NonNls List<Pair<String, String>> params = createParametersFor(login,
+                                                                    password,
+                                                                    error,
+                                                                    compilationTimestamp,
+                                                                    (ApplicationInfoEx) ApplicationInfo.getInstance(),
+                                                                    ApplicationNamesInfo.getInstance());
+
+    HttpURLConnection connection = post(new URL(NEW_THREAD_URL), join(params));
+    int responseCode = connection.getResponseCode();
+
+    if (responseCode != HttpURLConnection.HTTP_OK) {
+      throw new InternalEAPException(DiagnosticBundle.message("error.http.result.code", responseCode));
+    }
+
+    String reply;
+
+    InputStream is = new BufferedInputStream(connection.getInputStream());
+    try {
+      reply = readFrom(is);
+    } finally {
+      is.close();
+    }
+
+    if ("unauthorized".equals(reply)) {
+      throw new NoSuchEAPUserException(login);
+    }
+
+    if (reply.startsWith("update ")) {
+      throw new UpdateAvailableException(reply.substring(7));
+    }
+
+    if (reply.startsWith("message ")) {
+      throw new InternalEAPException(reply.substring(8));
+    }
+
+    try {
+      return Integer.valueOf(reply.trim()).intValue();
+    } catch (NumberFormatException ex) {
+      // Tibor!!!! :-E
+      throw new InternalEAPException(DiagnosticBundle.message("error.itn.returns.wrong.data"));
     }
-    connection.setRequestProperty(HTTP_CONTENT_LENGTH, Integer.toString(buffer.length()));
-    connection.getOutputStream().write(buffer.toString().getBytes());
-    return connection;
   }
 
-  @SuppressWarnings({"HardCodedStringLiteral"}) public static final String SUN = "Sun";
-  public static final String JDK_1_2_2 = "1.2.2";
-  public static final String JDK_1_3_0 = "1.3.0";
-  public static final String JDK_1_3_1 = "1.3.1";
-  public static final String JDK_1_3_1_01 = "1.3.1_01";
-  public static final String JDK_1_4_0 = "1.4.0";
-  public static final String JDK_1_4_0_01 = "1.4.0_01";
-  public static final String JDK_1_4_0_02 = "1.4.0_02";
-  public static final String JDK_1_4_1 = "1.4.1";
-  public static final String JDK_1_4_2 = "1.4.2";
-
-  @NonNls public static final String WINDOWS_XP = "Windows XP";
-  @NonNls public static final String WINDOWS_2000 = "Windows 2000";
-  @NonNls public static final String WINDOWS_NT = "Windows NT";
-  @NonNls public static final String WINDOWS_95 = "Windows 95";
-  @NonNls public static final String WINDOWS_98 = "Windows 98";
-  @NonNls public static final String WINDOWS_ME = "Windows Me";
-  @NonNls public static final String SOLARIS = "Solaris";
-  @NonNls public static final String MAC_OS_X = "Mac Os X";
-  @NonNls public static final String LINUX = "Linux";
-
-  public static int postNewThread (String userName, String password, ErrorBean error,
-                                   String compilationTimestamp)
-          throws IOException, NoSuchEAPUserException, InternalEAPException {
+  private static List<Pair<String, String>> createParametersFor(String login,
+                                                                String password,
+                                                                ErrorBean error,
+                                                                String compilationTimestamp,
+                                                                ApplicationInfoEx appInfo,
+                                                                ApplicationNamesInfo namesInfo) {
     @NonNls List<Pair<String,String>> params = new ArrayList<Pair<String, String>>();
-    params.add(Pair.create("username", userName));
-    params.add(Pair.create("pwd", password));
-    params.add(Pair.create("_title", MessageFormat.format(THREAD_SUBJECT,
-                                              error.getLastAction() == null ? error.getExceptionClass() :
-                                              error.getLastAction() + ", " + error.getExceptionClass())));
-    ApplicationInfoEx appInfo =
-      (ApplicationInfoEx) ApplicationManager.getApplication().getComponent(
-        ApplicationInfo.class);
-
-    params.add(Pair.create("_build", appInfo.getBuild().asString()));
-    params.add(Pair.create("_description",
-               (compilationTimestamp != null ? ("Build time: " + compilationTimestamp + "\n") : "") +
-               error.getDescription() + "\n\n" + error.getStackTrace()));
-
-    String jdkVersion = SystemProperties.getJavaVersion();
-    String jdkVendor = SystemProperties.getJavaVmVendor();
-
-    if (jdkVendor.contains(SUN)) {
-      if (jdkVersion.equals(JDK_1_4_2))
-        jdkVersion = "10";
-      else if (jdkVersion.equals(JDK_1_4_1))
-        jdkVersion = "7";
-      else if (jdkVersion.equals(JDK_1_4_0_02))
-        jdkVersion = "9";
-      else if (jdkVersion.equals(JDK_1_4_0_01))
-        jdkVersion = "8";
-      else if (jdkVersion.equals(JDK_1_4_0))
-        jdkVersion = "6";
-      else if (jdkVersion.equals(JDK_1_3_1_01))
-        jdkVersion = "5";
-      else if (jdkVersion.equals(JDK_1_3_1))
-        jdkVersion = "4";
-      else if (jdkVersion.equals(JDK_1_3_0))
-        jdkVersion = "3";
-      else if (jdkVersion.equals(JDK_1_2_2))
-        jdkVersion = "2";
-      else
-        jdkVersion = "1";
-    } else
-      jdkVersion = "1";
-
-    params.add(Pair.create("_jdk", jdkVersion));
-
-    String os = error.getOs();
-    if (os == null)
-      os = "";
-
-    if (os.contains(WINDOWS_XP))
-      os = "4";
-    else if (os.contains(WINDOWS_2000) || os.contains(WINDOWS_NT))
-      os = "3";
-    else if (os.contains(WINDOWS_95) || os.contains(WINDOWS_98) || os.contains(WINDOWS_ME))
-      os = "2";
-    else if (os.contains(SOLARIS))
-      os = "7";
-    else if (os.contains(MAC_OS_X))
-      os = "6";
-    else if (os.contains(LINUX))
-      os = "5";
-    else
-      os = "1";
-    params.add(Pair.create("_os", os));
-
-    params.add(Pair.create("_product", ApplicationNamesInfo.getInstance().getProductName()));
+
+    params.add(Pair.create("protocol.version", "1"));
+
+    params.add(Pair.create("user.login", login));
+    params.add(Pair.create("user.password", password));
+
+    params.add(Pair.create("os.name", SystemProperties.getOsName()));
+
+    params.add(Pair.create("java.version", SystemProperties.getJavaVersion()));
+    params.add(Pair.create("java.vm.vendor", SystemProperties.getJavaVmVendor()));
+
+    params.add(Pair.create("app.name", namesInfo.getProductName()));
+    params.add(Pair.create("app.name.full", namesInfo.getFullProductName()));
+    params.add(Pair.create("app.name.version", appInfo.getVersionName()));
+    params.add(Pair.create("app.eap", Boolean.toString(appInfo.isEAP())));
+    params.add(Pair.create("app.build", appInfo.getBuild().asString()));
+    params.add(Pair.create("app.version.major", appInfo.getMajorVersion()));
+    params.add(Pair.create("app.version.minor", appInfo.getMinorVersion()));
+    params.add(Pair.create("app.build.date", format(appInfo.getBuildDate())));
+    params.add(Pair.create("app.build.date.release.", format(appInfo.getMajorReleaseBuildDate())));
+    params.add(Pair.create("app.update.channel", appInfo.getDefaultUpdateChannel()));
+    params.add(Pair.create("app.compilation.timestamp", compilationTimestamp));
+
+    params.add(Pair.create("plugin.name", error.getPluginName()));
+    params.add(Pair.create("plugin.version", error.getPluginVersion()));
+
+    params.add(Pair.create("last.action", error.getLastAction()));
+    params.add(Pair.create("previous.exception",
+                           error.getPreviousException() == null ? null : Integer.toString(error.getPreviousException())));
+
+    params.add(Pair.create("error.message", error.getMessage()));
+    params.add(Pair.create("error.stacktrace", error.getStackTrace()));
+
+    params.add(Pair.create("error.description", error.getDescription()));
 
     for (Attachment attachment : error.getAttachments()) {
-      params.add(Pair.create("_attachment_name", attachment.getName()));
-      params.add(Pair.create("_attachment_value", attachment.getEncodedBytes()));
-    }
-    
-    HttpURLConnection connection = post(NEW_THREAD_URL, params);
-    int response = connection.getResponseCode();
-    switch (response) {
-      case HttpURLConnection.HTTP_OK:
-        break;
-      case HttpURLConnection.HTTP_BAD_REQUEST:
-      case HttpURLConnection.HTTP_NOT_FOUND:
-        // user not found
-        throw new NoSuchEAPUserException(userName);
-      default:
-        // some problems
-        throw new InternalEAPException(DiagnosticBundle.message("error.http.result.code", response));
+      params.add(Pair.create("attachment.name", attachment.getName()));
+      params.add(Pair.create("attachment.value", attachment.getEncodedBytes()));
     }
 
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    InputStream is = connection.getInputStream();
+    return params;
+  }
 
+  private static String readFrom(InputStream is) throws IOException {
+    ByteArrayOutputStream out = new ByteArrayOutputStream();
     int c;
     while ((c = is.read()) != -1) {
-      baos.write (c);
+      out.write(c);
+    }
+    String s = out.toString();
+    out.close();
+    return s;
+  }
+
+  private static String format(Calendar calendar) {
+    if (calendar == null) {
+      return null;
+    } else {
+      return new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime());
     }
-    int threadId;
+  }
+
+  private static HttpURLConnection post(URL url, byte[] bytes) throws IOException {
+    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
 
+    connection.setReadTimeout(10 * 1000);
+    connection.setConnectTimeout(10 * 1000);
+    connection.setRequestMethod(HTTP_POST);
+    connection.setDoInput(true);
+    connection.setDoOutput(true);
+    connection.setRequestProperty(HTTP_CONTENT_TYPE, String.format("%s; charset=%s", HTTP_WWW_FORM, ENCODING));
+    connection.setRequestProperty(HTTP_CONTENT_LENGTH, Integer.toString(bytes.length));
+
+    OutputStream out = new BufferedOutputStream(connection.getOutputStream());
     try {
-      threadId = Integer.valueOf(baos.toString().trim()).intValue();
-    } catch (NumberFormatException ex) {
-      // Tibor!!!! :-E
-      throw new InternalEAPException(DiagnosticBundle.message("error.itn.returns.wrong.data"));
+      out.write(bytes);
+      out.flush();
+    } finally {
+      out.close();
+    }
+
+    return connection;
+  }
+
+  private static byte[] join(List<Pair<String, String>> params) throws UnsupportedEncodingException {
+    StringBuilder buffer = new StringBuilder();
+
+    for (Pair<String, String> param : params) {
+      if (StringUtil.isEmpty(param.first))
+        throw new IllegalArgumentException(param.toString());
+
+      if (StringUtil.isNotEmpty(param.second))
+        buffer.append(param.first + "=" + URLEncoder.encode(param.second, ENCODING) + POST_DELIMITER);
     }
 
-    return threadId;
+    return buffer.toString().getBytes();
   }
 }
index 2c48e5efd07714d2998667efe61490226aadea81..244018c8f188f5801c887cf84a97db50f94d1edb 100644 (file)
@@ -20,7 +20,6 @@ import com.intellij.execution.ExecutionException;
 import com.intellij.execution.configurations.GeneralCommandLine;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.Condition;
-import com.intellij.openapi.util.Conditions;
 import com.intellij.openapi.util.Key;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.encoding.EncodingManager;
@@ -28,6 +27,8 @@ import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import java.util.Map;
+
 /**
  * @author Elena Shaverdova
  * @author Nikolay Matveev
@@ -43,15 +44,6 @@ public final class ScriptRunnerUtil {
     }
   };
 
-  public static final Condition<Key> STDERR_OUTPUT_KEY_FILTER = new Condition<Key>() {
-    @Override
-    public boolean value(Key key) {
-      return ProcessOutputTypes.STDERR.equals(key);
-    }
-  };
-
-  public static final Condition<Key> STDOUT_OR_STDERR_OUTPUT_KEY_FILTER = Conditions.or(STDOUT_OUTPUT_KEY_FILTER, STDERR_OUTPUT_KEY_FILTER);
-
   private static final int DEFAULT_TIMEOUT = 30000;
 
   private ScriptRunnerUtil() {
@@ -101,10 +93,14 @@ public final class ScriptRunnerUtil {
   public static OSProcessHandler execute(@NotNull String exePath,
                                          @Nullable String workingDirectory,
                                          @Nullable VirtualFile scriptFile,
-                                         String[] parameters) throws ExecutionException {
+                                         String[] parameters,
+                                         @Nullable Map<String, String> environmentParams) throws ExecutionException {
     GeneralCommandLine commandLine = new GeneralCommandLine();
     commandLine.setExePath(exePath);
     commandLine.setPassParentEnvs(true);
+    if (environmentParams != null) {
+      commandLine.setEnvParams(environmentParams);
+    }
     if (scriptFile != null) {
       commandLine.addParameter(scriptFile.getPresentableUrl());
     }
@@ -139,7 +135,7 @@ public final class ScriptRunnerUtil {
                                                                   ScriptOutputType scriptOutputType,
                                                                   @NonNls String... parameters)
     throws ExecutionException {
-    final OSProcessHandler processHandler = execute(exePathString, workingDirectory, scriptFile, parameters);
+    final OSProcessHandler processHandler = execute(exePathString, workingDirectory, scriptFile, parameters, null);
 
     final StringBuilder standardOutput = scriptOutputType.readStandardOutput() ? new StringBuilder() : null;
     final StringBuilder errorOutput = scriptOutputType.readErrorOutput() ? new StringBuilder() : null;
index 71ad68a17da04eac824ec05a49f2ff34714c5419..982be86001e91638ebacc6a53e08c341f3015088 100644 (file)
  */
 package com.intellij.ide.actions;
 
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.Presentation;
+import com.intellij.ide.DataManager;
+import com.intellij.openapi.actionSystem.*;
 import com.intellij.openapi.project.DumbAware;
+import com.intellij.openapi.wm.ToolWindow;
 import com.intellij.ui.content.Content;
 import com.intellij.ui.content.ContentManager;
 import com.intellij.ui.content.ContentManagerUtil;
@@ -26,10 +26,20 @@ import com.intellij.ui.content.ContentManagerUtil;
 public class CloseActiveTabAction extends AnAction implements DumbAware {
   public void actionPerformed(AnActionEvent e) {
     ContentManager contentManager = ContentManagerUtil.getContentManagerFromContext(e.getDataContext(), true);
+    boolean processed = false;
     if (contentManager != null && contentManager.canCloseContents()) {
       final Content selectedContent = contentManager.getSelectedContent();
       if (selectedContent != null && selectedContent.isCloseable()) {
         contentManager.removeContent(selectedContent, true);
+        processed = true;
+      }
+    }
+
+    if (!processed && contentManager != null) {
+      final DataContext context = DataManager.getInstance().getDataContext(contentManager.getComponent());
+      final ToolWindow tw = PlatformDataKeys.TOOL_WINDOW.getData(context);
+      if (tw != null) {
+        tw.hide(null);
       }
     }
   }
@@ -38,5 +48,10 @@ public class CloseActiveTabAction extends AnAction implements DumbAware {
     Presentation presentation = event.getPresentation();
     ContentManager contentManager=ContentManagerUtil.getContentManagerFromContext(event.getDataContext(), true);
     presentation.setEnabled(contentManager != null && contentManager.canCloseContents());
+
+    if (!presentation.isEnabled() && contentManager != null) {
+      final DataContext context = DataManager.getInstance().getDataContext(contentManager.getComponent());
+      presentation.setEnabled(PlatformDataKeys.TOOL_WINDOW.getData(context) != null);
+    }
   }
 }
\ No newline at end of file
index 623fa1b7ee460d063a46c9acfe1e278fd7144337..18cff022300db17c1bd3f9d2d602d4df69ef5d22 100644 (file)
@@ -124,36 +124,4 @@ class AvailablePluginColumnInfo extends PluginManagerColumnInfo {
     }
   }
 
-  //waiting for rates available in IDEA
-  private static class RatesPanel extends JPanel {
-    public static int MAX_RATE = 5;
-    private static final Icon STAR_ICON = IconLoader.getIcon("/general/toolWindowFavorites.png");
-
-    private JLabel[] myLabels = new JLabel[MAX_RATE];
-
-    private RatesPanel() {
-      super(new GridBagLayout());
-      GridBagConstraints gc =
-        new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
-                               new Insets(0, 0, 0, 0), 0, 0);
-      for (int i = 0, myLabelsLength = myLabels.length; i < myLabelsLength; i++) {
-        myLabels[i] = new JLabel();
-        add(myLabels[i], gc);
-      }
-      gc.weightx = 1;
-      gc.fill = GridBagConstraints.HORIZONTAL;
-      add(Box.createHorizontalBox(), gc);
-      setOpaque(false);
-    }
-
-    public void setRate(int rate) {
-      for (int i = 0; i < rate; i++) {
-        myLabels[i].setIcon(STAR_ICON);
-      }
-
-      for (int i = rate; i < MAX_RATE; i++) {
-        myLabels[i].setIcon(IconLoader.getDisabledIcon(STAR_ICON));
-      }
-    }
-  }
 }
index 03ea99607c78e6f32d2c796514cbbc9d5325b2d4..d297c0806f17396aae862dc6e882cf6094ff1e64 100644 (file)
@@ -83,6 +83,7 @@ public class AvailablePluginsManagerMain extends PluginManagerMain {
     pluginTable.getTableHeader().setReorderingAllowed(false);
     pluginTable.setColumnWidth(PluginManagerColumnInfo.COLUMN_DOWNLOADS, 60);
     pluginTable.setColumnWidth(PluginManagerColumnInfo.COLUMN_DATE, 60);
+    pluginTable.setColumnWidth(PluginManagerColumnInfo.COLUMN_RATE, 70);
 
     return ScrollPaneFactory.createScrollPane(pluginTable);
   }
index 89fbbb5e1d286d55df684b40f167ab134b07b6e5..8ed75d7faf2fee7513b0121c2f34585e09be2054 100644 (file)
@@ -51,6 +51,7 @@ public class AvailablePluginsTableModel extends PluginTableModel {
     super.columns = new ColumnInfo[] {
       new AvailablePluginColumnInfo(this),
       new PluginManagerColumnInfo(PluginManagerColumnInfo.COLUMN_DOWNLOADS, this),
+      new PluginManagerColumnInfo(PluginManagerColumnInfo.COLUMN_RATE, this),
       new PluginManagerColumnInfo(PluginManagerColumnInfo.COLUMN_DATE, this)/*,
       new PluginManagerColumnInfo(PluginManagerColumnInfo.COLUMN_CATEGORY, this)*/};
 
index 346d8a6450fdfa8ee6f7fe893a6d4df9e957ec41..f0d792f1c0b9e53f61cf63377500d252899d6474 100644 (file)
@@ -17,6 +17,8 @@ package com.intellij.ide.plugins;
 
 import com.intellij.ide.IdeBundle;
 import com.intellij.openapi.extensions.PluginId;
+import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.IconLoader;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.ui.LightColors;
 import com.intellij.util.text.DateFormatUtil;
@@ -40,12 +42,9 @@ import java.util.Comparator;
 class PluginManagerColumnInfo extends ColumnInfo<IdeaPluginDescriptor, String> {
   public static final int COLUMN_NAME = 0;
   public static final int COLUMN_DOWNLOADS = 1;
-  public static final int COLUMN_DATE = 2;
-  public static final int COLUMN_CATEGORY = 3;
-  public static final int COLUMN_INSTALLED_VERSION = 4;
-  public static final int COLUMN_SIZE = 5;
-  public static final int COLUMN_VERSION = 6;
-  public static final int COLUMN_STATE = 7;
+  public static final int COLUMN_RATE = 2;
+  public static final int COLUMN_DATE = 3;
+  public static final int COLUMN_CATEGORY = 4;
   private static final float mgByte = 1024.0f * 1024.0f;
   private static final float kByte = 1024.0f;
 
@@ -53,6 +52,7 @@ class PluginManagerColumnInfo extends ColumnInfo<IdeaPluginDescriptor, String> {
   public static final String[] COLUMNS = {
     IdeBundle.message("column.plugins.name"),
     IdeBundle.message("column.plugins.downloads"),
+    IdeBundle.message("column.plugins.rate"),
     IdeBundle.message("column.plugins.date"),
     IdeBundle.message("column.plugins.category")
   };
@@ -87,6 +87,9 @@ class PluginManagerColumnInfo extends ColumnInfo<IdeaPluginDescriptor, String> {
     else if (columnIdx == COLUMN_CATEGORY) {
       return base.getCategory();
     }
+    else if (columnIdx == COLUMN_RATE) {
+      return ((PluginNode)base).getRating();
+    }
     else
     // For COLUMN_STATUS - set of icons show the actual state of installed plugins.
     {
@@ -170,6 +173,16 @@ class PluginManagerColumnInfo extends ColumnInfo<IdeaPluginDescriptor, String> {
         }
       };
     }
+    if (columnIdx == COLUMN_RATE) {
+      return new Comparator<IdeaPluginDescriptor>() {
+        @Override
+        public int compare(IdeaPluginDescriptor o1, IdeaPluginDescriptor o2) {
+          final String rating1 = ((PluginNode)o1).getRating();
+          final String rating2 = ((PluginNode)o2).getRating();
+          return Comparing.compare(rating1, rating2);
+        }
+      };
+    }
     if (isSortByDownloads()) {
       return new Comparator<IdeaPluginDescriptor>() {
         public int compare(IdeaPluginDescriptor o1, IdeaPluginDescriptor o2) {
@@ -243,6 +256,20 @@ class PluginManagerColumnInfo extends ColumnInfo<IdeaPluginDescriptor, String> {
   }
 
   public TableCellRenderer getRenderer(IdeaPluginDescriptor o) {
+    if (columnIdx == COLUMN_RATE) {
+      return new DefaultTableCellRenderer(){
+        private RatesPanel myPanel = new RatesPanel();
+        @Override
+        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+          final Component orig = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+          myPanel.setBackground(orig.getBackground());
+          if (value != null) {
+            myPanel.setRate((String)value);
+          }
+          return myPanel;
+        }
+      };
+    }
     return new PluginTableCellRenderer((PluginNode)o);
   }
 
@@ -289,4 +316,48 @@ class PluginManagerColumnInfo extends ColumnInfo<IdeaPluginDescriptor, String> {
       return myLabel;
     }
   }
+
+  //waiting for rates available in IDEA
+  private static class RatesPanel extends JPanel {
+    public static int MAX_RATE = 5;
+
+    private static final Icon STAR = IconLoader.getIcon("/ide/rating.png");
+
+    private static final Icon STAR3 = IconLoader.getIcon("/ide/rating1.png");
+    private static final Icon STAR4 = IconLoader.getIcon("/ide/rating2.png");
+    private static final Icon STAR5 = IconLoader.getIcon("/ide/rating3.png");
+    private static final Icon STAR6 = IconLoader.getIcon("/ide/rating4.png");
+    private static final Icon[] STARs = new Icon[]{IconLoader.getDisabledIcon(STAR), STAR3, STAR3, STAR4, STAR4, STAR5, STAR5, STAR6, STAR6, STAR};
+
+    private JLabel[] myLabels = new JLabel[MAX_RATE];
+
+    private RatesPanel() {
+      super(new GridBagLayout());
+      GridBagConstraints gc =
+        new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
+                               new Insets(0, 0, 0, 0), 0, 0);
+      for (int i = 0, myLabelsLength = myLabels.length; i < myLabelsLength; i++) {
+        myLabels[i] = new JLabel();
+        myLabels[i].setOpaque(false);
+        add(myLabels[i], gc);
+      }
+    }
+
+    public void setRate(String rating) {
+      final Double dblRating = Double.valueOf(rating);
+
+      final int intRating = dblRating.intValue();
+
+      for (int i = 0; i < intRating; i++) {
+        myLabels[i].setIcon(STAR);
+      }
+
+      if (intRating < MAX_RATE) {
+        myLabels[intRating].setIcon(STARs[((Double)(dblRating * 10)).intValue() % 10]);
+        for (int i = 1 + intRating; i < MAX_RATE; i++) {
+          myLabels[i].setIcon(IconLoader.getDisabledIcon(STAR));
+        }
+      }
+    }
+  }
 }
index 2d8d5f978a3c4698729d5a5eaa8c993a69e93918..9d6cc2cdd24c37e13379dec1ff302adde7e6e460 100644 (file)
@@ -120,7 +120,7 @@ public abstract class PluginManagerMain implements Disposable {
     myToolbarPanel.setLayout(new BorderLayout());
     myActionToolbar = ActionManager.getInstance().createActionToolbar("PluginManaer", getActionGroup(true), true);
     final JComponent component = myActionToolbar.getComponent();
-    component.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
+    component.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
     JPanel panel = new JPanel(new BorderLayout()) {
       @Override
       public Dimension getMinimumSize() {
index bc95b54c0ea12304582f1521db54cbe19cd1e73b..1f7af463acd958e6257d20f8322c70e9f54e8385 100644 (file)
@@ -67,6 +67,7 @@ public class PluginNode implements IdeaPluginDescriptor {
   private String myInstalledVersion;
 
   private boolean myEnabled = true;
+  private String myRating;
 
   public PluginNode() {
   }
@@ -368,4 +369,12 @@ public class PluginNode implements IdeaPluginDescriptor {
   public String getInstalledVersion() {
     return myInstalledVersion;
   }
+
+  public void setRating(String rating) {
+    myRating = rating;
+  }
+
+  public String getRating() {
+    return myRating;
+  }
 }
index af06f44fab42e57c6eb440061df840dc8186451d..4c556dbcb32189b6576775d35002e8a71bf994d3 100644 (file)
@@ -48,6 +48,7 @@ class RepositoryContentHandler extends DefaultHandler {
   @NonNls private static final String DEPENDS = "depends";
   @NonNls private static final String DOWNLOADS = "downloads";
   @NonNls private static final String SIZE = "size";
+  @NonNls private static final String RATING = "rating";
 
   @NonNls private static final String DATE = "date";
   private PluginNode currentPlugin;
@@ -112,6 +113,9 @@ class RepositoryContentHandler extends DefaultHandler {
     else if (qName.equals(CATEGORY)) {
       categoriesStack.pop();
     }
+    else if (qName.equals(RATING)) {
+      currentPlugin.setRating(currentValue);
+    }
     currentValue = "";
   }
 
index 568ca18524a9a86da5eacaeac6ffe9eda4613181..b70604b82c65eba1f77a76bbe50dd5651718df0b 100644 (file)
@@ -24,6 +24,7 @@ import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.wm.StatusBar;
 import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.ui.UIUtil;
 import gnu.trove.THashMap;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -34,7 +35,8 @@ import java.util.*;
  * @author peter
  */
 public class LogModel implements Disposable {
-  private final Map<Notification, Long> myNotifications = new LinkedHashMap<Notification, Long>();
+  private final List<Notification> myNotifications = new ArrayList<Notification>();
+  private final Map<Notification, Long> myStamps = Collections.synchronizedMap(new WeakHashMap<Notification, Long>());
   private Notification myStatusMessage;
   private long myStatusTime;
   private final Project myProject;
@@ -50,9 +52,10 @@ public class LogModel implements Disposable {
     NotificationDisplayType type = NotificationsConfigurationImpl.getSettings(notification.getGroupId()).getDisplayType();
     if (notification.isImportant() || (type != NotificationDisplayType.NONE && type != NotificationDisplayType.TOOL_WINDOW)) {
       synchronized (myNotifications) {
-        myNotifications.put(notification, stamp);
+        myNotifications.add(notification);
       }
     }
+    myStamps.put(notification, stamp);
     setStatusMessage(notification, stamp);
   }
 
@@ -92,15 +95,13 @@ public class LogModel implements Disposable {
 
   public ArrayList<Notification> getNotifications() {
     synchronized (myNotifications) {
-      return new ArrayList<Notification>(myNotifications.keySet());
+      return new ArrayList<Notification>(myNotifications);
     }
   }
 
   @Nullable
   public Long getNotificationTime(Notification notification) {
-    synchronized (myNotifications) {
-      return myNotifications.get(notification);
-    }
+    return myStamps.get(notification);
   }
 
   void removeNotification(Notification notification) {
@@ -111,7 +112,7 @@ public class LogModel implements Disposable {
 
     Runnable handler = removeHandlers.remove(notification);
     if (handler != null) {
-      handler.run();
+      UIUtil.invokeLaterIfNeeded(handler);
     }
 
     Pair<Notification, Long> oldStatus = getStatusMessage();
index b48931d63539a476eff23fd1c7d69efae3cc7a76..7f571ad812b29d844cef15e83efdba6cee926d6d 100644 (file)
@@ -449,8 +449,8 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
       }
 
       for (final Rectangle r : bounds) {
-        if (r.height < maxHeight && r.y == 0) {
-          r.y = (maxHeight - r.height) / 2;
+        if (r.height < maxHeight) {
+          r.y = r.y + (maxHeight - r.height) / 2;
         }
       }
 
index 100a8996ab851066556b485a89341f5ddaadb8b3..33319507d86151b73e93481ae8e16355b16009dc 100644 (file)
@@ -130,11 +130,9 @@ public class Utils{
       if (child instanceof ActionGroup) {
         ActionGroup actionGroup = (ActionGroup)child;
         if (actionGroup.isPopup()) { // popup menu has its own presentation
-          if (presentation.isEnabled()) {
-            // disable group if it contains no visible actions
-            final boolean enabled = actionGroup.canBePerformed(context) || hasVisibleChildren(actionGroup, presentationFactory, context, place);
-            presentation.setEnabled(enabled);
-          }
+          // disable group if it contains no visible actions
+          final boolean enabled = actionGroup.canBePerformed(context) || hasVisibleChildren(actionGroup, presentationFactory, context, place);
+          presentation.setEnabled(enabled);
           list.add(child);
         }
         else {
index 1ba08ac89fa0f18b49376912d38eeebbd8a374d4..f54296693ac4514ca94363fed3b0407df3968ae9 100644 (file)
@@ -57,7 +57,7 @@ public class CommandMerger {
     return myCommandName;
   }
 
-  public void addAction(UndoableAction action) {
+  public void addAction(@NotNull UndoableAction action) {
     myCurrentActions.add(action);
     DocumentReference[] refs = action.getAffectedDocuments();
     if (refs != null) {
index d4ade9e25f0896c4a0c9406e868dcb3528c7d3a5..572eacd9dfdd1a628a1620c778dbe0137e5fec03 100644 (file)
@@ -457,13 +457,14 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid
     setTitle1(data.getContentTitles()[0]);
     setTitle2(data.getContentTitles()[1]);
     setWindowTitle(myOwnerWindow, data.getWindowTitle());
-    if (isBinaryOrUIEditors(data)) {
-      myPanel.removeStatusBar();
-      myPanel.disableToolbar(true);
-    } else {
-      data.customizeToolbar(myPanel.resetToolbar());
-      myPanel.registerToolbarActions();
-    }
+    //if (isBinaryOrUIEditors(data)) {
+    //  myPanel.removeStatusBar();
+    //  //myPanel.disableToolbar(true);
+    //} else {
+    //  myPanel.addStatusBar();
+    //}
+    data.customizeToolbar(myPanel.resetToolbar());
+    myPanel.registerToolbarActions();
 
     final JComponent oldBottomComponent = myPanel.getBottomComponent();
     if (oldBottomComponent instanceof Disposable) {
@@ -475,7 +476,10 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid
 
     if (myIsRequestFocus) {
       if (isEditor1Focused || isEditor2Focused) {
-        fm.requestFocus(isEditor2Focused ? getEditor2().getContentComponent() : getEditor1().getContentComponent(), true);
+        Editor e = isEditor2Focused ? getEditor2() : getEditor1();
+        if (e != null) {
+          fm.requestFocus(e.getContentComponent(), true);
+        }
       }
 
       myPanel.requestScrollEditors();
index 10332a76965ba3c5349b9b2a1a6537d84c2aba39..c45084caa971f2071a7e5b7a993c1350b7a1f1a8 100644 (file)
@@ -76,6 +76,8 @@ public class BinaryDiffTool implements DiffTool {
               myPanel.setDiffRequest(data);
               myPanel.setTitle1(src.getPath());
               myPanel.setTitle2(trg.getPath());
+              myPanel.enableToolbar(false);
+              myPanel.removeStatusBar();
               return myPanel.getComponent();
             }
           }.show();
index d51e5f99ddc877450299bc891f4e6904b0f2f7ae..5fb199d9bfdba801b5eb76f15a6697c68415a8c2 100644 (file)
@@ -30,6 +30,7 @@ import com.intellij.openapi.fileTypes.FileTypes;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.project.ProjectUtil;
 import com.intellij.openapi.project.ex.ProjectManagerEx;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 
 import java.io.IOException;
@@ -129,7 +130,7 @@ public interface MergeVersion {
     private static void setDocumentText(final Document document, final String text, String name, Project project) {
       CommandProcessor.getInstance().executeCommand(project, new Runnable() {
         public void run() {
-          document.replaceString(0, document.getTextLength(), text);
+          document.replaceString(0, document.getTextLength(), StringUtil.convertLineSeparators(text));
         }
       }, name, null);
     }
index 09f51b6fd3bbc07d9aab3890ff43be13b06e8b5e..889c5f9e842862b71d43e0c6e3b293321bced820 100644 (file)
@@ -123,7 +123,9 @@ public class DiffPanelOutterComponent extends JPanel implements DataProvider {
   }
 
   public void removeStatusBar() {
-    myBottomContainer.remove(myStatusBar);
+    if (myStatusBar != null) {
+      myStatusBar.setVisible(false);
+    }
   }
 
   public Object getData(String dataId) {
@@ -192,6 +194,12 @@ public class DiffPanelOutterComponent extends JPanel implements DataProvider {
     myWrapper.remove(jComponent);
   }
 
+  public void addStatusBar() {
+    if (myStatusBar != null) {
+      myStatusBar.setVisible(true);
+    }
+  }
+
   private interface DeferScrollToFirstDiff {
     DeferScrollToFirstDiff scrollNow(ScrollingPanel panel, JComponent component);
 
index 23da2147527907f2906c2a5c8831bb7f07a83e2b..e9610b3edf8aeb7caa70ffad4eb0963ac9b20d0c 100644 (file)
@@ -209,8 +209,8 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
       public boolean process(RangeHighlighterEx highlighter) {
         if (highlighter.getErrorStripeMarkColor() != null) {
           ProperTextRange range = offsetsToYPositions(highlighter.getStartOffset(), highlighter.getEndOffset());
-          if (range.getStartOffset() >= y - getMinHeight() * 2 &&
-              range.getEndOffset() <= y + getMinHeight() * 2) {
+          if (y >= range.getStartOffset() - getMinHeight() * 2 &&
+              y <= range.getEndOffset() + getMinHeight() * 2) {
             nearest.add(highlighter);
           }
         }
index 99adecc7a448f1f16425c044942c3bed2fbeaaa0..54890f9870aa5ffde5e9880e369b0dc095c917bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2011 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -228,8 +228,8 @@ class CacheEntry implements Comparable<CacheEntry>, Cloneable {
 
   @Override
   public String toString() {
-    return "visual line: " + visualLine + ", offsets: " + startOffset + "-" + endOffset + ", fold regions: " 
-           + Arrays.toString(myFoldingData.getValues()) + ", tab data: " + myTabPositions;
+    return System.identityHashCode(this) + "=visual line: " + visualLine + ", offsets: " + startOffset + "-" + endOffset
+           + ", fold regions: " + Arrays.toString(myFoldingData.getValues()) + ", tab data: " + myTabPositions;
   }
 
   @Override
index 0ff1694b690650a305654611e4c06b9f9c2ccb27..5fd1d61f2769c3dada10968f9b7e6595f121aa27 100644 (file)
@@ -452,7 +452,8 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw
       CacheEntry beforeLast = myCache.get(myCache.size() - 2);
       CacheEntry last = myCache.get(myCache.size() - 1);
       if (beforeLast.visualLine == last.visualLine
-          || (beforeLast.visualLine + 1 == last.visualLine && last.startOffset - beforeLast.endOffset > 1))
+          || (beforeLast.visualLine + 1 == last.visualLine && last.startOffset - beforeLast.endOffset > 1)
+          || last.startOffset > myEditor.getDocument().getTextLength())
       {
         CharSequence editorState = "";
         if (myEditor instanceof EditorImpl) {
@@ -481,6 +482,13 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw
     myBeforeChangeState.cacheShouldBeUpdated = false;
   }
 
+  @Override
+  public void reset() {
+    myCache.clear();
+    myAffectedByUpdateCacheEntries.clear();
+    myNotAffectedByUpdateTailCacheEntries.clear();
+  }
+
   @SuppressWarnings({"UseOfSystemOutOrSystemErr", "UnusedDeclaration", "CallToPrintStackTrace"})
   private void dumpCache() {
     Document document = myEditor.getDocument();
@@ -541,7 +549,7 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw
 
     int softWrapIndex = myStorage.getSoftWrapIndex(offset);
     if (softWrapIndex >= 0) {
-      softWrapIndex++; // We want to process only soft wraps which offsets strictly more than the given one.
+      softWrapIndex++; // We want to process only soft wraps which offsets are strictly more than the given one.
     }
     else {
       softWrapIndex = -softWrapIndex - 1;
index d6056d23efc4f01f69bfd352f71448a7e15d8d6d..147f41506cd9302184a74edd7be23e669f5c3bb2 100644 (file)
@@ -118,6 +118,9 @@ public class SoftWrapApplianceManager implements SoftWrapFoldingListener, Docume
   public void reset() {
     myEventsStorage.release();
     myEventsStorage.add(myEditor.getDocument(), new IncrementalCacheUpdateEvent(myEditor.getDocument()));
+    for (SoftWrapAwareDocumentParsingListener listener : myListeners) {
+      listener.reset();
+    }
   }
   
   public void release() {
index 32bcf2c183bf8ceac4ae4ab997c8137e1beff133..c9f113db9ba2de15ba26177330ed78ce63a5f5bb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2011 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -120,4 +120,9 @@ interface SoftWrapAwareDocumentParsingListener {
    *                should be rolled back if this param value is <code>false</code>
    */
   void onRecalculationEnd(@NotNull IncrementalCacheUpdateEvent event, boolean normal);
+
+  /**
+   * Callback for asking to drop all cached information (if any).
+   */
+  void reset();
 }
index c5a12ff59922da8bc682438f324791a27cadaf47..78c6579f614040a1808cc3c12a688f4e8d54cd5f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2011 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -120,4 +120,8 @@ public class SoftWrapAwareVisualSizeManager implements SoftWrapAwareDocumentPars
   @Override
   public void revertToOffset(int offset, int visualLine) {
   }
+
+  @Override
+  public void reset() {
+  }
 }
index 12e1fe06d5511415e57bed727a1013bba97fed9a..f4e6adcabd457d1e8adaeff4f18c930848306caa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2011 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ class TabData implements Cloneable {
 
   @Override
   public String toString() {
-    return offset + ", width: " + widthInColumns;
+    return "[" + offset + ", width: " + widthInColumns + "]";
   }
 
   @Override
index ed047fe3b27575a5f401a010aa39ef22f7b77a8d..f4cc2045a3eaaf9d9ef78724046dc66267ba8cc6 100644 (file)
@@ -383,8 +383,8 @@ final class EditorTabbedContainer implements Disposable, CloseAction.CloseTarget
 
     @Override
     public void update(final AnActionEvent e) {
-      e.getPresentation().setIcon(myTabs instanceof JBEditorTabs && ((JBEditorTabs)myTabs).isNewTabsActive()? myNewIcon : myIcon);
-      e.getPresentation().setHoveredIcon(myTabs instanceof JBEditorTabs && ((JBEditorTabs)myTabs).isNewTabsActive()? myNewHoveredIcon : myHoveredIcon);
+      e.getPresentation().setIcon(myTabs.isEditorTabs() ? myNewIcon : myIcon);
+      e.getPresentation().setHoveredIcon(myTabs.isEditorTabs()? myNewHoveredIcon : myHoveredIcon);
       e.getPresentation().setVisible(UISettings.getInstance().SHOW_CLOSE_BUTTON);
     }
 
index 0e6fd1991280a209a2895b8a2984d524494837cf..eb081e413848b067cdddf6cc0d23cf0058543392 100644 (file)
@@ -621,6 +621,7 @@ public class EditorWindow {
       if (tabCount != 0) {
         final EditorWithProviderComposite firstEC = getEditorAt(0);
         myPanel = new JPanel(new BorderLayout());
+        myPanel.setOpaque(false);
         myPanel.setBorder(new AdaptiveBorder());
         myPanel.setOpaque(false);
         
index 44edbdbc54efea5ed551a9023c71669f62e37394..4ae17eaf49171f9a77547dd517a48c2ab5baa50c 100644 (file)
@@ -78,8 +78,7 @@ public class EditorsSplitters extends JPanel {
 
   public EditorsSplitters(final FileEditorManagerImpl manager, DockManager dockManager, boolean createOwnDockableContainer) {
     super(new BorderLayout());
-    setOpaque(true);
-    setBackground(UIUtil.isUnderAquaLookAndFeel() ? JBTabsImpl.MAC_AQUA_BG_COLOR : Color.GRAY);
+    setOpaque(false);
     myManager = manager;
     myFocusWatcher = new MyFocusWatcher();
     setFocusTraversalPolicy(new MyFocusTraversalPolicy());
@@ -304,6 +303,7 @@ public class EditorsSplitters extends JPanel {
       Splitter splitter;
       if (panel == null) {
         panel = new JPanel(new BorderLayout());
+        panel.setOpaque(false);
         splitter = new Splitter(orientation, proportion, 0.1f, 0.9f);
         panel.add(splitter, BorderLayout.CENTER);
         splitter.setFirstComponent(readExternalPanel(first, null));
index ff19a12435e679056d9ed78913d0bc13962cf4d4..8c9fca553818a826731a14e4ab85303f5c7db264 100644 (file)
@@ -64,6 +64,7 @@ import com.intellij.ui.tabs.impl.JBTabsImpl;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.messages.MessageBusConnection;
 import com.intellij.util.messages.impl.MessageListenerList;
+import com.intellij.util.ui.SameColor;
 import com.intellij.util.ui.UIUtil;
 import com.intellij.util.ui.update.MergingUpdateQueue;
 import com.intellij.util.ui.update.Update;
@@ -209,7 +210,17 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec
     if (myPanels == null) {
       synchronized (myInitLock) {
         if (myPanels == null) {
-          myPanels = new JPanel(new BorderLayout());
+          myPanels = new JPanel(new BorderLayout()) {
+            @Override
+            public Color getBackground() {
+              boolean navBar = UISettings.getInstance().SHOW_NAVIGATION_BAR;
+              if (navBar) {
+                return  UIUtil.getSlightlyDarkerColor(UIUtil.isUnderAquaLookAndFeel() ? new SameColor(200) : UIUtil.getPanelBackground());
+              } else {
+                return UIUtil.isUnderAquaLookAndFeel() ? new SameColor(189) : UIUtil.getPanelBackground();
+              }
+            }
+          };
           myPanels.setBorder(new MyBorder());
           mySplitters = new EditorsSplitters(this, myDockManager, true);
           myPanels.add(mySplitters, BorderLayout.CENTER);
index 72c6c278e81d22d300511ab09a9385e583c36b75..4f6b61e1747b3d7d0349c1fcbb7e35c3632f2178 100644 (file)
@@ -116,14 +116,17 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
         register(fileType, parse(fileType.getDefaultExtension()));
       }
 
+      @Override
       public void consume(@NotNull final FileType fileType, final String extensions) {
         register(fileType, parse(extensions));
       }
 
+      @Override
       public void consume(@NotNull final FileType fileType, final FileNameMatcher... matchers) {
         register(fileType, new ArrayList<FileNameMatcher>(Arrays.asList(matchers)));
       }
 
+      @Override
       public FileType getStandardFileTypeByName(@NotNull final String name) {
         final StandardFileType type = ourStandardFileTypes.get(name);
         return type != null ? type.fileType : null;
@@ -162,6 +165,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
   public FileTypeManagerImpl(MessageBus bus, SchemesManagerFactory schemesManagerFactory) {
     myMessageBus = bus;
     mySchemesManager = schemesManagerFactory.createSchemesManager(FILE_SPEC, new BaseSchemeProcessor<AbstractFileType>() {
+      @Override
       public AbstractFileType readScheme(final Document document) throws InvalidDataException {
         if (document == null) {
           throw new InvalidDataException();
@@ -189,11 +193,13 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
 
       }
 
+      @Override
       public boolean shouldBeSaved(final AbstractFileType fileType) {
         return shouldBeSavedToFile(fileType);
 
       }
 
+      @Override
       public Document writeScheme(final AbstractFileType fileType) throws WriteExternalException {
         Element root = new Element(ELEMENT_FILETYPE);
 
@@ -215,6 +221,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
 
       }
 
+      @Override
       public void onSchemeAdded(final AbstractFileType scheme) {
         fireBeforeFileTypesChanged();
         if (scheme instanceof ReadFileType) {
@@ -223,6 +230,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
         fireFileTypesChanged();
       }
 
+      @Override
       public void onSchemeDeleted(final AbstractFileType scheme) {
         fireBeforeFileTypesChanged();
         myPatternsTable.removeAllAssociations(scheme);
@@ -252,17 +260,20 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
     return true;
   }
 
+  @Override
   @NotNull
   public FileType getStdFileType(@NotNull @NonNls String name) {
     StandardFileType stdFileType = ourStandardFileTypes.get(name);
     return stdFileType != null ? stdFileType.fileType : PlainTextFileType.INSTANCE;
   }
 
+  @Override
   @NotNull
   public File[] getExportFiles() {
     return new File[]{getOrCreateFileTypesDir(), PathManager.getOptionsFile(this)};
   }
 
+  @Override
   @NotNull
   public String getPresentableName() {
     return FileTypesBundle.message("filetype.settings.component");
@@ -271,9 +282,11 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
   // ApplicationComponent interface implementation
   // -------------------------------------------------------------------------
 
+  @Override
   public void disposeComponent() {
   }
 
+  @Override
   public void initComponent() {
   }
 
@@ -281,6 +294,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
   // Implementation of abstract methods
   // -------------------------------------------------------------------------
 
+  @Override
   @NotNull
   public FileType getFileTypeByFileName(@NotNull String fileName) {
     FileType type = myPatternsTable.findAssociatedFileType(fileName);
@@ -291,6 +305,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
     file.putUserData(FILE_TYPE_KEY, fileType);
   }
 
+  @Override
   @NotNull
   public FileType getFileTypeByFile(@NotNull VirtualFile file) {
     FileType fileType = file.getUserData(FILE_TYPE_KEY);
@@ -404,6 +419,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
     return guess != null && guess != CharsetToolkit.GuessedEncoding.INVALID_UTF8;
   }
 
+  @Override
   public boolean isFileOfType(VirtualFile file, FileType type) {
     if (type instanceof FileTypeIdentifiableByVirtualFile) {
       return ((FileTypeIdentifiableByVirtualFile)type).isMyFileType(file);
@@ -412,17 +428,21 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
     return getFileTypeByFileName(file.getName()) == type;
   }
 
+  @Override
   @NotNull
   public FileType getFileTypeByExtension(@NotNull String extension) {
     return getFileTypeByFileName("IntelliJ_IDEA_RULES." + extension);
   }
 
+  @Override
   public void registerFileType(FileType fileType) {
     registerFileType(fileType, ArrayUtil.EMPTY_STRING_ARRAY);
   }
 
+  @Override
   public void registerFileType(@NotNull final FileType type, @NotNull final List<FileNameMatcher> defaultAssociations) {
     ApplicationManager.getApplication().runWriteAction(new Runnable() {
+      @Override
       public void run() {
         fireBeforeFileTypesChanged();
         registerFileTypeWithoutNotification(type, defaultAssociations);
@@ -432,10 +452,16 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
     });
   }
 
-  public void unregisterFileType(FileType fileType) {
-    fireBeforeFileTypesChanged();
-    unregisterFileTypeWithoutNotification(fileType);
-    fireFileTypesChanged();
+  @Override
+  public void unregisterFileType(final FileType fileType) {
+    ApplicationManager.getApplication().runWriteAction(new Runnable() {
+      @Override
+      public void run() {
+        fireBeforeFileTypesChanged();
+        unregisterFileTypeWithoutNotification(fileType);
+        fireFileTypesChanged();
+      }
+    });
   }
 
   private void unregisterFileTypeWithoutNotification(FileType fileType) {
@@ -447,12 +473,14 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
     }
   }
 
+  @Override
   @NotNull
   public FileType[] getRegisteredFileTypes() {
     Collection<FileType> fileTypes = mySchemesManager.getAllSchemes();
     return fileTypes.toArray(new FileType[fileTypes.size()]);
   }
 
+  @Override
   @NotNull
   public String getExtension(String fileName) {
     int index = fileName.lastIndexOf('.');
@@ -460,6 +488,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
     return fileName.substring(index + 1);
   }
 
+  @Override
   @NotNull
   public String getIgnoredFilesList() {
     final Set<String> masks = myIgnoredPatterns.getIgnoreMasks();
@@ -470,12 +499,14 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
     return StringUtil.join(masks, ";") + ";";
   }
 
+  @Override
   public void setIgnoredFilesList(@NotNull String list) {
     fireBeforeFileTypesChanged();
     myIgnoredPatterns.setIgnoreMasks(list);
     fireFileTypesChanged();
   }
 
+  @Override
   public boolean isIgnoredFilesListEqualToCurrent(String list) {
     Set<String> tempSet = new THashSet<String>();
     StringTokenizer tokenizer = new StringTokenizer(list, ";");
@@ -485,6 +516,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
     return tempSet.equals(myIgnoredPatterns.getIgnoreMasks());
   }
 
+  @Override
   public boolean isFileIgnored(@NotNull String name) {
     return myIgnoredPatterns.isIgnored(name);
   }
@@ -494,21 +526,25 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
     return isFileIgnored(file.getName());
   }
 
+  @Override
   @SuppressWarnings({"deprecation"})
   @NotNull
   public String[] getAssociatedExtensions(@NotNull FileType type) {
     return myPatternsTable.getAssociatedExtensions(type);
   }
 
+  @Override
   @NotNull
   public List<FileNameMatcher> getAssociations(@NotNull FileType type) {
     return myPatternsTable.getAssociations(type);
   }
 
+  @Override
   public void associate(@NotNull FileType