From 4d909e595aeaf6ed30c90e802ddcb39612c00149 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 16 Mar 2015 17:04:46 +0300 Subject: [PATCH] moved to the same package --- .../impl/IdeDocumentHistoryImpl.java | 28 +++++++++---------- .../{ => impl}/IdeDocumentHistoryTest.java | 22 +++++++++++++-- 2 files changed, 33 insertions(+), 17 deletions(-) rename platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/{ => impl}/IdeDocumentHistoryTest.java (87%) diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/IdeDocumentHistoryImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/IdeDocumentHistoryImpl.java index 765efe35e7a8..2ec15e544c5b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/IdeDocumentHistoryImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/IdeDocumentHistoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -36,6 +36,7 @@ import com.intellij.openapi.wm.ToolWindowManager; import gnu.trove.THashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.TestOnly; import java.lang.ref.WeakReference; import java.util.*; @@ -143,8 +144,8 @@ public class IdeDocumentHistoryImpl extends IdeDocumentHistory implements Projec myCmdProcessor.addCommandListener(myCommandListener,myProject); } - public static class RecentlyChangedFilesState { - public List CHANGED_PATHS = new ArrayList(); + static class RecentlyChangedFilesState { + private List CHANGED_PATHS = new ArrayList(); public void register(VirtualFile file) { final String path = file.getPath(); @@ -171,7 +172,7 @@ public class IdeDocumentHistoryImpl extends IdeDocumentHistory implements Projec myRecentlyChangedFiles = state; } - public final void onFileDeleted() { + final void onFileDeleted() { removeInvalidFilesFromStacks(); } @@ -197,7 +198,7 @@ public class IdeDocumentHistoryImpl extends IdeDocumentHistory implements Projec } } - public final void onCommandStarted() { + final void onCommandStarted() { myCommandStartPlace = getCurrentPlaceInfo(); myCurrentCommandIsNavigation = false; myCurrentCommandHasChanges = false; @@ -213,7 +214,7 @@ public class IdeDocumentHistoryImpl extends IdeDocumentHistory implements Projec return null; } - public final void onCommandFinished(Object commandGroupId) { + final void onCommandFinished(Object commandGroupId) { if (myCommandStartPlace != null) { if (myCurrentCommandIsNavigation && myCurrentCommandHasMoves) { if (!myBackInProgress) { @@ -304,9 +305,9 @@ public class IdeDocumentHistoryImpl extends IdeDocumentHistory implements Projec @Override public final void clearHistory() { - clearPlaceList(myBackPlaces); - clearPlaceList(myForwardPlaces); - clearPlaceList(myChangePlaces); + myBackPlaces.clear(); + myForwardPlaces.clear(); + myChangePlaces.clear(); myLastGroupId = null; @@ -489,10 +490,6 @@ public class IdeDocumentHistoryImpl extends IdeDocumentHistory implements Projec return new PlaceInfo(file, state, fileProvider.getEditorTypeId(), myEditorManager.getCurrentWindow()); } - private static void clearPlaceList(@NotNull List list) { - list.clear(); - } - @Override @NotNull @@ -540,7 +537,7 @@ public class IdeDocumentHistoryImpl extends IdeDocumentHistory implements Projec } @NotNull - public FileEditorState getNavigationState() { + private FileEditorState getNavigationState() { return myNavigationState; } @@ -562,7 +559,8 @@ public class IdeDocumentHistoryImpl extends IdeDocumentHistory implements Projec } @NotNull - public List getBackPlaces() { + @TestOnly + List getBackPlaces() { return myBackPlaces; } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/IdeDocumentHistoryTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/impl/IdeDocumentHistoryTest.java similarity index 87% rename from platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/IdeDocumentHistoryTest.java rename to platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/impl/IdeDocumentHistoryTest.java index 7025e65600f0..0649c675771d 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/IdeDocumentHistoryTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/impl/IdeDocumentHistoryTest.java @@ -1,9 +1,27 @@ -package com.intellij.openapi.fileEditor; +/* + * Copyright 2000-2015 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.fileEditor.impl; import com.intellij.mock.Mock; import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.editor.EditorFactory; -import com.intellij.openapi.fileEditor.impl.IdeDocumentHistoryImpl; +import com.intellij.openapi.fileEditor.FileEditor; +import com.intellij.openapi.fileEditor.FileEditorProvider; +import com.intellij.openapi.fileEditor.FileEditorState; +import com.intellij.openapi.fileEditor.FileEditorStateLevel; import com.intellij.openapi.util.Pair; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager;