Merge branch 'master' of git.labs.intellij.net:idea/community
authorirengrig <Irina.Chernushina@jetbrains.com>
Fri, 16 Apr 2010 17:26:04 +0000 (21:26 +0400)
committerirengrig <Irina.Chernushina@jetbrains.com>
Fri, 16 Apr 2010 17:26:04 +0000 (21:26 +0400)
445 files changed:
bin/nix/idea.sh
java/compiler/impl/src/com/intellij/compiler/actions/CompileProjectAction.java
java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java
java/debugger/impl/src/com/intellij/debugger/impl/GenericDebuggerRunner.java
java/java-impl/src/com/intellij/codeInsight/completion/ConstructorInsertHandler.java
java/java-impl/src/com/intellij/codeInsight/completion/DefaultInsertHandler.java
java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java
java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java
java/java-impl/src/com/intellij/codeInsight/completion/JavaPsiClassReferenceElement.java
java/java-impl/src/com/intellij/codeInsight/completion/JavaSmartCompletionContributor.java
java/java-impl/src/com/intellij/psi/impl/source/tree/injected/MyTestInjector.java
java/java-impl/src/com/intellij/refactoring/changeClassSignature/ChangeClassSignatureProcessor.java
java/java-impl/src/com/intellij/refactoring/convertToInstanceMethod/ConvertToInstanceMethodProcessor.java
java/java-impl/src/com/intellij/refactoring/copy/CopyClassesHandler.java
java/java-impl/src/com/intellij/refactoring/extractInterface/ExtractInterfaceHandler.java
java/java-impl/src/com/intellij/refactoring/extractSuperclass/ExtractSuperclassHandler.java
java/java-impl/src/com/intellij/refactoring/inheritanceToDelegation/InheritanceToDelegationProcessor.java
java/java-impl/src/com/intellij/refactoring/inline/InlineMethodProcessor.java
java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceConstantHandler.java
java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceFieldHandler.java
java/java-impl/src/com/intellij/refactoring/introduceField/LocalToFieldHandler.java
java/java-impl/src/com/intellij/refactoring/migration/MigrationProcessor.java
java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesImpl.java
java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesProcessor.java
java/java-impl/src/com/intellij/refactoring/util/duplicates/MethodDuplicatesHandler.java
java/java-tests/testData/codeInsight/completion/normal/EnumConstantFromEnumMember.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completion/normal/EnumConstantFromEnumMember_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completion/normal/PrimitiveMethodParameter.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completion/normal/PrimitiveMethodParameter_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completion/smartType/TabAfterNew-out.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completion/smartType/TabAfterNew.java [new file with mode: 0644]
java/java-tests/testData/refactoring/inheritanceToDelegation/typeParametersSubstitution/after/A.java [new file with mode: 0644]
java/java-tests/testData/refactoring/inheritanceToDelegation/typeParametersSubstitution/after/Intf.java [new file with mode: 0644]
java/java-tests/testData/refactoring/inheritanceToDelegation/typeParametersSubstitution/before/A.java [new file with mode: 0644]
java/java-tests/testData/refactoring/inheritanceToDelegation/typeParametersSubstitution/before/Intf.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java
java/java-tests/testSrc/com/intellij/refactoring/InheritanceToDelegationTest.java
platform/lang-api/src/com/intellij/execution/runners/GenericProgramRunner.java
platform/lang-api/src/com/intellij/execution/ui/ConsoleViewWrapper.java [deleted file]
platform/lang-api/src/com/intellij/ide/actions/ElementCreator.java
platform/lang-api/src/com/intellij/lang/folding/CompositeFoldingBuilder.java
platform/lang-api/src/com/intellij/lang/folding/FoldingDescriptor.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/CodeFoldingPass.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/InjectedCodeFoldingPass.java
platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CodeFoldingManagerImpl.java
platform/lang-impl/src/com/intellij/codeInsight/folding/impl/DocumentFoldingInfo.java
platform/lang-impl/src/com/intellij/codeInsight/folding/impl/FoldingUpdate.java
platform/lang-impl/src/com/intellij/codeInsight/folding/impl/FoldingUtil.java
platform/lang-impl/src/com/intellij/codeInsight/folding/impl/UpdateFoldRegionsOperation.java
platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/BackspaceHandler.java
platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java
platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/TypedHandler.java
platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java
platform/lang-impl/src/com/intellij/execution/runners/RunContentBuilder.java
platform/lang-impl/src/com/intellij/ide/actions/CreateDirectoryOrPackageAction.java
platform/lang-impl/src/com/intellij/ide/commander/CommanderPanel.java
platform/lang-impl/src/com/intellij/ide/favoritesTreeView/FavoritesTreeViewPanel.java
platform/lang-impl/src/com/intellij/ide/hierarchy/TypeHierarchyBrowserBase.java
platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java
platform/lang-impl/src/com/intellij/ide/scopeView/ScopeTreeViewPanel.java
platform/lang-impl/src/com/intellij/ide/util/DeleteHandler.java
platform/lang-impl/src/com/intellij/injected/editor/EditorWindow.java
platform/lang-impl/src/com/intellij/injected/editor/FoldingModelWindow.java
platform/lang-impl/src/com/intellij/injected/editor/FoldingRegionWindow.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/openapi/roots/impl/DirectoryIndexImpl.java
platform/lang-impl/src/com/intellij/refactoring/BaseRefactoringProcessor.java
platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java
platform/lvcs-api/src/com/intellij/history/DeafLocalHistory.java [deleted file]
platform/lvcs-api/src/com/intellij/history/LocalHistory.java
platform/lvcs-api/src/com/intellij/history/LocalHistoryConfiguration.java [deleted file]
platform/lvcs-api/src/com/intellij/openapi/localVcs/LocalVcs.java [deleted file]
platform/lvcs-api/src/com/intellij/openapi/localVcs/LocalVcsItemsLocker.java [deleted file]
platform/lvcs-api/src/com/intellij/openapi/localVcs/LocalVcsPurgingProvider.java [deleted file]
platform/lvcs-api/src/com/intellij/openapi/localVcs/LocalVcsServices.java [deleted file]
platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsAction.java [deleted file]
platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsComparator.java [deleted file]
platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsDirectory.java [deleted file]
platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsDirectoryRevision.java [deleted file]
platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsFile.java [deleted file]
platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsFileRevision.java [deleted file]
platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsLabel.java [deleted file]
platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsLabelListener.java [deleted file]
platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsObject.java [deleted file]
platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsRevision.java [deleted file]
platform/lvcs-api/src/com/intellij/openapi/localVcs/VirtualFileInfo.java [deleted file]
platform/lvcs-api/src/com/intellij/openapi/localVcs/package.html [deleted file]
platform/lvcs-impl/lvcs-impl.iml
platform/lvcs-impl/src/com/intellij/history/core/ByteContentRetriever.java
platform/lvcs-impl/src/com/intellij/history/core/ChangeCollectingVisitor.java [new file with mode: 0644]
platform/lvcs-impl/src/com/intellij/history/core/ChangeList.java [new file with mode: 0644]
platform/lvcs-impl/src/com/intellij/history/core/ChangeListStorage.java [moved from platform/lvcs-impl/src/com/intellij/history/core/storage/IContentStorage.java with 57% similarity]
platform/lvcs-impl/src/com/intellij/history/core/ChangeListStorageImpl.java [new file with mode: 0644]
platform/lvcs-impl/src/com/intellij/history/core/ChangeSetBlock.java [new file with mode: 0644]
platform/lvcs-impl/src/com/intellij/history/core/ChangeSetsProcessor.java
platform/lvcs-impl/src/com/intellij/history/core/ContentFactory.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/IdPath.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/LabelImpl.java [moved from platform/lvcs-impl/src/com/intellij/history/core/changes/CreateEntryChangeNonAppliedState.java with 73% similarity]
platform/lvcs-impl/src/com/intellij/history/core/LinkedRecordsTable.java [new file with mode: 0644]
platform/lvcs-impl/src/com/intellij/history/core/LinkedStorage.java [new file with mode: 0644]
platform/lvcs-impl/src/com/intellij/history/core/LocalHistoryFacade.java [new file with mode: 0644]
platform/lvcs-impl/src/com/intellij/history/core/LocalVcs.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/Paths.java
platform/lvcs-impl/src/com/intellij/history/core/RevisionsCollector.java
platform/lvcs-impl/src/com/intellij/history/core/changes/Change.java
platform/lvcs-impl/src/com/intellij/history/core/changes/ChangeList.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/changes/ChangeSet.java
platform/lvcs-impl/src/com/intellij/history/core/changes/ChangeVisitor.java
platform/lvcs-impl/src/com/intellij/history/core/changes/ContentChange.java
platform/lvcs-impl/src/com/intellij/history/core/changes/ContentChangeAppliedState.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/changes/ContentChangeNonAppliedState.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/changes/CreateDirectoryChange.java
platform/lvcs-impl/src/com/intellij/history/core/changes/CreateEntryChange.java
platform/lvcs-impl/src/com/intellij/history/core/changes/CreateFileChange.java
platform/lvcs-impl/src/com/intellij/history/core/changes/CreateFileChangeNonAppliedState.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/changes/DeleteChange.java
platform/lvcs-impl/src/com/intellij/history/core/changes/DeleteChangeAppliedState.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/changes/MoveChange.java
platform/lvcs-impl/src/com/intellij/history/core/changes/MoveChangeNonAppliedState.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/changes/PutEntryLabelChange.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/changes/PutLabelChange.java
platform/lvcs-impl/src/com/intellij/history/core/changes/PutSystemLabelChange.java
platform/lvcs-impl/src/com/intellij/history/core/changes/ROStatusChange.java
platform/lvcs-impl/src/com/intellij/history/core/changes/ROStatusChangeAppliedState.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/changes/RenameChange.java
platform/lvcs-impl/src/com/intellij/history/core/changes/RenameChangeAppliedState.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/changes/RenameChangeNonAppliedState.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/changes/SelectiveChangeVisitor.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/changes/StructuralChange.java
platform/lvcs-impl/src/com/intellij/history/core/changes/StructuralChangeAppliedState.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/changes/StructuralChangeNonAppliedState.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/changes/StructuralChangeState.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/revisions/CurrentRevision.java
platform/lvcs-impl/src/com/intellij/history/core/revisions/LabeledRevision.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/revisions/RecentChange.java
platform/lvcs-impl/src/com/intellij/history/core/revisions/Revision.java
platform/lvcs-impl/src/com/intellij/history/core/revisions/RevisionAfterChange.java
platform/lvcs-impl/src/com/intellij/history/core/revisions/RevisionBeforeChange.java
platform/lvcs-impl/src/com/intellij/history/core/storage/CachingContentStorage.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/storage/CompressingContentStorage.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/storage/Content.java
platform/lvcs-impl/src/com/intellij/history/core/storage/ContentStorage.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/storage/Storage.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/storage/StorageChecker.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/storage/StoredContent.java
platform/lvcs-impl/src/com/intellij/history/core/storage/Stream.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/storage/StreamUtil.java [new file with mode: 0644]
platform/lvcs-impl/src/com/intellij/history/core/storage/ThreadSafeContentStorage.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/storage/UnavailableContent.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/core/tree/DirectoryEntry.java
platform/lvcs-impl/src/com/intellij/history/core/tree/Entry.java
platform/lvcs-impl/src/com/intellij/history/core/tree/FileEntry.java
platform/lvcs-impl/src/com/intellij/history/core/tree/RootEntry.java
platform/lvcs-impl/src/com/intellij/history/deprecated/DeprecatedLVCS.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/deprecated/DeprecatedLvcsServicesImpl.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/integration/CacheUpdaterProcessor.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/integration/EventDispatcher.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/integration/FileFilter.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/integration/IdeaGateway.java
platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryActionImpl.java
platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryBundle.properties
platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryCacheUpdater.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryComponent.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryEventDispatcher.java [new file with mode: 0644]
platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryFacade.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryImpl.java [new file with mode: 0644]
platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryService.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/integration/patches/PatchCreator.java
platform/lvcs-impl/src/com/intellij/history/integration/revertion/ChangeReverter.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/integration/revertion/ChangeRevertingVisitor.java [moved from platform/lvcs-impl/src/com/intellij/history/integration/revertion/ChangeRevertionVisitor.java with 50% similarity]
platform/lvcs-impl/src/com/intellij/history/integration/revertion/DifferenceReverter.java
platform/lvcs-impl/src/com/intellij/history/integration/revertion/Reverter.java
platform/lvcs-impl/src/com/intellij/history/integration/revertion/RevisionReverter.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/integration/revertion/SelectionReverter.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/actions/LocalHistoryAction.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/actions/LocalHistoryActionWithDialog.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/actions/PutLabelAction.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/actions/RecentChangesAction.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/actions/ShowHistoryAction.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/actions/ShowSelectionHistoryAction.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/models/DirectoryChangeModel.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/models/DirectoryHistoryDialogModel.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/models/EntireFileDifferenceModel.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/models/EntireFileHistoryDialogModel.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/models/FileDifferenceModel.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/models/FileHistoryDialogModel.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/models/HistoryDialogModel.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/models/RecentChangeDialogModel.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/models/SelectionDifferenceModel.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/views/DirectoryHistoryDialog.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/views/FileHistoryDialog.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/views/HistoryDialog.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/views/LocalHistoryConfigurable.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/integration/ui/views/PutLabelDialog.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/integration/ui/views/RecentChangeDialog.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/views/RecentChangesPopup.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/views/RevisionsList.java [new file with mode: 0644]
platform/lvcs-impl/src/com/intellij/history/integration/ui/views/SelectionHistoryDialog.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/views/SelectionHistoryDialogModel.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/views/table/ArrowBorder.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/integration/ui/views/table/RevisionsTable.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/integration/ui/views/table/RevisionsTableCellRenderer.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/integration/ui/views/table/RevisionsTableModel.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/integration/ui/views/table/RevisionsTableUI.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/integration/ui/views/table/ShiftedCellRendererWrapper.java [deleted file]
platform/lvcs-impl/src/com/intellij/history/utils/Reversed.java [deleted file]
platform/lvcs-impl/src/com/intellij/openapi/command/impl/ChangeRange.java
platform/lvcs-impl/src/com/intellij/openapi/command/impl/ChangeRangeRevertionVisitor.java [deleted file]
platform/lvcs-impl/src/com/intellij/openapi/command/impl/FileUndoProvider.java
platform/lvcs-impl/testSrc/com/intellij/history/core/ContentFactoryTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/IdPathTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/InMemoryChangeList.java [moved from platform/lvcs-impl/src/com/intellij/history/core/changes/ROStatusChangeNonAppliedState.java with 73% similarity]
platform/lvcs-impl/testSrc/com/intellij/history/core/InMemoryChangeListStorage.java [new file with mode: 0644]
platform/lvcs-impl/testSrc/com/intellij/history/core/InMemoryLocalHistoryFacade.java [moved from platform/lvcs-impl/src/com/intellij/history/core/changes/MoveChangeAppliedState.java with 74% similarity]
platform/lvcs-impl/testSrc/com/intellij/history/core/InMemoryLocalVcs.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/InMemoryStorage.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/LocalHistoryTestCase.java [new file with mode: 0644]
platform/lvcs-impl/testSrc/com/intellij/history/core/LocalVcsBasicsTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/LocalVcsChangeSetsTest.java
platform/lvcs-impl/testSrc/com/intellij/history/core/LocalVcsDatedContentTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/LocalVcsLabelsTest.java
platform/lvcs-impl/testSrc/com/intellij/history/core/LocalVcsPurgingTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/LocalVcsRecentChangesTest.java
platform/lvcs-impl/testSrc/com/intellij/history/core/LocalVcsRevisionsTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/LocalVcsSavingAfterChangeSetsTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/LocalVcsSavingTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/LocalVcsTestCase.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/LocalVcsVisitingTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/PathsTest.java
platform/lvcs-impl/testSrc/com/intellij/history/core/TempDirTestCase.java
platform/lvcs-impl/testSrc/com/intellij/history/core/changes/ChangeListChainsTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/changes/ChangeListCollectingChangesTest.java
platform/lvcs-impl/testSrc/com/intellij/history/core/changes/ChangeListPurgingTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/changes/ChangeListTest.java
platform/lvcs-impl/testSrc/com/intellij/history/core/changes/ChangeListTestCase.java
platform/lvcs-impl/testSrc/com/intellij/history/core/changes/ChangeSetTest.java
platform/lvcs-impl/testSrc/com/intellij/history/core/changes/ChangesApplyAndRevertTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/changes/ChangesCanRevertTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/changes/ChangesRevertingTest.java [new file with mode: 0644]
platform/lvcs-impl/testSrc/com/intellij/history/core/changes/PutLabelChangesTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/changes/RootEntryDirectoriesTest.java
platform/lvcs-impl/testSrc/com/intellij/history/core/changes/RootEntryFilesTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/changes/RootEntryRootsTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/changes/StructuralChangesPurgingTest.java
platform/lvcs-impl/testSrc/com/intellij/history/core/changes/StructuralChangesTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/revisions/RevisionsAfterChangeTest.java
platform/lvcs-impl/testSrc/com/intellij/history/core/revisions/RevisionsCauseChangesTest.java
platform/lvcs-impl/testSrc/com/intellij/history/core/revisions/RevisionsIsImportantTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/storage/ByteContentTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/storage/CachingContentStorageTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/storage/CompressingContentStorageTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/storage/ContentStorageTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/storage/StorageTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/storage/StoredContentTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/storage/StreamTest.java
platform/lvcs-impl/testSrc/com/intellij/history/core/storage/TestContent.java [moved from platform/lvcs-impl/src/com/intellij/history/core/storage/ByteContent.java with 86% similarity]
platform/lvcs-impl/testSrc/com/intellij/history/core/storage/UnavailableContentTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/core/tree/DirectoryEntryTest.java
platform/lvcs-impl/testSrc/com/intellij/history/core/tree/EntryTest.java
platform/lvcs-impl/testSrc/com/intellij/history/core/tree/FileEntryTest.java
platform/lvcs-impl/testSrc/com/intellij/history/core/tree/RootEntryFindingTest.java
platform/lvcs-impl/testSrc/com/intellij/history/core/tree/RootEntryTest.java
platform/lvcs-impl/testSrc/com/intellij/history/integration/EventDispatcherActionPerformingTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/EventDispatcherCommandProcessingTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/EventDispatcherFilteringTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/EventDispatcherListeningTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/EventDispatcherRefreshingTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/EventDispatcherTestCase.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/FileFilterTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/FormatUtilTest.java
platform/lvcs-impl/testSrc/com/intellij/history/integration/IdeaGatewayTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/LocalHistoryCacheUpdaterTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/LocalHistoryComponentTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/LocalHistoryServiceCommandProcessingAndActionsTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/LocalHistoryServiceFileListeningTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/LocalHistoryServiceRootsOnStartupTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/LocalHistoryServiceRootsOnUpdateTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/LocalHistoryServiceTestCase.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/TestFileFilter.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/TestIdeaGateway.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/TestVirtualFile.java
platform/lvcs-impl/testSrc/com/intellij/history/integration/UpdaterAsCacheUpdaterTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/ui/models/DirectoryChangeModelTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/ui/models/EntireFileHistoryDialogModelTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/ui/models/HistoryDialogModelTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/ui/models/RecentChangeDialogModelTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/history/integration/ui/models/SelectionCalculatorTest.java
platform/lvcs-impl/testSrc/com/intellij/history/utils/ReversedTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/ActionsTest.java
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/BasicsTest.java
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/ContentRootsAndUpdatingTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/ExternalChangesAndRefreshingTest.java
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/FileListeningTest.java
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/GettingContentAtDateTest.java [new file with mode: 0644]
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/IdeaGatewayTest.java
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/IntegrationTestCase.java
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/PatchingTestCase.java
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/PurgingTest.java [new file with mode: 0644]
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/RevisionsAndDiffsTest.java [new file with mode: 0644]
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/VisitingTest.java [new file with mode: 0644]
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/patches/PatchCreatorTest.java
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/revertion/ChangeReverterCanRevertTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/revertion/ChangeReverterOptimizationTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/revertion/ChangeReverterROStatusClearingTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/revertion/ChangeReverterTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/revertion/ChangeReverterTestCase.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/revertion/DifferenceReverterTest.java
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/revertion/IsFromRefreshFileListener.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/revertion/SelectionReverterTest.java
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/ui/DirectoryChangeModelTest.java [new file with mode: 0644]
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/ui/DirectoryHistoryDialogModelTest.java
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/ui/DirectoryHistoryDialogPatchCreationTest.java
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/ui/DirectoryHistoryDialogTest.java
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/ui/FileHistoryDialogTest.java
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/ui/HistoryDialogModelTest.java [new file with mode: 0644]
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/ui/LocalHistoryActionsTest.java
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/ui/PutLabelDialogTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/ui/RecentChangeDialogTest.java
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/ui/SelectionHistoryDialogTest.java
platform/lvcs-impl/testSrc/com/intellij/historyPerfTests/BasicsTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/historyPerfTests/CompressingContentStorageTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/historyPerfTests/ContentStorageTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/historyPerfTests/LocalVcsPerformanceTestCase.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/historyPerfTests/MemoryTest.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/historyPerfTests/PerformanceTestCase.java [deleted file]
platform/lvcs-impl/testSrc/com/intellij/historyPerfTests/SelectionCalculatorTest.java [deleted file]
platform/platform-api/src/com/intellij/execution/configurations/GeneralCommandLine.java
platform/platform-api/src/com/intellij/openapi/actionSystem/CommonShortcuts.java
platform/platform-api/src/com/intellij/openapi/project/Project.java
platform/platform-api/src/com/intellij/openapi/vfs/newvfs/FileAttribute.java
platform/platform-api/src/com/intellij/openapi/vfs/newvfs/NewVirtualFile.java
platform/platform-api/src/com/intellij/ui/IdeBorderFactory.java
platform/platform-api/src/com/intellij/util/Alarm.java
platform/platform-api/src/com/intellij/util/ui/update/Update.java
platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java
platform/platform-impl/src/com/intellij/ide/actions/UndoRedoAction.java
platform/platform-impl/src/com/intellij/openapi/command/impl/DocumentReferenceManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/command/impl/UndoManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/command/impl/UndoProvider.java
platform/platform-impl/src/com/intellij/openapi/command/impl/UndoRedo.java
platform/platform-impl/src/com/intellij/openapi/command/impl/UndoRedoStacksHolder.java
platform/platform-impl/src/com/intellij/openapi/command/impl/UndoableGroup.java
platform/platform-impl/src/com/intellij/openapi/diff/ex/DiffStatusBar.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffUtil.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/external/FrameDiffTool.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/mergeTool/MergeTool.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/splitter/FoldingTransformation.java
platform/platform-impl/src/com/intellij/openapi/editor/ex/FoldingModelEx.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldRegionImpl.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldingModelImpl.java
platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java
platform/platform-impl/src/com/intellij/openapi/ui/FrameWrapper.java [moved from platform/platform-impl/src/com/intellij/openapi/diff/impl/FrameWrapper.java with 81% similarity]
platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualDirectoryImpl.java
platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualFileImpl.java
platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java
platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFS.java
platform/platform-resources-en/src/messages/CommonBundle.properties
platform/platform-resources-en/src/messages/ExecutionBundle.properties
platform/platform-resources-en/src/misc/registry.properties
platform/platform-resources/src/META-INF/PlatformExtensions.xml
platform/platform-resources/src/META-INF/PlatformLangPlugin.xml
platform/platform-resources/src/componentSets/LocalHistory.xml [deleted file]
platform/platform-resources/src/componentSets/Platform.xml
platform/platform-resources/src/componentSets/PlatformComponents.xml
platform/platform-resources/src/componentSets/PlatformLangComponents.xml
platform/testFramework/src/com/intellij/testFramework/PlatformTestCase.java
platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
platform/testFramework/testFramework.iml
platform/testRunner/src/com/intellij/execution/testframework/LvcsHelper.java
platform/util/src/com/intellij/util/containers/ContainerUtil.java
platform/util/src/com/intellij/util/io/storage/AbstractRecordsTable.java [new file with mode: 0644]
platform/util/src/com/intellij/util/io/storage/AbstractStorage.java
platform/util/src/com/intellij/util/io/storage/CompactStorage.java [deleted file]
platform/util/src/com/intellij/util/io/storage/RecordsTable.java
platform/util/src/com/intellij/util/io/storage/RefCountingRecordsTable.java [new file with mode: 0644]
platform/util/src/com/intellij/util/io/storage/RefCountingStorage.java [new file with mode: 0644]
platform/util/src/com/intellij/util/io/storage/Storage.java
platform/util/testSrc/com/intellij/util/containers/ContainerUtilTest.java
platform/util/testSrc/com/intellij/util/io/storage/StorageTest.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesTreeBrowser.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/MockAbstractVcs.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/WiseSplitter.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/RollbackWorker.java
platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java
platform/vcs-impl/src/com/intellij/openapi/vcs/update/AbstractCommonUpdateAction.java
platform/xdebugger-api/src/com/intellij/xdebugger/breakpoints/XLineBreakpointType.java
plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties
plugins/InspectionGadgets/src/com/siyeh/ig/abstraction/MethodOnlyUsedFromInnerClassInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/bugs/ReflectionForUnavailableAnnotationInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/errorhandling/ExceptionFromCatchWhichDoesntWrapInspection.java
plugins/InspectionGadgets/src/inspectionDescriptions/MethodOnlyUsedFromInnerClass.html
plugins/InspectionGadgets/src/inspectionDescriptions/ReflectionForUnavailableAnnotation.html
plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/ReflectionForUnavailableAnnotationInspection.java
plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/SourceAnnotation.java [deleted file]
plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/UnretainedAnnotation.java [deleted file]
plugins/IntelliLang/xml-support/resources/xmlInjections.xml
plugins/ant/src/META-INF/plugin.xml
plugins/ant/src/com/intellij/lang/ant/AntSupport.java
plugins/ant/src/com/intellij/lang/ant/config/execution/ExecutionHandler.java
plugins/ant/src/com/intellij/lang/ant/dom/AntDomDependentTargetReference.java [deleted file]
plugins/ant/src/com/intellij/lang/ant/dom/AntDomElement.java
plugins/ant/src/com/intellij/lang/ant/dom/AntDomExtender.java
plugins/ant/src/com/intellij/lang/ant/dom/AntDomFileDescription.java
plugins/ant/src/com/intellij/lang/ant/dom/AntDomProject.java
plugins/ant/src/com/intellij/lang/ant/dom/AntDomReference.java [deleted file]
plugins/ant/src/com/intellij/lang/ant/dom/AntDomTarget.java
plugins/ant/src/com/intellij/lang/ant/dom/AntDomTargetConverter.java [new file with mode: 0644]
plugins/ant/src/com/intellij/lang/ant/dom/AntDomTargetDependsListConverter.java [new file with mode: 0644]
plugins/ant/src/com/intellij/lang/ant/dom/AntReferenceInjector.java
plugins/ant/src/com/intellij/lang/ant/psi/changes/AntChangeVisitor.java
plugins/ant/src/com/intellij/lang/ant/psi/impl/ReflectedProject.java
plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/AbstractAction.java
plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsstatuses/CvsChangeProvider.java
plugins/git4idea/src/git4idea/actions/GitMerge.java
plugins/git4idea/src/git4idea/actions/GitPull.java
plugins/git4idea/src/git4idea/merge/GitMergeUtil.java
plugins/groovy/src/org/jetbrains/plugins/groovy/gradle/GradlePositionManager.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/GroovyPropertyUtils.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/noncode/ImmutableAnnotationProcessor.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/processors/MethodResolverProcessor.java
plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyHighlightingTest.java
plugins/groovy/testdata/highlighting/BooleanProperties.groovy [new file with mode: 0644]
plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/PropertyFoldingBuilder.java
plugins/junit/src/com/intellij/execution/junit2/ui/actions/LvcsLabeler.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/annotator/MavenDomGutterAnnotator.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsManagerWatcher.java
plugins/maven/src/test/java/org/jetbrains/idea/maven/embedder/MavenEmbedderWrapperTest.java
plugins/svn4idea/src/org/jetbrains/idea/svn/actions/BasicAction.java
plugins/testng/src/com/theoryinpractice/testng/util/TestNGUtil.java
plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/run/HighlightingOutputConsole.java
plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/run/RunSettingsEditor.form
plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/run/XsltCommandLineState.java
plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/run/XsltRunConfiguration.java
plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/run/XsltRunSettingsEditor.java
plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/XPathExpressionGenerator.java
plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/util/Namespace.java
plugins/xpath/xslt-rt/src/org/intellij/plugins/xslt/run/rt/XSLTRunner.java
resources/src/META-INF/IdeaPlugin.xml
resources/src/componentSets/Dom.xml [deleted file]
resources/src/componentSets/IdeaComponents.xml
resources/src/componentSets/InspectionComponents.xml
xml/dom-impl/src/META-INF/DomPlugin.xml [moved from resources/src/META-INF/DomPlugin.xml with 94% similarity]
xml/dom-impl/src/com/intellij/util/xml/impl/VirtualDomParentStrategy.java

index f81b8298b51ba6c0fd539f7c342c890e7b48131a..486bfd094e2ad709f9533b61f0aa1f1ba567165e 100644 (file)
 # ---------------------------------------------------------------------
 if [ -z "$IDEA_JDK" ]; then
   IDEA_JDK=$JDK_HOME
+  if [ -z "$IDEA_JDK" -a -e "$JAVA_HOME/lib/tools.jar" ]; then
+    IDEA_JDK=$JAVA_HOME
+  fi
+  if [ -z "$IDEA_JDK" ]; then
+    # Try to get the jdk path from java binary path
+    JAVA_BIN_PATH=`which java`
+    if [ -n "$JAVA_BIN_PATH" ]; then
+      JAVA_LOCATION=`readlink -f $JAVA_BIN_PATH | xargs dirname | xargs dirname | xargs dirname`
+      if [ -x "$JAVA_LOCATION/bin/java" -a -e "$JAVA_LOCATION/lib/tools.jar" ]; then
+        IDEA_JDK=$JAVA_LOCATION
+      fi
+    fi
+  fi
   if [ -z "$IDEA_JDK" ]; then
     echo ERROR: cannot start IntelliJ IDEA.
     echo No JDK found to run IDEA. Please validate either IDEA_JDK or JDK_HOME points to valid JDK installation
index f5956d391adf2abd94cb012ac8fdbadabe9c4bb3..fde4f552a8ca5b19874b984d7dd503aecbd8efdc 100644 (file)
@@ -16,7 +16,6 @@
 package com.intellij.compiler.actions;
 
 import com.intellij.history.LocalHistory;
