Merge branch 'master' of git.labs.intellij.net:idea/community
authorYann Cébron <yann@yc.local>
Sat, 7 Nov 2009 12:05:54 +0000 (13:05 +0100)
committerYann Cébron <yann@yc.local>
Sat, 7 Nov 2009 12:05:54 +0000 (13:05 +0100)
289 files changed:
.idea/modules.xml
RegExpSupport/src/org/intellij/lang/regexp/_RegExLexer.java
RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex
RegExpSupport/testData/RETest.xml
build/scripts/layouts.gant
images/images.iml [moved from plugins/images/images.iml with 100% similarity]
images/src/org/intellij/images/ImagesBundle.java [moved from plugins/images/src/org/intellij/images/ImagesBundle.java with 100% similarity]
images/src/org/intellij/images/ImagesBundle.properties [moved from plugins/images/src/org/intellij/images/ImagesBundle.properties with 100% similarity]
images/src/org/intellij/images/actions/EditExternalyAction.java [moved from plugins/images/src/org/intellij/images/actions/EditExternalyAction.java with 100% similarity]
images/src/org/intellij/images/actions/ShowThumbnailsAction.java [moved from plugins/images/src/org/intellij/images/actions/ShowThumbnailsAction.java with 100% similarity]
images/src/org/intellij/images/actions/ToggleTransparencyChessboardAction.java [moved from plugins/images/src/org/intellij/images/actions/ToggleTransparencyChessboardAction.java with 50% similarity]
images/src/org/intellij/images/completion/ImageLookupInfoProvider.java [moved from plugins/images/src/org/intellij/images/completion/ImageLookupInfoProvider.java with 100% similarity]
images/src/org/intellij/images/editor/ImageDocument.java [moved from plugins/images/src/org/intellij/images/editor/ImageDocument.java with 100% similarity]
images/src/org/intellij/images/editor/ImageEditor.java [moved from plugins/images/src/org/intellij/images/editor/ImageEditor.java with 100% similarity]
images/src/org/intellij/images/editor/ImageFileEditor.java [moved from plugins/images/src/org/intellij/images/editor/ImageFileEditor.java with 100% similarity]
images/src/org/intellij/images/editor/ImageZoomModel.java [moved from plugins/images/src/org/intellij/images/editor/ImageZoomModel.java with 100% similarity]
images/src/org/intellij/images/editor/actionSystem/ImageEditorActionUtil.java [moved from plugins/images/src/org/intellij/images/editor/actionSystem/ImageEditorActionUtil.java with 100% similarity]
images/src/org/intellij/images/editor/actionSystem/ImageEditorActions.java [moved from plugins/images/src/org/intellij/images/editor/actionSystem/ImageEditorActions.java with 100% similarity]
images/src/org/intellij/images/editor/actions/ActualSizeAction.java [moved from plugins/images/src/org/intellij/images/editor/actions/ActualSizeAction.java with 100% similarity]
images/src/org/intellij/images/editor/actions/ToggleGridAction.java [moved from plugins/images/src/org/intellij/images/editor/actions/ToggleGridAction.java with 66% similarity]
images/src/org/intellij/images/editor/actions/ZoomInAction.java [moved from plugins/images/src/org/intellij/images/editor/actions/ZoomInAction.java with 100% similarity]
images/src/org/intellij/images/editor/actions/ZoomOutAction.java [moved from plugins/images/src/org/intellij/images/editor/actions/ZoomOutAction.java with 100% similarity]
images/src/org/intellij/images/editor/impl/ImageEditorImpl.java [moved from plugins/images/src/org/intellij/images/editor/impl/ImageEditorImpl.java with 100% similarity]
images/src/org/intellij/images/editor/impl/ImageEditorManagerImpl.java [moved from plugins/images/src/org/intellij/images/editor/impl/ImageEditorManagerImpl.java with 100% similarity]
images/src/org/intellij/images/editor/impl/ImageEditorUI.java [moved from plugins/images/src/org/intellij/images/editor/impl/ImageEditorUI.java with 100% similarity]
images/src/org/intellij/images/editor/impl/ImageFileEditorImpl.java [moved from plugins/images/src/org/intellij/images/editor/impl/ImageFileEditorImpl.java with 100% similarity]
images/src/org/intellij/images/editor/impl/ImageFileEditorProvider.java [moved from plugins/images/src/org/intellij/images/editor/impl/ImageFileEditorProvider.java with 100% similarity]
images/src/org/intellij/images/fileTypes/ImageDocumentationProvider.java [moved from plugins/images/src/org/intellij/images/fileTypes/ImageDocumentationProvider.java with 100% similarity]
images/src/org/intellij/images/fileTypes/ImageFileTypeManager.java [moved from plugins/images/src/org/intellij/images/fileTypes/ImageFileTypeManager.java with 100% similarity]
images/src/org/intellij/images/fileTypes/impl/ImageFileTypeManagerImpl.java [moved from plugins/images/src/org/intellij/images/fileTypes/impl/ImageFileTypeManagerImpl.java with 100% similarity]
images/src/org/intellij/images/icons/ActualSize.png [moved from plugins/images/src/org/intellij/images/icons/ActualSize.png with 100% similarity]
images/src/org/intellij/images/icons/EditExternaly.png [moved from plugins/images/src/org/intellij/images/icons/EditExternaly.png with 100% similarity]
images/src/org/intellij/images/icons/ImagesConfigurable.png [moved from plugins/images/src/org/intellij/images/icons/ImagesConfigurable.png with 100% similarity]
images/src/org/intellij/images/icons/ImagesFileType.png [moved from plugins/images/src/org/intellij/images/icons/ImagesFileType.png with 100% similarity]
images/src/org/intellij/images/icons/ThumbnailBlank.png [moved from plugins/images/src/org/intellij/images/icons/ThumbnailBlank.png with 100% similarity]
images/src/org/intellij/images/icons/ThumbnailDirectory.png [moved from plugins/images/src/org/intellij/images/icons/ThumbnailDirectory.png with 100% similarity]
images/src/org/intellij/images/icons/ThumbnailToolWindow.png [moved from plugins/images/src/org/intellij/images/icons/ThumbnailToolWindow.png with 100% similarity]
images/src/org/intellij/images/icons/ToggleGrid.png [moved from plugins/images/src/org/intellij/images/icons/ToggleGrid.png with 100% similarity]
images/src/org/intellij/images/icons/ToggleTransparencyChessboard.png [moved from plugins/images/src/org/intellij/images/icons/ToggleTransparencyChessboard.png with 100% similarity]
images/src/org/intellij/images/icons/ZoomIn.png [moved from plugins/images/src/org/intellij/images/icons/ZoomIn.png with 100% similarity]
images/src/org/intellij/images/icons/ZoomOut.png [moved from plugins/images/src/org/intellij/images/icons/ZoomOut.png with 100% similarity]
images/src/org/intellij/images/index/ImageInfoIndex.java [moved from plugins/images/src/org/intellij/images/index/ImageInfoIndex.java with 100% similarity]
images/src/org/intellij/images/options/EditorOptions.java [moved from plugins/images/src/org/intellij/images/options/EditorOptions.java with 100% similarity]
images/src/org/intellij/images/options/ExternalEditorOptions.java [moved from plugins/images/src/org/intellij/images/options/ExternalEditorOptions.java with 100% similarity]
images/src/org/intellij/images/options/GridOptions.java [moved from plugins/images/src/org/intellij/images/options/GridOptions.java with 100% similarity]
images/src/org/intellij/images/options/Options.java [moved from plugins/images/src/org/intellij/images/options/Options.java with 100% similarity]
images/src/org/intellij/images/options/OptionsManager.java [moved from plugins/images/src/org/intellij/images/options/OptionsManager.java with 100% similarity]
images/src/org/intellij/images/options/TransparencyChessboardOptions.java [moved from plugins/images/src/org/intellij/images/options/TransparencyChessboardOptions.java with 100% similarity]
images/src/org/intellij/images/options/ZoomOptions.java [moved from plugins/images/src/org/intellij/images/options/ZoomOptions.java with 100% similarity]
images/src/org/intellij/images/options/impl/EditorOptionsImpl.java [moved from plugins/images/src/org/intellij/images/options/impl/EditorOptionsImpl.java with 100% similarity]
images/src/org/intellij/images/options/impl/ExternalEditorOptionsImpl.java [moved from plugins/images/src/org/intellij/images/options/impl/ExternalEditorOptionsImpl.java with 100% similarity]
images/src/org/intellij/images/options/impl/GridOptionsImpl.java [moved from plugins/images/src/org/intellij/images/options/impl/GridOptionsImpl.java with 100% similarity]
images/src/org/intellij/images/options/impl/JDOMExternalizerEx.java [moved from plugins/images/src/org/intellij/images/options/impl/JDOMExternalizerEx.java with 100% similarity]
images/src/org/intellij/images/options/impl/Options.form [moved from plugins/images/src/org/intellij/images/options/impl/Options.form with 100% similarity]
images/src/org/intellij/images/options/impl/OptionsConfigurabe.java [moved from plugins/images/src/org/intellij/images/options/impl/OptionsConfigurabe.java with 100% similarity]
images/src/org/intellij/images/options/impl/OptionsImpl.java [moved from plugins/images/src/org/intellij/images/options/impl/OptionsImpl.java with 100% similarity]
images/src/org/intellij/images/options/impl/OptionsManagerImpl.java [moved from plugins/images/src/org/intellij/images/options/impl/OptionsManagerImpl.java with 100% similarity]
images/src/org/intellij/images/options/impl/OptionsUIForm.java [moved from plugins/images/src/org/intellij/images/options/impl/OptionsUIForm.java with 100% similarity]
images/src/org/intellij/images/options/impl/TransparencyChessboardOptionsImpl.java [moved from plugins/images/src/org/intellij/images/options/impl/TransparencyChessboardOptionsImpl.java with 100% similarity]
images/src/org/intellij/images/options/impl/ZoomOptionsImpl.java [moved from plugins/images/src/org/intellij/images/options/impl/ZoomOptionsImpl.java with 100% similarity]
images/src/org/intellij/images/thumbnail/ThumbnailManager.java [moved from plugins/images/src/org/intellij/images/thumbnail/ThumbnailManager.java with 100% similarity]
images/src/org/intellij/images/thumbnail/ThumbnailView.java [moved from plugins/images/src/org/intellij/images/thumbnail/ThumbnailView.java with 100% similarity]
images/src/org/intellij/images/thumbnail/actionSystem/ThumbnailViewActionUtil.java [moved from plugins/images/src/org/intellij/images/thumbnail/actionSystem/ThumbnailViewActionUtil.java with 100% similarity]
images/src/org/intellij/images/thumbnail/actionSystem/ThumbnailViewActions.java [moved from plugins/images/src/org/intellij/images/thumbnail/actionSystem/ThumbnailViewActions.java with 100% similarity]
images/src/org/intellij/images/thumbnail/actions/EnterAction.java [moved from plugins/images/src/org/intellij/images/thumbnail/actions/EnterAction.java with 100% similarity]
images/src/org/intellij/images/thumbnail/actions/HideThumbnailsAction.java [moved from plugins/images/src/org/intellij/images/thumbnail/actions/HideThumbnailsAction.java with 100% similarity]
images/src/org/intellij/images/thumbnail/actions/ToggleRecursiveAction.java [moved from plugins/images/src/org/intellij/images/thumbnail/actions/ToggleRecursiveAction.java with 100% similarity]
images/src/org/intellij/images/thumbnail/actions/UpFolderAction.java [moved from plugins/images/src/org/intellij/images/thumbnail/actions/UpFolderAction.java with 100% similarity]
images/src/org/intellij/images/thumbnail/impl/ThumbnailManagerImpl.java [moved from plugins/images/src/org/intellij/images/thumbnail/impl/ThumbnailManagerImpl.java with 100% similarity]
images/src/org/intellij/images/thumbnail/impl/ThumbnailSelectInTarget.java [moved from plugins/images/src/org/intellij/images/thumbnail/impl/ThumbnailSelectInTarget.java with 100% similarity]
images/src/org/intellij/images/thumbnail/impl/ThumbnailViewImpl.java [moved from plugins/images/src/org/intellij/images/thumbnail/impl/ThumbnailViewImpl.java with 100% similarity]
images/src/org/intellij/images/thumbnail/impl/ThumbnailViewUI.java [moved from plugins/images/src/org/intellij/images/thumbnail/impl/ThumbnailViewUI.java with 100% similarity]
images/src/org/intellij/images/ui/ImageComponent.java [moved from plugins/images/src/org/intellij/images/ui/ImageComponent.java with 100% similarity]
images/src/org/intellij/images/ui/ImageComponentDecorator.java [moved from plugins/images/src/org/intellij/images/ui/ImageComponentDecorator.java with 100% similarity]
images/src/org/intellij/images/ui/ImageComponentUI.java [moved from plugins/images/src/org/intellij/images/ui/ImageComponentUI.java with 100% similarity]
images/src/org/intellij/images/ui/ThumbnailComponent.java [moved from plugins/images/src/org/intellij/images/ui/ThumbnailComponent.java with 100% similarity]
images/src/org/intellij/images/ui/ThumbnailComponentUI.java [moved from plugins/images/src/org/intellij/images/ui/ThumbnailComponentUI.java with 100% similarity]
images/src/org/intellij/images/util/ImageInfoReader.java [moved from plugins/images/src/org/intellij/images/util/ImageInfoReader.java with 100% similarity]
images/src/org/intellij/images/vfs/IfsUtil.java [moved from plugins/images/src/org/intellij/images/vfs/IfsUtil.java with 100% similarity]
java/compiler/impl/src/com/intellij/packaging/impl/artifacts/ArtifactImpl.java
java/compiler/impl/src/com/intellij/packaging/impl/artifacts/ArtifactManagerImpl.java
java/compiler/impl/src/com/intellij/packaging/impl/artifacts/ArtifactModelBase.java
java/compiler/impl/src/com/intellij/packaging/impl/artifacts/ArtifactModelImpl.java
java/compiler/impl/src/com/intellij/packaging/impl/artifacts/ArtifactPointerImpl.java
java/compiler/impl/src/com/intellij/packaging/impl/artifacts/ArtifactPointerManagerImpl.java
java/compiler/impl/src/com/intellij/packaging/impl/artifacts/ArtifactUtil.java
java/compiler/impl/src/com/intellij/packaging/impl/artifacts/ArtifactVirtualFileListener.java [new file with mode: 0644]
java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactsProcessingItemsBuilderContext.java
java/compiler/impl/src/com/intellij/packaging/impl/elements/ArtifactElementType.java
java/compiler/impl/src/com/intellij/packaging/impl/elements/ArtifactPackagingElement.java
java/compiler/impl/src/com/intellij/packaging/impl/elements/PackagingElementFactoryImpl.java
java/compiler/impl/src/com/intellij/packaging/impl/run/ArtifactChooser.java
java/compiler/impl/src/com/intellij/packaging/impl/run/BuildArtifactsBeforeRun.java
java/compiler/impl/src/com/intellij/packaging/impl/run/BuildArtifactsBeforeRunTask.java
java/compiler/impl/src/com/intellij/packaging/impl/ui/ArtifactElementPresentation.java
java/compiler/openapi/src/com/intellij/packaging/artifacts/ArtifactModel.java
java/compiler/openapi/src/com/intellij/packaging/artifacts/ArtifactPointer.java
java/compiler/openapi/src/com/intellij/packaging/artifacts/ArtifactPointerManager.java
java/compiler/openapi/src/com/intellij/packaging/artifacts/ModifiableArtifactModel.java
java/compiler/openapi/src/com/intellij/packaging/elements/PackagingElementFactory.java
java/idea-ui/src/com/intellij/ide/util/newProjectWizard/modes/ImportMode.java
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/ArtifactsStructureConfigurableContextImpl.java
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/LayoutTreeComponent.java
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/actions/ExtractArtifactAction.java
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/sourceItems/ArtifactSourceItem.java
java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateLocalVarFromInstanceofAction.java
java/java-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandler.java
java/java-impl/src/com/intellij/codeInspection/ex/StandardInspectionToolsProvider.java
java/java-impl/src/com/intellij/codeInspection/inconsistentLanguageLevel/InconsistentLanguageLevelInspection.java [new file with mode: 0644]
java/java-impl/src/com/intellij/codeInspection/unnecessaryModuleDependency/UnnecessaryModuleDependencyInspection.java
java/java-impl/src/com/intellij/ide/util/gotoByName/DefaultSymbolNavigationContributor.java
java/java-impl/src/com/intellij/psi/controlFlow/ControlFlowFactory.java
java/java-impl/src/com/intellij/psi/impl/search/ThrowSearchUtil.java
java/java-impl/src/com/intellij/psi/impl/source/PsiTypeElementImpl.java
java/java-impl/src/com/intellij/psi/impl/source/resolve/ClassResolverProcessor.java
java/java-impl/src/com/intellij/psi/impl/source/resolve/JavaResolveCache.java
java/java-impl/src/com/intellij/refactoring/makeStatic/MakeMethodOrClassStaticProcessor.java
java/java-impl/src/com/intellij/refactoring/psi/SearchUtils.java
java/openapi/src/com/intellij/codeInsight/ExternalAnnotationsManager.java
java/openapi/src/com/intellij/ide/util/projectWizard/JavaModuleBuilder.java
java/openapi/src/com/intellij/openapi/roots/LanguageLevelModuleExtension.java
java/openapi/src/com/intellij/psi/JavaPsiFacade.java
platform/lang-api/src/com/intellij/psi/util/PsiTreeUtil.java
platform/lang-api/src/com/intellij/refactoring/util/CommonRefactoringUtil.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/GeneralHighlightingPass.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/GeneralHighlightingPassFactory.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PerThreadMap.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/TextEditorHighlightingPassRegistrarImpl.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/VisibleLineMarkersPassFactory.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/analysis/DefaultHighlightVisitor.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightInfoHolder.java
platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java
platform/lang-impl/src/com/intellij/codeInsight/problems/WolfTheProblemSolverImpl.java
platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateSettings.java
platform/lang-impl/src/com/intellij/codeInsight/unwrap/UnwrapAction.java
platform/lang-impl/src/com/intellij/codeInspection/ex/QuickFixAction.java
platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java
platform/lang-impl/src/com/intellij/find/actions/ShowUsagesTableCellRenderer.java
platform/lang-impl/src/com/intellij/ide/FileListPasteProvider.java
platform/lang-impl/src/com/intellij/ide/impl/ProjectViewSelectInTarget.java
platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ProjectViewDirectoryHelper.java
platform/lang-impl/src/com/intellij/ide/todo/TodoTreeBuilder.java
platform/lang-impl/src/com/intellij/ide/util/NavigationItemListCellRenderer.java
platform/lang-impl/src/com/intellij/internal/psiView/PsiViewerDialog.form
platform/lang-impl/src/com/intellij/internal/psiView/PsiViewerDialog.java
platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorImpl.java
platform/lang-impl/src/com/intellij/psi/impl/file/impl/FileManagerImpl.java
platform/lang-impl/src/com/intellij/psi/impl/source/resolve/FileContextUtil.java
platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/ReferenceProvidersRegistry.java
platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/MultiHostRegistrarImpl.java
platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesDialog.java
platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesUtil.java
platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java
platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java
platform/platform-api/src/com/intellij/ide/util/treeView/UpdaterTreeState.java
platform/platform-api/src/com/intellij/injected/editor/DocumentWindow.java
platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ActionUtil.java
platform/platform-api/src/com/intellij/openapi/components/ServiceManager.java
platform/platform-api/src/com/intellij/openapi/diff/DiffRequest.java
platform/platform-api/src/com/intellij/openapi/diff/DiffViewer.java
platform/platform-api/src/com/intellij/openapi/diff/SimpleDiffRequest.java
platform/platform-api/src/com/intellij/openapi/editor/EditorFactory.java
platform/platform-api/src/com/intellij/openapi/project/DumbService.java
platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java
platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsAction.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/GenericDataProvider.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorFactoryImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileSystemTreeFactoryImpl.java
platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/LocalFsFinder.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/fileEditor/impl/MoveEditorToOppositeTabGroupAction.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorImpl.java
platform/platform-impl/src/com/intellij/openapi/project/CacheUpdateSession.java
platform/platform-impl/src/com/intellij/openapi/project/DumbModeIndicator.java
platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java
platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java
platform/platform-impl/src/com/intellij/platform/OpenDirectoryProjectAction.java
platform/smRunner/src/com/intellij/execution/testframework/sm/TestsLocationProviderUtil.java
platform/testFramework/src/com/intellij/mock/MockEditorFactory.java
platform/testFramework/testSrc/com/intellij/codeInsight/unwrap/UnwrapTestCase.java [new file with mode: 0644]
platform/usageView/src/com/intellij/usages/impl/UsagePreviewPanel.java
platform/util/src/com/intellij/openapi/util/text/StringUtil.java
platform/util/src/com/intellij/util/concurrency/Semaphore.java
platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangeRequestChain.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ChangeDiffRequest.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ChangeDiffRequestPresentable.java [new file with mode: 0644]
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/DiffPresentationReturnValue.java [moved from java/openapi/src/com/intellij/util/descriptors/CustomConfigFile.java with 52% similarity]
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/DiffRequestPresentable.java [new file with mode: 0644]
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ShowDiffAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ShowNextChangeAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/ShowPrevChangeAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchForBaseRevisionTexts.java [new file with mode: 0644]
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/FilePatchInProgress.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/LazyPatchContentRevision.java
platform/vcs-impl/src/com/intellij/openapi/vcs/update/FilesForRefresh.java
platform/xdebugger-api/src/com/intellij/xdebugger/frame/XValue.java
platform/xdebugger-api/src/com/intellij/xdebugger/frame/XValueContainer.java
plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties
plugins/InspectionGadgets/src/com/siyeh/ig/InspectionGadgetsPlugin.java
plugins/InspectionGadgets/src/com/siyeh/ig/abstraction/StaticMethodOnlyUsedInOneClassInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/bugs/ObjectEqualityInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/ClassMayBeInterfaceInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/classlayout/UtilityClassWithoutPrivateConstructorInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/fixes/MakeFieldFinalFix.java
plugins/InspectionGadgets/src/com/siyeh/ig/fixes/MakeFieldStaticFinalFix.java [new file with mode: 0644]
plugins/InspectionGadgets/src/com/siyeh/ig/inheritance/AbstractMethodWithMissingImplementationsInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/j2me/AbstractClassWithOnlyOneDirectInheritorInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/j2me/InterfaceWithOnlyOneDirectInheritorInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/logging/NonStaticFinalLoggerInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableAssignedVisitor.java
plugins/InspectionGadgets/src/com/siyeh/ig/style/ConstantOnLHSOfComparisonInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/style/ConstantOnRHSOfComparisonInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/threading/ThreadLocalNotStaticFinalInspection.java [new file with mode: 0644]
plugins/InspectionGadgets/src/inspectionDescriptions/ThreadLocalNotStaticFinal.html [new file with mode: 0644]
plugins/ant/src/com/intellij/lang/ant/psi/impl/AntTypeDefImpl.java
plugins/commander/src/META-INF/plugin.xml
plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsExecution/CvsOperationExecutor.java
plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/CvsTabbedWindow.java
plugins/devkit/src/module/PluginModuleBuilder.java
plugins/git4idea/src/git4idea/actions/BasicAction.java
plugins/git4idea/src/git4idea/actions/GitInit.java
plugins/git4idea/src/git4idea/actions/GitRepositoryAction.java
plugins/git4idea/src/git4idea/checkin/GitConvertFilesDialog.java
plugins/git4idea/src/git4idea/checkin/GitPushActiveBranchesDialog.form
plugins/git4idea/src/git4idea/checkin/GitPushActiveBranchesDialog.java
plugins/git4idea/src/git4idea/checkin/GitPushRebaseProcess.java
plugins/git4idea/src/git4idea/commands/GitHandlerUtil.java
plugins/git4idea/src/git4idea/i18n/GitBundle.properties
plugins/git4idea/src/git4idea/ui/GitUIUtil.java
plugins/git4idea/src/git4idea/vfs/GitRootTracker.java
plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/local/GroovyUnusedImportPass.java
plugins/groovy/src/org/jetbrains/plugins/groovy/gotoclass/GroovyGoToSymbolContributor.java
plugins/images/imagesPlugin.iml [deleted file]
plugins/images/src/META-INF/images-commander-integration.xml [deleted file]
plugins/junit_rt/src/com/intellij/junit3/TestRunnerUtil.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/annotator/MavenDomAnnotator.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenDefaultModifiableModelsProvider.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/indices/MavenIndicesManager.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/MavenProjectsStructure.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenId.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProject.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectProblem.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectReader.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectReaderResult.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsManager.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenProblemFileHighlighter.java [new file with mode: 0644]
plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenRehighlighter.java [new file with mode: 0644]
plugins/maven/src/main/resources/DomBundle.properties
plugins/maven/src/main/resources/META-INF/plugin.xml
plugins/maven/src/main/resources/ProjectBundle.properties
plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java
plugins/maven/src/test/java/org/jetbrains/idea/maven/dom/MavenDomTestCase.java
plugins/maven/src/test/java/org/jetbrains/idea/maven/dom/MavenModelValidationTest.java
plugins/maven/src/test/java/org/jetbrains/idea/maven/dom/MavenParentCompletionAndResolutionTest.java
plugins/maven/src/test/java/org/jetbrains/idea/maven/dom/MavenTypingTest.java
plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/AddingDependencyTest.java [moved from plugins/maven/src/test/java/org/jetbrains/idea/maven/AddingDependencyTest.java with 97% similarity]
plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/ArchetypesTest.java [moved from plugins/maven/src/test/java/org/jetbrains/idea/maven/ArchetypesTest.java with 96% similarity]
plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/ArtifactsDownloadingTest.java [moved from plugins/maven/src/test/java/org/jetbrains/idea/maven/ArtifactsDownloadingTest.java with 97% similarity]
plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/DependenciesImportingTest.java [moved from plugins/maven/src/test/java/org/jetbrains/idea/maven/DependenciesImportingTest.java with 99% similarity]
plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/DependenciesManagementTest.java [moved from plugins/maven/src/test/java/org/jetbrains/idea/maven/DependenciesManagementTest.java with 98% similarity]
plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/FoldersImportingTest.java [moved from plugins/maven/src/test/java/org/jetbrains/idea/maven/FoldersImportingTest.java with 99% similarity]
plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/GroovyImporterTest.java [moved from plugins/maven/src/test/java/org/jetbrains/idea/maven/GroovyImporterTest.java with 99% similarity]
plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/IgnoresImportingTest.java [moved from plugins/maven/src/test/java/org/jetbrains/idea/maven/IgnoresImportingTest.java with 97% similarity]
plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/InvalidProjectImportingTest.java [moved from plugins/maven/src/test/java/org/jetbrains/idea/maven/InvalidProjectImportingTest.java with 93% similarity]
plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/MavenPerformanceTest.java [moved from plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenPerformanceTest.java with 96% similarity]
plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/MiscImportingTest.java [moved from plugins/maven/src/test/java/org/jetbrains/idea/maven/MiscImportingTest.java with 98% similarity]
plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/ReimportingTest.java [moved from plugins/maven/src/test/java/org/jetbrains/idea/maven/ReimportingTest.java with 98% similarity]
plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/SnapshotDependenciesImportingTest.java [moved from plugins/maven/src/test/java/org/jetbrains/idea/maven/SnapshotDependenciesImportingTest.java with 99% similarity]
plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/StructureImportingTest.java [moved from plugins/maven/src/test/java/org/jetbrains/idea/maven/StructureImportingTest.java with 99% similarity]
plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/WorkingWithOpenProjectTest.java [moved from plugins/maven/src/test/java/org/jetbrains/idea/maven/WorkingWithOpenProjectTest.java with 96% similarity]
plugins/maven/src/test/java/org/jetbrains/idea/maven/project/MavenProjectReaderTest.java
plugins/maven/src/test/java/org/jetbrains/idea/maven/project/MavenProjectsTreeReadingTest.java
plugins/spellchecker/src/com/intellij/spellchecker/SpellCheckerManager.java
resources-en/src/inspectionDescriptions/InconsistentLanguageLevel.html [new file with mode: 0644]
resources/src/META-INF/IdeaPlugin.xml
resources/src/META-INF/ImagesPlugin.xml [moved from plugins/images/src/META-INF/plugin.xml with 89% similarity]
xml/dom-openapi/src/com/intellij/util/xml/DomManager.java
xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlHighlightVisitor.java
xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlHighlightVisitorBasedInspection.java
xml/impl/src/com/intellij/javaee/ExternalResourceManagerImpl.java
xml/impl/src/com/intellij/xml/util/CheckDtdReferencesInspection.java

index afc6d2a0623cd38dfff40e68ba84a1b73f95c9dd..323302d1f7243291478083a88f02b3f71b1cc7f3 100644 (file)
@@ -35,7 +35,7 @@
       <module fileurl="file://$PROJECT_DIR$/plugins/groovy/rt/groovy-rt.iml" filepath="$PROJECT_DIR$/plugins/groovy/rt/groovy-rt.iml" />
       <module fileurl="file://$PROJECT_DIR$/platform/icons/icons.iml" filepath="$PROJECT_DIR$/platform/icons/icons.iml" group="platform" />
       <module fileurl="file://$PROJECT_DIR$/java/idea-ui/idea-ui.iml" filepath="$PROJECT_DIR$/java/idea-ui/idea-ui.iml" group="java" />
-      <module fileurl="file://$PROJECT_DIR$/plugins/images/images.iml" filepath="$PROJECT_DIR$/plugins/images/images.iml" />
+      <module fileurl="file://$PROJECT_DIR$/images/images.iml" filepath="$PROJECT_DIR$/images/images.iml" />
       <module fileurl="file://$PROJECT_DIR$/plugins/java-i18n/java-i18n.iml" filepath="$PROJECT_DIR$/plugins/java-i18n/java-i18n.iml" group="plugins" />
       <module fileurl="file://$PROJECT_DIR$/java/java-impl/java-impl.iml" filepath="$PROJECT_DIR$/java/java-impl/java-impl.iml" group="java" />
       <module fileurl="file://$PROJECT_DIR$/java/java-runtime/java-runtime.iml" filepath="$PROJECT_DIR$/java/java-runtime/java-runtime.iml" group="java" />
index b789ad5a697e40dbda1b198350442db8e8dddab2..89ccdee550b85bf32a4f0e75896f6fbe9a04efdc 100644 (file)
@@ -14,8 +14,6 @@
  * limitations under the License.
  */
 
-/* The following code was generated by JFlex 1.4.1 on 23.09.09 18:11 */
-
 /* It's an automatically generated code. Do not modify it. */
 package org.intellij.lang.regexp;
 
