From 0983125356529a7ed85332ff83c1a4d305ef8f4a Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Mon, 16 Apr 2018 12:20:23 +0200 Subject: [PATCH] deprecate FileDocumentManagerAdapter --- .../console/ConsoleHistoryController.java | 4 +- .../GeneratedSourceFileChangeTrackerImpl.java | 6 +-- .../psi/impl/PsiDocumentManagerImpl.java | 20 ++------ .../psi/impl/file/impl/PsiVFSListener.java | 20 ++------ .../util/indexing/FileBasedIndexImpl.java | 20 ++------ .../FileDocumentManagerAdapter.java | 50 ++----------------- .../FileDocumentManagerListener.java | 37 ++++++-------- .../editor/impl/TrailingSpacesStripper.java | 20 ++------ .../openapi/vfs/encoding/EncodingUtil.java | 20 ++------ .../wm/impl/status/LineSeparatorPanel.java | 20 ++------ .../impl/FileDocumentManagerImplTest.java | 23 ++------- .../execution/DelayedDocumentWatcher.java | 20 ++------ .../VetoSavingCommittingDocumentsAdapter.java | 20 ++------ .../xdebugger/impl/XDebuggerManagerImpl.java | 8 ++- .../DocumentSettingsManager.java | 5 +- .../configmanagement/EncodingManager.java | 5 +- .../configmanagement/LineEndingsManager.java | 5 +- 17 files changed, 64 insertions(+), 239 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/execution/console/ConsoleHistoryController.java b/platform/lang-impl/src/com/intellij/execution/console/ConsoleHistoryController.java index 039047909011..a486add133ca 100644 --- a/platform/lang-impl/src/com/intellij/execution/console/ConsoleHistoryController.java +++ b/platform/lang-impl/src/com/intellij/execution/console/ConsoleHistoryController.java @@ -20,7 +20,7 @@ import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.editor.ex.util.EditorUtil; import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; import com.intellij.openapi.fileEditor.FileDocumentManager; -import com.intellij.openapi.fileEditor.FileDocumentManagerAdapter; +import com.intellij.openapi.fileEditor.FileDocumentManagerListener; import com.intellij.openapi.fileTypes.SyntaxHighlighter; import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory; import com.intellij.openapi.project.DumbAwareAction; @@ -136,7 +136,7 @@ public class ConsoleHistoryController { } public void install() { - class Listener extends FileDocumentManagerAdapter implements ProjectEx.ProjectSaved { + class Listener implements ProjectEx.ProjectSaved, FileDocumentManagerListener { @Override public void beforeDocumentSaving(@NotNull Document document) { if (document == myConsole.getEditorDocument()) { diff --git a/platform/lang-impl/src/com/intellij/ide/GeneratedSourceFileChangeTrackerImpl.java b/platform/lang-impl/src/com/intellij/ide/GeneratedSourceFileChangeTrackerImpl.java index 76a8e3b36dbf..99a8dc5ab410 100644 --- a/platform/lang-impl/src/com/intellij/ide/GeneratedSourceFileChangeTrackerImpl.java +++ b/platform/lang-impl/src/com/intellij/ide/GeneratedSourceFileChangeTrackerImpl.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide; import com.intellij.AppTopics; @@ -9,7 +9,7 @@ import com.intellij.openapi.editor.EditorFactory; import com.intellij.openapi.editor.event.DocumentEvent; import com.intellij.openapi.editor.event.DocumentListener; import com.intellij.openapi.fileEditor.FileDocumentManager; -import com.intellij.openapi.fileEditor.FileDocumentManagerAdapter; +import com.intellij.openapi.fileEditor.FileDocumentManagerListener; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.fileEditor.FileEditorManagerListener; import com.intellij.openapi.project.Project; @@ -70,7 +70,7 @@ public class GeneratedSourceFileChangeTrackerImpl extends GeneratedSourceFileCha } }, myProject); MessageBusConnection connection = myProject.getMessageBus().connect(); - connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() { + connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerListener() { @Override public void fileContentReloaded(@NotNull VirtualFile file, @NotNull Document document) { myFilesToCheck.remove(file); diff --git a/platform/lang-impl/src/com/intellij/psi/impl/PsiDocumentManagerImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/PsiDocumentManagerImpl.java index 30b3e030ce90..d4070c3e1af2 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/PsiDocumentManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/PsiDocumentManagerImpl.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl; @@ -29,7 +15,7 @@ import com.intellij.openapi.editor.EditorFactory; import com.intellij.openapi.editor.event.DocumentEvent; import com.intellij.openapi.editor.ex.DocumentBulkUpdateListener; import com.intellij.openapi.fileEditor.FileDocumentManager; -import com.intellij.openapi.fileEditor.FileDocumentManagerAdapter; +import com.intellij.openapi.fileEditor.FileDocumentManagerListener; import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.project.Project; @@ -73,7 +59,7 @@ public class PsiDocumentManagerImpl extends PsiDocumentManagerBase { myDocumentCommitThread = documentCommitThread; editorFactory.getEventMulticaster().addDocumentListener(this, project); MessageBusConnection connection = bus.connect(); - connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() { + connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerListener() { @Override public void fileContentLoaded(@NotNull final VirtualFile virtualFile, @NotNull Document document) { PsiFile psiFile = ReadAction.compute(() -> myProject.isDisposed() || !virtualFile.isValid() ? null : getCachedPsiFile(virtualFile)); diff --git a/platform/lang-impl/src/com/intellij/psi/impl/file/impl/PsiVFSListener.java b/platform/lang-impl/src/com/intellij/psi/impl/file/impl/PsiVFSListener.java index 5666346236ae..1f25cd2e2198 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/file/impl/PsiVFSListener.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/file/impl/PsiVFSListener.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl.file.impl; import com.intellij.AppTopics; @@ -21,7 +7,7 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.fileEditor.FileDocumentManager; -import com.intellij.openapi.fileEditor.FileDocumentManagerAdapter; +import com.intellij.openapi.fileEditor.FileDocumentManagerListener; import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.fileTypes.FileTypeEvent; @@ -614,7 +600,7 @@ public class PsiVFSListener implements VirtualFileListener, BulkFileListener { } } - private class MyFileDocumentManagerAdapter extends FileDocumentManagerAdapter { + private class MyFileDocumentManagerAdapter implements FileDocumentManagerListener { @Override public void fileWithNoDocumentChanged(@NotNull final VirtualFile file) { FileViewProvider viewProvider = myFileManager.findCachedViewProvider(file); diff --git a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java index 0f715fbcedb6..6a4ae6cabb00 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.indexing; @@ -34,7 +20,7 @@ import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.impl.EditorHighlighterCache; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.fileEditor.FileDocumentManager; -import com.intellij.openapi.fileEditor.FileDocumentManagerAdapter; +import com.intellij.openapi.fileEditor.FileDocumentManagerListener; import com.intellij.openapi.fileTypes.*; import com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl; import com.intellij.openapi.progress.ProcessCanceledException; @@ -250,7 +236,7 @@ public class FileBasedIndexImpl extends FileBasedIndex implements BaseComponent, } }); - connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() { + connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerListener() { @Override public void fileContentReloaded(@NotNull VirtualFile file, @NotNull Document document) { cleanupMemoryStorage(); diff --git a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileDocumentManagerAdapter.java b/platform/platform-api/src/com/intellij/openapi/fileEditor/FileDocumentManagerAdapter.java index d56b8906b78e..529ed1ec04af 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileDocumentManagerAdapter.java +++ b/platform/platform-api/src/com/intellij/openapi/fileEditor/FileDocumentManagerAdapter.java @@ -1,50 +1,8 @@ -/* - * 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.fileEditor; -import com.intellij.openapi.editor.Document; -import com.intellij.openapi.vfs.VirtualFile; -import org.jetbrains.annotations.NotNull; - +/** + * @deprecated Use {@link FileDocumentManagerListener} directly. + */ public abstract class FileDocumentManagerAdapter implements FileDocumentManagerListener { - @Override - public void beforeAllDocumentsSaving() { - } - - @Override - public void beforeDocumentSaving(@NotNull Document document) { - } - - @Override - public void fileWithNoDocumentChanged(@NotNull VirtualFile file) { - } - - @Override - public void beforeFileContentReload(VirtualFile file, @NotNull Document document) { - } - - @Override - public void fileContentReloaded(@NotNull VirtualFile file, @NotNull Document document) { - } - - @Override - public void fileContentLoaded(@NotNull VirtualFile file, @NotNull Document document) { - } - - @Override - public void unsavedDocumentsDropped() { - } } diff --git a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileDocumentManagerListener.java b/platform/platform-api/src/com/intellij/openapi/fileEditor/FileDocumentManagerListener.java index c8331bb725d0..f4fa320915e6 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileDocumentManagerListener.java +++ b/platform/platform-api/src/com/intellij/openapi/fileEditor/FileDocumentManagerListener.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.fileEditor; import com.intellij.openapi.editor.Document; @@ -41,23 +27,30 @@ public interface FileDocumentManagerListener extends EventListener { * * @since 8.0 */ - void beforeAllDocumentsSaving(); + default void beforeAllDocumentsSaving() { + } /** * NOTE: Vetoing facility is deprecated in this listener implement {@link FileDocumentSynchronizationVetoer} instead. */ - void beforeDocumentSaving(@NotNull Document document); + default void beforeDocumentSaving(@NotNull Document document) { + } /** * NOTE: Vetoing facility is deprecated in this listener implement {@link FileDocumentSynchronizationVetoer} instead. */ - void beforeFileContentReload(VirtualFile file, @NotNull Document document); + default void beforeFileContentReload(VirtualFile file, @NotNull Document document) { + } - void fileWithNoDocumentChanged(@NotNull VirtualFile file); + default void fileWithNoDocumentChanged(@NotNull VirtualFile file) { + } - void fileContentReloaded(@NotNull VirtualFile file, @NotNull Document document); + default void fileContentReloaded(@NotNull VirtualFile file, @NotNull Document document) { + } - void fileContentLoaded(@NotNull VirtualFile file, @NotNull Document document); + default void fileContentLoaded(@NotNull VirtualFile file, @NotNull Document document) { + } - void unsavedDocumentsDropped(); + default void unsavedDocumentsDropped() { + } } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/TrailingSpacesStripper.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/TrailingSpacesStripper.java index ba46acd2c419..911b7ab59d05 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/TrailingSpacesStripper.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/TrailingSpacesStripper.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.editor.impl; import com.intellij.ide.DataManager; @@ -24,7 +10,7 @@ import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.editor.*; import com.intellij.openapi.editor.ex.EditorSettingsExternalizable; import com.intellij.openapi.fileEditor.FileDocumentManager; -import com.intellij.openapi.fileEditor.FileDocumentManagerAdapter; +import com.intellij.openapi.fileEditor.FileDocumentManagerListener; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectUtil; import com.intellij.openapi.util.Key; @@ -43,7 +29,7 @@ import java.util.Collections; import java.util.List; import java.util.Set; -public final class TrailingSpacesStripper extends FileDocumentManagerAdapter { +public final class TrailingSpacesStripper implements FileDocumentManagerListener { public static final Key OVERRIDE_STRIP_TRAILING_SPACES_KEY = Key.create("OVERRIDE_TRIM_TRAILING_SPACES_KEY"); public static final Key OVERRIDE_ENSURE_NEWLINE_KEY = Key.create("OVERRIDE_ENSURE_NEWLINE_KEY"); diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/encoding/EncodingUtil.java b/platform/platform-impl/src/com/intellij/openapi/vfs/encoding/EncodingUtil.java index 50efee37b07e..f6f1b6855e43 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/encoding/EncodingUtil.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/encoding/EncodingUtil.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vfs.encoding; import com.intellij.AppTopics; @@ -21,7 +7,7 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.fileEditor.FileDocumentManager; -import com.intellij.openapi.fileEditor.FileDocumentManagerAdapter; +import com.intellij.openapi.fileEditor.FileDocumentManagerListener; import com.intellij.openapi.fileEditor.impl.LoadTextUtil; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.fileTypes.FileTypes; @@ -161,7 +147,7 @@ public class EncodingUtil { final Disposable disposable = Disposer.newDisposable(); MessageBusConnection connection = ApplicationManager.getApplication().getMessageBus().connect(disposable); - connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() { + connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerListener() { @Override public void beforeFileContentReload(VirtualFile file, @NotNull Document document) { if (!file.equals(virtualFile)) return; diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/LineSeparatorPanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/LineSeparatorPanel.java index 71d067958a14..07c5a5666a73 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/LineSeparatorPanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/LineSeparatorPanel.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.wm.impl.status; import com.intellij.AppTopics; @@ -23,7 +9,7 @@ import com.intellij.openapi.actionSystem.impl.SimpleDataContext; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.fileEditor.FileDocumentManagerAdapter; +import com.intellij.openapi.fileEditor.FileDocumentManagerListener; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.fileEditor.FileEditorManagerEvent; import com.intellij.openapi.fileEditor.impl.LoadTextUtil; @@ -167,7 +153,7 @@ public class LineSeparatorPanel extends EditorBasedWidget implements StatusBarWi public void install(@NotNull StatusBar statusBar) { super.install(statusBar); MessageBusConnection connection = ApplicationManager.getApplication().getMessageBus().connect(this); - connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() { + connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerListener() { @Override public void fileContentReloaded(@NotNull VirtualFile file, @NotNull Document document) { update(); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImplTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImplTest.java index 00a5433a9ad0..0c2ae39c2164 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImplTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImplTest.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.fileEditor.impl; import com.intellij.AppTopics; @@ -26,7 +12,6 @@ import com.intellij.openapi.editor.event.DocumentEvent; import com.intellij.openapi.editor.event.DocumentListener; import com.intellij.openapi.editor.ex.DocumentEx; import com.intellij.openapi.fileEditor.FileDocumentManager; -import com.intellij.openapi.fileEditor.FileDocumentManagerAdapter; import com.intellij.openapi.fileEditor.FileDocumentManagerListener; import com.intellij.openapi.util.ThrowableComputable; import com.intellij.openapi.util.io.FileUtil; @@ -428,7 +413,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase { document.setModificationStamp(file.getModificationStamp()); }); - getProject().getMessageBus().connect(getTestRootDisposable()).subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() { + getProject().getMessageBus().connect(getTestRootDisposable()).subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerListener() { @Override public void beforeDocumentSaving(@NotNull Document documentToSave) { assertNotSame(document, documentToSave); @@ -505,7 +490,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase { myDocumentManager.saveDocument(document); getProject().getMessageBus().connect(getTestRootDisposable()) - .subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() { + .subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerListener() { @Override public void beforeDocumentSaving(@NotNull Document documentToSave) { assertNotSame(document, documentToSave); @@ -584,7 +569,7 @@ public class FileDocumentManagerImplTest extends PlatformTestCase { final PsiFile file = getPsiFile(original); assertNotNull(file); - FileDocumentManagerListener saveListener = new FileDocumentManagerAdapter() { + FileDocumentManagerListener saveListener = new FileDocumentManagerListener() { @Override public void beforeDocumentSaving(@NotNull Document document) { WriteCommandAction.runWriteCommandAction(getProject(), () -> { diff --git a/platform/testRunner/src/com/intellij/execution/DelayedDocumentWatcher.java b/platform/testRunner/src/com/intellij/execution/DelayedDocumentWatcher.java index 3287afff5bb7..37bdd9f381e9 100644 --- a/platform/testRunner/src/com/intellij/execution/DelayedDocumentWatcher.java +++ b/platform/testRunner/src/com/intellij/execution/DelayedDocumentWatcher.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.execution; import com.intellij.AppTopics; @@ -26,7 +12,7 @@ import com.intellij.openapi.editor.EditorFactory; import com.intellij.openapi.editor.event.DocumentEvent; import com.intellij.openapi.editor.event.DocumentListener; import com.intellij.openapi.fileEditor.FileDocumentManager; -import com.intellij.openapi.fileEditor.FileDocumentManagerAdapter; +import com.intellij.openapi.fileEditor.FileDocumentManagerListener; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectUtil; import com.intellij.openapi.util.Condition; @@ -84,7 +70,7 @@ public class DelayedDocumentWatcher implements AutoTestWatcher { Disposer.register(myProject, myListenerDisposable); EditorFactory.getInstance().getEventMulticaster().addDocumentListener(myListener, myListenerDisposable); myConnection = ApplicationManager.getApplication().getMessageBus().connect(myProject); - myConnection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() { + myConnection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerListener() { @Override public void beforeAllDocumentsSaving() { myDocumentSavingInProgress = true; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VetoSavingCommittingDocumentsAdapter.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VetoSavingCommittingDocumentsAdapter.java index 8892ebc88b4d..525ce19e666f 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VetoSavingCommittingDocumentsAdapter.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VetoSavingCommittingDocumentsAdapter.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs.changes; @@ -21,7 +7,7 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.ApplicationComponent; import com.intellij.openapi.editor.Document; import com.intellij.openapi.fileEditor.FileDocumentManager; -import com.intellij.openapi.fileEditor.FileDocumentManagerAdapter; +import com.intellij.openapi.fileEditor.FileDocumentManagerListener; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.UserDataHolderEx; @@ -43,7 +29,7 @@ public class VetoSavingCommittingDocumentsAdapter implements ApplicationComponen @Override public void initComponent() { - ApplicationManager.getApplication().getMessageBus().connect().subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() { + ApplicationManager.getApplication().getMessageBus().connect().subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerListener() { @Override public void beforeAllDocumentsSaving() { Map documentsToWarn = getDocumentsBeingCommitted(); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java index fff0bfc0de61..3ed3c02e2f94 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java @@ -1,6 +1,4 @@ -/* - * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.xdebugger.impl; import com.intellij.AppTopics; @@ -22,7 +20,7 @@ import com.intellij.openapi.components.Storage; import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.markup.GutterIconRenderer; -import com.intellij.openapi.fileEditor.FileDocumentManagerAdapter; +import com.intellij.openapi.fileEditor.FileDocumentManagerListener; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.fileEditor.FileEditorManagerListener; import com.intellij.openapi.project.Project; @@ -76,7 +74,7 @@ public class XDebuggerManagerImpl extends XDebuggerManager implements Persistent myExecutionPointHighlighter = new ExecutionPointHighlighter(project); MessageBusConnection messageBusConnection = messageBus.connect(); - messageBusConnection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() { + messageBusConnection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerListener() { @Override public void fileContentLoaded(@NotNull VirtualFile file, @NotNull Document document) { updateExecutionPoint(file, true); diff --git a/plugins/editorconfig/src/org/editorconfig/configmanagement/DocumentSettingsManager.java b/plugins/editorconfig/src/org/editorconfig/configmanagement/DocumentSettingsManager.java index 31a622186158..e42979c25b94 100644 --- a/plugins/editorconfig/src/org/editorconfig/configmanagement/DocumentSettingsManager.java +++ b/plugins/editorconfig/src/org/editorconfig/configmanagement/DocumentSettingsManager.java @@ -1,10 +1,11 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.editorconfig.configmanagement; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.ex.EditorSettingsExternalizable; import com.intellij.openapi.editor.impl.TrailingSpacesStripper; import com.intellij.openapi.fileEditor.FileDocumentManager; -import com.intellij.openapi.fileEditor.FileDocumentManagerAdapter; +import com.intellij.openapi.fileEditor.FileDocumentManagerListener; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; import com.intellij.openapi.vfs.VirtualFile; @@ -19,7 +20,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -public class DocumentSettingsManager extends FileDocumentManagerAdapter { +public class DocumentSettingsManager implements FileDocumentManagerListener { // Handles the following EditorConfig settings: public static final String trimTrailingWhitespaceKey = "trim_trailing_whitespace"; public static final String insertFinalNewlineKey = "insert_final_newline"; diff --git a/plugins/editorconfig/src/org/editorconfig/configmanagement/EncodingManager.java b/plugins/editorconfig/src/org/editorconfig/configmanagement/EncodingManager.java index 0a1b99b51d08..83943e07f71e 100644 --- a/plugins/editorconfig/src/org/editorconfig/configmanagement/EncodingManager.java +++ b/plugins/editorconfig/src/org/editorconfig/configmanagement/EncodingManager.java @@ -1,8 +1,9 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.editorconfig.configmanagement; import com.intellij.openapi.editor.Document; import com.intellij.openapi.fileEditor.FileDocumentManager; -import com.intellij.openapi.fileEditor.FileDocumentManagerAdapter; +import com.intellij.openapi.fileEditor.FileDocumentManagerListener; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.vfs.CharsetToolkit; @@ -20,7 +21,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -public class EncodingManager extends FileDocumentManagerAdapter { +public class EncodingManager implements FileDocumentManagerListener { // Handles the following EditorConfig settings: public static final String charsetKey = "charset"; diff --git a/plugins/editorconfig/src/org/editorconfig/configmanagement/LineEndingsManager.java b/plugins/editorconfig/src/org/editorconfig/configmanagement/LineEndingsManager.java index 3de66072bc01..41ee62ec53ba 100644 --- a/plugins/editorconfig/src/org/editorconfig/configmanagement/LineEndingsManager.java +++ b/plugins/editorconfig/src/org/editorconfig/configmanagement/LineEndingsManager.java @@ -1,9 +1,10 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.editorconfig.configmanagement; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Document; import com.intellij.openapi.fileEditor.FileDocumentManager; -import com.intellij.openapi.fileEditor.FileDocumentManagerAdapter; +import com.intellij.openapi.fileEditor.FileDocumentManagerListener; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.fileEditor.FileEditorManagerEvent; import com.intellij.openapi.project.Project; @@ -27,7 +28,7 @@ import java.util.Locale; /** * @author Dennis.Ushakov */ -public class LineEndingsManager extends FileDocumentManagerAdapter { +public class LineEndingsManager implements FileDocumentManagerListener { // Handles the following EditorConfig settings: public static final String lineEndingsKey = "end_of_line";