-import com.intellij.history.LocalHistoryConfiguration;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.actionSystem.PlatformDataKeys;
@@ -31,14 +30,12 @@ public class CompileProjectAction extends CompileActionBase {
   protected void doAction(DataContext dataContext, final Project project) {
     CompilerManager.getInstance(project).rebuild(new CompileStatusNotification() {
       public void finished(boolean aborted, int errors, int warnings, final CompileContext compileContext) {
-        if (!aborted && LocalHistoryConfiguration.getInstance().ADD_LABEL_ON_PROJECT_COMPILATION) {
-          String text = getTemplatePresentation().getText();
-          if (!project.isDisposed()) {
-            LocalHistory.putSystemLabel(project, errors == 0
-                                           ? CompilerBundle.message("rebuild.lvcs.label.no.errors", text)
-                                           : CompilerBundle.message("rebuild.lvcs.label.with.errors", text));
-          }
-        }
+        if (aborted) return;
+
+        String text = getTemplatePresentation().getText();
+        LocalHistory.getInstance().putSystemLabel(project, errors == 0
+                                       ? CompilerBundle.message("rebuild.lvcs.label.no.errors", text)
+                                       : CompilerBundle.message("rebuild.lvcs.label.with.errors", text));
       }
     });
   }
index 6a918af4bc3362a181128e7993034a7fa19df74e..cfcbcca7435361757fd5a94bac9ea169fe0166bf 100644 (file)
@@ -833,10 +833,8 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent {
     if (file.getFileSystem() instanceof LocalFileSystem) {
       if (file.isDirectory()) {
         if (dbOnly) {
-          for (VirtualFile child : ((NewVirtualFile)file).getInDbChildren()) {
-            if (NullVirtualFile.INSTANCE != child) {
-              processRecursively(child, true, processor);
-            }
+          for (VirtualFile child : ((NewVirtualFile)file).iterInDbChildren()) {
+            processRecursively(child, true, processor);
           }
         }
         else {
index dca79b50e200eb43cbedd374c27b10912c043c9d..b0e4ed0e3e2d807bc17e11bed88956786221c319 100644 (file)
@@ -25,8 +25,6 @@ import com.intellij.execution.executors.DefaultDebugExecutor;
 import com.intellij.execution.runners.ExecutionEnvironment;
 import com.intellij.execution.runners.JavaPatchableProgramRunner;
 import com.intellij.execution.ui.RunContentDescriptor;
-import com.intellij.history.LocalHistory;
-import com.intellij.history.LocalHistoryConfiguration;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.options.SettingsEditor;
 import com.intellij.openapi.project.Project;
@@ -46,16 +44,16 @@ public class GenericDebuggerRunner extends JavaPatchableProgramRunner<GenericDeb
   protected RunContentDescriptor doExecute(final Project project, final Executor executor, final RunProfileState state, final RunContentDescriptor contentToReuse,
                                            final ExecutionEnvironment env) throws ExecutionException {
     FileDocumentManager.getInstance().saveAllDocuments();
+    return createContentDescriptor(project, executor, state, contentToReuse, env);
+  }
 
-    if (LocalHistoryConfiguration.getInstance().ADD_LABEL_ON_RUNNING) {
-      final String name = env.getRunProfile().getName();
-      final String label = state instanceof RemoteState
-                           ? DebuggerBundle.message("debugger.runner.vcs.label.remote.debug", name)
-                           : DebuggerBundle.message("debugger.runner.vcs.label.debugging", name);
-      LocalHistory.putSystemLabel(project, label);
-    }
+  @Override
+  protected String getLocalHistoryLabel(RunProfile profile, RunProfileState state) {
+    final String name = profile.getName();
+    return state instanceof RemoteState
+                         ? DebuggerBundle.message("debugger.runner.vcs.label.remote.debug", name)
+                         : DebuggerBundle.message("debugger.runner.vcs.label.debugging", name);
 
-    return createContentDescriptor(project, executor, state, contentToReuse, env);
   }
 
   @Nullable
index 146cbcf41f2363394dc5b2e26e7d283806b28115..38c0516be7759e867cce4e6c33edb9c6c0e1fb3a 100644 (file)
@@ -36,10 +36,11 @@ class ConstructorInsertHandler implements InsertHandler<LookupElementDecorator<L
 
   public void handleInsert(InsertionContext context, LookupElementDecorator<LookupItem> item) {
     @SuppressWarnings({"unchecked"}) final LookupItem<PsiClass> delegate = item.getDelegate();
-    delegate.handleInsert(context);
 
     insertParentheses(context, delegate, delegate.getObject());
 
+    DefaultInsertHandler.addImportForItem(context.getFile(), context.getStartOffset(), delegate);
+
     final PsiElement position = SmartCompletionDecorator.getPosition(context, delegate);
 
     final PsiExpression enclosing = PsiTreeUtil.getContextOfType(position, PsiExpression.class, true);
@@ -66,8 +67,6 @@ class ConstructorInsertHandler implements InsertHandler<LookupElementDecorator<L
   }
 
   public static void insertParentheses(InsertionContext context, LookupItem delegate, final PsiClass psiClass) {
-    PsiDocumentManager.getInstance(context.getProject()).doPostponedOperationsAndUnblockDocument(context.getEditor().getDocument());
-
     final PsiElement place = context.getFile().findElementAt(context.getStartOffset());
     final PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(context.getProject()).getResolveHelper();
     assert place != null;
index c12a935e86e9b058004f3f315edbf620941dfbb6..a699861def3e2c83d4aee5a153b5032f86682d45 100644 (file)
@@ -80,10 +80,12 @@ public class DefaultInsertHandler extends TemplateInsertHandler implements Clone
     final boolean needLeftParenth = isToInsertParenth();
     final boolean hasParams = needLeftParenth && hasParams();
 
-    if (CompletionUtil.isOverwrite(item, completionChar))
+    if (CompletionUtil.isOverwrite(item, completionChar)) {
       removeEndOfIdentifier(needLeftParenth && hasParams);
-    else if(myContext.getOffsetMap().getOffset(CompletionInitializationContext.IDENTIFIER_END_OFFSET) != myContext.getSelectionEndOffset())
+    }
+    else if(myContext.getOffsetMap().getOffset(CompletionInitializationContext.IDENTIFIER_END_OFFSET) != myContext.getSelectionEndOffset()) {
       JavaCompletionUtil.resetParensInfo(context.getOffsetMap());
+    }
 
     handleParenses(hasParams, needLeftParenth, tailType);
     handleBrackets();
@@ -253,7 +255,7 @@ public class DefaultInsertHandler extends TemplateInsertHandler implements Clone
     }
   }
 
-  private boolean isToInsertParenth(){
+  protected boolean isToInsertParenth(){
     return insertingAnnotationWithParameters();
   }
 
index d6d33237a64abaa929512ea445ce819c2ef6c793..ff460f723914a7ff39f4fc852049a2a7abf0701a 100644 (file)
@@ -37,7 +37,6 @@ import com.intellij.openapi.util.Computable;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.patterns.ElementPattern;
 import com.intellij.patterns.PatternCondition;
-import static com.intellij.patterns.PsiJavaPatterns.*;
 import com.intellij.patterns.PsiNameValuePairPattern;
 import com.intellij.psi.*;
 import com.intellij.psi.filters.*;
@@ -60,6 +59,8 @@ import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.Set;
 
+import static com.intellij.patterns.PsiJavaPatterns.*;
+
 /**
  * @author peter
  */
@@ -88,7 +89,7 @@ public class JavaCompletionContributor extends CompletionContributor {
   @Nullable 
   private static ElementFilter getReferenceFilter(PsiElement position) {
     // Completion after extends in interface, type parameter and implements in class
-    final PsiClass containingClass = PsiTreeUtil.getParentOfType(position, PsiClass.class, false, PsiCodeBlock.class, PsiMethod.class, PsiExpressionList.class);
+    final PsiClass containingClass = PsiTreeUtil.getParentOfType(position, PsiClass.class, false, PsiCodeBlock.class, PsiMethod.class, PsiExpressionList.class, PsiVariable.class);
     if (containingClass != null && psiElement().afterLeaf(PsiKeyword.EXTENDS, PsiKeyword.IMPLEMENTS, ",", "&").accepts(position)) {
       return new AndFilter(ElementClassFilter.CLASS, new NotFilter(new AssignableFromContextFilter()));
     }
index 0d2d3ad6174275d1415d0ee8a4ada5f97c7fcedd..716b8b940dc92274d0742768d9ea1fd1be5a129a 100644 (file)
@@ -60,8 +60,7 @@ public class JavaCompletionData extends JavaAwareCompletionData{
       new ParentElementFilter(new ClassFilter(PsiTryStatement.class)))
 )));
   public static final PsiJavaElementPattern.Capture<PsiElement> INSIDE_PARAMETER_LIST =
-    PsiJavaPatterns.psiElement().withSuperParent(
-      2, 
+    PsiJavaPatterns.psiElement().withParent(
       psiElement(PsiJavaCodeReferenceElement.class).withParent(
         psiElement(PsiTypeElement.class).withParent(PsiParameterList.class)));
 
index e3602ac3ef94c55b45b349cd2ce42859e11c96a5..c2fd803c698cfeadbb2ae1bb694a36fd2f033758 100644 (file)
@@ -31,8 +31,8 @@ public class JavaPsiClassReferenceElement extends LookupItem<Object> {
   public static final InsertHandler<JavaPsiClassReferenceElement> JAVA_CLASS_INSERT_HANDLER = new InsertHandler<JavaPsiClassReferenceElement>() {
     public void handleInsert(final InsertionContext context, final JavaPsiClassReferenceElement item) {
       if (completingRawConstructor(context, item)) {
-        DefaultInsertHandler.NO_TAIL_HANDLER.handleInsert(context, item);
         ConstructorInsertHandler.insertParentheses(context, item, item.getObject());
+        DefaultInsertHandler.addImportForItem(context.getFile(), context.getStartOffset(), item);
       } else {
         new DefaultInsertHandler().handleInsert(context, item);
       }
index 841795650167824458119628ac549e82777c2545..096d07f863bbcdfed2dc9078ca84dafcac9c5c64 100644 (file)
@@ -174,7 +174,6 @@ public class JavaSmartCompletionContributor extends CompletionContributor {
                   JavaCompletionUtil.setShowFQN((LookupItem)item);
                 } else {
                 }
-                ((LookupItem) item).setInsertHandler(DefaultInsertHandler.NO_TAIL_HANDLER);
                 result.addElement(decorate(LookupElementDecorator.withInsertHandler((LookupItem)item, ConstructorInsertHandler.INSTANCE), infos));
               }
             }
@@ -578,7 +577,6 @@ public class JavaSmartCompletionContributor extends CompletionContributor {
       item.setAttribute(LookupItem.INDICATE_ANONYMOUS, "");
     }
 
-    item.setInsertHandler(DefaultInsertHandler.NO_TAIL_HANDLER);
     result.addElement(decorate(type instanceof PsiClassType ? LookupElementDecorator.withInsertHandler(item, ConstructorInsertHandler.INSTANCE) : item, infos));
   }
 
@@ -621,13 +619,19 @@ public class JavaSmartCompletionContributor extends CompletionContributor {
       PsiElement element = file.findElementAt(context.getStartOffset());
       if (element instanceof PsiIdentifier) {
         element = element.getParent();
-        while (element instanceof PsiJavaCodeReferenceElement || element instanceof PsiMethodCallExpression ||
+        while (element instanceof PsiJavaCodeReferenceElement || element instanceof PsiCall ||
                element instanceof PsiThisExpression || element instanceof PsiSuperExpression ||
                element instanceof PsiTypeElement ||
                element instanceof PsiClassObjectAccessExpression) {
           int newEnd = element.getTextRange().getEndOffset();
           if (element instanceof PsiMethodCallExpression) {
-            newEnd = ((PsiMethodCallExpression)element).getMethodExpression().getElement().getTextRange().getEndOffset();
+            newEnd = ((PsiMethodCallExpression)element).getMethodExpression().getTextRange().getEndOffset();
+          }
+          else if (element instanceof PsiNewExpression) {
+            final PsiJavaCodeReferenceElement classReference = ((PsiNewExpression)element).getClassReference();
+            if (classReference != null) {
+              newEnd = classReference.getTextRange().getEndOffset();
+            }
           }
           context.getOffsetMap().addOffset(CompletionInitializationContext.IDENTIFIER_END_OFFSET, newEnd);
           element = element.getParent();
index 6562de5b88e0ee41554a124b027cade6553aef67..3474da35d17a610f6a6e24800450e8fd3d164da4 100644 (file)
@@ -159,6 +159,7 @@ public class MyTestInjector {
     final Language ql = findLanguageByID("JPAQL");
     final Language js = findLanguageByID("JavaScript");
     if (ql == null || js == null) return;
+    final Language ecma4 = findLanguageByID("ECMA Script Level 4");
 
     final MultiHostInjector myMultiHostInjector = new MultiHostInjector() {
       public void getLanguagesToInject(@NotNull MultiHostRegistrar registrar, @NotNull PsiElement context) {
@@ -227,6 +228,10 @@ public class MyTestInjector {
             inject(host, placesToInject, js);
             return;
           }
+          if (ecma4 != null && "ecma4".equals(tag.getLocalName())) {
+            inject(host, placesToInject, ecma4);
+            return;
+          }
           if ("jsprefix".equals(tag.getLocalName())) {
             inject(host, placesToInject, js, "function foo(doc, window){", "}");
             return;
index eff1ee26c4e0a64413acc8c2b167ad1e670ed44f..3398a0594f04f748cbb2f67c8216508e9fe5d987 100644 (file)
@@ -83,7 +83,7 @@ public class ChangeClassSignatureProcessor extends BaseRefactoringProcessor {
   }
 
   protected void performRefactoring(UsageInfo[] usages) {
-    LocalHistoryAction a = LocalHistory.startAction(myProject, getCommandName());
+    LocalHistoryAction a = LocalHistory.getInstance().startAction(getCommandName());
     try {
       doRefactoring(usages);
     }
index c192501dceb573be2f8d399dea185a4096daa003..aed16d3c631a00a713f6ba60d45d198b8e46646a 100644 (file)
@@ -211,7 +211,7 @@ public class ConvertToInstanceMethodProcessor extends BaseRefactoringProcessor {
 
   protected void performRefactoring(UsageInfo[] usages) {
     if (!CommonRefactoringUtil.checkReadOnlyStatus(myProject, myTargetClass)) return;
-    LocalHistoryAction a = LocalHistory.startAction(myProject, getCommandName());
+    LocalHistoryAction a = LocalHistory.getInstance().startAction(getCommandName());
     try {
       doRefactoring(usages);
     }
index e236ae7550ccc430f5c3d51654748b97d1901299..ec8f1bf607d7652b32ae87b3e97f2b69909b2912 100644 (file)
@@ -294,8 +294,8 @@ public class CopyClassesHandler implements CopyHandlerDelegate {
   private static PsiClass[] getTopLevelClasses(PsiElement element) {
     while (true) {
       if (element == null || element instanceof PsiFile) break;
-      if (element instanceof PsiClass && (((PsiClass)element).getContainingClass() == null)) break;
-      element = element.getContext();
+      if (element instanceof PsiClass && element.getParent() != null && (((PsiClass)element).getContainingClass() == null)) break;
+      element = element.getParent();
     }
     if (element instanceof PsiClassOwner) {
       PsiClass[] classes = ((PsiClassOwner)element).getClasses();
index 8681c97d53c2a51c5253be52eb328239be8a4dea..eae9a2708121c23cf6889a24aa93f6f47f4ddce4 100644 (file)
@@ -106,7 +106,7 @@ public class ExtractInterfaceHandler implements RefactoringActionHandler, Elemen
 
 
   private void doRefactoring() throws IncorrectOperationException {
-    LocalHistoryAction a = LocalHistory.startAction(myProject, getCommandName());
+    LocalHistoryAction a = LocalHistory.getInstance().startAction(getCommandName());
     PsiClass anInterface = null;
     try {
       anInterface = extractInterface(myTargetDir, myClass, myInterfaceName, mySelectedMembers, myJavaDocPolicy);
index 4aeb4bb5b64da78569f0eef701837ab6f74a76e7..70641e1f052f0c292472860e9a59e1d21b7d5fbb 100644 (file)
@@ -151,7 +151,7 @@ public class ExtractSuperclassHandler implements RefactoringActionHandler, Extra
     final PsiDirectory targetDirectory = dialog.getTargetDirectory();
     final MemberInfo[] selectedMemberInfos = dialog.getSelectedMemberInfos();
     final DocCommentPolicy javaDocPolicy = new DocCommentPolicy(dialog.getJavaDocPolicy());
-    LocalHistoryAction a = LocalHistory.startAction(myProject, getCommandName(subclass, superclassName));
+    LocalHistoryAction a = LocalHistory.getInstance().startAction(getCommandName(subclass, superclassName));
     try {
       PsiClass superclass = null;
 
index 803ddbb2f13aadad6d64a70d19f83ddee1e3e2a4..237387fac73722146ca67b1cf4fa8a0ae8246175 100644 (file)
@@ -384,7 +384,9 @@ public class InheritanceToDelegationProcessor extends BaseRefactoringProcessor {
     if (!myIsInnerClassNeeded) return;
 
     PsiClass innerClass = myFactory.createClass(myInnerClassName);
-    final PsiJavaCodeReferenceElement baseClassReferenceElement = myFactory.createClassReferenceElement(myBaseClass);
+    final PsiSubstitutor superClassSubstitutor = TypeConversionUtil.getSuperClassSubstitutor(myBaseClass, myClass, PsiSubstitutor.EMPTY);
+    final PsiClassType superClassType = myFactory.createType(myBaseClass, superClassSubstitutor);
+    final PsiJavaCodeReferenceElement baseClassReferenceElement = myFactory.createReferenceElementByType(superClassType);
     if (!myBaseClass.isInterface()) {
       innerClass.getExtendsList().add(baseClassReferenceElement);
     } else {
index 0313d99c335639aac3b93a2db5cc2e65538cf127..c714bf0a381ba3eef1b0dbae6e148c3e5f99596e 100644 (file)
@@ -243,7 +243,7 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
       myEditor.getCaretModel().moveToLogicalPosition(pos);
     }
 
-    LocalHistoryAction a = LocalHistory.startAction(myProject, getCommandName());
+    LocalHistoryAction a = LocalHistory.getInstance().startAction(getCommandName());
     try {
       doRefactoring(usages);
     }
index 8360a956ca44c948c407200ac1ba96ed3809b471..4b57acbde0282dd2b127f7103564e7d14e050f86 100644 (file)
@@ -62,8 +62,16 @@ public class IntroduceConstantHandler extends BaseExpressionToFieldHandler {
     ElementToWorkOn.processElementToWorkOn(editor, file, REFACTORING_NAME, getHelpID(), project, getElementProcessor(project, editor));
   }
 
-  protected boolean invokeImpl(Project project, final PsiLocalVariable localVariable, Editor editor) {
-    final LocalToFieldHandler localToFieldHandler = new LocalToFieldHandler(project, true);
+  protected boolean invokeImpl(final Project project, final PsiLocalVariable localVariable, final Editor editor) {
+    final LocalToFieldHandler localToFieldHandler = new LocalToFieldHandler(project, true){
+      @Override
+      protected Settings showRefactoringDialog(PsiClass aClass,
+                                               PsiLocalVariable local,
+                                               PsiExpression[] occurences,
+                                               boolean isStatic) {
+        return IntroduceConstantHandler.this.showRefactoringDialog(project, editor, aClass, local.getInitializer(), local.getType(), occurences, null, null);
+      }
+    };
     return localToFieldHandler.convertLocalToField(localVariable, editor);
   }
 
@@ -112,7 +120,7 @@ public class IntroduceConstantHandler extends BaseExpressionToFieldHandler {
       }
     }
 
-    IntroduceConstantDialog dialog =
+    final IntroduceConstantDialog dialog =
       new IntroduceConstantDialog(project, parentClass, expr, localVariable, false, occurences, getParentClass(),
                                   new TypeSelectorManagerImpl(project, type, expr, occurences));
     dialog.show();
index bc222e11468e6fe672cb3522c3f54d6590b767de..104b5212bf1f0096515a443e981bf97231732ecd 100644 (file)
@@ -127,8 +127,17 @@ public class IntroduceFieldHandler extends BaseExpressionToFieldHandler {
     return new ExpressionOccurenceManager(selectedExpr, parentClass, occurenceFilter, true);
   }
 
-  protected boolean invokeImpl(Project project, PsiLocalVariable localVariable, Editor editor) {
-    LocalToFieldHandler localToFieldHandler = new LocalToFieldHandler(project, false);
+  protected boolean invokeImpl(final Project project, PsiLocalVariable localVariable, final Editor editor) {
+    LocalToFieldHandler localToFieldHandler = new LocalToFieldHandler(project, false){
+      @Override
+      protected Settings showRefactoringDialog(PsiClass aClass,
+                                               PsiLocalVariable local,
+                                               PsiExpression[] occurences,
+                                               boolean isStatic) {
+        final PsiStatement statement = PsiTreeUtil.getParentOfType(local, PsiStatement.class);
+        return IntroduceFieldHandler.this.showRefactoringDialog(project, editor, aClass, local.getInitializer(), local.getType(), occurences, statement, statement);
+      }
+    };
     return localToFieldHandler.convertLocalToField(localVariable, editor);
   }
 
index ee2c97c7dd16035e479c56a7d9c20824d22e0e27..e367e86ebdbd3420386e1dbfc4d46189b7e82a8e 100644 (file)
@@ -26,10 +26,8 @@ import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.CodeStyleManager;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.search.searches.ReferencesSearch;
-import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.refactoring.HelpID;
 import com.intellij.refactoring.RefactoringBundle;
-import com.intellij.refactoring.ui.TypeSelectorManagerImpl;
 import com.intellij.refactoring.util.CommonRefactoringUtil;
 import com.intellij.refactoring.util.EnumConstantsUtil;
 import com.intellij.refactoring.util.RefactoringUtil;
@@ -40,7 +38,7 @@ import org.jetbrains.annotations.NonNls;
 import static com.intellij.refactoring.introduceField.BaseExpressionToFieldHandler.InitializationPlace.IN_CONSTRUCTOR;
 import static com.intellij.refactoring.introduceField.BaseExpressionToFieldHandler.InitializationPlace.IN_FIELD_DECLARATION;
 
-public class LocalToFieldHandler {
+public abstract class LocalToFieldHandler {
   private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.introduceField.LocalToFieldHandler");
 
   private static final String REFACTORING_NAME = RefactoringBundle.message("convert.local.to.field.title");
@@ -54,52 +52,7 @@ public class LocalToFieldHandler {
     myIsConstant = isConstant;
   }
 
-  protected BaseExpressionToFieldHandler.Settings showRefactoringDialog(PsiClass aClass, PsiLocalVariable local, PsiExpression[] occurences, boolean isStatic) {
-    final String fieldName;
-    final BaseExpressionToFieldHandler.InitializationPlace initializerPlace;
-    final boolean declareFinal;
-    @Modifier String fieldVisibility;
-    final TypeSelectorManagerImpl typeSelectorManager = new TypeSelectorManagerImpl(myProject, local.getType(),
-                                                                                    occurences
-    );
-
-    final boolean annotateAsNonNls;
-    final boolean introduceEnumConstant;
-    if (myIsConstant) {
-      IntroduceConstantDialog dialog = new IntroduceConstantDialog(myProject, aClass,
-                                                                   local.getInitializer(), local, true, occurences, aClass, typeSelectorManager
-      );
-      dialog.show();
-      if (!dialog.isOK()) return null;
-      fieldName = dialog.getEnteredName();
-      declareFinal = true;
-      initializerPlace = IN_FIELD_DECLARATION;
-      fieldVisibility = dialog.getFieldVisibility();
-      annotateAsNonNls = dialog.isAnnotateAsNonNls();
-      introduceEnumConstant = dialog.introduceEnumConstant();
-    }
-    else {
-      PsiMethod method = PsiTreeUtil.getParentOfType(local, PsiMethod.class);
-      IntroduceFieldDialog dialog = new IntroduceFieldDialog(myProject, aClass,
-                                                             local.getInitializer(), local,
-                                                             method != null && method.isConstructor(),
-                                                             true, isStatic,
-                                                             occurences.length, method != null, method != null,
-                                                             typeSelectorManager
-      );
-      dialog.show();
-      if (!dialog.isOK()) return null;
-      fieldName = dialog.getEnteredName();
-      initializerPlace = dialog.getInitializerPlace();
-      declareFinal = dialog.isDeclareFinal();
-      fieldVisibility = dialog.getFieldVisibility();
-      annotateAsNonNls = false;
-      introduceEnumConstant = false;
-    }
-
-    return new BaseExpressionToFieldHandler.Settings(fieldName, true, isStatic, declareFinal, initializerPlace, fieldVisibility, local, null, true, new BaseExpressionToFieldHandler.TargetDestination(aClass), annotateAsNonNls,
-                                                     introduceEnumConstant);
-  }
+  protected abstract BaseExpressionToFieldHandler.Settings showRefactoringDialog(PsiClass aClass, PsiLocalVariable local, PsiExpression[] occurences, boolean isStatic);
 
   public boolean convertLocalToField(final PsiLocalVariable local, final Editor editor) {
     PsiClass aClass;
index 593cc62eebc28299c76a8d45073802226c6da65f..4113edcc80b7d216a0cca0d2cd5273c6602cb321 100644 (file)
@@ -117,7 +117,7 @@ class MigrationProcessor extends BaseRefactoringProcessor {
   protected void performRefactoring(UsageInfo[] usages) {
     PsiManager psiManager = PsiManager.getInstance(myProject);
     final PsiMigration psiMigration = JavaPsiFacade.getInstance(psiManager.getProject()).startMigration();
-    LocalHistoryAction a = LocalHistory.startAction(myProject, getCommandName());
+    LocalHistoryAction a = LocalHistory.getInstance().startAction(getCommandName());
 
     try {
       for (int i = 0; i < myMigrationMap.getEntryCount(); i++) {
index 8f69918665b5e85fec58dc62991f3d3d6c0faaf3..9ab24ce8ab3f281a5d03343f79eb5923917f45b7 100644 (file)
@@ -316,7 +316,7 @@ public class MoveClassesOrPackagesImpl {
       public void run() {
         ApplicationManager.getApplication().runWriteAction(new Runnable() {
           public void run() {
-            LocalHistoryAction a = LocalHistory.startAction(project, commandDescription);
+            LocalHistoryAction a = LocalHistory.getInstance().startAction(commandDescription);
             try {
               rearrangeDirectoriesToTarget(directories, selectedTarget);
             }
index 3555beafb89e993017bbc4d8a49bb9f8e3128ce0..aa68369253e2a8d9686f18a9ffe2474aa3709246 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2010 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -473,7 +473,10 @@ public class MoveClassesOrPackagesProcessor extends BaseRefactoringProcessor {
         LOG.assertTrue(newElement != null);
         final PsiReference reference = moveRenameUsage.getReference();
         if (reference != null) {
-          reference.bindToElement(newElement);
+          try {
+            reference.bindToElement(newElement);
+          } catch (IncorrectOperationException e) {//
+          }
         }
       }
     }
index 70c2a23269c2c1b8c0b8b2b93894f9f47b95faa5..4aef1e9d0784353ac2dd62b01c8728fe4f390564 100644 (file)
@@ -134,7 +134,7 @@ public class MethodDuplicatesHandler implements RefactoringActionHandler {
   }
 
   private static void replaceDuplicate(final Project project, final List<Match> duplicates, final PsiMethod method) {
-    LocalHistoryAction a = LocalHistory.startAction(project, REFACTORING_NAME);
+    LocalHistoryAction a = LocalHistory.getInstance().startAction(REFACTORING_NAME);
     try {
       final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
       if (progressIndicator != null && progressIndicator.isCanceled()) return;
diff --git a/java/java-tests/testData/codeInsight/completion/normal/EnumConstantFromEnumMember.java b/java/java-tests/testData/codeInsight/completion/normal/EnumConstantFromEnumMember.java
new file mode 100644 (file)
index 0000000..c3503f0
--- /dev/null
@@ -0,0 +1,6 @@
+public enum ButtonKey {
+  CANCEL_ALL,
+  CANCEL_SELL;
+
+  public static final ButtonKey[] ARR = {CANCEL_ALL, CANCEL_S<caret>};
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/normal/EnumConstantFromEnumMember_after.java b/java/java-tests/testData/codeInsight/completion/normal/EnumConstantFromEnumMember_after.java
new file mode 100644 (file)
index 0000000..ec0e055
--- /dev/null
@@ -0,0 +1,6 @@
+public enum ButtonKey {
+  CANCEL_ALL,
+  CANCEL_SELL;
+
+  public static final ButtonKey[] ARR = {CANCEL_ALL, CANCEL_SELL<caret>};
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/normal/PrimitiveMethodParameter.java b/java/java-tests/testData/codeInsight/completion/normal/PrimitiveMethodParameter.java
new file mode 100644 (file)
index 0000000..eea3b77
--- /dev/null
@@ -0,0 +1,3 @@
+public class Foo {
+  Object foo(bo<caret>){ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/normal/PrimitiveMethodParameter_after.java b/java/java-tests/testData/codeInsight/completion/normal/PrimitiveMethodParameter_after.java
new file mode 100644 (file)
index 0000000..aa3645a
--- /dev/null
@@ -0,0 +1,3 @@
+public class Foo {
+  Object foo(boolean <caret>){ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/TabAfterNew-out.java b/java/java-tests/testData/codeInsight/completion/smartType/TabAfterNew-out.java
new file mode 100644 (file)
index 0000000..0eb33cc
--- /dev/null
@@ -0,0 +1,21 @@
+public class Main {
+
+  public void main(String[] args) {
+    Aaaa a = new Bbbb(<caret>2);
+  }
+
+  class Aaaa {
+    int aaa;
+
+    Aaaa(int aaa) {
+      this.aaa = aaa;
+    }
+  }
+
+  class Bbbb extends Aaaa{
+    Bbbb(int aaa) {
+      super(aaa);
+    }
+  }
+
+}
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/TabAfterNew.java b/java/java-tests/testData/codeInsight/completion/smartType/TabAfterNew.java
new file mode 100644 (file)
index 0000000..98174a6
--- /dev/null
@@ -0,0 +1,21 @@
+public class Main {
+
+  public void main(String[] args) {
+    Aaaa a = new B<caret>Aaaa(2);
+  }
+
+  class Aaaa {
+    int aaa;
+
+    Aaaa(int aaa) {
+      this.aaa = aaa;
+    }
+  }
+
+  class Bbbb extends Aaaa{
+    Bbbb(int aaa) {
+      super(aaa);
+    }
+  }
+
+}
diff --git a/java/java-tests/testData/refactoring/inheritanceToDelegation/typeParametersSubstitution/after/A.java b/java/java-tests/testData/refactoring/inheritanceToDelegation/typeParametersSubstitution/after/A.java
new file mode 100644 (file)
index 0000000..9414e4e
--- /dev/null
@@ -0,0 +1,8 @@
+public class A {
+    public final MyIntf myDelegate = new MyIntf();
+
+    private class MyIntf implements Intf<Integer> {
+        public void method1(Integer t) {
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/inheritanceToDelegation/typeParametersSubstitution/after/Intf.java b/java/java-tests/testData/refactoring/inheritanceToDelegation/typeParametersSubstitution/after/Intf.java
new file mode 100644 (file)
index 0000000..da4078c
--- /dev/null
@@ -0,0 +1,3 @@
+public interface Intf<T> {
+    void method1(T t);
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/inheritanceToDelegation/typeParametersSubstitution/before/A.java b/java/java-tests/testData/refactoring/inheritanceToDelegation/typeParametersSubstitution/before/A.java
new file mode 100644 (file)
index 0000000..377e466
--- /dev/null
@@ -0,0 +1,4 @@
+public class A implements Intf<Integer> {
+    public void method1(Integer t) {
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/inheritanceToDelegation/typeParametersSubstitution/before/Intf.java b/java/java-tests/testData/refactoring/inheritanceToDelegation/typeParametersSubstitution/before/Intf.java
new file mode 100644 (file)
index 0000000..da4078c
--- /dev/null
@@ -0,0 +1,3 @@
+public interface Intf<T> {
+    void method1(T t);
+}
\ No newline at end of file
index 7a6bc1e2b2e48ade035510bbe067986884dad2ae..40cb370a5fe7d732684c84fb5fb84774fe91b0b3 100644 (file)
@@ -662,5 +662,9 @@ public class NormalCompletionTest extends LightCompletionTestCase {
 
   public void testMethodParameterAnnotationClass() throws Throwable { doTest(); }
 
+  public void testEnumConstantFromEnumMember() throws Throwable { doTest(); }
+
+  public void testPrimitiveMethodParameter() throws Throwable { doTest(); }
+
 
 }
index 1883bba1da8571710cab588151868a64f40eeed4..ffb13f847f70ad64337af63417b3c9bdaa4025fe 100644 (file)
@@ -996,6 +996,12 @@ public class SmartTypeCompletionTest extends LightCompletionTestCase {
     checkResultByTestName();
   }
 
+  public void testTabAfterNew() throws Exception {
+    configureByTestName();
+    select('\t');
+    checkResultByTestName();
+  }
+
   private void doTest(boolean performAction, boolean selectItem) throws Exception {
     configureByTestName();
     if (performAction) {
index ec9beac919f484315036e0045788f89d0568d03d..e3b45d35ca2f0b749639d4a63d6c2156a164117c 100644 (file)
@@ -119,6 +119,9 @@ public class InheritanceToDelegationTest extends MultiFileTestCase {
         new String[]{"getDate"}, ArrayUtil.EMPTY_STRING_ARRAY, false, false));
   }
 
+  public void testTypeParametersSubstitution() throws Exception {
+     doTest(createPerformAction("A", "myDelegate", "MyIntf", "Intf", new int[]{}, ArrayUtil.EMPTY_STRING_ARRAY, true, false));
+  }
 
   private PerformAction createPerformAction(
     final String className, final String fieldName, final String innerClassName,
index 02b2d95a9247e2291edea5dfa0b046c593dfcb85..d05194d6fe41912761036e606e37c80ce2ae434e 100644 (file)
 
 package com.intellij.execution.runners;
 
-import com.intellij.execution.ExecutionException;
-import com.intellij.execution.ExecutionManager;
-import com.intellij.execution.ExecutionResult;
-import com.intellij.execution.Executor;
+import com.intellij.execution.*;
 import com.intellij.execution.configurations.*;
 import com.intellij.execution.process.ProcessHandler;
 import com.intellij.execution.ui.RunContentDescriptor;
 import com.intellij.history.LocalHistory;
-import com.intellij.history.LocalHistoryConfiguration;
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.DataKey;
 import com.intellij.openapi.application.ApplicationManager;
@@ -98,9 +94,7 @@ public abstract class GenericProgramRunner<Settings extends JDOMExternalizable>
           if (callback != null) callback.processStarted(descriptor);
 
           if (descriptor != null) {
-            if (LocalHistoryConfiguration.getInstance().ADD_LABEL_ON_RUNNING) {
-              LocalHistory.putSystemLabel(project, executor.getId() + " " + profile.getName());
-            }
+            LocalHistory.getInstance().putSystemLabel(project, getLocalHistoryLabel(profile, state));
 
             ExecutionManager.getInstance(project).getContentManager().showRunContent(executor, descriptor);
             final ProcessHandler processHandler = descriptor.getProcessHandler();
@@ -124,4 +118,8 @@ public abstract class GenericProgramRunner<Settings extends JDOMExternalizable>
   protected abstract RunContentDescriptor doExecute(final Project project, final Executor executor, final RunProfileState state,
                                         final RunContentDescriptor contentToReuse,
                                         final ExecutionEnvironment env) throws ExecutionException;
+
+  protected String getLocalHistoryLabel(RunProfile profile, RunProfileState state) {
+    return ExecutionBundle.message("default.runner.start.action.label", profile.getName());
+  }
 }
diff --git a/platform/lang-api/src/com/intellij/execution/ui/ConsoleViewWrapper.java b/platform/lang-api/src/com/intellij/execution/ui/ConsoleViewWrapper.java
deleted file mode 100644 (file)
index 4d70faa..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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.execution.ui;
-
-import com.intellij.execution.filters.Filter;
-import com.intellij.execution.filters.HyperlinkInfo;
-import com.intellij.execution.process.ProcessHandler;
-import com.intellij.openapi.actionSystem.AnAction;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-
-/**
- * @author Gregory.Shrago
- */
-public class ConsoleViewWrapper implements ConsoleView, ExecutionConsoleEx {
-  private final ConsoleView myDelegate;
-
-  public ConsoleViewWrapper(final ConsoleView delegate) {
-    myDelegate = delegate;
-  }
-
-  public ConsoleView getDelegate() {
-    return myDelegate;
-  }
-
-  public void dispose() {
-    myDelegate.dispose();
-  }
-
-  public JComponent getComponent() {
-    return myDelegate.getComponent();
-  }
-
-  public JComponent getPreferredFocusableComponent() {
-    return myDelegate.getPreferredFocusableComponent();
-  }
-
-  public void print(String s, ConsoleViewContentType contentType) {
-    myDelegate.print(s, contentType);
-  }
-
-  public void clear() {
-    myDelegate.clear();
-  }
-
-  public void scrollTo(int offset) {
-    myDelegate.scrollTo(offset);
-  }
-
-  public void attachToProcess(ProcessHandler processHandler) {
-    myDelegate.attachToProcess(processHandler);
-  }
-
-  public void setOutputPaused(boolean value) {
-    myDelegate.setOutputPaused(value);
-  }
-
-  public boolean isOutputPaused() {
-    return myDelegate.isOutputPaused();
-  }
-
-  public boolean hasDeferredOutput() {
-    return myDelegate.hasDeferredOutput();
-  }
-
-  public void performWhenNoDeferredOutput(Runnable runnable) {
-    myDelegate.performWhenNoDeferredOutput(runnable);
-  }
-
-  public void setHelpId(String helpId) {
-    myDelegate.setHelpId(helpId);
-  }
-
-  public void addMessageFilter(Filter filter) {
-    myDelegate.addMessageFilter(filter);
-  }
-
-  public void printHyperlink(String hyperlinkText, HyperlinkInfo info) {
-    myDelegate.printHyperlink(hyperlinkText, info);
-  }
-
-  public int getContentSize() {
-    return myDelegate.getContentSize();
-  }
-
-  public boolean canPause() {
-    return myDelegate.canPause();
-  }
-
-  public void buildUi(RunnerLayoutUi layoutUi) {
-    if (myDelegate instanceof ExecutionConsoleEx) {
-      ((ExecutionConsoleEx)myDelegate).buildUi(layoutUi);
-    }
-  }
-
-
-  public String getExecutionConsoleId() {
-    if (myDelegate instanceof ExecutionConsoleEx) {
-      return ((ExecutionConsoleEx)myDelegate).getExecutionConsoleId();
-    }
-    return null;
-  }
-
-  @NotNull
-  public AnAction[] createConsoleActions() {
-    return myDelegate.createConsoleActions();
-  }
-
-}
index f33e96632a1d8f2cabd2f00cfdfd7439410e4952..e5fa2f012d7645cf892b2a2024151b0e247d8941 100644 (file)
@@ -75,7 +75,7 @@ public abstract class ElementCreator {
       protected void run(Result result) throws Throwable {
         LocalHistoryAction action = LocalHistoryAction.NULL;
         try {
-          action = LocalHistory.startAction(myProject, commandName);
+          action = LocalHistory.getInstance().startAction(commandName);
 
           PsiElement[] psiElements = create(inputString);
           myCreatedElements[0] = new SmartPsiElementPointer[psiElements.length];
index ec2e7d68de25b1b63320838045fb058464eececf..92f563b0cceb8ba5b3ed247d8c8a6f823496ee0d 100644 (file)
@@ -63,6 +63,6 @@ public class CompositeFoldingBuilder extends FoldingBuilderEx implements DumbAwa
 
   public boolean isCollapsedByDefault(@NotNull ASTNode node) {
     final FoldingBuilder builder = node.getUserData(FOLDING_BUILDER);
-    return builder == null ? false : builder.isCollapsedByDefault(node);
+    return builder != null && builder.isCollapsedByDefault(node);
   }
 }
index 849c99bf2f0acde3eb6abf484abc7998465a7a7b..5b17f826924fc4c14a2c22de4e09fe342da26c51 100644 (file)
@@ -17,12 +17,10 @@ package com.intellij.lang.folding;
 
 import com.intellij.lang.ASTNode;
 import com.intellij.lang.Language;
-import com.intellij.lang.injection.InjectedLanguageManager;
 import com.intellij.openapi.editor.FoldingGroup;
 import com.intellij.openapi.util.ProperTextRange;
 import com.intellij.openapi.util.TextRange;
 import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
 import com.intellij.util.ObjectUtils;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -97,19 +95,9 @@ public class FoldingDescriptor {
    * Returns the folded text range.
    * @return the folded text range.
    */
+  @NotNull
   public TextRange getRange() {
-    return getRange(myElement, myRange);
-  }
-
-  public static TextRange getRange(ASTNode node, TextRange range) {
-    PsiElement element = node.getPsi();
-    PsiFile containingFile = element.getContainingFile();
-    InjectedLanguageManager injectedManager = InjectedLanguageManager.getInstance(containingFile.getProject());
-    boolean isInjected = injectedManager.isInjectedFragment(containingFile);
-    if (isInjected) {
-      range = injectedManager.injectedToHost(element, range);
-    }
-    return range;
+    return myRange;
   }
 
   @Nullable
index f79bb68ef46784d9c8ec8b2f258334cba490367b..e783f72ab887415732b515e75374dfc890da045f 100644 (file)
@@ -41,13 +41,22 @@ class CodeFoldingPass extends TextEditorHighlightingPass implements DumbAware {
   }
 
   public void doCollectInformation(ProgressIndicator progress) {
-    final boolean firstTime = myFile.getUserData(THE_FIRST_TIME) == null || myEditor.getUserData(THE_FIRST_TIME) == null;
+    final boolean firstTime = isFirstTime(myFile, myEditor, THE_FIRST_TIME);
     Runnable runnable = CodeFoldingManager.getInstance(myProject).updateFoldRegionsAsync(myEditor, firstTime);
     synchronized (this) {
       myRunnable = runnable;
     }
   }
 
+  static boolean isFirstTime(PsiFile file, Editor editor, Key<Boolean> key) {
+    return file.getUserData(key) == null || editor.getUserData(key) == null;
+  }
+
+  static void clearFirstTimeFlag(PsiFile file, Editor editor, Key<Boolean> key) {
+    file.putUserData(key, Boolean.FALSE);
+    editor.putUserData(key, Boolean.FALSE);
+  }
+
   public void doApplyInformationToEditor() {
     Runnable runnable;
     synchronized (this) {
@@ -57,13 +66,12 @@ class CodeFoldingPass extends TextEditorHighlightingPass implements DumbAware {
       try {
         runnable.run();
       }
-      catch (IndexNotReadyException e) {
+      catch (IndexNotReadyException ignored) {
       }
     }
 
     if (InjectedLanguageUtil.getTopLevelFile(myFile) == myFile) {
-      myFile.putUserData(THE_FIRST_TIME, Boolean.FALSE);
-      myEditor.putUserData(THE_FIRST_TIME, Boolean.FALSE);
+      clearFirstTimeFlag(myFile, myEditor, THE_FIRST_TIME);
     }
   }
 }
index a2bc456e2bd2d71cd3c8d740c744f445da60affe..6879d8b81949fb573fef4dc0d97b94fe9ced1368 100755 (executable)
@@ -23,10 +23,12 @@ import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.project.IndexNotReadyException;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Key;
 import com.intellij.psi.PsiFile;
 import org.jetbrains.annotations.NotNull;
 
 class InjectedCodeFoldingPass extends TextEditorHighlightingPass implements DumbAware {
+  private static final Key<Boolean> THE_FIRST_TIME_KEY = Key.create("FirstInjectedFoldingPass");
   private Runnable myRunnable;
   private final Editor myEditor;
   private final PsiFile myFile;
@@ -38,7 +40,8 @@ class InjectedCodeFoldingPass extends TextEditorHighlightingPass implements Dumb
   }
 
   public void doCollectInformation(ProgressIndicator progress) {
-    Runnable runnable = FoldingUpdate.updateInjectedFoldRegions(myEditor, myFile);
+    boolean firstTime = CodeFoldingPass.isFirstTime(myFile, myEditor, THE_FIRST_TIME_KEY);
+    Runnable runnable = FoldingUpdate.updateInjectedFoldRegions(myEditor, myFile, firstTime);
     synchronized (this) {
       myRunnable = runnable;
     }
@@ -53,8 +56,9 @@ class InjectedCodeFoldingPass extends TextEditorHighlightingPass implements Dumb
       try {
         runnable.run();
       }
-      catch (IndexNotReadyException e) {
+      catch (IndexNotReadyException ignored) {
       }
+      CodeFoldingPass.clearFirstTimeFlag(myFile, myEditor, THE_FIRST_TIME_KEY);
     }
   }
 }
\ No newline at end of file
index beaed335d955897fa75fd533374775d045518138..890e15da09816912a4bba2e96abecd722bfa3b87 100644 (file)
@@ -228,8 +228,9 @@ public class CodeFoldingManagerImpl extends CodeFoldingManager implements Projec
     final FoldRegion[] regions = editor.getFoldingModel().getAllFoldRegions();
     editor.getFoldingModel().runBatchFoldingOperation(new Runnable() {
       public void run() {
+        EditorFoldingInfo foldingInfo = EditorFoldingInfo.get(editor);
         for (FoldRegion region : regions) {
-          PsiElement element = EditorFoldingInfo.get(editor).getPsiElement(region);
+          PsiElement element = foldingInfo.getPsiElement(region);
           if (element != null) {
             region.setExpanded(!FoldingPolicy.isCollapseByDefault(element));
           }
index 8f1cd78588a9ef0a17d840243d406598c6631133..406821455418e238c8c4c9ebfd6eadd6d8faf5fb 100644 (file)
@@ -26,7 +26,7 @@ import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.FoldRegion;
 import com.intellij.openapi.editor.RangeMarker;
-import com.intellij.openapi.editor.impl.FoldRegionImpl;
+import com.intellij.openapi.editor.ex.FoldingModelEx;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.fileEditor.impl.text.CodeFoldingState;
 import com.intellij.openapi.project.Project;
@@ -126,7 +126,8 @@ public class DocumentFoldingInfo implements JDOMExternalizable, CodeFoldingState
         FoldRegion region = FoldingUtil.findFoldRegion(editor, marker.getStartOffset(), marker.getEndOffset());
         if (region == null) {
           String placeHolderText = myPlaceholderTexts.get(marker);
-          region = new FoldRegionImpl(editor, marker.getStartOffset(), marker.getEndOffset(), placeHolderText, null);  //may fail to add in case intersecting region exists
+          region = ((FoldingModelEx)editor.getFoldingModel()).createFoldRegion(marker.getStartOffset(), marker.getEndOffset(), placeHolderText, null);  
+          //may fail to add in case intersecting region exists
           if (!editor.getFoldingModel().addFoldRegion(region)) return;
         }
 
index 1b4797280f89737e99c90bd97c03f64a86620be8..2551e2a1c50c8836ea11705801711f95b843ae09 100644 (file)
@@ -17,6 +17,7 @@
 package com.intellij.codeInsight.folding.impl;
 
 import com.intellij.injected.editor.DocumentWindow;
+import com.intellij.injected.editor.EditorWindow;
 import com.intellij.lang.Language;
 import com.intellij.lang.folding.FoldingBuilder;
 import com.intellij.lang.folding.FoldingDescriptor;
@@ -87,8 +88,7 @@ public class FoldingUpdate {
     final TreeMap<PsiElement, FoldingDescriptor> elementsToFoldMap = new TreeMap<PsiElement, FoldingDescriptor>(COMPARE_BY_OFFSET);
     getFoldingsFor(file instanceof PsiCompiledElement ? (PsiFile)((PsiCompiledElement)file).getMirror() : file, document, elementsToFoldMap, quick);
 
-    final UpdateFoldRegionsOperation operation =
-      new UpdateFoldRegionsOperation(project, editor, elementsToFoldMap, applyDefaultState, false);
+    final UpdateFoldRegionsOperation operation = new UpdateFoldRegionsOperation(project, editor, elementsToFoldMap, applyDefaultState, false);
     Runnable runnable = new Runnable() {
       public void run() {
         editor.getFoldingModel().runBatchFoldingOperationDoNotCollapseCaret(operation);
@@ -104,7 +104,7 @@ public class FoldingUpdate {
 
   private static final Key<Object> LAST_UPDATE_INJECTED_STAMP_KEY = Key.create("LAST_UPDATE_INJECTED_STAMP_KEY");
   @Nullable
-  public static Runnable updateInjectedFoldRegions(@NotNull final Editor editor, @NotNull PsiFile file) {
+  public static Runnable updateInjectedFoldRegions(@NotNull final Editor editor, @NotNull PsiFile file, final boolean applyDefaultState) {
     if (file instanceof PsiCompiledElement) return null;
     ApplicationManager.getApplication().assertReadAccessAllowed();
 
@@ -116,17 +116,32 @@ public class FoldingUpdate {
     Object lastTimeStamp = editor.getUserData(LAST_UPDATE_INJECTED_STAMP_KEY);
     if (lastTimeStamp instanceof Long && ((Long)lastTimeStamp).longValue() == timeStamp) return null;
 
-    final TreeMap<PsiElement, FoldingDescriptor> elementsToFoldMap = new TreeMap<PsiElement, FoldingDescriptor>(COMPARE_BY_OFFSET);
-
     List<DocumentWindow> injectedDocuments = InjectedLanguageUtil.getCachedInjectedDocuments(file);
     if (injectedDocuments.isEmpty()) return null;
+    final List<EditorWindow> injectedEditors = new ArrayList<EditorWindow>();
+    final List<Map<PsiElement, FoldingDescriptor>> maps = new ArrayList<Map<PsiElement, FoldingDescriptor>>();
     for (DocumentWindow injectedDocument : injectedDocuments) {
-      PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(injectedDocument);
-      if (psiFile == null || !psiFile.isValid() || !injectedDocument.isValid()) continue;
-      getFoldingsFor(psiFile, injectedDocument, elementsToFoldMap, false);
+      PsiFile injectedFile = PsiDocumentManager.getInstance(project).getPsiFile(injectedDocument);
+      if (injectedFile == null || !injectedFile.isValid() || !injectedDocument.isValid()) continue;
+      Editor injectedEditor = InjectedLanguageUtil.getInjectedEditorForInjectedFile(editor, injectedFile);
+      if (!(injectedEditor instanceof EditorWindow)) continue;
+
+      injectedEditors.add((EditorWindow)injectedEditor);
+      Map<PsiElement, FoldingDescriptor> map = new TreeMap<PsiElement, FoldingDescriptor>(COMPARE_BY_OFFSET);
+      maps.add(map);
+      getFoldingsFor(injectedFile, injectedDocument, map, false);
     }
 
-    final Runnable operation = new UpdateFoldRegionsOperation(project, editor, elementsToFoldMap, false, true);
+
+    final Runnable operation = new Runnable() {
+      public void run() {
+        for (int i = 0; i < injectedEditors.size(); i++) {
+          EditorWindow injectedEditor = injectedEditors.get(i);
+          Map<PsiElement, FoldingDescriptor> map = maps.get(i);
+          new UpdateFoldRegionsOperation(project, injectedEditor, map, applyDefaultState, true).run();
+        }
+      }
+    };
     return new Runnable() {
       public void run() {
         editor.getFoldingModel().runBatchFoldingOperationDoNotCollapseCaret(operation);
@@ -135,7 +150,7 @@ public class FoldingUpdate {
     };
   }
 
-  private static void getFoldingsFor(PsiFile file, Document document, TreeMap<PsiElement, FoldingDescriptor> elementsToFoldMap, boolean quick) {
+  private static void getFoldingsFor(PsiFile file, Document document, Map<PsiElement, FoldingDescriptor> elementsToFoldMap, boolean quick) {
     final FileViewProvider viewProvider = file.getViewProvider();
     for (final Language language : viewProvider.getLanguages()) {
       final PsiFile psi = viewProvider.getPsi(language);
index 25cccdf3b4191f0e04e157b9ea93cb0e9797decc..cb15358b7cf937a153ccbf43d4b5ae70fc7bfcbf 100644 (file)
@@ -18,13 +18,15 @@ package com.intellij.codeInsight.folding.impl;
 
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.FoldRegion;
+import com.intellij.openapi.editor.RangeMarker;
 import com.intellij.openapi.editor.ex.FoldingModelEx;
 import com.intellij.openapi.util.TextRange;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Comparator;
+import java.util.Collections;
+import java.util.List;
 
 class FoldingUtil {
   private FoldingUtil() {}
@@ -56,7 +58,7 @@ class FoldingUtil {
   }
 
   public static FoldRegion[] getFoldRegionsAtOffset(Editor editor, int offset){
-    ArrayList<FoldRegion> list = new ArrayList<FoldRegion>();
+    List<FoldRegion> list = new ArrayList<FoldRegion>();
     FoldRegion[] allRegions = editor.getFoldingModel().getAllFoldRegions();
     for (FoldRegion region : allRegions) {
       if (region.getStartOffset() <= offset && offset <= region.getEndOffset()) {
@@ -65,15 +67,7 @@ class FoldingUtil {
     }
 
     FoldRegion[] regions = list.toArray(new FoldRegion[list.size()]);
-    Arrays.sort(
-      regions,
-      new Comparator<FoldRegion>() {
-        public int compare(FoldRegion region1, FoldRegion region2) {
-          return region2.getStartOffset() - region1.getStartOffset();
-        }
-      }
-    );
-
+    Arrays.sort(regions, Collections.reverseOrder(RangeMarker.BY_START_OFFSET));
     return regions;
   }
 
@@ -81,4 +75,4 @@ class FoldingUtil {
     final int offset = editor.getCaretModel().getOffset();
     return range.contains(offset) && range.getStartOffset() != offset;
   }
-}
\ No newline at end of file
+}
index 9cbca86e20401c1c643fd90fdb3701ad78c58553..a200448c7928db01bc91809ecfaaadc768a27ba9 100644 (file)
@@ -22,7 +22,6 @@ import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.FoldRegion;
 import com.intellij.openapi.editor.FoldingGroup;
 import com.intellij.openapi.editor.ex.FoldingModelEx;
-import com.intellij.openapi.editor.impl.FoldRegionImpl;
 import com.intellij.openapi.progress.ProgressManager;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.TextRange;
@@ -32,7 +31,6 @@ import com.intellij.util.containers.HashMap;
 
 import java.util.List;
 import java.util.Map;
-import java.util.TreeMap;
 
 import static com.intellij.util.containers.CollectionFactory.arrayList;
 import static com.intellij.util.containers.CollectionFactory.newTroveMap;
@@ -44,10 +42,10 @@ class UpdateFoldRegionsOperation implements Runnable {
   private final Project myProject;
   private final Editor myEditor;
   private final boolean myApplyDefaultState;
-  private final TreeMap<PsiElement, FoldingDescriptor> myElementsToFoldMap;
+  private final Map<PsiElement, FoldingDescriptor> myElementsToFoldMap;
   private final boolean myForInjected;
 
-  UpdateFoldRegionsOperation(Project project, Editor editor, TreeMap<PsiElement, FoldingDescriptor> elementsToFoldMap, boolean applyDefaultState,
+  UpdateFoldRegionsOperation(Project project, Editor editor, Map<PsiElement, FoldingDescriptor> elementsToFoldMap, boolean applyDefaultState,
                              boolean forInjected) {
     myProject = project;
     myEditor = editor;
@@ -94,7 +92,7 @@ class UpdateFoldRegionsOperation implements Runnable {
       final FoldingDescriptor descriptor = entry.getValue();
       FoldingGroup group = descriptor.getGroup();
       TextRange range = descriptor.getRange();
-      FoldRegion region = new FoldRegionImpl(myEditor, range.getStartOffset(), range.getEndOffset(), descriptor.getPlaceholderText(), group);
+      FoldRegion region = foldingModel.createFoldRegion(range.getStartOffset(), range.getEndOffset(), descriptor.getPlaceholderText(), group);
       if (!foldingModel.addFoldRegion(region)) continue;
 
       info.addRegion(region, descriptor);
index 1e5cd6f0a2a4c839af9e6c87d45f65ee98a0cce0..b48edf5e4d56d4ca827722e4efa36df60d7b46bf 100644 (file)
@@ -21,8 +21,6 @@ import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
 
-import java.awt.*;
-
 public class BackspaceHandler extends EditorActionHandler {
   private final EditorActionHandler myOriginalHandler;
 
@@ -40,12 +38,6 @@ public class BackspaceHandler extends EditorActionHandler {
     final String prefix = lookup.getAdditionalPrefix();
     if (prefix.length() > 0) {
       lookup.setAdditionalPrefix(prefix.substring(0, prefix.length() - 1));
-      if (lookup.isVisible()) {
-        Point point = lookup.calculatePosition();
-        Dimension preferredSize = lookup.getComponent().getPreferredSize();
-        lookup.setBounds(point.x,point.y,preferredSize.width,preferredSize.height);
-        lookup.getList().repaint();
-      }
     }
     else{
       lookup.hide();
index 18ca300a7287cb4f40ce5e0f04d26f1603b0adab..cf843525608a332896e7a462c75232df5a71cc96 100644 (file)
@@ -255,7 +255,7 @@ public class LookupImpl extends LightweightHint implements Lookup, Disposable {
     myAdditionalPrefix = additionalPrefix;
     myInitialPrefix = null;
     markDirty();
-    updateList();
+    refreshUi();
   }
 
   private void updateList() {
@@ -450,10 +450,15 @@ public class LookupImpl extends LightweightHint implements Lookup, Disposable {
 
     int shiftLow = layeredPane.getHeight() - (layeredPanePoint.y + dim.height);
     int shiftHigh = layeredPanePoint.y - dim.height;
-    myPositionedAbove = shiftLow < 0 && shiftLow < shiftHigh ? Boolean.TRUE : Boolean.FALSE;
-
-    if (myPositionedAbove.booleanValue()){
+    if (!isPositionedAboveCaret()) {
+      myPositionedAbove = shiftLow < 0 && shiftLow < shiftHigh ? Boolean.TRUE : Boolean.FALSE;
+    }
+    if (isPositionedAboveCaret()) {
       layeredPanePoint.y -= dim.height + myEditor.getLineHeight();
+      if (pos.line == 0) {
+        layeredPanePoint.y += 1;
+        //otherwise the lookup won't intersect with the editor and every editor's resize (e.g. after typing in console) will close the lookup
+      }
     }
     return layeredPanePoint;
   }
index 119e0dfad4934ee34ea7d57f5e7dad3125bfd9ac..3e524940419eb080fba6c7e05c1d2a1ee5145a66 100644 (file)
@@ -61,21 +61,20 @@ public class TypedHandler implements TypedActionHandler {
     }, "", editor.getDocument());
 
     if (result == CharFilter.Result.ADD_TO_PREFIX){
-      lookup.refreshUi();
+      return;
     }
-    else{
-      if (result == CharFilter.Result.SELECT_ITEM_AND_FINISH_LOOKUP){
-        LookupElement item = lookup.getCurrentItem();
-        if (item != null){
-          FeatureUsageTracker.getInstance().triggerFeatureUsed(CodeCompletionFeatures.EDITING_COMPLETION_FINISH_BY_DOT_ETC);
-          lookup.finishLookup(charTyped);
-          return;
-        }
-      }
 
-      lookup.hide();
-      myOriginalHandler.execute(editor, charTyped, dataContext);
+    if (result == CharFilter.Result.SELECT_ITEM_AND_FINISH_LOOKUP){
+      LookupElement item = lookup.getCurrentItem();
+      if (item != null){
+        FeatureUsageTracker.getInstance().triggerFeatureUsed(CodeCompletionFeatures.EDITING_COMPLETION_FINISH_BY_DOT_ETC);
+        lookup.finishLookup(charTyped);
+        return;
+      }
     }
+
+    lookup.hide();
+    myOriginalHandler.execute(editor, charTyped, dataContext);
   }
 
   private static CharFilter.Result getLookupAction(final char charTyped, final LookupElement currentItem, final LookupImpl lookup) {
index 78283dc7b8347fd000d4fd761ef1aeffad32a7c3..3f1bf7904db6d2859faa048526e797d721c15356 100644 (file)
@@ -41,12 +41,12 @@ import com.intellij.openapi.editor.colors.EditorColorsManager;
 import com.intellij.openapi.editor.colors.EditorColorsScheme;
 import com.intellij.openapi.editor.event.*;
 import com.intellij.openapi.editor.ex.EditorEx;
+import com.intellij.openapi.editor.ex.FoldingModelEx;
 import com.intellij.openapi.editor.ex.MarkupModelEx;
 import com.intellij.openapi.editor.highlighter.EditorHighlighter;
 import com.intellij.openapi.editor.highlighter.HighlighterClient;
 import com.intellij.openapi.editor.highlighter.HighlighterIterator;
 import com.intellij.openapi.editor.impl.EditorFactoryImpl;
-import com.intellij.openapi.editor.impl.FoldRegionImpl;
 import com.intellij.openapi.editor.markup.HighlighterLayer;
 import com.intellij.openapi.editor.markup.HighlighterTargetArea;
 import com.intellij.openapi.editor.markup.RangeHighlighter;
@@ -897,7 +897,8 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
       if (oStart > 0) oStart--;
       int oEnd = CharArrayUtil.shiftBackward(chars, document.getLineEndOffset(lEnd) - 1, " \t") + 1;
 
-      toAdd.add(new FoldRegionImpl(myEditor, oStart, oEnd, prevFolding.getPlaceholderText(toFold), null));
+      FoldRegion region = ((FoldingModelEx)myEditor.getFoldingModel()).createFoldRegion(oStart, oEnd, prevFolding.getPlaceholderText(toFold), null);
+      toAdd.add(region); 
     }
   }
 
index 23b07eb93adcbdecb6fc8a8c08c2249075994003..d6f01d82320122db3ae72dc054b8ef93644dbede 100644 (file)
@@ -136,7 +136,7 @@ public class RunContentBuilder implements LogConsoleManager, Disposable  {
         ((ExecutionConsoleEx)console).buildUi(myUi);
       }
       else {
-        buildConsoleUiDefault(console);
+        buildConsoleUiDefault(myUi, console);
       }
       if (profile instanceof RunConfigurationBase) {
         myManager.initLogConsoles((RunConfigurationBase)profile, myExecutionResult.getProcessHandler());
@@ -148,7 +148,7 @@ public class RunContentBuilder implements LogConsoleManager, Disposable  {
     return contentDescriptor;
   }
 
-  private void buildConsoleUiDefault(final ExecutionConsole console) {
+  public static void buildConsoleUiDefault(RunnerLayoutUi ui, final ExecutionConsole console) {
     DefaultActionGroup consoleActions = new DefaultActionGroup();
     if (console instanceof ConsoleView) {
       AnAction[] actions = ((ConsoleView)console).createConsoleActions();
@@ -157,12 +157,12 @@ public class RunContentBuilder implements LogConsoleManager, Disposable  {
       }
     }
 
-    final Content consoleContent = myUi.createContent("Console", console.getComponent(), "Console",
+    final Content consoleContent = ui.createContent("Console", console.getComponent(), "Console",
                                                       IconLoader.getIcon("/debugger/console.png"),
                                                       console.getPreferredFocusableComponent());
 
     consoleContent.setActions(consoleActions, ActionPlaces.UNKNOWN, console.getComponent());
-    myUi.addContent(consoleContent, 0, PlaceInGrid.bottom, false);
+    ui.addContent(consoleContent, 0, PlaceInGrid.bottom, false);
   }
 
   public void addLogConsole(final String name, final String path, final long skippedContent) {
index 1bb247f450e2e84b93a4f77f8344860dd323eb1d..733c610cded82aa7607b9a2abf6767fe559a0ec2 100644 (file)
@@ -173,7 +173,7 @@ public class CreateDirectoryOrPackageAction extends AnAction implements DumbAwar
                 String actionName;
                 String dirPath = myDirectory.getVirtualFile().getPresentableUrl();
                 actionName = IdeBundle.message("progress.creating.directory", dirPath, File.separator, subDirName);
-                action = LocalHistory.startAction(myProject, actionName);
+                action = LocalHistory.getInstance().startAction(actionName);
 
                 final PsiDirectory createdDir;
                 if (myIsDirectory) {
index b7a4bd8b7d69526e31eb836005cf4da2fdfd07c0..026f82935b1f607ddb403c64aaf6c7aa42a1780d 100644 (file)
@@ -529,7 +529,7 @@ public class CommanderPanel extends JPanel {
 
   private final class MyDeleteElementProvider implements DeleteProvider {
     public void deleteElement(final DataContext dataContext) {
-      LocalHistoryAction a = LocalHistory.startAction(myProject, IdeBundle.message("progress.deleting"));
+      LocalHistoryAction a = LocalHistory.getInstance().startAction(IdeBundle.message("progress.deleting"));
       try {
         final PsiElement[] elements = getSelectedElements();
         DeleteHandler.deletePsiElement(elements, myProject);
index 5b7b206b05f754d05de6621c2c3d50f91c493c19..80996b34990957b5a0cacd2724c3769041d78306 100644 (file)
@@ -409,7 +409,7 @@ public class FavoritesTreeViewPanel extends JPanel implements DataProvider {
       }
       final PsiElement[] elements = validElements.toArray(new PsiElement[validElements.size()]);
 
-      LocalHistoryAction a = LocalHistory.startAction(myProject, IdeBundle.message("progress.deleting"));
+      LocalHistoryAction a = LocalHistory.getInstance().startAction(IdeBundle.message("progress.deleting"));
       try {
         DeleteHandler.deletePsiElement(elements, myProject);
       }
index ae4f8b9eba5abb81631eb808e1728175f88ff382..ea1a5c98661193e7793b7f5ba89aaade51c9be73 100644 (file)
@@ -100,7 +100,7 @@ public abstract class TypeHierarchyBrowserBase extends HierarchyBrowserBaseEx {
     public final void deleteElement(final DataContext dataContext) {
       final PsiElement aClass = getSelectedElement();
       if (!canBeDeleted(aClass)) return;
-      LocalHistoryAction a = LocalHistory.startAction(myProject, IdeBundle.message("progress.deleting.class", getQualifiedName(aClass)));
+      LocalHistoryAction a = LocalHistory.getInstance().startAction(IdeBundle.message("progress.deleting.class", getQualifiedName(aClass)));
       try {
         final PsiElement[] elements = new PsiElement[]{aClass};
         DeleteHandler.deletePsiElement(elements, myProject);
index 0d284c4ae30961b336f11b01942ad985178e878a..410ea91a87cdc7b32f3d0c40e69e96de867bb416 100644 (file)
@@ -904,7 +904,7 @@ public final class ProjectViewImpl extends ProjectView implements PersistentStat
       }
       final PsiElement[] elements = validElements.toArray(new PsiElement[validElements.size()]);
 
-      LocalHistoryAction a = LocalHistory.startAction(myProject, IdeBundle.message("progress.deleting"));
+      LocalHistoryAction a = LocalHistory.getInstance().startAction(IdeBundle.message("progress.deleting"));
       try {
         DeleteHandler.deletePsiElement(elements, myProject);
       }
index 84474567797c6d1642c887856acf05b0f93357a8..069c8269e6891e993c3b5de353663746bb94626d 100644 (file)
@@ -678,7 +678,7 @@ public class ScopeTreeViewPanel extends JPanel implements JDOMExternalizable, Di
       }
       final PsiElement[] elements = validElements.toArray(new PsiElement[validElements.size()]);
 
-      LocalHistoryAction a = LocalHistory.startAction(myProject, IdeBundle.message("progress.deleting"));
+      LocalHistoryAction a = LocalHistory.getInstance().startAction(IdeBundle.message("progress.deleting"));
       try {
         DeleteHandler.deletePsiElement(elements, myProject);
       }
index f40c7bd3b43739d7a9c3249ba10d79804a333ba2..f9fca27b67098b7ea4d00dfe32a8ebf7d6081a63 100644 (file)
@@ -86,7 +86,7 @@ public class DeleteHandler {
       if (elements == null) return;
       Project project = PlatformDataKeys.PROJECT.getData(dataContext);
       if (project == null) return;
-      LocalHistoryAction a = LocalHistory.startAction(project, IdeBundle.message("progress.deleting"));
+      LocalHistoryAction a = LocalHistory.getInstance().startAction(IdeBundle.message("progress.deleting"));
       try {
         deletePsiElement(elements, project);
       }
index 091d576f1d30eda7076675cd2fb16df461244115..5f01a469f3e281a436d0ce834615f984df4334b3 100644 (file)
@@ -97,7 +97,7 @@ public class EditorWindow implements EditorEx, UserDataHolderEx {
     myCaretModelDelegate = new CaretModelWindow(myDelegate.getCaretModel(), this);
     mySelectionModelDelegate = new SelectionModelWindow(myDelegate, myDocumentWindow,this);
     myMarkupModelDelegate = new MarkupModelWindow((MarkupModelEx)myDelegate.getMarkupModel(), myDocumentWindow);
-    myFoldingModelWindow = new FoldingModelWindow((FoldingModelEx)delegate.getFoldingModel(), documentWindow);
+    myFoldingModelWindow = new FoldingModelWindow((FoldingModelEx)delegate.getFoldingModel(), documentWindow, this);
   }
 
   public static void disposeInvalidEditors() {
index 93d49844c0f9cfcef8c2de96fb1d9f5aea50bcda..cebf385b9f11c1392438b9afe8254c8005ab0f61 100644 (file)
 package com.intellij.injected.editor;
 
 import com.intellij.openapi.editor.FoldRegion;
-import com.intellij.openapi.editor.markup.TextAttributes;
+import com.intellij.openapi.editor.FoldingGroup;
 import com.intellij.openapi.editor.ex.FoldingModelEx;
 import com.intellij.openapi.editor.impl.FoldRegionImpl;
+import com.intellij.openapi.editor.markup.TextAttributes;
+import com.intellij.openapi.util.Key;
 import org.jetbrains.annotations.NotNull;
 
 import java.awt.*;
+import java.util.*;
+import java.util.List;
 
 /**
  * @author cdr
@@ -30,10 +34,12 @@ import java.awt.*;
 public class FoldingModelWindow implements FoldingModelEx{
   private final FoldingModelEx myDelegate;
   private final DocumentWindow myDocumentWindow;
+  private final EditorWindow myEditorWindow;
 
-  public FoldingModelWindow(FoldingModelEx delegate, DocumentWindow documentWindow) {
+  public FoldingModelWindow(@NotNull FoldingModelEx delegate, @NotNull DocumentWindow documentWindow, @NotNull EditorWindow editorWindow) {
     myDelegate = delegate;
     myDocumentWindow = documentWindow;
+    myEditorWindow = editorWindow;
   }
 
   public void setFoldingEnabled(boolean isEnabled) {
@@ -49,7 +55,15 @@ public class FoldingModelWindow implements FoldingModelEx{
   }
 
   public FoldRegion[] getAllFoldRegionsIncludingInvalid() {
-    return myDelegate.getAllFoldRegionsIncludingInvalid();
+    FoldRegion[] all = myDelegate.getAllFoldRegionsIncludingInvalid();
+    List<FoldRegion> result = new ArrayList<FoldRegion>();
+    for (FoldRegion region : all) {
+      FoldingRegionWindow window = region.getUserData(FOLD_REGION_WINDOW);
+      if (window != null && window.getEditor() == myEditorWindow) {
+        result.add(window);
+      }
+    }
+    return result.toArray(new FoldRegion[result.size()]);
   }
 
   public boolean intersectsRegion(int startOffset, int endOffset) {
@@ -59,22 +73,29 @@ public class FoldingModelWindow implements FoldingModelEx{
   }
 
   public FoldRegion addFoldRegion(int startOffset, int endOffset, @NotNull String placeholderText) {
-    return myDelegate.addFoldRegion(myDocumentWindow.injectedToHost(startOffset), myDocumentWindow.injectedToHost(endOffset), placeholderText);
+    FoldRegion region = createFoldRegion(startOffset, endOffset, placeholderText, null);
+    return addFoldRegion(region) ? region : null;
   }
 
   public boolean addFoldRegion(@NotNull final FoldRegion region) {
-    return myDelegate.addFoldRegion(new FoldRegionImpl(region.getEditor(), myDocumentWindow.injectedToHost(region.getStartOffset()),
-                                                       myDocumentWindow.injectedToHost(region.getEndOffset()), region.getPlaceholderText(),
-                                                       region.getGroup()));
+    return myDelegate.addFoldRegion(((FoldingRegionWindow)region).getDelegate());
   }
 
   public void removeFoldRegion(@NotNull FoldRegion region) {
-    myDelegate.removeFoldRegion(region);
+    myDelegate.removeFoldRegion(((FoldingRegionWindow)region).getDelegate());
   }
 
   @NotNull
   public FoldRegion[] getAllFoldRegions() {
-    return myDelegate.getAllFoldRegions();
+    FoldRegion[] all = myDelegate.getAllFoldRegions();
+    List<FoldRegion> result = new ArrayList<FoldRegion>();
+    for (FoldRegion region : all) {
+      FoldingRegionWindow window = region.getUserData(FOLD_REGION_WINDOW);
+      if (window != null && window.getEditor() == myEditorWindow) {
+        result.add(window);
+      }
+    }
+    return result.toArray(new FoldRegion[result.size()]);
   }
 
   public boolean isOffsetCollapsed(int offset) {
@@ -82,7 +103,8 @@ public class FoldingModelWindow implements FoldingModelEx{
   }
 
   public FoldRegion getCollapsedRegionAtOffset(int offset) {
-    return myDelegate.getCollapsedRegionAtOffset(myDocumentWindow.injectedToHost(offset));
+    FoldRegion host = myDelegate.getCollapsedRegionAtOffset(myDocumentWindow.injectedToHost(offset));
+    return host; //todo convert to window?
   }
 
   public void runBatchFoldingOperation(@NotNull Runnable operation) {
@@ -94,11 +116,12 @@ public class FoldingModelWindow implements FoldingModelEx{
   }
 
   public FoldRegion fetchOutermost(int offset) {
-    return null;
+    FoldRegion host = myDelegate.fetchOutermost(myDocumentWindow.injectedToHost(offset));
+    return host; //todo convert to window?
   }
 
   public int getLastCollapsedRegionBefore(int offset) {
-    return -1;
+    return -1; //todo implement
   }
 
   public TextAttributes getPlaceholderAttributes() {
@@ -106,6 +129,14 @@ public class FoldingModelWindow implements FoldingModelEx{
   }
 
   public FoldRegion[] fetchTopLevel() {
-    return FoldRegion.EMPTY_ARRAY;
+    return FoldRegion.EMPTY_ARRAY; //todo implement
+  }
+
+  private static final Key<FoldingRegionWindow> FOLD_REGION_WINDOW = Key.create("FOLD_REGION_WINDOW");
+  public FoldRegion createFoldRegion(int startOffset, int endOffset, @NotNull String placeholder, FoldingGroup group) {
+    FoldRegion hostRegion = myDelegate.createFoldRegion(myDocumentWindow.injectedToHost(startOffset), myDocumentWindow.injectedToHost(endOffset), placeholder, group);
+    FoldingRegionWindow window = new FoldingRegionWindow(myDocumentWindow, myEditorWindow, (FoldRegionImpl)hostRegion);
+    hostRegion.putUserData(FOLD_REGION_WINDOW, window);
+    return window;
   }
 }
diff --git a/platform/lang-impl/src/com/intellij/injected/editor/FoldingRegionWindow.java b/platform/lang-impl/src/com/intellij/injected/editor/FoldingRegionWindow.java
new file mode 100644 (file)
index 0000000..adf45f9
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2000-2010 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.injected.editor;
+
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.FoldRegion;
+import com.intellij.openapi.editor.FoldingGroup;
+import com.intellij.openapi.editor.impl.FoldRegionImpl;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * User: cdr
+ */
+public class FoldingRegionWindow extends RangeMarkerWindow implements FoldRegion {
+  private final EditorWindow myEditorWindow;
+
+  private final FoldRegionImpl myHostRegion;
+
+  public FoldingRegionWindow(@NotNull DocumentWindow documentWindow, @NotNull EditorWindow editorWindow, @NotNull FoldRegionImpl hostRegion) {
+    super(documentWindow, hostRegion);
+    myEditorWindow = editorWindow;
+    myHostRegion = hostRegion;
+  }
+
+  public boolean isExpanded() {
+    return myHostRegion.isExpanded();
+  }
+
+  public void setExpanded(boolean expanded) {
+    myHostRegion.setExpanded(expanded);
+  }
+
+  @NotNull
+  public String getPlaceholderText() {
+    return myHostRegion.getPlaceholderText();
+  }
+
+  public Editor getEditor() {
+    return myEditorWindow;
+  }
+
+  public FoldingGroup getGroup() {
+    return myHostRegion.getGroup();
+  }
+
+  public FoldRegionImpl getDelegate() {
+    return myHostRegion;
+  }
+}
index 7a7040fb4d85e684b9b6857f4e39090a64de8e1d..b405e57c16321f8e4307182af593fd2f146e0084 100644 (file)
@@ -35,6 +35,7 @@ import com.intellij.openapi.roots.*;
 import com.intellij.openapi.startup.StartupManager;
 import com.intellij.openapi.util.Condition;
 import com.intellij.openapi.util.Key;
+import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.vfs.*;
 import com.intellij.openapi.vfs.impl.BulkVirtualFileListenerAdapter;
 import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
@@ -124,7 +125,7 @@ public class DirectoryIndexImpl extends DirectoryIndex implements ProjectCompone
     }
 
     assert myPackageNameToDirsMap.keySet().size() == oldPackageNameToDirsMap.keySet().size();
-    for (Map.Entry<String,List<VirtualFile>> entry : myPackageNameToDirsMap.entrySet()) {
+    for (Map.Entry<String, List<VirtualFile>> entry : myPackageNameToDirsMap.entrySet()) {
       String packageName = entry.getKey();
       List<VirtualFile> dirs = entry.getValue();
       List<VirtualFile> dirs1 = oldPackageNameToDirsMap.get(packageName);
@@ -242,7 +243,7 @@ public class DirectoryIndexImpl extends DirectoryIndex implements ProjectCompone
         for (ExcludeFolder excludeRoot : excludeRoots) {
           // Output paths should be excluded (if marked as such) regardless if they're under corresponding module's content root
           if (excludeRoot.getFile() != null) {
-            if (!contentRoot.getUrl().startsWith(excludeRoot.getUrl())) {
+            if (!FileUtil.startsWith(contentRoot.getUrl(), excludeRoot.getUrl())) {
               if (isExcludeRootForModule(module, excludeRoot.getFile())) {
                 putForFileAndAllAncestors(result, excludeRoot.getFile(), excludeRoot.getUrl());
               }
@@ -610,7 +611,8 @@ public class DirectoryIndexImpl extends DirectoryIndex implements ProjectCompone
 
     public Query<VirtualFile> search(@NotNull String packageName, boolean includeLibrarySources) {
       List<VirtualFile> allDirs = doGetDirectoriesByPackageName(packageName);
-      return new FilteredQuery<VirtualFile>(includeLibrarySources ? new CollectionQuery<VirtualFile>(allDirs) : createQuery(allDirs), IS_VALID);
+      return new FilteredQuery<VirtualFile>(includeLibrarySources ? new CollectionQuery<VirtualFile>(allDirs) : createQuery(allDirs),
+                                            IS_VALID);
     }
   }
 
@@ -702,9 +704,23 @@ public class DirectoryIndexImpl extends DirectoryIndex implements ProjectCompone
       VirtualFile parent = file.getParent();
       if (parent == null) return;
 
-      if (isIgnored(file)) return;
-
       DirectoryInfo parentInfo = myDirToInfoMap.get(parent);
+
+      // fill info for all nested roots
+      for (Module eachModule : ModuleManager.getInstance(myProject).getModules()) {
+        for (ContentEntry eachRoot : getContentEntries(eachModule)) {
+          if (parentInfo != null && eachRoot == parentInfo.contentRoot) continue;
+
+          if (FileUtil.startsWith(eachRoot.getUrl(), file.getUrl())) {
+            String rel = FileUtil.getRelativePath(file.getUrl(), eachRoot.getUrl(), '/');
+            if (rel != null) {
+              VirtualFile f = file.findFileByRelativePath(rel);
+              fillMapWithModuleContent(f, eachModule, f);
+            }
+          }
+        }
+      }
+
       if (parentInfo == null) return;
 
       Module module = parentInfo.module;
index 0e914e3aadffe79abd2af8bf464b2349dcfcb307..37a5ebb6b1a3f05cf438f9216d19e043648ab8c5 100644 (file)
@@ -364,7 +364,7 @@ public abstract class BaseRefactoringProcessor {
       }
     }
 
-    LocalHistoryAction action = LocalHistory.startAction(myProject, getCommandName());
+    LocalHistoryAction action = LocalHistory.getInstance().startAction(getCommandName());
 
     final UsageInfo[] writableUsageInfos = usageInfoSet.toArray(new UsageInfo[usageInfoSet.size()]);
     try {
index 488e71c3067253cd4b5393bbd1936a0c39ed25da..e3c3514c5c23677fe60911fdfe2d50200ffccb44 100644 (file)
@@ -1487,11 +1487,9 @@ public class FileBasedIndex implements ApplicationComponent {
       }
       if (file.isDirectory()) {
         if (isMock(file) || myManagingFS.wereChildrenAccessed(file)) {
-          final Collection<VirtualFile> children = (file instanceof NewVirtualFile)? ((NewVirtualFile)file).getInDbChildren() : Arrays.asList(file.getChildren());
+          final Iterable<VirtualFile> children = (file instanceof NewVirtualFile)? ((NewVirtualFile)file).iterInDbChildren() : Arrays.asList(file.getChildren());
           for (VirtualFile child : children) {
-            if (NullVirtualFile.INSTANCE != child) {
-              invalidateIndices(child, markForReindex);
-            }
+            invalidateIndices(child, markForReindex);
           }
         }
       }
diff --git a/platform/lvcs-api/src/com/intellij/history/DeafLocalHistory.java b/platform/lvcs-api/src/com/intellij/history/DeafLocalHistory.java
deleted file mode 100644 (file)
index 6835383..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * @author max
- */
-package com.intellij.history;
-
-import com.intellij.openapi.vfs.VirtualFile;
-
-public class DeafLocalHistory extends LocalHistory {
-  public byte[] getByteContent(final VirtualFile f, final FileRevisionTimestampComparator c) {
-    throw new UnsupportedOperationException();
-  }
-
-  public boolean hasUnavailableContent(final VirtualFile f) {
-    return false;
-  }
-
-  public boolean isUnderControl(final VirtualFile f) {
-    return false;
-  }
-
-  public Label putSystemLabel(final String name, final int color) {
-    return Label.NULL_INSTANCE;
-  }
-
-  public Label putUserLabel(final VirtualFile f, final String name) {
-    return Label.NULL_INSTANCE;
-  }
-
-  public Label putUserLabel(final String name) {
-    return Label.NULL_INSTANCE;
-  }
-
-  public LocalHistoryAction startAction(final String name) {
-    return LocalHistoryAction.NULL;
-  }
-
-  public void save() {
-  }
-}
index 392c6645415bdcb64bdbb53854a02173ece62c87..41ecd8d7bb29ef2620ece8a2bec97b3aa4558f04 100644 (file)
 
 package com.intellij.history;
 
+import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.components.SettingsSavingComponent;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vfs.VirtualFile;
 
-public abstract class LocalHistory implements SettingsSavingComponent {
-  public static LocalHistoryAction startAction(Project p, String name) {
-    return getInstance(p).startAction(name);
-  }
-
-  public static Label putUserLabel(Project p, String name) {
-    return getInstance(p).putUserLabel(name);
-  }
-
-  public static Label putUserLabel(Project p, VirtualFile f, String name) {
-    return getInstance(p).putUserLabel(f, name);
-  }
-
-  public static Label putSystemLabel(Project p, String name) {
-    return getInstance(p).putSystemLabel(name);
-  }
-
-  public static Label putSystemLabel(Project p, String name, int color) {
-    return getInstance(p).putSystemLabel(name, color);
-  }
-
-  public static byte[] getByteContent(Project p, VirtualFile f, FileRevisionTimestampComparator c) {
-    return getInstance(p).getByteContent(f, c);
-  }
-
-  public static boolean isUnderControl(Project p, VirtualFile f) {
-    return getInstance(p).isUnderControl(f);
-  }
-
-  public static boolean hasUnavailableContent(Project p, VirtualFile f) {
-    return getInstance(p).hasUnavailableContent(f);
-  }
-
-  public static LocalHistory getInstance(Project p) {
-    return p.getComponent(LocalHistory.class);
+public abstract class LocalHistory {
+  public static LocalHistory getInstance() {
+    return ApplicationManager.getApplication().getComponent(LocalHistory.class);
   }
 
   public abstract LocalHistoryAction startAction(String name);
 
-  public abstract Label putUserLabel(String name);
-
-  public abstract Label putUserLabel(VirtualFile f, String name);
-
-  public abstract Label putSystemLabel(String name, int color);
+  public abstract Label putSystemLabel(Project p, String name, int color);
 
-  public Label putSystemLabel(String name) {
-    return putSystemLabel(name, -1);
+  public Label putSystemLabel(Project p, String name) {
+    return putSystemLabel(p, name, -1);
   }
 
+  public abstract Label putUserLabel(Project p, String name);
+
   public abstract byte[] getByteContent(VirtualFile f, FileRevisionTimestampComparator c);
 
   public abstract boolean isUnderControl(VirtualFile f);
-
-  public abstract boolean hasUnavailableContent(VirtualFile f);
 }
diff --git a/platform/lvcs-api/src/com/intellij/history/LocalHistoryConfiguration.java b/platform/lvcs-api/src/com/intellij/history/LocalHistoryConfiguration.java
deleted file mode 100644 (file)
index b3c7507..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.history;
-
-import com.intellij.openapi.components.PersistentStateComponent;
-import com.intellij.openapi.components.ServiceManager;
-import com.intellij.openapi.components.State;
-import com.intellij.openapi.components.Storage;
-import com.intellij.util.xmlb.XmlSerializerUtil;
-
-@State(
-  name = "LocalHistoryConfiguration",
-  storages = {
-    @Storage(
-      id ="other",
-      file = "$APP_CONFIG$/other.xml"
-    )}
-)
-public class LocalHistoryConfiguration implements PersistentStateComponent<LocalHistoryConfiguration> {
-  private static final long DEFAULT_PURGING_PERIOD = 1000 * 60 * 60 * 24 * 3; // 3 days
-
-  public long PURGE_PERIOD = DEFAULT_PURGING_PERIOD;
-
-  public boolean ADD_LABEL_ON_PROJECT_OPEN = true;
-  public boolean ADD_LABEL_ON_PROJECT_COMPILATION = true;
-  public boolean ADD_LABEL_ON_FILE_PACKAGE_COMPILATION = true;
-  public boolean ADD_LABEL_ON_PROJECT_MAKE = true;
-  public boolean ADD_LABEL_ON_RUNNING = true;
-  public boolean ADD_LABEL_ON_DEBUGGING = true;
-  public boolean ADD_LABEL_ON_UNIT_TEST_PASSED = true;
-  public boolean ADD_LABEL_ON_UNIT_TEST_FAILED = true;
-
-  public boolean SHOW_CHANGES_ONLY = false;
-
-  public static LocalHistoryConfiguration getInstance() {
-    return ServiceManager.getService(LocalHistoryConfiguration.class);
-  }
-
-  public LocalHistoryConfiguration getState() {
-    return this;
-  }
-
-  public void loadState(final LocalHistoryConfiguration state) {
-    XmlSerializerUtil.copyBean(state, this);
-  }
-}
diff --git a/platform/lvcs-api/src/com/intellij/openapi/localVcs/LocalVcs.java b/platform/lvcs-api/src/com/intellij/openapi/localVcs/LocalVcs.java
deleted file mode 100644 (file)
index a9677ad..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.openapi.localVcs;
-
-import com.intellij.history.LocalHistoryConfiguration;
-import com.intellij.openapi.components.SettingsSavingComponent;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vfs.VirtualFile;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @deprecated use LocalHistory instead
- */
-public abstract class LocalVcs implements SettingsSavingComponent {
-  public static LocalVcs getInstance(Project project) {
-    return project.getComponent(LocalVcs.class);
-  }
-
-  public abstract Project getProject();
-
-  public abstract String[] getRootPaths();
-
-  @Nullable
-  public abstract LvcsFile findFile(String filePath);
-
-  @Nullable
-  public abstract LvcsFile findFile(String filePath, boolean ignoreDeleted);
-
-  @Nullable
-  public abstract LvcsFileRevision findFileRevisionByDate(final String filePath, long date);
-
-  @Nullable
-  public abstract LvcsDirectory findDirectory(String dirPath);
-
-  @Nullable
-  public abstract LvcsDirectory findDirectory(String dirPath, boolean ignoreDeleted);
-
-  public abstract LvcsLabel addLabel(String name, String path);
-
-  public abstract LvcsLabel addLabel(byte type, String name, String path);
-
-  public abstract LvcsAction startAction(String action, String path, boolean isExternalChanges);
-
-  public abstract LvcsRevision[] getRevisions(String path, LvcsLabel label);
-
-  public abstract LvcsRevision[] getRevisions(LvcsLabel label1, LvcsLabel label2);
-
-  public abstract boolean isUnderVcs(VirtualFile file);
-
-  public abstract boolean isAvailable();
-
-  public abstract LocalVcsPurgingProvider getLocalVcsPurgingProvider();
-
-  public abstract LvcsLabel[] getAllLabels();
-
-  public abstract void addLvcsLabelListener(LvcsLabelListener listener);
-
-  public abstract void removeLvcsLabelListener(LvcsLabelListener listener);
-
-  public abstract LocalHistoryConfiguration getConfiguration();
-}
diff --git a/platform/lvcs-api/src/com/intellij/openapi/localVcs/LocalVcsItemsLocker.java b/platform/lvcs-api/src/com/intellij/openapi/localVcs/LocalVcsItemsLocker.java
deleted file mode 100644 (file)
index 33955a1..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.openapi.localVcs;
-
-/**
- * @deprecated use LocalHistory instead
- */
-public interface LocalVcsItemsLocker {
-  boolean itemCanBePurged(LvcsRevision lvcsObject);
-}
diff --git a/platform/lvcs-api/src/com/intellij/openapi/localVcs/LocalVcsPurgingProvider.java b/platform/lvcs-api/src/com/intellij/openapi/localVcs/LocalVcsPurgingProvider.java
deleted file mode 100644 (file)
index 38c49b0..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.openapi.localVcs;
-
-/**
- * @deprecated use LocalHistory instead
- */
-public interface LocalVcsPurgingProvider {
-  void registerLocker(LocalVcsItemsLocker locker);
-  void unregisterLocker(LocalVcsItemsLocker locker);
-
-  boolean itemCanBePurged(LvcsRevision lvcsRevisionFor);
-}
diff --git a/platform/lvcs-api/src/com/intellij/openapi/localVcs/LocalVcsServices.java b/platform/lvcs-api/src/com/intellij/openapi/localVcs/LocalVcsServices.java
deleted file mode 100644 (file)
index 2e67c78..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.openapi.localVcs;
-
-import com.intellij.openapi.project.Project;
-
-/**
- * @deprecated use LocalHistory instead
- */
-public abstract class LocalVcsServices {
-  public static LocalVcsServices getInstance(Project project) {
-    return project.getComponent(LocalVcsServices.class);
-  }                  
-
-  public abstract LocalVcsItemsLocker getUpToDateRevisionProvider();
-}
diff --git a/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsAction.java b/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsAction.java
deleted file mode 100644 (file)
index 2f8fa01..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.openapi.localVcs;
-
-import com.intellij.history.LocalHistoryAction;
-
-
-/**
- * @deprecated see LocalHistoryAction
- */
-public interface LvcsAction extends LocalHistoryAction {
-  LvcsAction EMPTY = new LvcsAction() {
-    public void finish() {
-    }
-
-    public String getName() {
-      return "";
-    }
-  };
-
-  void finish();
-
-  String getName();
-}
diff --git a/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsComparator.java b/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsComparator.java
deleted file mode 100644 (file)
index a6b1bb0..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.openapi.localVcs;
-
-import java.util.Comparator;
-
-/**
- * @deprecated use LocalHistory instead
- */
-public class LvcsComparator implements Comparator{
-
-  public static final Comparator INSTANCE = new LvcsComparator();
-
-  private LvcsComparator(){
-
-  }
-
-  public int compare(Object obj1, Object obj2) {
-    if (obj1 instanceof LvcsRevision){
-      if (obj2 instanceof LvcsRevision)
-        return ((LvcsRevision)obj1).compareTo((LvcsRevision)obj2);
-      else if (obj2 instanceof LvcsLabel)
-        return ((LvcsRevision)obj1).compareTo((LvcsLabel)obj2);
-    } else if (obj1 instanceof LvcsLabel)
-      if (obj2 instanceof LvcsRevision)
-        return ((LvcsLabel)obj1).compareTo((LvcsRevision)obj2);
-      else if (obj2 instanceof LvcsLabel)
-        return ((LvcsLabel)obj1).compareTo((LvcsLabel)obj2);
-
-    throw new RuntimeException("Cannot compare " + obj1 + " and " + obj2);
-  }
-}
diff --git a/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsDirectory.java b/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsDirectory.java
deleted file mode 100644 (file)
index de89ab0..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.openapi.localVcs;
-
-import com.intellij.openapi.vfs.VirtualFile;
-
-/**
- * @deprecated use LocalHistory instead
- */
-public interface LvcsDirectory extends LvcsObject {
-  LvcsFile[] getFiles();
-  LvcsFile[] getFiles(LvcsLabel label);
-
-  LvcsDirectory[] getDirectories();
-  LvcsDirectory[] getDirectories(LvcsLabel label);
-
-  LvcsObject[] getChildren();
-  LvcsObject[] getChildren(LvcsLabel label);
-
-  LvcsDirectory addDirectory(String name, VirtualFile onDisk);
-
-  LvcsFile addFile(String name, VirtualFileInfo virtualFileInfo);
-}
diff --git a/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsDirectoryRevision.java b/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsDirectoryRevision.java
deleted file mode 100644 (file)
index d2feffb..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.openapi.localVcs;
-
-/**
- * @deprecated use LocalHistory instead
- */
-public interface LvcsDirectoryRevision extends LvcsRevision {
-  LvcsDirectoryRevision getParent();
-
-  LvcsFileRevision[] getFiles();
-  LvcsDirectoryRevision[] getDirectories();
-
-  LvcsRevision[] getChildren();
-}
diff --git a/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsFile.java b/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsFile.java
deleted file mode 100644 (file)
index c01e960..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.openapi.localVcs;
-
-/**
- * @deprecated use LocalHistory instead
- */
-public interface LvcsFile extends LvcsObject {
-  byte[] getByteContent();
-  byte[] getByteContent(LvcsLabel label);
-
-  void commit(VirtualFileInfo fileInfo);
-  void commitRefactorings(byte[] newContent);
-
-  long getByteLength(LvcsLabel label);
-
-  long getTimeStamp();
-
-  LvcsFileRevision getRevision();
-}
diff --git a/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsFileRevision.java b/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsFileRevision.java
deleted file mode 100644 (file)
index 1478991..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.openapi.localVcs;
-
-/**
- * @deprecated use LocalHistory instead
- */
-public interface LvcsFileRevision extends LvcsRevision {
-  byte[] getByteContent();
-  long getByteLength();
-
-  LvcsFileRevision getLastSavedRevision();
-
-  void markSaved();
-}
diff --git a/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsLabel.java b/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsLabel.java
deleted file mode 100644 (file)
index 8fd64e9..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.openapi.localVcs;
-
-
-
-/**
- * @deprecated use LocalHistory instead
- */
-public interface LvcsLabel extends Comparable<LvcsLabel>{
-  byte TYPE_BEFORE_ACTION = 1;
-  byte TYPE_AFTER_ACTION = 2;
-
-  byte TYPE_OTHER = 3;
-  byte TYPE_TESTS_SUCCESSFUL = 4;
-  byte TYPE_TESTS_FAILED = 5;
-
-  byte TYPE_USER = 6;
-
-  int getType();
-  String getName();
-  String getPath();
-  long getDate();
-  String getAction();
-  int getVersionId();
-
-  LvcsLabel getRecentChangesBeforeLabel( long date );
-
-  int compareTo(LvcsRevision revision);
-}
diff --git a/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsLabelListener.java b/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsLabelListener.java
deleted file mode 100644 (file)
index daeeebd..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.openapi.localVcs;
-
-/**
- * @deprecated use LocalHistory instead
- */
-public interface LvcsLabelListener {
-  void labelAdded(LvcsLabel label);
-  void labelDeleted(LvcsLabel label);
-}
diff --git a/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsObject.java b/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsObject.java
deleted file mode 100644 (file)
index 249d881..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.openapi.localVcs;
-
-import com.intellij.openapi.vfs.VirtualFile;
-
-/**
- * @deprecated use LocalHistory instead
- */
-public interface LvcsObject {
-  LocalVcs getLocalVcs();
-
-  LvcsRevision getRevision();
-  LvcsRevision getRevision(LvcsLabel label);
-
-  String getName();
-  String getName(LvcsLabel label);
-
-  String getAbsolutePath();
-  String getAbsolutePath(LvcsLabel label);
-
-  long getDate();
-  long getDate(LvcsLabel label);
-
-  boolean exists();
-  boolean exists(LvcsLabel label);
-
-  LvcsObject getParent();
-  LvcsObject getParent(LvcsLabel label);
-
-  void delete();
-
-  void rename(String newName, VirtualFile file);
-  void move(LvcsDirectory newParent, VirtualFile virtualFile);
-
-  void scheduleForRemoval();
-}
diff --git a/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsRevision.java b/platform/lvcs-api/src/com/intellij/openapi/localVcs/LvcsRevision.java
deleted file mode 100644 (file)
index 148c9d4..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.openapi.localVcs;
-
-import org.jetbrains.annotations.NonNls;
-
-/**
- * @deprecated use LocalHistory instead
- */
-public interface LvcsRevision extends Comparable{
-  @NonNls String PROPERTY_UP_TO_DATE = "upToDate";
-
-  String getName();
-  String getAbsolutePath();
-
-  long getDate();
-  boolean isDeleted();
-  boolean isPurged();
-
-  int getId();
-
-  LvcsObject getObject();
-
-  LvcsRevision getNextRevision();
-  LvcsRevision getPrevRevision();
-
-  LvcsRevision getParentRevision();
-
-  void setUpToDate(boolean value);
-  boolean isUpToDate();
-
-  /**
-   * Returns a lable, which is associated with this revision. You can use this label to view the VCS
-   * at the moment of revision creation. This label is not visible view LocalVcs.getLabels().
-   */
-  LvcsLabel getImplicitLabel();
-
-  LvcsRevision findLatestRevision();
-
-  LvcsRevision findNearestPreviousUpToDateRevision();
-
-  int compareTo(LvcsLabel label);
-
-  int compareTo(LvcsRevision label);
-
-  long getCreationDate();
-
-  int getLength();
-
-  int getVersionId();
-
-  int getVersion();
-
-  boolean isScheduledForRemoval();
-
-  boolean isTooLong();
-
-  boolean hasContent();
-}
diff --git a/platform/lvcs-api/src/com/intellij/openapi/localVcs/VirtualFileInfo.java b/platform/lvcs-api/src/com/intellij/openapi/localVcs/VirtualFileInfo.java
deleted file mode 100644 (file)
index fe24c98..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.openapi.localVcs;
-
-import java.io.IOException;
-
-/**
- * @deprecated use LocalHistory instead
- */
-public interface VirtualFileInfo {
-  String getFilePath();
-  long getFileTampStamp();
-  byte[] getFileByteContent() throws IOException;
-
-  boolean isDirectory();
-
-  String getName();
-
-  int getFileSize();
-
-}
diff --git a/platform/lvcs-api/src/com/intellij/openapi/localVcs/package.html b/platform/lvcs-api/src/com/intellij/openapi/localVcs/package.html
deleted file mode 100644 (file)
index 971160c..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<!--
-  ~ Copyright 2000-2007 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.
-  -->
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html><body bgcolor="white">
-Provides interfaces for working with IDEA's Local VCS.
-</body></html>
index 4976107b60410f13c887ce1f97b6fb31e2bb73eb..893e135638dc8e5c82f56b4d15f25fde915a59e3 100644 (file)
     <orderEntry type="module" module-name="testFramework" scope="TEST" />
     <orderEntry type="module" module-name="lvcs-api" />
     <orderEntry type="library" scope="TEST" name="EasyMock" level="project" />
-    <orderEntry type="module" module-name="platform-impl" />
+    <orderEntry type="library" name="jcip" level="project" />
+    <orderEntry type="library" name="commons-lang" level="project" />
     <orderEntry type="module" module-name="lang-api" />
-    <orderEntry type="module" module-name="lang-impl" />
+    <orderEntry type="module" module-name="platform-impl" />
   </component>
   <component name="copyright">
     <Base>
index 3ccb3804b26b0cd7e10b95d0fd5980423d849042..235c49adf8bcddc34b9e7ac363c385f75a9026bf 100644 (file)
@@ -22,8 +22,10 @@ import com.intellij.history.core.changes.ChangeSet;
 import com.intellij.history.core.changes.ChangeVisitor;
 import com.intellij.history.core.changes.ContentChange;
 import com.intellij.history.core.storage.Content;
+import com.intellij.history.core.tree.Entry;
+import com.intellij.history.core.tree.RootEntry;
+import com.intellij.openapi.util.Pair;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -32,21 +34,25 @@ import java.util.List;
 // Therefore we have to move along the changelist, revert only content changes
 // and record file and changeset timestamps to call comparator with.
 public class ByteContentRetriever extends ChangeSetsProcessor {
+  private final LocalHistoryFacade myVcs;
   private final FileRevisionTimestampComparator myComparator;
 
   private long myCurrentFileTimestamp;
   private Content myCurrentFileContent;
 
-  public ByteContentRetriever(LocalVcs vcs, String path, FileRevisionTimestampComparator c) {
-    super(vcs, path);
+  public ByteContentRetriever(LocalHistoryFacade vcs, RootEntry root, String path, FileRevisionTimestampComparator c) {
+    super(path);
+    myVcs = vcs;
     myComparator = c;
 
-    myCurrentFileContent = myEntry.getContent();
-    myCurrentFileTimestamp = myEntry.getTimestamp();
+    Entry entry = root.getEntry(path);
+    myCurrentFileContent = entry.getContent();
+    myCurrentFileTimestamp = entry.getTimestamp();
   }
 
   public byte[] getResult() {
     try {
+      checkCurrentRevision(); // optimization: do not collect changes if current revision will do
       process();
     }
     catch (ContentFoundException ignore) {
@@ -57,57 +63,48 @@ public class ByteContentRetriever extends ChangeSetsProcessor {
   }
 
   @Override
-  protected List<Change> collectChanges() {
-    try {
-      final List<Change> result = new ArrayList<Change>();
+  protected Pair<String, List<ChangeSet>> collectChanges() {
+    final List<ChangeSet> result = new ArrayList<ChangeSet>();
 
-      myVcs.acceptRead(new ChangeVisitor() {
-        @Override
-        public void begin(ChangeSet c) {
-          if (c.affects(myEntry)) result.add(c);
-        }
-      });
+    myVcs.accept(new ChangeVisitor() {
+      @Override
+      public void begin(ChangeSet c) throws StopVisitingException {
+        if (c.affectsPath(myPath)) result.add(c);
+      }
+    });
 
-      return result;
-    }
-    catch (IOException ex) {
-      throw new RuntimeException(ex);
-    }
+    return Pair.create(myPath, result);
   }
 
   @Override
   protected void nothingToVisit() {
     // visit current version
-    doVisit();
+    checkCurrentRevision();
   }
 
   @Override
-  protected void visitLabel(Change c) {
+  public void visit(ChangeSet changeSet) {
+    checkCurrentRevision();
+    recordContentAndTimestamp(changeSet);
   }
 
   @Override
-  public void visitRegular(Change c) {
-    doVisit();
-    recordContentAndTimestamp(c);
+  protected void visitFirstAvailableNonCreational(ChangeSet changeSet) {
+    checkCurrentRevision();
   }
 
-  @Override
-  protected void visitFirstAvailableNonCreational(Change c) {
-    doVisit();
-  }
-
-  void doVisit() {
+  private void checkCurrentRevision() {
     if (myComparator.isSuitable(myCurrentFileTimestamp)) {
       throw new ContentFoundException();
     }
   }
 
-  private void recordContentAndTimestamp(Change c) {
+  private void recordContentAndTimestamp(ChangeSet c) {
+    // todo what if the path is being changed during changes?
     for (Change each : c.getChanges()) {
-      if (!each.isFileContentChange()) continue;
-      if (!each.affectsOnlyInside(myEntry)) continue;
-
+      if (!(each instanceof ContentChange)) continue;
       ContentChange cc = (ContentChange)each;
+      if (!cc.affectsPath(myPath)) continue;
 
       myCurrentFileTimestamp = cc.getOldTimestamp();
       myCurrentFileContent = cc.getOldContent();
diff --git a/platform/lvcs-impl/src/com/intellij/history/core/ChangeCollectingVisitor.java b/platform/lvcs-impl/src/com/intellij/history/core/ChangeCollectingVisitor.java
new file mode 100644 (file)
index 0000000..460e2f4
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2000-2010 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.history.core;
+
+import com.intellij.history.core.changes.*;
+import com.intellij.psi.codeStyle.NameUtil;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.regex.Pattern;
+
+public class ChangeCollectingVisitor extends ChangeVisitor {
+  private String myPath;
+  private final String myProjectId;
+  private final Pattern myPattern;
+  private ChangeSet myCurrentChangeSet;
+  private boolean myExists = true;
+  private boolean myDoNotAddAnythingElseFromCurrentChangeSet = false;
+  private final LinkedHashSet<ChangeSet> myResult = new LinkedHashSet<ChangeSet>();
+
+  public ChangeCollectingVisitor(String path, String projectId, @Nullable String pattern) {
+    myPath = path;
+    myProjectId = projectId;
+    myPattern = pattern == null ? null : Pattern.compile(NameUtil.buildRegexp(pattern, 0, true, true), Pattern.CASE_INSENSITIVE);
+  }
+
+  public List<ChangeSet> getChanges() {
+    return new ArrayList<ChangeSet>(myResult);
+  }
+
+  public String getPath() {
+    return myPath;
+  }
+
+  @Override
+  public void begin(ChangeSet c) throws StopVisitingException {
+    myCurrentChangeSet = c;
+  }
+
+  @Override
+  public void end(ChangeSet c) throws StopVisitingException {
+    myCurrentChangeSet = null;
+    myDoNotAddAnythingElseFromCurrentChangeSet = false;
+  }
+
+  @Override
+  public void visit(PutLabelChange c) throws StopVisitingException {
+    doVisit(c);
+  }
+
+  @Override
+  public void visit(StructuralChange c) throws StopVisitingException {
+    doVisit(c);
+  }
+
+  private void doVisit(Change c) {
+    if (skippedDueToNonexistence(c)) return;
+    addIfAffectsAndRevert(c);
+  }
+
+  @Override
+  public void visit(CreateEntryChange c) throws StopVisitingException {
+    if (skippedDueToNonexistence(c)) return;
+    addIfAffectsAndRevert(c);
+    if (c.isCreationalFor(myPath)) myExists = false;
+  }
+
+  @Override
+  public void visit(DeleteChange c) throws StopVisitingException {
+    if (skippedDueToNonexistence(c)) {
+      if (c.isDeletionOf(myPath)) {
+        myExists = true;
+        myDoNotAddAnythingElseFromCurrentChangeSet = true;
+      }
+      return;
+    }
+    addIfAffectsAndRevert(c);
+  }
+
+  private void addIfAffectsAndRevert(Change c) {
+    if (!myDoNotAddAnythingElseFromCurrentChangeSet && (c.affectsPath(myPath) || c.affectsProject(myProjectId))) {
+      if (myPattern == null || c.affectsMatching(myPattern)) {
+        myResult.add(myCurrentChangeSet);
+      }
+    }
+    if (c instanceof StructuralChange) myPath = ((StructuralChange)c).revertPath(myPath);
+  }
+
+  private boolean skippedDueToNonexistence(Change c) {
+    if (myExists) return false;
+    if (c instanceof StructuralChange) myPath = ((StructuralChange)c).revertPath(myPath);
+    return true;
+  }
+}
diff --git a/platform/lvcs-impl/src/com/intellij/history/core/ChangeList.java b/platform/lvcs-impl/src/com/intellij/history/core/ChangeList.java
new file mode 100644 (file)
index 0000000..3fc8641
--- /dev/null
@@ -0,0 +1,190 @@
+/*
+ * 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.history.core;
+
+import com.intellij.history.Clock;
+import com.intellij.history.core.changes.Change;
+import com.intellij.history.core.changes.ChangeSet;
+import com.intellij.history.core.changes.ChangeVisitor;
+import com.intellij.history.core.storage.Content;
+import com.intellij.openapi.application.Application;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.TestOnly;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class ChangeList {
+  private final ChangeListStorage myStorage;
+
+  private ChangeSetBlock myCurrentBlock;
+
+  private ChangeSet myCurrentChangeSet;
+  private int myChangeSetDepth;
+
+  private int myIntervalBetweenActivities = 12 * 60 * 60 * 1000; // one day
+
+  public ChangeList(ChangeListStorage storage) {
+    myStorage = storage;
+    myCurrentBlock = storage.createNewBlock();
+  }
+
+  public synchronized void save() {
+    flushChanges(true);
+  }
+
+  public synchronized void close() {
+    flushChanges(true);
+    myStorage.close();
+  }
+
+  public synchronized long nextId() {
+    return myStorage.nextId();
+  }
+
+  public synchronized void addChange(Change c) {
+    assert myChangeSetDepth != 0;
+    myCurrentChangeSet.addChange(c);
+  }
+
+  public synchronized void beginChangeSet() {
+    myChangeSetDepth++;
+    if (myChangeSetDepth > 1) return;
+
+    myCurrentChangeSet = new ChangeSet(myStorage.nextId(), Clock.getCurrentTimestamp());
+    myCurrentBlock.add(myCurrentChangeSet);
+  }
+
+  public synchronized boolean endChangeSet(String name) {
+    assert myChangeSetDepth > 0;
+
+    myChangeSetDepth--;
+    if (myChangeSetDepth > 0) return false;
+
+    if (myCurrentChangeSet.getChanges().isEmpty()) {
+      myCurrentBlock.removeLast();
+      return false;
+    }
+
+    myCurrentChangeSet.setName(name);
+    myCurrentChangeSet = null;
+
+    flushChanges(false);
+    return true;
+  }
+
+  @TestOnly
+  public List<ChangeSet> getChangesInTests() {
+    List<ChangeSet> result = new ArrayList<ChangeSet>();
+    for (ChangeSet each : iterChanges()) {
+      result.add(each);
+    }
+    return result;
+  }
+
+  public synchronized Iterable<ChangeSet> iterChanges() {
+    return new Iterable<ChangeSet>() {
+      public Iterator<ChangeSet> iterator() {
+        return new Iterator<ChangeSet>() {
+          private ChangeSetBlock currentBlock;
+          private Iterator<ChangeSet> currentIter;
+
+          private ChangeSet next = fetchNext();
+
+          public boolean hasNext() {
+            return next != null;
+          }
+
+          public ChangeSet next() {
+            ChangeSet result = next;
+            next = fetchNext();
+            return result;
+          }
+
+          private ChangeSet fetchNext() {
+            if (currentBlock == null) {
+              synchronized (ChangeList.this) {
+                currentBlock = myCurrentBlock;
+                List<ChangeSet> copy = new ArrayList<ChangeSet>(currentBlock.changes);
+                currentIter = ContainerUtil.iterateBackward(copy).iterator();
+              }
+            }
+            while (!currentIter.hasNext()) {
+              synchronized (ChangeList.this) {
+                currentBlock = myStorage.readPrevious(currentBlock);
+              }
+              if (currentBlock == null) return null;
+              currentIter = ContainerUtil.iterateBackward(currentBlock.changes).iterator();
+            }
+            return currentIter.next();
+          }
+
+          public void remove() {
+            throw new UnsupportedOperationException();
+          }
+        };
+      }
+    };
+  }
+
+  private void flushChanges(boolean force) {
+    if (myChangeSetDepth > 0) return; 
+    if (myCurrentBlock.shouldFlush(force) || flushEveryChangeSetInTests()) {
+      myStorage.writeNextBlock(myCurrentBlock);
+      myCurrentBlock = myStorage.createNewBlock();
+    }
+    myStorage.flush();
+  }
+
+  private boolean flushEveryChangeSetInTests() {
+    Application app = ApplicationManager.getApplication();
+    return app == null || app.isUnitTestMode();
+  }
+
+  public void accept(ChangeVisitor v) {
+    try {
+      for (ChangeSet change : iterChanges()) {
+        change.accept(v);
+      }
+    }
+    catch (ChangeVisitor.StopVisitingException e) {
+    }
+    v.finished();
+  }
+
+  public synchronized void purgeObsolete(long period) {
+    List<Content> contentsToPurge = new ArrayList<Content>();
+
+    List<ChangeSetBlock> blocks = myStorage.purge(period, myIntervalBetweenActivities);
+    for (ChangeSetBlock each : blocks) {
+      for (ChangeSet changeSet : each.changes) {
+        contentsToPurge.addAll(changeSet.getContentsToPurge());
+      }
+    }
+
+    for (Content each : contentsToPurge) {
+      each.release();
+    }
+  }
+
+  @TestOnly
+  public void setIntervalBetweenActivities(int value) {
+    myIntervalBetweenActivities = value;
+  }
+}
\ No newline at end of file
similarity index 57%
rename from platform/lvcs-impl/src/com/intellij/history/core/storage/IContentStorage.java
rename to platform/lvcs-impl/src/com/intellij/history/core/ChangeListStorage.java
index c518b298be2c08425c56487b4b5d79f5a4cdcf08..a0f2a2a25e8e6517dc9e8f0ed7a2cfba8d465f4a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2010 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-package com.intellij.history.core.storage;
+package com.intellij.history.core;
 
-public interface IContentStorage {
-  void save();
+import org.jetbrains.annotations.Nullable;
 
+import java.util.List;
+
+public interface ChangeListStorage {
   void close();
 
-  int store(byte[] content) throws BrokenStorageException;
+  long nextId();
+
+  ChangeSetBlock createNewBlock();
 
-  byte[] load(int id) throws BrokenStorageException;
+  @Nullable
+  ChangeSetBlock readPrevious(ChangeSetBlock block);
 
-  void remove(int id);
+  List<ChangeSetBlock> purge(long period, int intervalBetweenActivities);
 
-  void setVersion(int version);
+  void writeNextBlock(ChangeSetBlock block);
 
-  int getVersion();
-}
+  void flush();
+}
\ No newline at end of file
diff --git a/platform/lvcs-impl/src/com/intellij/history/core/ChangeListStorageImpl.java b/platform/lvcs-impl/src/com/intellij/history/core/ChangeListStorageImpl.java
new file mode 100644 (file)
index 0000000..3b9a329
--- /dev/null
@@ -0,0 +1,185 @@
+/*
+ * Copyright 2000-2010 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.intellij.history.core;
+
+import com.intellij.history.core.changes.ChangeSet;
+import com.intellij.history.utils.LocalHistoryLog;
+import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.vfs.newvfs.ManagingFS;
+import com.intellij.openapi.vfs.newvfs.persistent.PersistentFS;
+import com.intellij.util.io.storage.AbstractStorage;
+
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ChangeListStorageImpl implements ChangeListStorage {
+  private static final int VERSION = 3;
+
+  private static final String STORAGE_FILE = "changes";
+
+  private final File myStorageDir;
+  private final LinkedStorage myStorage;
+
+  public ChangeListStorageImpl(File storageDir) {
+    myStorageDir = storageDir;
+    try {
+      myStorage = createStorage(myStorageDir);
+    }
+    catch (IOException e) {
+      throw handleError(e);
+    }
+  }
+
+  private static LinkedStorage createStorage(File storageDir) throws IOException {
+    String path = storageDir.getPath() + "/" + STORAGE_FILE;
+    LinkedStorage result = new LinkedStorage(path);
+
+    long fsTimestamp = ((PersistentFS)ManagingFS.getInstance()).getCreationTimestamp();
+
+    boolean versionMismatch = result.getVersion() != VERSION;
+    boolean timestampMismatch = result.getFSTimestamp() != fsTimestamp;
+    if (versionMismatch || timestampMismatch) {
+      if (versionMismatch) LocalHistoryLog.LOG.info("local history version mismatch, rebuilding...");
+      if (timestampMismatch) LocalHistoryLog.LOG.info("FS has been rebuild, rebuilding clearing local history...");
+      result.dispose();
+      if (!FileUtil.delete(storageDir)) {
+        throw new IOException("cannot clear storage dir: " + storageDir);
+      }
+      result = new LinkedStorage(path);
+      result.setVersion(VERSION);
+      result.setFSTimestamp(fsTimestamp);
+    }
+    return result;
+  }
+
+  private RuntimeException handleError(Throwable e) {
+    try {
+      if (myStorage != null) {
+        myStorage.setVersion(-1);
+      }
+    }
+    catch (Throwable ex) {
+      LocalHistoryLog.LOG.error("cannot mark storage as broken", ex);
+    }
+    throw new RuntimeException(e);
+  }
+
+  public synchronized void close() {
+    myStorage.dispose();
+  }
+
+  public synchronized long nextId() {
+    return myStorage.nextId();
+  }
+
+  public synchronized ChangeSetBlock createNewBlock() {
+    return new ChangeSetBlock(0);
+  }
+
+  public synchronized ChangeSetBlock readPrevious(ChangeSetBlock block) {
+    int prevId = block.id == 0 ? myStorage.getLastRecord() : myStorage.getPrevRecord(block.id);
+    if (prevId == 0) return null;
+    assert prevId != block.id;
+    return doReadBlock(prevId);
+  }
+
+  private ChangeSetBlock doReadBlock(int id) {
+    DataInputStream in = myStorage.readStream(id);
+    try {
+      try {
+        int size = in.readInt();
+        List<ChangeSet> changes = new ArrayList<ChangeSet>(size);
+        while (size-- > 0) {
+          changes.add(new ChangeSet(in));
+        }
+        return new ChangeSetBlock(id, changes);
+      }
+      finally {
+        in.close();
+      }
+    }
+    catch (Throwable e) {
+      throw handleError(e);
+    }
+  }
+
+  public synchronized void writeNextBlock(ChangeSetBlock block) {
+    try {
+      block.id = myStorage.createNextRecord();
+      AbstractStorage.StorageDataOutput out = myStorage.writeStream(block.id);
+      try {
+        out.writeInt(block.changes.size());
+        for (ChangeSet each : block.changes) {
+          each.write(out);
+        }
+      }
+      finally {
+        out.close();
+      }
+    }
+    catch (IOException e) {
+      throw handleError(e);
+    }
+  }
+
+  public synchronized List<ChangeSetBlock> purge(long period, int intervalBetweenActivities) {
+    List<ChangeSetBlock> result = new ArrayList<ChangeSetBlock>();
+    int each = findFirstObsoleteBlock(period, intervalBetweenActivities);
+    try {
+      while(each != 0) {
+        result.add(doReadBlock(each));
+        myStorage.deleteRecord(each);
+        each = myStorage.getPrevRecord(each);
+      }
+    }
+    catch (IOException e) {
+      throw handleError(e);
+    }
+    return result;
+  }
+
+
+  private int findFirstObsoleteBlock(long period, int intervalBetweenActivities) {
+    long prevTimestamp = 0;
+    long length = 0;
+
+    int last = myStorage.getLastRecord();
+    while (last != 0) {
+      long t = myStorage.getTimestamp(last);
+      if (prevTimestamp == 0) prevTimestamp = t;
+
+      long delta = prevTimestamp - t;
+      prevTimestamp = t;
+
+      length += delta < intervalBetweenActivities ? delta : 1;
+
+      if (length >= period) return last;
+
+      last = myStorage.getPrevRecord(last);
+    }
+
+    return 0;
+  }
+
+
+  public void flush() {
+    myStorage.flushSome();
+  }
+}
\ No newline at end of file
diff --git a/platform/lvcs-impl/src/com/intellij/history/core/ChangeSetBlock.java b/platform/lvcs-impl/src/com/intellij/history/core/ChangeSetBlock.java
new file mode 100644 (file)
index 0000000..7660c05
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2000-2010 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.history.core;
+
+import com.intellij.history.core.changes.ChangeSet;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ChangeSetBlock {
+  private static final int BLOCK_SIZE = 1000;
+  public int id;
+  public final List<ChangeSet> changes;
+
+  public ChangeSetBlock(int id) {
+    this.id = id;
+    this.changes = new ArrayList<ChangeSet>(BLOCK_SIZE);
+  }
+
+  ChangeSetBlock(int id, List<ChangeSet> changes) {
+    this.id = id;
+    this.changes = changes;
+  }
+
+  public void add(ChangeSet changeSet) {
+    changes.add(changeSet);
+  }
+
+  public void removeLast() {
+    changes.remove(changes.size() - 1);
+  }
+
+  public boolean shouldFlush(boolean force) {
+    int count = 0;
+    for (ChangeSet each : changes) {
+      count += each.getChanges().size();
+
+      if (count >= BLOCK_SIZE) return true;
+      if (force && count > 0) return true;
+    }
+    return false;
+  }
+}
index ba9fb175ae630f26691690b43e0fec43df77e18e..0da48a9b1ec6a58c389766d2bdaa3791485b679e 100644 (file)
 
 package com.intellij.history.core;
 
-import com.intellij.history.core.changes.Change;
-import com.intellij.history.core.tree.Entry;
+import com.intellij.history.core.changes.ChangeSet;
+import com.intellij.openapi.util.Pair;
 
 import java.util.List;
 
 public abstract class ChangeSetsProcessor {
-  protected LocalVcs myVcs;
   protected String myPath;
-  protected Entry myEntry;
 
-  public ChangeSetsProcessor(LocalVcs vcs, String path) {
-    myVcs = vcs;
+  public ChangeSetsProcessor(String path) {
     myPath = path;
-    myEntry = myVcs.getEntry(path);
   }
 
   protected void process() {
-    List<Change> changes = collectChanges();
+    Pair<String, List<ChangeSet>> pathAndChanges = collectChanges();
 
+    List<ChangeSet> changes = pathAndChanges.second;
     if (changes.isEmpty()) {
       nothingToVisit();
       return;
     }
 
-    for (Change c : changes) {
-      if (c.isLabel()) {
-        visitLabel(c);
-      }
-      else {
-        visitRegular(c);
-      }
+    for (ChangeSet c : changes) {
+      visit(c);
     }
 
-    Change lastChange = changes.get(changes.size() - 1);
-    if (!lastChange.isLabel() && !lastChange.isCreationalFor(myEntry)) {
+    ChangeSet lastChange = changes.get(changes.size() - 1);
+    if (!lastChange.isLabelOnly() && !lastChange.isCreationalFor(pathAndChanges.first)) {
       visitFirstAvailableNonCreational(lastChange);
     }
   }
 
-  protected abstract List<Change> collectChanges();
+  protected abstract Pair<String, List<ChangeSet>> collectChanges();
 
   protected abstract void nothingToVisit();
 
-  protected abstract void visitLabel(Change c);
+  protected abstract void visit(ChangeSet changeSet);
 
-  protected abstract void visitRegular(Change c);
-
-  protected abstract void visitFirstAvailableNonCreational(Change c);
+  protected abstract void visitFirstAvailableNonCreational(ChangeSet changeSet);
 }
diff --git a/platform/lvcs-impl/src/com/intellij/history/core/ContentFactory.java b/platform/lvcs-impl/src/com/intellij/history/core/ContentFactory.java
deleted file mode 100644 (file)
index 25ae207..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.history.core;
-
-import com.intellij.history.core.storage.Content;
-import com.intellij.history.core.storage.Storage;
-import com.intellij.history.core.storage.UnavailableContent;
-
-import java.io.IOException;
-import java.util.Arrays;
-
-
-public abstract class ContentFactory {
-  public static final int MAX_CONTENT_LENGTH = 1024 * 1024;
-
-  public Content createContent(Storage s) {
-    try {
-      if (isTooLong()) return new UnavailableContent();
-      return s.storeContent(getBytes());
-    }
-    catch (IOException e) {
-      return new UnavailableContent();
-    }
-  }
-
-  private boolean isTooLong() throws IOException {
-    return getLength() > MAX_CONTENT_LENGTH;
-  }
-
-  public boolean equalsTo(Content c) {
-    try {
-      if (!c.isAvailable()) return false;
-      if (isTooLong()) return false;
-
-      if (getLength() != c.getBytes().length) return false;
-      return Arrays.equals(getBytes(), c.getBytes());
-    }
-    catch (IOException e) {
-      return false;
-    }
-  }
-
-  protected abstract byte[] getBytes() throws IOException;
-
-  protected abstract long getLength() throws IOException;
-}
diff --git a/platform/lvcs-impl/src/com/intellij/history/core/IdPath.java b/platform/lvcs-impl/src/com/intellij/history/core/IdPath.java
deleted file mode 100644 (file)
index 1a8b9d3..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.history.core;
-
-import com.intellij.history.core.storage.Stream;
-
-import java.io.IOException;
-import java.util.Arrays;
-
-public class IdPath {
-  private final int[] myParts;
-
-  public IdPath(int... parts) {
-    myParts = parts;
-  }
-
-  public IdPath(Stream s) throws IOException {
-    myParts = new int[s.readInteger()];
-    for (int i = 0; i < myParts.length; i++) {
-      myParts[i] = s.readInteger();
-    }
-  }
-
-  public void write(Stream s) throws IOException {
-    s.writeInteger(myParts.length);
-    // todo try to change with writeArray method
-    for (int id : myParts) {
-      s.writeInteger(id);
-    }
-  }
-
-  public int getId() {
-    return myParts[myParts.length - 1];
-  }
-
-  public IdPath getParent() {
-    if (myParts.length == 1) return null;
-    int[] newPath = new int[myParts.length - 1];
-    System.arraycopy(myParts, 0, newPath, 0, newPath.length);
-    return new IdPath(newPath);
-  }
-
-  public IdPath appendedWith(int id) {
-    // todo use Arrays.copyOf after going to 1.6 
-    int[] newPath = new int[myParts.length + 1];
-    System.arraycopy(myParts, 0, newPath, 0, myParts.length);
-    newPath[newPath.length - 1] = id;
-    return new IdPath(newPath);
-  }
-
-  public boolean isChildOrParentOf(IdPath p) {
-    return startsWith(p) || p.startsWith(this);
-  }
-
-  public boolean contains(int id) {
-    for (int part : myParts) {
-      if (part == id) return true;
-    }
-    return false;
-  }
-
-  public boolean startsWith(IdPath p) {
-    if (myParts.length < p.myParts.length) return false;
-    for (int i = 0; i < p.myParts.length; i++) {
-      if (myParts[i] != p.myParts[i]) return false;
-    }
-    return true;
-  }
-
-  public boolean rootEquals(int id) {
-    return myParts[0] == id;
-  }
-
-  public IdPath withoutRoot() {
-    int[] newPath = new int[myParts.length - 1];
-    System.arraycopy(myParts, 1, newPath, 0, newPath.length);
-    return new IdPath(newPath);
-  }
-
-  @Override
-  public String toString() {
-    String result = "";
-    for (int part : myParts) {
-      result += part + ".";
-    }
-    return result.substring(0, result.length() - 1);
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (o == null || !o.getClass().equals(getClass())) return false;
-    return Arrays.equals(myParts, ((IdPath)o).myParts);
-  }
-
-  @Override
-  public int hashCode() {
-    throw new UnsupportedOperationException();
-  }
-}
similarity index 73%
rename from platform/lvcs-impl/src/com/intellij/history/core/changes/CreateEntryChangeNonAppliedState.java
rename to platform/lvcs-impl/src/com/intellij/history/core/LabelImpl.java
index 5e85eac8a72f8270ef571e02d7b8e155b5d08eb5..3be56c87c3ae5b083dab2a52129599ede0ca4d4f 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package com.intellij.history.core;
 
-package com.intellij.history.core.changes;
+import com.intellij.history.ByteContent;
+import com.intellij.history.core.tree.RootEntry;
 
-class CreateEntryChangeNonAppliedState extends StructuralChangeNonAppliedState {
-  public int myId;
+public interface LabelImpl {
+  ByteContent getByteContent(RootEntry root, String path);
 }
diff --git a/platform/lvcs-impl/src/com/intellij/history/core/LinkedRecordsTable.java b/platform/lvcs-impl/src/com/intellij/history/core/LinkedRecordsTable.java
new file mode 100644 (file)
index 0000000..5a40317
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2000-2010 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.history.core;
+
+import com.intellij.openapi.components.impl.stores.StorageUtil;
+import com.intellij.util.io.PagePool;
+import com.intellij.util.io.storage.AbstractRecordsTable;
+
+import java.io.File;
+import java.io.IOException;
+
+public class LinkedRecordsTable extends AbstractRecordsTable {
+  private static final int VERSION = 3;
+
+  private static final int ID_COUNTER_OFFSET = DEFAULT_HEADER_SIZE;
+  private static final int FIRST_RECORD_OFFSET = ID_COUNTER_OFFSET + 8;
+  private static final int LAST_RECORD_OFFSET = FIRST_RECORD_OFFSET + 4;
+  private static final int FS_TIMESTAMP_OFFSET = LAST_RECORD_OFFSET + 4;
+  private static final int HEADER_SIZE = FS_TIMESTAMP_OFFSET + 8;
+
+  private static final int PREV_RECORD_OFFSET = DEFAULT_RECORD_SIZE;
+  private static final int NEXT_RECORD_OFFSET = DEFAULT_RECORD_SIZE + 4;
+  private static final int TIMESTAMP_OFFSET = DEFAULT_RECORD_SIZE + 8;
+
+  private static final int RECORD_SIZE = TIMESTAMP_OFFSET + 8;
+  private static final byte[] ZEROS = new byte[RECORD_SIZE];
+
+  public LinkedRecordsTable(final File storageFilePath, final PagePool pool) throws IOException {
+    super(storageFilePath, pool);
+  }
+
+  @Override
+  protected int getHeaderSize() {
+    return HEADER_SIZE;
+  }
+
+  @Override
+  protected int getRecordSize() {
+    return RECORD_SIZE;
+  }
+
+  @Override
+  protected int getImplVersion() {
+    return VERSION;
+  }
+
+  @Override
+  protected byte[] getZeros() {
+    return ZEROS;
+  }
+
+  public void setFSTimestamp(long timestamp) {
+    markDirty();
+    myStorage.putLong(FS_TIMESTAMP_OFFSET, timestamp);
+  }
+
+  public long getFSTimestamp() {
+    return myStorage.getLong(FS_TIMESTAMP_OFFSET);
+  }
+
+  public void setFirstRecord(int record) {
+    markDirty();
+    myStorage.putInt(FIRST_RECORD_OFFSET, record);
+  }
+
+  public int getFirstRecord() {
+    markDirty();
+    return myStorage.getInt(FIRST_RECORD_OFFSET);
+  }
+
+  public void setLastRecord(int record) {
+    markDirty();
+    myStorage.putInt(LAST_RECORD_OFFSET, record);
+  }
+
+  public int getLastRecord() {
+    markDirty();
+    return myStorage.getInt(LAST_RECORD_OFFSET);
+  }
+
+  public void setPrevRecord(int record, int prevRecord) {
+    markDirty();
+    myStorage.putInt(getOffset(record, PREV_RECORD_OFFSET), prevRecord);
+  }
+
+  public int getPrevRecord(int record) {
+    return myStorage.getInt(getOffset(record, PREV_RECORD_OFFSET));
+  }
+
+  public void setNextRecord(int record, int nextRecord) {
+    markDirty();
+    myStorage.putInt(getOffset(record, NEXT_RECORD_OFFSET), nextRecord);
+  }
+
+  public int getNextRecord(int record) {
+    return myStorage.getInt(getOffset(record, NEXT_RECORD_OFFSET));
+  }
+
+  public void setTimestamp(int record, long timestamp) {
+    markDirty();
+    myStorage.putLong(getOffset(record, TIMESTAMP_OFFSET), timestamp);
+  }
+
+  public long getTimestamp(int record) {
+    return myStorage.getLong(getOffset(record, TIMESTAMP_OFFSET));
+  }
+
+  public long nextId() {
+    markDirty();
+    long result = myStorage.getLong(ID_COUNTER_OFFSET);
+    myStorage.putLong(ID_COUNTER_OFFSET, result + 1);
+    return result;
+  }
+}
+
diff --git a/platform/lvcs-impl/src/com/intellij/history/core/LinkedStorage.java b/platform/lvcs-impl/src/com/intellij/history/core/LinkedStorage.java
new file mode 100644 (file)
index 0000000..cbabb70
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2000-2010 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.history.core;
+
+import com.intellij.history.Clock;
+import com.intellij.util.io.PagePool;
+import com.intellij.util.io.storage.AbstractRecordsTable;
+import com.intellij.util.io.storage.AbstractStorage;
+
+import java.io.File;
+import java.io.IOException;
+
+public class LinkedStorage extends AbstractStorage {
+  public LinkedStorage(String storageFilePath) throws IOException {
+    super(storageFilePath);
+  }
+
+  public LinkedStorage(String storageFilePath, PagePool pool) throws IOException {
+    super(storageFilePath, pool);
+  }
+
+  @Override
+  protected AbstractRecordsTable createRecordsTable(PagePool pool, File recordsFile) throws IOException {
+    return new LinkedRecordsTable(recordsFile, pool);
+  }
+
+  public long getFSTimestamp() {
+    synchronized (myLock) {
+      return ((LinkedRecordsTable)myRecordsTable).getFSTimestamp();
+    }
+  }
+
+  public void setFSTimestamp(long timestamp) {
+    synchronized (myLock) {
+      ((LinkedRecordsTable)myRecordsTable).setFSTimestamp(timestamp);
+    }
+  }
+
+  public long nextId() {
+    synchronized (myLock) {
+      return ((LinkedRecordsTable)myRecordsTable).nextId();
+    }
+  }
+
+  public int getLastRecord() {
+    synchronized (myLock) {
+      return ((LinkedRecordsTable)myRecordsTable).getLastRecord();
+    }
+  }
+
+  public int getPrevRecord(int record) {
+    synchronized (myLock) {
+      return ((LinkedRecordsTable)myRecordsTable).getPrevRecord(record);
+    }
+  }
+
+  public long getTimestamp(int record) {
+    synchronized (myLock) {
+      return ((LinkedRecordsTable)myRecordsTable).getTimestamp(record);
+    }
+  }
+
+  public int createNextRecord() throws IOException {
+    synchronized (myLock) {
+      LinkedRecordsTable table = (LinkedRecordsTable)myRecordsTable;
+      int id = table.createNewRecord();
+      int prev = table.getLastRecord();
+
+      table.setPrevRecord(id, prev);
+      if (prev > 0) {
+        table.setNextRecord(prev, id);
+      }
+      else {
+        table.setFirstRecord(id);
+      }
+      table.setLastRecord(id);
+
+      table.setTimestamp(id, Clock.getCurrentTimestamp());
+
+      return id;
+    }
+  }
+
+  public void deleteRecord(int id) throws IOException {
+    synchronized (myLock) {
+      LinkedRecordsTable table = (LinkedRecordsTable)myRecordsTable;
+
+      int prev = table.getPrevRecord(id);
+      int next = table.getNextRecord(id);
+
+      if (prev == 0) {
+        table.setFirstRecord(next);
+      }
+      else {
+        table.setNextRecord(prev, next);
+      }
+
+      if (next == 0) {
+        table.setLastRecord(prev);
+      }
+      else {
+        table.setPrevRecord(next, prev);
+      }
+
+      table.deleteRecord(id);
+    }
+  }
+}
diff --git a/platform/lvcs-impl/src/com/intellij/history/core/LocalHistoryFacade.java b/platform/lvcs-impl/src/com/intellij/history/core/LocalHistoryFacade.java
new file mode 100644 (file)
index 0000000..e77ba8d
--- /dev/null
@@ -0,0 +1,218 @@
+/*
+ * 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.history.core;
+
+import com.intellij.history.ByteContent;
+import com.intellij.history.core.changes.*;
+import com.intellij.history.core.revisions.RecentChange;
+import com.intellij.history.core.revisions.Revision;
+import com.intellij.history.core.revisions.RevisionAfterChange;
+import com.intellij.history.core.revisions.RevisionBeforeChange;
+import com.intellij.history.core.storage.Content;
+import com.intellij.history.core.tree.Entry;
+import com.intellij.history.core.tree.RootEntry;
+import com.intellij.openapi.Disposable;
+import com.intellij.openapi.util.Disposer;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.TestOnly;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LocalHistoryFacade {
+  private final ChangeList myChangeList;
+  private final List<Listener> myListeners = ContainerUtil.createEmptyCOWList();
+
+  public LocalHistoryFacade(ChangeList changeList) {
+    myChangeList = changeList;
+  }
+
+  public void beginChangeSet() {
+    myChangeList.beginChangeSet();
+  }
+
+  public void endChangeSet(String name) {
+    if (myChangeList.endChangeSet(name)) {
+      fireChangeSetFinished();
+    }
+  }
+
+  public void created(String path, boolean isDirectory) {
+    addChange(isDirectory ? new CreateDirectoryChange(myChangeList.nextId(), path)
+                          : new CreateFileChange(myChangeList.nextId(), path));
+  }
+
+  public void contentChanged(String path, Content oldContent, long oldTimestamp) {
+    addChange(new ContentChange(myChangeList.nextId(), path, oldContent, oldTimestamp));
+  }
+
+  public void renamed(String path, String oldName) {
+    addChange(new RenameChange(myChangeList.nextId(), path, oldName));
+  }
+
+  public void readOnlyStatusChanged(String path, boolean oldStatus) {
+    addChange(new ROStatusChange(myChangeList.nextId(), path, oldStatus));
+  }
+
+  public void moved(String path, String oldParent) {
+    addChange(new MoveChange(myChangeList.nextId(), path, oldParent));
+  }
+
+  public void deleted(String path, Entry deletedEntry) {
+    addChange(new DeleteChange(myChangeList.nextId(), path, deletedEntry));
+  }
+
+  public LabelImpl putSystemLabel(String name, String projectId, int color) {
+    return putLabel(new PutSystemLabelChange(myChangeList.nextId(), name, projectId, color));
+  }
+