@@ -30,8 +28,8 @@ import com.intellij.psi.StringEscapesTokenTypes;
 /**
  * This class is a scanner generated by 
  * <a href="http://www.jflex.de/">JFlex</a> 1.4.1
- * on 23.09.09 18:11 from the specification file
- * <tt>C:/JetBrains/IDEA/svnPlugins/RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex</tt>
+ * on 04.11.09 17:54 from the specification file
+ * <tt>RegExpSupport/src/org/intellij/lang/regexp/regexp-lexer.flex</tt>
  */
 class _RegExLexer implements FlexLexer {
   /** initial size of the lookahead buffer */
@@ -51,12 +49,12 @@ class _RegExLexer implements FlexLexer {
    * Translates characters to character classes
    */
   private static final String ZZ_CMAP_PACKED = 
-    "\10\0\2\50\1\13\1\0\1\50\1\57\22\0\1\60\1\54\1\0"+
-    "\1\56\1\15\1\0\1\47\1\0\1\4\1\5\1\17\1\20\1\46"+
-    "\1\42\1\3\1\0\1\2\7\41\2\1\1\51\1\0\1\55\1\53"+
-    "\1\52\1\16\1\0\1\24\1\24\1\30\1\27\1\36\1\34\1\25"+
+    "\10\0\2\51\1\13\1\0\1\51\1\60\22\0\1\44\1\55\1\0"+
+    "\1\57\1\15\1\0\1\50\1\0\1\4\1\5\1\17\1\20\1\47"+
+    "\1\42\1\3\1\0\1\2\7\41\2\1\1\52\1\0\1\56\1\54"+
+    "\1\53\1\16\1\0\1\24\1\24\1\30\1\27\1\36\1\34\1\25"+
     "\1\43\1\32\6\43\1\33\1\35\1\43\1\26\3\43\1\26\1\26"+
-    "\1\43\1\25\1\10\1\12\1\11\1\14\1\44\1\0\1\23\1\24"+
+    "\1\43\1\25\1\10\1\12\1\11\1\14\1\45\1\0\1\23\1\24"+
     "\1\31\1\27\1\23\1\23\2\43\1\32\4\43\1\22\1\43\1\33"+
     "\1\43\1\22\1\26\1\22\1\40\1\43\1\26\1\37\1\43\1\25"+
     "\1\6\1\21\1\7\54\0\1\43\12\0\1\43\4\0\1\43\5\0"+
@@ -65,43 +63,43 @@ class _RegExLexer implements FlexLexer {
     "\1\43\1\0\24\43\1\0\54\43\1\0\46\43\1\0\5\43\4\0"+
     "\202\43\10\0\105\43\1\0\46\43\2\0\2\43\6\0\20\43\41\0"+
     "\46\43\2\0\1\43\7\0\47\43\110\0\33\43\5\0\3\43\56\0"+
-    "\32\43\5\0\13\43\25\0\12\45\4\0\2\43\1\0\143\43\1\0"+
-    "\1\43\17\0\2\43\7\0\2\43\12\45\3\43\2\0\1\43\20\0"+
+    "\32\43\5\0\13\43\25\0\12\46\4\0\2\43\1\0\143\43\1\0"+
+    "\1\43\17\0\2\43\7\0\2\43\12\46\3\43\2\0\1\43\20\0"+
     "\1\43\1\0\36\43\35\0\3\43\60\0\46\43\13\0\1\43\u0152\0"+
-    "\66\43\3\0\1\43\22\0\1\43\7\0\12\43\4\0\12\45\25\0"+
+    "\66\43\3\0\1\43\22\0\1\43\7\0\12\43\4\0\12\46\25\0"+
     "\10\43\2\0\2\43\2\0\26\43\1\0\7\43\1\0\1\43\3\0"+
-    "\4\43\3\0\1\43\36\0\2\43\1\0\3\43\4\0\12\45\2\43"+
+    "\4\43\3\0\1\43\36\0\2\43\1\0\3\43\4\0\12\46\2\43"+
     "\23\0\6\43\4\0\2\43\2\0\26\43\1\0\7\43\1\0\2\43"+
-    "\1\0\2\43\1\0\2\43\37\0\4\43\1\0\1\43\7\0\12\45"+
+    "\1\0\2\43\1\0\2\43\37\0\4\43\1\0\1\43\7\0\12\46"+
     "\2\0\3\43\20\0\11\43\1\0\3\43\1\0\26\43\1\0\7\43"+
     "\1\0\2\43\1\0\5\43\3\0\1\43\22\0\1\43\17\0\2\43"+
-    "\4\0\12\45\25\0\10\43\2\0\2\43\2\0\26\43\1\0\7\43"+
+    "\4\0\12\46\25\0\10\43\2\0\2\43\2\0\26\43\1\0\7\43"+
     "\1\0\2\43\1\0\5\43\3\0\1\43\36\0\2\43\1\0\3\43"+
-    "\4\0\12\45\1\0\1\43\21\0\1\43\1\0\6\43\3\0\3\43"+
+    "\4\0\12\46\1\0\1\43\21\0\1\43\1\0\6\43\3\0\3\43"+
     "\1\0\4\43\3\0\2\43\1\0\1\43\1\0\2\43\3\0\2\43"+
-    "\3\0\3\43\3\0\10\43\1\0\3\43\55\0\11\45\25\0\10\43"+
+    "\3\0\3\43\3\0\10\43\1\0\3\43\55\0\11\46\25\0\10\43"+
     "\1\0\3\43\1\0\27\43\1\0\12\43\1\0\5\43\46\0\2\43"+
-    "\4\0\12\45\25\0\10\43\1\0\3\43\1\0\27\43\1\0\12\43"+
-    "\1\0\5\43\3\0\1\43\40\0\1\43\1\0\2\43\4\0\12\45"+
+    "\4\0\12\46\25\0\10\43\1\0\3\43\1\0\27\43\1\0\12\43"+
+    "\1\0\5\43\3\0\1\43\40\0\1\43\1\0\2\43\4\0\12\46"+
     "\25\0\10\43\1\0\3\43\1\0\27\43\1\0\20\43\46\0\2\43"+
-    "\4\0\12\45\25\0\22\43\3\0\30\43\1\0\11\43\1\0\1\43"+
-    "\2\0\7\43\72\0\60\43\1\0\2\43\14\0\7\43\11\0\12\45"+
+    "\4\0\12\46\25\0\22\43\3\0\30\43\1\0\11\43\1\0\1\43"+
+    "\2\0\7\43\72\0\60\43\1\0\2\43\14\0\7\43\11\0\12\46"+
     "\47\0\2\43\1\0\1\43\2\0\2\43\1\0\1\43\2\0\1\43"+
     "\6\0\4\43\1\0\7\43\1\0\3\43\1\0\1\43\1\0\1\43"+
     "\2\0\2\43\1\0\4\43\1\0\2\43\11\0\1\43\2\0\5\43"+
-    "\1\0\1\43\11\0\12\45\2\0\2\43\42\0\1\43\37\0\12\45"+
+    "\1\0\1\43\11\0\12\46\2\0\2\43\42\0\1\43\37\0\12\46"+
     "\26\0\10\43\1\0\42\43\35\0\4\43\164\0\42\43\1\0\5\43"+
-    "\1\0\2\43\25\0\12\45\6\0\6\43\112\0\46\43\12\0\51\43"+
+    "\1\0\2\43\25\0\12\46\6\0\6\43\112\0\46\43\12\0\51\43"+
     "\7\0\132\43\5\0\104\43\5\0\122\43\6\0\7\43\1\0\77\43"+
     "\1\0\1\43\1\0\4\43\2\0\7\43\1\0\1\43\1\0\4\43"+
     "\2\0\47\43\1\0\1\43\1\0\4\43\2\0\37\43\1\0\1\43"+
     "\1\0\4\43\2\0\7\43\1\0\1\43\1\0\4\43\2\0\7\43"+
     "\1\0\7\43\1\0\27\43\1\0\37\43\1\0\1\43\1\0\4\43"+
-    "\2\0\7\43\1\0\47\43\1\0\23\43\16\0\11\45\56\0\125\43"+
+    "\2\0\7\43\1\0\47\43\1\0\23\43\16\0\11\46\56\0\125\43"+
     "\14\0\u026c\43\2\0\10\43\12\0\32\43\5\0\113\43\25\0\15\43"+
     "\1\0\4\43\16\0\22\43\16\0\22\43\16\0\15\43\1\0\3\43"+
-    "\17\0\64\43\43\0\1\43\4\0\1\43\3\0\12\45\46\0\12\45"+
-    "\6\0\130\43\10\0\51\43\127\0\35\43\51\0\12\45\36\43\2\0"+
+    "\17\0\64\43\43\0\1\43\4\0\1\43\3\0\12\46\46\0\12\46"+
+    "\6\0\130\43\10\0\51\43\127\0\35\43\51\0\12\46\36\43\2\0"+
     "\5\43\u038b\0\154\43\224\0\234\43\4\0\132\43\6\0\26\43\2\0"+
     "\6\43\2\0\46\43\2\0\6\43\2\0\10\43\1\0\1\43\1\0"+
     "\1\43\1\0\1\43\1\0\37\43\2\0\65\43\1\0\7\43\1\0"+
@@ -116,7 +114,7 @@ class _RegExLexer implements FlexLexer {
     "\7\43\14\0\5\43\5\0\1\43\1\0\12\43\1\0\15\43\1\0"+
     "\5\43\1\0\1\43\1\0\2\43\1\0\2\43\1\0\154\43\41\0"+
     "\u016b\43\22\0\100\43\2\0\66\43\50\0\14\43\164\0\5\43\1\0"+
-    "\207\43\23\0\12\45\7\0\32\43\6\0\32\43\13\0\131\43\3\0"+
+    "\207\43\23\0\12\46\7\0\32\43\6\0\32\43\13\0\131\43\3\0"+
     "\6\43\2\0\6\43\2\0\6\43\2\0\3\43\43\0";
 
   /** 
@@ -136,13 +134,13 @@ class _RegExLexer implements FlexLexer {
     "\1\27\1\30\1\31\1\32\1\33\1\34\1\3\1\35"+
     "\1\36\1\35\1\37\1\40\1\1\1\41\1\42\1\2"+
     "\1\43\1\44\1\45\1\46\1\47\1\50\1\51\1\52"+
-    "\1\53\2\54\1\55\1\11\1\56\1\57\1\60\1\61"+
-    "\1\62\1\63\1\64\1\65\2\0\1\66\1\67\2\57"+
-    "\2\60\1\70\1\71\1\0\1\66\1\57\1\72\2\60"+
-    "\1\73\1\66\3\60\1\74";
+    "\1\53\1\54\2\55\1\56\1\11\1\57\1\60\1\61"+
+    "\1\62\1\63\1\64\1\65\1\66\2\0\1\67\1\70"+
+    "\2\60\2\61\1\71\1\72\1\0\1\67\1\60\1\73"+
+    "\2\61\1\74\1\67\3\61\1\75";
 
   private static int [] zzUnpackAction() {
-    int [] result = new int[88];
+    int [] result = new int[89];
     int offset = 0;
     offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
     return result;
@@ -173,14 +171,15 @@ class _RegExLexer implements FlexLexer {
     "\0\u0188\0\u024c\0\u0188\0\u027d\0\u0188\0\u02ae\0\u0188\0\u0188"+
     "\0\u0188\0\u0188\0\u0188\0\u02df\0\u0188\0\u0188\0\u01ea\0\u0188"+
     "\0\u0188\0\u0310\0\u0341\0\u0188\0\u0188\0\u0372\0\u0188\0\u0188"+
-    "\0\u03a3\0\u03d4\0\u0188\0\u0188\0\u0188\0\u0188\0\u0188\0\u0405"+
-    "\0\u0188\0\u0188\0\u0188\0\u0436\0\u0467\0\u0188\0\u0188\0\u0188"+
-    "\0\u0188\0\u0188\0\u0498\0\u04c9\0\u04fa\0\u0188\0\u052b\0\u055c"+
-    "\0\u058d\0\u05be\0\u0188\0\u0188\0\u05ef\0\u0620\0\u0188\0\u0188"+
-    "\0\u0651\0\u0682\0\u0188\0\u0188\0\u06b3\0\u06e4\0\u0188\0\u0188";
+    "\0\u03a3\0\u03d4\0\u0188\0\u0188\0\u0188\0\u0188\0\u0188\0\u0188"+
+    "\0\u0405\0\u0188\0\u0188\0\u0188\0\u0436\0\u0467\0\u0188\0\u0188"+
+    "\0\u0188\0\u0188\0\u0188\0\u0498\0\u04c9\0\u04fa\0\u0188\0\u052b"+
+    "\0\u055c\0\u058d\0\u05be\0\u0188\0\u0188\0\u05ef\0\u0620\0\u0188"+
+    "\0\u0188\0\u0651\0\u0682\0\u0188\0\u0188\0\u06b3\0\u06e4\0\u0188"+
+    "\0\u0188";
 
   private static int [] zzUnpackRowMap() {
-    int [] result = new int[88];
+    int [] result = new int[89];
     int offset = 0;
     offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
     return result;
@@ -205,36 +204,37 @@ class _RegExLexer implements FlexLexer {
   private static final String ZZ_TRANS_PACKED_0 =
     "\3\11\1\12\1\13\1\14\1\15\1\11\1\16\1\11"+
     "\1\17\1\20\1\21\1\22\1\23\1\24\1\25\1\26"+
-    "\20\11\1\27\5\11\1\20\5\11\1\30\1\20\1\31"+
-    "\12\11\1\32\1\0\45\11\1\33\2\34\4\33\1\35"+
-    "\12\33\17\36\1\34\1\33\1\36\1\33\1\34\1\37"+
-    "\12\33\11\40\1\41\1\40\1\0\45\40\6\11\1\15"+
-    "\1\11\1\16\1\42\1\17\1\43\1\21\25\11\1\27"+
-    "\4\11\1\44\1\43\6\11\1\43\1\11\6\45\1\46"+
+    "\20\11\1\27\1\11\1\30\4\11\1\20\5\11\1\31"+
+    "\1\20\12\11\1\32\1\0\45\11\1\33\2\34\4\33"+
+    "\1\35\12\33\17\36\1\34\1\33\1\36\2\33\1\34"+
+    "\1\37\11\33\11\40\1\41\1\40\1\0\45\40\6\11"+
+    "\1\15\1\11\1\16\1\42\1\17\1\43\1\21\25\11"+
+    "\1\27\5\11\1\44\1\43\6\11\1\43\6\45\1\46"+
     "\1\45\1\47\1\45\1\17\46\45\5\50\1\51\14\50"+
-    "\17\52\1\50\1\53\1\52\5\50\1\54\7\50\13\10"+
-    "\1\55\43\10\1\55\1\10\77\0\1\56\53\0\1\57"+
-    "\47\0\1\60\1\61\1\62\4\63\1\60\1\63\1\60"+
-    "\1\63\1\60\6\63\2\64\2\65\2\66\1\67\1\70"+
-    "\1\67\1\71\1\72\1\73\1\72\1\74\1\75\1\61"+
-    "\1\63\1\72\15\60\36\0\1\76\23\0\2\34\36\0"+
-    "\1\34\3\0\1\34\14\0\2\36\17\0\20\36\1\0"+
-    "\3\36\62\0\1\77\33\0\17\52\2\0\1\52\37\0"+
-    "\17\53\2\0\1\53\66\0\2\100\1\101\1\102\1\103"+
-    "\1\104\3\0\2\61\36\0\1\61\21\0\1\105\36\0"+
-    "\1\105\17\0\61\106\1\107\2\110\20\107\2\110\2\107"+
-    "\3\110\2\107\1\110\1\107\1\110\2\107\1\110\17\107"+
-    "\1\111\2\112\20\111\2\112\2\111\3\112\2\111\1\112"+
-    "\1\111\1\112\2\111\1\112\17\111\53\0\1\113\1\114"+
-    "\4\0\5\115\1\0\53\115\2\0\1\116\36\0\1\116"+
-    "\17\0\62\117\2\120\20\117\2\120\2\117\3\120\2\117"+
-    "\1\120\1\117\1\120\2\117\1\120\17\117\62\121\2\122"+
-    "\20\121\2\122\2\121\3\122\2\121\1\122\1\121\1\122"+
-    "\2\121\1\122\17\121\5\115\1\123\53\115\2\0\1\124"+
-    "\36\0\1\124\17\0\62\125\2\126\20\125\2\126\2\125"+
-    "\3\126\2\125\1\126\1\125\1\126\2\125\1\126\17\125"+
-    "\62\127\2\130\20\127\2\130\2\127\3\130\2\127\1\130"+
-    "\1\127\1\130\2\127\1\130\17\127";
+    "\17\52\1\50\1\53\1\52\6\50\1\54\6\50\13\10"+
+    "\1\55\44\10\1\55\77\0\1\56\53\0\1\57\47\0"+
+    "\1\60\1\61\1\62\4\63\1\60\1\63\1\60\1\63"+
+    "\1\64\6\63\2\65\2\66\2\67\1\70\1\71\1\70"+
+    "\1\72\1\73\1\74\1\73\1\75\1\76\1\61\1\63"+
+    "\1\73\1\64\4\60\1\64\6\60\1\64\36\0\1\77"+
+    "\23\0\2\34\36\0\1\34\4\0\1\34\13\0\2\36"+
+    "\17\0\20\36\1\0\1\36\1\0\2\36\62\0\1\100"+
+    "\32\0\17\52\2\0\1\52\37\0\17\53\2\0\1\53"+
+    "\67\0\2\101\1\102\1\103\1\104\1\105\2\0\2\61"+
+    "\36\0\1\61\21\0\1\106\36\0\1\106\17\0\61\107"+
+    "\1\110\2\111\20\110\2\111\2\110\3\111\2\110\1\111"+
+    "\1\110\1\111\2\110\1\111\17\110\1\112\2\113\20\112"+
+    "\2\113\2\112\3\113\2\112\1\113\1\112\1\113\2\112"+
+    "\1\113\17\112\54\0\1\114\1\115\3\0\5\116\1\0"+
+    "\53\116\2\0\1\117\36\0\1\117\17\0\62\120\2\121"+
+    "\20\120\2\121\2\120\3\121\2\120\1\121\1\120\1\121"+
+    "\2\120\1\121\17\120\62\122\2\123\20\122\2\123\2\122"+
+    "\3\123\2\122\1\123\1\122\1\123\2\122\1\123\17\122"+
+    "\5\116\1\124\53\116\2\0\1\125\36\0\1\125\17\0"+
+    "\62\126\2\127\20\126\2\127\2\126\3\127\2\126\1\127"+
+    "\1\126\1\127\2\126\1\127\17\126\62\130\2\131\20\130"+
+    "\2\131\2\130\3\131\2\130\1\131\1\130\1\131\2\130"+
+    "\1\131\17\130";
 
   private static int [] zzUnpackTrans() {
     int [] result = new int[1813];
@@ -281,12 +281,12 @@ class _RegExLexer implements FlexLexer {
     "\6\0\2\1\2\11\1\1\2\11\1\3\1\1\12\11"+
     "\1\1\1\11\1\1\1\11\1\1\5\11\1\1\2\11"+
     "\1\3\2\11\2\1\2\11\1\1\1\15\1\11\2\1"+
-    "\5\11\1\1\3\11\2\1\5\11\2\0\1\1\1\11"+
+    "\6\11\1\1\3\11\2\1\5\11\2\0\1\1\1\11"+
     "\4\1\2\11\1\0\1\1\2\11\2\1\2\11\2\1"+
     "\2\11";
 
   private static int [] zzUnpackAttribute() {
-    int [] result = new int[88];
+    int [] result = new int[89];
     int offset = 0;
     offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
     return result;
@@ -431,14 +431,7 @@ class _RegExLexer implements FlexLexer {
 
   // For Demetra compatibility
   public void reset(CharSequence buffer, int initialState){
-    zzBuffer = buffer;
-    zzBufferArray = null; 
-    zzCurrentPos = zzMarkedPos = zzStartRead = 0;
-    zzPushbackPos = 0;
-    zzAtEOF = false;
-    zzAtBOL = true;
-    zzEndRead = buffer.length();
-    yybegin(initialState);
+    reset(buffer, 0, buffer.length(), initialState);
   }
 
   /**
@@ -650,243 +643,247 @@ class _RegExLexer implements FlexLexer {
         case 7: 
           { if (yystate() != CLASS2) yypushstate(EMBRACED); return RegExpTT.LBRACE;
           }
-        case 61: break;
+        case 62: break;
         case 6: 
           { return RegExpTT.GROUP_END;
           }
-        case 62: break;
+        case 63: break;
         case 36: 
           { yypushstate(CLASS1); return RegExpTT.CLASS_BEGIN;
           }
-        case 63: break;
+        case 64: break;
         case 14: 
           { return RegExpTT.STAR;
           }
-        case 64: break;
+        case 65: break;
         case 40: 
           { return RegExpTT.ESC_CHARACTER;
           }
-        case 65: break;
+        case 66: break;
         case 28: 
           { return commentMode ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.ESC_CHARACTER;
           }
-        case 66: break;
+        case 67: break;
+        case 41: 
+          { return commentMode ? RegExpTT.CHARACTER : RegExpTT.REDUNDANT_ESCAPE;
+          }
+        case 68: break;
         case 37: 
           { return RegExpTT.REDUNDANT_ESCAPE;
           }
-        case 67: break;
+        case 69: break;
         case 24: 
           { return RegExpTT.COMMA;
           }
-        case 68: break;
-        case 56
+        case 70: break;
+        case 57
           { return RegExpTT.POS_LOOKBEHIND;
           }
-        case 69: break;
+        case 71: break;
         case 39: 
           { return RegExpTT.BAD_OCT_VALUE;
           }
-        case 70: break;
+        case 72: break;
         case 10: 
           { return commentMode ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.CTRL_CHARACTER;
           }
-        case 71: break;
+        case 73: break;
         case 30: 
           { yypopstate(); yypushstate(EMBRACED); return RegExpTT.LBRACE;
           }
-        case 72: break;
-        case 48
+        case 74: break;
+        case 49
           { return StringEscapesTokenTypes.INVALID_UNICODE_ESCAPE_TOKEN;
           }
-        case 73: break;
-        case 57
+        case 75: break;
+        case 58
           { return RegExpTT.NEG_LOOKBEHIND;
           }
-        case 74: break;
-        case 60
+        case 76: break;
+        case 61
           { return RegExpTT.UNICODE_CHAR;
           }
-        case 75: break;
-        case 55
+        case 77: break;
+        case 56
           { if (xmlSchemaMode) { yypushback(1); return RegExpTT.CHAR_CLASS; } else return RegExpTT.CTRL;
           }
-        case 76: break;
+        case 78: break;
         case 35: 
           { yybegin(OPTIONS); return RegExpTT.SET_OPTIONS;
           }
-        case 77: break;
+        case 79: break;
         case 12: 
           { return RegExpTT.DOLLAR;
           }
-        case 78: break;
-        case 49
+        case 80: break;
+        case 50
           { yypopstate(); return RegExpTT.QUOTE_END;
           }
-        case 79: break;
-        case 52
+        case 81: break;
+        case 53
           { return RegExpTT.POS_LOOKAHEAD;
           }
-        case 80: break;
+        case 82: break;
         case 22: 
           { yypopstate(); return RegExpTT.RBRACE;
           }
-        case 81: break;
+        case 83: break;
         case 3: 
           { return RegExpTT.CHARACTER;
           }
-        case 82: break;
-        case 53
+        case 84: break;
+        case 54
           { return RegExpTT.NEG_LOOKAHEAD;
           }
-        case 83: break;
-        case 41
+        case 85: break;
+        case 42
           { return RegExpTT.ESC_CTRL_CHARACTER;
           }
-        case 84: break;
+        case 86: break;
         case 23: 
           { return RegExpTT.NAME;
           }
-        case 85: break;
-        case 50
+        case 87: break;
+        case 51
           { return RegExpTT.ANDAND;
           }
-        case 86: break;
+        case 88: break;
         case 13: 
           { return RegExpTT.QUEST;
           }
-        case 87: break;
-        case 43
+        case 89: break;
+        case 44
           { return RegExpTT.CHAR_CLASS;
           }
-        case 88: break;
+        case 90: break;
         case 17: 
           { return RegExpTT.MINUS;
           }
-        case 89: break;
-        case 59
+        case 91: break;
+        case 60
           { return RegExpTT.COMMENT;
           }
-        case 90: break;
+        case 92: break;
         case 38: 
           { return yystate() != CLASS2 ? RegExpTT.BACKREF : RegExpTT.ESC_CHARACTER;
           }
-        case 91: break;
+        case 93: break;
         case 16: 
           { return RegExpTT.UNION;
           }
-        case 92: break;
-        case 44
+        case 94: break;
+        case 45
           { if (xmlSchemaMode) return RegExpTT.CHAR_CLASS; else return StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN;
           }
-        case 93: break;
-        case 54
+        case 95: break;
+        case 55
           { return RegExpTT.OCT_CHAR;
           }
-        case 94: break;
+        case 96: break;
         case 4: 
           { return RegExpTT.DOT;
           }
-        case 95: break;
+        case 97: break;
         case 32: 
           { yybegin(YYINITIAL); return RegExpTT.GROUP_END;
           }
-        case 96: break;
+        case 98: break;
         case 21: 
           { return RegExpTT.NUMBER;
           }
-        case 97: break;
-        case 45
+        case 99: break;
+        case 46
           { yypushstate(PROP); return RegExpTT.PROPERTY;
           }
-        case 98: break;
-        case 19
+        case 100: break;
+        case 18
           { return commentMode ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.CHARACTER;
           }
-        case 99: break;
+        case 101: break;
         case 33: 
           { handleOptions(); return RegExpTT.OPTIONS_OFF;
           }
-        case 100: break;
+        case 102: break;
         case 34: 
           { yybegin(YYINITIAL); return RegExpTT.COLON;
           }
-        case 101: break;
+        case 103: break;
         case 25: 
           { assert false : yytext();
           }
-        case 102: break;
+        case 104: break;
         case 27: 
           { yypopstate(); return RegExpTT.CLASS_END;
           }
-        case 103: break;
+        case 105: break;
         case 11: 
           { return RegExpTT.CARET;
           }
-        case 104: break;
+        case 106: break;
         case 1: 
           { handleOptions(); return RegExpTT.OPTIONS_ON;
           }
-        case 105: break;
+        case 107: break;
         case 29: 
           { yypopstate(); yypushback(1);
           }
-        case 106: break;
-        case 42
+        case 108: break;
+        case 43
           { return yystate() != CLASS2 ? RegExpTT.BOUNDARY : RegExpTT.ESC_CHARACTER;
           }
-        case 107: break;
-        case 18
+        case 109: break;
+        case 19
           { if (commentMode) { yypushstate(COMMENT); return RegExpTT.COMMENT; } else return RegExpTT.CHARACTER;
           }
-        case 108: break;
-        case 58
+        case 110: break;
+        case 59
           { return RegExpTT.HEX_CHAR;
           }
-        case 109: break;
+        case 111: break;
         case 20: 
           { return RegExpTT.BAD_CHARACTER;
           }
-        case 110: break;
+        case 112: break;
         case 5: 
           { return RegExpTT.GROUP_BEGIN;
           }
-        case 111: break;
+        case 113: break;
         case 8: 
           { yypushstate(CLASS2); return RegExpTT.CLASS_BEGIN;
           }
-        case 112: break;
-        case 51
+        case 114: break;
+        case 52
           { return RegExpTT.NON_CAPT_GROUP;
           }
-        case 113: break;
+        case 115: break;
         case 9: 
           { return StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN;
           }
-        case 114: break;
-        case 47
+        case 116: break;
+        case 48
           { return RegExpTT.BAD_HEX_VALUE;
           }
-        case 115: break;
+        case 117: break;
         case 2: 
           { yypopstate(); return RegExpTT.COMMENT;
           }
-        case 116: break;
-        case 46
+        case 118: break;
+        case 47
           { yypushstate(QUOTED); return RegExpTT.QUOTE_BEGIN;
           }
-        case 117: break;
+        case 119: break;
         case 26: 
           { yybegin(CLASS2); return RegExpTT.CHARACTER;
           }
-        case 118: break;
+        case 120: break;
         case 15: 
           { return RegExpTT.PLUS;
           }
-        case 119: break;
+        case 121: break;
         case 31: 
           { yybegin(YYINITIAL); return RegExpTT.BAD_CHARACTER;
           }
-        case 120: break;
+        case 122: break;
         default:
           if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
             zzAtEOF = true;
index d2784722c22802bc5d8ca5538baa07519eb4e84b..dcd94c284ed00575c3671bce3c682c53f36e2bab 100644 (file)
@@ -138,6 +138,7 @@ HEX_CHAR=[0-9a-fA-F]
 {ESCAPE}  {CONTROL}           { return RegExpTT.ESC_CTRL_CHARACTER; }
 
 {ESCAPE}  [:letter:]          { return StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN; }
+{ESCAPE}  [\n\b\t\r\f ]       { return commentMode ? RegExpTT.CHARACTER : RegExpTT.REDUNDANT_ESCAPE; }
 {ESCAPE}  {ANY}               { return RegExpTT.REDUNDANT_ESCAPE; }
 {ESCAPE}                      { return StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN; }
 
index 7578aebfabb8d8436b7847024c0d4a59793af5df..e0c7c3163d866ffc96083363377c6c9c2a7d5dea 100644 (file)
       <expected>OK</expected>
     </test>
   </bug>
+
+  <bug id="IDEA-25680">
+    <test info="true">
+      <pattern>(?x)a\ b\ c</pattern>
+      <expected>OK</expected>
+    </test>
+    <test verify="false" info="true">
+      <pattern><![CDATA[a<weak_warning descr="Redundant character escape">\ </weak_warning>b]]></pattern>
+      <expected>OK</expected>
+    </test>
+  </bug>
 </tests>
index 38ad668574e88b3ac243550b8690ba31c0c3a6a6..2ef163ed660df5dee5e917a6e7e3384316157a69 100644 (file)
@@ -36,6 +36,7 @@ private List platformImplementationModules() {
           "testFramework",
           "xml",
           "lvcs-impl",
+          "images",
   ]
 }
 
@@ -146,7 +147,7 @@ def layoutFull(String home, String targetDirectory) {
     }
 
     dir("plugins") {
-      def simplePlugins = ["commander", "copyright", "properties", "java-i18n", "images", "devkit", "eclipse"]
+      def simplePlugins = ["commander", "copyright", "properties", "java-i18n", "devkit", "eclipse"]
 
       simplePlugins.each {
         layoutPlugin it
similarity index 100%
rename from plugins/images/images.iml
rename to images/images.iml
similarity index 50%
rename from plugins/images/src/org/intellij/images/actions/ToggleTransparencyChessboardAction.java
rename to images/src/org/intellij/images/actions/ToggleTransparencyChessboardAction.java
index b9411078e86b451f68d849c400196829979a5bec..0fd76172942c9454b1d71d18d04f282e553fb2f7 100644 (file)
@@ -26,21 +26,22 @@ import org.intellij.images.ui.ImageComponentDecorator;
  * @see org.intellij.images.ui.ImageComponentDecorator#setTransparencyChessboardVisible
  */
 public final class ToggleTransparencyChessboardAction extends ToggleAction {
-    public boolean isSelected(AnActionEvent e) {
-        ImageComponentDecorator decorator = (ImageComponentDecorator) e.getDataContext().getData(ImageComponentDecorator.class.getName());
-        return decorator != null && decorator.isEnabledForActionPlace(e.getPlace()) && decorator.isTransparencyChessboardVisible();
-    }
+  public boolean isSelected(AnActionEvent e) {
+    ImageComponentDecorator decorator = (ImageComponentDecorator)e.getDataContext().getData(ImageComponentDecorator.class.getName());
+    return decorator != null && decorator.isEnabledForActionPlace(e.getPlace()) && decorator.isTransparencyChessboardVisible();
+  }
 
-    public void setSelected(AnActionEvent e, boolean state) {
-        ImageComponentDecorator decorator = (ImageComponentDecorator) e.getDataContext().getData(ImageComponentDecorator.class.getName());
-        if (decorator != null && decorator.isEnabledForActionPlace(e.getPlace())) {
-            decorator.setTransparencyChessboardVisible(state);
-        }
+  public void setSelected(AnActionEvent e, boolean state) {
+    ImageComponentDecorator decorator = (ImageComponentDecorator)e.getDataContext().getData(ImageComponentDecorator.class.getName());
+    if (decorator != null && decorator.isEnabledForActionPlace(e.getPlace())) {
+      decorator.setTransparencyChessboardVisible(state);
     }
+  }
 
-    public void update(final AnActionEvent e) {
-        super.update(e);
-        ImageComponentDecorator decorator = (ImageComponentDecorator) e.getDataContext().getData(ImageComponentDecorator.class.getName());
-        e.getPresentation().setEnabled(decorator != null && decorator.isEnabledForActionPlace(e.getPlace()));
-    }
+  public void update(final AnActionEvent e) {
+    super.update(e);
+    ImageComponentDecorator decorator = (ImageComponentDecorator)e.getDataContext().getData(ImageComponentDecorator.class.getName());
+    e.getPresentation().setEnabled(decorator != null && decorator.isEnabledForActionPlace(e.getPlace()));
+    e.getPresentation().setText(isSelected(e) ? "Hide Chessboard" : "Show Chessboard");
+  }
 }
similarity index 66%
rename from plugins/images/src/org/intellij/images/editor/actions/ToggleGridAction.java
rename to images/src/org/intellij/images/editor/actions/ToggleGridAction.java
index 07e53f81e9c7e73feb11a459d86bdf58219adb0c..53ca4b2f7354dbfa6d2677f598ecf554374b528f 100644 (file)
@@ -27,20 +27,21 @@ import org.intellij.images.editor.actionSystem.ImageEditorActionUtil;
  * @see ImageEditor#setGridVisible
  */
 public final class ToggleGridAction extends ToggleAction {
-    public boolean isSelected(AnActionEvent e) {
-        ImageEditor editor = ImageEditorActionUtil.getValidEditor(e);
-        return editor != null && editor.isGridVisible();
-    }
+  public boolean isSelected(AnActionEvent e) {
+    ImageEditor editor = ImageEditorActionUtil.getValidEditor(e);
+    return editor != null && editor.isGridVisible();
+  }
 
-    public void setSelected(AnActionEvent e, boolean state) {
-        ImageEditor editor = ImageEditorActionUtil.getValidEditor(e);
-        if (editor != null) {
-            editor.setGridVisible(state);
-        }
+  public void setSelected(AnActionEvent e, boolean state) {
+    ImageEditor editor = ImageEditorActionUtil.getValidEditor(e);
+    if (editor != null) {
+      editor.setGridVisible(state);
     }
+  }
 
-    public void update(final AnActionEvent e) {
-        super.update(e);
-        ImageEditorActionUtil.setEnabled(e);
-    }
+  public void update(final AnActionEvent e) {
+    super.update(e);
+    ImageEditorActionUtil.setEnabled(e);
+    e.getPresentation().setText(isSelected(e) ? "Hide Grid" : "Show Grid");
+  }
 }
index 90b10646826d5263061cb8c208c74cc0ed9337a4..77564966808fb44b808eafe0f3aa8eed0b005e90 100644 (file)
 package com.intellij.packaging.impl.artifacts;
 
 import com.intellij.openapi.util.UserDataHolderBase;
-import com.intellij.packaging.artifacts.ArtifactProperties;
-import com.intellij.packaging.artifacts.ArtifactPropertiesProvider;
-import com.intellij.packaging.artifacts.ArtifactType;
-import com.intellij.packaging.artifacts.ModifiableArtifact;
+import com.intellij.packaging.artifacts.*;
 import com.intellij.packaging.elements.CompositePackagingElement;
+import com.intellij.util.EventDispatcher;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.NonNls;
 
@@ -37,16 +35,23 @@ public class ArtifactImpl extends UserDataHolderBase implements ModifiableArtifa
   private String myName;
   private boolean myBuildOnMake;
   private String myOutputPath;
+  private final EventDispatcher<ArtifactListener> myDispatcher;
   private ArtifactType myArtifactType;
   private Map<ArtifactPropertiesProvider, ArtifactProperties<?>> myProperties;
 
   public ArtifactImpl(@NotNull String name, @NotNull ArtifactType artifactType, boolean buildOnMake, @NotNull CompositePackagingElement<?> rootElement,
                       String outputPath) {
+    this(name, artifactType, buildOnMake, rootElement, outputPath, null);
+  }
+  public ArtifactImpl(@NotNull String name, @NotNull ArtifactType artifactType, boolean buildOnMake, @NotNull CompositePackagingElement<?> rootElement,
+                      String outputPath,
+                      EventDispatcher<ArtifactListener> dispatcher) {
     myName = name;
     myArtifactType = artifactType;
     myBuildOnMake = buildOnMake;
     myRootElement = rootElement;
     myOutputPath = outputPath;
+    myDispatcher = dispatcher;
     myProperties = new HashMap<ArtifactPropertiesProvider, ArtifactProperties<?>>();
     resetProperties();
   }
@@ -86,8 +91,8 @@ public class ArtifactImpl extends UserDataHolderBase implements ModifiableArtifa
     return Collections.unmodifiableCollection(myProperties.keySet());
   }
 
-  public ArtifactImpl createCopy() {
-    final ArtifactImpl artifact = new ArtifactImpl(myName, myArtifactType, myBuildOnMake, myRootElement, myOutputPath);
+  public ArtifactImpl createCopy(EventDispatcher<ArtifactListener> dispatcher) {
+    final ArtifactImpl artifact = new ArtifactImpl(myName, myArtifactType, myBuildOnMake, myRootElement, myOutputPath, dispatcher);
     for (Map.Entry<ArtifactPropertiesProvider, ArtifactProperties<?>> entry : myProperties.entrySet()) {
       final ArtifactProperties newProperties = artifact.myProperties.get(entry.getKey());
       //noinspection unchecked
@@ -97,7 +102,11 @@ public class ArtifactImpl extends UserDataHolderBase implements ModifiableArtifa
   }
 
   public void setName(@NotNull String name) {
+    String oldName = myName;
     myName = name;
+    if (myDispatcher != null) {
+      myDispatcher.getMulticaster().artifactChanged(this, oldName);
+    }
   }
 
   @NonNls @Override
index adfe8b9fb574e4b49bea2eba991ab447cbb0a7d9..7ccbe70ec50fa59a3b89774afa5a2b6cd9c5ab14 100644 (file)
@@ -23,7 +23,7 @@ import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.ModificationTracker;
 import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.vfs.LocalFileSystem;
+import com.intellij.openapi.vfs.*;
 import com.intellij.packaging.artifacts.*;
 import com.intellij.packaging.elements.*;
 import com.intellij.util.containers.ContainerUtil;
@@ -52,7 +52,7 @@ public class ArtifactManagerImpl extends ArtifactManager implements ProjectCompo
   @NonNls public static final String COMPONENT_NAME = "ArtifactManager";
   @NonNls public static final String PACKAGING_ELEMENT_NAME = "element";
   @NonNls public static final String TYPE_ID_ATTRIBUTE = "id";
-  private final ArtifactManagerModel myModel = new ArtifactManagerModel();
+  private final ArtifactManagerModel myModel;
   private final Project myProject;
   private final DefaultPackagingElementResolvingContext myResolvingContext;
   private boolean myInsideCommit = false;
@@ -65,9 +65,11 @@ public class ArtifactManagerImpl extends ArtifactManager implements ProjectCompo
   };
   private Map<String, LocalFileSystem.WatchRequest> myWatchedOutputs = new HashMap<String, LocalFileSystem.WatchRequest>();
 
-  public ArtifactManagerImpl(Project project) {
+  public ArtifactManagerImpl(Project project, VirtualFileManager virtualFileManager) {
     myProject = project;
+    myModel = new ArtifactManagerModel();
     myResolvingContext = new DefaultPackagingElementResolvingContext(myProject);
+    virtualFileManager.addVirtualFileListener(new ArtifactVirtualFileListener(myProject, this), myProject);
   }
 
   @NotNull
@@ -84,6 +86,11 @@ public class ArtifactManagerImpl extends ArtifactManager implements ProjectCompo
     return myModel.getArtifactByOriginal(artifact);
   }
 
+  @NotNull
+  public Artifact getOriginalArtifact(@NotNull Artifact artifact) {
+    return myModel.getOriginalArtifact(artifact);
+  }
+
   public Collection<? extends Artifact> getArtifactsByType(@NotNull ArtifactType type) {
     return myModel.getArtifactsByType(type);
   }
@@ -182,8 +189,7 @@ public class ArtifactManagerImpl extends ArtifactManager implements ProjectCompo
     }
 
     if (myLoaded) {
-      final ArtifactModelImpl model = new ArtifactModelImpl(this);
-      model.addArtifacts(artifacts);
+      final ArtifactModelImpl model = new ArtifactModelImpl(this, artifacts);
       doCommit(model);
     }
     else {
@@ -257,10 +263,7 @@ public class ArtifactManagerImpl extends ArtifactManager implements ProjectCompo
 
   @Override
   public ModifiableArtifactModel createModifiableModel() {
-    ((ArtifactPointerManagerImpl)ArtifactPointerManager.getInstance(myProject)).updateAllPointers();
-    final ArtifactModelImpl model = new ArtifactModelImpl(this);
-    model.addArtifacts(getArtifactsList());
-    return model;
+    return new ArtifactModelImpl(this, getArtifactsList());
   }
 
   @Override
index a3db26ee4d86b0faca8e6fd1f54e9f09959cf4f6..ee67d33edb5ecad3d1173d34d92999fd67a27d5f 100644 (file)
@@ -55,6 +55,11 @@ public abstract class ArtifactModelBase implements ArtifactModel {
     return artifact;
   }
 
+  @NotNull
+  public Artifact getOriginalArtifact(@NotNull Artifact artifact) {
+    return artifact;
+  }
+
   public Collection<? extends Artifact> getArtifactsByType(@NotNull ArtifactType type) {
     final List<Artifact> result = new ArrayList<Artifact>();
     for (Artifact artifact : getArtifacts()) {
index bd4583e8073e95a0e083965ef673cb7090e479f9..2617aaf973b0f3bf0397bd8a16fa42f104738149 100644 (file)
@@ -36,16 +36,15 @@ public class ArtifactModelImpl extends ArtifactModelBase implements ModifiableAr
   private final Map<ArtifactImpl, ArtifactImpl> myModifiable2Original = new HashMap<ArtifactImpl, ArtifactImpl>();
   private final EventDispatcher<ArtifactListener> myDispatcher = EventDispatcher.create(ArtifactListener.class);
 
-  public ArtifactModelImpl(ArtifactManagerImpl artifactManager) {
+  public ArtifactModelImpl(ArtifactManagerImpl artifactManager, List<ArtifactImpl> originalArtifacts) {
     myArtifactManager = artifactManager;
-    myOriginalArtifacts = new ArrayList<ArtifactImpl>();
-  }
-
-  public void addArtifacts(List<ArtifactImpl> artifacts) {
-    for (ArtifactImpl artifact : artifacts) {
-      myOriginalArtifacts.add(artifact);
-    }
-    artifactsChanged();
+    myOriginalArtifacts = new ArrayList<ArtifactImpl>(originalArtifacts);
+    addListener(new ArtifactAdapter() {
+      @Override
+      public void artifactChanged(@NotNull Artifact artifact, @NotNull String oldName) {
+        artifactsChanged();
+      }
+    });
   }
 
   protected List<? extends Artifact> getArtifactsList() {
@@ -70,7 +69,7 @@ public class ArtifactModelImpl extends ArtifactModelBase implements ModifiableAr
   @NotNull
   public ModifiableArtifact addArtifact(@NotNull String name, @NotNull ArtifactType artifactType, CompositePackagingElement<?> rootElement) {
     final String outputPath = ArtifactUtil.getDefaultArtifactOutputPath(name, myArtifactManager.getProject());
-    final ArtifactImpl artifact = new ArtifactImpl(generateUniqueName(name), artifactType, false, rootElement, outputPath);
+    final ArtifactImpl artifact = new ArtifactImpl(generateUniqueName(name), artifactType, false, rootElement, outputPath, myDispatcher);
     myOriginalArtifacts.add(artifact);
     myArtifact2ModifiableCopy.put(artifact, artifact);
     myModifiable2Original.put(artifact, artifact);
@@ -123,7 +122,8 @@ public class ArtifactModelImpl extends ArtifactModelBase implements ModifiableAr
 
     ArtifactImpl modifiableCopy = myArtifact2ModifiableCopy.get(artifactImpl);
     if (modifiableCopy == null) {
-      modifiableCopy = artifactImpl.createCopy();
+      modifiableCopy = artifactImpl.createCopy(myDispatcher);
+      myDispatcher.getMulticaster().artifactChanged(modifiableCopy, artifact.getName());
       myArtifact2ModifiableCopy.put(artifactImpl, modifiableCopy);
       myModifiable2Original.put(modifiableCopy, artifactImpl);
       artifactsChanged();
@@ -131,7 +131,8 @@ public class ArtifactModelImpl extends ArtifactModelBase implements ModifiableAr
     return modifiableCopy;
   }
 
-  public Artifact getOriginalArtifact(Artifact artifact) {
+  @NotNull
+  public Artifact getOriginalArtifact(@NotNull Artifact artifact) {
     final ArtifactImpl original = myModifiable2Original.get(artifact);
     return original != null ? original : artifact;
   }
@@ -151,6 +152,16 @@ public class ArtifactModelImpl extends ArtifactModelBase implements ModifiableAr
     myArtifactManager.commit(this);
   }
 
+  public void dispose() {
+    List<Artifact> artifacts = new ArrayList<Artifact>();
+    for (ArtifactImpl artifact : myModifiable2Original.keySet()) {
+      if (myModifiable2Original.get(artifact).equals(artifact)) {
+        artifacts.add(artifact);
+      }
+    }
+    ((ArtifactPointerManagerImpl)ArtifactPointerManager.getInstance(myArtifactManager.getProject())).disposePointers(artifacts);
+  }
+
   @Nullable
   public ArtifactImpl getModifiableCopy(Artifact artifact) {
     //noinspection SuspiciousMethodCalls
index 23aa58e44a959f6d5543e3cf0f2d53509cca82f6..c8b6b369fc9860c7ecd862d15548be31111f1273 100644 (file)
@@ -15,9 +15,7 @@
  */
 package com.intellij.packaging.impl.artifacts;
 
-import com.intellij.openapi.project.Project;
 import com.intellij.packaging.artifacts.Artifact;
-import com.intellij.packaging.artifacts.ArtifactManager;
 import com.intellij.packaging.artifacts.ArtifactModel;
 import com.intellij.packaging.artifacts.ArtifactPointer;
 import org.jetbrains.annotations.NotNull;
@@ -26,35 +24,42 @@ import org.jetbrains.annotations.NotNull;
  * @author nik
  */
 public class ArtifactPointerImpl implements ArtifactPointer {
-  private final Project myProject;
   private String myName;
   private Artifact myArtifact;
 
-  public ArtifactPointerImpl(@NotNull Project project, @NotNull String name) {
-    myProject = project;
+  public ArtifactPointerImpl(@NotNull String name) {
     myName = name;
   }
 
+  public ArtifactPointerImpl(@NotNull Artifact artifact) {
+    myArtifact = artifact;
+    myName = artifact.getName();
+  }
+
   @NotNull
-  public String getName() {
+  public String getArtifactName() {
     return myName;
   }
 
   public Artifact getArtifact() {
-    if (myArtifact == null) {
-      myArtifact = findArtifact(ArtifactManager.getInstance(myProject));
-    }
     return myArtifact;
   }
 
+  @NotNull
+  public String getArtifactName(@NotNull ArtifactModel artifactModel) {
+    final Artifact artifact = getArtifact();
+    if (artifact != null) {
+      return artifactModel.getArtifactByOriginal(artifact).getName();
+    }
+    return myName;
+  }
+
   public Artifact findArtifact(@NotNull ArtifactModel artifactModel) {
-    if (myArtifact != null) {
-      final Artifact artifact = artifactModel.getArtifactByOriginal(myArtifact);
-      if (!artifact.equals(myArtifact)) {
-        return artifact;
-      }
+    final Artifact artifact = getArtifact();
+    if (artifact != null) {
+      return artifactModel.getArtifactByOriginal(artifact);
     }
-    return artifactModel.findArtifact(myName);
+    return null;
   }
 
   void setArtifact(Artifact artifact) {
index 4d19897f7438a33cb924cd52fa76f033dacf43b9..92401f8a24ef913e399857a8b23e1e40bd6a9a0f 100644 (file)
@@ -20,72 +20,98 @@ import com.intellij.packaging.artifacts.*;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
  * @author nik
  */
 public class ArtifactPointerManagerImpl extends ArtifactPointerManager {
+  private final Map<String, ArtifactPointerImpl> myUnresolvedPointers = new HashMap<String, ArtifactPointerImpl>();
+  private final Map<Artifact, ArtifactPointerImpl> myPointers = new HashMap<Artifact, ArtifactPointerImpl>();
   private final Project myProject;
-  private final Map<String, ArtifactPointerImpl> myPointers = new HashMap<String, ArtifactPointerImpl>();
 
   public ArtifactPointerManagerImpl(Project project) {
     myProject = project;
-    myProject.getMessageBus().connect().subscribe(ArtifactManager.TOPIC, new ArtifactAdapter() {
+    project.getMessageBus().connect().subscribe(ArtifactManager.TOPIC, new ArtifactAdapter() {
       @Override
       public void artifactRemoved(@NotNull Artifact artifact) {
-        final ArtifactPointerImpl pointer = myPointers.get(artifact.getName());
-        if (pointer != null) {
-          pointer.setArtifact(null);
-        }
+        disposePointer(artifact);
       }
 
       @Override
       public void artifactAdded(@NotNull Artifact artifact) {
-        final ArtifactPointerImpl artifactPointer = myPointers.get(artifact.getName());
-        if (artifactPointer != null) {
-          artifactPointer.setArtifact(artifact);
+        final ArtifactPointerImpl pointer = myPointers.get(artifact);
+        if (pointer != null) {
+          pointer.setName(artifact.getName());
+        }
+        
+        final ArtifactPointerImpl unresolved = myUnresolvedPointers.remove(artifact.getName());
+        if (unresolved != null) {
+          unresolved.setArtifact(artifact);
+          if (pointer == null) {
+            myPointers.put(artifact, unresolved);
+          }
         }
       }
 
       @Override
       public void artifactChanged(@NotNull Artifact artifact, @NotNull String oldName) {
-        final ArtifactPointerImpl pointer = myPointers.get(oldName);
+        final ArtifactPointerImpl pointer = myPointers.get(artifact);
         if (pointer != null) {
-          pointer.setArtifact(artifact);
-          final String newName = artifact.getName();
-          if (!newName.equals(oldName)) {
-            pointer.setName(newName);
-            myPointers.remove(oldName);
-            myPointers.put(newName, pointer);
+          pointer.setName(artifact.getName());
+        }
+        
+        final ArtifactPointerImpl unresolved = myUnresolvedPointers.remove(artifact.getName());
+        if (unresolved != null) {
+          unresolved.setArtifact(artifact);
+          if (pointer == null) {
+            myPointers.put(artifact, unresolved);
           }
         }
       }
     });
   }
 
-  public void updateAllPointers() {
-    for (ArtifactPointerImpl pointer : myPointers.values()) {
-      pointer.getArtifact();
+  private void disposePointer(Artifact artifact) {
+    final ArtifactPointerImpl pointer = myPointers.remove(artifact);
+    if (pointer != null) {
+      pointer.setArtifact(null);
+      myUnresolvedPointers.put(pointer.getArtifactName(), pointer);
     }
   }
 
-  public ArtifactPointer create(@NotNull String name) {
-    ArtifactPointerImpl pointer = myPointers.get(name);
+  public ArtifactPointer createPointer(@NotNull String name) {
+    final Artifact artifact = ArtifactManager.getInstance(myProject).findArtifact(name);
+    if (artifact != null) {
+      return createPointer(artifact);
+    }
+
+    ArtifactPointerImpl pointer = myUnresolvedPointers.get(name);
     if (pointer == null) {
-      pointer = new ArtifactPointerImpl(myProject, name);
-      myPointers.put(name, pointer);
+      pointer = new ArtifactPointerImpl(name);
+      myUnresolvedPointers.put(name, pointer);
     }
     return pointer;
   }
 
-  public ArtifactPointer create(@NotNull Artifact artifact) {
-    final String name = artifact.getName();
-    ArtifactPointerImpl pointer = myPointers.get(name);
+  public ArtifactPointer createPointer(@NotNull Artifact artifact) {
+    ArtifactPointerImpl pointer = myPointers.get(artifact);
     if (pointer == null) {
-      pointer = new ArtifactPointerImpl(myProject, name);
-      myPointers.put(artifact.getName(), pointer);
+      pointer = new ArtifactPointerImpl(artifact);
+      myPointers.put(artifact, pointer);
     }
     return pointer;
   }
+
+  @Override
+  public ArtifactPointer createPointer(@NotNull Artifact artifact, @NotNull ArtifactModel artifactModel) {
+    return createPointer(artifactModel.getOriginalArtifact(artifact));
+  }
+
+  public void disposePointers(List<Artifact> artifacts) {
+    for (Artifact artifact : artifacts) {
+      disposePointer(artifact);
+    }
+  }
 }
index 019aa3e91ecf40bf74f0e189a2f642a0e23b01d7..cf2b82412988f7a660e081a88d55c1b87baa8ff0 100644 (file)
@@ -297,7 +297,7 @@ public class ArtifactUtil {
     return result;
   }
 
-  private static void processFileOrDirectoryCopyElements(Artifact artifact,
+  public static void processFileOrDirectoryCopyElements(Artifact artifact,
                                                          PackagingElementProcessor<FileOrDirectoryCopyPackagingElement<?>> processor,
                                                          PackagingElementResolvingContext context,
                                                          boolean processSubstitutions) {
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/artifacts/ArtifactVirtualFileListener.java b/java/compiler/impl/src/com/intellij/packaging/impl/artifacts/ArtifactVirtualFileListener.java
new file mode 100644 (file)
index 0000000..0482832
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2000-2009 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.packaging.impl.artifacts;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.MultiValuesMap;
+import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.VirtualFileAdapter;
+import com.intellij.openapi.vfs.VirtualFileMoveEvent;
+import com.intellij.openapi.vfs.VirtualFilePropertyEvent;
+import com.intellij.packaging.artifacts.Artifact;
+import com.intellij.packaging.artifacts.ModifiableArtifactModel;
+import com.intellij.packaging.elements.CompositePackagingElement;
+import com.intellij.packaging.impl.elements.FileOrDirectoryCopyPackagingElement;
+import com.intellij.psi.util.CachedValue;
+import com.intellij.psi.util.CachedValueProvider;
+import com.intellij.psi.util.CachedValuesManager;
+import com.intellij.util.PathUtil;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author nik
+ */
+public class ArtifactVirtualFileListener extends VirtualFileAdapter {
+  private CachedValue<MultiValuesMap<String, Artifact>> myParentPathsToArtifacts;
+  private final ArtifactManagerImpl myArtifactManager;
+
+  public ArtifactVirtualFileListener(Project project, final ArtifactManagerImpl artifactManager) {
+    myArtifactManager = artifactManager;
+    myParentPathsToArtifacts =
+      CachedValuesManager.getManager(project).createCachedValue(new CachedValueProvider<MultiValuesMap<String, Artifact>>() {
+        public Result<MultiValuesMap<String, Artifact>> compute() {
+          MultiValuesMap<String, Artifact> result = computeParentPathToArtifactMap();
+          return Result.createSingleDependency(result, artifactManager.getModificationTracker());
+        }
+      }, false);
+  }
+
+  private MultiValuesMap<String, Artifact> computeParentPathToArtifactMap() {
+    final MultiValuesMap<String, Artifact> result = new MultiValuesMap<String, Artifact>();
+    for (final Artifact artifact : myArtifactManager.getArtifacts()) {
+      ArtifactUtil.processFileOrDirectoryCopyElements(artifact, new PackagingElementProcessor<FileOrDirectoryCopyPackagingElement<?>>() {
+        @Override
+        public boolean process(@NotNull List<CompositePackagingElement<?>> parents, @NotNull FileOrDirectoryCopyPackagingElement<?> element) {
+          String path = element.getFilePath();
+          while (path.length() > 0) {
+            result.put(path, artifact);
+            path = PathUtil.getParentPath(path);
+          }
+          return true;
+        }
+      }, myArtifactManager.getResolvingContext(), false);
+    }
+    return result;
+  }
+
+
+  @Override
+  public void fileMoved(VirtualFileMoveEvent event) {
+    final String oldPath = event.getOldParent().getPath() + "/" + event.getFileName();
+    filePathChanged(oldPath, event.getNewParent().getPath() + "/" + event.getFileName());
+  }
+
+  private void filePathChanged(@NotNull final String oldPath, @NotNull final String newPath) {
+    final Collection<Artifact> artifacts = myParentPathsToArtifacts.getValue().get(oldPath);
+    if (artifacts != null) {
+      final ModifiableArtifactModel model = myArtifactManager.createModifiableModel();
+      for (Artifact artifact : artifacts) {
+        final Artifact copy = model.getOrCreateModifiableArtifact(artifact);
+        ArtifactUtil.processFileOrDirectoryCopyElements(copy, new PackagingElementProcessor<FileOrDirectoryCopyPackagingElement<?>>() {
+          @Override
+          public boolean process(@NotNull List<CompositePackagingElement<?>> parents,
+                                 @NotNull FileOrDirectoryCopyPackagingElement<?> element) {
+            final String path = element.getFilePath();
+            if (FileUtil.startsWith(path, oldPath)) {
+              element.setFilePath(newPath + path.substring(oldPath.length()));
+            }
+            return true;
+          }
+        }, myArtifactManager.getResolvingContext(), false);
+      }
+      model.commit();
+    }
+  }
+
+  @Override
+  public void propertyChanged(VirtualFilePropertyEvent event) {
+    if (VirtualFile.PROP_NAME.equals(event.getPropertyName())) {
+      final VirtualFile parent = event.getParent();
+      if (parent != null) {
+        filePathChanged(parent.getPath() + "/" + event.getOldValue(), parent.getPath() + "/" + event.getNewValue());
+      }
+    }
+  }
+}
index 8af7d610ae70ad5db0ff07733daef6d7124f1de0..75138c8eab1ad9938188d15129bfda8502ce1f0c 100644 (file)
 package com.intellij.packaging.impl.compiler;
 
 import com.intellij.compiler.impl.packagingCompiler.DestinationInfo;
+import com.intellij.compiler.impl.packagingCompiler.ExplodedDestinationInfo;
 import com.intellij.compiler.impl.packagingCompiler.ProcessingItemsBuilderContext;
 import com.intellij.openapi.compiler.CompileContext;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.packaging.elements.ArtifactIncrementalCompilerContext;
+import org.jetbrains.annotations.NotNull;
 
 import java.util.Collection;
 
@@ -33,7 +35,11 @@ public class ArtifactsProcessingItemsBuilderContext extends ProcessingItemsBuild
     super(compileContext);
   }
 
-  public boolean addDestination(VirtualFile sourceFile, DestinationInfo destinationInfo) {
+  public boolean addDestination(@NotNull VirtualFile sourceFile, @NotNull DestinationInfo destinationInfo) {
+    if (destinationInfo instanceof ExplodedDestinationInfo && sourceFile.equals(destinationInfo.getOutputFile())) {
+      return false;
+    }
+
     if (checkOutputPath(destinationInfo.getOutputPath(), sourceFile)) {
       getOrCreateProcessingItem(sourceFile).addDestination(destinationInfo, myCollectingEnabledItems);
       return true;
index 021c9772d3f22092cab8669cb542ef722d904a60..8addfc9c57e0aa37c5d773b209edfda13c7e2bbf 100644 (file)
@@ -58,7 +58,7 @@ public class ArtifactElementType extends ComplexPackagingElementType<ArtifactPac
     List<Artifact> artifacts = context.chooseArtifacts(getAvailableArtifacts(context, artifact), CompilerBundle.message("dialog.title.choose.artifacts"));
     final List<ArtifactPackagingElement> elements = new ArrayList<ArtifactPackagingElement>();
     for (Artifact selected : artifacts) {
-      elements.add(new ArtifactPackagingElement(project, ArtifactPointerManager.getInstance(project).create(selected.getName())));
+      elements.add(new ArtifactPackagingElement(project, ArtifactPointerManager.getInstance(project).createPointer(selected, context.getArtifactModel())));
     }
     return elements;
   }
index 5995a48e54443bec1dfa17742ce7390d5d368643..4207fbbfde5f2d7ac9d03deefb913529abe967a2 100644 (file)
@@ -18,19 +18,16 @@ package com.intellij.packaging.impl.elements;
 import com.intellij.compiler.ant.BuildProperties;
 import com.intellij.compiler.ant.Generator;
 import com.intellij.openapi.project.Project;
-import com.intellij.packaging.artifacts.Artifact;
-import com.intellij.packaging.artifacts.ArtifactType;
-import com.intellij.packaging.artifacts.ArtifactPointer;
-import com.intellij.packaging.artifacts.ArtifactPointerManager;
+import com.intellij.packaging.artifacts.*;
 import com.intellij.packaging.elements.*;
 import com.intellij.packaging.impl.ui.ArtifactElementPresentation;
 import com.intellij.packaging.impl.ui.DelegatedPackagingElementPresentation;
-import com.intellij.packaging.ui.PackagingElementPresentation;
 import com.intellij.packaging.ui.ArtifactEditorContext;
+import com.intellij.packaging.ui.PackagingElementPresentation;
 import com.intellij.util.xmlb.annotations.Attribute;
+import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
-import org.jetbrains.annotations.NonNls;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -107,14 +104,14 @@ public class ArtifactPackagingElement extends ComplexPackagingElement<ArtifactPa
   public ArtifactPackagingElementState getState() {
     final ArtifactPackagingElementState state = new ArtifactPackagingElementState();
     if (myArtifactPointer != null) {
-      state.setArtifactName(myArtifactPointer.getName());
+      state.setArtifactName(myArtifactPointer.getArtifactName());
     }
     return state;
   }
 
   public void loadState(ArtifactPackagingElementState state) {
     final String name = state.getArtifactName();
-    myArtifactPointer = name != null ? ArtifactPointerManager.getInstance(myProject).create(name) : null;
+    myArtifactPointer = name != null ? ArtifactPointerManager.getInstance(myProject).createPointer(name) : null;
   }
 
   @Override
@@ -135,7 +132,7 @@ public class ArtifactPackagingElement extends ComplexPackagingElement<ArtifactPa
 
   @Nullable
   public String getArtifactName() {
-    return myArtifactPointer != null ? myArtifactPointer.getName() : null;
+    return myArtifactPointer != null ? myArtifactPointer.getArtifactName() : null;
   }
 
 
index 0ca24141838e25a550206f21544d57e675f79258..b6e4da4aeb39c888281f13eb750a5329a6f75839 100644 (file)
@@ -27,6 +27,7 @@ import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.packaging.artifacts.Artifact;
+import com.intellij.packaging.artifacts.ArtifactPointer;
 import com.intellij.packaging.artifacts.ArtifactPointerManager;
 import com.intellij.packaging.elements.*;
 import com.intellij.packaging.ui.ArtifactEditorContext;
@@ -114,7 +115,7 @@ public class PackagingElementFactoryImpl extends PackagingElementFactory {
   @NotNull
   @Override
   public PackagingElement<?> createArtifactElement(@NotNull Artifact artifact, @NotNull Project project) {
-    return new ArtifactPackagingElement(project, ArtifactPointerManager.getInstance(project).create(artifact));
+    return new ArtifactPackagingElement(project, ArtifactPointerManager.getInstance(project).createPointer(artifact));
   }
 
   @NotNull
@@ -204,6 +205,12 @@ public class PackagingElementFactoryImpl extends PackagingElementFactory {
     return elements;
   }
 
+  @NotNull
+  @Override
+  public PackagingElement<?> createArtifactElement(@NotNull ArtifactPointer artifactPointer, @NotNull Project project) {
+    return new ArtifactPackagingElement(project, artifactPointer);
+  }
+
   @NotNull
   @Override
   public PackagingElement<?> createLibraryFiles(@NotNull String libraryName, @NotNull String level, String moduleName) {
index 6040b2d44727ced42f63e19aa1c0678bcf618bbe..b2ef063f94ae8eb72c8eba3e9e241139fabd9e94 100644 (file)
@@ -32,7 +32,7 @@ import java.util.List;
 public class ArtifactChooser extends ElementsChooser<ArtifactPointer> {
   private static final Comparator<ArtifactPointer> ARTIFACT_COMPARATOR = new Comparator<ArtifactPointer>() {
     public int compare(ArtifactPointer o1, ArtifactPointer o2) {
-      return o1.getName().compareToIgnoreCase(o2.getName());
+      return o1.getArtifactName().compareToIgnoreCase(o2.getArtifactName());
     }
   };
   private static final ElementProperties INVALID_ARTIFACT_PROPERTIES = new ElementProperties() {
@@ -57,7 +57,7 @@ public class ArtifactChooser extends ElementsChooser<ArtifactPointer> {
 
   @Override
   protected String getItemText(@NotNull ArtifactPointer value) {
-    return value.getName();
+    return value.getArtifactName();
   }
 
   @Override
index d16dfac6052f79ea530c01345c822a930a292f7b..f9f8c8bcad13fbe95a012ab3e70c638785dcd43f 100644 (file)
@@ -72,7 +72,7 @@ public class BuildArtifactsBeforeRun implements BeforeRunTaskProvider<BuildArtif
       return "Build Artifacts";
     }
     if (pointers.size() == 1) {
-      return "Build '" + pointers.get(0).getName() + "' artifact";
+      return "Build '" + pointers.get(0).getArtifactName() + "' artifact";
     }
     return "Build " + pointers.size() + " artifacts";
   }
@@ -89,7 +89,7 @@ public class BuildArtifactsBeforeRun implements BeforeRunTaskProvider<BuildArtif
     final Artifact[] artifacts = ArtifactManager.getInstance(myProject).getArtifacts();
     Set<ArtifactPointer> pointers = new THashSet<ArtifactPointer>();
     for (Artifact artifact : artifacts) {
-      pointers.add(ArtifactPointerManager.getInstance(myProject).create(artifact));
+      pointers.add(ArtifactPointerManager.getInstance(myProject).createPointer(artifact));
     }
     pointers.addAll(task.getArtifactPointers());
     ArtifactChooser chooser = new ArtifactChooser(new ArrayList<ArtifactPointer>(pointers));
index 3411b1066c8aae818b7f56ffc4aee5f15ae631d5..65a1d8d36be6c8a51ce8f39855f8468bc0e07504 100644 (file)
@@ -46,7 +46,7 @@ public class BuildArtifactsBeforeRunTask extends BeforeRunTask {
     final List<Element> children = element.getChildren(ARTIFACT_ELEMENT);
     final ArtifactPointerManager pointerManager = ArtifactPointerManager.getInstance(myProject);
     for (Element child : children) {
-      myArtifactPointers.add(pointerManager.create(child.getAttributeValue(NAME_ATTRIBUTE)));
+      myArtifactPointers.add(pointerManager.createPointer(child.getAttributeValue(NAME_ATTRIBUTE)));
     }
   }
 
@@ -54,7 +54,7 @@ public class BuildArtifactsBeforeRunTask extends BeforeRunTask {
   public void writeExternal(Element element) {
     super.writeExternal(element);
     for (ArtifactPointer pointer : myArtifactPointers) {
-      element.addContent(new Element(ARTIFACT_ELEMENT).setAttribute(NAME_ATTRIBUTE, pointer.getName()));
+      element.addContent(new Element(ARTIFACT_ELEMENT).setAttribute(NAME_ATTRIBUTE, pointer.getArtifactName()));
     }
   }
 
@@ -74,14 +74,14 @@ public class BuildArtifactsBeforeRunTask extends BeforeRunTask {
   }
 
   public void addArtifact(Artifact artifact) {
-    final ArtifactPointer pointer = ArtifactPointerManager.getInstance(myProject).create(artifact);
+    final ArtifactPointer pointer = ArtifactPointerManager.getInstance(myProject).createPointer(artifact);
     if (!myArtifactPointers.contains(pointer)) {
       myArtifactPointers.add(pointer);
     }
   }
 
   public void removeArtifact(Artifact artifact) {
-    myArtifactPointers.remove(ArtifactPointerManager.getInstance(myProject).create(artifact));
+    myArtifactPointers.remove(ArtifactPointerManager.getInstance(myProject).createPointer(artifact));
   }
 
   public boolean equals(Object o) {
index 2daa2a0b324ad62e408bf34904ab1132f75c9a9c..a9dabbf9f02db5842318582394ddd55691bdf1e2 100644 (file)
@@ -24,43 +24,51 @@ import com.intellij.packaging.ui.PackagingElementWeights;
 import com.intellij.packaging.ui.TreeNodePresentation;
 import com.intellij.ui.SimpleTextAttributes;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 /**
  * @author nik
  */
 public class ArtifactElementPresentation extends TreeNodePresentation {
-  private final Artifact myArtifact;
+  private final ArtifactPointer myArtifactPointer;
   private final ArtifactEditorContext myContext;
-  private final String myName;
 
   public ArtifactElementPresentation(ArtifactPointer artifactPointer, ArtifactEditorContext context) {
-    myName = artifactPointer != null ? artifactPointer.getName() : "<unknown>";
-    myArtifact = artifactPointer != null ? artifactPointer.findArtifact(context.getArtifactModel()) : null;
+    myArtifactPointer = artifactPointer;
     myContext = context;
   }
 
   public String getPresentableName() {
-    return myName;
+    return myArtifactPointer != null ? myArtifactPointer.getArtifactName(myContext.getArtifactModel()) : "<unknown>";
   }
 
   @Override
   public boolean canNavigateToSource() {
-    return myArtifact != null;
+    return findArtifact() != null;
   }
 
   @Override
   public Object getSourceObject() {
-    return myArtifact;
+    return myArtifactPointer;
   }
 
   @Override
   public void navigateToSource() {
-    myContext.selectArtifact(myArtifact);
+    final Artifact artifact = findArtifact();
+    if (artifact != null) {
+      myContext.selectArtifact(artifact);
+    }
   }
 
   public void render(@NotNull PresentationData presentationData, SimpleTextAttributes mainAttributes, SimpleTextAttributes commentAttributes) {
-    presentationData.setIcons(myArtifact != null ? myArtifact.getArtifactType().getIcon() : PlainArtifactType.ARTIFACT_ICON);
-    presentationData.addText(myName, myArtifact != null ? mainAttributes : SimpleTextAttributes.ERROR_ATTRIBUTES);
+    final Artifact artifact = findArtifact();
+    presentationData.setIcons(artifact != null ? artifact.getArtifactType().getIcon() : PlainArtifactType.ARTIFACT_ICON);
+    presentationData.addText(getPresentableName(), artifact != null ? mainAttributes : SimpleTextAttributes.ERROR_ATTRIBUTES);
+  }
+
+  @Nullable
+  private Artifact findArtifact() {
+    return myArtifactPointer != null ? myArtifactPointer.findArtifact(myContext.getArtifactModel()) : null;
   }
 
   @Override
index 4c339a000d722828cfbcd7a42779b71f1b88c9c1..1a11ecbb4c67c0fa5e420cc752999a8888b81754 100644 (file)
@@ -33,5 +33,8 @@ public interface ArtifactModel {
   @NotNull
   Artifact getArtifactByOriginal(@NotNull Artifact artifact);
 
+  @NotNull
+  Artifact getOriginalArtifact(@NotNull Artifact artifact);
+
   Collection<? extends Artifact> getArtifactsByType(@NotNull ArtifactType type);
 }
index 78908d8d8815e5709cd655c95dc3a0c86e79d432..ee1ed1c5390fb4a9ae2f6ebfceebf9839647ed50 100644 (file)
@@ -24,11 +24,14 @@ import org.jetbrains.annotations.NotNull;
 public interface ArtifactPointer {
 
   @NotNull
-  String getName();
+  String getArtifactName();
 
   @Nullable
   Artifact getArtifact();
 
+  @NotNull
+  String getArtifactName(@NotNull ArtifactModel artifactModel);
+
   @Nullable
   Artifact findArtifact(@NotNull ArtifactModel artifactModel);
 
index f6927e12dc283b7e729192235e16097441e13eb9..c5f32f480c436709e8aa88d0f5d237c774beb87e 100644 (file)
@@ -27,7 +27,9 @@ public abstract class ArtifactPointerManager {
     return ServiceManager.getService(project, ArtifactPointerManager.class);
   }
 
-  public abstract ArtifactPointer create(@NotNull String name);
+  public abstract ArtifactPointer createPointer(@NotNull String name);
 
-  public abstract ArtifactPointer create(@NotNull Artifact artifact);
+  public abstract ArtifactPointer createPointer(@NotNull Artifact artifact);
+
+  public abstract ArtifactPointer createPointer(@NotNull Artifact artifact, @NotNull ArtifactModel artifactModel);
 }
index 50d16dad85c640ff392e303793bac97dd3f6e17f..5e6172f8e6c2af861dd367a09fe068645d4b607d 100644 (file)
@@ -35,10 +35,17 @@ public interface ModifiableArtifactModel extends ArtifactModel {
   @NotNull
   ModifiableArtifact getOrCreateModifiableArtifact(@NotNull Artifact artifact);
 
+  @Nullable
+  Artifact getModifiableCopy(Artifact artifact);
+
+  void addListener(@NotNull ArtifactListener listener);
+
+  void removeListener(@NotNull ArtifactListener listener);
+
+
   boolean isModified();
 
   void commit();
 
-  @Nullable
-  Artifact getModifiableCopy(Artifact artifact);
+  void dispose();
 }
index 179477db3faa18675fa53b56cd70627f078b5cba..7401a31d0e555ec99fff74b09cdc76a2d731e3ef 100644 (file)
@@ -20,6 +20,7 @@ import com.intellij.openapi.module.Module;
 import com.intellij.openapi.roots.libraries.Library;
 import com.intellij.openapi.project.Project;
 import com.intellij.packaging.artifacts.Artifact;
+import com.intellij.packaging.artifacts.ArtifactPointer;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -53,6 +54,9 @@ public abstract class PackagingElementFactory {
   @NotNull
   public abstract List<? extends PackagingElement<?>> createLibraryElements(@NotNull Library library);
 
+  @NotNull
+  public abstract PackagingElement<?> createArtifactElement(@NotNull ArtifactPointer artifactPointer, @NotNull Project project);
+
   @NotNull
   public abstract PackagingElement<?> createArtifactElement(@NotNull Artifact artifact, @NotNull Project project);
 
index 9789be138d177dbd6e28729ad93b0db9131b98b2..fefa73aaf7baf505d5a1730545649825b42a5e33 100644 (file)
@@ -73,7 +73,7 @@ public class ImportMode extends WizardMode {
   }
 
   public boolean isAvailable(WizardContext context) {
-    return true;
+    return Extensions.getExtensions(ProjectImportProvider.PROJECT_IMPORT_PROVIDER).length > 0;
   }
 
   @Nullable
index 6f3ade014cf355be573258bffa6f2256860c95ad..fe32672e469940ae6007c6b7dfe7c550a2897ca2 100644 (file)
@@ -22,7 +22,6 @@ import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigur
 import com.intellij.openapi.util.Disposer;
 import com.intellij.packaging.artifacts.*;
 import com.intellij.packaging.elements.CompositePackagingElement;
-import com.intellij.packaging.impl.artifacts.ArtifactModelImpl;
 import com.intellij.packaging.impl.artifacts.ArtifactUtil;
 import com.intellij.packaging.ui.ManifestFileConfiguration;
 import org.jetbrains.annotations.NotNull;
@@ -69,7 +68,7 @@ class ArtifactsStructureConfigurableContextImpl implements ArtifactsStructureCon
   @NotNull
   public Artifact getOriginalArtifact(@NotNull Artifact artifact) {
     if (myModifiableModel != null) {
-      return ((ArtifactModelImpl)myModifiableModel).getOriginalArtifact(artifact);
+      return myModifiableModel.getOriginalArtifact(artifact);
     }
     return artifact;
   }
@@ -108,7 +107,7 @@ class ArtifactsStructureConfigurableContextImpl implements ArtifactsStructureCon
     artifact = getOriginalArtifact(artifact);
     ArtifactEditorImpl artifactEditor = myArtifactEditors.get(artifact);
     if (artifactEditor == null) {
-      final ArtifactEditorSettings settings = myEditorSettings.get(ArtifactPointerManager.getInstance(myProject).create(artifact));
+      final ArtifactEditorSettings settings = myEditorSettings.get(ArtifactPointerManager.getInstance(myProject).createPointer(artifact, getArtifactModel()));
       artifactEditor = new ArtifactEditorImpl(this, artifact, settings != null ? settings : myDefaultSettings);
       myArtifactEditors.put(artifact, artifactEditor);
     }
@@ -124,7 +123,7 @@ class ArtifactsStructureConfigurableContextImpl implements ArtifactsStructureCon
   public ModifiableArtifactModel getModifiableArtifactModel() {
     if (myModifiableModel == null) {
       myModifiableModel = ArtifactManager.getInstance(myProject).createModifiableModel();
-      ((ArtifactModelImpl)myModifiableModel).addListener(myModifiableModelListener);
+      myModifiableModel.addListener(myModifiableModelListener);
     }
     return myModifiableModel;
   }
@@ -168,12 +167,15 @@ class ArtifactsStructureConfigurableContextImpl implements ArtifactsStructureCon
       Disposer.dispose(editor);
     }
     myArtifactEditors.clear();
+    if (myModifiableModel != null) {
+      myModifiableModel.dispose();
+    }
   }
 
   public void saveEditorSettings() {
     myEditorSettings.clear();
     for (ArtifactEditorImpl artifactEditor : myArtifactEditors.values()) {
-      final ArtifactPointer pointer = ArtifactPointerManager.getInstance(myProject).create(artifactEditor.getArtifact());
+      final ArtifactPointer pointer = ArtifactPointerManager.getInstance(myProject).createPointer(artifactEditor.getArtifact(), getArtifactModel());
       myEditorSettings.put(pointer, artifactEditor.createSettings());
     }
   }
index 90854fce96bf1348067b8263ba5e1b95bd7bfe49..e9af366c37e41974284dbece433d17212fd0a3e6 100644 (file)
@@ -484,6 +484,7 @@ public class LayoutTreeComponent implements DnDTarget, Disposable {
         if (myCurrentPanel != null) {
           myPropertiesPanel.add(BorderLayout.CENTER, ScrollPaneFactory.createScrollPane(myCurrentPanel.createComponent()));
           myCurrentPanel.reset();
+          myPropertiesPanel.revalidate();
         }
       }
     }
index bc96b49d0686821259652f3e63a389bc971cfe90..f3cb59b7db44644bb29345ccb6a82a88c17ca3b7 100644 (file)
@@ -16,7 +16,6 @@
 package com.intellij.openapi.roots.ui.configuration.artifacts.actions;
 
 import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.project.DumbAwareAction;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.project.ProjectBundle;
 import com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactEditorEx;
@@ -71,7 +70,7 @@ public class ExtractArtifactAction extends LayoutTreeActionBase {
           for (PackagingElement element : selectedElements) {
             parent.removeChild(element);
           }
-          parent.addOrFindChild(new ArtifactPackagingElement(project, ArtifactPointerManager.getInstance(project).create(artifact)));
+          parent.addOrFindChild(new ArtifactPackagingElement(project, ArtifactPointerManager.getInstance(project).createPointer(artifact, myArtifactEditor.getContext().getArtifactModel())));
         }
       });
       treeComponent.rebuildTree();
index b393f4785910f056985aabe66770f4411548f97b..e56a47bc42c43b6a65eb77cd5ea87983a0276282 100644 (file)
  */
 package com.intellij.openapi.roots.ui.configuration.artifacts.sourceItems;
 
+import com.intellij.openapi.project.Project;
 import com.intellij.packaging.artifacts.Artifact;
-import com.intellij.packaging.artifacts.ArtifactPointerManager;
 import com.intellij.packaging.artifacts.ArtifactPointer;
+import com.intellij.packaging.artifacts.ArtifactPointerManager;
 import com.intellij.packaging.elements.PackagingElement;
 import com.intellij.packaging.elements.PackagingElementFactory;
 import com.intellij.packaging.elements.PackagingElementOutputKind;
 import com.intellij.packaging.impl.artifacts.JarArtifactType;
 import com.intellij.packaging.impl.ui.ArtifactElementPresentation;
-import com.intellij.packaging.ui.*;
+import com.intellij.packaging.ui.ArtifactEditorContext;
+import com.intellij.packaging.ui.PackagingSourceItem;
+import com.intellij.packaging.ui.SourceItemPresentation;
+import com.intellij.packaging.ui.SourceItemWeights;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.Collections;
@@ -40,7 +44,7 @@ public class ArtifactSourceItem extends PackagingSourceItem {
   }
 
   public SourceItemPresentation createPresentation(@NotNull ArtifactEditorContext context) {
-    final ArtifactPointer pointer = ArtifactPointerManager.getInstance(context.getProject()).create(myArtifact);
+    final ArtifactPointer pointer = ArtifactPointerManager.getInstance(context.getProject()).createPointer(myArtifact, context.getArtifactModel());
     return new DelegatedSourceItemPresentation(new ArtifactElementPresentation(pointer, context)) {
       @Override
       public int getWeight() {
@@ -51,7 +55,9 @@ public class ArtifactSourceItem extends PackagingSourceItem {
 
   @NotNull
   public List<? extends PackagingElement<?>> createElements(@NotNull ArtifactEditorContext context) {
-    return Collections.singletonList(PackagingElementFactory.getInstance().createArtifactElement(myArtifact, context.getProject()));
+    final Project project = context.getProject();
+    final ArtifactPointer pointer = ArtifactPointerManager.getInstance(project).createPointer(myArtifact, context.getArtifactModel());
+    return Collections.singletonList(PackagingElementFactory.getInstance().createArtifactElement(pointer, project));
   }
 
   public boolean equals(Object obj) {
index fa7dd2ba8ffe0e46eaf18368b4170bc62ae28dc5..a9b2b9bd3ae30a072afe920d17d7ac3320dd36a7 100644 (file)
@@ -21,6 +21,7 @@ import com.intellij.codeInsight.daemon.JavaErrorMessages;
 import com.intellij.codeInsight.daemon.impl.*;
 import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction;
 import com.intellij.codeInsight.daemon.impl.quickfix.SetupJDKFix;
+import com.intellij.lang.injection.InjectedLanguageManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.progress.ProgressManager;
@@ -98,13 +99,10 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
   }  
 
   public boolean suitableForFile(PsiFile file) {
-    return true;
+    return !InjectedLanguageManager.getInstance(file.getProject()).isInjectedFragment(file);
   }
 
   public void visit(PsiElement element, HighlightInfoHolder holder) {
-    if (!holder.isWritable()) {
-      throw new UnsupportedOperationException();
-    }
     myHolder = holder;
 
     if (LOG.isDebugEnabled()) {
@@ -689,7 +687,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
   }
 
   @Override public void visitReferenceElement(PsiJavaCodeReferenceElement ref) {
-    JavaResolveResult result = null;
+    JavaResolveResult result;
     try {
       result = ref.advancedResolve(true);
     }
@@ -747,7 +745,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
       visitExpression(expression);
       if (myHolder.hasErrorResults()) return;
     }
-    JavaResolveResult result = null;
+    JavaResolveResult result;
     try {
       result = expression.advancedResolve(false);
     }
index 13e84b26958cc6b28d2ca39f5afcae3b02e49145..14f04687e1c4bec56d7aa97fb2c6880eb2736e79 100644 (file)
@@ -143,7 +143,7 @@ public class CreateLocalVarFromInstanceofAction extends BaseIntentionAction {
 
   private static boolean atSameLine(final PsiExpression condition, final Editor editor) {
     int line = editor.getCaretModel().getLogicalPosition().line;
-    return editor.offsetToLogicalPosition(condition.getTextOffset()).line == line;
+    return editor.getDocument().getLineNumber(condition.getTextOffset()) == line;
   }
 
   public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) {
index 052b5f897625b211e4299d6168958eba0298d7af..b0480784f5e396ea060290f9ae8a8f158cad2820 100644 (file)
@@ -88,7 +88,7 @@ public class JavaTypedHandler extends TypedHandlerDelegate {
     if (originalFileType == StdFileTypes.JAVA && c == '{') {
       int offset = editor.getCaretModel().getOffset();
       HighlighterIterator iterator = ((EditorEx) editor).getHighlighter().createIterator(offset - 1);
-      while (iterator.getTokenType() != null && iterator.getTokenType() == TokenType.WHITE_SPACE) {
+      while (iterator.getTokenType() == TokenType.WHITE_SPACE) {
         iterator.retreat();
       }
       if (iterator.getTokenType() == JavaTokenType.RBRACKET || iterator.getTokenType() == JavaTokenType.EQ) {
@@ -101,6 +101,7 @@ public class JavaTypedHandler extends TypedHandlerDelegate {
       }
       if (PsiTreeUtil.getParentOfType(leaf, PsiCodeBlock.class, false, PsiMember.class) != null) {
         EditorModificationUtil.insertStringAtCaret(editor, "{", false, true);
+        TypedHandler.indentOpenedBrace(project, editor);
         return Result.STOP;
       }
     }
index 04da7b25e003f56d71ad0b7b1810afdd7b99e457..033ff9d0d69eb9039381a345c5f7a0f986271804 100644 (file)
@@ -29,6 +29,7 @@ import com.intellij.codeInspection.deprecation.DeprecationInspection;
 import com.intellij.codeInspection.duplicateThrows.DuplicateThrowsInspection;
 import com.intellij.codeInspection.emptyMethod.EmptyMethodInspection;
 import com.intellij.codeInspection.equalsAndHashcode.EqualsAndHashcode;
+import com.intellij.codeInspection.inconsistentLanguageLevel.InconsistentLanguageLevelInspection;
 import com.intellij.codeInspection.java15api.Java15APIUsageInspection;
 import com.intellij.codeInspection.javaDoc.JavaDocLocalInspection;
 import com.intellij.codeInspection.javaDoc.JavaDocReferenceInspection;
@@ -65,6 +66,7 @@ public class StandardInspectionToolsProvider implements InspectionToolProvider {
     return new Class[] {
       DeadCodeInspection.class,
       UnusedLibrariesInspection.class,
+      InconsistentLanguageLevelInspection.class,
       VisibilityInspection.class,
       CanBeFinalInspection.class,
       UnusedParametersInspection.class,
diff --git a/java/java-impl/src/com/intellij/codeInspection/inconsistentLanguageLevel/InconsistentLanguageLevelInspection.java b/java/java-impl/src/com/intellij/codeInspection/inconsistentLanguageLevel/InconsistentLanguageLevelInspection.java
new file mode 100644 (file)
index 0000000..cbbc526
--- /dev/null
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2000-2009 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.
+ */
+
+/*
+ * User: anna
+ * Date: 03-Nov-2009
+ */
+package com.intellij.codeInspection.inconsistentLanguageLevel;
+
+import com.intellij.analysis.AnalysisScope;
+import com.intellij.codeInsight.daemon.GroupNames;
+import com.intellij.codeInspection.*;
+import com.intellij.codeInspection.ex.DescriptorProviderInspection;
+import com.intellij.codeInspection.ex.JobDescriptor;
+import com.intellij.codeInspection.reference.RefModule;
+import com.intellij.codeInspection.unnecessaryModuleDependency.UnnecessaryModuleDependencyInspection;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleUtil;
+import com.intellij.openapi.options.ShowSettingsUtil;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.project.ProjectBundle;
+import com.intellij.openapi.roots.*;
+import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService;
+import com.intellij.pom.java.LanguageLevel;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiElementVisitor;
+import com.intellij.psi.PsiFile;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class InconsistentLanguageLevelInspection extends DescriptorProviderInspection{
+  private static final Logger LOGGER = Logger.getInstance("#" + InconsistentLanguageLevelInspection.class.getName());
+
+  public void runInspection(AnalysisScope scope, InspectionManager manager) {
+    final Set<Module> modules = new HashSet<Module>();
+    scope.accept(new PsiElementVisitor(){
+      public void visitElement(PsiElement element) {
+        final Module module = ModuleUtil.findModuleForPsiElement(element);
+        if (module != null) {
+          modules.add(module);
+        }
+      }
+    });
+
+    if (!modules.isEmpty()) {
+      final LanguageLevel projectLanguageLevel =
+        LanguageLevelProjectExtension.getInstance(modules.iterator().next().getProject()).getLanguageLevel();
+      for (Module module : modules) {
+        LanguageLevel languageLevel = LanguageLevelModuleExtension.getInstance(module).getLanguageLevel();
+        if (languageLevel == null) {
+          languageLevel = projectLanguageLevel;
+        }
+        LOGGER.assertTrue(languageLevel != null);
+        final RefModule refModule = getRefManager().getRefModule(module);
+        for (OrderEntry entry : ModuleRootManager.getInstance(module).getOrderEntries()) {
+          if (entry instanceof ModuleOrderEntry) {
+            final Module dependantModule = ((ModuleOrderEntry)entry).getModule();
+            if (dependantModule != null) {
+              LanguageLevel dependantLanguageLevel = LanguageLevelModuleExtension.getInstance(dependantModule).getLanguageLevel();
+              if (dependantLanguageLevel == null) {
+                dependantLanguageLevel = projectLanguageLevel;
+              }
+              LOGGER.assertTrue(dependantLanguageLevel != null);
+              if (languageLevel.compareTo(dependantLanguageLevel) < 0) {
+                final CommonProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
+                  "Inconsistent language level settings: module " + module.getName() + " with language level " + languageLevel +
+                  " depends on module " + dependantModule.getName() +" with language level " + dependantLanguageLevel,
+                  new UnnecessaryModuleDependencyInspection.RemoveModuleDependencyFix(module, dependantModule),
+                  new OpenModuleSettingsFix(module));
+                addProblemElement(refModule, problemDescriptor);
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+
+  public boolean isGraphNeeded() {
+    return false;
+  }
+
+  @NotNull
+  public JobDescriptor[] getJobDescriptors() {
+    return JobDescriptor.EMPTY_ARRAY;
+  }
+
+  public boolean isEnabledByDefault() {
+    return false;
+  }
+
+  @Nls
+  @NotNull
+  public String getGroupDisplayName() {
+    return GroupNames.MODULARIZATION_GROUP_NAME;
+  }
+
+  @NotNull
+  public String getDisplayName() {
+    return "Inconsistent language level settings";
+  }
+
+  @NonNls
+  @NotNull
+  public String getShortName() {
+    return "InconsistentLanguageLevel";
+  }
+
+  private static class OpenModuleSettingsFix implements QuickFix {
+    private Module myModule;
+
+    private OpenModuleSettingsFix(Module module) {
+      myModule = module;
+    }
+
+    @NotNull
+    public String getName() {
+      return "Open module " + myModule.getName() + " settings";
+    }
+
+    @NotNull
+    public String getFamilyName() {
+      return getName();
+    }
+
+    public void applyFix(@NotNull Project project, @NotNull CommonProblemDescriptor descriptor) {
+      if (!myModule.isDisposed()) {
+        ProjectSettingsService.getInstance(project).showModuleConfigurationDialog(myModule.getName(), ProjectBundle.message("modules.classpath.title"), false);
+      }
+    }
+  }
+}
\ No newline at end of file
index 1ad8c8b0b413d422737ea33581b1813245e149f5..19a2863ca5a17566a0b52932f21d091fa8467bcf 100644 (file)
@@ -44,31 +44,8 @@ public class UnnecessaryModuleDependencyInspection extends GlobalInspectionTool
       for (final Module dependency : declaredDependencies) {
         if (scope.contains(dependency.getModuleFile())) { //external references are rejected -> annotator doesn't provide any information on them -> false positives
           if (modules == null || !modules.contains(dependency)) {
-            descriptors.add(manager.createProblemDescriptor(InspectionsBundle.message("unnecessary.module.dependency.problem.descriptor", module.getName(), dependency.getName()), new QuickFix(){
-              @NotNull
-              public String getName() {
-                return "Remove dependency";
-              }
-
-              @NotNull
-              public String getFamilyName() {
-                return getName();
-              }
-
-              public void applyFix(@NotNull Project project, @NotNull CommonProblemDescriptor descriptor) {
-                final ModifiableRootModel model = ModuleRootManager.getInstance(module).getModifiableModel();
-                for (OrderEntry entry : model.getOrderEntries()) {
-                  if (entry instanceof ModuleOrderEntry) {
-                    final Module mDependency = ((ModuleOrderEntry)entry).getModule();
-                    if (Comparing.equal(mDependency, dependency)) {
-                      model.removeOrderEntry(entry);
-                      break;
-                    }
-                  }
-                }
-                model.commit();
-              }
-            }));
+            descriptors.add(manager.createProblemDescriptor(InspectionsBundle.message("unnecessary.module.dependency.problem.descriptor", module.getName(), dependency.getName()),
+                                                            new RemoveModuleDependencyFix(module, dependency)));
           }
         }
       }
@@ -92,4 +69,38 @@ public class UnnecessaryModuleDependencyInspection extends GlobalInspectionTool
   public String getShortName() {
     return "UnnecessaryModuleDependencyInspection";
   }
+
+  public static class RemoveModuleDependencyFix implements QuickFix {
+    private final Module myModule;
+    private final Module myDependency;
+
+    public RemoveModuleDependencyFix(Module module, Module dependency) {
+      myModule = module;
+      myDependency = dependency;
+    }
+
+    @NotNull
+    public String getName() {
+      return "Remove dependency";
+    }
+
+    @NotNull
+    public String getFamilyName() {
+      return getName();
+    }
+
+    public void applyFix(@NotNull Project project, @NotNull CommonProblemDescriptor descriptor) {
+      final ModifiableRootModel model = ModuleRootManager.getInstance(myModule).getModifiableModel();
+      for (OrderEntry entry : model.getOrderEntries()) {
+        if (entry instanceof ModuleOrderEntry) {
+          final Module mDependency = ((ModuleOrderEntry)entry).getModule();
+          if (Comparing.equal(mDependency, myDependency)) {
+            model.removeOrderEntry(entry);
+            break;
+          }
+        }
+      }
+      model.commit();
+    }
+  }
 }
index 1e4f5edd2beb8b57c764e8b5af39d86a5750c838..fb5a995ba555fec9eb0e6d4909b2029b4f861566 100644 (file)
@@ -77,9 +77,8 @@ public class DefaultSymbolNavigationContributor implements ChooseByNameContribut
 
   private static PsiMethod[] filterInheritedMethods(PsiMethod[] methods) {
     ArrayList<PsiMethod> list = new ArrayList<PsiMethod>(methods.length);
-    ProgressManager progressManager = ProgressManager.getInstance();
     for (PsiMethod method : methods) {
-      progressManager.checkCanceled();
+      ProgressManager.checkCanceled();
       if (method.isConstructor()) continue;
       PsiMethod[] supers = method.findSuperMethods();
       if (supers.length > 0) continue;
@@ -143,4 +142,4 @@ public class DefaultSymbolNavigationContributor implements ChooseByNameContribut
     }
   }
 
-}
\ No newline at end of file
+}
index 5de1c60db95c65f59a73de2596489065541b5f78..85047bb2e9311eb95cb2f8eba6f84dbf72e6509d 100644 (file)
@@ -30,7 +30,6 @@ import com.intellij.openapi.util.NotNullLazyKey;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.impl.PsiManagerEx;
 import com.intellij.util.ConcurrencyUtil;
-import com.intellij.util.NotNullFunction;
 import com.intellij.util.containers.ConcurrentWeakHashMap;
 import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.NotNull;
@@ -44,12 +43,7 @@ public class ControlFlowFactory {
   // psiElements hold weakly, controlFlows softly
   private final ConcurrentMap<PsiElement, Reference<CopyOnWriteArrayList<ControlFlowContext>>> cachedFlows = new ConcurrentWeakHashMap<PsiElement, Reference<CopyOnWriteArrayList<ControlFlowContext>>>();
 
-  private static final NotNullLazyKey<ControlFlowFactory, Project> INSTANCE_KEY = NotNullLazyKey.create("ControlFlowFactory.Instance.Cache", new NotNullFunction<Project, ControlFlowFactory>() {
-    @NotNull
-    public ControlFlowFactory fun(final Project project) {
-      return ServiceManager.getService(project, ControlFlowFactory.class);
-    }
-  });
+  private static final NotNullLazyKey<ControlFlowFactory, Project> INSTANCE_KEY = ServiceManager.createLazyKey(ControlFlowFactory.class);
 
   public static ControlFlowFactory getInstance(Project project) {
     return INSTANCE_KEY.getValue(project);
index ed38b7d69558f23f59d9f3185c95844bf8468109..9c3cf73d8ada3f39d15276056f08550e307d7d7f 100644 (file)
@@ -19,7 +19,6 @@ import com.intellij.find.findUsages.FindUsagesOptions;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.Key;
 import com.intellij.psi.*;
-import com.intellij.psi.search.PsiSearchHelper;
 import com.intellij.psi.search.searches.MethodReferencesSearch;
 import com.intellij.psi.util.PsiFormatUtil;
 import com.intellij.usageView.UsageInfo;
@@ -90,7 +89,6 @@ public class ThrowSearchUtil {
         final PsiMethod method = deepestSuperMethod != null ? deepestSuperMethod : (PsiMethod)elem;
         if (!processed.contains(method)) {
           processed.add(method);
-          PsiSearchHelper helper = method.getManager().getSearchHelper();
           final PsiReference[] refs = MethodReferencesSearch.search(method, options.searchScope, true).toArray(PsiReference.EMPTY_ARRAY);
           for (int i = 0; i != refs.length; ++i) {
             scanCatches(refs[i].getElement(), processor, root, options, processed);
index 4e4e1ca854c3282345c9c8d7142363654b2f5f09..9312cd73248fe20b377194a3018ccabdb4c9c274 100644 (file)
@@ -19,12 +19,14 @@ import com.intellij.codeInsight.daemon.impl.analysis.AnnotationsHighlightUtil;
 import com.intellij.lang.ASTNode;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.PsiImplUtil;
 import com.intellij.psi.impl.source.tree.*;
 import com.intellij.psi.scope.PsiScopeProcessor;
 import com.intellij.psi.tree.IElementType;
 import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.Function;
 import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.PatchedSoftReference;
@@ -132,7 +134,7 @@ public class PsiTypeElementImpl extends CompositePsiElement implements PsiTypeEl
     PsiType type = cached == null ? null : cached.get();
     if (type != null) return type;
     try {
-      String combinedAnnos = StringUtil.join(getApplicableAnnotations(), ANNOTATION_TEXT, " ");
+      String combinedAnnos = getCombinedAnnosText();
       String text = combinedAnnos.length() == 0 ? getText().trim() : combinedAnnos + " " + getText().trim();
       type = JavaPsiFacade.getInstance(getProject()).getElementFactory().createTypeFromText(text, context);
       myCachedDetachedType = new PatchedSoftReference<PsiType>(type);
@@ -143,6 +145,13 @@ public class PsiTypeElementImpl extends CompositePsiElement implements PsiTypeEl
     return type;
   }
 
+  @NotNull
+  private String getCombinedAnnosText() {
+    boolean typeAnnotationsSupported = PsiUtil.getLanguageLevel(this).isAtLeast(LanguageLevel.JDK_1_7);
+    if (!typeAnnotationsSupported) return "";
+    return StringUtil.join(getApplicableAnnotations(), ANNOTATION_TEXT, " ");
+  }
+
   private static final Function<PsiAnnotation, String> ANNOTATION_TEXT = new Function<PsiAnnotation, String>() {
     public String fun(PsiAnnotation psiAnnotation) {
       return psiAnnotation.getText();
index 2ee48785b5e61907bda52ab5d2c266b1a2d89014..ff5fdaa291f9a715017137d97b09c0ccc671e788 100644 (file)
@@ -92,13 +92,19 @@ public class ClassResolverProcessor extends BaseScopeProcessor implements NameHi
     }
   }
 
-  private static boolean isOnDemand(PsiElement fileContext, PsiClass psiClass) {
+  private boolean isOnDemand(PsiElement fileContext, PsiClass psiClass) {
     if (fileContext instanceof PsiImportStatementBase) {
       return ((PsiImportStatementBase)fileContext).isOnDemand();
     }
     String fqn = psiClass.getQualifiedName();
     if (fqn == null) return false;
-    return "java.lang".equals(StringUtil.getPackageName(fqn));
+    String packageName = StringUtil.getPackageName(fqn);
+    if ("java.lang".equals(packageName)) return true;
+
+    // class from my package imported implicitly
+    PsiFile file = myPlace == null ? null : FileContextUtil.getContextFile(myPlace);
+    
+    return file instanceof PsiJavaFile && ((PsiJavaFile)file).getPackageName().equals(packageName);
   }
 
   public boolean execute(PsiElement element, ResolveState state) {
@@ -154,9 +160,7 @@ public class ClassResolverProcessor extends BaseScopeProcessor implements NameHi
     myCandidates.add(new ClassCandidateInfo(aClass, state.get(PsiSubstitutor.KEY), !accessible, myCurrentFileContext));
     myResult = null;
     if (!accessible) return true;
-    if (!(myCurrentFileContext instanceof PsiImportStatementBase)) return false;
-
-    return true;
+    return myCurrentFileContext instanceof PsiImportStatementBase;
   }
 
   private boolean checkAccessibility(final PsiClass aClass) {
index 107b8f4ec629372d0b44bbf66a6f802b18fa7bbb..2ea655fbb772eb03e7fb7b46ba9df8a69eb4710a 100644 (file)
@@ -31,7 +31,6 @@ import com.intellij.psi.PsiVariable;
 import com.intellij.psi.impl.PsiManagerEx;
 import com.intellij.util.ConcurrencyUtil;
 import com.intellij.util.Function;
-import com.intellij.util.NotNullFunction;
 import com.intellij.util.containers.ConcurrentWeakHashMap;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
@@ -44,12 +43,7 @@ import java.util.concurrent.ConcurrentMap;
 public class JavaResolveCache {
   private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.resolve.JavaResolveCache");
 
-  private static final NotNullLazyKey<JavaResolveCache, Project> INSTANCE_KEY = NotNullLazyKey.create("JavaResolveCache.Instance.Cache", new NotNullFunction<Project, JavaResolveCache>() {
-    @NotNull
-    public JavaResolveCache fun(final Project project) {
-      return ServiceManager.getService(project, JavaResolveCache.class);
-    }
-  });
+  private static final NotNullLazyKey<JavaResolveCache, Project> INSTANCE_KEY = ServiceManager.createLazyKey(JavaResolveCache.class);
 
   public static JavaResolveCache getInstance(Project project) {
     return INSTANCE_KEY.getValue(project);
index f821f743cd5a0368dc594706073f62461d0a9372..e034af55c99d36b5bbcf6102de5784e716d1f16a 100644 (file)
@@ -29,7 +29,6 @@ import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.*;
-import com.intellij.psi.search.PsiSearchHelper;
 import com.intellij.psi.search.searches.OverridingMethodsSearch;
 import com.intellij.psi.search.searches.ReferencesSearch;
 import com.intellij.psi.util.PsiTreeUtil;
@@ -48,7 +47,10 @@ import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.containers.MultiMap;
 import org.jetbrains.annotations.NotNull;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
 
 public abstract class MakeMethodOrClassStaticProcessor<T extends PsiTypeParameterListOwner> extends BaseRefactoringProcessor {
   private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.makeMethodStatic.MakeMethodStaticProcessor");
@@ -193,8 +195,6 @@ public abstract class MakeMethodOrClassStaticProcessor<T extends PsiTypeParamete
   @NotNull
   protected UsageInfo[] findUsages() {
     ArrayList<UsageInfo> result = new ArrayList<UsageInfo>();
-    PsiManager manager = myMember.getManager();
-    PsiSearchHelper helper = manager.getSearchHelper();
 
     result.addAll(Arrays.asList(MakeStaticUtil.findClassRefsInMember(myMember, true)));
 
index 63fc75a03eef8483cc87648b51dec2651591e8fd..4ce773a771b884d1c909240ae0e56e032220762f 100644 (file)
@@ -19,7 +19,6 @@ import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiMethod;
 import com.intellij.psi.PsiReference;
-import com.intellij.psi.search.PsiSearchHelper;
 import com.intellij.psi.search.SearchScope;
 import com.intellij.psi.search.searches.ClassInheritorsSearch;
 import com.intellij.psi.search.searches.OverridingMethodsSearch;
@@ -59,13 +58,11 @@ public class SearchUtils{
     }
 
     public static Iterable<PsiMethod> findOverridingMethods(PsiMethod method){
-        final PsiSearchHelper searchHelper = method.getManager().getSearchHelper();
         return new ArrayIterable<PsiMethod>(OverridingMethodsSearch.search(method, method.getUseScope(), true).toArray(new PsiMethod[0]));
        // return OverridingMethodsSearch.search(method, method.getUseScope(), true).findAll();
     }
 
     public static Iterable<PsiClass> findClassInheritors(PsiClass aClass, boolean deep){
-        final PsiSearchHelper searchHelper = aClass.getManager().getSearchHelper();
         return new ArrayIterable<PsiClass>(ClassInheritorsSearch.search(aClass, aClass.getUseScope(), deep).toArray(new PsiClass[0]));
        // return ClassInheritorsSearch.search(aClass, deep);
     }
index cb869c71871f035e67afcd6cde7329175769dfa4..34fa8f3d52913d795a194048027c2526c498ba93 100644 (file)
@@ -27,9 +27,7 @@ import com.intellij.psi.PsiAnnotation;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiModifierListOwner;
-import com.intellij.util.NotNullFunction;
 import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 public abstract class ExternalAnnotationsManager {
@@ -41,12 +39,7 @@ public abstract class ExternalAnnotationsManager {
     NOWHERE
   }
 
-  private static final NotNullLazyKey<ExternalAnnotationsManager, Project> INSTANCE_KEY = NotNullLazyKey.create("ExternalAnnotationsManager.Instance.Cache", new NotNullFunction<Project, ExternalAnnotationsManager>() {
-    @NotNull
-    public ExternalAnnotationsManager fun(final Project project) {
-      return ServiceManager.getService(project, ExternalAnnotationsManager.class);
-    }
-  });
+  private static final NotNullLazyKey<ExternalAnnotationsManager, Project> INSTANCE_KEY = ServiceManager.createLazyKey(ExternalAnnotationsManager.class);
 
   public static ExternalAnnotationsManager getInstance(Project project) {
     return INSTANCE_KEY.getValue(project);
index 2f0b0e276c1885c9edc9ca40e65c0fbf03087c63..f70cec3dd34cea8207441afb1326b7d9aa119893 100644 (file)
@@ -19,6 +19,7 @@ package com.intellij.ide.util.projectWizard;
 import com.intellij.openapi.module.ModuleType;
 import com.intellij.openapi.module.StdModuleTypes;
 import com.intellij.openapi.options.ConfigurationException;
+import com.intellij.openapi.projectRoots.JavaSdk;
 import com.intellij.openapi.projectRoots.JavaSdkType;
 import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.roots.CompilerModuleExtension;
@@ -188,6 +189,6 @@ public class JavaModuleBuilder extends ModuleBuilder implements SourcePathsBuild
 
   @Override
   public boolean isSuitableSdk(final Sdk sdk) {
-    return sdk.getSdkType() instanceof JavaSdkType;
+    return sdk.getSdkType() == JavaSdk.getInstance();
   }
 }
index b6fed3e249da6b3f9b404110ef107e6f34e99407..20d5c2283116eca7b9044ac5fa40a9a172b86772 100644 (file)
@@ -27,6 +27,7 @@ import com.intellij.openapi.util.WriteExternalException;
 import com.intellij.pom.java.LanguageLevel;
 import org.jdom.Element;
 import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.Nullable;
 
 public class LanguageLevelModuleExtension extends ModuleExtension<LanguageLevelModuleExtension> {
   @NonNls private static final String LANGUAGE_LEVEL_ELEMENT_NAME = "LANGUAGE_LEVEL";
@@ -69,6 +70,7 @@ public class LanguageLevelModuleExtension extends ModuleExtension<LanguageLevelM
     myLanguageLevel = languageLevel;
   }
 
+  @Nullable
   public LanguageLevel getLanguageLevel() {
     return myLanguageLevel;
   }
index 871be86b5cbe862507c84d144b21a18e6be1820f..75f11b58d01d0a64f601ce83de69d0d6eed473e4 100644 (file)
@@ -25,18 +25,12 @@ import com.intellij.openapi.util.NotNullLazyKey;
 import com.intellij.psi.javadoc.JavadocManager;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.search.PsiShortNamesCache;
-import com.intellij.util.NotNullFunction;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 public abstract class JavaPsiFacade {
-  private static final NotNullLazyKey<JavaPsiFacade, Project> INSTANCE_KEY = NotNullLazyKey.create("JavaPsiFacade.Instance.Cache", new NotNullFunction<Project, JavaPsiFacade>() {
-    @NotNull
-    public JavaPsiFacade fun(final Project project) {
-      return ServiceManager.getService(project, JavaPsiFacade.class);
-    }
-  });
+  private static final NotNullLazyKey<JavaPsiFacade, Project> INSTANCE_KEY = ServiceManager.createLazyKey(JavaPsiFacade.class);
   
   public static JavaPsiFacade getInstance(Project project) {
     return INSTANCE_KEY.getValue(project);
@@ -199,4 +193,4 @@ public abstract class JavaPsiFacade {
   public abstract boolean arePackagesTheSame(@NotNull PsiElement element1, @NotNull PsiElement element2);
 
   public abstract Project getProject();
-}
\ No newline at end of file
+}
index c99abcfbdefab2bc3c7c77b38df1452aa7d506d4..c1fbeafc746a4351d51c65e7b6b9937a3fbd5bce 100644 (file)
@@ -504,8 +504,9 @@ public class PsiTreeUtil {
     return nextLeaf(parent);
   }
 
-  public static PsiElement lastChild(final PsiElement element) {
-    if(element.getLastChild() != null) return lastChild(element.getLastChild());
+  public static PsiElement lastChild(@NotNull PsiElement element) {
+    PsiElement lastChild = element.getLastChild();
+    if(lastChild != null) return lastChild(lastChild);
     return element;
   }
 
index b44b5373ae181287908e7a8b51844fb05c12c52a..d3f07d037db891b442e3a8170d6fda445236e689 100644 (file)
@@ -106,8 +106,6 @@ public class CommonRefactoringUtil {
     boolean seenNonWritablePsiFilesWithoutVirtualFile = false;
 
     for (PsiElement element : elements) {
-      if (element.isWritable()) continue;
-
       if (element instanceof PsiDirectory) {
         PsiDirectory dir = (PsiDirectory)element;
         final VirtualFile vFile = dir.getVirtualFile();
@@ -140,13 +138,11 @@ public class CommonRefactoringUtil {
             }
           }
           else {
-            if (!directory.isWritable()) {
-              if (virtualFile.getFileSystem() instanceof JarFileSystem) {
-                failed.add(virtualFile);
-              }
-              else {
-                readonly.add(virtualFile);
-              }
+            if (virtualFile.getFileSystem() instanceof JarFileSystem) {
+              failed.add(virtualFile);
+            }
+            else {
+              readonly.add(virtualFile);
             }
           }
         }
@@ -160,15 +156,19 @@ public class CommonRefactoringUtil {
       else {
         PsiFile file = element.getContainingFile();
         if (file == null) {
-          seenNonWritablePsiFilesWithoutVirtualFile = true;
+          if (!element.isWritable()) {
+            seenNonWritablePsiFilesWithoutVirtualFile = true;
+          }
         }
-        else if (!file.isWritable()) {
+        else {
           final VirtualFile vFile = file.getVirtualFile();
           if (vFile != null) {
             readonly.add(vFile);
           }
           else {
-            seenNonWritablePsiFilesWithoutVirtualFile = true;
+            if (!element.isWritable()) {
+              seenNonWritablePsiFilesWithoutVirtualFile = true;
+            }
           }
         }
       }
index f60fd8820724cb285fb39fba9327c9f16958cb37..16a1d2fe938678bcf56be21c8e462ea9746f7f55 100644 (file)
@@ -20,19 +20,12 @@ import com.intellij.codeHighlighting.Pass;
 import com.intellij.codeHighlighting.TextEditorHighlightingPass;
 import com.intellij.codeInsight.daemon.DaemonBundle;
 import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
-import com.intellij.codeInsight.daemon.impl.analysis.DefaultHighlightVisitor;
 import com.intellij.codeInsight.daemon.impl.analysis.HighlightInfoHolder;
 import com.intellij.codeInsight.daemon.impl.analysis.HighlightLevelUtil;
-import com.intellij.codeInsight.highlighting.HighlightErrorFilter;
 import com.intellij.codeInsight.problems.ProblemImpl;
 import com.intellij.concurrency.JobUtil;
 import com.intellij.injected.editor.DocumentWindow;
-import com.intellij.injected.editor.DocumentWindowImpl;
-import com.intellij.injected.editor.VirtualFileWindow;
 import com.intellij.lang.Language;
-import com.intellij.lang.LanguageAnnotators;
-import com.intellij.lang.annotation.Annotation;
-import com.intellij.lang.annotation.Annotator;
 import com.intellij.lang.annotation.HighlightSeverity;
 import com.intellij.lang.injection.InjectedLanguageManager;
 import com.intellij.openapi.application.ApplicationManager;
@@ -147,6 +140,7 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
     DaemonCodeAnalyzer daemonCodeAnalyzer = DaemonCodeAnalyzer.getInstance(myProject);
     FileStatusMap fileStatusMap = ((DaemonCodeAnalyzerImpl)daemonCodeAnalyzer).getFileStatusMap();
     HighlightVisitor[] highlightVisitors = createHighlightVisitors();
+    HighlightVisitor[] filtered = filterVisitors(highlightVisitors, myFile);
     try {
       final FileViewProvider viewProvider = myFile.getViewProvider();
       final Set<Language> relevantLanguages = viewProvider.getLanguages();
@@ -166,8 +160,8 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
         }
       }
       if (elements != null) {
-        result.addAll(collectHighlights(elements, highlightVisitors, progress));
-        addInjectedPsiHighlights(elements, Extensions.getExtensions(DefaultHighlightVisitor.FILTER_EP_NAME, myProject));
+        result.addAll(collectHighlights(elements, progress, filtered));
+        addInjectedPsiHighlights(elements);
       }
 
       if (!isDumbMode()) {
@@ -184,7 +178,7 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
     myHighlights = result;
   }
 
-  private void addInjectedPsiHighlights(final List<PsiElement> elements, final HighlightErrorFilter[] errorFilters) {
+  private void addInjectedPsiHighlights(@NotNull final List<PsiElement> elements) {
     List<DocumentWindow> injected = InjectedLanguageUtil.getCachedInjectedDocuments(myFile);
     Collection<PsiElement> hosts = new THashSet<PsiElement>(elements.size() + injected.size());
 
@@ -228,43 +222,36 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
 
     JobUtil.invokeConcurrentlyUnderMyProgress(injectedFiles, new Processor<PsiFile>() {
       public boolean process(final PsiFile injectedPsi) {
-        AnnotationHolderImpl annotationHolder = createAnnotationHolder();
-        highlightInjectedIn(injectedPsi, annotationHolder, errorFilters, injectedLanguageManager);
         DocumentWindow documentWindow = (DocumentWindow)PsiDocumentManager.getInstance(myProject).getCachedDocument(injectedPsi);
-        for (Annotation annotation : annotationHolder) {
-          final TextRange fixedTextRange;
-          final int startOffset = annotation.getStartOffset();
-          TextRange textRange = documentWindow.getHostRange(startOffset);
-          if (textRange == null) {
-            // todo[cdr] check this fix. prefix/suffix code annotation case
-            textRange = findNearestTextRange(documentWindow, startOffset);
-            final boolean isBefore = startOffset < textRange.getStartOffset();
-            fixedTextRange = new ProperTextRange(isBefore ? textRange.getStartOffset() - 1 : textRange.getEndOffset(),
-                                           isBefore ? textRange.getStartOffset() : textRange.getEndOffset() + 1);
+        HighlightInfoHolder holder = createInfoHolder(injectedPsi);
+        runHighlightVisitosForInjected(injectedPsi, holder);
+        for (int i=0; i<holder.size();i++) {
+          HighlightInfo info = holder.get(i);
+          final int startOffset = documentWindow.injectedToHost(info.startOffset);
+          final TextRange fixedTextRange = getFixedTextRange(documentWindow, startOffset);
+          addPatchedInfos(info, injectedPsi, documentWindow, injectedLanguageManager, fixedTextRange);
+        }
+        holder.clear();
+        highlightInjectedSyntax(injectedPsi, holder);
+        for (int i=0; i<holder.size();i++) {
+          HighlightInfo info = holder.get(i);
+          final int startOffset = info.startOffset;
+          final TextRange fixedTextRange = getFixedTextRange(documentWindow, startOffset);
+          if (fixedTextRange == null) {
+            addHighlightInfo(new TextRange(info.startOffset, info.endOffset), info);
           }
           else {
-            fixedTextRange = null;
-          }
-          if (((DocumentWindowImpl)documentWindow).isOneLine()) {
-            annotation.setAfterEndOfLine(false);
+            HighlightInfo patched =
+              new HighlightInfo(info.forcedTextAttributes, info.type, fixedTextRange.getStartOffset(), fixedTextRange.getEndOffset(),
+                                info.description, info.toolTip, info.type.getSeverity(null), info.isAfterEndOfLine, null, false);
+            addHighlightInfo(fixedTextRange, patched);
           }
-          final HighlightInfo info = HighlightInfo.fromAnnotation(annotation, fixedTextRange);
-          addHighlightInfo(textRange, info);
         }
 
         if (!isDumbMode()) {
           Collection<HighlightInfo> todos = highlightTodos(injectedPsi, injectedPsi.getText(), 0, injectedPsi.getTextLength());
           for (HighlightInfo info : todos) {
-            ProperTextRange textRange = new ProperTextRange(info.startOffset, info.endOffset);
-            List<TextRange> editables = injectedLanguageManager.intersectWithAllEditableFragments(injectedPsi, textRange);
-            for (TextRange editable : editables) {
-              TextRange hostRange = documentWindow.injectedToHost(editable);
-
-              HighlightInfo patched =
-                new HighlightInfo(info.forcedTextAttributes, info.type, hostRange.getStartOffset(), hostRange.getEndOffset(),
-                                  info.description, info.toolTip, info.type.getSeverity(null), false, null, false);
-              addHighlightInfo(hostRange, patched);
-            }
+            addPatchedInfos(info, injectedPsi, documentWindow, injectedLanguageManager, null);
           }
         }
         return true;
@@ -272,6 +259,49 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
     }, "Highlight injected language fragments");
   }
 
+  private TextRange getFixedTextRange(DocumentWindow documentWindow, int startOffset) {
+    final TextRange fixedTextRange;
+    TextRange textRange = documentWindow.getHostRange(startOffset);
+    if (textRange == null) {
+      // todo[cdr] check this fix. prefix/suffix code annotation case
+      textRange = findNearestTextRange(documentWindow, startOffset);
+      final boolean isBefore = startOffset < textRange.getStartOffset();
+      fixedTextRange = new ProperTextRange(isBefore ? textRange.getStartOffset() - 1 : textRange.getEndOffset(),
+                                     isBefore ? textRange.getStartOffset() : textRange.getEndOffset() + 1);
+    }
+    else {
+      fixedTextRange = null;
+    }
+    return fixedTextRange;
+  }
+
+  private void addPatchedInfos(HighlightInfo info, PsiFile injectedPsi, DocumentWindow documentWindow, InjectedLanguageManager injectedLanguageManager,
+                               TextRange fixedTextRange) {
+    ProperTextRange textRange = new ProperTextRange(info.startOffset, info.endOffset);
+    List<TextRange> editables = injectedLanguageManager.intersectWithAllEditableFragments(injectedPsi, textRange);
+    for (TextRange editable : editables) {
+      TextRange hostRange = fixedTextRange == null ? documentWindow.injectedToHost(editable) : fixedTextRange;
+
+      HighlightInfo patched =
+        new HighlightInfo(info.forcedTextAttributes, info.type, hostRange.getStartOffset(), hostRange.getEndOffset(),
+                          info.description, info.toolTip, info.type.getSeverity(null), info.isAfterEndOfLine, null, false);
+      
+      if (info.quickFixActionRanges != null) {
+        for (Pair<HighlightInfo.IntentionActionDescriptor, TextRange> pair : info.quickFixActionRanges) {
+          TextRange quickfixTextRange = pair.getSecond();
+          List<TextRange> editableQF = injectedLanguageManager.intersectWithAllEditableFragments(injectedPsi, quickfixTextRange);
+          for (TextRange editableRange : editableQF) {
+            HighlightInfo.IntentionActionDescriptor descriptor = pair.getFirst();
+            if (patched.quickFixActionRanges == null) patched.quickFixActionRanges = new ArrayList<Pair<HighlightInfo.IntentionActionDescriptor, TextRange>>();
+            TextRange hostEditableRange = documentWindow.injectedToHost(editableRange);
+            patched.quickFixActionRanges.add(Pair.create(descriptor, hostEditableRange));
+          }
+        }
+      }
+      addHighlightInfo(hostRange, patched);
+    }
+  }
+
   private void addHighlightInfo(@NotNull TextRange textRange, @NotNull HighlightInfo highlightInfo) {
     synchronized (myInjectedPsiHighlights) {
       Collection<HighlightInfo> infos = myInjectedPsiHighlights.get(textRange);
@@ -295,89 +325,32 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
     return textRange;
   }
 
-  private static void highlightInjectedIn(final PsiFile injectedPsi,
-                                          final AnnotationHolderImpl annotationHolder,
-                                          final HighlightErrorFilter[] errorFilters,
-                                          final InjectedLanguageManager injectedLanguageManager) {
-    Language injectedLanguage = injectedPsi.getLanguage();
-    runAnnotatorsForInjected(injectedPsi, annotationHolder, errorFilters, injectedLanguageManager, injectedLanguage);
-    highlightInjectedSyntax(injectedLanguage, injectedPsi, annotationHolder);
-  }
-
-  private static final PerThreadMap<Annotator,Language> cachedAnnotators = new PerThreadMap<Annotator, Language>() {
-    @NotNull
-    @Override
-    public Collection<Annotator> initialValue(@NotNull Language key) {
-      return LanguageAnnotators.INSTANCE.allForLanguage(key);
-    }
-  };
-  private static void runAnnotatorsForInjected(final PsiFile injectedPsi, final AnnotationHolderImpl annotationHolder,
-                                               final HighlightErrorFilter[] errorFilters, final InjectedLanguageManager injectedLanguageManager,
-                                               Language injectedLanguage) {
-    final DocumentWindow documentRange = ((VirtualFileWindow)injectedPsi.getViewProvider().getVirtualFile()).getDocumentWindow();
-    assert documentRange != null;
-    assert documentRange.getText().equals(injectedPsi.getText());
-    final List<Annotator> annotators = cachedAnnotators.get(injectedLanguage);
-    final AnnotationHolderImpl fixingOffsetsHolder = new AnnotationHolderImpl() {
-      public boolean add(final Annotation annotation) {
-        return true; // we are going to hand off the annotation to the annotationHolder anyway
-      }
-
-      protected Annotation createAnnotation(TextRange range, HighlightSeverity severity, String message) {
-        List<TextRange> editables = injectedLanguageManager.intersectWithAllEditableFragments(injectedPsi, range);
-        Annotation firstAnnotation = null;
-        for (TextRange editable : editables) {
-          final TextRange patched = documentRange.injectedToHost(editable);
-          Annotation annotation = super.createAnnotation(patched, severity, message);
-          if (firstAnnotation == null) {
-            firstAnnotation = annotation;
-          }
-          annotationHolder.add(annotation);
-        }
-        return firstAnnotation != null ? firstAnnotation :
-        // fake
-        super.createAnnotation(documentRange.injectedToHost(TextRange.from(0, 0)), severity, message);
-      }
-    };
-    PsiElementVisitor visitor = new PsiRecursiveElementWalkingVisitor() {
-      @Override public void visitElement(PsiElement element) {
-        super.visitElement(element);
-        //noinspection ForLoopReplaceableByForEach
-        for (int i = 0; i < annotators.size(); i++) {
-          Annotator annotator = annotators.get(i);
-          annotator.annotate(element, fixingOffsetsHolder);
-        }
-      }
-
-      @Override public void visitErrorElement(PsiErrorElement element) {
-        for (final HighlightErrorFilter errorFilter : errorFilters) {
-          if (!errorFilter.shouldHighlightErrorElement(element)) return;
-        }
-
-        HighlightInfo info = DefaultHighlightVisitor.createErrorElementInfo(element);
-        Annotation error = fixingOffsetsHolder.createErrorAnnotation(new ProperTextRange(info.startOffset, info.endOffset), info.description);
-        error.setAfterEndOfLine(info.isAfterEndOfLine);
-        error.setTooltip(info.toolTip);
-        if (info.quickFixActionRanges != null) {
-          for (Pair<HighlightInfo.IntentionActionDescriptor, TextRange> o : info.quickFixActionRanges) {
-            List<TextRange> editables = injectedLanguageManager.intersectWithAllEditableFragments(injectedPsi, o.second);
-            for (TextRange fixEditable : editables) {
-              error.registerFix(o.first.getAction(), documentRange.injectedToHost(fixEditable));
+  private void runHighlightVisitosForInjected(final PsiFile injectedPsi, final HighlightInfoHolder holder) {
+    HighlightVisitor[] visitors = createHighlightVisitors();
+    try {
+      HighlightVisitor[] filtered = filterVisitors(visitors, injectedPsi);
+      final List<PsiElement> elements = CollectHighlightsUtil.getElementsInRange(injectedPsi, 0, injectedPsi.getTextLength());
+      for (final HighlightVisitor hvisitor : filtered) {
+        hvisitor.analyze(new Runnable() {
+          public void run() {
+            for (PsiElement element : elements) {
+              ProgressManager.checkCanceled();
+              hvisitor.visit(element, holder);
             }
           }
-        }
+        }, true, injectedPsi);
       }
-    };
-
-    injectedPsi.accept(visitor);
+    }
+    finally {
+      incVisitorUsageCount(-1);
+    }
   }
 
-  private static void highlightInjectedSyntax(final Language injectedLanguage,
-                                              final PsiFile injectedPsi,
-                                              final AnnotationHolderImpl annotationHolder) {
+  private static void highlightInjectedSyntax(final PsiFile injectedPsi, HighlightInfoHolder holder) {
     List<Trinity<IElementType, PsiLanguageInjectionHost, TextRange>> tokens = InjectedLanguageUtil.getHighlightTokens(injectedPsi);
     if (tokens == null) return;
 
+    final Language injectedLanguage = injectedPsi.getLanguage();
     SyntaxHighlighter syntaxHighlighter =
       SyntaxHighlighterFactory.getSyntaxHighlighter(injectedLanguage, injectedPsi.getProject(), injectedPsi.getVirtualFile());
     EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
@@ -391,10 +364,7 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
       if (textRange.getLength() == 0) continue;
 
       TextRange annRange = textRange.shiftRight(injectionHost.getTextRange().getStartOffset());
-      Annotation annotation = annotationHolder.createAnnotation(annRange, HighlightInfoType.INJECTED_FRAGMENT_SEVERITY, null);
-      if (annotation == null) continue; // maybe out of highlightable range
       // force attribute colors to override host' ones
-
       TextAttributes attributes = null;
       for(TextAttributesKey key:keys) {
         TextAttributes attrs2 = globalScheme.getAttributes(key);
@@ -402,15 +372,18 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
           attributes = attributes != null ? TextAttributes.merge(attributes, attrs2):attrs2;
         }
       }
+      TextAttributes forcedAttributes;
       if (attributes == null || attributes.isEmpty() || attributes.equals(defaultAttrs)) {
-        annotation.setEnforcedTextAttributes(TextAttributes.ERASE_MARKER);
+        forcedAttributes = TextAttributes.ERASE_MARKER;
       }
       else {
         Color back = attributes.getBackgroundColor() == null ? globalScheme.getDefaultBackground() : attributes.getBackgroundColor();
         Color fore = attributes.getForegroundColor() == null ? globalScheme.getDefaultForeground() : attributes.getForegroundColor();
-        TextAttributes forced = new TextAttributes(fore, back, attributes.getEffectColor(), attributes.getEffectType(), attributes.getFontType());
-        annotation.setEnforcedTextAttributes(forced);
+        forcedAttributes = new TextAttributes(fore, back, attributes.getEffectColor(), attributes.getEffectType(), attributes.getFontType());
       }
+      
+      HighlightInfo info = HighlightInfo.createHighlightInfo(HighlightInfoType.INJECTED_LANGUAGE_FRAGMENT, annRange, null,null,forcedAttributes);
+      holder.add(info);
     }
   }
 
@@ -460,30 +433,18 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
     return list;
   }
 
-  private Collection<HighlightInfo> collectHighlights(@NotNull final List<PsiElement> elements,
-                                                      @NotNull final HighlightVisitor[] highlightVisitors,
-                                                      @NotNull final ProgressIndicator progress) {
+  private Collection<HighlightInfo> collectHighlights(@NotNull final List<PsiElement> elements, @NotNull final ProgressIndicator progress,
+                                                      final HighlightVisitor[] visitors) {
     final Set<PsiElement> skipParentsSet = new THashSet<PsiElement>();
     final Set<HighlightInfo> gotHighlights = new THashSet<HighlightInfo>();
 
-    final List<HighlightVisitor> visitors = new ArrayList<HighlightVisitor>(highlightVisitors.length);
-    List<HighlightVisitor> list = Arrays.asList(highlightVisitors);
-    for (HighlightVisitor visitor : DumbService.getInstance(myProject).filterByDumbAwareness(list)) {
-      if (visitor.suitableForFile(myFile)) visitors.add(visitor);
-    }
-    LOG.assertTrue(!visitors.isEmpty(), list);
-
-    HighlightVisitor[] visitorArray = visitors.toArray(new HighlightVisitor[visitors.size()]);
-    Arrays.sort(visitorArray, VISITOR_ORDER_COMPARATOR);
-
     final boolean forceHighlightParents = forceHighlightParents();
 
-    final HighlightInfoHolder holder = createInfoHolder();
-    holder.setWritable(true);
-    setProgressLimit((long)elements.size() * visitorArray.length);
+    final HighlightInfoHolder holder = createInfoHolder(myFile);
+    setProgressLimit((long)elements.size() * visitors.length);
 
     final int chunkSize = Math.max(1, elements.size() / 100); // one percent precision is enough
-    for (final HighlightVisitor visitor : visitorArray) {
+    for (final HighlightVisitor visitor : visitors) {
       Runnable action = new Runnable() {
         public void run() {
           int nextLimit = chunkSize;
@@ -533,6 +494,19 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
     return gotHighlights;
   }
 
+  private static HighlightVisitor[] filterVisitors(HighlightVisitor[] highlightVisitors, final PsiFile file) {
+    final List<HighlightVisitor> visitors = new ArrayList<HighlightVisitor>(highlightVisitors.length);
+    List<HighlightVisitor> list = Arrays.asList(highlightVisitors);
+    for (HighlightVisitor visitor : DumbService.getInstance(file.getProject()).filterByDumbAwareness(list)) {
+      if (visitor.suitableForFile(file)) visitors.add(visitor);
+    }
+    LOG.assertTrue(!visitors.isEmpty(), list);
+
+    HighlightVisitor[] visitorArray = visitors.toArray(new HighlightVisitor[visitors.size()]);
+    Arrays.sort(visitorArray, VISITOR_ORDER_COMPARATOR);
+    return visitorArray;
+  }
+
   static Void cancelAndRestartDaemonLater(ProgressIndicator progress, final Project project, TextEditorHighlightingPass pass) {
     PassExecutorService.log(progress, pass, "Cancel and restart");
     progress.cancel();
@@ -561,12 +535,9 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
     return forceHighlightParents;
   }
 
-  protected HighlightInfoHolder createInfoHolder() {
+  protected HighlightInfoHolder createInfoHolder(final PsiFile file) {
     final HighlightInfoFilter[] filters = ApplicationManager.getApplication().getExtensions(HighlightInfoFilter.EXTENSION_POINT_NAME);
-    return new HighlightInfoHolder(myFile, filters);
-  }
-  protected AnnotationHolderImpl createAnnotationHolder() {
-    return new AnnotationHolderImpl();
+    return new HighlightInfoHolder(file, filters);
   }
 
   private static Collection<HighlightInfo> highlightTodos(PsiFile file, CharSequence text, int startOffset, int endOffset) {
index ba33192e2d2a2bf6f076fc1d49e2691f6b774b62..612ab9a0bba597164800ade3560c4c66d458dd0c 100644 (file)
@@ -36,8 +36,8 @@ public class GeneralHighlightingPassFactory extends AbstractProjectComponent imp
   public GeneralHighlightingPassFactory(Project project, TextEditorHighlightingPassRegistrar highlightingPassRegistrar) {
     super(project);
     highlightingPassRegistrar.registerTextEditorHighlightingPass(this,
-                                                                 new int[]{  /*Pass.POPUP_HINTS*/},
-                                                                 new int[]{Pass.UPDATE_FOLDING,Pass.UPDATE_VISIBLE}, false, Pass.UPDATE_ALL);
+                                                                 new int[]{Pass.UPDATE_VISIBLE},
+                                                                 new int[]{Pass.UPDATE_FOLDING}, false, Pass.UPDATE_ALL);
   }
 
   @NonNls
index de41d7c6673676f76e59f5d6f2c0202a31518bbd..b09e4a2596556ef3d9aaab9276fc072302c2f5b5 100755 (executable)
@@ -19,6 +19,8 @@ import com.intellij.openapi.util.UserDataHolder;
 import gnu.trove.THashMap;
 import org.jetbrains.annotations.NotNull;
 
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
@@ -44,7 +46,9 @@ public abstract class PerThreadMap<T, KeyT extends UserDataHolder> {
     for (T template : templates) {
       Class<? extends T> aClass = (Class<? extends T>)template.getClass();
       try {
-        T clone = aClass.newInstance();
+        Constructor<? extends T> constructor = aClass.getDeclaredConstructor();
+        constructor.setAccessible(true);
+        T clone = constructor.newInstance();
         result.add(clone);
       }
       catch (InstantiationException e) {
@@ -53,6 +57,12 @@ public abstract class PerThreadMap<T, KeyT extends UserDataHolder> {
       catch (IllegalAccessException e) {
         throw new RuntimeException("Cannot access annotator "+aClass+". There must be public no-args constructor", e);
       }
+      catch (NoSuchMethodException e) {
+        throw new RuntimeException("Cannot create annotator "+aClass+". There must be public no-args constructor", e);
+      }
+      catch (InvocationTargetException e) {
+        throw new RuntimeException("Error during creating annotator "+aClass, e);
+      }
     }
     return result;
   }
index e8a78fb225df1baeacc40564a76d594a1704a3bf..2e464863559915cc948e589e908b14d493970571 100644 (file)
@@ -56,10 +56,7 @@ public class TextEditorHighlightingPassRegistrarImpl extends TextEditorHighlight
     private final int[] startingPredecessorIds;
     private final int[] completionPredecessorIds;
 
-    private PassConfig(@NotNull TextEditorHighlightingPassFactory passFactory,
-                      boolean runIntentionsPassAfter,
-                      @NotNull int[] completionPredecessorIds,
-                      @NotNull int[] startingPredecessorIds) {
+    private PassConfig(@NotNull TextEditorHighlightingPassFactory passFactory, @NotNull int[] completionPredecessorIds, @NotNull int[] startingPredecessorIds) {
       this.completionPredecessorIds = completionPredecessorIds;
       this.startingPredecessorIds = startingPredecessorIds;
       this.passFactory = passFactory;
@@ -87,7 +84,7 @@ public class TextEditorHighlightingPassRegistrarImpl extends TextEditorHighlight
                                                              boolean runIntentionsPassAfter,
                                                              int forcedPassId) {
     assert !checkedForCycles;
-    PassConfig info = new PassConfig(factory, runIntentionsPassAfter,
+    PassConfig info = new PassConfig(factory,
                                      runAfterCompletionOf == null || runAfterCompletionOf.length == 0 ? ArrayUtil.EMPTY_INT_ARRAY : runAfterCompletionOf,
                                      runAfterOfStartingOf == null || runAfterOfStartingOf.length == 0 ? ArrayUtil.EMPTY_INT_ARRAY : runAfterOfStartingOf);
     int passId = forcedPassId == -1 ? nextAvailableId++ : forcedPassId;
index 089d06d9e4af7ca1788d2a3c146cd8a464bd7ec7..da70262698d2937c73d687e457bf266fe3ded47a 100644 (file)
@@ -34,8 +34,7 @@ import org.jetbrains.annotations.Nullable;
 public class VisibleLineMarkersPassFactory extends VisibleHighlightingPassFactory implements TextEditorHighlightingPassFactory {
   public VisibleLineMarkersPassFactory(Project project, TextEditorHighlightingPassRegistrar highlightingPassRegistrar) {
     super(project);
-    highlightingPassRegistrar.registerTextEditorHighlightingPass(this, null, new int[]{Pass.UPDATE_VISIBLE}, false,
-                                                                 Pass.VISIBLE_LINE_MARKERS);
+    highlightingPassRegistrar.registerTextEditorHighlightingPass(this, null, new int[]{Pass.UPDATE_VISIBLE}, false, Pass.VISIBLE_LINE_MARKERS);
   }
 
   @NonNls
index 8fb3d0fbc24832d658316251c14dae950165af14..79b10a407bf81d7fb6a7aac137ab50c3a9f63764 100644 (file)
 
 package com.intellij.codeInsight.daemon.impl.analysis;
 
-import com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl;
-import com.intellij.codeInsight.daemon.impl.HighlightInfo;
-import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
-import com.intellij.codeInsight.daemon.impl.HighlightVisitor;
+import com.intellij.codeInsight.daemon.impl.*;
 import com.intellij.codeInsight.highlighting.HighlightErrorFilter;
+import com.intellij.lang.Language;
 import com.intellij.lang.LanguageAnnotators;
 import com.intellij.lang.annotation.Annotation;
 import com.intellij.lang.annotation.Annotator;
@@ -32,7 +30,9 @@ import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.TextRange;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.*;
+import org.jetbrains.annotations.NotNull;
 
+import java.util.Collection;
 import java.util.List;
 
 /**
@@ -84,8 +84,16 @@ public class DefaultHighlightVisitor extends PsiElementVisitor implements Highli
     runAnnotators(element);
   }
 
+  private static final PerThreadMap<Annotator,Language> cachedAnnotators = new PerThreadMap<Annotator, Language>() {
+    @NotNull
+    @Override
+    public Collection<Annotator> initialValue(@NotNull Language key) {
+      return LanguageAnnotators.INSTANCE.allForLanguage(key);
+    }
+  };
+
   private void runAnnotators(final PsiElement element) {
-    List<Annotator> annotators = LanguageAnnotators.INSTANCE.allForLanguage(element.getLanguage());
+    List<Annotator> annotators = cachedAnnotators.get(element.getLanguage());
     if (!annotators.isEmpty()) {
       final boolean dumb = DumbService.getInstance(myProject).isDumb();
       //noinspection ForLoopReplaceableByForEach
index 3b67c3c3e84bfba96a0f118b936220253d9aecb8..a227ab81edb1c0f56df2e597d947bfe590df6991 100644 (file)
@@ -39,7 +39,6 @@ public class HighlightInfoHolder {
   private int myErrorCount;
   private int myWarningCount;
   private int myInfoCount;
-  private boolean writable = false;
   private final List<HighlightInfo> myInfos = new ArrayList<HighlightInfo>(5);
 
   public HighlightInfoHolder(@NotNull PsiFile contextFile, @NotNull HighlightInfoFilter... filters) {
@@ -48,7 +47,6 @@ public class HighlightInfoHolder {
   }
 
   public boolean add(@Nullable HighlightInfo info) {
-    if (!writable) throw new IllegalStateException("Update highlight holder after visit finished; "+this+"; info="+info);
     if (info == null || !accepted(info)) return false;
 
     HighlightSeverity severity = info.getSeverity();
@@ -73,8 +71,6 @@ public class HighlightInfoHolder {
   }
 
   public void clear() {
-    if (!writable) throw new IllegalStateException("Clearing holder after visit finished; " + this);
-
     myErrorCount = 0;
     myWarningCount = 0;
     myInfoCount = 0;
@@ -107,18 +103,6 @@ public class HighlightInfoHolder {
     return added;
   }
 
-  // ASSERTIONS ONLY
-  public void setWritable(final boolean writable) {
-    if (this.writable == writable) {
-      LOG.error("this.writable != writable");
-    }
-    this.writable = writable;
-  }
-
-  public boolean isWritable() {
-    return writable;
-  }
-
   public int size() {
     return myInfos.size();
   }
index 739bd596da97c6c441dde20661a2bbd271f310f7..d6c4880508bbee1b8e19e3b5cb1fc15d010dc344 100644 (file)
@@ -476,15 +476,15 @@ public class TypedHandler implements TypedActionHandler {
     return quoteHandler.isInsideLiteral(iterator);
   }
 
-  private static void indentClosingBrace(final Project project, final Editor editor){
+  private static void indentClosingBrace(@NotNull Project project, @NotNull Editor editor){
     indentBrace(project, editor, '}');
   }
 
-  private static void indentOpenedBrace(final Project project, final Editor editor){
+  static void indentOpenedBrace(@NotNull Project project, @NotNull Editor editor){
     indentBrace(project, editor, '{');
   }
 
-  private static void indentBrace(final Project project, final Editor editor, final char braceChar) {
+  private static void indentBrace(@NotNull final Project project, @NotNull final Editor editor, final char braceChar) {
     final int offset = editor.getCaretModel().getOffset() - 1;
     final Document document = editor.getDocument();
     CharSequence chars = document.getCharsSequence();
index eadac632bbe8f63415426a3909d5d41585f58bb4..ff423b6dc5e1db52d846de254af6f17a2dda5923 100644 (file)
@@ -18,7 +18,6 @@ package com.intellij.codeInsight.problems;
 
 import com.intellij.codeInsight.daemon.impl.*;
 import com.intellij.codeInsight.daemon.impl.analysis.HighlightInfoHolder;
-import com.intellij.lang.annotation.Annotation;
 import com.intellij.lang.annotation.HighlightSeverity;
 import com.intellij.openapi.Disposable;
 import com.intellij.openapi.application.ApplicationManager;
@@ -294,8 +293,8 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
 
     try {
       GeneralHighlightingPass pass = new GeneralHighlightingPass(myProject, psiFile, document, 0, document.getTextLength(), false) {
-        protected HighlightInfoHolder createInfoHolder() {
-          return new HighlightInfoHolder(psiFile, HighlightInfoFilter.EMPTY_ARRAY) {
+        protected HighlightInfoHolder createInfoHolder(final PsiFile file) {
+          return new HighlightInfoHolder(file, HighlightInfoFilter.EMPTY_ARRAY) {
             public boolean add(HighlightInfo info) {
               if (info != null && info.getSeverity() == HighlightSeverity.ERROR) {
                 throw new HaveGotErrorException(info, myHasErrorElement);
@@ -305,17 +304,6 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
           };
         }
 
-        protected AnnotationHolderImpl createAnnotationHolder() {
-          return new AnnotationHolderImpl(){
-            public boolean add(Annotation annotation) {
-              if (annotation != null && annotation.getSeverity() == HighlightSeverity.ERROR) {
-                HighlightInfo highlightInfo = HighlightInfo.fromAnnotation(annotation);
-                throw new HaveGotErrorException(highlightInfo, myHasErrorElement);
-              }
-              return super.add(annotation);
-            }
-          };
-        }
       };
       pass.collectInformation(progressIndicator);
     }
index c8ecbbfc62eff34c18309b772a9ba54929b09276..66ae02ce90a22a1a341d91c6f47d7e1f046e6cbf 100644 (file)
@@ -122,6 +122,24 @@ public class TemplateSettings implements PersistentStateComponent<Element>, Expo
     public static TemplateKey keyOf(TemplateImpl template) {
       return new TemplateKey(template.getGroupName(), template.getKey());
     }
+
+    public boolean equals(Object o) {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+
+      TemplateKey that = (TemplateKey)o;
+
+      if (groupName != null ? !groupName.equals(that.groupName) : that.groupName != null) return false;
+      if (key != null ? !key.equals(that.key) : that.key != null) return false;
+
+      return true;
+    }
+
+    public int hashCode() {
+      int result = groupName != null ? groupName.hashCode() : 0;
+      result = 31 * result + (key != null ? key.hashCode() : 0);
+      return result;
+    }
   }
 
   public TemplateSettings(SchemesManagerFactory schemesManagerFactory) {
index f06e46664384b612363404ec0d268895dff8cdbc..0ca3ec7554048fa0b9688378b336c81eddb66dfb 100644 (file)
@@ -24,6 +24,7 @@ import com.intellij.psi.*;
 
 public class UnwrapAction extends BaseCodeInsightAction{
   public UnwrapAction() {
+    super(true);
     setEnabledInModalContext(true);
   }
 
index 769e7f3ece85bdd87e8e93b0bb133d58283816c7..b6cd42dadcc0bceaf5878d688fd13ac334aaf96d 100644 (file)
@@ -224,8 +224,8 @@ public class QuickFixAction extends AnAction {
     Set<VirtualFile> readOnlyFiles = new THashSet<VirtualFile>();
     for (RefElement refElement : refElements) {
       PsiElement psiElement = refElement.getElement();
-      if (psiElement == null) continue;
-      if (!psiElement.isWritable()) readOnlyFiles.add(psiElement.getContainingFile().getVirtualFile());
+      if (psiElement == null || psiElement.getContainingFile() == null) continue;
+      readOnlyFiles.add(psiElement.getContainingFile().getVirtualFile());
     }
     return readOnlyFiles;
   }
index be38bcbad49c0be4d8000277a36fb62b067088fa..ec9dcfa0b827e830a294dfa566ba66ba6ebfda3d 100644 (file)
@@ -823,7 +823,7 @@ public final class ConsoleViewImpl extends JPanel implements ConsoleView, Observ
     myHyperlinks.add(highlighter, hyperlinkInfo);
   }
 
-  private class ClearAllAction extends AnAction{
+  private class ClearAllAction extends AnAction implements DumbAware {
     private ClearAllAction(){
       super(ExecutionBundle.message("clear.all.from.console.action.name"));
     }
@@ -833,7 +833,7 @@ public final class ConsoleViewImpl extends JPanel implements ConsoleView, Observ
     }
   }
 
-  private class CopyAction extends AnAction{
+  private class CopyAction extends AnAction implements DumbAware {
     private CopyAction(){
       super(myEditor != null && myEditor.getSelectionModel().hasSelection() ? ExecutionBundle.message("copy.selected.content.action.name") : ExecutionBundle.message("copy.content.action.name"));
     }
index ae1d5e52fdb60867f7d3cdfb63ba1c98c6c4f81c..b0dbdddca19961c8db19bd3949a2875d7158075e 100644 (file)
@@ -90,10 +90,10 @@ class ShowUsagesTableCellRenderer implements TableCellRenderer {
         for (int i = 1; i < text.length; i++) {
           TextChunk textChunk = text[i];
           final SimpleTextAttributes attrs = SimpleTextAttributes.fromTextAttributes(textChunk.getAttributes());
-          final Color selectedColor = attrs.getStyle() == SimpleTextAttributes.STYLE_BOLD ? Color.WHITE : Color.GRAY;
+          final Color bg = UIUtil.getListSelectionBackground();
+          final Color fg = UIUtil.getListSelectionForeground();
           SimpleTextAttributes attributes = isSelected ?
-            new SimpleTextAttributes(UIUtil.getListSelectionBackground(), selectedColor, selectedColor, attrs.getStyle())
-            : deriveAttributesWithColor(attrs, fileBgColor);
+            new SimpleTextAttributes(bg, fg, fg, attrs.getStyle()) : deriveAttributesWithColor(attrs, fileBgColor);
           textChunks.append(textChunk.getText(), attributes);
         }
       }
index 691326a8710ce8de76687cc06d10ceed57e2aa61..e1a5463e49777530ba0d34d955ebac7ac6c76c20 100644 (file)
@@ -56,6 +56,7 @@ public class FileListPasteProvider implements PasteProvider {
     catch (IOException e) {
       return;
     }
+    if (fileList == null) return;
     List<PsiElement> elements = new ArrayList<PsiElement>();
     for (File file : fileList) {
       final VirtualFile vFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
index 01a97e47e887d26c4450fbc107c514addca6192c..dde21573fcf62deb72c8735672d00a2485090db4 100644 (file)
@@ -27,9 +27,9 @@ import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.ActionCallback;
 import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.wm.ToolWindow;
 import com.intellij.openapi.wm.ToolWindowId;
 import com.intellij.openapi.wm.ToolWindowManager;
-import com.intellij.openapi.wm.ex.ToolWindowEx;
 import com.intellij.psi.*;
 import com.intellij.psi.util.PsiUtilBase;
 import org.jetbrains.annotations.NotNull;
@@ -61,7 +61,7 @@ public abstract class ProjectViewSelectInTarget extends SelectInTargetPsiWrapper
 
     final ProjectView projectView = ProjectView.getInstance(project);
     ToolWindowManager windowManager=ToolWindowManager.getInstance(project);
-    final ToolWindowEx projectViewToolWindow = (ToolWindowEx) windowManager.getToolWindow(ToolWindowId.PROJECT_VIEW);
+    final ToolWindow projectViewToolWindow = windowManager.getToolWindow(ToolWindowId.PROJECT_VIEW);
     final Runnable runnable = new Runnable() {
       public void run() {
         if (requestFocus) {
index 68da08839eedd16efce13fc20fb8ce8d7a39ab7d..adf7c33ace82016da402cc952293a981d0e5fe30 100644 (file)
@@ -172,27 +172,24 @@ public class ProjectViewDirectoryHelper {
       return psiDirectory.getChildren();
     }
 
-    Set<VirtualFile> directoriesOnTheWayToContentRoots = new THashSet<VirtualFile>();
+    PsiManager manager = psiDirectory.getManager();
+    Set<PsiElement> directoriesOnTheWayToContentRoots = new THashSet<PsiElement>();
     for (VirtualFile root : getTopLevelRoots()) {
       VirtualFile current = root;
       while (current != null) {
         VirtualFile parent = current.getParent();
 
         if (parent == dir) {
-          directoriesOnTheWayToContentRoots.add(current);
+          final PsiDirectory psi = manager.findDirectory(current);
+          if (psi != null) {
+            directoriesOnTheWayToContentRoots.add(psi);
+          }
         }
         current = parent;
       }
     }
 
-    PsiManager manager = psiDirectory.getManager();
-    PsiElement[] answer = new PsiElement[directoriesOnTheWayToContentRoots.size()];
-    int i = 0;
-    for (VirtualFile directory : directoriesOnTheWayToContentRoots) {
-      answer[i++] = manager.findDirectory(directory);
-    }
-
-    return answer;
+    return directoriesOnTheWayToContentRoots.toArray(new PsiElement[directoriesOnTheWayToContentRoots.size()]);
   }
 
   // used only for non-flatten packages mode
index 88ee4312aca2677845877e96aa40d978f1d1cf35..1cd586e1cc2912d230a7265c0b966a6884781eae 100644 (file)
@@ -675,8 +675,9 @@ public abstract class TodoTreeBuilder extends AbstractTreeBuilder {
 
     public void beforeChildRemoval(PsiTreeChangeEvent e) {
       // If local midification
-      if (e.getFile() != null) {
-        markFileAsDirty(e.getFile());
+      final PsiFile file = e.getFile();
+      if (file != null) {
+        markFileAsDirty(file);
         updateTree(true);
         return;
       }
@@ -700,6 +701,12 @@ public abstract class TodoTreeBuilder extends AbstractTreeBuilder {
         }
         updateTree(true);
       }
+      else {
+        if (PsiTreeUtil.getParentOfType(child, PsiComment.class, false) != null) { // change inside comment
+          markFileAsDirty(child.getContainingFile());
+          updateTree(true);
+        }
+      }
     }
 
     public void childMoved(PsiTreeChangeEvent e) {
index a5824eb7e7c891a67519879f6290f99e03818e6d..66b1948ed62d00cf9189807908ecc4b2abded54c 100644 (file)
@@ -19,6 +19,9 @@ import com.intellij.ide.ui.UISettings;
 import com.intellij.ide.util.treeView.NodeRenderer;
 import com.intellij.navigation.ItemPresentation;
 import com.intellij.navigation.NavigationItem;
+import com.intellij.openapi.actionSystem.DataConstants;
+import com.intellij.openapi.actionSystem.DataProvider;
+import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.editor.colors.EditorColorsManager;
 import com.intellij.openapi.editor.colors.EditorColorsScheme;
 import com.intellij.openapi.editor.markup.EffectType;
@@ -94,18 +97,21 @@ public class NavigationItemListCellRenderer extends JPanel implements ListCellRe
                                 && WolfTheProblemSolver.getInstance(((PsiElement)element).getProject())
                                    .isProblemFile(PsiUtilBase.getVirtualFile((PsiElement)element));
 
-        if (element instanceof PsiElement) {
-          final PsiElement psiElement = (PsiElement)element;
-          final Project project = psiElement.getProject();
+        if (element instanceof PsiElement || element instanceof DataProvider) {
+          final PsiElement psiElement = element instanceof PsiElement ? (PsiElement)element : (PsiElement) ((DataProvider)element).getData(
+            DataConstants.PSI_ELEMENT);
+          if (psiElement != null) {
+            final Project project = psiElement.getProject();
 
-          final VirtualFile virtualFile = PsiUtilBase.getVirtualFile(psiElement);
-          isProblemFile = WolfTheProblemSolver.getInstance(project).isProblemFile(virtualFile);
+            final VirtualFile virtualFile = PsiUtilBase.getVirtualFile(psiElement);
+            isProblemFile = WolfTheProblemSolver.getInstance(project).isProblemFile(virtualFile);
 
-          final FileColorManager fileColorManager = FileColorManager.getInstance(project);
-          if (virtualFile != null && fileColorManager.isEnabled()) {
-            final Color fileColor = fileColorManager.getFileColor(psiElement.getContainingFile());
-            if (fileColor != null) {
-              bgColor = fileColor;
+            final FileColorManager fileColorManager = FileColorManager.getInstance(project);
+            if (virtualFile != null && fileColorManager.isEnabled()) {
+              final Color fileColor = fileColorManager.getFileColor(psiElement.getContainingFile());
+              if (fileColor != null) {
+                bgColor = fileColor;
+              }
             }
           }
         }
index 920bee8ebac8dfeb4a03406506c3efb1ddb4ff4c..037b6456ba6301d8dfe093ef065e3126d16cff91 100644 (file)
@@ -3,7 +3,7 @@
   <grid id="80cff" binding="myPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
     <margin top="0" left="0" bottom="0" right="0"/>
     <constraints>
-      <xy x="44" y="67" width="454" height="304"/>
+      <xy x="44" y="67" width="454" height="371"/>
     </constraints>
     <properties/>
     <border type="none"/>
         </properties>
         <border type="none"/>
         <children>
-          <xy id="c65eb" binding="myStructureTreePanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
+          <grid id="1e8e6" binding="myTextPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
             <margin top="0" left="0" bottom="0" right="0"/>
             <constraints>
-              <splitpane position="right"/>
+              <splitpane position="left"/>
             </constraints>
             <properties/>
-            <border type="none" title="PSI Structure"/>
+            <border type="none" title="Text"/>
             <children/>
-          </xy>
-          <grid id="1e8e6" binding="myTextPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+          </grid>
+          <grid id="c07f4" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
             <margin top="0" left="0" bottom="0" right="0"/>
             <constraints>
-              <splitpane position="left"/>
+              <splitpane position="right"/>
             </constraints>
             <properties/>
-            <border type="none" title="Text"/>
-            <children/>
+            <border type="none"/>
+            <children>
+              <splitpane id="7d23d">
+                <constraints>
+                  <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
+                    <preferred-size width="200" height="200"/>
+                  </grid>
+                </constraints>
+                <properties>
+                  <dividerLocation value="400"/>
+                </properties>
+                <border type="none"/>
+                <children>
+                  <grid id="bb268" binding="myStructureTreePanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+                    <margin top="0" left="0" bottom="0" right="0"/>
+                    <constraints>
+                      <splitpane position="left"/>
+                    </constraints>
+                    <properties/>
+                    <border type="none" title="PSI Structure"/>
+                    <children/>
+                  </grid>
+                  <grid id="47abd" binding="myReferencesPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+                    <margin top="0" left="0" bottom="0" right="0"/>
+                    <constraints>
+                      <splitpane position="right"/>
+                    </constraints>
+                    <properties/>
+                    <border type="none" title="References"/>
+                    <children/>
+                  </grid>
+                </children>
+              </splitpane>
+            </children>
           </grid>
         </children>
       </splitpane>
index 3995be4c1b2fd74c2215a7a3331aab63e0334e68..ff785b0c563bd2c3e3e346bd578162105319a2d6 100644 (file)
@@ -40,7 +40,11 @@ import com.intellij.openapi.ui.Messages;
 import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.util.TextRange;
 import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiFileFactory;
+import com.intellij.psi.PsiReference;
+import com.intellij.psi.search.FilenameIndex;
+import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.ui.SortedComboBoxModel;
 import com.intellij.ui.TreeSpeedSearch;
 import com.intellij.ui.treeStructure.Tree;
@@ -55,8 +59,7 @@ import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeModel;
 import javax.swing.tree.TreePath;
 import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
+import java.awt.event.*;
 import java.util.*;
 import java.util.List;
 
@@ -68,6 +71,8 @@ public class PsiViewerDialog extends DialogWrapper {
   private final Tree myTree;
   private final ViewerTreeBuilder myTreeBuilder;
 
+  private final JList myRefs;
+
   private Editor myEditor;
   private String myLastParsedText = null;
 
@@ -76,13 +81,13 @@ public class PsiViewerDialog extends DialogWrapper {
   private FileType[] myFileTypes;
 
   private JCheckBox myShowWhiteSpacesBox;
-
   private JPanel myStructureTreePanel;
   private JPanel myTextPanel;
   private JPanel myPanel;
   private JPanel myChoicesPanel;
   private JCheckBox myShowTreeNodesCheckBox;
   private JComboBox myDialectsComboBox;
+  private JPanel myReferencesPanel;
 
   public PsiViewerDialog(Project project,boolean modal) {
     super(project, true);
@@ -106,6 +111,16 @@ public class PsiViewerDialog extends DialogWrapper {
     myStructureTreePanel.setLayout(new BorderLayout());
     myStructureTreePanel.add(panel, BorderLayout.CENTER);
 
+    myRefs = new JList(new DefaultListModel());
+    JScrollPane refScrollPane = new JScrollPane(myRefs);
+    JPanel refPanel = new JPanel(new BorderLayout());
+    refPanel.add(refScrollPane, BorderLayout.CENTER);
+    myReferencesPanel.setLayout(new BorderLayout());
+    myReferencesPanel.add(refPanel, BorderLayout.CENTER);
+    final GoToListener listener = new GoToListener(myRefs, project);
+    myRefs.addKeyListener(listener);
+    myRefs.addMouseListener(listener);
+
     setModal(modal);
     setOKButtonText("&Build PSI Tree");
     init();
@@ -342,10 +357,21 @@ public class PsiViewerDialog extends DialogWrapper {
           if (end <= textLength) {
             myHighlighter = myEditor.getMarkupModel().addRangeHighlighter(start, end, HighlighterLayer.FIRST + 1, myAttributes, HighlighterTargetArea.EXACT_RANGE);
           }
+          updateReferences(element);
         }
       }
     }
 
+    public void updateReferences(PsiElement element) {
+      final DefaultListModel model = (DefaultListModel)myRefs.getModel();
+      model.clear();
+      if (element != null) {
+        for (PsiReference reference : element.getReferences()) {
+          model.addElement(reference.getClass().getName());
+        }
+      }      
+    }
+
     private void clearSelection() {
       if (myHighlighter != null) {
         myEditor.getMarkupModel().removeHighlighter(myHighlighter);
@@ -360,4 +386,52 @@ public class PsiViewerDialog extends DialogWrapper {
 
     super.dispose();
   }
+
+  private static class GoToListener implements KeyListener, MouseListener {
+    private final JList myList;
+    private final Project myProject;
+
+    public GoToListener(JList list, Project project) {
+      myList = list;
+      myProject = project;
+    }
+
+    private void navigate() {
+      final Object value = myList.getSelectedValue();
+      if (value instanceof String) {
+        final String fqn = (String)value;
+        String filename = fqn;
+        if (fqn.contains(".")) {
+          filename = fqn.substring(fqn.lastIndexOf('.') + 1);
+        }
+        if (filename.contains("$")) {
+          filename = filename.substring(0, filename.indexOf('$'));
+        }
+        filename += ".java";
+        final PsiFile[] files = FilenameIndex.getFilesByName(myProject, filename, GlobalSearchScope.allScope(myProject));
+        if (files != null && files.length > 0) {
+          files[0].navigate(true);
+        }
+      }
+    }
+
+    public void keyPressed(KeyEvent e) {
+      if (e.getKeyCode() == KeyEvent.VK_ENTER) {
+        navigate();
+      }
+    }
+
+    public void mouseClicked(MouseEvent e) {
+      if (e.getClickCount() > 1) {
+        navigate();
+      }
+    }
+
+    public void keyTyped(KeyEvent e) {}
+    public void keyReleased(KeyEvent e) {}
+    public void mousePressed(MouseEvent e) {}
+    public void mouseReleased(MouseEvent e) {}
+    public void mouseEntered(MouseEvent e) {}
+    public void mouseExited(MouseEvent e) {}
+  }
 }
index 67be506566db163086224299f959b56aaa43b0ff..97f62e5156e151c084ba85b8ce55adcc1c3828b7 100644 (file)
@@ -41,6 +41,10 @@ public class PsiAwareTextEditorImpl extends TextEditorImpl {
     return new PsiAwareTextEditorComponent(project, file, this);
   }
 
+  public void initFolding() {
+    CodeFoldingManager.getInstance(myProject).buildInitialFoldings(getEditor());
+  }
+
   public BackgroundEditorHighlighter getBackgroundHighlighter() {
     if (myBackgroundHighlighter == null) {
       myBackgroundHighlighter = new TextEditorBackgroundHighlighter(myProject, getEditor());
@@ -58,7 +62,6 @@ public class PsiAwareTextEditorImpl extends TextEditorImpl {
       super(project, file, textEditor);
       myProject = project;
       myFile = file;
-      CodeFoldingManager.getInstance(project).buildInitialFoldings(getEditor());
     }
 
     @Override
index 2ed8567329a67be75631771d065defc8356f88f2..170a9cdeb793659f26f7b3163a9b5f6326768347 100644 (file)
@@ -333,8 +333,7 @@ public class FileManagerImpl implements FileManager {
 
   @NotNull
   public GlobalSearchScope getResolveScope(@NotNull PsiElement element) {
-    final ProgressManager progressManager = ProgressManager.getInstance();
-    progressManager.checkCanceled();
+    ProgressManager.checkCanceled();
 
     VirtualFile vFile;
     final Project project = myManager.getProject();
@@ -383,10 +382,9 @@ public class FileManagerImpl implements FileManager {
       // resolve references in libraries in context of all modules which contain it
       List<Module> modulesLibraryUsedIn = new ArrayList<Module>();
       List<OrderEntry> orderEntries = projectFileIndex.getOrderEntriesForFile(vFile);
-      final ProgressManager progressManager = ProgressManager.getInstance();
 
       for (OrderEntry entry : orderEntries) {
-        progressManager.checkCanceled();
+        ProgressManager.checkCanceled();
 
         if (entry instanceof JdkOrderEntry) {
           return ((ProjectRootManagerEx)myProjectRootManager).getScopeForJdk((JdkOrderEntry)entry);