From f0098d0ddb2a254a8b4fde09a7fe63c835c81fac Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Mon, 13 Aug 2018 16:27:27 +0200 Subject: [PATCH] override, notnull --- .../regexp/intention/CheckRegExpForm.java | 2 +- .../editor/impl/ImageFileEditorProvider.java | 2 +- .../compiler/server/BuildManager.java | 2 +- .../debugger/actions/ViewTextAction.java | 2 +- .../completion/JavaMethodCallElement.java | 2 +- .../java18StreamApi/AddMethodsDialog.java | 20 ++------- .../ide/util/PackageChooserDialog.java | 20 ++------- .../GenerateVisitorByHierarchyAction.java | 20 ++------- .../JavaChangeSignatureDialog.java | 30 ++++--------- .../ExtractMethodObjectDialog.java | 18 +------- .../extractclass/ExtractClassDialog.java | 20 ++------- .../IntroduceConstantDialog.java | 4 +- .../IntroduceParameterObjectDialog.java | 20 ++------- .../migration/EditMigrationEntryDialog.java | 19 ++------- .../DestinationFolderComboBox.java | 21 ++-------- .../MoveClassesOrPackagesDialog.java | 24 +++-------- .../move/moveMembers/MoveMembersDialog.java | 19 ++------- .../ReplaceConstructorWithBuilderDialog.java | 19 +-------- .../typeMigration/ui/TypeMigrationDialog.java | 6 +-- .../WrapReturnValueDialog.java | 22 ++-------- .../createTest/CreateTestDialog.java | 8 ++-- .../intellij/unscramble/ThreadDumpPanel.java | 2 +- .../completion/JavaAutoPopupTest.groovy | 33 +++++---------- .../SmartPsiElementPointersTest.java | 18 ++++---- .../editor/event/DocumentListener.java | 21 ++-------- .../completion/OffsetTranslator.java | 21 ++-------- .../openapi/editor/impl/RangeMarkerTree.java | 10 ++--- .../psi/impl/PsiDocumentManagerBase.java | 2 +- .../diff/actions/DocumentsSynchronizer.java | 20 ++------- .../intellij/diff/merge/MergeModelBase.java | 20 ++------- .../tools/fragmented/UnifiedDiffViewer.java | 18 +------- .../diff/tools/util/FoldingModelSupport.java | 4 +- .../util/base/ListenerDiffViewerBase.java | 20 ++------- .../com/intellij/dvcs/ui/CloneDvcsDialog.java | 20 ++------- .../util/LayeredLexerEditorHighlighter.java | 20 ++------- .../ex/util/LexerEditorHighlighter.java | 22 ++-------- .../ExternalSystemProjectsWatcherImpl.java | 10 ++--- .../match/ArrangementSectionRulesControl.java | 20 ++------- .../ArrangementSectionRulesValidator.java | 17 +------- .../colors/ColorAndFontDescriptionPanel.java | 19 ++------- .../options/colors/FontOptions.java | 17 +------- .../options/colors/OptionsPanelImpl.java | 19 ++------- .../build/ExecutionNodeProgressAnimator.java | 18 ++------ .../build/events/impl/AbstractBuildEvent.java | 17 +------- .../TargetElementEvaluatorEx2.java | 31 ++++---------- .../codeInsight/actions/LayoutCodeDialog.java | 17 +------- .../actions/LayoutProjectCodeDialog.java | 18 ++------ .../codeInsight/completion/ActionTracker.java | 2 +- .../completion/AddSpaceInsertHandler.java | 1 + .../completion/CompletionPhase.java | 2 +- .../completion/CompletionThreading.java | 18 ++------ .../completion/RangeMarkerSpy.java | 19 ++------- .../daemon/impl/DaemonListeners.java | 2 +- .../daemon/impl/PsiChangeHandler.java | 18 +------- .../QuickDocOnMouseOverManager.java | 2 +- .../editorActions/AutoHardWrapHandler.java | 6 +-- .../editorActions/MatchBraceAction.java | 17 +------- .../TabOutScopesTrackerImpl.java | 2 +- ...EnterBetweenBracesAndBracketsDelegate.java | 1 + .../enter/EnterBetweenBracesHandler.java | 17 +------- .../EnterBetweenBracesNoCommitDelegate.java | 3 ++ .../impl/CollapseBlockHandlerImpl.java | 6 +-- .../impl/actions/CollapseBlockAction.java | 6 +-- .../highlighting/BraceHighlighter.java | 2 +- .../highlighting/HighlightManagerImpl.java | 2 +- .../NextParameterAfterCompletionHandler.java | 4 +- .../hint/ParameterInfoController.java | 10 ++--- .../hint/ShowExpressionTypeHandler.java | 17 +------- .../ParameterNameHintsConfigurable.java | 42 +++++++------------ .../intention/impl/QuickEditHandler.java | 18 +------- .../config/IntentionDescriptionPanel.java | 5 ++- .../codeInsight/lookup/LookupArranger.java | 2 + .../codeInsight/lookup/impl/LookupImpl.java | 2 +- .../lookup/impl/LookupOffsets.java | 4 +- .../navigation/IncrementalSearchHandler.java | 18 +------- .../template/impl/InvokeTemplateAction.java | 17 +------- .../impl/LiveTemplateSettingsEditor.java | 2 +- .../impl/TemplateExpandShortcutPanel.java | 17 +------- .../template/impl/TemplateState.java | 2 +- ...PostfixTemplateExpressionSelectorBase.java | 17 +------- ...PostfixTemplateWithExpressionSelector.java | 1 + .../editable/EditablePostfixTemplate.java | 1 + .../actions/SilentCodeCleanupAction.java | 18 ++------ .../ex/PerformFixesModalTask.java | 3 +- .../ui/DefaultInspectionToolPresentation.java | 4 ++ .../codeInspection/ui/RefElementNode.java | 5 +-- .../execution/ExecutionTargetManagerImpl.java | 5 ++- .../console/DefaultConsoleHistoryModel.java | 17 +------- .../console/LanguageConsoleBuilder.java | 2 +- .../console/LanguageConsoleImpl.java | 18 +------- .../tree/RunDashboardTreeMouseListener.java | 17 +------- .../com/intellij/find/impl/FindDialog.java | 26 +++--------- .../intellij/find/impl/FindPopupPanel.java | 6 +-- .../livePreview/LivePreviewController.java | 2 +- .../find/impl/livePreview/SearchResults.java | 8 ++-- .../intellij/formatting/FormatterImpl.java | 21 ++-------- .../GeneratedSourceFileChangeTrackerImpl.java | 2 +- .../activity/RunAnythingCommandProvider.java | 1 + .../activity/RunAnythingProviderBase.java | 4 ++ .../RunAnythingRecentProjectProvider.java | 1 + .../RunAnythingRunConfigurationProvider.java | 1 + .../AbstractGotoSEContributor.java | 1 + .../ide/bookmarks/BookmarkManager.java | 4 +- .../fileTemplates/FileTemplatesScheme.java | 17 +------- .../impl/FileTemplateConfigurable.java | 24 +++-------- .../NotImplementedHierarchyBrowser.java | 6 +-- .../impl/CustomFileTypeBraceMatcher.java | 17 +------- .../actions/MarkExcludeRootAction.java | 17 +------- .../actions/MarkSourceRootAction.java | 19 ++------- .../projectView/actions/UnmarkRootAction.java | 19 ++------- .../TemplateLanguageStructureViewBuilder.java | 21 ++-------- .../AbstractNewProjectDialog.java | 17 +------- .../projectWizard/WebProjectTemplate.java | 2 + .../internal/psiView/PsiViewerDialog.java | 2 +- .../stubtree/StubViewerPsiBasedTree.java | 17 +------- .../actions/CollectFUStatisticsAction.java | 1 + .../settings/DiffColorDescriptionPanel.java | 21 ++-------- .../openapi/module/WebModuleTypeBase.java | 17 +------- .../projectRoots/impl/DependentSdkType.java | 19 ++------- .../openapi/wm/impl/NextProjectWindow.java | 17 +------- .../wm/impl/PreviousProjectWindow.java | 17 +------- .../ui/GeneralGroupNode.java | 19 ++------- .../platform/PlatformProjectViewOpener.java | 1 + .../templates/ArchivedProjectTemplate.java | 5 +-- .../InspectionsConfigTreeTable.java | 3 +- .../extractor/ui/ExtractedSettingsDialog.java | 17 +------- .../psi/impl/PsiDocumentManagerImpl.java | 4 +- .../search/NonPhysicalReferenceSearcher.java | 1 + .../psi/impl/source/LightPsiFileImpl.java | 17 +------- .../codeStyle/CodeStyleManagerImpl.java | 30 ++++++------- .../FormatterBasedIndentAdjuster.java | 25 +++-------- .../IntroduceParameterObjectAction.java | 19 ++------- .../actions/InvertBooleanAction.java | 22 +++------- .../refactoring/actions/RenameFileAction.java | 18 ++------ .../ChangeSignatureDialogBase.java | 20 ++------- .../inplace/InplaceChangeSignature.java | 18 +------- .../copy/CopyFilesOrDirectoriesDialog.java | 18 +------- .../extractMethod/ExtractMethodHelper.java | 25 +++-------- .../inplace/AbstractInplaceIntroducer.java | 21 ++-------- .../IntroduceParameterObjectProcessor.java | 17 +------- ...uceParameterObjectUsageViewDescriptor.java | 19 ++------- .../invertBoolean/InvertBooleanDialog.java | 22 +++------- .../invertBoolean/InvertBooleanHandler.java | 20 ++------- .../InvertBooleanUsageViewDescriptor.java | 21 +++------- .../memberPullUp/PullUpDialogBase.java | 19 ++------- .../AbstractPushDownDialog.java | 20 +++------ .../PushDownUsageViewDescriptor.java | 22 +++------- .../ui/MemberSelectionPanelBase.java | 17 +------- .../refactoring/ui/NameSuggestionsField.java | 19 ++------- .../util/AbstractParameterTablePanel.java | 19 ++------- .../FixableUsagesRefactoringProcessor.java | 18 ++------ .../slicer/SliceLeafValueRootNode.java | 17 +------- ...xtFieldWithAutoCompletionListProvider.java | 17 +------- .../ui/tabs/FileColorManagerImpl.java | 3 +- .../util/indexing/VfsAwareMapReduceIndex.java | 25 +++-------- .../textCompletion/TextCompletionUtil.java | 18 +------- .../util/ui/tree/PerFileConfigurableBase.java | 20 ++------- .../packaging/ManagePackagesDialog.java | 22 +++------- .../com/intellij/ui/UserActivityWatcher.java | 19 ++------- .../codeInsight/hint/HintManagerImpl.java | 2 +- .../command/impl/DocumentUndoProvider.java | 27 ++++-------- .../intellij/openapi/diff/impl/Rediffers.java | 20 ++------- .../incrementalMerge/DiffRangeMarker.java | 18 +------- .../ex/util/EmptyEditorHighlighter.java | 18 +------- .../openapi/editor/impl/CaretModelImpl.java | 28 ++++--------- .../editor/impl/EditorComponentImpl.java | 8 ++-- .../openapi/editor/impl/FoldingModelImpl.java | 18 ++++---- .../openapi/editor/impl/InlayModelImpl.java | 10 ++--- .../editor/impl/ScrollingModelImpl.java | 4 +- .../editor/impl/SoftWrapModelImpl.java | 30 +++++++------ .../editor/impl/view/EditorSizeManager.java | 42 +++++++++---------- .../impl/view/LogicalPositionCache.java | 10 ++--- .../editor/impl/view/TextLayoutCache.java | 34 +++++---------- .../impl/FileDocumentManagerImpl.java | 2 +- .../impl/IdeDocumentHistoryImpl.java | 2 +- .../impl/text/TextEditorComponent.java | 4 +- .../vcs/impl/FileStatusManagerImpl.java | 6 +-- .../vfs/encoding/EncodingManagerImpl.java | 2 +- .../status/EditorBasedStatusBarPopup.java | 2 +- .../openapi/wm/impl/status/PositionPanel.java | 2 +- .../src/com/intellij/ui/EditorComboBox.java | 20 ++------- .../src/com/intellij/ui/EditorTextField.java | 8 ++-- .../util/ui/table/JBTableRowEditor.java | 19 ++------- .../intellij/openapi/editor/DocumentTest.java | 31 ++++---------- .../openapi/editor/impl/RangeMarkerTest.java | 18 +------- .../impl/FileDocumentManagerImplTest.java | 6 +-- .../vfs/encoding/FileEncodingTest.java | 2 +- .../plugin/ui/EditVarConstraintsDialog.java | 6 +-- .../plugin/ui/SearchDialog.java | 6 ++- .../plugin/ui/StructuralSearchDialog.java | 2 +- .../propertyBased/MadTestingUtil.java | 4 +- .../autotest/DelayedDocumentWatcher.java | 2 +- .../conflicts/ChangelistConflictTracker.java | 18 +------- .../changes/ui/ChangeListChooserPanel.java | 18 +------- .../changes/ui/NewEditChangelistPanel.java | 18 +------- .../breakpoints/XLineBreakpointManager.java | 2 +- .../config/ui/MethodParameterPanel.java | 4 +- .../intellij/coverage/SrcFileAnnotator.java | 28 ++++--------- .../src/git4idea/push/GitPushTargetPanel.java | 18 +------- .../intentions/GroovyCreateClassDialog.java | 18 +------- .../GroovyMapParameterDialog.java | 19 ++------- .../groovy/mvc/MvcRunTargetDialog.java | 18 +------- .../GrChangeSignatureDialog.java | 18 +------- .../method/GroovyExtractMethodDialog.java | 18 +------- .../constant/GrIntroduceConstantDialog.java | 20 ++------- .../zmlx/hg4idea/push/HgPushTargetPanel.java | 18 +------- .../src/org/zmlx/hg4idea/ui/HgPullDialog.java | 2 +- .../i18n/JavaI18nizeQuickFixDialog.java | 18 +------- .../sceneBuilder/SceneBuilderEditor.java | 2 +- .../project/MavenProjectsManagerWatcher.java | 2 +- .../maven/utils/MavenMergingUpdateQueue.java | 18 +------- .../tasks/config/BaseRepositoryEditor.java | 19 ++------- .../intellij/tasks/actions/SearchSupport.java | 25 +++-------- .../tasks/generic/RegExResponseHandler.java | 18 +------- .../uiDesigner/designSurface/GuiEditor.java | 18 +------- .../palette/ComponentItemDialog.java | 20 ++------- .../xpathView/ui/InputExpressionDialog.java | 4 +- .../ipnb/editor/panels/IpnbFilePanel.java | 3 +- .../rest/editor/RestPreviewFileEditor.java | 4 +- .../python/console/PyConsoleStartFolding.java | 18 +------- .../python/lexer/PythonEditorHighlighter.java | 18 +------- .../PyChangeSignatureDialog.java | 20 ++------- .../introduce/PyIntroduceDialog.java | 20 ++------- .../util/xml/ui/DomUIFactoryImpl.java | 20 ++------- .../util/xml/ui/EditorTextFieldControl.java | 18 +------- .../com/intellij/util/xml/ui/UndoHelper.java | 2 +- .../editorActions/XmlTagNameSynchronizer.java | 2 +- .../template/emmet/EmmetPreviewHint.java | 18 +------- .../completion/XmlSyncTagCommunityTest.java | 5 ++- 229 files changed, 692 insertions(+), 2402 deletions(-) diff --git a/RegExpSupport/src/org/intellij/lang/regexp/intention/CheckRegExpForm.java b/RegExpSupport/src/org/intellij/lang/regexp/intention/CheckRegExpForm.java index 5785b2ee0e06..934230f47daa 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/intention/CheckRegExpForm.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/intention/CheckRegExpForm.java @@ -144,7 +144,7 @@ public class CheckRegExpForm { updater = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, disposable); DocumentListener documentListener = new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { update(); } }; diff --git a/images/src/org/intellij/images/editor/impl/ImageFileEditorProvider.java b/images/src/org/intellij/images/editor/impl/ImageFileEditorProvider.java index 80be68cc74ce..f4b2f9278fa0 100644 --- a/images/src/org/intellij/images/editor/impl/ImageFileEditorProvider.java +++ b/images/src/org/intellij/images/editor/impl/ImageFileEditorProvider.java @@ -57,7 +57,7 @@ final class ImageFileEditorProvider implements FileEditorProvider, DumbAware { editor.getEditor().getDocument().addDocumentListener(new DocumentListener() { Alarm myAlarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, editor); @Override - public void documentChanged(DocumentEvent event) { + public void documentChanged(@NotNull DocumentEvent event) { myAlarm.cancelAllRequests(); myAlarm.addRequest(() -> ((ImageEditorImpl)viewer.getImageEditor()).setValue(new LightVirtualFile("preview.svg", file.getFileType(), event.getDocument().getText())), 500); diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java index 53a2ca4b80cb..23de789a6af2 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java @@ -320,7 +320,7 @@ public class BuildManager implements Disposable { EditorFactory.getInstance().getEventMulticaster().addDocumentListener(new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { if (Registry.is("compiler.document.save.enabled", true)) { final Document document = e.getDocument(); if (FileDocumentManager.getInstance().isDocumentUnsaved(document)) { diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/ViewTextAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/ViewTextAction.java index 0d85f5cf0560..a31d6caa306a 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/ViewTextAction.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/ViewTextAction.java @@ -101,7 +101,7 @@ public class ViewTextAction extends XFetchValueActionBase { myTextViewer = new TextViewer(initialValue, project, myStringNode == null); myTextViewer.addDocumentListener(new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { if (e.getNewLength() + e.getOldLength() > 0) { getOKAction().setEnabled(true); } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java index 4b0509f9a62d..5345995476c3 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java @@ -370,7 +370,7 @@ public class JavaMethodCallElement extends LookupItem implements Type AtomicInteger maxEditedVariable = new AtomicInteger(-1); editor.getDocument().addDocumentListener(new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { maxEditedVariable.set(Math.max(maxEditedVariable.get(), templateState.getCurrentVariableNumber())); } }, templateState); diff --git a/java/java-impl/src/com/intellij/codeInspection/java18StreamApi/AddMethodsDialog.java b/java/java-impl/src/com/intellij/codeInspection/java18StreamApi/AddMethodsDialog.java index b7f1670ea95d..a0494eec8e88 100644 --- a/java/java-impl/src/com/intellij/codeInspection/java18StreamApi/AddMethodsDialog.java +++ b/java/java-impl/src/com/intellij/codeInspection/java18StreamApi/AddMethodsDialog.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.codeInspection.java18StreamApi; @@ -42,8 +28,8 @@ import javax.swing.*; import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.util.*; import java.util.List; +import java.util.*; /** * @author Dmitry Batkovich @@ -143,7 +129,7 @@ public class AddMethodsDialog extends DialogWrapper { }); myClassNameEditor.addDocumentListener(new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { final String classFqn = e.getDocument().getText(); final PsiClass aClass = JavaPsiFacade.getInstance(project).findClass(classFqn, GlobalSearchScope.allScope(project)); final DefaultComboBoxModel comboBoxModel = (DefaultComboBoxModel)myMethodNameCombo.getModel(); diff --git a/java/java-impl/src/com/intellij/ide/util/PackageChooserDialog.java b/java/java-impl/src/com/intellij/ide/util/PackageChooserDialog.java index b7dd2ca93c60..eb8aff716045 100644 --- a/java/java-impl/src/com/intellij/ide/util/PackageChooserDialog.java +++ b/java/java-impl/src/com/intellij/ide/util/PackageChooserDialog.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.ide.util; import com.intellij.CommonBundle; @@ -180,7 +166,7 @@ public class PackageChooserDialog extends PackageChooser { myPathEditor = new EditorTextField(JavaReferenceEditorUtil.createDocument("", myProject, false), myProject, StdFileTypes.JAVA); myPathEditor.addDocumentListener(new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { myAlarm.cancelAllRequests(); myAlarm.addRequest(() -> updateTreeFromPath(), 300); } @@ -212,7 +198,7 @@ public class PackageChooserDialog extends PackageChooser { private void updateTreeFromPath() { selectPackage(myPathEditor.getText().trim()); } - + private DefaultActionGroup createActionGroup(JComponent component) { final DefaultActionGroup group = new DefaultActionGroup(); final DefaultActionGroup temp = new DefaultActionGroup(); diff --git a/java/java-impl/src/com/intellij/internal/GenerateVisitorByHierarchyAction.java b/java/java-impl/src/com/intellij/internal/GenerateVisitorByHierarchyAction.java index 7301c7ccb90c..374ea4404756 100644 --- a/java/java-impl/src/com/intellij/internal/GenerateVisitorByHierarchyAction.java +++ b/java/java-impl/src/com/intellij/internal/GenerateVisitorByHierarchyAction.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.internal; import com.intellij.codeInsight.editorActions.SelectWordUtil; @@ -54,8 +40,8 @@ import org.jetbrains.annotations.NotNull; import javax.swing.*; import javax.swing.event.DocumentEvent; import java.awt.*; -import java.util.*; import java.util.List; +import java.util.*; public class GenerateVisitorByHierarchyAction extends AnAction { @@ -117,7 +103,7 @@ public class GenerateVisitorByHierarchyAction extends AnAction { labeledComponent.setComponent(editorTextField); editorTextField.addDocumentListener(new DocumentListener() { @Override - public void documentChanged(final com.intellij.openapi.editor.event.DocumentEvent e) { + public void documentChanged(@NotNull final com.intellij.openapi.editor.event.DocumentEvent e) { parentClassRef.set(null); try { final PsiType psiType = codeFragment.getType(); diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureDialog.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureDialog.java index 84df4e58c4ea..20d444e8120a 100644 --- a/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureDialog.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.refactoring.changeSignature; import com.intellij.codeInsight.completion.CompletionResultSet; @@ -215,7 +201,7 @@ public class JavaChangeSignatureDialog extends ChangeSignatureDialogBase item : myParametersTableModel.getItems()) { @@ -456,8 +442,8 @@ public class JavaChangeSignatureDialog extends ChangeSignatureDialogBase> table) { diff --git a/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectDialog.java b/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectDialog.java index 39b2892fae3c..4b92eb61bfb3 100644 --- a/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectDialog.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.refactoring.extractMethodObject; import com.intellij.ide.highlighter.JavaFileType; @@ -285,7 +271,7 @@ public class ExtractMethodObjectDialog extends DialogWrapper implements Abstract final DocumentListener nameListener = new DocumentListener() { @Override - public void documentChanged(final DocumentEvent e) { + public void documentChanged(@NotNull final DocumentEvent e) { update(); } }; diff --git a/java/java-impl/src/com/intellij/refactoring/extractclass/ExtractClassDialog.java b/java/java-impl/src/com/intellij/refactoring/extractclass/ExtractClassDialog.java index 52f93f0f37ee..18bbc98e2d1f 100644 --- a/java/java-impl/src/com/intellij/refactoring/extractclass/ExtractClassDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/extractclass/ExtractClassDialog.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.refactoring.extractclass; import com.intellij.openapi.help.HelpManager; @@ -48,8 +34,8 @@ import javax.swing.event.DocumentListener; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.*; import java.util.List; +import java.util.*; @SuppressWarnings({"OverridableMethodCallInConstructor"}) class ExtractClassDialog extends RefactoringDialog implements MemberInfoChangeListener { @@ -85,7 +71,7 @@ class ExtractClassDialog extends RefactoringDialog implements MemberInfoChangeLi RefactorJBundle.message("choose.destination.package.label")); packageTextField.getChildComponent().getDocument().addDocumentListener(new com.intellij.openapi.editor.event.DocumentListener() { @Override - public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) { + public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent e) { validateButtons(); } }); diff --git a/java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceConstantDialog.java b/java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceConstantDialog.java index 030750dfbf35..347a8edea749 100644 --- a/java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceConstantDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceConstantDialog.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.refactoring.introduceField; import com.intellij.codeInsight.AnnotationUtil; @@ -200,7 +200,7 @@ class IntroduceConstantDialog extends DialogWrapper { myTfTargetClassName.getChildComponent().setSelectedItem(myParentClass.getQualifiedName()); myTfTargetClassName.getChildComponent().addDocumentListener(new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { targetClassChanged(); enableEnumDependant(introduceEnumConstant()); } diff --git a/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectDialog.java b/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectDialog.java index 2d37153df9c6..272d43cb7489 100644 --- a/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectDialog.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.refactoring.introduceparameterobject; import com.intellij.ide.util.TreeJavaClassChooserDialog; @@ -283,7 +269,7 @@ public class IntroduceParameterObjectDialog extends AbstractIntroduceParameterOb final Document document = packageTextField.getChildComponent().getDocument(); final com.intellij.openapi.editor.event.DocumentListener adapter = new com.intellij.openapi.editor.event.DocumentListener() { @Override - public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) { + public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent e) { validateButtons(); } }; @@ -313,7 +299,7 @@ public class IntroduceParameterObjectDialog extends AbstractIntroduceParameterOb existingClassField.getChildComponent().getDocument().addDocumentListener(new com.intellij.openapi.editor.event.DocumentListener() { @Override - public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) { + public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent e) { validateButtons(); enableGenerateAccessors(); } diff --git a/java/java-impl/src/com/intellij/refactoring/migration/EditMigrationEntryDialog.java b/java/java-impl/src/com/intellij/refactoring/migration/EditMigrationEntryDialog.java index bb15b1b8f1db..1a3f02a140ea 100644 --- a/java/java-impl/src/com/intellij/refactoring/migration/EditMigrationEntryDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/migration/EditMigrationEntryDialog.java @@ -1,19 +1,5 @@ -/* - * 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.refactoring.migration; import com.intellij.lang.Language; @@ -28,6 +14,7 @@ import com.intellij.refactoring.RefactoringBundle; import com.intellij.ui.EditorTextField; import com.intellij.ui.LanguageTextField; import com.intellij.util.ui.JBUI; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -122,7 +109,7 @@ public class EditMigrationEntryDialog extends DialogWrapper{ final DocumentListener documentAdapter = new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { validateOKButton(); } }; diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/DestinationFolderComboBox.java b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/DestinationFolderComboBox.java index a98924997dd9..39560b3396de 100644 --- a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/DestinationFolderComboBox.java +++ b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/DestinationFolderComboBox.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.refactoring.move.moveClassesOrPackages; import com.intellij.ide.util.DirectoryChooser; @@ -34,14 +20,15 @@ import com.intellij.psi.search.GlobalSearchScope; import com.intellij.refactoring.MoveDestination; import com.intellij.refactoring.PackageWrapper; import com.intellij.ui.*; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.*; import java.util.List; +import java.util.*; public abstract class DestinationFolderComboBox extends ComboboxWithBrowseButton { private static final String LEAVE_IN_SAME_SOURCE_ROOT = "Leave in same source root"; @@ -134,7 +121,7 @@ public abstract class DestinationFolderComboBox extends ComboboxWithBrowseButton editorComboBox.addDocumentListener(new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { JComboBox comboBox = getComboBox(); DirectoryChooser.ItemWrapper selectedItem = (DirectoryChooser.ItemWrapper)comboBox.getSelectedItem(); setComboboxModel(comboBox, selectedItem != null && selectedItem != NULL_WRAPPER ? fileIndex.getSourceRootForFile(selectedItem.getDirectory().getVirtualFile()) : initialSourceRoot, selection[0], fileIndex, mySourceRoots, project, false, errorMessageUpdater); diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesDialog.java b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesDialog.java index 2a95ae10c44c..fdf97ff4cf43 100644 --- a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesDialog.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.refactoring.move.moveClassesOrPackages; import com.intellij.lang.Language; @@ -195,7 +181,7 @@ public class MoveClassesOrPackagesDialog extends MoveDialogBase { myInnerClassChooser = new ClassNameReferenceEditor(myProject, null, scope); myInnerClassChooser.addDocumentListener(new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { validateButtons(); } }); @@ -227,11 +213,11 @@ public class MoveClassesOrPackagesDialog extends MoveDialogBase { final Document document = packageChooser.getChildComponent().getDocument(); document.addDocumentListener(new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { validateButtons(); } }); - + return packageChooser; } @@ -296,7 +282,7 @@ public class MoveClassesOrPackagesDialog extends MoveDialogBase { myCbSearchInComments.setSelected(searchInComments); myCbSearchTextOccurences.setSelected(searchForTextOccurences); - if (initialTargetDirectory != null && + if (initialTargetDirectory != null && JavaMoveClassesOrPackagesHandler.packageHasMultipleDirectoriesInModule(myProject, initialTargetDirectory)) { final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex(); final Set initialRoots = new HashSet<>(); diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersDialog.java b/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersDialog.java index aab4aa865a8d..71b4a7e5c01b 100644 --- a/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersDialog.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.refactoring.move.moveMembers; import com.intellij.ide.util.ClassFilter; @@ -49,6 +35,7 @@ import com.intellij.ui.ReferenceEditorComboWithBrowseButton; import com.intellij.usageView.UsageViewUtil; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -182,7 +169,7 @@ public class MoveMembersDialog extends MoveDialogBase implements MoveMembersOpti myTfTargetClassName.getChildComponent().getDocument().addDocumentListener(new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { myMemberInfoModel.updateTargetClass(); validateButtons(); } diff --git a/java/java-impl/src/com/intellij/refactoring/replaceConstructorWithBuilder/ReplaceConstructorWithBuilderDialog.java b/java/java-impl/src/com/intellij/refactoring/replaceConstructorWithBuilder/ReplaceConstructorWithBuilderDialog.java index 32327602a982..fbf27002f50b 100644 --- a/java/java-impl/src/com/intellij/refactoring/replaceConstructorWithBuilder/ReplaceConstructorWithBuilderDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/replaceConstructorWithBuilder/ReplaceConstructorWithBuilderDialog.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.refactoring.replaceConstructorWithBuilder; @@ -36,7 +22,6 @@ import com.intellij.psi.*; import com.intellij.psi.codeStyle.JavaCodeStyleManager; import com.intellij.psi.codeStyle.VariableKind; import com.intellij.psi.search.GlobalSearchScope; -import com.intellij.psi.util.PropertyUtil; import com.intellij.psi.util.PropertyUtilBase; import com.intellij.refactoring.PackageWrapper; import com.intellij.refactoring.RefactoringBundle; @@ -265,7 +250,7 @@ public class ReplaceConstructorWithBuilderDialog extends RefactoringDialog { private void createUIComponents() { final DocumentListener adapter = new DocumentListener() { @Override - public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) { + public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent e) { validateButtons(); } }; diff --git a/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/TypeMigrationDialog.java b/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/TypeMigrationDialog.java index cf1df9379b50..f995180ee41e 100644 --- a/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/TypeMigrationDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/TypeMigrationDialog.java @@ -1,6 +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.refactoring.typeMigration.ui; import com.intellij.find.FindSettings; @@ -169,7 +167,7 @@ public abstract class TypeMigrationDialog extends RefactoringDialog { myToTypeEditor.setHistory(types != null ? types : new String[]{document.getText()}); document.addDocumentListener(new DocumentListener() { @Override - public void documentChanged(final DocumentEvent e) { + public void documentChanged(@NotNull final DocumentEvent e) { documentManager.commitDocument(document); validateButtons(); } diff --git a/java/java-impl/src/com/intellij/refactoring/wrapreturnvalue/WrapReturnValueDialog.java b/java/java-impl/src/com/intellij/refactoring/wrapreturnvalue/WrapReturnValueDialog.java index 4fce21a738c4..e57b2ccce3a9 100644 --- a/java/java-impl/src/com/intellij/refactoring/wrapreturnvalue/WrapReturnValueDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/wrapreturnvalue/WrapReturnValueDialog.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.refactoring.wrapreturnvalue; import com.intellij.ide.util.TreeClassChooser; @@ -201,7 +187,7 @@ class WrapReturnValueDialog extends RefactoringDialog { createNewClassButton.addActionListener(enableListener); myCreateInnerClassButton.addActionListener(enableListener); toggleRadioEnablement(); - + final DefaultComboBoxModel model = new DefaultComboBoxModel(); myFieldsCombo.setModel(model); myFieldsCombo.setRenderer(new ListCellRendererWrapper() { @@ -216,7 +202,7 @@ class WrapReturnValueDialog extends RefactoringDialog { }); existingClassField.getChildComponent().getDocument().addDocumentListener(new com.intellij.openapi.editor.event.DocumentListener() { @Override - public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) { + public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent e) { final JavaPsiFacade facade = JavaPsiFacade.getInstance(myProject); final PsiClass currentClass = facade.findClass(existingClassField.getText(), GlobalSearchScope.allScope(myProject)); if (currentClass != null) { @@ -271,7 +257,7 @@ class WrapReturnValueDialog extends RefactoringDialog { private void createUIComponents() { final com.intellij.openapi.editor.event.DocumentListener adapter = new com.intellij.openapi.editor.event.DocumentListener() { @Override - public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) { + public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent e) { validateButtons(); } }; diff --git a/java/java-impl/src/com/intellij/testIntegration/createTest/CreateTestDialog.java b/java/java-impl/src/com/intellij/testIntegration/createTest/CreateTestDialog.java index da05e05b55d3..b6c749697ed8 100644 --- a/java/java-impl/src/com/intellij/testIntegration/createTest/CreateTestDialog.java +++ b/java/java-impl/src/com/intellij/testIntegration/createTest/CreateTestDialog.java @@ -60,8 +60,8 @@ import java.awt.event.ActionListener; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.io.IOException; -import java.util.*; import java.util.List; +import java.util.*; public class CreateTestDialog extends DialogWrapper { private static final String RECENTS_KEY = "CreateTestDialog.RecentsKey"; @@ -227,9 +227,9 @@ public class CreateTestDialog extends DialogWrapper { constr.fill = GridBagConstraints.HORIZONTAL; constr.anchor = GridBagConstraints.WEST; - + int gridy = 1; - + constr.insets = insets(4); constr.gridy = gridy++; constr.gridx = 0; @@ -266,7 +266,7 @@ public class CreateTestDialog extends DialogWrapper { myTargetClassNameField = new EditorTextField(suggestTestClassName(myTargetClass)); myTargetClassNameField.getDocument().addDocumentListener(new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { getOKAction().setEnabled(PsiNameHelper.getInstance(myProject).isIdentifier(getClassName())); } }); diff --git a/java/java-impl/src/com/intellij/unscramble/ThreadDumpPanel.java b/java/java-impl/src/com/intellij/unscramble/ThreadDumpPanel.java index ffdc57b8831e..058c2cfe2e2a 100644 --- a/java/java-impl/src/com/intellij/unscramble/ThreadDumpPanel.java +++ b/java/java-impl/src/com/intellij/unscramble/ThreadDumpPanel.java @@ -145,7 +145,7 @@ public class ThreadDumpPanel extends JPanel implements DataProvider { if (editor != null) { editor.getDocument().addDocumentListener(new DocumentListener() { @Override - public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) { + public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent e) { String filter = myFilterField.getText(); if (StringUtil.isNotEmpty(filter)) { highlightOccurrences(filter, project, editor); diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/JavaAutoPopupTest.groovy b/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/JavaAutoPopupTest.groovy index 57134eb2c0d2..4ae53621f30a 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/JavaAutoPopupTest.groovy +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/JavaAutoPopupTest.groovy @@ -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.java.codeInsight.completion import com.intellij.codeInsight.CodeInsightSettings @@ -53,7 +39,10 @@ import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.progress.ProgressManager import com.intellij.openapi.util.Computable import com.intellij.openapi.util.Disposer -import com.intellij.psi.* +import com.intellij.psi.NavigatablePsiElement +import com.intellij.psi.PsiClass +import com.intellij.psi.PsiJavaFile +import com.intellij.psi.PsiMethod import com.intellij.psi.statistics.StatisticsManager import com.intellij.psi.statistics.impl.StatisticsManagerImpl import com.intellij.testFramework.fixtures.CodeInsightTestUtil @@ -991,7 +980,7 @@ class Foo { myFixture.configureByText("$a1 $a2 .java", src) myFixture.editor.document.addDocumentListener(new DocumentListener() { @Override - void documentChanged(DocumentEvent e) { + void documentChanged(@NotNull DocumentEvent e) { if (e.newFragment.toString().contains("a")) { fail(e.toString()) } @@ -1235,7 +1224,7 @@ public class Test { JavaCodeContextType contextType = ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), JavaCodeContextType.Statement) ((TemplateImpl)template).templateContext.setEnabled(contextType, true) CodeInsightTestUtil.addTemplate(template, myFixture.testRootDisposable) - + LiveTemplateCompletionContributor.setShowTemplatesInTests(true, myFixture.testRootDisposable) myFixture.configureByText("a.java", """ public class Test { @@ -1694,7 +1683,7 @@ class Cls { } void mySout() {} } -""" +""" type('sout') myFixture.assertPreferredCompletionItems 0, 'sout', 'mySout' } @@ -1723,7 +1712,7 @@ class Cls { } void mySout() {} } -""" +""" type('sout') assert lookup assert 'sout' in myFixture.lookupElementStrings @@ -1751,7 +1740,7 @@ class Cls { ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), JavaCodeContextType.Statement) ((TemplateImpl)template).getTemplateContext().setEnabled(contextType, true) CodeInsightTestUtil.addTemplate(template, myFixture.testRootDisposable) - + myFixture.configureByText 'a.java', ''' class Foo { int tplMn; @@ -1801,7 +1790,7 @@ ita """ type 'r' assert lookup == null - + LiveTemplateCompletionContributor.setShowTemplatesInTests(true, myFixture.getTestRootDisposable()) type '\br' assert lookup diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java b/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java index ef9eca21e744..3fef173cdd04 100644 --- a/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/impl/smartPointers/SmartPsiElementPointersTest.java @@ -279,7 +279,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase { int offset = aClass.getTextOffset(); DocumentListener listener = new DocumentListener() { @Override - public void beforeDocumentChange(DocumentEvent event) { + public void beforeDocumentChange(@NotNull DocumentEvent event) { pointer[0] = createPointer(aClass); } }; @@ -634,14 +634,14 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase { assertEquals(range1, pointer2.getRange()); assertNotNull(node); } - + public void testEqualPointersWhenCreatedFromStubAndAST() { PsiJavaFile file = (PsiJavaFile)myJavaFacade.findClass("AClass", GlobalSearchScope.allScope(getProject())).getContainingFile(); int hash1 = file.getClasses()[0].hashCode(); final SmartPsiElementPointer pointer1 = createPointer(file.getClasses()[0]); assertNotNull(((PsiFileImpl)file).getStubTree()); - + PlatformTestUtil.tryGcSoftlyReachableObjects(); final FileASTNode node = file.getNode(); @@ -736,7 +736,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase { PsiDocumentManager.getInstance(myProject).commitAllDocuments(); assertEquals(TextRange.create(2, 3), pointer.getRange()); } - + public void testUpdateAfterInsertingIdenticalText() { PsiJavaFile file = (PsiJavaFile)configureByText(StdFileTypes.JAVA, "class Foo {\n" + " void m() {\n" + @@ -925,7 +925,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase { PsiJavaFile file = (PsiJavaFile)createFile("a.java", "import foo.Bar;\nclass Foo {}"); SmartPointerEx pointer = createPointer(file.getImportList()); Document document = file.getViewProvider().getDocument(); - + WriteCommandAction.runWriteCommandAction(myProject, () -> { document.insertString(document.getText().indexOf("class"), "import foo.Goo;\n"); PsiDocumentManager.getInstance(myProject).commitAllDocuments(); @@ -953,7 +953,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase { assertTrue(psiFile.isValid()); assertEquals(((PsiJavaFile)psiFile).getClasses()[0], pointer.getElement()); - + assertFalse(((PsiFileImpl)psiFile).isContentsLoaded()); } @@ -974,7 +974,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase { PsiJavaFileImpl file = (PsiJavaFileImpl)createFile("a.java", "class A {}"); assertNotNull(file.getNode()); SmartPointerEx pointer = createPointer(file.getClasses()[0]); - + PlatformTestUtil.tryGcSoftlyReachableObjects(); assertNull(file.getTreeElement()); @@ -1008,14 +1008,14 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase { PsiFile file = createFile("a.java", "abc"); SmartPsiFileRange pointer = getPointerManager().createSmartPsiFileRangePointer(file, TextRange.from(0, 1)); assertInstanceOf(pointer.getElement(), PsiJavaFile.class); - + WriteCommandAction.runWriteCommandAction(myProject, () -> { Document document = file.getViewProvider().getDocument(); file.setName("a.txt"); document.insertString(0, "ddd"); PsiDocumentManager.getInstance(myProject).commitAllDocuments(); }); - + assertInstanceOf(pointer.getElement(), PsiPlainTextFile.class); assertEquals(TextRange.from(3, 1), TextRange.create(pointer.getRange())); } diff --git a/platform/core-api/src/com/intellij/openapi/editor/event/DocumentListener.java b/platform/core-api/src/com/intellij/openapi/editor/event/DocumentListener.java index 4903d7cf19e7..bc9c371dbc07 100644 --- a/platform/core-api/src/com/intellij/openapi/editor/event/DocumentListener.java +++ b/platform/core-api/src/com/intellij/openapi/editor/event/DocumentListener.java @@ -1,21 +1,8 @@ -/* - * 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.editor.event; import com.intellij.util.ArrayFactory; +import org.jetbrains.annotations.NotNull; import java.util.EventListener; @@ -36,7 +23,7 @@ public interface DocumentListener extends EventListener{ * * @param event the event containing the information about the change. */ - default void beforeDocumentChange(DocumentEvent event) { + default void beforeDocumentChange(@NotNull DocumentEvent event) { } /** @@ -44,6 +31,6 @@ public interface DocumentListener extends EventListener{ * * @param event the event containing the information about the change. */ - default void documentChanged(DocumentEvent event) { + default void documentChanged(@NotNull DocumentEvent event) { } } diff --git a/platform/core-impl/src/com/intellij/codeInsight/completion/OffsetTranslator.java b/platform/core-impl/src/com/intellij/codeInsight/completion/OffsetTranslator.java index fe1e55453648..f5822cc886a9 100644 --- a/platform/core-impl/src/com/intellij/codeInsight/completion/OffsetTranslator.java +++ b/platform/core-impl/src/com/intellij/codeInsight/completion/OffsetTranslator.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.codeInsight.completion; import com.intellij.openapi.Disposable; @@ -24,6 +10,7 @@ import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Key; import com.intellij.psi.PsiFile; import com.intellij.psi.util.PsiModificationTracker; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.LinkedList; @@ -48,7 +35,7 @@ class OffsetTranslator implements Disposable { final LinkedList sinceCommit = new LinkedList<>(); originalDocument.addDocumentListener(new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { if (isUpToDate()) { DocumentEventImpl inverse = new DocumentEventImpl(originalDocument, e.getOffset(), e.getNewFragment(), e.getOldFragment(), 0, false); @@ -56,7 +43,7 @@ class OffsetTranslator implements Disposable { } } }, this); - + originalFile.getProject().getMessageBus().connect(this).subscribe(PsiModificationTracker.TOPIC, new PsiModificationTracker.Listener() { long lastModCount = originalFile.getViewProvider().getModificationStamp(); @Override diff --git a/platform/core-impl/src/com/intellij/openapi/editor/impl/RangeMarkerTree.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/RangeMarkerTree.java index 835bef68d5a1..e22d9f450f7e 100644 --- a/platform/core-impl/src/com/intellij/openapi/editor/impl/RangeMarkerTree.java +++ b/platform/core-impl/src/com/intellij/openapi/editor/impl/RangeMarkerTree.java @@ -34,7 +34,7 @@ class RangeMarkerTree extends IntervalTreeImpl imple } @Override - public void documentChanged(DocumentEvent event) { + public void documentChanged(@NotNull DocumentEvent event) { updateMarkersOnChange(event); } @@ -57,8 +57,8 @@ class RangeMarkerTree extends IntervalTreeImpl imple boolean stickyR1 = o1.isStickingToRight(); boolean stickyR2 = o2.isStickingToRight(); - if (stickyR1 != stickyR2) return stickyR1 ? -1 : 1; - + if (stickyR1 != stickyR2) return stickyR1 ? -1 : 1; + return 0; } @@ -69,7 +69,7 @@ class RangeMarkerTree extends IntervalTreeImpl imple private static final int DUPLICATE_LIMIT = 30; // assertion: no more than DUPLICATE_LIMIT range markers are allowed to be registered at given (start, end) @NotNull @Override - public RMNode addInterval(@NotNull T interval, int start, int end, + public RMNode addInterval(@NotNull T interval, int start, int end, boolean greedyToLeft, boolean greedyToRight, boolean stickingToRight, int layer) { ((RangeMarkerImpl)interval).setValid(true); RMNode node = (RMNode)super.addInterval(interval, start, end, greedyToLeft, greedyToRight, stickingToRight, layer); @@ -104,7 +104,7 @@ class RangeMarkerTree extends IntervalTreeImpl imple @NotNull @Override - protected RMNode createNewNode(@NotNull T key, int start, int end, + protected RMNode createNewNode(@NotNull T key, int start, int end, boolean greedyToLeft, boolean greedyToRight, boolean stickingToRight, int layer) { return new RMNode<>(this, key, start, end, greedyToLeft, greedyToRight, stickingToRight); } diff --git a/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java b/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java index 9006b2840b6f..e2381441a653 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java +++ b/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java @@ -800,7 +800,7 @@ public abstract class PsiDocumentManagerBase extends PsiDocumentManager implemen } @Override - public void documentChanged(DocumentEvent event) { + public void documentChanged(@NotNull DocumentEvent event) { if (myStopTrackingDocuments || myProject.isDisposed()) return; final Document document = event.getDocument(); diff --git a/platform/diff-impl/src/com/intellij/diff/actions/DocumentsSynchronizer.java b/platform/diff-impl/src/com/intellij/diff/actions/DocumentsSynchronizer.java index c9410a621a4a..33c70ebc5302 100644 --- a/platform/diff-impl/src/com/intellij/diff/actions/DocumentsSynchronizer.java +++ b/platform/diff-impl/src/com/intellij/diff/actions/DocumentsSynchronizer.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.diff.actions; import com.intellij.openapi.application.ApplicationManager; @@ -36,7 +22,7 @@ abstract class DocumentsSynchronizer { private final DocumentListener myListener1 = new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { if (myDuringModification) return; onDocumentChanged1(e); } @@ -44,7 +30,7 @@ abstract class DocumentsSynchronizer { private final DocumentListener myListener2 = new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { if (myDuringModification) return; onDocumentChanged2(e); } diff --git a/platform/diff-impl/src/com/intellij/diff/merge/MergeModelBase.java b/platform/diff-impl/src/com/intellij/diff/merge/MergeModelBase.java index 86b80be2be75..6c369946b0d1 100644 --- a/platform/diff-impl/src/com/intellij/diff/merge/MergeModelBase.java +++ b/platform/diff-impl/src/com/intellij/diff/merge/MergeModelBase.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.diff.merge; import com.intellij.diff.util.DiffUtil; @@ -185,7 +171,7 @@ public abstract class MergeModelBase implements private class MyDocumentListener implements DocumentListener { @Override - public void beforeDocumentChange(DocumentEvent e) { + public void beforeDocumentChange(@NotNull DocumentEvent e) { if (isDisposed()) return; enterBulkChangeUpdateBlock(); @@ -211,7 +197,7 @@ public abstract class MergeModelBase implements } @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { if (isDisposed()) return; exitBulkChangeUpdateBlock(); } diff --git a/platform/diff-impl/src/com/intellij/diff/tools/fragmented/UnifiedDiffViewer.java b/platform/diff-impl/src/com/intellij/diff/tools/fragmented/UnifiedDiffViewer.java index 6ff1fa39d6e8..aad5d3c61232 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/fragmented/UnifiedDiffViewer.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/fragmented/UnifiedDiffViewer.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.diff.tools.fragmented; import com.intellij.diff.DiffContext; @@ -540,7 +526,7 @@ public class UnifiedDiffViewer extends ListenerDiffViewerBase { private class MyOnesideDocumentListener implements DocumentListener { @Override - public void beforeDocumentChange(DocumentEvent e) { + public void beforeDocumentChange(@NotNull DocumentEvent e) { if (myDuringOnesideDocumentModification) return; if (myChangedBlockData == null) { LOG.warn("oneside beforeDocumentChange - myChangedBlockData == null"); diff --git a/platform/diff-impl/src/com/intellij/diff/tools/util/FoldingModelSupport.java b/platform/diff-impl/src/com/intellij/diff/tools/util/FoldingModelSupport.java index d918013a64e0..661a1b750dd7 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/util/FoldingModelSupport.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/util/FoldingModelSupport.java @@ -30,8 +30,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.awt.*; -import java.util.*; import java.util.List; +import java.util.*; import static com.intellij.diff.util.DiffUtil.getLineCount; import static com.intellij.util.ArrayUtil.toObjectArray; @@ -256,7 +256,7 @@ public class FoldingModelSupport { private class MyDocumentListener implements DocumentListener { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { if (StringUtil.indexOf(e.getOldFragment(), '\n') != -1 || StringUtil.indexOf(e.getNewFragment(), '\n') != -1) { for (int i = 0; i < myCount; i++) { diff --git a/platform/diff-impl/src/com/intellij/diff/tools/util/base/ListenerDiffViewerBase.java b/platform/diff-impl/src/com/intellij/diff/tools/util/base/ListenerDiffViewerBase.java index 8e3465ddd341..0cd3cc0b6c49 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/util/base/ListenerDiffViewerBase.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/util/base/ListenerDiffViewerBase.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.diff.tools.util.base; import com.intellij.diff.DiffContext; @@ -53,12 +39,12 @@ public abstract class ListenerDiffViewerBase extends DiffViewerBase { protected DocumentListener createDocumentListener() { return new DocumentListener() { @Override - public void beforeDocumentChange(DocumentEvent event) { + public void beforeDocumentChange(@NotNull DocumentEvent event) { onBeforeDocumentChange(event); } @Override - public void documentChanged(DocumentEvent event) { + public void documentChanged(@NotNull DocumentEvent event) { onDocumentChange(event); } }; diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/ui/CloneDvcsDialog.java b/platform/dvcs-impl/src/com/intellij/dvcs/ui/CloneDvcsDialog.java index 2339acfb4573..26f1eb149e4f 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/ui/CloneDvcsDialog.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/ui/CloneDvcsDialog.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.dvcs.ui; import com.intellij.codeInsight.hint.HintManager; @@ -217,13 +203,13 @@ public abstract class CloneDvcsDialog extends DialogWrapper { myRepositoryUrlField.addDocumentListener(new DocumentListener() { @Override - public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent event) { + public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent event) { myDirectoryField.trySetChildPath(defaultDirectoryName(myRepositoryUrlField.getText().trim())); } }); myRepositoryUrlField.addDocumentListener(new DocumentListener() { @Override - public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent event) { + public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent event) { myRepositoryTestValidationInfo = null; } }); diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/util/LayeredLexerEditorHighlighter.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/util/LayeredLexerEditorHighlighter.java index 998a859ae239..b573a270af1f 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/util/LayeredLexerEditorHighlighter.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/util/LayeredLexerEditorHighlighter.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.editor.ex.util; @@ -164,12 +150,12 @@ public class LayeredLexerEditorHighlighter extends LexerEditorHighlighter { } protected boolean updateLayers() { return false; } - + protected boolean updateLayers(@NotNull DocumentEvent e) { return updateLayers(); } @SuppressWarnings("NonSynchronizedMethodOverridesSynchronizedMethod") @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { // do NOT synchronize before updateLayers due to deadlock with PsiLock boolean changed = updateLayers(e); diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/util/LexerEditorHighlighter.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/util/LexerEditorHighlighter.java index 93dcd2b9da07..98d890e87b46 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/util/LexerEditorHighlighter.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/util/LexerEditorHighlighter.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.editor.ex.util; import com.intellij.lexer.FlexAdapter; @@ -137,7 +123,7 @@ public class LexerEditorHighlighter implements EditorHighlighter, PrioritizedDoc Project project = myEditor.getProject(); return project != null && !project.isDisposed(); } - + private boolean isInSyncWithDocument() { Document document = getDocument(); return document == null || document.getTextLength() == 0 || mySegments.getSegmentCount() > 0; @@ -152,7 +138,7 @@ public class LexerEditorHighlighter implements EditorHighlighter, PrioritizedDoc } @Override - public synchronized void documentChanged(DocumentEvent e) { + public synchronized void documentChanged(@NotNull DocumentEvent e) { try { final Document document = e.getDocument(); CharSequence text = document.getImmutableCharSequence(); @@ -389,7 +375,7 @@ public class LexerEditorHighlighter implements EditorHighlighter, PrioritizedDoc myLexer.advance(); } processor.finish(); - + if (textLength > 0 && (mySegments.mySegmentCount == 0 || mySegments.myEnds[mySegments.mySegmentCount - 1] != textLength)) { throw new IllegalStateException("Unexpected termination offset for lexer " + myLexer); } diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/autoimport/ExternalSystemProjectsWatcherImpl.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/autoimport/ExternalSystemProjectsWatcherImpl.java index c88e90e3695d..9839f3ad7519 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/autoimport/ExternalSystemProjectsWatcherImpl.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/autoimport/ExternalSystemProjectsWatcherImpl.java @@ -1,6 +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.openapi.externalSystem.service.project.autoimport; import com.intellij.ProjectTopics; @@ -47,7 +45,7 @@ import com.intellij.openapi.vfs.newvfs.events.VFileContentChangeEvent; import com.intellij.openapi.vfs.newvfs.events.VFileEvent; import com.intellij.openapi.vfs.pointers.VirtualFilePointer; import com.intellij.openapi.vfs.pointers.VirtualFilePointerManager; -import com.intellij.psi.*; +import com.intellij.psi.PsiDocumentManager; import com.intellij.util.PathUtil; import com.intellij.util.SmartList; import com.intellij.util.containers.ContainerUtil; @@ -169,7 +167,7 @@ public class ExternalSystemProjectsWatcherImpl extends ExternalSystemTaskNotific DocumentListener myDocumentListener = new DocumentListener() { @Override - public void documentChanged(DocumentEvent event) { + public void documentChanged(@NotNull DocumentEvent event) { Document doc = event.getDocument(); VirtualFile file = FileDocumentManager.getInstance().getFile(doc); if (file == null) return; @@ -451,7 +449,7 @@ public class ExternalSystemProjectsWatcherImpl extends ExternalSystemTaskNotific multicaster.addDocumentListener(new DocumentListener() { @Override - public void documentChanged(DocumentEvent event) { + public void documentChanged(@NotNull DocumentEvent event) { mergingUpdateQueue.restartTimer(); } }, mergingUpdateQueue); diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementSectionRulesControl.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementSectionRulesControl.java index 3394af5e7ee3..5ab4d0707357 100644 --- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementSectionRulesControl.java +++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementSectionRulesControl.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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.application.options.codeStyle.arrangement.match; import com.intellij.application.options.codeStyle.arrangement.ArrangementConstants; @@ -29,7 +15,8 @@ import com.intellij.psi.codeStyle.arrangement.model.ArrangementAtomMatchConditio import com.intellij.psi.codeStyle.arrangement.model.ArrangementCompositeMatchCondition; import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchCondition; import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchConditionVisitor; -import com.intellij.psi.codeStyle.arrangement.std.*; +import com.intellij.psi.codeStyle.arrangement.std.ArrangementStandardSettingsManager; +import com.intellij.psi.codeStyle.arrangement.std.StdArrangementRuleAliasToken; import com.intellij.util.containers.ContainerUtil; import gnu.trove.THashSet; import org.jetbrains.annotations.NotNull; @@ -172,6 +159,7 @@ public class ArrangementSectionRulesControl extends ArrangementMatchingRulesCont } } + @Override public void showEditor(int rowToEdit) { if (mySectionRuleManager != null && mySectionRuleManager.isSectionRule(getModel().getElementAt(rowToEdit))) { mySectionRuleManager.showEditor(rowToEdit); diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementSectionRulesValidator.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementSectionRulesValidator.java index 82277b328b8a..2f2ea6fd137b 100644 --- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementSectionRulesValidator.java +++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementSectionRulesValidator.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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.application.options.codeStyle.arrangement.match; import com.intellij.openapi.application.ApplicationBundle; @@ -35,6 +21,7 @@ public class ArrangementSectionRulesValidator extends ArrangementMatchingRulesVa mySectionRuleManager = sectionRuleManager; } + @Override @Nullable protected String validate(int index) { if (myRulesModel.getSize() < index) { diff --git a/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontDescriptionPanel.java b/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontDescriptionPanel.java index ebffa07a52ec..75c4f51a487d 100644 --- a/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontDescriptionPanel.java +++ b/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontDescriptionPanel.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.application.options.colors; import com.intellij.openapi.application.ApplicationBundle; @@ -131,6 +117,7 @@ public class ColorAndFontDescriptionPanel extends JPanel implements OptionsPanel return this; } + @Override public void resetDefault() { try { myUiEventsEnabled = false; @@ -168,6 +155,7 @@ public class ColorAndFontDescriptionPanel extends JPanel implements OptionsPanel colorPanel.setEnabled(isChecked); } + @Override public void reset(@NotNull EditorSchemeAttributeDescriptor attrDescription) { try { myUiEventsEnabled = false; @@ -266,6 +254,7 @@ public class ColorAndFontDescriptionPanel extends JPanel implements OptionsPanel myBackgroundChooser.setEditable(isEditEnabled); } + @Override public void apply(@NotNull EditorSchemeAttributeDescriptor attrDescription, EditorColorsScheme scheme) { if (!(attrDescription instanceof ColorAndFontDescription)) return; ColorAndFontDescription description = (ColorAndFontDescription)attrDescription; diff --git a/platform/lang-impl/src/com/intellij/application/options/colors/FontOptions.java b/platform/lang-impl/src/com/intellij/application/options/colors/FontOptions.java index 3c041e9eba7f..52ee78540e33 100644 --- a/platform/lang-impl/src/com/intellij/application/options/colors/FontOptions.java +++ b/platform/lang-impl/src/com/intellij/application/options/colors/FontOptions.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.application.options.colors; @@ -155,6 +141,7 @@ public class FontOptions extends AbstractFontOptionsPanel { } } + @Override protected void setDelegatingPreferences(boolean isDelegating) { FontPreferences currPrefs = getCurrentScheme().getFontPreferences(); if (currPrefs instanceof DelegatingFontPreferences == isDelegating) return; diff --git a/platform/lang-impl/src/com/intellij/application/options/colors/OptionsPanelImpl.java b/platform/lang-impl/src/com/intellij/application/options/colors/OptionsPanelImpl.java index 2f5971e01b76..1bba6f54dc39 100644 --- a/platform/lang-impl/src/com/intellij/application/options/colors/OptionsPanelImpl.java +++ b/platform/lang-impl/src/com/intellij/application/options/colors/OptionsPanelImpl.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.application.options.colors; @@ -221,7 +207,8 @@ public class OptionsPanelImpl extends JPanel implements OptionsPanel { void onHyperLinkClicked(HyperlinkEvent e); } } - + + @Override public void setEmptyText(@NotNull String text, @Nullable ActionListener linkListener) { myOptionsTree.setEmptyText(text, linkListener); } diff --git a/platform/lang-impl/src/com/intellij/build/ExecutionNodeProgressAnimator.java b/platform/lang-impl/src/com/intellij/build/ExecutionNodeProgressAnimator.java index 7c3da7ccef15..914219538e37 100644 --- a/platform/lang-impl/src/com/intellij/build/ExecutionNodeProgressAnimator.java +++ b/platform/lang-impl/src/com/intellij/build/ExecutionNodeProgressAnimator.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.build; import com.intellij.icons.AllIcons; @@ -67,6 +53,7 @@ public class ExecutionNodeProgressAnimator implements Runnable, Disposable { return FRAMES[getCurrentFrameIndex()]; } + @Override public void run() { if (!myNodes.isEmpty()) { final long time = System.currentTimeMillis(); @@ -100,6 +87,7 @@ public class ExecutionNodeProgressAnimator implements Runnable, Disposable { cancelAlarm(); } + @Override public void dispose() { myTreeView = null; myNodes.clear(); diff --git a/platform/lang-impl/src/com/intellij/build/events/impl/AbstractBuildEvent.java b/platform/lang-impl/src/com/intellij/build/events/impl/AbstractBuildEvent.java index 90b8f21f8a5f..8eb9057a0961 100644 --- a/platform/lang-impl/src/com/intellij/build/events/impl/AbstractBuildEvent.java +++ b/platform/lang-impl/src/com/intellij/build/events/impl/AbstractBuildEvent.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.build.events.impl; import com.intellij.build.events.BuildEvent; @@ -66,6 +52,7 @@ public abstract class AbstractBuildEvent implements BuildEvent { return myMessage; } + @Override @Nullable public String getHint() { return myHint; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/TargetElementEvaluatorEx2.java b/platform/lang-impl/src/com/intellij/codeInsight/TargetElementEvaluatorEx2.java index f5811d484907..a41bca79dee2 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/TargetElementEvaluatorEx2.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/TargetElementEvaluatorEx2.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.codeInsight; import com.intellij.openapi.editor.Editor; @@ -29,18 +15,18 @@ import java.util.Collection; /** * Advanced customization interface used in {@link TargetElementUtil} class to support specifics of various languages. * The exact API is not documented and is subject to change. - * Please refer to {@link TargetElementUtil} for additional information. + * Please refer to {@link TargetElementUtil} for additional information. */ public abstract class TargetElementEvaluatorEx2 implements TargetElementEvaluator { - @Nullable + @Nullable public PsiElement getNamedElement(@NotNull PsiElement element) { return null; } - + public boolean isAcceptableNamedParent(@NotNull PsiElement parent) { return true; } - + @Nullable public PsiElement adjustElement(Editor editor, int flags, @Nullable PsiElement element, @Nullable PsiElement contextElement) { return element; @@ -62,7 +48,7 @@ public abstract class TargetElementEvaluatorEx2 implements TargetElementEvaluato @Nullable public PsiElement adjustReference(@NotNull PsiReference ref) { - return null; + return null; } @Nullable @@ -80,12 +66,13 @@ public abstract class TargetElementEvaluatorEx2 implements TargetElementEvaluato return ThreeState.UNSURE; } + @Override public boolean includeSelfInGotoImplementation(@NotNull final PsiElement element) { return true; } - + public boolean acceptImplementationForReference(@Nullable PsiReference reference, @NotNull PsiElement element) { - return true; + return true; } /** diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutCodeDialog.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutCodeDialog.java index 170130b3c886..6a83a4cfc59e 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutCodeDialog.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutCodeDialog.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2012 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.codeInsight.actions; @@ -74,6 +60,7 @@ public class LayoutCodeDialog extends DialogWrapper { init(); } + @Override protected void init() { super.init(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutProjectCodeDialog.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutProjectCodeDialog.java index 97f1c50865f6..4d1e7b397d1e 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutProjectCodeDialog.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutProjectCodeDialog.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2011 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// 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.codeInsight.actions; @@ -201,10 +187,12 @@ public class LayoutProjectCodeDialog extends DialogWrapper implements ReformatFi } } + @Override public boolean isOptimizeImports() { return myCbOptimizeImports.isSelected(); } + @Override @Nullable public String getFileTypeMask() { if (myEnableFileNameFilterCb.isSelected()) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/ActionTracker.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/ActionTracker.java index 7d7ffc1260b2..5b250242f4cb 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/ActionTracker.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/ActionTracker.java @@ -44,7 +44,7 @@ class ActionTracker { }); myEditor.getDocument().addDocumentListener(new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { if (!myIgnoreDocumentChanges) { myActionsHappened = true; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/AddSpaceInsertHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/AddSpaceInsertHandler.java index 3a220bc9d2b1..2fec4557afee 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/AddSpaceInsertHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/AddSpaceInsertHandler.java @@ -30,6 +30,7 @@ public class AddSpaceInsertHandler implements InsertHandler { myTriggerAutoPopup = triggerAutoPopup; } + @Override public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) { Editor editor = context.getEditor(); char completionChar = context.getCompletionChar(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionPhase.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionPhase.java index 4d06b866f14d..b882aaab0ef5 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionPhase.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionPhase.java @@ -163,7 +163,7 @@ public abstract class CompletionPhase implements Disposable { }; final DocumentListener documentListener = new DocumentListener() { @Override - public void beforeDocumentChange(DocumentEvent e) { + public void beforeDocumentChange(@NotNull DocumentEvent e) { CompletionServiceImpl.setCompletionPhase(NoCompletion); } }; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionThreading.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionThreading.java index 092a0b46d204..4fd613acb411 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionThreading.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionThreading.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.codeInsight.completion; import com.intellij.openapi.application.ApplicationManager; @@ -79,6 +65,7 @@ class SyncCompletion extends CompletionThreadingBase { }; } + @Override protected void flushBatchResult(CompletionProgressIndicator indicator) { try { indicator.withSingleUpdate(() -> { @@ -162,6 +149,7 @@ class AsyncCompletion extends CompletionThreadingBase { }; } + @Override protected void flushBatchResult(CompletionProgressIndicator indicator) { ArrayList batchListCopy = new ArrayList<>(myBatchList); myBatchList.clear(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/RangeMarkerSpy.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/RangeMarkerSpy.java index ca3435d8dae2..75f160d083dc 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/RangeMarkerSpy.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/RangeMarkerSpy.java @@ -1,23 +1,10 @@ -/* - * 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.codeInsight.completion; import com.intellij.openapi.editor.RangeMarker; import com.intellij.openapi.editor.event.DocumentEvent; import com.intellij.openapi.editor.event.DocumentListener; +import org.jetbrains.annotations.NotNull; /** * @author peter @@ -33,7 +20,7 @@ public abstract class RangeMarkerSpy implements DocumentListener { protected abstract void invalidated(DocumentEvent e); @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { if (!myMarker.isValid()) { invalidated(e); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java index 5a5ace5b5813..477be6dd9198 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java @@ -162,7 +162,7 @@ public class DaemonListeners implements Disposable { eventMulticaster.addDocumentListener(new DocumentListener() { // clearing highlighters before changing document because change can damage editor highlighters drastically, so we'll clear more than necessary @Override - public void beforeDocumentChange(final DocumentEvent e) { + public void beforeDocumentChange(@NotNull final DocumentEvent e) { Document document = e.getDocument(); VirtualFile virtualFile = fileDocumentManager.getFile(document); Project project = virtualFile == null ? null : ProjectUtil.guessProjectForFile(virtualFile); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PsiChangeHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PsiChangeHandler.java index eb43746fa290..4fbf4ae21331 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PsiChangeHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PsiChangeHandler.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.codeInsight.daemon.impl; @@ -69,7 +55,7 @@ class PsiChangeHandler extends PsiTreeChangeAdapter implements Disposable { myFileStatusMap = fileStatusMap; editorFactory.getEventMulticaster().addDocumentListener(new DocumentListener() { @Override - public void beforeDocumentChange(DocumentEvent e) { + public void beforeDocumentChange(@NotNull DocumentEvent e) { final Document document = e.getDocument(); if (documentManager.getSynchronizer().isInSynchronization(document)) return; if (documentManager.getCachedPsiFile(document) == null) return; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/QuickDocOnMouseOverManager.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/QuickDocOnMouseOverManager.java index 0b84e81bffdb..812c7a8e6c14 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/QuickDocOnMouseOverManager.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/QuickDocOnMouseOverManager.java @@ -403,7 +403,7 @@ public class QuickDocOnMouseOverManager { private class MyDocumentListener implements DocumentListener { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { Editor editor = getEditor(); if (editor == null || editor.getDocument() == e.getDocument()) { closeQuickDocIfPossible(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/AutoHardWrapHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/AutoHardWrapHandler.java index b77feee795d2..e1484a114166 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/AutoHardWrapHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/AutoHardWrapHandler.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.codeInsight.editorActions; import com.intellij.codeInsight.template.TemplateManager; @@ -153,7 +153,7 @@ public class AutoHardWrapHandler { if (wrapOffset < 0) { return; } - + WhiteSpaceFormattingStrategy formattingStrategy = WhiteSpaceFormattingStrategyFactory.getStrategy(editor); if (wrapOffset <= startOffset || wrapOffset > maxPreferredOffset || formattingStrategy.check(document.getCharsSequence(), startOffset, wrapOffset) >= wrapOffset) @@ -168,7 +168,7 @@ public class AutoHardWrapHandler { final int baseCaretOffset = caretModel.getOffset(); DocumentListener listener = new DocumentListener() { @Override - public void beforeDocumentChange(DocumentEvent event) { + public void beforeDocumentChange(@NotNull DocumentEvent event) { if (event.getOffset() < baseCaretOffset + caretOffsetDiff[0]) { caretOffsetDiff[0] += event.getNewLength() - event.getOldLength(); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/MatchBraceAction.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/MatchBraceAction.java index cd012770c51a..831e90c6cf4b 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/MatchBraceAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/MatchBraceAction.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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.codeInsight.editorActions; import com.intellij.codeInsight.highlighting.BraceMatchingUtil; @@ -45,6 +31,7 @@ public class MatchBraceAction extends EditorAction { super(true); } + @Override public void execute(@NotNull Editor editor, DataContext dataContext) { final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext); if (file == null) return; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TabOutScopesTrackerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TabOutScopesTrackerImpl.java index e28cd6be895c..5dec14aa773f 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TabOutScopesTrackerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TabOutScopesTrackerImpl.java @@ -119,7 +119,7 @@ public class TabOutScopesTrackerImpl implements TabOutScopesTracker { } @Override - public void beforeDocumentChange(DocumentEvent event) { + public void beforeDocumentChange(@NotNull DocumentEvent event) { List scopes = getCurrentScopes(false); if (scopes == null) return; int caretOffset = myEditor.getCaretModel().getOffset(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterBetweenBracesAndBracketsDelegate.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterBetweenBracesAndBracketsDelegate.java index 743c24eef6ca..f76154a58e70 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterBetweenBracesAndBracketsDelegate.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterBetweenBracesAndBracketsDelegate.java @@ -2,6 +2,7 @@ package com.intellij.codeInsight.editorActions.enter; public class EnterBetweenBracesAndBracketsDelegate extends EnterBetweenBracesDelegate { + @Override protected boolean isBracePair(char lBrace, char rBrace) { return super.isBracePair(lBrace, rBrace ) || (lBrace == '[' && rBrace == ']'); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterBetweenBracesHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterBetweenBracesHandler.java index 87db43a74e34..212dc3d7af20 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterBetweenBracesHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterBetweenBracesHandler.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.codeInsight.editorActions.enter; @@ -25,6 +11,7 @@ import org.jetbrains.annotations.NotNull; * @Deprecated Please, use the {@code EnterBetweenBracesDelegate} language-specific implementation instead. */ public class EnterBetweenBracesHandler extends EnterBetweenBracesFinalHandler { + @Override protected boolean isApplicable(@NotNull PsiFile file, @NotNull Editor editor, CharSequence documentText, diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterBetweenBracesNoCommitDelegate.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterBetweenBracesNoCommitDelegate.java index 301260a4afe6..ec58df87721a 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterBetweenBracesNoCommitDelegate.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/EnterBetweenBracesNoCommitDelegate.java @@ -11,6 +11,7 @@ import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; public abstract class EnterBetweenBracesNoCommitDelegate extends EnterBetweenBracesDelegate { + @Override public boolean bracesAreInTheSameElement(@NotNull PsiFile file, @NotNull Editor editor, int lBraceOffset, int rBraceOffset) { final HighlighterIterator it = createBeforeIterator((EditorEx)editor, lBraceOffset + 1); while(!it.atEnd() && it.getStart() < rBraceOffset) { @@ -22,6 +23,7 @@ public abstract class EnterBetweenBracesNoCommitDelegate extends EnterBetweenBra return true; } + @Override public boolean isInComment(@NotNull PsiFile file, @NotNull Editor editor, int offset) { final HighlighterIterator it = createBeforeIterator((EditorEx)editor, offset); return !it.atEnd() && isCommentType(it.getTokenType()); @@ -29,6 +31,7 @@ public abstract class EnterBetweenBracesNoCommitDelegate extends EnterBetweenBra public abstract boolean isCommentType(IElementType type); + @Override protected void formatAtOffset(@NotNull PsiFile file, @NotNull Editor editor, int offset, Language language) { EnterHandler.adjustLineIndentNoCommit(language, editor.getDocument(), diff --git a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CollapseBlockHandlerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CollapseBlockHandlerImpl.java index 99b639904d17..b158f64dfd6e 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CollapseBlockHandlerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CollapseBlockHandlerImpl.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.codeInsight.folding.impl; import com.intellij.codeInsight.folding.CollapseBlockHandler; @@ -12,13 +10,13 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; - import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public abstract class CollapseBlockHandlerImpl implements CollapseBlockHandler { Logger LOG = Logger.getInstance("#com.intellij.codeInsight.folding.CollapseBlockHandler"); + @Override public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) { int[] targetCaretOffset = {-1}; editor.getFoldingModel().runBatchFoldingOperation(() -> { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/actions/CollapseBlockAction.java b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/actions/CollapseBlockAction.java index dee0f8672b5f..5266517b8e6e 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/actions/CollapseBlockAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/actions/CollapseBlockAction.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.codeInsight.folding.impl.actions; import com.intellij.codeInsight.CodeInsightActionHandler; @@ -20,12 +18,14 @@ public class CollapseBlockAction extends BaseCodeInsightAction { @Override protected CodeInsightActionHandler getHandler() { return new CodeInsightActionHandler() { + @Override public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) { executor(project, editor, file, true); } }; } + @Override protected boolean isValidForFile(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { return executor(project, editor, file, false); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceHighlighter.java b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceHighlighter.java index 42ab5e14278d..796a304b736f 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceHighlighter.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceHighlighter.java @@ -70,7 +70,7 @@ public class BraceHighlighter implements StartupActivity { DocumentListener documentListener = new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { myAlarm.cancelAllRequests(); Editor[] editors = EditorFactory.getInstance().getEditors(e.getDocument(), project); for (Editor editor : editors) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/HighlightManagerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/HighlightManagerImpl.java index e126dc96f32f..dd016f32c4b5 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/HighlightManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/HighlightManagerImpl.java @@ -47,7 +47,7 @@ public class HighlightManagerImpl extends HighlightManager { DocumentListener documentListener = new DocumentListener() { @Override - public void documentChanged(DocumentEvent event) { + public void documentChanged(@NotNull DocumentEvent event) { Document document = event.getDocument(); Editor[] editors = EditorFactory.getInstance().getEditors(document); for (Editor editor : editors) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hint/NextParameterAfterCompletionHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/hint/NextParameterAfterCompletionHandler.java index 1b67f0dd9b66..b6ac36576690 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/hint/NextParameterAfterCompletionHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/hint/NextParameterAfterCompletionHandler.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.codeInsight.hint; import com.intellij.openapi.actionSystem.ActionManager; @@ -32,7 +32,7 @@ public class NextParameterAfterCompletionHandler extends EditorActionHandler { Ref documentChanged = new Ref<>(); DocumentListener listener = new DocumentListener() { @Override - public void documentChanged(DocumentEvent event) { + public void documentChanged(@NotNull DocumentEvent event) { if (event.getOldLength() > 0 || event.getNewLength() > 0) documentChanged.set(Boolean.TRUE); } }; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoController.java b/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoController.java index 8c054a63593b..bd00e64328f4 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoController.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoController.java @@ -154,7 +154,7 @@ public class ParameterInfoController extends UserDataHolderBase implements Visib myEditor.getDocument().addDocumentListener(new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { rescheduleUpdate(); } }, this); @@ -222,7 +222,7 @@ public class ParameterInfoController extends UserDataHolderBase implements Visib } mySingleParameterInfo = singleParameterInfo && myKeepOnHintHidden; - + Pair pos = myProvider.getBestPointPosition(myHint, myComponent.getParameterOwner(), myLbraceMarker.getStartOffset(), null, HintManager.ABOVE); HintHint hintHint = HintManagerImpl.createHintHint(myEditor, pos.getFirst(), myHint, pos.getSecond()); @@ -311,7 +311,7 @@ public class ParameterInfoController extends UserDataHolderBase implements Visib if (elementForUpdating != null) { myHandler.updateParameterInfo(elementForUpdating, context); - boolean knownParameter = (myComponent.getObjects().length == 1 || myComponent.getHighlighted() != null) && + boolean knownParameter = (myComponent.getObjects().length == 1 || myComponent.getHighlighted() != null) && myComponent.getCurrentParameterIndex() != -1; if (mySingleParameterInfo && !knownParameter && myHint.isVisible()) { hideHint(); @@ -381,7 +381,7 @@ public class ParameterInfoController extends UserDataHolderBase implements Visib if (argsList == null && !CodeInsightSettings.getInstance().SHOW_PARAMETER_NAME_HINTS_ON_COMPLETION) return; if (!myHint.isVisible()) AutoPopupController.getInstance(myProject).autoPopupParameterInfo(myEditor, null); - + offset = adjustOffsetToInlay(offset); VisualPosition visualPosition = myEditor.offsetToVisualPosition(offset); if (myEditor.getInlayModel().hasInlineElementAt(visualPosition)) { @@ -778,7 +778,7 @@ public class ParameterInfoController extends UserDataHolderBase implements Visib setBorder(JBUI.Borders.empty()); } - // foreground/background/font are used to style the popup (HintManagerImpl.createHintHint) + // foreground/background/font are used to style the popup (HintManagerImpl.createHintHint) @Override public Color getForeground() { return getComponentCount() == 0 ? super.getForeground() : getComponent(0).getForeground(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hint/ShowExpressionTypeHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/hint/ShowExpressionTypeHandler.java index 66acb2c7429c..ec04c0459124 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/hint/ShowExpressionTypeHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/hint/ShowExpressionTypeHandler.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.codeInsight.hint; @@ -58,6 +44,7 @@ public class ShowExpressionTypeHandler implements CodeInsightActionHandler { return false; } + @Override public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull PsiFile file) { ApplicationManager.getApplication().assertIsDispatchThread(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hints/settings/ParameterNameHintsConfigurable.java b/platform/lang-impl/src/com/intellij/codeInsight/hints/settings/ParameterNameHintsConfigurable.java index fa434ab1904a..a147ff9f7420 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/hints/settings/ParameterNameHintsConfigurable.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/hints/settings/ParameterNameHintsConfigurable.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.codeInsight.hints.settings; import com.intellij.codeInsight.CodeInsightBundle; @@ -48,8 +34,8 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.util.*; import java.util.List; +import java.util.*; import java.util.stream.Collectors; import static com.intellij.codeInsight.hints.HintUtilsKt.getBlackListInvalidLineNumbers; @@ -60,11 +46,11 @@ public class ParameterNameHintsConfigurable extends DialogWrapper { private JPanel myConfigurable; private ComboBox myCurrentLanguageCombo; - + private Map myEditors; private Map myIsValidPatterns; private Map myOptions; - + private JPanel myPanel; private CardLayout myCardLayout; @@ -77,7 +63,7 @@ public class ParameterNameHintsConfigurable extends DialogWrapper { super(null); setTitle("Configure Parameter Name Hints"); init(); - + if (selectedLanguage != null) { showLanguagePanel(selectedLanguage); myCurrentLanguageCombo.setSelectedItem(selectedLanguage); @@ -105,10 +91,10 @@ public class ParameterNameHintsConfigurable extends DialogWrapper { private void updateOkEnabled(@NotNull Language language, @NotNull EditorTextField editorTextField) { String text = editorTextField.getText(); List invalidLines = getBlackListInvalidLineNumbers(text); - + myIsValidPatterns.put(language, invalidLines.isEmpty()); boolean isEveryOneValid = !myIsValidPatterns.containsValue(false); - + getOKAction().setEnabled(isEveryOneValid); Editor editor = editorTextField.getEditor(); @@ -135,7 +121,7 @@ public class ParameterNameHintsConfigurable extends DialogWrapper { String blacklist = editor.getText(); storeBlackListDiff(language, blacklist); }); - + myOptions.forEach((option, checkBox) -> option.set(checkBox.isSelected())); saveLastEditedLanguage(); ParameterHintsPassFactory.forceHintsUpdateOnNextPass(); @@ -227,7 +213,7 @@ public class ParameterNameHintsConfigurable extends DialogWrapper { if (optionsPanel != null) { panel.add(optionsPanel); } - + return panel; } @@ -241,12 +227,12 @@ public class ParameterNameHintsConfigurable extends DialogWrapper { EditorTextField editorTextField = createBlacklistEditorField(blackList); editorTextField.addDocumentListener(new DocumentListener() { @Override - public void documentChanged(DocumentEvent e) { + public void documentChanged(@NotNull DocumentEvent e) { updateOkEnabled(language, editorTextField); } }); updateOkEnabled(language, editorTextField); - + myEditors.put(language, editorTextField); JPanel blacklistPanel = new JPanel(); @@ -343,7 +329,7 @@ public class ParameterNameHintsConfigurable extends DialogWrapper { private void initLanguageCombo(Language selected, List languages) { ListComboBoxModel model = new ListComboBoxModel<>(languages); - + myCurrentLanguageCombo = new ComboBox<>(model); myCurrentLanguageCombo.setSelectedItem(selected); myCurrentLanguageCombo.setRenderer(new ListCellRendererWrapper() { @@ -367,7 +353,7 @@ public class ParameterNameHintsConfigurable extends DialogWrapper { private void showLanguagePanel(@NotNull Language language) { myCardLayout.show(myPanel, language.getID()); } - + private static List