diff --git a/platform/platform-api/src/com/intellij/codeInsight/breadcrumbs/FileBreadcrumbsCollector.java b/platform/platform-api/src/com/intellij/codeInsight/breadcrumbs/FileBreadcrumbsCollector.java index c6808c70c2fc..f06b32c5fcc0 100644 --- a/platform/platform-api/src/com/intellij/codeInsight/breadcrumbs/FileBreadcrumbsCollector.java +++ b/platform/platform-api/src/com/intellij/codeInsight/breadcrumbs/FileBreadcrumbsCollector.java @@ -1,4 +1,4 @@ -// Copyright 2000-2023 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.breadcrumbs; import com.intellij.openapi.Disposable; @@ -40,11 +40,10 @@ public abstract class FileBreadcrumbsCollector { @NotNull Disposable disposable, @NotNull Runnable changesHandler); - @NotNull - public abstract Iterable computeCrumbs(@NotNull VirtualFile virtualFile, - @NotNull Document document, - int offset, - @Nullable Boolean forcedShown); + public abstract @NotNull Iterable computeCrumbs(@NotNull VirtualFile virtualFile, + @NotNull Document document, + int offset, + @Nullable Boolean forcedShown); public static FileBreadcrumbsCollector findBreadcrumbsCollector(Project project, VirtualFile file) { if (file != null) { diff --git a/platform/platform-api/src/com/intellij/codeInsight/highlighting/TooltipLinkHandler.java b/platform/platform-api/src/com/intellij/codeInsight/highlighting/TooltipLinkHandler.java index 298ac328de07..359a57ab2b82 100644 --- a/platform/platform-api/src/com/intellij/codeInsight/highlighting/TooltipLinkHandler.java +++ b/platform/platform-api/src/com/intellij/codeInsight/highlighting/TooltipLinkHandler.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.highlighting; import com.intellij.codeInspection.util.InspectionMessage; @@ -29,8 +29,7 @@ public abstract class TooltipLinkHandler { * @param editor an editor in which tooltip with a link was shown. * @return detailed description to show. */ - @Nullable - public @InspectionMessage String getDescription(@NotNull String refSuffix, @NotNull Editor editor) { + public @Nullable @InspectionMessage String getDescription(@NotNull String refSuffix, @NotNull Editor editor) { return null; } @@ -41,9 +40,7 @@ public abstract class TooltipLinkHandler { * @param editor an editor in which tooltip with a link was shown. * @return title above detailed description in the expanded tooltip */ - @NotNull - @InspectionMessage - public String getDescriptionTitle(@NotNull String refSuffix, @NotNull Editor editor) { + public @NotNull @InspectionMessage String getDescriptionTitle(@NotNull String refSuffix, @NotNull Editor editor) { return IdeBundle.message("inspection.message.inspection.info"); } } diff --git a/platform/platform-api/src/com/intellij/execution/process/BinaryOSProcessHandler.java b/platform/platform-api/src/com/intellij/execution/process/BinaryOSProcessHandler.java index f54e157756e6..835095c22cd5 100644 --- a/platform/platform-api/src/com/intellij/execution/process/BinaryOSProcessHandler.java +++ b/platform/platform-api/src/com/intellij/execution/process/BinaryOSProcessHandler.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.execution.process; import com.intellij.execution.ExecutionException; @@ -28,9 +28,8 @@ public class BinaryOSProcessHandler extends OSProcessHandler { return myOutput.toByteArray(); } - @NotNull @Override - protected BaseDataReader createOutputDataReader() { + protected @NotNull BaseDataReader createOutputDataReader() { return new SimpleBinaryReader(myProcess.getInputStream(), readerOptions().policy()); } @@ -45,9 +44,8 @@ public class BinaryOSProcessHandler extends OSProcessHandler { myOutput.write(data, 0, size); } - @NotNull @Override - protected Future executeOnPooledThread(@NotNull Runnable runnable) { + protected @NotNull Future executeOnPooledThread(@NotNull Runnable runnable) { return BinaryOSProcessHandler.this.executeTask(runnable); } } diff --git a/platform/platform-api/src/com/intellij/execution/process/CapturingAnsiEscapesAwareProcessHandler.java b/platform/platform-api/src/com/intellij/execution/process/CapturingAnsiEscapesAwareProcessHandler.java index 76ba85281c00..631409f2f2e9 100644 --- a/platform/platform-api/src/com/intellij/execution/process/CapturingAnsiEscapesAwareProcessHandler.java +++ b/platform/platform-api/src/com/intellij/execution/process/CapturingAnsiEscapesAwareProcessHandler.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.execution.process; import com.intellij.execution.ExecutionException; @@ -43,8 +29,7 @@ public class CapturingAnsiEscapesAwareProcessHandler extends CapturingProcessHan protected static class AnsiEscapesAwareAdapter extends CapturingProcessAdapter implements AnsiEscapeDecoder.ColoredTextAcceptor { private final AnsiEscapeDecoder myAnsiEscapeDecoder = new AnsiEscapeDecoder() { @Override - @NotNull - protected Key getCurrentOutputAttributes(@NotNull Key outputType) { + protected @NotNull Key getCurrentOutputAttributes(@NotNull Key outputType) { return outputType; //we don't need color information - only stdout and stderr keys are added to output in CapturingProcessAdapter } }; diff --git a/platform/platform-api/src/com/intellij/execution/process/ConsoleHighlighter.java b/platform/platform-api/src/com/intellij/execution/process/ConsoleHighlighter.java index 1a29556bcae3..14883a625dc0 100644 --- a/platform/platform-api/src/com/intellij/execution/process/ConsoleHighlighter.java +++ b/platform/platform-api/src/com/intellij/execution/process/ConsoleHighlighter.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.execution.process; import com.intellij.execution.ui.ConsoleViewContentType; @@ -6,24 +6,24 @@ import com.intellij.openapi.editor.colors.TextAttributesKey; import org.jetbrains.annotations.NonNls; public final class ConsoleHighlighter { - @NonNls static final String BLACK_ID = "CONSOLE_BLACK_OUTPUT"; - @NonNls static final String RED_ID = "CONSOLE_RED_OUTPUT"; - @NonNls static final String GREEN_ID = "CONSOLE_GREEN_OUTPUT"; - @NonNls static final String YELLOW_ID = "CONSOLE_YELLOW_OUTPUT"; - @NonNls static final String BLUE_ID = "CONSOLE_BLUE_OUTPUT"; - @NonNls static final String MAGENTA_ID = "CONSOLE_MAGENTA_OUTPUT"; - @NonNls static final String CYAN_ID = "CONSOLE_CYAN_OUTPUT"; - @NonNls static final String GRAY_ID = "CONSOLE_GRAY_OUTPUT"; //ISO white + static final @NonNls String BLACK_ID = "CONSOLE_BLACK_OUTPUT"; + static final @NonNls String RED_ID = "CONSOLE_RED_OUTPUT"; + static final @NonNls String GREEN_ID = "CONSOLE_GREEN_OUTPUT"; + static final @NonNls String YELLOW_ID = "CONSOLE_YELLOW_OUTPUT"; + static final @NonNls String BLUE_ID = "CONSOLE_BLUE_OUTPUT"; + static final @NonNls String MAGENTA_ID = "CONSOLE_MAGENTA_OUTPUT"; + static final @NonNls String CYAN_ID = "CONSOLE_CYAN_OUTPUT"; + static final @NonNls String GRAY_ID = "CONSOLE_GRAY_OUTPUT"; //ISO white - @NonNls static final String DARKGRAY_ID = "CONSOLE_DARKGRAY_OUTPUT"; - @NonNls static final String RED_BRIGHT_ID = "CONSOLE_RED_BRIGHT_OUTPUT"; - @NonNls static final String GREEN_BRIGHT_ID = "CONSOLE_GREEN_BRIGHT_OUTPUT"; - @NonNls static final String YELLOW_BRIGHT_ID = "CONSOLE_YELLOW_BRIGHT_OUTPUT"; - @NonNls static final String BLUE_BRIGHT_ID = "CONSOLE_BLUE_BRIGHT_OUTPUT"; - @NonNls static final String MAGENTA_BRIGHT_ID = "CONSOLE_MAGENTA_BRIGHT_OUTPUT"; - @NonNls static final String CYAN_BRIGHT_ID = "CONSOLE_CYAN_BRIGHT_OUTPUT"; - @NonNls static final String WHITE_ID = "CONSOLE_WHITE_OUTPUT"; //ISO bright white + static final @NonNls String DARKGRAY_ID = "CONSOLE_DARKGRAY_OUTPUT"; + static final @NonNls String RED_BRIGHT_ID = "CONSOLE_RED_BRIGHT_OUTPUT"; + static final @NonNls String GREEN_BRIGHT_ID = "CONSOLE_GREEN_BRIGHT_OUTPUT"; + static final @NonNls String YELLOW_BRIGHT_ID = "CONSOLE_YELLOW_BRIGHT_OUTPUT"; + static final @NonNls String BLUE_BRIGHT_ID = "CONSOLE_BLUE_BRIGHT_OUTPUT"; + static final @NonNls String MAGENTA_BRIGHT_ID = "CONSOLE_MAGENTA_BRIGHT_OUTPUT"; + static final @NonNls String CYAN_BRIGHT_ID = "CONSOLE_CYAN_BRIGHT_OUTPUT"; + static final @NonNls String WHITE_ID = "CONSOLE_WHITE_OUTPUT"; //ISO bright white public static final TextAttributesKey BLACK = TextAttributesKey.createTextAttributesKey(BLACK_ID, ConsoleViewContentType.NORMAL_OUTPUT_KEY); diff --git a/platform/platform-api/src/com/intellij/execution/process/OSProcessManager.java b/platform/platform-api/src/com/intellij/execution/process/OSProcessManager.java index 3867267afdb6..187c42fa221f 100644 --- a/platform/platform-api/src/com/intellij/execution/process/OSProcessManager.java +++ b/platform/platform-api/src/com/intellij/execution/process/OSProcessManager.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.execution.process; import com.intellij.openapi.application.ApplicationManager; @@ -19,6 +19,5 @@ public abstract class OSProcessManager { * @deprecated Use {@link OSProcessUtil#getProcessList()} and then {@link ProcessInfo#getCommandLine()} on items */ @Deprecated(forRemoval = true) - @NotNull - public abstract List getCommandLinesOfRunningProcesses(); + public abstract @NotNull List getCommandLinesOfRunningProcesses(); } \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/execution/process/ProcessHandlerFactory.java b/platform/platform-api/src/com/intellij/execution/process/ProcessHandlerFactory.java index 479f94086e57..0a6f39c3d9b6 100644 --- a/platform/platform-api/src/com/intellij/execution/process/ProcessHandlerFactory.java +++ b/platform/platform-api/src/com/intellij/execution/process/ProcessHandlerFactory.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.execution.process; import com.intellij.execution.ExecutionException; @@ -15,13 +15,11 @@ public abstract class ProcessHandlerFactory { /** * Returns a new instance of the {@link OSProcessHandler}. */ - @NotNull - public abstract OSProcessHandler createProcessHandler(@NotNull GeneralCommandLine commandLine) throws ExecutionException; + public abstract @NotNull OSProcessHandler createProcessHandler(@NotNull GeneralCommandLine commandLine) throws ExecutionException; /** * Returns a new instance of the {@link OSProcessHandler} which is aware of ANSI coloring output. */ - @NotNull - public abstract OSProcessHandler createColoredProcessHandler(@NotNull GeneralCommandLine commandLine) throws ExecutionException; + public abstract @NotNull OSProcessHandler createColoredProcessHandler(@NotNull GeneralCommandLine commandLine) throws ExecutionException; } diff --git a/platform/platform-api/src/com/intellij/execution/ui/FragmentedSettingsBuilder.java b/platform/platform-api/src/com/intellij/execution/ui/FragmentedSettingsBuilder.java index e29ea917161b..058d07dc8c40 100644 --- a/platform/platform-api/src/com/intellij/execution/ui/FragmentedSettingsBuilder.java +++ b/platform/platform-api/src/com/intellij/execution/ui/FragmentedSettingsBuilder.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.execution.ui; import com.intellij.ide.DataManager; @@ -268,15 +268,13 @@ public class FragmentedSettingsBuilder impl myConfigId = configId; } - @NotNull - private static @NlsContexts.PopupAdvertisement String getHint(AnAction action) { + private static @NotNull @NlsContexts.PopupAdvertisement String getHint(AnAction action) { return (action != null && StringUtil.isNotEmpty(action.getTemplatePresentation().getDescription())) ? action.getTemplatePresentation().getDescription() : ""; } - @NotNull - private DefaultActionGroup buildGroup(List> fragments, - Ref lastSelected) { + private @NotNull DefaultActionGroup buildGroup(List> fragments, + Ref lastSelected) { fragments.sort(Comparator.comparingInt(SettingsEditorFragment::getMenuPosition)); DefaultActionGroup actionGroup = new DefaultActionGroup(); String group = null; diff --git a/platform/platform-api/src/com/intellij/execution/ui/SettingsEditorFragment.java b/platform/platform-api/src/com/intellij/execution/ui/SettingsEditorFragment.java index 0adda8569b18..d02110a331b6 100644 --- a/platform/platform-api/src/com/intellij/execution/ui/SettingsEditorFragment.java +++ b/platform/platform-api/src/com/intellij/execution/ui/SettingsEditorFragment.java @@ -163,13 +163,11 @@ public class SettingsEditorFragment extends Sett return myId; } - @Nls - public String getName() { + public @Nls String getName() { return myName; } - @Nls - public String getGroup() { + public @Nls String getGroup() { return myGroup; } @@ -205,8 +203,7 @@ public class SettingsEditorFragment extends Sett return myPriority; } - @Nullable - public ActionGroup getCustomActionGroup() { + public @Nullable ActionGroup getCustomActionGroup() { return null; } diff --git a/platform/platform-api/src/com/intellij/execution/ui/TagButton.java b/platform/platform-api/src/com/intellij/execution/ui/TagButton.java index 3742e48e1738..f3c5ab85ec9d 100644 --- a/platform/platform-api/src/com/intellij/execution/ui/TagButton.java +++ b/platform/platform-api/src/com/intellij/execution/ui/TagButton.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.execution.ui; import com.intellij.icons.AllIcons; @@ -120,8 +120,7 @@ public class TagButton extends JBLayeredPane implements Disposable { myButton.setToolTipText(toolTip); } - @Nls - public String getText() { + public @Nls String getText() { return myText; } diff --git a/platform/platform-api/src/com/intellij/execution/ui/VariantTagFragment.java b/platform/platform-api/src/com/intellij/execution/ui/VariantTagFragment.java index f2537fed62f1..e8f518b6e93f 100644 --- a/platform/platform-api/src/com/intellij/execution/ui/VariantTagFragment.java +++ b/platform/platform-api/src/com/intellij/execution/ui/VariantTagFragment.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.execution.ui; import com.intellij.ide.DataManager; @@ -111,18 +111,15 @@ public class VariantTagFragment extends SettingsEditorFragment myDependencies; + private @NotNull String myId; + private @Nullable String myDisplayName; + private final @Nullable String myGroupId; + private @Nullable String myTipId; + private @Nullable Set myDependencies; private int myDaysBeforeFirstShowUp = 1; private int myDaysBetweenSuccessiveShowUps = 3; private int myMinUsageCount = 1; @@ -29,23 +29,23 @@ public class FeatureDescriptor { private long myLastTimeShown; private long myLastTimeUsed; private int myShownCount; - @Nullable private final ProductivityFeaturesProvider myProvider; + private final @Nullable ProductivityFeaturesProvider myProvider; - @NonNls private static final String ATTRIBUTE_COUNT = "count"; - @NonNls private static final String ATTRIBUTE_LAST_SHOWN = "last-shown"; - @NonNls private static final String ATTRIBUTE_LAST_USED = "last-used"; - @NonNls private static final String ATTRIBUTE_SHOWN_COUNT = "shown-count"; - @NonNls private static final String ATTRIBUTE_ID = "id"; - @NonNls private static final String ATTRIBUTE_TIP_ID = "tip-id"; - @NonNls private static final String ATTRIBUTE_FIRST_SHOW = "first-show"; - @NonNls private static final String ATTRIBUTE_SUCCESSIVE_SHOW = "successive-show"; - @NonNls private static final String ATTRIBUTE_MIN_USAGE_COUNT = "min-usage-count"; - @NonNls private static final String ATTRIBUTE_UTILITY_SCORE = "utility-score"; - @NonNls private static final String ATTRIBUTE_SHOW_IN_GUIDE = "show-in-guide"; - @NonNls private static final String ATTRIBUTE_CLASS_NAME = "class-name"; - @NonNls private static final String ELEMENT_DEPENDENCY = "dependency"; - @NonNls private static final String ELEMENT_TRACK_ACTION = "track-action"; - @NonNls private static final String ELEMENT_TRACK_INTENTION = "track-intention"; + private static final @NonNls String ATTRIBUTE_COUNT = "count"; + private static final @NonNls String ATTRIBUTE_LAST_SHOWN = "last-shown"; + private static final @NonNls String ATTRIBUTE_LAST_USED = "last-used"; + private static final @NonNls String ATTRIBUTE_SHOWN_COUNT = "shown-count"; + private static final @NonNls String ATTRIBUTE_ID = "id"; + private static final @NonNls String ATTRIBUTE_TIP_ID = "tip-id"; + private static final @NonNls String ATTRIBUTE_FIRST_SHOW = "first-show"; + private static final @NonNls String ATTRIBUTE_SUCCESSIVE_SHOW = "successive-show"; + private static final @NonNls String ATTRIBUTE_MIN_USAGE_COUNT = "min-usage-count"; + private static final @NonNls String ATTRIBUTE_UTILITY_SCORE = "utility-score"; + private static final @NonNls String ATTRIBUTE_SHOW_IN_GUIDE = "show-in-guide"; + private static final @NonNls String ATTRIBUTE_CLASS_NAME = "class-name"; + private static final @NonNls String ELEMENT_DEPENDENCY = "dependency"; + private static final @NonNls String ELEMENT_TRACK_ACTION = "track-action"; + private static final @NonNls String ELEMENT_TRACK_INTENTION = "track-intention"; FeatureDescriptor(@NotNull GroupDescriptor group, @Nullable ProductivityFeaturesProvider provider, @NotNull Element featureElement) { myGroupId = group.getId(); @@ -121,8 +121,7 @@ public class FeatureDescriptor { } } - @NotNull - public String getId() { + public @NotNull String getId() { return myId; } @@ -150,8 +149,7 @@ public class FeatureDescriptor { return myIntentionEvents; } - @NotNull - public String getDisplayName() { + public @NotNull String getDisplayName() { if (myDisplayName == null) { myDisplayName = FeatureStatisticsBundle.message(myId); } diff --git a/platform/platform-api/src/com/intellij/featureStatistics/GroupDescriptor.java b/platform/platform-api/src/com/intellij/featureStatistics/GroupDescriptor.java index 307c9583c006..ba1ae34d689f 100644 --- a/platform/platform-api/src/com/intellij/featureStatistics/GroupDescriptor.java +++ b/platform/platform-api/src/com/intellij/featureStatistics/GroupDescriptor.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.featureStatistics; import org.jdom.Element; @@ -21,9 +7,9 @@ import org.jetbrains.annotations.NonNls; public class GroupDescriptor { private String myId; - @Nls private String myDisplayName; - @NonNls protected static final String ID_ATTR = "id"; - @NonNls private static final String GROUP_PREFIX = "group."; + private @Nls String myDisplayName; + protected static final @NonNls String ID_ATTR = "id"; + private static final @NonNls String GROUP_PREFIX = "group."; GroupDescriptor() { } @@ -41,8 +27,7 @@ public class GroupDescriptor { return myId; } - @Nls - public String getDisplayName() { + public @Nls String getDisplayName() { if (myDisplayName == null) { myDisplayName = FeatureStatisticsBundle.message(GROUP_PREFIX + myId); } diff --git a/platform/platform-api/src/com/intellij/featureStatistics/ProductivityFeaturesRegistry.java b/platform/platform-api/src/com/intellij/featureStatistics/ProductivityFeaturesRegistry.java index 01c6022868dc..cc725d791c93 100644 --- a/platform/platform-api/src/com/intellij/featureStatistics/ProductivityFeaturesRegistry.java +++ b/platform/platform-api/src/com/intellij/featureStatistics/ProductivityFeaturesRegistry.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.featureStatistics; import com.intellij.openapi.application.ApplicationManager; @@ -8,8 +8,7 @@ import org.jetbrains.annotations.Nullable; import java.util.Set; public abstract class ProductivityFeaturesRegistry { - @NotNull - public abstract Set getFeatureIds(); + public abstract @NotNull Set getFeatureIds(); public abstract FeatureDescriptor getFeatureDescriptor(@NotNull String id); diff --git a/platform/platform-api/src/com/intellij/ide/ExporterToTextFile.java b/platform/platform-api/src/com/intellij/ide/ExporterToTextFile.java index c8db680fbf4e..902494112585 100644 --- a/platform/platform-api/src/com/intellij/ide/ExporterToTextFile.java +++ b/platform/platform-api/src/com/intellij/ide/ExporterToTextFile.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide; import org.jetbrains.annotations.NotNull; @@ -11,8 +9,7 @@ import javax.swing.event.ChangeListener; import java.util.TooManyListenersException; public interface ExporterToTextFile { - @Nullable - default JComponent getSettingsEditor() { + default @Nullable JComponent getSettingsEditor() { return null; } diff --git a/platform/platform-api/src/com/intellij/ide/FileEditorSelectInContext.java b/platform/platform-api/src/com/intellij/ide/FileEditorSelectInContext.java index 29852077f57b..0ac57f53d7ac 100644 --- a/platform/platform-api/src/com/intellij/ide/FileEditorSelectInContext.java +++ b/platform/platform-api/src/com/intellij/ide/FileEditorSelectInContext.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide; import com.intellij.lang.injection.InjectedLanguageManager; @@ -23,21 +23,18 @@ public class FileEditorSelectInContext extends SmartSelectInContext { editor = fileEditor instanceof TextEditor ? (TextEditor)fileEditor : null; } - @Nullable @Override - public Object getSelectorInFile() { + public @Nullable Object getSelectorInFile() { PsiFile file = getPsiFile(); return file == null ? null : ObjectUtils.notNull(getElementAtCaret(file, false), file); } - @Nullable - public PsiElement getElementAtCaret(boolean tryInjected) { + public @Nullable PsiElement getElementAtCaret(boolean tryInjected) { PsiFile file = getPsiFile(); return file == null ? null : getElementAtCaret(file, tryInjected); } - @Nullable - private PsiElement getElementAtCaret(@NotNull PsiFile file, boolean tryInjected) { + private @Nullable PsiElement getElementAtCaret(@NotNull PsiFile file, boolean tryInjected) { Editor editor = getEditor(); if (editor == null) return null; int offset = editor.getCaretModel().getOffset(); @@ -53,8 +50,7 @@ public class FileEditorSelectInContext extends SmartSelectInContext { return elementAt; } - @Nullable - public Editor getEditor() { + public @Nullable Editor getEditor() { return editor == null ? null : editor.getEditor(); } } diff --git a/platform/platform-api/src/com/intellij/ide/FileSelectInContext.java b/platform/platform-api/src/com/intellij/ide/FileSelectInContext.java index 55c0bd80902c..ad7e3f80aa38 100644 --- a/platform/platform-api/src/com/intellij/ide/FileSelectInContext.java +++ b/platform/platform-api/src/com/intellij/ide/FileSelectInContext.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide; import com.intellij.notebook.editor.BackedVirtualFile; @@ -33,27 +33,23 @@ public class FileSelectInContext implements SelectInContext { myProvider = provider; } - @NotNull @Override - public Project getProject() { + public @NotNull Project getProject() { return myProject; } - @NotNull @Override - public VirtualFile getVirtualFile() { + public @NotNull VirtualFile getVirtualFile() { return myFile; } - @Nullable @Override - public Object getSelectorInFile() { + public @Nullable Object getSelectorInFile() { return null; } - @Nullable @Override - public FileEditorProvider getFileEditorProvider() { + public @Nullable FileEditorProvider getFileEditorProvider() { return myProvider; } diff --git a/platform/platform-api/src/com/intellij/ide/OccurenceNavigator.java b/platform/platform-api/src/com/intellij/ide/OccurenceNavigator.java index ddb836436cbb..78508c1a6930 100644 --- a/platform/platform-api/src/com/intellij/ide/OccurenceNavigator.java +++ b/platform/platform-api/src/com/intellij/ide/OccurenceNavigator.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide; import com.intellij.openapi.actionSystem.ActionUpdateThread; @@ -43,15 +29,13 @@ public interface OccurenceNavigator extends ActionUpdateThreadAware { return null; } - @NotNull @Override - public String getNextOccurenceActionName() { + public @NotNull String getNextOccurenceActionName() { return ""; } - @NotNull @Override - public String getPreviousOccurenceActionName() { + public @NotNull String getPreviousOccurenceActionName() { return ""; } diff --git a/platform/platform-api/src/com/intellij/ide/OccurenceNavigatorSupport.java b/platform/platform-api/src/com/intellij/ide/OccurenceNavigatorSupport.java index 3b9667313def..96e7643c868d 100644 --- a/platform/platform-api/src/com/intellij/ide/OccurenceNavigatorSupport.java +++ b/platform/platform-api/src/com/intellij/ide/OccurenceNavigatorSupport.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide; import com.intellij.pom.Navigatable; @@ -33,8 +19,7 @@ public abstract class OccurenceNavigatorSupport implements OccurenceNavigator { myTree = tree; } - @Nullable - protected abstract Navigatable createDescriptorForNode(@NotNull DefaultMutableTreeNode node); + protected abstract @Nullable Navigatable createDescriptorForNode(@NotNull DefaultMutableTreeNode node); /** * @return true if this node is an actual occurrence, i.e. the "next/prev occurrence" actions should show this node (as opposed to groups or other nodes which should be skipped) @@ -68,8 +53,7 @@ public abstract class OccurenceNavigatorSupport implements OccurenceNavigator { return new OccurenceInfo(editSourceDescriptor, counters.myFoundOccurenceNumber, counters.myOccurencesCount); } - @NotNull - private Counters calculatePosition(@NotNull DefaultMutableTreeNode foundNode) { + private @NotNull Counters calculatePosition(@NotNull DefaultMutableTreeNode foundNode) { Counters counters = new Counters(); @SuppressWarnings("unchecked") Enumeration enumeration = ((DefaultMutableTreeNode)foundNode.getRoot()).preorderEnumeration(); diff --git a/platform/platform-api/src/com/intellij/ide/SearchTopHitProvider.java b/platform/platform-api/src/com/intellij/ide/SearchTopHitProvider.java index 47d49479a481..6081b129c902 100644 --- a/platform/platform-api/src/com/intellij/ide/SearchTopHitProvider.java +++ b/platform/platform-api/src/com/intellij/ide/SearchTopHitProvider.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide; import com.intellij.openapi.extensions.ExtensionPointName; @@ -17,8 +17,7 @@ public interface SearchTopHitProvider { void consumeTopHits(@NotNull String pattern, @NotNull Consumer collector, @Nullable Project project); - @NlsSafe - static String getTopHitAccelerator() { + static @NlsSafe String getTopHitAccelerator() { return "/"; } } diff --git a/platform/platform-api/src/com/intellij/ide/SelectInManager.java b/platform/platform-api/src/com/intellij/ide/SelectInManager.java index 6f5f4675f1f1..ef410e3754df 100644 --- a/platform/platform-api/src/com/intellij/ide/SelectInManager.java +++ b/platform/platform-api/src/com/intellij/ide/SelectInManager.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide; import com.intellij.openapi.components.Service; @@ -21,8 +21,7 @@ public final class SelectInManager { /** * @deprecated Use {@link #getProject()} instead */ - @Deprecated(forRemoval = true) - @NonNls public static final String PROJECT = getProject(); + @Deprecated(forRemoval = true) public static final @NonNls String PROJECT = getProject(); public SelectInManager(@NotNull Project project) { myProject = project; @@ -33,8 +32,7 @@ public final class SelectInManager { myTargets.removeExplicitExtension(target); } - @NotNull - public List getTargetList() { + public @NotNull List getTargetList() { List targets = new ArrayList<>(myTargets.getExtensions()); if (DumbService.getInstance(myProject).isDumb()) { targets.removeIf(target -> !DumbService.isDumbAware(target)); diff --git a/platform/platform-api/src/com/intellij/ide/SelectInTarget.java b/platform/platform-api/src/com/intellij/ide/SelectInTarget.java index 7b9a21ebd6ca..2f3d63c2e657 100644 --- a/platform/platform-api/src/com/intellij/ide/SelectInTarget.java +++ b/platform/platform-api/src/com/intellij/ide/SelectInTarget.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide; import com.intellij.openapi.extensions.ExtensionPointName; @@ -34,16 +20,12 @@ public interface SelectInTarget { void selectIn(SelectInContext context, final boolean requestFocus); /** Tool window this target is supposed to select in */ - @Nullable - @NonNls - default String getToolWindowId() { + default @Nullable @NonNls String getToolWindowId() { return null; } /** aux view id specific for tool window, e.g. Project/Packages/J2EE tab inside project View */ - @Nullable - @NonNls - default String getMinorViewId() { + default @Nullable @NonNls String getMinorViewId() { return null; } diff --git a/platform/platform-api/src/com/intellij/ide/SmartSelectInContext.java b/platform/platform-api/src/com/intellij/ide/SmartSelectInContext.java index c6f012ac04f8..dc2ab0169ede 100644 --- a/platform/platform-api/src/com/intellij/ide/SmartSelectInContext.java +++ b/platform/platform-api/src/com/intellij/ide/SmartSelectInContext.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide; import com.intellij.openapi.project.Project; @@ -37,7 +37,7 @@ public class SmartSelectInContext extends FileSelectInContext { return pointer.getElement(); } - @Nullable public PsiFile getPsiFile() { + public @Nullable PsiFile getPsiFile() { Object selector = pointer.getElement(); return selector instanceof PsiFile ? (PsiFile)selector : null; } diff --git a/platform/platform-api/src/com/intellij/ide/TextCopyProvider.java b/platform/platform-api/src/com/intellij/ide/TextCopyProvider.java index cafe82018a2a..f8fc544f2a1d 100644 --- a/platform/platform-api/src/com/intellij/ide/TextCopyProvider.java +++ b/platform/platform-api/src/com/intellij/ide/TextCopyProvider.java @@ -1,4 +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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide; import com.intellij.openapi.actionSystem.DataContext; @@ -22,8 +22,7 @@ public abstract class TextCopyProvider implements CopyProvider { * * @return collection of text blocks or null */ - @Nullable - public abstract Collection getTextLinesToCopy(); + public abstract @Nullable Collection getTextLinesToCopy(); @Override public void performCopy(@NotNull DataContext dataContext) { diff --git a/platform/platform-api/src/com/intellij/ide/TooltipTitle.java b/platform/platform-api/src/com/intellij/ide/TooltipTitle.java index 0b51898ab812..f9d065ea57a9 100644 --- a/platform/platform-api/src/com/intellij/ide/TooltipTitle.java +++ b/platform/platform-api/src/com/intellij/ide/TooltipTitle.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide; import com.intellij.openapi.util.NlsContext; @@ -8,7 +8,6 @@ import java.lang.annotation.ElementType; import java.lang.annotation.Target; @NlsContext(prefix = "tooltip.title") -@Nls(capitalization = Nls.Capitalization.Sentence) @Target({ElementType.TYPE_USE, ElementType.PARAMETER, ElementType.METHOD}) -public @interface TooltipTitle { +public @Nls(capitalization = Nls.Capitalization.Sentence) @interface TooltipTitle { } \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/ide/TypeNameEP.java b/platform/platform-api/src/com/intellij/ide/TypeNameEP.java index e4f37687aece..e2d7397cc108 100644 --- a/platform/platform-api/src/com/intellij/ide/TypeNameEP.java +++ b/platform/platform-api/src/com/intellij/ide/TypeNameEP.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide; import com.intellij.BundleBase; @@ -32,9 +32,7 @@ public final class TypeNameEP implements PluginAware { /** * Use {@link #resourceKey} for i18n. */ - @Attribute("name") - @Nls(capitalization = Nls.Capitalization.Title) - public String name; + @Attribute("name") public @Nls(capitalization = Nls.Capitalization.Title) String name; /** * If unspecified, plugin's {@code } will be used. @@ -42,9 +40,7 @@ public final class TypeNameEP implements PluginAware { @Attribute("resourceBundle") public String resourceBundle; - @Attribute("resourceKey") - @Nls(capitalization = Nls.Capitalization.Title) - public String resourceKey; + @Attribute("resourceKey") public @Nls(capitalization = Nls.Capitalization.Title) String resourceKey; private final NullableLazyValue myName = new NullableLazyValue<>() { @Override diff --git a/platform/platform-api/src/com/intellij/ide/actions/ContextHelpAction.java b/platform/platform-api/src/com/intellij/ide/actions/ContextHelpAction.java index f0cdd19c2239..4c4ee81d49b3 100644 --- a/platform/platform-api/src/com/intellij/ide/actions/ContextHelpAction.java +++ b/platform/platform-api/src/com/intellij/ide/actions/ContextHelpAction.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.actions; import com.intellij.CommonBundle; @@ -46,8 +32,7 @@ public class ContextHelpAction extends AnAction implements DumbAware, ActionRemo } } - @Nullable - protected String getHelpId(DataContext dataContext) { + protected @Nullable String getHelpId(DataContext dataContext) { return myHelpID != null ? myHelpID : PlatformCoreDataKeys.HELP_ID.getData(dataContext); } diff --git a/platform/platform-api/src/com/intellij/ide/actions/QuickSwitchSchemeAction.java b/platform/platform-api/src/com/intellij/ide/actions/QuickSwitchSchemeAction.java index 1c404046aef4..28b86be4afbc 100644 --- a/platform/platform-api/src/com/intellij/ide/actions/QuickSwitchSchemeAction.java +++ b/platform/platform-api/src/com/intellij/ide/actions/QuickSwitchSchemeAction.java @@ -17,7 +17,7 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; public abstract class QuickSwitchSchemeAction extends AnAction implements DumbAware { - private final static Condition DEFAULT_PRESELECT_ACTION = a -> { + private static final Condition DEFAULT_PRESELECT_ACTION = a -> { return a.getTemplatePresentation().getIcon() != AllIcons.Actions.Forward; }; @@ -63,8 +63,7 @@ public abstract class QuickSwitchSchemeAction extends AnAction implements DumbAw showPopup(e, popup); } - @Nullable - protected Condition preselectAction() { + protected @Nullable Condition preselectAction() { return DEFAULT_PRESELECT_ACTION; } @@ -82,8 +81,7 @@ public abstract class QuickSwitchSchemeAction extends AnAction implements DumbAw return JBPopupFactory.ActionSelectionAid.NUMBERING; } - @Nls(capitalization = Nls.Capitalization.Title) - protected String getPopupTitle(@NotNull AnActionEvent e) { + protected @Nls(capitalization = Nls.Capitalization.Title) String getPopupTitle(@NotNull AnActionEvent e) { return e.getPresentation().getText(); } diff --git a/platform/platform-api/src/com/intellij/ide/actions/exclusion/TreeNodeExclusionAction.java b/platform/platform-api/src/com/intellij/ide/actions/exclusion/TreeNodeExclusionAction.java index 7c8d898f65ae..8abe2953ce0c 100644 --- a/platform/platform-api/src/com/intellij/ide/actions/exclusion/TreeNodeExclusionAction.java +++ b/platform/platform-api/src/com/intellij/ide/actions/exclusion/TreeNodeExclusionAction.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.actions.exclusion; import com.intellij.ide.IdeBundle; @@ -16,7 +16,7 @@ import java.awt.*; import java.util.List; abstract class TreeNodeExclusionAction extends AnAction { - private final static Logger LOG = Logger.getInstance(TreeNodeExclusionAction.class); + private static final Logger LOG = Logger.getInstance(TreeNodeExclusionAction.class); private final boolean myIsExclude; diff --git a/platform/platform-api/src/com/intellij/ide/browsers/BrowserFamily.java b/platform/platform-api/src/com/intellij/ide/browsers/BrowserFamily.java index 3566dc1ac5ec..445556f65e29 100644 --- a/platform/platform-api/src/com/intellij/ide/browsers/BrowserFamily.java +++ b/platform/platform-api/src/com/intellij/ide/browsers/BrowserFamily.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.browsers; import com.intellij.icons.AllIcons; @@ -46,13 +46,11 @@ public enum BrowserFamily implements Iconable { myIcon = icon; } - @Nullable - public BrowserSpecificSettings createBrowserSpecificSettings() { + public @Nullable BrowserSpecificSettings createBrowserSpecificSettings() { return null; } - @Nullable - public String getExecutionPath() { + public @Nullable String getExecutionPath() { if (SystemInfo.isWindows) { return myWindowsPath; } diff --git a/platform/platform-api/src/com/intellij/ide/browsers/BrowserSpecificSettings.java b/platform/platform-api/src/com/intellij/ide/browsers/BrowserSpecificSettings.java index b7fd90ef3ade..fa2cc741d823 100644 --- a/platform/platform-api/src/com/intellij/ide/browsers/BrowserSpecificSettings.java +++ b/platform/platform-api/src/com/intellij/ide/browsers/BrowserSpecificSettings.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.browsers; import com.intellij.openapi.options.Configurable; @@ -23,16 +9,13 @@ import java.util.List; import java.util.Map; public abstract class BrowserSpecificSettings implements Cloneable { - @NotNull - public abstract Configurable createConfigurable(); + public abstract @NotNull Configurable createConfigurable(); - @NotNull - public List getAdditionalParameters() { + public @NotNull List getAdditionalParameters() { return Collections.emptyList(); } - @NotNull - public Map getEnvironmentVariables() { + public @NotNull Map getEnvironmentVariables() { return Collections.emptyMap(); } diff --git a/platform/platform-api/src/com/intellij/ide/browsers/WebBrowser.java b/platform/platform-api/src/com/intellij/ide/browsers/WebBrowser.java index c2cf804e69a5..d3864664d9a6 100644 --- a/platform/platform-api/src/com/intellij/ide/browsers/WebBrowser.java +++ b/platform/platform-api/src/com/intellij/ide/browsers/WebBrowser.java @@ -1,3 +1,4 @@ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.browsers; import com.intellij.openapi.util.NlsSafe; @@ -9,26 +10,19 @@ import java.util.List; import java.util.UUID; public abstract class WebBrowser { - @NotNull - public abstract @NlsSafe String getName(); + public abstract @NotNull @NlsSafe String getName(); - @NotNull - public abstract UUID getId(); + public abstract @NotNull UUID getId(); - @NotNull - public abstract BrowserFamily getFamily(); + public abstract @NotNull BrowserFamily getFamily(); - @NotNull - public abstract Icon getIcon(); + public abstract @NotNull Icon getIcon(); - @Nullable - public abstract @NlsSafe String getPath(); + public abstract @Nullable @NlsSafe String getPath(); - @NotNull - public abstract String getBrowserNotFoundMessage(); + public abstract @NotNull String getBrowserNotFoundMessage(); - @Nullable - public abstract BrowserSpecificSettings getSpecificSettings(); + public abstract @Nullable BrowserSpecificSettings getSpecificSettings(); public void addOpenUrlParameter(@NotNull List command, @NotNull String url) { command.add(url); diff --git a/platform/platform-api/src/com/intellij/ide/browsers/WebBrowserService.java b/platform/platform-api/src/com/intellij/ide/browsers/WebBrowserService.java index ba489825b083..1f43376f1981 100644 --- a/platform/platform-api/src/com/intellij/ide/browsers/WebBrowserService.java +++ b/platform/platform-api/src/com/intellij/ide/browsers/WebBrowserService.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.browsers; import com.intellij.lang.Language; @@ -13,8 +13,7 @@ public abstract class WebBrowserService { return ApplicationManager.getApplication().getService(WebBrowserService.class); } - @NotNull - public abstract Collection getUrlsToOpen(@NotNull OpenInBrowserRequest request, boolean preferLocalUrl) throws WebBrowserUrlProvider.BrowserException; + public abstract @NotNull Collection getUrlsToOpen(@NotNull OpenInBrowserRequest request, boolean preferLocalUrl) throws WebBrowserUrlProvider.BrowserException; @SuppressWarnings("unused") public static boolean isHtmlOrXmlLanguage(@NotNull Language language) { diff --git a/platform/platform-api/src/com/intellij/ide/browsers/chrome/ChromeSettings.java b/platform/platform-api/src/com/intellij/ide/browsers/chrome/ChromeSettings.java index 9b01b1ecc5a5..411dfa07e71f 100644 --- a/platform/platform-api/src/com/intellij/ide/browsers/chrome/ChromeSettings.java +++ b/platform/platform-api/src/com/intellij/ide/browsers/chrome/ChromeSettings.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.browsers.chrome; import com.intellij.ide.browsers.BrowserSpecificSettings; @@ -26,9 +26,8 @@ public final class ChromeSettings extends BrowserSpecificSettings { public ChromeSettings() { } - @Nullable @Tag("user-data-dir") - public String getUserDataDirectoryPath() { + public @Nullable String getUserDataDirectoryPath() { return myUserDataDirectoryPath; } @@ -37,9 +36,8 @@ public final class ChromeSettings extends BrowserSpecificSettings { return myUseCustomProfile; } - @Nullable @Tag("command-line-options") - public String getCommandLineOptions() { + public @Nullable String getCommandLineOptions() { return myCommandLineOptions; } @@ -55,9 +53,8 @@ public final class ChromeSettings extends BrowserSpecificSettings { myUseCustomProfile = useCustomProfile; } - @NotNull @Override - public List getAdditionalParameters() { + public @NotNull List getAdditionalParameters() { if (myCommandLineOptions == null) { if (myUseCustomProfile && myUserDataDirectoryPath != null) { return Collections.singletonList(USER_DATA_DIR_ARG + FileUtilRt.toSystemDependentName(myUserDataDirectoryPath)); @@ -75,19 +72,17 @@ public final class ChromeSettings extends BrowserSpecificSettings { } @Override - @NotNull @XMap(propertyElementName = "environment-variables") - public Map getEnvironmentVariables() { + public @NotNull Map getEnvironmentVariables() { return myEnvironmentVariables; } - public void setEnvironmentVariables(@NotNull final Map environmentVariables) { + public void setEnvironmentVariables(final @NotNull Map environmentVariables) { myEnvironmentVariables = environmentVariables; } - @NotNull @Override - public ChromeSettingsConfigurable createConfigurable() { + public @NotNull ChromeSettingsConfigurable createConfigurable() { return new ChromeSettingsConfigurable(this); } diff --git a/platform/platform-api/src/com/intellij/ide/browsers/chrome/ChromeSettingsConfigurable.java b/platform/platform-api/src/com/intellij/ide/browsers/chrome/ChromeSettingsConfigurable.java index 08df8acfc135..81fcbc666c3a 100644 --- a/platform/platform-api/src/com/intellij/ide/browsers/chrome/ChromeSettingsConfigurable.java +++ b/platform/platform-api/src/com/intellij/ide/browsers/chrome/ChromeSettingsConfigurable.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.browsers.chrome; import com.intellij.ide.IdeBundle; @@ -106,9 +106,8 @@ public class ChromeSettingsConfigurable implements Configurable { } } - @Nls @Override - public String getDisplayName() { + public @Nls String getDisplayName() { return IdeBundle.message("configurable.ChromeSettingsConfigurable.display.name"); } diff --git a/platform/platform-api/src/com/intellij/ide/browsers/firefox/FirefoxSettings.java b/platform/platform-api/src/com/intellij/ide/browsers/firefox/FirefoxSettings.java index df2bb63856fe..83bbfd21d9ac 100644 --- a/platform/platform-api/src/com/intellij/ide/browsers/firefox/FirefoxSettings.java +++ b/platform/platform-api/src/com/intellij/ide/browsers/firefox/FirefoxSettings.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.browsers.firefox; import com.intellij.ide.browsers.BrowserSpecificSettings; @@ -29,9 +29,8 @@ public final class FirefoxSettings extends BrowserSpecificSettings { myProfile = StringUtil.nullize(profile); } - @Nullable @Tag("profiles-ini-path") - public String getProfilesIniPath() { + public @Nullable String getProfilesIniPath() { return myProfilesIniPath; } @@ -39,9 +38,8 @@ public final class FirefoxSettings extends BrowserSpecificSettings { myProfilesIniPath = PathUtil.toSystemIndependentName(StringUtil.nullize(value)); } - @Nullable @Tag("profile") - public @NlsSafe String getProfile() { + public @Nullable @NlsSafe String getProfile() { return myProfile; } @@ -49,23 +47,20 @@ public final class FirefoxSettings extends BrowserSpecificSettings { myProfile = StringUtil.nullize(value); } - @NotNull @Override - public Configurable createConfigurable() { + public @NotNull Configurable createConfigurable() { return new FirefoxSettingsConfigurable(this); } - @Nullable - public File getProfilesIniFile() { + public @Nullable File getProfilesIniFile() { if (myProfilesIniPath != null) { return new File(FileUtil.toSystemDependentName(myProfilesIniPath)); } return FirefoxUtil.getDefaultProfileIniPath(); } - @NotNull @Override - public List getAdditionalParameters() { + public @NotNull List getAdditionalParameters() { List profiles = FirefoxUtil.computeProfiles(getProfilesIniFile()); if (profiles.size() >= 2) { FirefoxProfile profile = FirefoxUtil.findProfileByNameOrDefault(myProfile, profiles); diff --git a/platform/platform-api/src/com/intellij/ide/browsers/firefox/FirefoxSettingsConfigurable.java b/platform/platform-api/src/com/intellij/ide/browsers/firefox/FirefoxSettingsConfigurable.java index b7adbee5a2fc..0ffa588f9fca 100644 --- a/platform/platform-api/src/com/intellij/ide/browsers/firefox/FirefoxSettingsConfigurable.java +++ b/platform/platform-api/src/com/intellij/ide/browsers/firefox/FirefoxSettingsConfigurable.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.browsers.firefox; import com.intellij.ide.IdeBundle; @@ -65,14 +65,12 @@ public class FirefoxSettingsConfigurable implements Configurable { !Objects.equals(mySettings.getProfilesIniPath(), getConfiguredProfileIniPath()); } - @Nullable - private String getConfiguredProfileIniPath() { + private @Nullable String getConfiguredProfileIniPath() { String path = PathUtil.toSystemIndependentName(StringUtil.nullize(myProfilesIniPathField.getText())); return myDefaultProfilesIniPath.equals(path) ? null : path; } - @Nullable - private String getConfiguredProfileName() { + private @Nullable String getConfiguredProfileName() { String selected = (String)myProfileCombobox.getSelectedItem(); return Objects.equals(defaultProfile, selected) ? null : selected; } @@ -117,14 +115,12 @@ public class FirefoxSettingsConfigurable implements Configurable { } @Override - @Nls - public String getDisplayName() { + public @Nls String getDisplayName() { return IdeBundle.message("display.name.firefox.settings"); } - @Nullable @Override - public String getHelpTopic() { + public @Nullable String getHelpTopic() { return "reference.settings.ide.settings.web.browsers.edit"; } } diff --git a/platform/platform-api/src/com/intellij/ide/browsers/firefox/FirefoxUtil.java b/platform/platform-api/src/com/intellij/ide/browsers/firefox/FirefoxUtil.java index 7281a7998670..212b7ed7f188 100644 --- a/platform/platform-api/src/com/intellij/ide/browsers/firefox/FirefoxUtil.java +++ b/platform/platform-api/src/com/intellij/ide/browsers/firefox/FirefoxUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.browsers.firefox; import com.intellij.openapi.diagnostic.Logger; @@ -19,13 +19,12 @@ import java.util.List; public final class FirefoxUtil { private static final Logger LOG = Logger.getInstance(FirefoxUtil.class); - @NonNls public static final String PROFILES_INI_FILE = "profiles.ini"; + public static final @NonNls String PROFILES_INI_FILE = "profiles.ini"; private FirefoxUtil() { } - @Nullable - public static File getDefaultProfileIniPath() { + public static @Nullable File getDefaultProfileIniPath() { File[] roots = getProfilesDirs(); for (File profilesDir : roots) { File profilesFile = new File(profilesDir, PROFILES_INI_FILE); @@ -36,8 +35,7 @@ public final class FirefoxUtil { return null; } - @Nullable - public static File getFirefoxExtensionsDir(FirefoxSettings settings) { + public static @Nullable File getFirefoxExtensionsDir(FirefoxSettings settings) { File profilesFile = settings.getProfilesIniFile(); if (profilesFile != null && profilesFile.exists()) { List profiles = computeProfiles(profilesFile); @@ -52,8 +50,7 @@ public final class FirefoxUtil { return null; } - @Nullable - public static FirefoxProfile findProfileByNameOrDefault(@Nullable String name, @NotNull List profiles) { + public static @Nullable FirefoxProfile findProfileByNameOrDefault(@Nullable String name, @NotNull List profiles) { for (FirefoxProfile profile : profiles) { if (profile.getName().equals(name)) { return profile; @@ -62,8 +59,7 @@ public final class FirefoxUtil { return getDefaultProfile(profiles); } - @Nullable - public static FirefoxProfile getDefaultProfile(List profiles) { + public static @Nullable FirefoxProfile getDefaultProfile(List profiles) { if (profiles.isEmpty()) { return null; } @@ -76,8 +72,7 @@ public final class FirefoxUtil { return profiles.get(0); } - @NotNull - public static List computeProfiles(@Nullable File profilesFile) { + public static @NotNull List computeProfiles(@Nullable File profilesFile) { if (profilesFile == null || !profilesFile.isFile()) { return Collections.emptyList(); } diff --git a/platform/platform-api/src/com/intellij/ide/dnd/DnDManager.java b/platform/platform-api/src/com/intellij/ide/dnd/DnDManager.java index 76aa099c4291..58d150fdf14b 100644 --- a/platform/platform-api/src/com/intellij/ide/dnd/DnDManager.java +++ b/platform/platform-api/src/com/intellij/ide/dnd/DnDManager.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.dnd; import com.intellij.openapi.Disposable; @@ -30,6 +30,5 @@ public abstract class DnDManager { public abstract void unregisterTarget(DnDTarget target, JComponent component); - @Nullable - public abstract Component getLastDropHandler(); + public abstract @Nullable Component getLastDropHandler(); } diff --git a/platform/platform-api/src/com/intellij/ide/dnd/DnDNativeTarget.java b/platform/platform-api/src/com/intellij/ide/dnd/DnDNativeTarget.java index 41c6f7e75e74..bd05668ec295 100644 --- a/platform/platform-api/src/com/intellij/ide/dnd/DnDNativeTarget.java +++ b/platform/platform-api/src/com/intellij/ide/dnd/DnDNativeTarget.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.dnd; import com.intellij.openapi.diagnostic.Logger; @@ -30,8 +30,7 @@ public interface DnDNativeTarget extends DnDTarget { return myFlavors; } - @Nullable - public String getTextForFlavor(DataFlavor flavor) { + public @Nullable String getTextForFlavor(DataFlavor flavor) { if (myTexts.containsKey(flavor)) { return myTexts.get(flavor); } diff --git a/platform/platform-api/src/com/intellij/ide/dnd/DnDSupport.java b/platform/platform-api/src/com/intellij/ide/dnd/DnDSupport.java index 3c7ed5a388fc..66627d505595 100644 --- a/platform/platform-api/src/com/intellij/ide/dnd/DnDSupport.java +++ b/platform/platform-api/src/com/intellij/ide/dnd/DnDSupport.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.dnd; import com.intellij.openapi.Disposable; @@ -131,7 +131,7 @@ public final class DnDSupport implements DnDTarget, DnDSource, DnDDropHandler.Wi } private static final class DnDNativeTargetWrapper implements DnDNativeTarget, DnDDropHandler.WithResult { - @NotNull private final DnDSupport myTarget; + private final @NotNull DnDSupport myTarget; private DnDNativeTargetWrapper(@NotNull DnDSupport target) { myTarget = target; @@ -158,8 +158,7 @@ public final class DnDSupport implements DnDTarget, DnDSource, DnDDropHandler.Wi } } - @NotNull - public static DnDSupportBuilder createBuilder(@NotNull JComponent component) { + public static @NotNull DnDSupportBuilder createBuilder(@NotNull JComponent component) { final JComponent myComponent = component; final Ref asTarget = Ref.create(true); final Ref asSource = Ref.create(true); diff --git a/platform/platform-api/src/com/intellij/ide/errorTreeView/ErrorTreeElementKind.java b/platform/platform-api/src/com/intellij/ide/errorTreeView/ErrorTreeElementKind.java index 748abf80ad7a..3b825ebfd5c0 100644 --- a/platform/platform-api/src/com/intellij/ide/errorTreeView/ErrorTreeElementKind.java +++ b/platform/platform-api/src/com/intellij/ide/errorTreeView/ErrorTreeElementKind.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.errorTreeView; import com.intellij.icons.AllIcons; @@ -53,13 +39,11 @@ public enum ErrorTreeElementKind { return myPresentableText; } - @Nullable - public Icon getIcon() { + public @Nullable Icon getIcon() { return myIcon; } - @NotNull - public static ErrorTreeElementKind convertMessageFromCompilerErrorType(int type) { + public static @NotNull ErrorTreeElementKind convertMessageFromCompilerErrorType(int type) { return switch (type) { case MessageCategory.ERROR -> ERROR; case MessageCategory.WARNING -> WARNING; diff --git a/platform/platform-api/src/com/intellij/ide/errorTreeView/HotfixData.java b/platform/platform-api/src/com/intellij/ide/errorTreeView/HotfixData.java index dbc07dffa929..d28d93fb6395 100644 --- a/platform/platform-api/src/com/intellij/ide/errorTreeView/HotfixData.java +++ b/platform/platform-api/src/com/intellij/ide/errorTreeView/HotfixData.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.errorTreeView; import com.intellij.util.Consumer; @@ -11,8 +11,8 @@ public class HotfixData { private final @Nls String myFixComment; private final Consumer myFix; - public HotfixData(@NotNull final String id, - @NotNull final String errorText, + public HotfixData(final @NotNull String id, + final @NotNull String errorText, @NotNull @Nls String fixComment, final Consumer fix) { myErrorText = errorText; diff --git a/platform/platform-api/src/com/intellij/ide/errorTreeView/SimpleErrorData.java b/platform/platform-api/src/com/intellij/ide/errorTreeView/SimpleErrorData.java index 2bbd44a3cf31..6d236b3e46bb 100644 --- a/platform/platform-api/src/com/intellij/ide/errorTreeView/SimpleErrorData.java +++ b/platform/platform-api/src/com/intellij/ide/errorTreeView/SimpleErrorData.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.errorTreeView; import com.intellij.openapi.vfs.VirtualFile; @@ -29,8 +15,7 @@ public class SimpleErrorData { myVf = vf; } - @NotNull - public ErrorTreeElementKind getKind() { + public @NotNull ErrorTreeElementKind getKind() { return myKind; } diff --git a/platform/platform-api/src/com/intellij/ide/plugins/PluginReplacement.java b/platform/platform-api/src/com/intellij/ide/plugins/PluginReplacement.java index 2075a452ae3a..a4b8ca92ebc0 100644 --- a/platform/platform-api/src/com/intellij/ide/plugins/PluginReplacement.java +++ b/platform/platform-api/src/com/intellij/ide/plugins/PluginReplacement.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.plugins; import com.intellij.ide.IdeBundle; @@ -29,9 +29,7 @@ public abstract class PluginReplacement implements PluginAware { myNewPluginId = newPluginId; } - @NotNull - @Nls - public String getReplacementMessage(@NotNull IdeaPluginDescriptor oldPlugin, @NotNull IdeaPluginDescriptor newPlugin) { + public @NotNull @Nls String getReplacementMessage(@NotNull IdeaPluginDescriptor oldPlugin, @NotNull IdeaPluginDescriptor newPlugin) { return IdeBundle.message("plugin.manager.replace.plugin.0.by.plugin.1", oldPlugin.getName(), newPlugin.getName()); } diff --git a/platform/platform-api/src/com/intellij/ide/ui/LafManager.java b/platform/platform-api/src/com/intellij/ide/ui/LafManager.java index 58c43c83cda1..1b88936fa7b2 100644 --- a/platform/platform-api/src/com/intellij/ide/ui/LafManager.java +++ b/platform/platform-api/src/com/intellij/ide/ui/LafManager.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.ui; import com.intellij.ide.ui.laf.UIThemeLookAndFeelInfo; @@ -133,9 +133,7 @@ public abstract class LafManager { } - @Nullable - public abstract UIThemeLookAndFeelInfo getDefaultLightLaf(); + public abstract @Nullable UIThemeLookAndFeelInfo getDefaultLightLaf(); - @Nullable - public abstract UIThemeLookAndFeelInfo getDefaultDarkLaf(); + public abstract @Nullable UIThemeLookAndFeelInfo getDefaultDarkLaf(); } \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/ide/ui/ProductIcons.java b/platform/platform-api/src/com/intellij/ide/ui/ProductIcons.java index 13187a8a2450..2aa1c462eb22 100644 --- a/platform/platform-api/src/com/intellij/ide/ui/ProductIcons.java +++ b/platform/platform-api/src/com/intellij/ide/ui/ProductIcons.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.ui; import com.intellij.openapi.application.ApplicationManager; @@ -10,8 +10,7 @@ import javax.swing.*; * Provides icons which can be used to represent this IDE in different contexts. */ public interface ProductIcons { - @NotNull - static ProductIcons getInstance() { + static @NotNull ProductIcons getInstance() { return ApplicationManager.getApplication().getService(ProductIcons.class); } diff --git a/platform/platform-api/src/com/intellij/ide/ui/PublicFieldBasedOptionDescription.java b/platform/platform-api/src/com/intellij/ide/ui/PublicFieldBasedOptionDescription.java index cf835666ac67..ec0953e2d38a 100644 --- a/platform/platform-api/src/com/intellij/ide/ui/PublicFieldBasedOptionDescription.java +++ b/platform/platform-api/src/com/intellij/ide/ui/PublicFieldBasedOptionDescription.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.ui; import com.intellij.ide.ui.search.BooleanOptionDescription; @@ -18,8 +18,7 @@ public abstract class PublicFieldBasedOptionDescription extends BooleanOptionDes myFieldName = fieldName; } - @NotNull - public abstract Object getInstance(); + public abstract @NotNull Object getInstance(); protected void fireUpdated() { } diff --git a/platform/platform-api/src/com/intellij/ide/ui/SplitterProportionsDataImpl.java b/platform/platform-api/src/com/intellij/ide/ui/SplitterProportionsDataImpl.java index 54dd8880277d..2a577cb97f25 100644 --- a/platform/platform-api/src/com/intellij/ide/ui/SplitterProportionsDataImpl.java +++ b/platform/platform-api/src/com/intellij/ide/ui/SplitterProportionsDataImpl.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.ui; import com.intellij.ide.util.PropertiesComponent; @@ -8,19 +8,19 @@ import com.intellij.util.SmartList; import com.intellij.util.text.StringTokenizer; import com.intellij.util.xmlb.Converter; import com.intellij.util.xmlb.annotations.Tag; -import java.awt.Component; -import java.awt.Container; -import java.util.List; -import java.util.Objects; import org.jdom.Element; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; +import java.awt.*; +import java.util.List; +import java.util.Objects; + @Tag("splitter-proportions") public class SplitterProportionsDataImpl implements SplitterProportionsData { private static final String DATA_VERSION = "1"; - @NonNls private static final String ATTRIBUTE_PROPORTIONS = "proportions"; - @NonNls private static final String ATTRIBUTE_VERSION = "version"; + private static final @NonNls String ATTRIBUTE_PROPORTIONS = "proportions"; + private static final @NonNls String ATTRIBUTE_VERSION = "version"; private List proportions = new SmartList<>(); @@ -108,9 +108,8 @@ public class SplitterProportionsDataImpl implements SplitterProportionsData { } public static final class SplitterProportionsConverter extends Converter { - @NotNull @Override - public SplitterProportionsDataImpl fromString(@NotNull String value) { + public @NotNull SplitterProportionsDataImpl fromString(@NotNull String value) { SplitterProportionsDataImpl data = new SplitterProportionsDataImpl(); StringTokenizer tokenizer = new StringTokenizer(value, ","); while (tokenizer.hasMoreTokens()) { @@ -119,9 +118,8 @@ public class SplitterProportionsDataImpl implements SplitterProportionsData { return data; } - @NotNull @Override - public String toString(@NotNull SplitterProportionsDataImpl data) { + public @NotNull String toString(@NotNull SplitterProportionsDataImpl data) { StringBuilder result = new StringBuilder(); String sep = ""; for (Float proportion : data.proportions) { diff --git a/platform/platform-api/src/com/intellij/ide/ui/search/ActionFromOptionDescriptorProvider.java b/platform/platform-api/src/com/intellij/ide/ui/search/ActionFromOptionDescriptorProvider.java index 8d311a5936c5..abf62601d3e1 100644 --- a/platform/platform-api/src/com/intellij/ide/ui/search/ActionFromOptionDescriptorProvider.java +++ b/platform/platform-api/src/com/intellij/ide/ui/search/ActionFromOptionDescriptorProvider.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.ui.search; import com.intellij.openapi.actionSystem.AnAction; @@ -27,6 +13,5 @@ public abstract class ActionFromOptionDescriptorProvider { public static final ExtensionPointName EP = new ExtensionPointName<>("com.intellij.actionFromOptionDescriptorProvider"); - @Nullable - public abstract AnAction provide(@NotNull OptionDescription description); + public abstract @Nullable AnAction provide(@NotNull OptionDescription description); } diff --git a/platform/platform-api/src/com/intellij/ide/ui/search/OptionDescription.java b/platform/platform-api/src/com/intellij/ide/ui/search/OptionDescription.java index d28007fbd7b3..ab08b970d224 100644 --- a/platform/platform-api/src/com/intellij/ide/ui/search/OptionDescription.java +++ b/platform/platform-api/src/com/intellij/ide/ui/search/OptionDescription.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.ui.search; import com.intellij.openapi.util.NlsSafe; @@ -40,34 +40,27 @@ public class OptionDescription implements Comparable { myGroupName = groupName; } - @Nls - public String getOption() { + public @Nls String getOption() { return myOption; } - @NlsSafe - @Nullable - public final String getHit() { + public final @NlsSafe @Nullable String getHit() { return myHit; } - @Nullable - public final String getPath() { + public final @Nullable String getPath() { return myPath; } - @NonNls - public final String getConfigurableId() { + public final @NonNls String getConfigurableId() { return myConfigurableId; } - @Nls - public final String getGroupName() { + public final @Nls String getGroupName() { return myGroupName; } - @NlsSafe - public String getValue() { + public @NlsSafe String getValue() { return null; } diff --git a/platform/platform-api/src/com/intellij/ide/ui/search/SearchableOptionProcessor.java b/platform/platform-api/src/com/intellij/ide/ui/search/SearchableOptionProcessor.java index c2050e07c7dc..9a967b0be8de 100644 --- a/platform/platform-api/src/com/intellij/ide/ui/search/SearchableOptionProcessor.java +++ b/platform/platform-api/src/com/intellij/ide/ui/search/SearchableOptionProcessor.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.ui.search; import com.intellij.openapi.options.SearchableConfigurable; @@ -25,7 +25,7 @@ public abstract class SearchableOptionProcessor { public abstract void addOptions(@NotNull String text, @Nullable String path, @Nullable String hit, - @NonNls @NotNull final String configurableId, - @Nullable final String configurableDisplayName, + final @NonNls @NotNull String configurableId, + final @Nullable String configurableDisplayName, boolean applyStemming); } diff --git a/platform/platform-api/src/com/intellij/ide/util/BrowseFilesListener.java b/platform/platform-api/src/com/intellij/ide/util/BrowseFilesListener.java index 75afe2d03938..8df297f3e4f0 100644 --- a/platform/platform-api/src/com/intellij/ide/util/BrowseFilesListener.java +++ b/platform/platform-api/src/com/intellij/ide/util/BrowseFilesListener.java @@ -1,27 +1,13 @@ -/* - * 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.util; import com.intellij.openapi.fileChooser.FileChooser; import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; +import com.intellij.openapi.util.NlsContexts; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.util.NlsContexts; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -52,8 +38,7 @@ public class BrowseFilesListener implements ActionListener { myChooserDescriptor = chooserDescriptor; } - @Nullable - protected VirtualFile getFileToSelect() { + protected @Nullable VirtualFile getFileToSelect() { final String path = myTextField.getText().trim().replace(File.separatorChar, '/'); if (path.length() > 0) { File file = new File(path); @@ -67,7 +52,7 @@ public class BrowseFilesListener implements ActionListener { return null; } - protected void doSetText(@NotNull final String path) { + protected void doSetText(final @NotNull String path) { myTextField.setText(path); } diff --git a/platform/platform-api/src/com/intellij/ide/util/DelegatingProgressIndicator.java b/platform/platform-api/src/com/intellij/ide/util/DelegatingProgressIndicator.java index 606b165fc7ba..ae128121505a 100644 --- a/platform/platform-api/src/com/intellij/ide/util/DelegatingProgressIndicator.java +++ b/platform/platform-api/src/com/intellij/ide/util/DelegatingProgressIndicator.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.util; import com.intellij.openapi.application.ModalityState; @@ -110,8 +110,7 @@ public class DelegatingProgressIndicator implements WrappedProgressIndicator, St } @Override - @NotNull - public ModalityState getModalityState() { + public @NotNull ModalityState getModalityState() { return myIndicator.getModalityState(); } @@ -139,9 +138,8 @@ public class DelegatingProgressIndicator implements WrappedProgressIndicator, St return myIndicator; } - @NotNull @Override - public ProgressIndicator getOriginalProgressIndicator() { + public @NotNull ProgressIndicator getOriginalProgressIndicator() { return myIndicator; } diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java index f5e301a9be83..296f1bc8d47a 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.util.treeView; import com.intellij.ide.IdeBundle; @@ -24,7 +24,10 @@ import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.tree.TreeUtil; import com.intellij.util.ui.update.Activatable; import com.intellij.util.ui.update.UiNotifyConnector; -import org.jetbrains.annotations.*; +import org.jetbrains.annotations.Nls; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.jetbrains.concurrency.AsyncPromise; import org.jetbrains.concurrency.Promise; import org.jetbrains.concurrency.Promises; @@ -196,7 +199,7 @@ public class AbstractTreeUi { private final Set myUserRunnables = new HashSet<>(); private UiActivityMonitor myActivityMonitor; - @NonNls private UiActivity myActivityId; + private @NonNls UiActivity myActivityId; @Override public String toString() { @@ -501,8 +504,7 @@ public class AbstractTreeUi { return myTree; } - @Nullable - private static NodeDescriptor getDescriptorFrom(Object node) { + private static @Nullable NodeDescriptor getDescriptorFrom(Object node) { if (node instanceof DefaultMutableTreeNode) { Object userObject = ((DefaultMutableTreeNode)node).getUserObject(); if (userObject instanceof NodeDescriptor) { @@ -513,8 +515,7 @@ public class AbstractTreeUi { return null; } - @Nullable - public final DefaultMutableTreeNode getNodeForElement(@NotNull Object element, boolean validateAgainstStructure) { + public final @Nullable DefaultMutableTreeNode getNodeForElement(@NotNull Object element, boolean validateAgainstStructure) { DefaultMutableTreeNode result = null; if (validateAgainstStructure) { int index = 0; @@ -589,8 +590,7 @@ public class AbstractTreeUi { return valid; } - @Nullable - public final DefaultMutableTreeNode getNodeForPath(Object @NotNull [] path) { + public final @Nullable DefaultMutableTreeNode getNodeForPath(Object @NotNull [] path) { DefaultMutableTreeNode node = null; for (Object pathElement : path) { node = node == null ? getFirstNode(pathElement) : findNodeForChildElement(node, pathElement); @@ -640,8 +640,7 @@ public class AbstractTreeUi { getBuilder().queueUpdateFrom(getTreeStructure().getRootElement(), true); } - @NotNull - protected AbstractTreeBuilder getBuilder() { + protected @NotNull AbstractTreeBuilder getBuilder() { return myBuilder; } @@ -833,8 +832,7 @@ public class AbstractTreeUi { return myTree instanceof AlwaysExpandedTree && ((AlwaysExpandedTree)myTree).isAlwaysExpanded(); } - @NotNull - private Promise update(@NotNull NodeDescriptor nodeDescriptor, boolean now) { + private @NotNull Promise update(@NotNull NodeDescriptor nodeDescriptor, boolean now) { Promise promise; if (now || isPassthroughMode()) { promise = Promises.resolvedPromise(update(nodeDescriptor)); @@ -974,13 +972,11 @@ public class AbstractTreeUi { } //todo: to make real callback - @NotNull - public ActionCallback queueUpdate(Object element) { + public @NotNull ActionCallback queueUpdate(Object element) { return queueUpdate(element, true); } - @NotNull - public ActionCallback queueUpdate(Object fromElement, boolean updateStructure) { + public @NotNull ActionCallback queueUpdate(Object fromElement, boolean updateStructure) { assertIsDispatchThread(); try { @@ -1096,8 +1092,7 @@ public class AbstractTreeUi { return isToBuildChildrenInBackground(getElementFromDescriptor(descriptor)); } - @NotNull - private UpdaterTreeState setUpdaterState(@NotNull UpdaterTreeState state) { + private @NotNull UpdaterTreeState setUpdaterState(@NotNull UpdaterTreeState state) { if (state.equals(myUpdaterState)) return state; UpdaterTreeState oldState = myUpdaterState; @@ -1135,15 +1130,14 @@ public class AbstractTreeUi { return getBuilder().getTreeStructureElement(descriptor); } - @NotNull - private ActionCallback updateNodeChildren(@NotNull DefaultMutableTreeNode node, - @NotNull TreeUpdatePass pass, - @Nullable LoadedChildren loadedChildren, - boolean forcedNow, - boolean toSmartExpand, - boolean forceUpdate, - boolean descriptorIsUpToDate, - boolean updateChildren) { + private @NotNull ActionCallback updateNodeChildren(@NotNull DefaultMutableTreeNode node, + @NotNull TreeUpdatePass pass, + @Nullable LoadedChildren loadedChildren, + boolean forcedNow, + boolean toSmartExpand, + boolean forceUpdate, + boolean descriptorIsUpToDate, + boolean updateChildren) { AbstractTreeStructure treeStructure = getTreeStructure(); ActionCallback result = treeStructure.asyncCommit(); result.doWhenDone(new TreeRunnable("AbstractTreeUi.updateNodeChildren: on done") { @@ -1629,11 +1623,10 @@ public class AbstractTreeUi { } } - @NotNull - private ActionCallback updateNodesToInsert(@NotNull List nodesToInsert, - @NotNull TreeUpdatePass pass, - boolean canSmartExpand, - boolean forceUpdate) { + private @NotNull ActionCallback updateNodesToInsert(@NotNull List nodesToInsert, + @NotNull TreeUpdatePass pass, + boolean canSmartExpand, + boolean forceUpdate) { ActionCallback.Chunk chunk = new ActionCallback.Chunk(); for (TreeNode node : nodesToInsert) { DefaultMutableTreeNode childNode = (DefaultMutableTreeNode)node; @@ -1645,14 +1638,13 @@ public class AbstractTreeUi { return chunk.getWhenProcessed(); } - @NotNull - private Promise processExistingNodes(@NotNull DefaultMutableTreeNode node, - @NotNull MutualMap elementToIndexMap, - @NotNull TreeUpdatePass pass, - boolean canSmartExpand, - boolean forceUpdate, - boolean wasExpanded, - @Nullable LoadedChildren preloaded) { + private @NotNull Promise processExistingNodes(@NotNull DefaultMutableTreeNode node, + @NotNull MutualMap elementToIndexMap, + @NotNull TreeUpdatePass pass, + boolean canSmartExpand, + boolean forceUpdate, + boolean wasExpanded, + @Nullable LoadedChildren preloaded) { List childNodes = TreeUtil.listChildren(node); return maybeYield(() -> { if (pass.isExpired()) return Promises.rejectedPromise(); @@ -1731,8 +1723,7 @@ public class AbstractTreeUi { Promise run(); } - @NotNull - private Promise maybeYield(@NotNull AsyncRunnable processRunnable, @NotNull TreeUpdatePass pass, DefaultMutableTreeNode node) { + private @NotNull Promise maybeYield(@NotNull AsyncRunnable processRunnable, @NotNull TreeUpdatePass pass, DefaultMutableTreeNode node) { if (isRerunNeeded(pass)) { getUpdater().requeue(pass); return Promises.rejectedPromise(); @@ -1790,8 +1781,7 @@ public class AbstractTreeUi { } } - @NotNull - private Promise execute(@NotNull AsyncRunnable runnable) throws ProcessCanceledException { + private @NotNull Promise execute(@NotNull AsyncRunnable runnable) throws ProcessCanceledException { try { if (!canInitiateNewActivity()) { throw new ProcessCanceledException(); @@ -1867,8 +1857,7 @@ public class AbstractTreeUi { }); } - @NotNull - private ActionCallback resetToReadyNow() { + private @NotNull ActionCallback resetToReadyNow() { if (isReleased()) return ActionCallback.REJECTED; assertIsDispatchThread(); @@ -2002,9 +1991,7 @@ public class AbstractTreeUi { } } - @NotNull - @NonNls - public String getStatus() { + public @NotNull @NonNls String getStatus() { return "isReady=" + isReady() + "\n" + " isIdle=" + isIdle() + "\n" + " isYeildingNow=" + isYieldingNow() + "\n" + @@ -2148,9 +2135,8 @@ public class AbstractTreeUi { getBuilder().yieldToEDT(runnable); } - @NotNull - private MutualMap loadElementsFromStructure(NodeDescriptor descriptor, - @Nullable LoadedChildren preloadedChildren) { + private @NotNull MutualMap loadElementsFromStructure(NodeDescriptor descriptor, + @Nullable LoadedChildren preloadedChildren) { MutualMap elementToIndexMap = new MutualMap<>(true); Object element = getElementFromDescriptor(descriptor); if (!isValid(element)) return elementToIndexMap; @@ -2172,12 +2158,11 @@ public class AbstractTreeUi { return node instanceof LoadingNode; } - @NotNull - private AsyncResult> collectNodesToInsert(NodeDescriptor descriptor, - @NotNull MutualMap elementToIndexMap, - DefaultMutableTreeNode parent, - boolean addLoadingNode, - @NotNull LoadedChildren loadedChildren) { + private @NotNull AsyncResult> collectNodesToInsert(NodeDescriptor descriptor, + @NotNull MutualMap elementToIndexMap, + DefaultMutableTreeNode parent, + boolean addLoadingNode, + @NotNull LoadedChildren loadedChildren) { AsyncResult> result = new AsyncResult<>(); List nodesToInsert = new ArrayList<>(); @@ -2250,8 +2235,7 @@ public class AbstractTreeUi { return result; } - @NotNull - protected DefaultMutableTreeNode createChildNode(NodeDescriptor descriptor) { + protected @NotNull DefaultMutableTreeNode createChildNode(NodeDescriptor descriptor) { return new ElementNode(this, descriptor); } @@ -2263,8 +2247,7 @@ public class AbstractTreeUi { return myClearOnHideDelay; } - @NotNull - public ActionCallback getInitialized() { + public @NotNull ActionCallback getInitialized() { return myInitialized; } @@ -2339,8 +2322,7 @@ public class AbstractTreeUi { return getUpdater().hasNodesToUpdate(); } - @NotNull - public List getExpandedElements() { + public @NotNull List getExpandedElements() { List result = new ArrayList<>(); if (isReleased()) return result; @@ -2358,8 +2340,7 @@ public class AbstractTreeUi { return result; } - @NotNull - public ActionCallback cancelUpdate() { + public @NotNull ActionCallback cancelUpdate() { if (isReleased()) return ActionCallback.REJECTED; setCancelRequested(true); @@ -2407,18 +2388,15 @@ public class AbstractTreeUi { } } - @Nullable - private LockToken attemptLock() throws InterruptedException { + private @Nullable LockToken attemptLock() throws InterruptedException { return LockToken.attemptLock(myStateLock, Registry.intValue("ide.tree.uiLockAttempt")); } - @NotNull - private LockToken acquireLock() { + private @NotNull LockToken acquireLock() { return LockToken.acquireLock(myStateLock); } - @NotNull - public ActionCallback batch(@NotNull Progressive progressive) { + public @NotNull ActionCallback batch(@NotNull Progressive progressive) { assertIsDispatchThread(); EmptyProgressIndicator indicator = new EmptyProgressIndicator(); @@ -2532,8 +2510,7 @@ public class AbstractTreeUi { return getUpdatingParent(kid) != null; } - @Nullable - private DefaultMutableTreeNode getUpdatingParent(DefaultMutableTreeNode kid) { + private @Nullable DefaultMutableTreeNode getUpdatingParent(DefaultMutableTreeNode kid) { DefaultMutableTreeNode eachParent = kid; while (eachParent != null) { if (isUpdatingChildrenNow(eachParent)) return eachParent; @@ -2672,10 +2649,8 @@ public class AbstractTreeUi { children.set(loaded); } - @NotNull - @NonNls @Override - public String toString() { + public @NotNull @NonNls String toString() { return "runnable=" + oldElementFromDescriptor; } }; @@ -2858,8 +2833,7 @@ public class AbstractTreeUi { } } - @Nullable - private static TreeNode getChildForSmartExpand(@NotNull DefaultMutableTreeNode node) { + private static @Nullable TreeNode getChildForSmartExpand(@NotNull DefaultMutableTreeNode node) { int realChildCount = 0; TreeNode nodeToExpand = null; @@ -2899,8 +2873,7 @@ public class AbstractTreeUi { return getParentLoadingInBackground(nodeObject) != null; } - @Nullable - private DefaultMutableTreeNode getParentLoadingInBackground(@NotNull Object nodeObject) { + private @Nullable DefaultMutableTreeNode getParentLoadingInBackground(@NotNull Object nodeObject) { if (!(nodeObject instanceof DefaultMutableTreeNode node)) return null; TreeNode eachParent = node.getParent(); @@ -2920,15 +2893,14 @@ public class AbstractTreeUi { return IdeBundle.message("progress.searching"); } - @NotNull - private Promise processExistingNode(@NotNull DefaultMutableTreeNode childNode, - NodeDescriptor childDescriptor, - @NotNull DefaultMutableTreeNode parentNode, - @NotNull MutualMap elementToIndexMap, - @NotNull TreeUpdatePass pass, - boolean canSmartExpand, - boolean forceUpdate, - @Nullable LoadedChildren parentPreloadedChildren) { + private @NotNull Promise processExistingNode(@NotNull DefaultMutableTreeNode childNode, + NodeDescriptor childDescriptor, + @NotNull DefaultMutableTreeNode parentNode, + @NotNull MutualMap elementToIndexMap, + @NotNull TreeUpdatePass pass, + boolean canSmartExpand, + boolean forceUpdate, + @Nullable LoadedChildren parentPreloadedChildren) { if (pass.isExpired()) { return Promises.rejectedPromise(); } @@ -3114,8 +3086,7 @@ public class AbstractTreeUi { return parentElementInTree.equals(parentElement); } - @NotNull - private Condition getExpiredElementCondition(Object element) { + private @NotNull Condition getExpiredElementCondition(Object element) { return __ -> isInStructure(element); } @@ -3152,8 +3123,7 @@ public class AbstractTreeUi { }); } - @NotNull - private static TreePath getPathFor(@NotNull TreeNode node) { + private static @NotNull TreePath getPathFor(@NotNull TreeNode node) { if (node instanceof DefaultMutableTreeNode) { return new TreePath(((DefaultMutableTreeNode)node).getPath()); } @@ -3288,8 +3258,7 @@ public class AbstractTreeUi { } - @NotNull - private Promise queueToBackground(@NotNull Runnable bgBuildAction, @Nullable Runnable edtPostRunnable) { + private @NotNull Promise queueToBackground(@NotNull Runnable bgBuildAction, @Nullable Runnable edtPostRunnable) { if (!canInitiateNewActivity()) return Promises.rejectedPromise(); AsyncPromise result = new AsyncPromise<>(); AtomicReference fail = new AtomicReference<>(); @@ -3809,8 +3778,7 @@ public class AbstractTreeUi { } } - @NotNull - final Set getSelectedElements() { + final @NotNull Set getSelectedElements() { TreePath[] paths = myTree.getSelectionPaths(); Set result = new LinkedHashSet<>(); @@ -3963,8 +3931,7 @@ public class AbstractTreeUi { return myTree.isRootVisible() || node != getRootNode() ? node : null; } - @NotNull - private Runnable wrapDone(Runnable onDone, @NotNull String name) { + private @NotNull Runnable wrapDone(Runnable onDone, @NotNull String name) { return new TreeRunnable(name) { @Override public void perform() { @@ -3973,13 +3940,12 @@ public class AbstractTreeUi { }; } - @NotNull - private Runnable wrapScrollTo(Runnable onDone, - @NotNull Object element, - @NotNull DefaultMutableTreeNode node, - boolean addToSelection, - boolean canBeCentered, - boolean scroll) { + private @NotNull Runnable wrapScrollTo(Runnable onDone, + @NotNull Object element, + @NotNull DefaultMutableTreeNode node, + boolean addToSelection, + boolean canBeCentered, + boolean scroll) { return new TreeRunnable("AbstractTreeUi.wrapScrollTo") { @Override public void perform() { @@ -4347,8 +4313,7 @@ public class AbstractTreeUi { return getUpdater().isEnqueuedToUpdate(node) || isUpdatingParent(node) || myCancelledBuild.containsKey(node); } - @Nullable - public Object getElementFor(Object node) { + public @Nullable Object getElementFor(Object node) { NodeDescriptor descriptor = getDescriptorFrom(node); return descriptor == null ? null : getElementFromDescriptor(descriptor); } @@ -4361,8 +4326,7 @@ public class AbstractTreeUi { return getParentBuiltNode(node) != null || myRootNode == node && !wasRootNodeInitialized(); } - @Nullable - private DefaultMutableTreeNode getParentBuiltNode(@NotNull Object node) { + private @Nullable DefaultMutableTreeNode getParentBuiltNode(@NotNull Object node) { DefaultMutableTreeNode parent = getParentLoadingInBackground(node); if (parent != null) return parent; @@ -4490,13 +4454,11 @@ public class AbstractTreeUi { } } - @Nullable - private DefaultMutableTreeNode getFirstNode(@NotNull Object element) { + private @Nullable DefaultMutableTreeNode getFirstNode(@NotNull Object element) { return findNode(element, 0); } - @Nullable - private DefaultMutableTreeNode findNode(@NotNull Object element, int startIndex) { + private @Nullable DefaultMutableTreeNode findNode(@NotNull Object element, int startIndex) { Object value = getBuilder().findNodeByElement(element); if (value == null) { return null; @@ -4526,8 +4488,7 @@ public class AbstractTreeUi { } } - @Nullable - private DefaultMutableTreeNode findNodeForChildElement(@NotNull DefaultMutableTreeNode parentNode, Object element) { + private @Nullable DefaultMutableTreeNode findNodeForChildElement(@NotNull DefaultMutableTreeNode parentNode, Object element) { Object anchor = TreeAnchorizer.getService().createAnchor(element); Object value = isNodeNull(anchor) ? null : myElementToNodeMap.get(anchor); TreeAnchorizer.getService().freeAnchor(anchor); @@ -4782,7 +4743,7 @@ public class AbstractTreeUi { } private static class LoadedChildren { - @NotNull private final List myElements; + private final @NotNull List myElements; private final Map> myDescriptors = new HashMap<>(); private final Map, Boolean> myChanges = new HashMap<>(); @@ -4807,9 +4768,8 @@ public class AbstractTreeUi { return myDescriptors.get(element); } - @NotNull @Override - public String toString() { + public @NotNull String toString() { return myElements + "->" + myChanges; } @@ -4901,9 +4861,7 @@ public class AbstractTreeUi { } @Override - @NotNull - @NonNls - public synchronized String toString() { + public synchronized @NotNull @NonNls String toString() { return "UpdateInfo: desc=" + myDescriptor + " pass=" + diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUpdater.java b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUpdater.java index ecd5395a501f..58e527157842 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUpdater.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUpdater.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.util.treeView; @@ -321,9 +321,8 @@ public class AbstractTreeUpdater implements Disposable, Activatable { myUpdateQueue.hideNotify(); } - @NonNls @Override - public synchronized String toString() { + public synchronized @NonNls String toString() { return "AbstractTreeUpdater updateCount=" + myUpdateCount + " queue=[" + myUpdateQueue + "] " + " nodeQueue=" + myNodeQueue + " builder=" + myTreeBuilder; } diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/NodeRenderer.java b/platform/platform-api/src/com/intellij/ide/util/treeView/NodeRenderer.java index 7bc6724c8058..9727387dacf5 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/NodeRenderer.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/NodeRenderer.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.util.treeView; import com.intellij.ide.projectView.PresentationData; @@ -111,20 +111,17 @@ public class NodeRenderer extends ColoredTreeCellRenderer { } } - @Nullable - protected ItemPresentation getPresentation(Object node) { + protected @Nullable ItemPresentation getPresentation(Object node) { return node instanceof PresentableNodeDescriptor ? ((PresentableNodeDescriptor)node).getPresentation() : node instanceof NavigationItem ? ((NavigationItem)node).getPresentation() : null; } - @NotNull - private static EditorColorsScheme getScheme() { + private static @NotNull EditorColorsScheme getScheme() { return EditorColorsManager.getInstance().getSchemeForCurrentUITheme(); } - @NotNull - protected SimpleTextAttributes getSimpleTextAttributes(@NotNull PresentationData presentation, Color color, @NotNull Object node) { + protected @NotNull SimpleTextAttributes getSimpleTextAttributes(@NotNull PresentationData presentation, Color color, @NotNull Object node) { SimpleTextAttributes simpleTextAttributes = getSimpleTextAttributes(presentation, getScheme()); return addColorToSimpleTextAttributes(simpleTextAttributes, color); @@ -139,11 +136,11 @@ public class NodeRenderer extends ColoredTreeCellRenderer { return simpleTextAttributes; } - public static SimpleTextAttributes getSimpleTextAttributes(@Nullable final ItemPresentation presentation) { + public static SimpleTextAttributes getSimpleTextAttributes(final @Nullable ItemPresentation presentation) { return getSimpleTextAttributes(presentation, getScheme()); } - private static SimpleTextAttributes getSimpleTextAttributes(@Nullable final ItemPresentation presentation, + private static SimpleTextAttributes getSimpleTextAttributes(final @Nullable ItemPresentation presentation, @NotNull EditorColorsScheme colorsScheme) { if (presentation instanceof ColoredItemPresentation) { diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/TreeState.java b/platform/platform-api/src/com/intellij/ide/util/treeView/TreeState.java index 16ba3e46037e..1087fb55826f 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/TreeState.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/TreeState.java @@ -64,7 +64,7 @@ public final class TreeState implements JDOMExternalizable { String id; String type; transient Object userObject; - transient final int index; + final transient int index; @SuppressWarnings("unused") PathElement() { @@ -156,31 +156,26 @@ public final class TreeState implements JDOMExternalizable { } } - @NotNull - public static TreeState createOn(@NotNull JTree tree, @NotNull DefaultMutableTreeNode treeNode) { + public static @NotNull TreeState createOn(@NotNull JTree tree, @NotNull DefaultMutableTreeNode treeNode) { return createOn(tree, new TreePath(treeNode.getPath())); } - @NotNull - public static TreeState createOn(@NotNull JTree tree, @NotNull TreePath rootPath) { + public static @NotNull TreeState createOn(@NotNull JTree tree, @NotNull TreePath rootPath) { return new TreeState(createPaths(tree, TreeUtil.collectExpandedPaths(tree, rootPath)), createPaths(tree, TreeUtil.collectSelectedPaths(tree, rootPath))); } - @NotNull - public static TreeState createOn(@NotNull JTree tree) { + public static @NotNull TreeState createOn(@NotNull JTree tree) { return createOn(tree, true, false); } - @NotNull - public static TreeState createOn(@NotNull JTree tree, boolean persistExpand, boolean persistSelect) { + public static @NotNull TreeState createOn(@NotNull JTree tree, boolean persistExpand, boolean persistSelect) { List expanded = persistExpand ? TreeUtil.collectExpandedPaths(tree) : Collections.emptyList(); List selected = persistSelect ? TreeUtil.collectSelectedPaths(tree) : Collections.emptyList(); return createOn(tree, expanded, selected); } - @NotNull - public static TreeState createOn(@NotNull JTree tree, @NotNull List expandedPaths, @NotNull List selectedPaths) { + public static @NotNull TreeState createOn(@NotNull JTree tree, @NotNull List expandedPaths, @NotNull List selectedPaths) { List expandedPathElements = !expandedPaths.isEmpty() ? createPaths(tree, expandedPaths) : new ArrayList<>(); @@ -190,8 +185,7 @@ public final class TreeState implements JDOMExternalizable { return new TreeState(expandedPathElements, selectedPathElements); } - @NotNull - public static TreeState createFrom(@Nullable Element element) { + public static @NotNull TreeState createFrom(@Nullable Element element) { TreeState state = new TreeState(new ArrayList<>(), new ArrayList<>()); try { if (element != null) { @@ -244,8 +238,7 @@ public final class TreeState implements JDOMExternalizable { return result; } - @NotNull - private static String calcId(@Nullable Object userObject) { + private static @NotNull String calcId(@Nullable Object userObject) { if (userObject == null) return ""; // The easiest case: the node provides an ID explicitly. if (userObject instanceof PathElementIdProvider userObjectWithPathId) { @@ -258,8 +251,7 @@ public final class TreeState implements JDOMExternalizable { return StringUtil.notNullize(userObject.toString()); } - @NotNull - private static String calcType(@Nullable Object userObject) { + private static @NotNull String calcType(@Nullable Object userObject) { if (userObject == null) return ""; String name = userObject.getClass().getName(); return Integer.toHexString(StringHash.murmur(name, 31)) + ":" + StringUtil.getShortName(name); @@ -321,8 +313,7 @@ public final class TreeState implements JDOMExternalizable { } - @Nullable - private static TreePath findMatchedChild(@NotNull TreeModel model, @NotNull TreePath treePath, @NotNull PathElement pathElement) { + private static @Nullable TreePath findMatchedChild(@NotNull TreeModel model, @NotNull TreePath treePath, @NotNull PathElement pathElement) { Object parent = treePath.getLastPathComponent(); int childCount = model.getChildCount(parent); if (childCount <= 0) return null; @@ -524,9 +515,8 @@ public final class TreeState implements JDOMExternalizable { return VisitThread.BGT; } - @NotNull @Override - public Action visit(@NotNull TreePath path) { + public @NotNull Action visit(@NotNull TreePath path) { int count = path.getPathCount(); if (count > elements.length) return Action.SKIP_CHILDREN; boolean matches = elements[count - 1].isMatchTo(path.getLastPathComponent()); diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/UpdaterTreeState.java b/platform/platform-api/src/com/intellij/ide/util/treeView/UpdaterTreeState.java index f02e89b823af..31e5139eb1e5 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/UpdaterTreeState.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/UpdaterTreeState.java @@ -1,4 +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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.util.treeView; import com.intellij.openapi.util.ActionCallback; @@ -341,9 +341,8 @@ public class UpdaterTreeState { } } - @NonNls @Override - public String toString() { + public @NonNls String toString() { return "UpdaterState toSelect " + myToSelect + " toExpand=" + myToExpand + " processingNow=" + isProcessingNow() + " canRun=" + myCanRunRestore; diff --git a/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java b/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java index faf70b998f44..e91aafb8f8c2 100644 --- a/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java +++ b/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java @@ -40,7 +40,7 @@ import java.util.*; public abstract class AbstractWizard extends DialogWrapper { private static final Logger LOG = Logger.getInstance(AbstractWizard.class); - public final static Key> KEY = Key.create("AbstractWizard"); + public static final Key> KEY = Key.create("AbstractWizard"); protected int myCurrentStep; protected final ArrayList mySteps; @@ -66,7 +66,7 @@ public abstract class AbstractWizard extends DialogWrapper { initWizard(title); } - public AbstractWizard(@NlsContexts.DialogTitle String title, @Nullable final Project project) { + public AbstractWizard(@NlsContexts.DialogTitle String title, final @Nullable Project project) { super(project, true); mySteps = new ArrayList<>(); initWizard(title); @@ -253,7 +253,7 @@ public abstract class AbstractWizard extends DialogWrapper { private static void add(final GroupLayout.Group hGroup, final GroupLayout.Group vGroup, - @Nullable final Collection collection, + final @Nullable Collection collection, final Component... components) { for (Component component : components) { hGroup.addComponent(component); @@ -335,11 +335,11 @@ public abstract class AbstractWizard extends DialogWrapper { return mySteps.get(myCurrentStep); } - public void addStep(@NotNull final T step) { + public void addStep(final @NotNull T step) { addStep(step, mySteps.size()); } - public void addStep(@NotNull final T step, int index) { + public void addStep(final @NotNull T step, int index) { mySteps.add(index, step); if (step instanceof StepAdapter) { @@ -610,7 +610,5 @@ public abstract class AbstractWizard extends DialogWrapper { return mySteps.size(); } - @Nullable - @NonNls - protected abstract String getHelpID(); + protected abstract @Nullable @NonNls String getHelpID(); } diff --git a/platform/platform-api/src/com/intellij/idea/ActionsBundle.java b/platform/platform-api/src/com/intellij/idea/ActionsBundle.java index 25db52570d25..2b0dd92d0023 100644 --- a/platform/platform-api/src/com/intellij/idea/ActionsBundle.java +++ b/platform/platform-api/src/com/intellij/idea/ActionsBundle.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.idea; import com.intellij.DynamicBundle; @@ -11,7 +11,7 @@ import org.jetbrains.annotations.PropertyKey; import java.util.function.Supplier; public final class ActionsBundle { - @NonNls public static final String IDEA_ACTIONS_BUNDLE = "messages.ActionsBundle"; + public static final @NonNls String IDEA_ACTIONS_BUNDLE = "messages.ActionsBundle"; private static final DynamicBundle ourInstance = new DynamicBundle(ActionsBundle.class, IDEA_ACTIONS_BUNDLE); @@ -22,8 +22,7 @@ public final class ActionsBundle { return ourInstance.containsKey(key) ? ourInstance.getMessage(key, params) : ActionsDeprecatedMessagesBundle.message(key, params); } - @NotNull - public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = IDEA_ACTIONS_BUNDLE) String key, Object @NotNull ... params) { + public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = IDEA_ACTIONS_BUNDLE) String key, Object @NotNull ... params) { return ourInstance.containsKey(key) ? ourInstance.getLazyMessage(key, params) : ActionsDeprecatedMessagesBundle.messagePointer(key, params); } diff --git a/platform/platform-api/src/com/intellij/internal/performanceTests/ProjectInitializationDiagnosticService.java b/platform/platform-api/src/com/intellij/internal/performanceTests/ProjectInitializationDiagnosticService.java index f41cff1f22e6..3669bcadbfd8 100644 --- a/platform/platform-api/src/com/intellij/internal/performanceTests/ProjectInitializationDiagnosticService.java +++ b/platform/platform-api/src/com/intellij/internal/performanceTests/ProjectInitializationDiagnosticService.java @@ -19,13 +19,11 @@ import java.util.function.Supplier; */ public interface ProjectInitializationDiagnosticService { - @NotNull - static ProjectInitializationDiagnosticService getInstance(@NotNull Project project) { + static @NotNull ProjectInitializationDiagnosticService getInstance(@NotNull Project project) { return project.getService(ProjectInitializationDiagnosticService.class); } - @NotNull - static ActivityTracker registerTracker(@NotNull Project project, @NotNull @NlsSafe String debugActivityName) { + static @NotNull ActivityTracker registerTracker(@NotNull Project project, @NotNull @NlsSafe String debugActivityName) { return getInstance(project).registerBeginningOfInitializationActivity(() -> debugActivityName); } diff --git a/platform/platform-api/src/com/intellij/openapi/GitRepositoryInitializer.java b/platform/platform-api/src/com/intellij/openapi/GitRepositoryInitializer.java index 2d245ab4bfbf..c7fec8369a3a 100644 --- a/platform/platform-api/src/com/intellij/openapi/GitRepositoryInitializer.java +++ b/platform/platform-api/src/com/intellij/openapi/GitRepositoryInitializer.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi; import com.intellij.openapi.extensions.ExtensionPointName; @@ -24,8 +24,7 @@ public interface GitRepositoryInitializer { @RequiresBackgroundThread void initRepository(@NotNull Project project, @NotNull VirtualFile root, boolean addFilesToVcs); - @Nullable - static GitRepositoryInitializer getInstance() { + static @Nullable GitRepositoryInitializer getInstance() { return EP_NAME.getExtensionList().stream().findFirst().orElse(null); } } diff --git a/platform/platform-api/src/com/intellij/openapi/GitSilentFileAdderProvider.java b/platform/platform-api/src/com/intellij/openapi/GitSilentFileAdderProvider.java index 1f38fc1a1392..27f031ac15f6 100644 --- a/platform/platform-api/src/com/intellij/openapi/GitSilentFileAdderProvider.java +++ b/platform/platform-api/src/com/intellij/openapi/GitSilentFileAdderProvider.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi; import com.intellij.openapi.extensions.ProjectExtensionPointName; @@ -21,8 +21,7 @@ public interface GitSilentFileAdderProvider { @NotNull GitSilentFileAdder create(); - @NotNull - static GitSilentFileAdder create(@NotNull Project project) { + static @NotNull GitSilentFileAdder create(@NotNull Project project) { return EP_NAME.getExtensions(project).stream().findFirst().map(it -> it.create()).orElse(new GitSilentFileAdder.Empty()); } } diff --git a/platform/platform-api/src/com/intellij/openapi/MnemonicWrapper.java b/platform/platform-api/src/com/intellij/openapi/MnemonicWrapper.java index 3548ba1343bf..b1b51f5080d4 100644 --- a/platform/platform-api/src/com/intellij/openapi/MnemonicWrapper.java +++ b/platform/platform-api/src/com/intellij/openapi/MnemonicWrapper.java @@ -224,7 +224,7 @@ abstract class MnemonicWrapper implements Runnable, Proper } } - private static abstract class AbstractButtonWrapper extends MnemonicWrapper { + private abstract static class AbstractButtonWrapper extends MnemonicWrapper { private AbstractButtonWrapper(AbstractButton component) { super(component, "text", "mnemonic", "displayedMnemonicIndex"); } diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/AbbreviationManager.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/AbbreviationManager.java index 99a33e405986..6fbcf1a5f079 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/AbbreviationManager.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/AbbreviationManager.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.actionSystem; import com.intellij.openapi.application.ApplicationManager; @@ -18,14 +18,11 @@ public abstract class AbbreviationManager { return ApplicationManager.getApplication().getService(AbbreviationManager.class); } - @NotNull - public abstract Set getAbbreviations(); + public abstract @NotNull Set getAbbreviations(); - @NotNull - public abstract Set getAbbreviations(@NotNull String actionId); + public abstract @NotNull Set getAbbreviations(@NotNull String actionId); - @NotNull - public abstract List findActions(@NotNull String abbreviation); + public abstract @NotNull List findActions(@NotNull String abbreviation); public abstract void register(@NotNull String abbreviation, @NotNull String actionId); diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/ActionInGroup.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/ActionInGroup.java index c9cbf9aebe3f..62042afa9e56 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/ActionInGroup.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/ActionInGroup.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.actionSystem; import org.jetbrains.annotations.NotNull; @@ -26,14 +12,12 @@ public class ActionInGroup { myAction = action; } - @NotNull - public ActionInGroup setAsSecondary(boolean isSecondary) { + public @NotNull ActionInGroup setAsSecondary(boolean isSecondary) { myGroup.setAsPrimary(myAction, !isSecondary); return this; } - @NotNull - public ActionGroup getGroup() { + public @NotNull ActionGroup getGroup() { return myGroup; } } diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/Constraints.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/Constraints.java index 2e4a8587bd0f..321d9aef9f54 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/Constraints.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/Constraints.java @@ -10,8 +10,8 @@ import org.jetbrains.annotations.NonNls; * @see DefaultActionGroup */ public final class Constraints implements Cloneable { - public final static Constraints FIRST = new Constraints(Anchor.FIRST, null); - public final static Constraints LAST = new Constraints(Anchor.LAST, null); + public static final Constraints FIRST = new Constraints(Anchor.FIRST, null); + public static final Constraints LAST = new Constraints(Anchor.LAST, null); /** * Anchor. */ diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/DefaultActionGroup.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/DefaultActionGroup.java index 1d4754e779a0..9a91f5834a23 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/DefaultActionGroup.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/DefaultActionGroup.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.actionSystem; import com.intellij.openapi.diagnostic.Logger; @@ -6,7 +6,6 @@ import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.util.NlsActions; import com.intellij.openapi.util.NlsActions.ActionText; import com.intellij.openapi.util.NlsContexts; -import com.intellij.openapi.util.Pair; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -496,8 +495,7 @@ public class DefaultActionGroup extends ActionGroup { add(Separator.create(separatorText)); } - @Nullable - public synchronized Constraints getConstraints(@NotNull AnAction action) { + public synchronized @Nullable Constraints getConstraints(@NotNull AnAction action) { return myConstraints.get(action); } diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/EmptyAction.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/EmptyAction.java index ec657d35526f..241a1b646e67 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/EmptyAction.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/EmptyAction.java @@ -70,8 +70,7 @@ public final class EmptyAction extends AnAction { * ActionManager.getInstance().getAction(id).registerCustomShortcutSet(shortcutSet, component) shouldn't be used directly, * because it will erase shortcuts, assigned to this action in keymap. */ - @NotNull - public static AnAction registerWithShortcutSet(@NotNull String id, @NotNull ShortcutSet shortcutSet, @NotNull JComponent component) { + public static @NotNull AnAction registerWithShortcutSet(@NotNull String id, @NotNull ShortcutSet shortcutSet, @NotNull JComponent component) { AnAction newAction = wrap(ActionManager.getInstance().getAction(id)); newAction.registerCustomShortcutSet(shortcutSet, component); return newAction; diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/KeyboardModifierGestureShortcut.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/KeyboardModifierGestureShortcut.java index 3caae116eb7e..e1ca57c3923d 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/KeyboardModifierGestureShortcut.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/KeyboardModifierGestureShortcut.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.actionSystem; import com.intellij.openapi.keymap.KeymapUtil; @@ -25,8 +11,7 @@ public class KeyboardModifierGestureShortcut extends Shortcut { private final KeyStroke myStroke; private final KeyboardGestureAction.ModifierType myType; - @NotNull - public static Shortcut newInstance(KeyboardGestureAction.ModifierType type, KeyStroke stroke) { + public static @NotNull Shortcut newInstance(KeyboardGestureAction.ModifierType type, KeyStroke stroke) { return switch (type) { case dblClick -> new DblClick(stroke); case hold -> new Hold(stroke); @@ -52,7 +37,7 @@ public class KeyboardModifierGestureShortcut extends Shortcut { } @Override - public boolean startsWith(@NotNull final Shortcut sc) { + public boolean startsWith(final @NotNull Shortcut sc) { if (!(sc instanceof KeyboardModifierGestureShortcut other)) return false; if (myType.equals(other.myType)) { diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/MouseShortcut.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/MouseShortcut.java index f7247757994e..2364049c0975 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/MouseShortcut.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/MouseShortcut.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.actionSystem; import com.intellij.util.BitUtil; @@ -119,7 +105,7 @@ public class MouseShortcut extends Shortcut { } @Override - public boolean startsWith(@NotNull final Shortcut sc) { + public boolean startsWith(final @NotNull Shortcut sc) { return equals(sc); } diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/PressureShortcut.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/PressureShortcut.java index f4d37b7b9db8..d40849d85577 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/PressureShortcut.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/PressureShortcut.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.actionSystem; import org.intellij.lang.annotations.JdkConstants; @@ -63,7 +49,7 @@ public class PressureShortcut extends MouseShortcut { } @Override - public boolean startsWith(@NotNull final Shortcut sc) { + public boolean startsWith(final @NotNull Shortcut sc) { return equals(sc); } diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/Separator.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/Separator.java index d3151cb47fc9..5bf712eac747 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/Separator.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/Separator.java @@ -19,18 +19,15 @@ public final class Separator extends DecorativeElement implements DumbAware, Lig private static final Separator ourInstance = new Separator(); private final Supplier<@NlsContexts.Separator String> myDynamicText; - @NotNull - public static Separator getInstance() { + public static @NotNull Separator getInstance() { return ourInstance; } - @NotNull - public static Separator create() { + public static @NotNull Separator create() { return create(null); } - @NotNull - public static Separator create(@Nullable @NlsContexts.Separator String text) { + public static @NotNull Separator create(@Nullable @NlsContexts.Separator String text) { return StringUtil.isEmptyOrSpaces(text)? ourInstance : new Separator(text); } diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/ToggleAction.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/ToggleAction.java index 4f115f451bac..f3640c0fc033 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/ToggleAction.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/ToggleAction.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.actionSystem; import com.intellij.openapi.util.NlsActions.ActionDescription; @@ -18,7 +18,7 @@ public abstract class ToggleAction extends AnAction implements Toggleable { public ToggleAction() { } - public ToggleAction(@Nullable @ActionText final String text) { + public ToggleAction(final @Nullable @ActionText String text) { super(() -> text); } @@ -26,24 +26,24 @@ public abstract class ToggleAction extends AnAction implements Toggleable { super(text); } - public ToggleAction(@Nullable @ActionText final String text, - @Nullable @ActionDescription final String description, - @Nullable final Icon icon) { + public ToggleAction(final @Nullable @ActionText String text, + final @Nullable @ActionDescription String description, + final @Nullable Icon icon) { super(text, description, icon); } public ToggleAction(@NotNull Supplier<@ActionText String> text, @NotNull Supplier<@ActionDescription String> description, - @Nullable final Icon icon) { + final @Nullable Icon icon) { super(text, description, icon); } - public ToggleAction(@NotNull Supplier<@ActionText String> text, @Nullable final Icon icon) { + public ToggleAction(@NotNull Supplier<@ActionText String> text, final @Nullable Icon icon) { super(text, Presentation.NULL_STRING, icon); } @Override - public void actionPerformed(@NotNull final AnActionEvent e) { + public void actionPerformed(final @NotNull AnActionEvent e) { final boolean state = !isSelected(e); setSelected(e, state); final Presentation presentation = e.getPresentation(); @@ -67,7 +67,7 @@ public abstract class ToggleAction extends AnAction implements Toggleable { public abstract void setSelected(@NotNull AnActionEvent e, boolean state); @Override - public void update(@NotNull final AnActionEvent e) { + public void update(final @NotNull AnActionEvent e) { boolean selected = isSelected(e); final Presentation presentation = e.getPresentation(); Toggleable.setSelected(presentation, selected); diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/ToggleOptionAction.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/ToggleOptionAction.java index af2a7e75f71e..bc37a7f5112f 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/ToggleOptionAction.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/ToggleOptionAction.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.actionSystem; import com.intellij.openapi.util.NlsActions.ActionDescription; @@ -71,18 +71,14 @@ public class ToggleOptionAction extends ToggleAction { /** * @return a string to override an action name */ - @Nullable - @ActionText - default String getName() { + default @Nullable @ActionText String getName() { return null; } /** * @return a string to override an action description */ - @Nullable - @ActionDescription - default String getDescription() { + default @Nullable @ActionDescription String getDescription() { return null; } diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/CheckboxAction.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/CheckboxAction.java index 7c9f01d288fc..2673486e8082 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/CheckboxAction.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/CheckboxAction.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.actionSystem.ex; @@ -37,9 +37,8 @@ public abstract class CheckboxAction extends ToggleAction implements CustomCompo super(dynamicText, dynamicDescription, icon); } - @NotNull @Override - public JComponent createCustomComponent(@NotNull Presentation presentation, @NotNull String place) { + public @NotNull JComponent createCustomComponent(@NotNull Presentation presentation, @NotNull String place) { JBCheckBox checkBox = new JBCheckBox(); checkBox.setFocusable(false); return createCheckboxComponent(checkBox, this, place); @@ -67,8 +66,7 @@ public abstract class CheckboxAction extends ToggleAction implements CustomCompo checkBox.setVisible(presentation.isVisible()); } - @NotNull - static JComponent createCheckboxComponent(@NotNull JCheckBox checkBox, @NotNull AnAction action, @NotNull String place) { + static @NotNull JComponent createCheckboxComponent(@NotNull JCheckBox checkBox, @NotNull AnAction action, @NotNull String place) { // this component cannot be stored right in AnAction because of action system architecture: // one action can be shown on multiple toolbars simultaneously checkBox.setOpaque(false); diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/DefaultCustomComponentAction.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/DefaultCustomComponentAction.java index 2850252f3de5..58b852bbcf0d 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/DefaultCustomComponentAction.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/DefaultCustomComponentAction.java @@ -1,4 +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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.actionSystem.ex; import com.intellij.ide.lightEdit.LightEditCompatible; @@ -11,7 +11,7 @@ import javax.swing.*; import java.util.function.Supplier; public class DefaultCustomComponentAction extends AnAction implements CustomComponentAction, LightEditCompatible { - @NotNull private final Supplier myProducer; + private final @NotNull Supplier myProducer; public DefaultCustomComponentAction(@NotNull Supplier producer) { myProducer = producer; @@ -22,9 +22,8 @@ public class DefaultCustomComponentAction extends AnAction implements CustomComp //do nothing } - @NotNull @Override - public JComponent createCustomComponent(@NotNull Presentation presentation, @NotNull String place) { + public @NotNull JComponent createCustomComponent(@NotNull Presentation presentation, @NotNull String place) { return myProducer.get(); } } diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ThreeStateCheckboxAction.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ThreeStateCheckboxAction.java index c0c2a4764c50..d2a4395b4b3f 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ThreeStateCheckboxAction.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ThreeStateCheckboxAction.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.actionSystem.ex; @@ -16,7 +16,7 @@ import javax.swing.*; import java.util.function.Supplier; public abstract class ThreeStateCheckboxAction extends AnAction implements CustomComponentAction { - @NonNls public static final Key STATE_PROPERTY = Key.create("three_state_selected"); + public static final @NonNls Key STATE_PROPERTY = Key.create("three_state_selected"); protected ThreeStateCheckboxAction() {} @@ -37,14 +37,13 @@ public abstract class ThreeStateCheckboxAction extends AnAction implements Custo super(dynamicText, dynamicDescription, icon); } - @NotNull - public abstract ThreeStateCheckBox.State isSelected(AnActionEvent e); + public abstract @NotNull ThreeStateCheckBox.State isSelected(AnActionEvent e); public abstract void setSelected(AnActionEvent e, @NotNull ThreeStateCheckBox.State state); @Override - public final void actionPerformed(@NotNull final AnActionEvent e) { + public final void actionPerformed(final @NotNull AnActionEvent e) { ThreeStateCheckBox.State state = isSelected(e); Presentation presentation = e.getPresentation(); @@ -54,16 +53,15 @@ public abstract class ThreeStateCheckboxAction extends AnAction implements Custo } @Override - public void update(@NotNull final AnActionEvent e) { + public void update(final @NotNull AnActionEvent e) { ThreeStateCheckBox.State state = isSelected(e); Presentation presentation = e.getPresentation(); presentation.putClientProperty(STATE_PROPERTY, state); } - @NotNull @Override - public JComponent createCustomComponent(@NotNull Presentation presentation, @NotNull String place) { + public @NotNull JComponent createCustomComponent(@NotNull Presentation presentation, @NotNull String place) { // this component cannot be stored right here because of the action system architecture: // one action can be shown on multiple toolbars simultaneously ThreeStateCheckBox checkBox = new ThreeStateCheckBox(); diff --git a/platform/platform-api/src/com/intellij/openapi/diagnostic/IdeaLoggingEvent.java b/platform/platform-api/src/com/intellij/openapi/diagnostic/IdeaLoggingEvent.java index f8f07c96e938..5ee65ce6eb87 100644 --- a/platform/platform-api/src/com/intellij/openapi/diagnostic/IdeaLoggingEvent.java +++ b/platform/platform-api/src/com/intellij/openapi/diagnostic/IdeaLoggingEvent.java @@ -1,4 +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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.diagnostic; import com.intellij.openapi.util.text.StringUtil; @@ -34,8 +34,7 @@ public class IdeaLoggingEvent { return myThrowable != null ? StringUtil.getThrowableText(myThrowable) : ""; } - @Nullable - public Object getData() { + public @Nullable Object getData() { return myData; } diff --git a/platform/platform-api/src/com/intellij/openapi/editor/EditorModificationUtil.java b/platform/platform-api/src/com/intellij/openapi/editor/EditorModificationUtil.java index b41fe9a3d51a..c23e03d95b49 100644 --- a/platform/platform-api/src/com/intellij/openapi/editor/EditorModificationUtil.java +++ b/platform/platform-api/src/com/intellij/openapi/editor/EditorModificationUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.editor; import com.intellij.codeInsight.hint.HintManager; @@ -37,8 +37,7 @@ public final class EditorModificationUtil extends EditorModificationUtilEx { editor.getSelectionModel().setBlockSelection(new LogicalPosition(startLine, caretColumn), new LogicalPosition(endLine, caretColumn)); } - @Nullable - public static Transferable getContentsToPasteToEditor(@Nullable Producer producer) { + public static @Nullable Transferable getContentsToPasteToEditor(@Nullable Producer producer) { if (producer == null) { CopyPasteManager manager = CopyPasteManager.getInstance(); return manager.areDataFlavorsAvailable(DataFlavor.stringFlavor) ? manager.getContents() : null; @@ -48,8 +47,7 @@ public final class EditorModificationUtil extends EditorModificationUtilEx { } } - @Nullable - public static String getStringContent(@NotNull Transferable content) { + public static @Nullable String getStringContent(@NotNull Transferable content) { RawText raw = RawText.fromTransferable(content); if (raw != null) return raw.rawText; @@ -91,9 +89,8 @@ public final class EditorModificationUtil extends EditorModificationUtilEx { caretModel.moveToOffset(caretModel.getOffset() + caretShift); } - @NotNull - public static List calcBlockSelectionState(@NotNull Editor editor, - @NotNull LogicalPosition blockStart, @NotNull LogicalPosition blockEnd) { + public static @NotNull List calcBlockSelectionState(@NotNull Editor editor, + @NotNull LogicalPosition blockStart, @NotNull LogicalPosition blockEnd) { int startLine = Math.max(Math.min(blockStart.line, editor.getDocument().getLineCount() - 1), 0); int endLine = Math.max(Math.min(blockEnd.line, editor.getDocument().getLineCount() - 1), 0); int step = endLine < startLine ? -1 : 1; diff --git a/platform/platform-api/src/com/intellij/openapi/editor/EditorNavigationDelegateAdapter.java b/platform/platform-api/src/com/intellij/openapi/editor/EditorNavigationDelegateAdapter.java index ed4e38e6106b..5f50a23c57f6 100644 --- a/platform/platform-api/src/com/intellij/openapi/editor/EditorNavigationDelegateAdapter.java +++ b/platform/platform-api/src/com/intellij/openapi/editor/EditorNavigationDelegateAdapter.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.editor; import com.intellij.openapi.actionSystem.DataContext; @@ -20,9 +6,8 @@ import org.jetbrains.annotations.NotNull; public class EditorNavigationDelegateAdapter implements EditorNavigationDelegate { - @NotNull @Override - public Result navigateToLineEnd(@NotNull Editor editor, @NotNull DataContext dataContext) { + public @NotNull Result navigateToLineEnd(@NotNull Editor editor, @NotNull DataContext dataContext) { return Result.CONTINUE; } } diff --git a/platform/platform-api/src/com/intellij/openapi/editor/RawText.java b/platform/platform-api/src/com/intellij/openapi/editor/RawText.java index a66d4aa1e670..55d65de64872 100644 --- a/platform/platform-api/src/com/intellij/openapi/editor/RawText.java +++ b/platform/platform-api/src/com/intellij/openapi/editor/RawText.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.editor; import org.jetbrains.annotations.Nullable; @@ -41,8 +41,7 @@ public class RawText implements Cloneable, Serializable { return null; } - @Nullable - public static RawText fromTransferable(Transferable content) { + public static @Nullable RawText fromTransferable(Transferable content) { DataFlavor flavor = getDataFlavor(); if (flavor != null) { diff --git a/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorAction.java b/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorAction.java index fc3298a8ed13..2a36ccaf0347 100644 --- a/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorAction.java +++ b/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorAction.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.editor.actionSystem; import com.intellij.ide.lightEdit.LightEditCompatible; @@ -36,7 +36,7 @@ public abstract class EditorAction extends AnAction implements DumbAware, LightE return ActionUpdateThread.BGT; } - public synchronized final EditorActionHandler setupHandler(@NotNull EditorActionHandler newHandler) { + public final synchronized EditorActionHandler setupHandler(@NotNull EditorActionHandler newHandler) { EditorActionHandler tmp = getHandler(); doSetupHandler(newHandler); return tmp; @@ -77,12 +77,11 @@ public abstract class EditorAction extends AnAction implements DumbAware, LightE actionPerformed(editor, dataContext); } - @Nullable - protected Editor getEditor(@NotNull DataContext dataContext) { + protected @Nullable Editor getEditor(@NotNull DataContext dataContext) { return EDITOR.getData(dataContext); } - public final void actionPerformed(final Editor editor, @NotNull final DataContext dataContext) { + public final void actionPerformed(final Editor editor, final @NotNull DataContext dataContext) { if (editor == null) return; if (editor.isDisposed()) { VirtualFile file = FileDocumentManager.getInstance().getFile(editor.getDocument()); diff --git a/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorActionHandler.java b/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorActionHandler.java index 7232894708b6..5662a6134f79 100644 --- a/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorActionHandler.java +++ b/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorActionHandler.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.editor.actionSystem; import com.intellij.lang.injection.InjectedLanguageManager; @@ -180,7 +180,7 @@ public abstract class EditorActionHandler { * @param editor the editor in which the action is invoked. * @param dataContext the data context for the action. */ - public final void execute(@NotNull Editor editor, @Nullable final Caret contextCaret, final DataContext dataContext) { + public final void execute(@NotNull Editor editor, final @Nullable Caret contextCaret, final DataContext dataContext) { Editor hostEditor = dataContext == null ? null : CommonDataKeys.HOST_EDITOR.getData(dataContext); if (hostEditor == null) { hostEditor = editor; @@ -222,7 +222,7 @@ public abstract class EditorActionHandler { void perform(@NotNull Caret caret, @Nullable DataContext dataContext); } - public static abstract class ForEachCaret extends EditorActionHandler { + public abstract static class ForEachCaret extends EditorActionHandler { protected ForEachCaret() { super(true); } diff --git a/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorActionManager.java b/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorActionManager.java index 7ecf8f06dde2..b0bb57c4ff66 100644 --- a/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorActionManager.java +++ b/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorActionManager.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.editor.actionSystem; import com.intellij.openapi.application.ApplicationManager; @@ -44,8 +44,7 @@ public abstract class EditorActionManager { * @deprecated Use {@link TypedAction#getInstance()} instead */ @Deprecated - @NotNull - public abstract TypedAction getTypedAction(); + public abstract @NotNull TypedAction getTypedAction(); /** * Gets the default handler which is invoked on attempt to modify a read-only fragment in the editor. diff --git a/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorWriteActionHandler.java b/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorWriteActionHandler.java index 620a6d7c4cdf..9a59c59ebed8 100644 --- a/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorWriteActionHandler.java +++ b/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorWriteActionHandler.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.editor.actionSystem; import com.intellij.codeInsight.intention.preview.IntentionPreviewUtils; @@ -39,7 +25,7 @@ public abstract class EditorWriteActionHandler extends EditorActionHandler { } @Override - public void doExecute(@NotNull final Editor editor, @Nullable final Caret caret, final DataContext dataContext) { + public void doExecute(final @NotNull Editor editor, final @Nullable Caret caret, final DataContext dataContext) { boolean preview = IntentionPreviewUtils.getPreviewEditor() == editor; if (!preview) { if (!EditorModificationUtil.checkModificationAllowed(editor)) return; @@ -92,7 +78,7 @@ public abstract class EditorWriteActionHandler extends EditorActionHandler { } } - public static abstract class ForEachCaret extends EditorWriteActionHandler { + public abstract static class ForEachCaret extends EditorWriteActionHandler { protected ForEachCaret() { super(true); } diff --git a/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/TypedAction.java b/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/TypedAction.java index 5e1d64c4c92d..8c48abc978fb 100644 --- a/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/TypedAction.java +++ b/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/TypedAction.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.editor.actionSystem; import com.intellij.diagnostic.PluginException; @@ -131,8 +131,7 @@ public abstract class TypedAction { * * @return the current typing handler. */ - @NotNull - public TypedActionHandler getHandler() { + public @NotNull TypedActionHandler getHandler() { ensureHandlersLoaded(); return myHandler; } @@ -146,8 +145,7 @@ public abstract class TypedAction { * @deprecated Use <typedHandler> extension point for registering typing handlers */ @Deprecated - @NotNull - public TypedActionHandler setupHandler(@NotNull TypedActionHandler handler) { + public @NotNull TypedActionHandler setupHandler(@NotNull TypedActionHandler handler) { ensureHandlersLoaded(); TypedActionHandler tmp = myHandler; myHandler = handler; @@ -159,8 +157,7 @@ public abstract class TypedAction { * * @see #setupRawHandler(TypedActionHandler) */ - @NotNull - public TypedActionHandler getRawHandler() { + public @NotNull TypedActionHandler getRawHandler() { return myRawHandler; } @@ -194,7 +191,7 @@ public abstract class TypedAction { } } - public final void actionPerformed(@NotNull final Editor editor, final char charTyped, @NotNull DataContext dataContext) { + public final void actionPerformed(final @NotNull Editor editor, final char charTyped, @NotNull DataContext dataContext) { Project project = CommonDataKeys.PROJECT.getData(dataContext); try (var ignored = SlowOperations.startSection(SlowOperations.ACTION_PERFORM)) { FreezeLogger.getInstance().runUnderPerformanceMonitor( diff --git a/platform/platform-api/src/com/intellij/openapi/editor/event/MockDocumentEvent.java b/platform/platform-api/src/com/intellij/openapi/editor/event/MockDocumentEvent.java index 7f4af8dde565..6f70bcd04b37 100644 --- a/platform/platform-api/src/com/intellij/openapi/editor/event/MockDocumentEvent.java +++ b/platform/platform-api/src/com/intellij/openapi/editor/event/MockDocumentEvent.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.editor.event; import com.intellij.openapi.editor.Document; @@ -30,14 +30,12 @@ public class MockDocumentEvent extends DocumentEvent { } @Override - @NotNull - public CharSequence getOldFragment() { + public @NotNull CharSequence getOldFragment() { return ""; } @Override - @NotNull - public CharSequence getNewFragment() { + public @NotNull CharSequence getNewFragment() { return ""; } diff --git a/platform/platform-api/src/com/intellij/openapi/editor/highlighter/FragmentedEditorHighlighter.java b/platform/platform-api/src/com/intellij/openapi/editor/highlighter/FragmentedEditorHighlighter.java index 468c5e986b2f..b94828a8492a 100644 --- a/platform/platform-api/src/com/intellij/openapi/editor/highlighter/FragmentedEditorHighlighter.java +++ b/platform/platform-api/src/com/intellij/openapi/editor/highlighter/FragmentedEditorHighlighter.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.editor.highlighter; import com.intellij.openapi.editor.Document; @@ -92,9 +92,8 @@ public class FragmentedEditorHighlighter implements EditorHighlighter { } } - @NotNull @Override - public HighlighterIterator createIterator(int startOffset) { + public @NotNull HighlighterIterator createIterator(int startOffset) { int index = Collections.binarySearch(myPieces, new Element(startOffset, 0, null, null), Comparator.comparingInt(Element::getStart)); // index: (-insertion point - 1), where insertionPoint is the index of the first element greater than the key // and we need index of the first element that is less or equal (floorElement) diff --git a/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooser.java b/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooser.java index 0509bc8bf3c8..b8d49c8bb345 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooser.java +++ b/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooser.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.fileChooser; import com.intellij.openapi.diagnostic.Logger; @@ -32,32 +32,30 @@ public final class FileChooser { private FileChooser() { } - public static VirtualFile @NotNull [] chooseFiles(@NotNull final FileChooserDescriptor descriptor, - @Nullable final Project project, - @Nullable final VirtualFile toSelect) { + public static VirtualFile @NotNull [] chooseFiles(final @NotNull FileChooserDescriptor descriptor, + final @Nullable Project project, + final @Nullable VirtualFile toSelect) { return chooseFiles(descriptor, null, project, toSelect); } - public static VirtualFile @NotNull [] chooseFiles(@NotNull final FileChooserDescriptor descriptor, - @Nullable final Component parent, - @Nullable final Project project, - @Nullable final VirtualFile toSelect) { + public static VirtualFile @NotNull [] chooseFiles(final @NotNull FileChooserDescriptor descriptor, + final @Nullable Component parent, + final @Nullable Project project, + final @Nullable VirtualFile toSelect) { final FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, project, parent); return chooser.choose(project, toSelect); } - @Nullable - public static VirtualFile chooseFile(@NotNull final FileChooserDescriptor descriptor, - @Nullable final Project project, - @Nullable final VirtualFile toSelect) { + public static @Nullable VirtualFile chooseFile(final @NotNull FileChooserDescriptor descriptor, + final @Nullable Project project, + final @Nullable VirtualFile toSelect) { return chooseFile(descriptor, null, project, toSelect); } - @Nullable - public static VirtualFile chooseFile(@NotNull final FileChooserDescriptor descriptor, - @Nullable final Component parent, - @Nullable final Project project, - @Nullable final VirtualFile toSelect) { + public static @Nullable VirtualFile chooseFile(final @NotNull FileChooserDescriptor descriptor, + final @Nullable Component parent, + final @Nullable Project project, + final @Nullable VirtualFile toSelect) { Component parentComponent = parent == null ? KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow() : parent; LOG.assertTrue(!descriptor.isChooseMultiple()); return ArrayUtil.getFirstElement(chooseFiles(descriptor, parentComponent, project, toSelect)); @@ -73,10 +71,10 @@ public final class FileChooser { * @param callback invoked after user closes dialog, and only if there are selected files * @see FileChooserConsumer */ - public static void chooseFiles(@NotNull final FileChooserDescriptor descriptor, - @Nullable final Project project, - @Nullable final VirtualFile toSelect, - @NotNull final Consumer> callback) { + public static void chooseFiles(final @NotNull FileChooserDescriptor descriptor, + final @Nullable Project project, + final @Nullable VirtualFile toSelect, + final @NotNull Consumer> callback) { chooseFiles(descriptor, project, null, toSelect, callback); } @@ -91,11 +89,11 @@ public final class FileChooser { * @param callback invoked after user closes dialog, and only if there are selected files * @see FileChooserConsumer */ - public static void chooseFiles(@NotNull final FileChooserDescriptor descriptor, - @Nullable final Project project, - @Nullable final Component parent, - @Nullable final VirtualFile toSelect, - @NotNull final Consumer> callback) { + public static void chooseFiles(final @NotNull FileChooserDescriptor descriptor, + final @Nullable Project project, + final @Nullable Component parent, + final @Nullable VirtualFile toSelect, + final @NotNull Consumer> callback) { Component parentComponent = parent == null ? WindowManager.getInstance().suggestParentWindow(project) : parent; final FileChooserFactory factory = FileChooserFactory.getInstance(); final PathChooserDialog pathChooser = factory.createPathChooser(descriptor, project, parentComponent); @@ -111,10 +109,10 @@ public final class FileChooser { * @param toSelect file to preselect * @param callback invoked after user closes dialog, and only if there is selected file */ - public static void chooseFile(@NotNull final FileChooserDescriptor descriptor, - @Nullable final Project project, - @Nullable final VirtualFile toSelect, - @NotNull final Consumer callback) { + public static void chooseFile(final @NotNull FileChooserDescriptor descriptor, + final @Nullable Project project, + final @Nullable VirtualFile toSelect, + final @NotNull Consumer callback) { chooseFile(descriptor, project, null, toSelect, callback); } @@ -128,11 +126,11 @@ public final class FileChooser { * @param toSelect file to preselect * @param callback invoked after user closes dialog, and only if there is selected file */ - public static void chooseFile(@NotNull final FileChooserDescriptor descriptor, - @Nullable final Project project, - @Nullable final Component parent, - @Nullable final VirtualFile toSelect, - @NotNull final Consumer callback) { + public static void chooseFile(final @NotNull FileChooserDescriptor descriptor, + final @Nullable Project project, + final @Nullable Component parent, + final @Nullable VirtualFile toSelect, + final @NotNull Consumer callback) { LOG.assertTrue(!descriptor.isChooseMultiple()); chooseFiles(descriptor, project, parent, toSelect, files -> callback.consume(files.get(0))); } diff --git a/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserFactory.java b/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserFactory.java index 43b15d5e291a..23e272435a8a 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserFactory.java +++ b/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserFactory.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.fileChooser; import com.intellij.openapi.Disposable; @@ -15,15 +15,13 @@ public abstract class FileChooserFactory { return ApplicationManager.getApplication().getService(FileChooserFactory.class); } - @NotNull - public abstract FileChooserDialog createFileChooser(@NotNull FileChooserDescriptor descriptor, - @Nullable Project project, - @Nullable Component parent); + public abstract @NotNull FileChooserDialog createFileChooser(@NotNull FileChooserDescriptor descriptor, + @Nullable Project project, + @Nullable Component parent); - @NotNull - public abstract PathChooserDialog createPathChooser(@NotNull FileChooserDescriptor descriptor, - @Nullable Project project, - @Nullable Component parent); + public abstract @NotNull PathChooserDialog createPathChooser(@NotNull FileChooserDescriptor descriptor, + @Nullable Project project, + @Nullable Component parent); /** * Creates Save File dialog. @@ -32,17 +30,13 @@ public abstract class FileChooserFactory { * @param project chooser options * @return Save File dialog */ - @NotNull - public abstract FileSaverDialog createSaveFileDialog(@NotNull FileSaverDescriptor descriptor, @Nullable Project project); + public abstract @NotNull FileSaverDialog createSaveFileDialog(@NotNull FileSaverDescriptor descriptor, @Nullable Project project); - @NotNull - public abstract FileSaverDialog createSaveFileDialog(@NotNull FileSaverDescriptor descriptor, @NotNull Component parent); + public abstract @NotNull FileSaverDialog createSaveFileDialog(@NotNull FileSaverDescriptor descriptor, @NotNull Component parent); - @NotNull - public abstract FileTextField createFileTextField(@NotNull FileChooserDescriptor descriptor, boolean showHidden, @Nullable Disposable parent); + public abstract @NotNull FileTextField createFileTextField(@NotNull FileChooserDescriptor descriptor, boolean showHidden, @Nullable Disposable parent); - @NotNull - public FileTextField createFileTextField(@NotNull FileChooserDescriptor descriptor, @Nullable Disposable parent) { + public @NotNull FileTextField createFileTextField(@NotNull FileChooserDescriptor descriptor, @Nullable Disposable parent) { return createFileTextField(descriptor, true, parent); } diff --git a/platform/platform-api/src/com/intellij/openapi/fileChooser/PathChooserDialog.java b/platform/platform-api/src/com/intellij/openapi/fileChooser/PathChooserDialog.java index c593695428f4..1d4e15b6305e 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileChooser/PathChooserDialog.java +++ b/platform/platform-api/src/com/intellij/openapi/fileChooser/PathChooserDialog.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.fileChooser; import com.intellij.openapi.actionSystem.DataKey; @@ -29,5 +15,5 @@ import java.util.List; public interface PathChooserDialog { DataKey PREFER_LAST_OVER_EXPLICIT = DataKey.create("prefer.last.over.explicit"); - void choose(@Nullable VirtualFile toSelect, @NotNull final Consumer> callback); + void choose(@Nullable VirtualFile toSelect, final @NotNull Consumer> callback); } diff --git a/platform/platform-api/src/com/intellij/openapi/help/WebHelpProvider.java b/platform/platform-api/src/com/intellij/openapi/help/WebHelpProvider.java index 0a45a567d6c8..949345230b0c 100644 --- a/platform/platform-api/src/com/intellij/openapi/help/WebHelpProvider.java +++ b/platform/platform-api/src/com/intellij/openapi/help/WebHelpProvider.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.help; import com.intellij.openapi.extensions.PluginAware; @@ -24,16 +24,14 @@ public abstract class WebHelpProvider implements PluginAware { * * @param helpTopicId full ID of help topic including {@code '.'} prefix */ - @Nullable - public abstract String getHelpPageUrl(@NotNull String helpTopicId); + public abstract @Nullable String getHelpPageUrl(@NotNull String helpTopicId); @Override public final void setPluginDescriptor(@NotNull PluginDescriptor pluginDescriptor) { myHelpTopicPrefix = pluginDescriptor.getPluginId().getIdString() + "."; } - @NotNull - public String getHelpTopicPrefix() { + public @NotNull String getHelpTopicPrefix() { return myHelpTopicPrefix; } } diff --git a/platform/platform-api/src/com/intellij/openapi/ide/KillRingTransferable.java b/platform/platform-api/src/com/intellij/openapi/ide/KillRingTransferable.java index 2b203706f038..61210819edeb 100644 --- a/platform/platform-api/src/com/intellij/openapi/ide/KillRingTransferable.java +++ b/platform/platform-api/src/com/intellij/openapi/ide/KillRingTransferable.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ide; import com.intellij.openapi.editor.Document; @@ -87,8 +73,7 @@ public class KillRingTransferable implements Transferable { return myData; } - @Nullable - public Document getDocument() { + public @Nullable Document getDocument() { return myDocument.get(); } diff --git a/platform/platform-api/src/com/intellij/openapi/keymap/KeymapManager.java b/platform/platform-api/src/com/intellij/openapi/keymap/KeymapManager.java index 3406e6ac71f4..f159e5f852bb 100644 --- a/platform/platform-api/src/com/intellij/openapi/keymap/KeymapManager.java +++ b/platform/platform-api/src/com/intellij/openapi/keymap/KeymapManager.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.keymap; import com.intellij.diagnostic.LoadingState; @@ -16,11 +16,9 @@ public abstract class KeymapManager { public static final String KDE_KEYMAP = "Default for KDE"; public static final String GNOME_KEYMAP = "Default for GNOME"; - @NotNull - public abstract Keymap getActiveKeymap(); + public abstract @NotNull Keymap getActiveKeymap(); - @Nullable - public abstract Keymap getKeymap(@NotNull String name); + public abstract @Nullable Keymap getKeymap(@NotNull String name); private static volatile KeymapManager INSTANCE; diff --git a/platform/platform-api/src/com/intellij/openapi/keymap/KeymapTextContext.java b/platform/platform-api/src/com/intellij/openapi/keymap/KeymapTextContext.java index 0aa024cfcdbe..1f04eef18dff 100644 --- a/platform/platform-api/src/com/intellij/openapi/keymap/KeymapTextContext.java +++ b/platform/platform-api/src/com/intellij/openapi/keymap/KeymapTextContext.java @@ -16,26 +16,23 @@ import java.awt.event.KeyEvent; import java.util.StringTokenizer; public class KeymapTextContext { - @NonNls private static final String CANCEL_KEY_TEXT = "Cancel"; - @NonNls private static final String BREAK_KEY_TEXT = "Break"; - @NonNls private static final String SHIFT = "shift"; - @NonNls private static final String CONTROL = "control"; - @NonNls private static final String CTRL = "ctrl"; - @NonNls private static final String META = "meta"; - @NonNls private static final String ALT = "alt"; - @NonNls private static final String ALT_GRAPH = "altGraph"; - @NonNls private static final String DOUBLE_CLICK = "doubleClick"; + private static final @NonNls String CANCEL_KEY_TEXT = "Cancel"; + private static final @NonNls String BREAK_KEY_TEXT = "Break"; + private static final @NonNls String SHIFT = "shift"; + private static final @NonNls String CONTROL = "control"; + private static final @NonNls String CTRL = "ctrl"; + private static final @NonNls String META = "meta"; + private static final @NonNls String ALT = "alt"; + private static final @NonNls String ALT_GRAPH = "altGraph"; + private static final @NonNls String DOUBLE_CLICK = "doubleClick"; - @NlsSafe - @NotNull - public String getShortcutText(@NotNull @NonNls String actionId) { + public @NlsSafe @NotNull String getShortcutText(@NotNull @NonNls String actionId) { KeyboardShortcut shortcut = ActionManager.getInstance().getKeyboardShortcut(actionId); if (shortcut == null) return ""; return getShortcutText(shortcut); } - @NotNull - public @NlsSafe String getShortcutText(@NotNull Shortcut shortcut) { + public @NotNull @NlsSafe String getShortcutText(@NotNull Shortcut shortcut) { String s = ""; if (shortcut instanceof KeyboardShortcut keyboardShortcut) { @@ -63,8 +60,7 @@ public class KeymapTextContext { return s; } - @NotNull - public String getMouseShortcutText(@NotNull MouseShortcut shortcut) { + public @NotNull String getMouseShortcutText(@NotNull MouseShortcut shortcut) { if (shortcut instanceof PressureShortcut) return shortcut.toString(); return getMouseShortcutText(shortcut.getButton(), shortcut.getModifiers(), shortcut.getClickCount()); } @@ -75,8 +71,7 @@ public class KeymapTextContext { * @param clickCount target clicks count * @return string representation of passed mouse shortcut. */ - @NotNull - private String getMouseShortcutText(int button, @JdkConstants.InputEventMask int modifiers, int clickCount) { + private @NotNull String getMouseShortcutText(int button, @JdkConstants.InputEventMask int modifiers, int clickCount) { String resource; if (button == MouseShortcut.BUTTON_WHEEL_UP) { resource = "mouse.wheel.rotate.up.shortcut.text"; @@ -117,8 +112,7 @@ public class KeymapTextContext { return modifiers; } - @NotNull - public @NlsSafe String getKeystrokeText(KeyStroke accelerator) { + public @NotNull @NlsSafe String getKeystrokeText(KeyStroke accelerator) { if (accelerator == null) return ""; if (isNativeMacShortcuts()) { return MacKeymapUtil.getKeyStrokeText(accelerator); @@ -134,8 +128,7 @@ public class KeymapTextContext { return acceleratorText.trim(); } - @NotNull - public String getKeyText(int code) { + public @NotNull String getKeyText(int code) { return switch (code) { case KeyEvent.VK_BACK_QUOTE -> "`"; case KeyEvent.VK_SEPARATOR -> ","; @@ -163,8 +156,7 @@ public class KeymapTextContext { return SystemInfo.isMac && AdvancedSettings.getInstanceIfCreated() != null && AdvancedSettings.getBoolean("ide.macos.disable.native.shortcut.symbols"); } - @NotNull - private String getModifiersText(@JdkConstants.InputEventMask int modifiers) { + private @NotNull String getModifiersText(@JdkConstants.InputEventMask int modifiers) { if (isNativeMacShortcuts()) { //try { // Class appleLaf = Class.forName(APPLE_LAF_AQUA_LOOK_AND_FEEL_CLASS_NAME); @@ -285,8 +277,7 @@ public class KeymapTextContext { * @return shortcut for the given keystroke * @throws InvalidDataException if {@code keystrokeString} doesn't represent valid {@code MouseShortcut}. */ - @NotNull - public MouseShortcut parseMouseShortcut(@NotNull String keystrokeString) throws InvalidDataException { + public @NotNull MouseShortcut parseMouseShortcut(@NotNull String keystrokeString) throws InvalidDataException { if (keystrokeString.startsWith("Force touch")) { return new PressureShortcut(2); } @@ -333,8 +324,7 @@ public class KeymapTextContext { * @return string representation of passed mouse shortcut. This method should * be used only for serializing of the {@code MouseShortcut} */ - @NotNull - public String getMouseShortcutString(@NotNull MouseShortcut shortcut) { + public @NotNull String getMouseShortcutString(@NotNull MouseShortcut shortcut) { if (shortcut instanceof PressureShortcut) { return "Force touch"; } diff --git a/platform/platform-api/src/com/intellij/openapi/keymap/KeymapUtil.java b/platform/platform-api/src/com/intellij/openapi/keymap/KeymapUtil.java index ee055c502cc1..986cb48a125d 100644 --- a/platform/platform-api/src/com/intellij/openapi/keymap/KeymapUtil.java +++ b/platform/platform-api/src/com/intellij/openapi/keymap/KeymapUtil.java @@ -38,37 +38,29 @@ public final class KeymapUtil { private KeymapUtil() { } - @NlsSafe - @NotNull - public static String getShortcutText(@NotNull @NonNls String actionId) { + public static @NlsSafe @NotNull String getShortcutText(@NotNull @NonNls String actionId) { return defaultKeymapTextContext.getShortcutText(actionId); } - @NlsSafe - @Nullable - public static String getShortcutTextOrNull(@NotNull @NonNls String actionId) { + public static @NlsSafe @Nullable String getShortcutTextOrNull(@NotNull @NonNls String actionId) { KeyboardShortcut shortcut = ActionManager.getInstance().getKeyboardShortcut(actionId); if (shortcut == null) return null; return getShortcutText(shortcut); } - @NotNull - public static @NlsSafe String getShortcutText(@NotNull Shortcut shortcut) { + public static @NotNull @NlsSafe String getShortcutText(@NotNull Shortcut shortcut) { return defaultKeymapTextContext.getShortcutText(shortcut); } - @NotNull - public static String getMouseShortcutText(@NotNull MouseShortcut shortcut) { + public static @NotNull String getMouseShortcutText(@NotNull MouseShortcut shortcut) { return defaultKeymapTextContext.getMouseShortcutText(shortcut); } - @NotNull - public static @NlsSafe String getKeystrokeText(KeyStroke accelerator) { + public static @NotNull @NlsSafe String getKeystrokeText(KeyStroke accelerator) { return defaultKeymapTextContext.getKeystrokeText(accelerator); } - @NotNull - public static String getKeyText(int code) { + public static @NotNull String getKeyText(int code) { return defaultKeymapTextContext.getKeyText(code); } @@ -76,8 +68,7 @@ public final class KeymapUtil { return defaultKeymapTextContext.isSimplifiedMacShortcuts(); } - @NotNull - public static ShortcutSet getActiveKeymapShortcuts(@Nullable @NonNls String actionId) { + public static @NotNull ShortcutSet getActiveKeymapShortcuts(@Nullable @NonNls String actionId) { KeymapManager keymapManager = KeymapManager.getInstance(); if (keymapManager == null || actionId == null) { return new CustomShortcutSet(Shortcut.EMPTY_ARRAY); @@ -89,15 +80,13 @@ public final class KeymapUtil { * @param actionId action to find the shortcut for * @return first keyboard shortcut that activates given action in active keymap; null if not found */ - @Nullable - public static Shortcut getPrimaryShortcut(@Nullable @NonNls String actionId) { + public static @Nullable Shortcut getPrimaryShortcut(@Nullable @NonNls String actionId) { KeymapManager keymapManager = KeymapManager.getInstance(); if (keymapManager == null || actionId == null) return null; return ArrayUtil.getFirstElement(keymapManager.getActiveKeymap().getShortcuts(actionId)); } - @NotNull - public static @NlsSafe String getFirstKeyboardShortcutText(@NotNull @NonNls String actionId) { + public static @NotNull @NlsSafe String getFirstKeyboardShortcutText(@NotNull @NonNls String actionId) { for (Shortcut shortcut : getActiveKeymapShortcuts(actionId).getShortcuts()) { if (shortcut instanceof KeyboardShortcut) { return getShortcutText(shortcut); @@ -106,8 +95,7 @@ public final class KeymapUtil { return ""; } - @NotNull - public static @NlsSafe String getFirstMouseShortcutText(@NotNull @NonNls String actionId) { + public static @NotNull @NlsSafe String getFirstMouseShortcutText(@NotNull @NonNls String actionId) { for (Shortcut shortcut : getActiveKeymapShortcuts(actionId).getShortcuts()) { if (shortcut instanceof MouseShortcut) { return getShortcutText(shortcut); @@ -125,27 +113,23 @@ public final class KeymapUtil { return false; } - @NotNull - public static @NlsSafe String getFirstKeyboardShortcutText(@NotNull AnAction action) { + public static @NotNull @NlsSafe String getFirstKeyboardShortcutText(@NotNull AnAction action) { return getFirstKeyboardShortcutText(action.getShortcutSet()); } - @NotNull - public static @NlsSafe String getFirstKeyboardShortcutText(@NotNull ShortcutSet set) { + public static @NotNull @NlsSafe String getFirstKeyboardShortcutText(@NotNull ShortcutSet set) { Shortcut[] shortcuts = set.getShortcuts(); KeyboardShortcut shortcut = ContainerUtil.findInstance(shortcuts, KeyboardShortcut.class); return shortcut == null ? "" : getShortcutText(shortcut); } - @NotNull - public static @NlsSafe String getPreferredShortcutText(Shortcut @NotNull [] shortcuts) { + public static @NotNull @NlsSafe String getPreferredShortcutText(Shortcut @NotNull [] shortcuts) { KeyboardShortcut shortcut = ContainerUtil.findInstance(shortcuts, KeyboardShortcut.class); return shortcut != null ? getShortcutText(shortcut) : shortcuts.length > 0 ? getShortcutText(shortcuts[0]) : ""; } - @NotNull - public static @NlsSafe String getShortcutsText(Shortcut @NotNull [] shortcuts) { + public static @NotNull @NlsSafe String getShortcutsText(Shortcut @NotNull [] shortcuts) { if (shortcuts.length == 0) { return ""; } @@ -159,8 +143,7 @@ public final class KeymapUtil { * @return shortcut for the given keystroke * @throws InvalidDataException if {@code keystrokeString} doesn't represent valid {@code MouseShortcut}. */ - @NotNull - public static MouseShortcut parseMouseShortcut(@NotNull String keystrokeString) throws InvalidDataException { + public static @NotNull MouseShortcut parseMouseShortcut(@NotNull String keystrokeString) throws InvalidDataException { return defaultKeymapTextContext.parseMouseShortcut(keystrokeString); } @@ -168,8 +151,7 @@ public final class KeymapUtil { * @return string representation of passed mouse shortcut. This method should * be used only for serializing of the {@code MouseShortcut} */ - @NotNull - public static String getMouseShortcutString(@NotNull MouseShortcut shortcut) { + public static @NotNull String getMouseShortcutString(@NotNull MouseShortcut shortcut) { return defaultKeymapTextContext.getMouseShortcutString(shortcut); } @@ -235,8 +217,7 @@ public final class KeymapUtil { return false; } - @Nullable - public static KeyStroke getKeyStroke(@NotNull final ShortcutSet shortcutSet) { + public static @Nullable KeyStroke getKeyStroke(final @NotNull ShortcutSet shortcutSet) { final Shortcut[] shortcuts = shortcutSet.getShortcuts(); if (shortcuts.length == 0 || !(shortcuts[0] instanceof KeyboardShortcut shortcut)) return null; if (shortcut.getSecondKeyStroke() != null) { @@ -245,8 +226,7 @@ public final class KeymapUtil { return shortcut.getFirstKeyStroke(); } - @NotNull - public static Collection getKeyStrokes(@NotNull ShortcutSet shortcutSet) { + public static @NotNull Collection getKeyStrokes(@NotNull ShortcutSet shortcutSet) { Shortcut[] shortcuts = shortcutSet.getShortcuts(); if (shortcuts.length == 0) { return Collections.emptySet(); @@ -264,14 +244,12 @@ public final class KeymapUtil { return result.isEmpty() ? Collections.emptySet() : result; } - @NotNull - public static @NlsContexts.Tooltip String createTooltipText(@NotNull @NlsContexts.Tooltip String name, @NotNull @NonNls String actionId) { + public static @NotNull @NlsContexts.Tooltip String createTooltipText(@NotNull @NlsContexts.Tooltip String name, @NotNull @NonNls String actionId) { String text = getFirstKeyboardShortcutText(actionId); return text.isEmpty() ? name : name + " (" + text + ")"; } - @NotNull - public static @NlsSafe String createTooltipText(@Nullable String name, @NotNull AnAction action) { + public static @NotNull @NlsSafe String createTooltipText(@Nullable String name, @NotNull AnAction action) { String toolTipText = name == null ? "" : name; while (StringUtil.endsWithChar(toolTipText, '.')) { toolTipText = toolTipText.substring(0, toolTipText.length() - 1); @@ -303,8 +281,7 @@ public final class KeymapUtil { /** * Creates shortcut corresponding to a single-click event */ - @NotNull - public static MouseShortcut createMouseShortcut(@NotNull MouseEvent e) { + public static @NotNull MouseShortcut createMouseShortcut(@NotNull MouseEvent e) { int button = MouseShortcut.getButton(e); int modifiers = e.getModifiersEx(); if (button == MouseEvent.NOBUTTON && e.getID() == MouseEvent.MOUSE_DRAGGED) { @@ -388,8 +365,7 @@ public final class KeymapUtil { } } - @Nullable - public static ShortcutSet filterKeyStrokes(@NotNull ShortcutSet source, KeyStroke...toLeaveOut) { + public static @Nullable ShortcutSet filterKeyStrokes(@NotNull ShortcutSet source, KeyStroke...toLeaveOut) { List filtered = new ArrayList<>(Arrays.asList(source.getShortcuts())); for (Shortcut shortcut : source.getShortcuts()) { if (shortcut instanceof KeyboardShortcut) { @@ -405,8 +381,7 @@ public final class KeymapUtil { * @deprecated use {@link #getShortcutsForMnemonicChar} or {@link #getShortcutsForMnemonicCode} instead */ @Deprecated - @Nullable - public static CustomShortcutSet getMnemonicAsShortcut(int mnemonic) { + public static @Nullable CustomShortcutSet getMnemonicAsShortcut(int mnemonic) { return getShortcutsForMnemonicCode(mnemonic); } diff --git a/platform/platform-api/src/com/intellij/openapi/keymap/MacKeymapUtil.java b/platform/platform-api/src/com/intellij/openapi/keymap/MacKeymapUtil.java index 1b81673b9464..39d48f1aa474 100644 --- a/platform/platform-api/src/com/intellij/openapi/keymap/MacKeymapUtil.java +++ b/platform/platform-api/src/com/intellij/openapi/keymap/MacKeymapUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.keymap; import com.intellij.openapi.options.advanced.AdvancedSettings; @@ -47,8 +47,7 @@ public final class MacKeymapUtil { public static final String POWER3 = "\u233D"; public static final String NUM_PAD = "\u2328"; - @NotNull - public static String getModifiersText(@JdkConstants.InputEventMask int modifiers, String delimiter) { + public static @NotNull String getModifiersText(@JdkConstants.InputEventMask int modifiers, String delimiter) { StringJoiner buf = new StringJoiner(delimiter != null ? delimiter : ""); if ((modifiers & InputEvent.CTRL_MASK) != 0) buf.add(get(CONTROL, "Ctrl+")); if ((modifiers & InputEvent.ALT_MASK) != 0) buf.add(get(OPTION, "Alt+")); @@ -61,13 +60,11 @@ public final class MacKeymapUtil { } - @NotNull - static String getModifiersText(@JdkConstants.InputEventMask int modifiers) { + static @NotNull String getModifiersText(@JdkConstants.InputEventMask int modifiers) { return getModifiersText(modifiers, null); } - @NotNull - public static String getKeyText(int code) { + public static @NotNull String getKeyText(int code) { if (!isNativeShortcutSymbolsDisabled()) { return switch (code) { case KeyEvent.VK_BACK_SPACE -> get(BACKSPACE, "Backspace"); @@ -108,8 +105,7 @@ public final class MacKeymapUtil { return KeyEvent.getKeyText(code); } - @NotNull - public static String getKeyStrokeText(@NotNull KeyStroke keyStroke, String delimiter, boolean onlyDelimIntoModifiersAndKey) { + public static @NotNull String getKeyStrokeText(@NotNull KeyStroke keyStroke, String delimiter, boolean onlyDelimIntoModifiersAndKey) { String modifiers = getModifiersText(keyStroke.getModifiers()); final String key = KeymapUtil.getKeyText(keyStroke.getKeyCode()); @@ -124,13 +120,11 @@ public final class MacKeymapUtil { return modifiers + key; } - @NotNull - public static String getKeyStrokeText(@NotNull KeyStroke keyStroke) { + public static @NotNull String getKeyStrokeText(@NotNull KeyStroke keyStroke) { return getKeyStrokeText(keyStroke, null, true); } - @NotNull - private static String get(@NotNull String value, @NotNull String replacement) { + private static @NotNull String get(@NotNull String value, @NotNull String replacement) { if (isNativeShortcutSymbolsDisabled()) { return replacement; } @@ -141,8 +135,7 @@ public final class MacKeymapUtil { return AdvancedSettings.getInstanceIfCreated() != null && AdvancedSettings.getBoolean("ide.macos.disable.native.shortcut.symbols"); } - @NotNull - public static String getKeyModifiersTextForMacOSLeopard(@JdkConstants.InputEventMask int modifiers) { + public static @NotNull String getKeyModifiersTextForMacOSLeopard(@JdkConstants.InputEventMask int modifiers) { StringBuilder buf = new StringBuilder(); if ((modifiers & InputEvent.META_MASK) != 0) { buf.append("\u2318"); diff --git a/platform/platform-api/src/com/intellij/openapi/keymap/NationalKeyboardSupport.java b/platform/platform-api/src/com/intellij/openapi/keymap/NationalKeyboardSupport.java index 83076824a7f4..4f252738287b 100644 --- a/platform/platform-api/src/com/intellij/openapi/keymap/NationalKeyboardSupport.java +++ b/platform/platform-api/src/com/intellij/openapi/keymap/NationalKeyboardSupport.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.keymap; import com.intellij.openapi.application.ApplicationManager; @@ -61,14 +61,12 @@ public final class NationalKeyboardSupport implements PersistentStateComponent, S> implemen this.helpTopic = helpTopic; } - @NotNull @Override - public final String getId() { + public final @NotNull String getId() { return id; } @@ -34,14 +33,12 @@ public abstract class ConfigurableBase, S> implemen return displayName; } - @Nullable @Override - public final String getHelpTopic() { + public final @Nullable String getHelpTopic() { return helpTopic; } - @NotNull - protected abstract S getSettings(); + protected abstract @NotNull S getSettings(); @Override public void reset() { @@ -50,9 +47,8 @@ public abstract class ConfigurableBase, S> implemen } } - @NotNull @Override - public final JComponent createComponent() { + public final @NotNull JComponent createComponent() { if (ui == null) { ui = createUi(); } diff --git a/platform/platform-api/src/com/intellij/openapi/options/ConfigurableGroup.java b/platform/platform-api/src/com/intellij/openapi/options/ConfigurableGroup.java index d9a72bb91522..809e618f7d99 100644 --- a/platform/platform-api/src/com/intellij/openapi/options/ConfigurableGroup.java +++ b/platform/platform-api/src/com/intellij/openapi/options/ConfigurableGroup.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.options; import com.intellij.openapi.util.NlsContexts; @@ -8,8 +8,7 @@ public interface ConfigurableGroup extends Configurable.Composite { @NlsContexts.ConfigurableName String getDisplayName(); - @NlsContexts.DetailedDescription - default @Nullable String getDescription() { return null; } + default @NlsContexts.DetailedDescription @Nullable String getDescription() { return null; } /** * @deprecated unused diff --git a/platform/platform-api/src/com/intellij/openapi/options/ConfigurableSchemeExporter.java b/platform/platform-api/src/com/intellij/openapi/options/ConfigurableSchemeExporter.java index fd828d495d59..5fbc23e6afd9 100644 --- a/platform/platform-api/src/com/intellij/openapi/options/ConfigurableSchemeExporter.java +++ b/platform/platform-api/src/com/intellij/openapi/options/ConfigurableSchemeExporter.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.options; import com.intellij.openapi.project.Project; @@ -35,6 +21,5 @@ public abstract class ConfigurableSchemeExporter extends Sch public abstract void exportScheme(@NotNull T scheme, @NotNull OutputStream outputStream, @Nullable C exportConfig) throws Exception; - @Nullable - public abstract C getConfiguration(@NotNull Component parent, @NotNull T scheme); + public abstract @Nullable C getConfiguration(@NotNull Component parent, @NotNull T scheme); } diff --git a/platform/platform-api/src/com/intellij/openapi/options/ConfigurableUi.java b/platform/platform-api/src/com/intellij/openapi/options/ConfigurableUi.java index acec0e9456b0..44a594521b49 100644 --- a/platform/platform-api/src/com/intellij/openapi/options/ConfigurableUi.java +++ b/platform/platform-api/src/com/intellij/openapi/options/ConfigurableUi.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.options; import org.jetbrains.annotations.NotNull; @@ -19,13 +19,11 @@ public interface ConfigurableUi { @NotNull JComponent getComponent(); - @Nullable - default JComponent getPreferredFocusedComponent() { + default @Nullable JComponent getPreferredFocusedComponent() { return null; } - @Nullable - default Runnable enableSearch(String option) { + default @Nullable Runnable enableSearch(String option) { return null; } } \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/openapi/options/SchemeExporter.java b/platform/platform-api/src/com/intellij/openapi/options/SchemeExporter.java index 97fe7c4b6643..e7157c046e91 100644 --- a/platform/platform-api/src/com/intellij/openapi/options/SchemeExporter.java +++ b/platform/platform-api/src/com/intellij/openapi/options/SchemeExporter.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.options; import com.intellij.openapi.project.Project; @@ -51,8 +51,7 @@ public abstract class SchemeExporter { /** * @return A directory which should be preselected for the given project if any. */ - @NotNull - public VirtualFile getDefaultDir(@Nullable Project project) { + public @NotNull VirtualFile getDefaultDir(@Nullable Project project) { return Objects.requireNonNull(VfsUtil.getUserHomeDir()); } } diff --git a/platform/platform-api/src/com/intellij/openapi/options/SchemeImporter.java b/platform/platform-api/src/com/intellij/openapi/options/SchemeImporter.java index b97a31cd9d3f..935e887fb12b 100644 --- a/platform/platform-api/src/com/intellij/openapi/options/SchemeImporter.java +++ b/platform/platform-api/src/com/intellij/openapi/options/SchemeImporter.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.options; import com.intellij.openapi.project.Project; @@ -41,16 +41,14 @@ public interface SchemeImporter { * @param scheme The imported scheme. * @return An information message to be displayed after import. */ - @Nullable - default @NlsContexts.NotificationContent String getAdditionalImportInfo(@NotNull T scheme) { + default @Nullable @NlsContexts.NotificationContent String getAdditionalImportInfo(@NotNull T scheme) { return null; } /** * @return File to import scheme. If {@code null}, file chooser is shown. */ - @Nullable - default VirtualFile getImportFile() { + default @Nullable VirtualFile getImportFile() { return null; } } \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/openapi/options/SettingsEditorConfigurable.java b/platform/platform-api/src/com/intellij/openapi/options/SettingsEditorConfigurable.java index 71a1f9f364ad..81ea1b98abe1 100644 --- a/platform/platform-api/src/com/intellij/openapi/options/SettingsEditorConfigurable.java +++ b/platform/platform-api/src/com/intellij/openapi/options/SettingsEditorConfigurable.java @@ -1,4 +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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.options; import com.intellij.openapi.util.Disposer; @@ -49,14 +49,12 @@ public abstract class SettingsEditorConfigurable extends BaseConfigura myEditor = null; } - @NotNull - public SettingsEditor getEditor() { + public @NotNull SettingsEditor getEditor() { // myEditor is null only if disposed return myEditor; } - @NotNull - public Settings getSettings() { + public @NotNull Settings getSettings() { return mySettings; } } diff --git a/platform/platform-api/src/com/intellij/openapi/options/SettingsEditorWrapper.java b/platform/platform-api/src/com/intellij/openapi/options/SettingsEditorWrapper.java index 042523215cb2..e6d3afd9386b 100644 --- a/platform/platform-api/src/com/intellij/openapi/options/SettingsEditorWrapper.java +++ b/platform/platform-api/src/com/intellij/openapi/options/SettingsEditorWrapper.java @@ -1,4 +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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.options; import com.intellij.openapi.util.Disposer; @@ -31,8 +31,7 @@ public final class SettingsEditorWrapper extends SettingsEditor } @Override - @NotNull - public JComponent createEditor() { + public @NotNull JComponent createEditor() { return myWrapped.createEditor(); } diff --git a/platform/platform-api/src/com/intellij/openapi/options/SimpleConfigurable.java b/platform/platform-api/src/com/intellij/openapi/options/SimpleConfigurable.java index 67071bc81cb1..b045550b41e8 100644 --- a/platform/platform-api/src/com/intellij/openapi/options/SimpleConfigurable.java +++ b/platform/platform-api/src/com/intellij/openapi/options/SimpleConfigurable.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.options; import com.intellij.openapi.util.Getter; @@ -39,9 +39,8 @@ public final class SimpleConfigurable, S> extends C return new SimpleConfigurable<>(id, displayName, id, uiClass, settingsGetter); } - @NotNull @Override - protected S getSettings() { + protected @NotNull S getSettings() { return settingsGetter.get(); } @@ -50,9 +49,8 @@ public final class SimpleConfigurable, S> extends C return ReflectionUtil.newInstance(uiClass); } - @NotNull @Override - public Class getOriginalClass() { + public @NotNull Class getOriginalClass() { return uiClass; } } \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/openapi/options/colors/ColorSettingsPage.java b/platform/platform-api/src/com/intellij/openapi/options/colors/ColorSettingsPage.java index d38af7685395..525eda0aebae 100644 --- a/platform/platform-api/src/com/intellij/openapi/options/colors/ColorSettingsPage.java +++ b/platform/platform-api/src/com/intellij/openapi/options/colors/ColorSettingsPage.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.options.colors; import com.intellij.openapi.editor.Editor; @@ -61,13 +61,13 @@ public interface ColorSettingsPage extends ColorAndFontDescriptorsProvider { */ @Nullable Map getAdditionalHighlightingTagToDescriptorMap(); - @Nullable default Map getAdditionalInlineElementToDescriptorMap() { return null; } + default @Nullable Map getAdditionalInlineElementToDescriptorMap() { return null; } /** * Specifies tag-to-'color key' mapping for regions with presentation containing additional colors from color map. * It's used to implement navigation between the list of keys and regions in sample editor. */ - @Nullable default Map getAdditionalHighlightingTagToColorKeyMap() { return null; } + default @Nullable Map getAdditionalHighlightingTagToColorKeyMap() { return null; } /** * Allows to define additional customizations for the preview editor, which cannot be configured by markup in demo text. diff --git a/platform/platform-api/src/com/intellij/openapi/options/colors/ColorSettingsPages.java b/platform/platform-api/src/com/intellij/openapi/options/colors/ColorSettingsPages.java index 47d65bcccfba..e3c0ae4d55c6 100644 --- a/platform/platform-api/src/com/intellij/openapi/options/colors/ColorSettingsPages.java +++ b/platform/platform-api/src/com/intellij/openapi/options/colors/ColorSettingsPages.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.options.colors; import com.intellij.openapi.application.ApplicationManager; @@ -37,10 +37,8 @@ public abstract class ColorSettingsPages { */ public abstract ColorSettingsPage[] getRegisteredPages(); - @Nullable - public abstract Pair getAttributeDescriptor(TextAttributesKey key); + public abstract @Nullable Pair getAttributeDescriptor(TextAttributesKey key); - @Nullable - public abstract Pair getColorDescriptor(ColorKey key); + public abstract @Nullable Pair getColorDescriptor(ColorKey key); } diff --git a/platform/platform-api/src/com/intellij/openapi/project/DumbUnawareHider.java b/platform/platform-api/src/com/intellij/openapi/project/DumbUnawareHider.java index 9f242e68ef2a..258bc9451b8b 100644 --- a/platform/platform-api/src/com/intellij/openapi/project/DumbUnawareHider.java +++ b/platform/platform-api/src/com/intellij/openapi/project/DumbUnawareHider.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.project; import com.intellij.ide.IdeBundle; @@ -18,8 +18,7 @@ public final class DumbUnawareHider extends JBPanelWithEmptyText { add(dumbUnawareContent, BorderLayout.CENTER); } - @NotNull - public JComponent getContent() { + public @NotNull JComponent getContent() { return myDumbUnawareContent; } diff --git a/platform/platform-api/src/com/intellij/openapi/project/LightEditActionFactory.java b/platform/platform-api/src/com/intellij/openapi/project/LightEditActionFactory.java index 3a74cc98000b..c91a284641fb 100644 --- a/platform/platform-api/src/com/intellij/openapi/project/LightEditActionFactory.java +++ b/platform/platform-api/src/com/intellij/openapi/project/LightEditActionFactory.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.project; import com.intellij.ide.lightEdit.LightEditCompatible; @@ -13,14 +13,12 @@ public final class LightEditActionFactory { private LightEditActionFactory() { } - @NotNull - public static DumbAwareAction create(@NotNull Consumer actionPerformed) { + public static @NotNull DumbAwareAction create(@NotNull Consumer actionPerformed) { return new SimpleLightEditCompatibleAction(actionPerformed); } - @NotNull - public static DumbAwareAction create(@Nullable @NlsActions.ActionText String text, - @NotNull Consumer actionPerformed) { + public static @NotNull DumbAwareAction create(@Nullable @NlsActions.ActionText String text, + @NotNull Consumer actionPerformed) { return new SimpleLightEditCompatibleAction(text, actionPerformed); } diff --git a/platform/platform-api/src/com/intellij/openapi/roots/ui/FileAppearanceService.java b/platform/platform-api/src/com/intellij/openapi/roots/ui/FileAppearanceService.java index b797eeb6b30e..fcce51fbc503 100644 --- a/platform/platform-api/src/com/intellij/openapi/roots/ui/FileAppearanceService.java +++ b/platform/platform-api/src/com/intellij/openapi/roots/ui/FileAppearanceService.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.roots.ui; import com.intellij.openapi.application.ApplicationManager; @@ -13,15 +13,11 @@ public abstract class FileAppearanceService { return ApplicationManager.getApplication().getService(FileAppearanceService.class); } - @NotNull - public abstract CellAppearanceEx empty(); + public abstract @NotNull CellAppearanceEx empty(); - @NotNull - public abstract CellAppearanceEx forVirtualFile(@NotNull VirtualFile file); + public abstract @NotNull CellAppearanceEx forVirtualFile(@NotNull VirtualFile file); - @NotNull - public abstract CellAppearanceEx forIoFile(@NotNull File file); + public abstract @NotNull CellAppearanceEx forIoFile(@NotNull File file); - @NotNull - public abstract CellAppearanceEx forInvalidUrl(@NlsSafe @NotNull String url); + public abstract @NotNull CellAppearanceEx forInvalidUrl(@NlsSafe @NotNull String url); } diff --git a/platform/platform-api/src/com/intellij/openapi/roots/ui/SdkAppearanceService.java b/platform/platform-api/src/com/intellij/openapi/roots/ui/SdkAppearanceService.java index dd86027ac1aa..3faa281dc221 100644 --- a/platform/platform-api/src/com/intellij/openapi/roots/ui/SdkAppearanceService.java +++ b/platform/platform-api/src/com/intellij/openapi/roots/ui/SdkAppearanceService.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.roots.ui; import com.intellij.openapi.application.ApplicationManager; @@ -9,22 +9,18 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public abstract class SdkAppearanceService { - @NotNull - public abstract CellAppearanceEx forSdk(@NotNull SdkTypeId sdkType, - @NlsSafe @NotNull String name, - @Nullable String versionString, - boolean hasValidPath, - boolean isInComboBox, - boolean selected); + public abstract @NotNull CellAppearanceEx forSdk(@NotNull SdkTypeId sdkType, + @NlsSafe @NotNull String name, + @Nullable String versionString, + boolean hasValidPath, + boolean isInComboBox, + boolean selected); - @NotNull - public static SdkAppearanceService getInstance() { + public static @NotNull SdkAppearanceService getInstance() { return ApplicationManager.getApplication().getService(SdkAppearanceService.class); } - @NotNull - public abstract CellAppearanceEx forNullSdk(boolean selected); + public abstract @NotNull CellAppearanceEx forNullSdk(boolean selected); - @NotNull - public abstract CellAppearanceEx forSdk(@Nullable Sdk sdk, boolean isInComboBox, boolean selected, boolean showVersion); + public abstract @NotNull CellAppearanceEx forSdk(@Nullable Sdk sdk, boolean isInComboBox, boolean selected, boolean showVersion); } diff --git a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/BaseTextCommentCellAppearance.java b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/BaseTextCommentCellAppearance.java index f2c8c48e2906..655231a7b187 100644 --- a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/BaseTextCommentCellAppearance.java +++ b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/BaseTextCommentCellAppearance.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.roots.ui.util; import com.intellij.openapi.roots.ui.CellAppearanceEx; @@ -21,7 +21,7 @@ public abstract class BaseTextCommentCellAppearance implements CellAppearanceEx protected abstract @Nls String getPrimaryText(); @Override - public void customize(@NotNull final SimpleColoredComponent component) { + public void customize(final @NotNull SimpleColoredComponent component) { component.setIcon(getIcon()); component.append(getPrimaryText(), myTextAttributes); final String secondaryText = getSecondaryText(); @@ -31,8 +31,7 @@ public abstract class BaseTextCommentCellAppearance implements CellAppearanceEx } @Override - @NotNull - public String getText() { + public @NotNull String getText() { String secondaryText = getSecondaryText(); if (secondaryText != null && secondaryText.length() > 0) { return getPrimaryText() + " (" + secondaryText + ")"; diff --git a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CompositeAppearance.java b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CompositeAppearance.java index ce5342a2d212..50ad84b148df 100644 --- a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CompositeAppearance.java +++ b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CompositeAppearance.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.roots.ui.util; import com.intellij.openapi.diagnostic.Logger; @@ -46,15 +46,14 @@ public class CompositeAppearance implements ModifiableCellAppearanceEx { } @Override - public void setIcon(@Nullable final Icon icon) { + public void setIcon(final @Nullable Icon icon) { synchronized (mySections) { myIcon = icon; } } @Override - @NotNull - public String getText() { + public @NotNull String getText() { synchronized (mySections) { @Nls StringBuilder buffer = new StringBuilder(); for (TextSection section : mySections) { diff --git a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/SimpleTextCellAppearance.java b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/SimpleTextCellAppearance.java index 9ba0f79af4a1..3601cf26e97b 100644 --- a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/SimpleTextCellAppearance.java +++ b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/SimpleTextCellAppearance.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.roots.ui.util; import com.intellij.openapi.roots.ui.ModifiableCellAppearanceEx; @@ -16,45 +16,43 @@ public class SimpleTextCellAppearance implements ModifiableCellAppearanceEx { private final SimpleTextAttributes myTextAttributes; private final @NlsContexts.Label String myText; - public static SimpleTextCellAppearance regular(@NotNull final @NlsContexts.Label String text, @Nullable final Icon icon) { + public static SimpleTextCellAppearance regular(final @NotNull @NlsContexts.Label String text, final @Nullable Icon icon) { return new SimpleTextCellAppearance(text, icon, SimpleTextAttributes.REGULAR_ATTRIBUTES); } - public static SimpleTextCellAppearance invalid(@NotNull final @NlsContexts.Label String text, @Nullable final Icon icon) { + public static SimpleTextCellAppearance invalid(final @NotNull @NlsContexts.Label String text, final @Nullable Icon icon) { return new SimpleTextCellAppearance(text, icon, SimpleTextAttributes.ERROR_ATTRIBUTES); } - public static SimpleTextCellAppearance synthetic(@NotNull final @NlsContexts.Label String text, @Nullable final Icon icon) { + public static SimpleTextCellAppearance synthetic(final @NotNull @NlsContexts.Label String text, final @Nullable Icon icon) { return new SimpleTextCellAppearance(text, icon, SimpleTextAttributes.SYNTHETIC_ATTRIBUTES); } - public SimpleTextCellAppearance(@NotNull final @NlsContexts.Label String text, - @Nullable final Icon icon, - @NotNull final SimpleTextAttributes textAttributes) { + public SimpleTextCellAppearance(final @NotNull @NlsContexts.Label String text, + final @Nullable Icon icon, + final @NotNull SimpleTextAttributes textAttributes) { myIcon = icon; myTextAttributes = textAttributes; myText = text; } @Override - public void customize(@NotNull final SimpleColoredComponent component) { + public void customize(final @NotNull SimpleColoredComponent component) { component.setIcon(myIcon); component.append(myText, myTextAttributes); } @Override - @NotNull - public String getText() { + public @NotNull String getText() { return myText; } - @NotNull - public SimpleTextAttributes getTextAttributes() { + public @NotNull SimpleTextAttributes getTextAttributes() { return myTextAttributes; } @Override - public void setIcon(@Nullable final Icon icon) { + public void setIcon(final @Nullable Icon icon) { myIcon = icon; } } \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/openapi/ui/BrowseFolderRunnable.java b/platform/platform-api/src/com/intellij/openapi/ui/BrowseFolderRunnable.java index 827358c0dc8c..f73760adc7e7 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/BrowseFolderRunnable.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/BrowseFolderRunnable.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui; import com.intellij.openapi.fileChooser.FileChooser; @@ -51,8 +51,7 @@ public class BrowseFolderRunnable implements Runnable { myAccessor = accessor; } - @Nullable - protected Project getProject() { + protected @Nullable Project getProject() { return myProject; } @@ -76,8 +75,7 @@ public class BrowseFolderRunnable implements Runnable { FileChooser.chooseFile(fileChooserDescriptor, getProject(), myTextComponent, getInitialFile(), this::onFileChosen); } - @Nullable - protected VirtualFile getInitialFile() { + protected @Nullable VirtualFile getInitialFile() { @NonNls String directoryName = myAccessor.getText(myTextComponent).trim(); if (StringUtil.isEmptyOrSpaces(directoryName)) { return null; @@ -94,9 +92,7 @@ public class BrowseFolderRunnable implements Runnable { return path; } - @NotNull - @NonNls - protected String expandPath(@NotNull @NonNls String path) { + protected @NotNull @NonNls String expandPath(@NotNull @NonNls String path) { var descriptor = BrowseFolderDescriptor.asBrowseFolderDescriptor(myFileChooserDescriptor); var convertTextToPath = descriptor.getConvertTextToPath(); if (convertTextToPath != null) { @@ -105,8 +101,7 @@ public class BrowseFolderRunnable implements Runnable { return path; } - @NotNull - protected @NlsSafe String chosenFileToResultingText(@NotNull VirtualFile chosenFile) { + protected @NotNull @NlsSafe String chosenFileToResultingText(@NotNull VirtualFile chosenFile) { var descriptor = BrowseFolderDescriptor.asBrowseFolderDescriptor(myFileChooserDescriptor); var convertFileToText = descriptor.getConvertFileToText(); if (convertFileToText != null) { diff --git a/platform/platform-api/src/com/intellij/openapi/ui/ComponentValidator.java b/platform/platform-api/src/com/intellij/openapi/ui/ComponentValidator.java index 75543f4f1e2c..31a757212739 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/ComponentValidator.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/ComponentValidator.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui; import com.intellij.execution.ui.TagButton; @@ -219,8 +219,7 @@ public class ComponentValidator { validationInfo = null; } - @Nullable - public ValidationInfo getValidationInfo() { + public @Nullable ValidationInfo getValidationInfo() { return validationInfo; } @@ -284,8 +283,7 @@ public class ComponentValidator { } } - @NotNull - private static ComponentPopupBuilder createPopupBuilder(boolean isWarning, @Nullable Consumer configurator) { + private static @NotNull ComponentPopupBuilder createPopupBuilder(boolean isWarning, @Nullable Consumer configurator) { JEditorPane tipComponent = new JEditorPane(); tipComponent.setContentType("text/html"); tipComponent.setEditable(false); @@ -325,8 +323,7 @@ public class ComponentValidator { /** * @return true if message is multiline. */ - @NlsSafe - private static boolean convertMessage(@Nls String message, @NotNull JEditorPane component) { + private static @NlsSafe boolean convertMessage(@Nls String message, @NotNull JEditorPane component) { View v = BasicHTML.createHTMLView(component, String.format("%s", message)); boolean widerText = v.getPreferredSpan(View.X_AXIS) > MAX_WIDTH.get(); HtmlChunk.Element div = widerText ? @@ -336,8 +333,7 @@ public class ComponentValidator { return widerText; } - @NotNull - public static ComponentPopupBuilder createPopupBuilder(@NotNull ValidationInfo info, @Nullable Consumer configurator) { + public static @NotNull ComponentPopupBuilder createPopupBuilder(@NotNull ValidationInfo info, @Nullable Consumer configurator) { return createPopupBuilder(info.warning, tipComponent -> { convertMessage(info.message, tipComponent); if (configurator != null) { diff --git a/platform/platform-api/src/com/intellij/openapi/ui/ComponentWithBrowseButton.java b/platform/platform-api/src/com/intellij/openapi/ui/ComponentWithBrowseButton.java index 4c881d066d15..62a61d9b3daf 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/ComponentWithBrowseButton.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/ComponentWithBrowseButton.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui; import com.intellij.icons.AllIcons; @@ -107,23 +107,19 @@ public class ComponentWithBrowseButton extends JPanel i putClientProperty(DslComponentProperty.VISUAL_PADDINGS, visualPaddings); } - @NotNull - protected Icon getDefaultIcon() { + protected @NotNull Icon getDefaultIcon() { return AllIcons.General.OpenDisk; } - @NotNull - protected Icon getHoveredIcon() { + protected @NotNull Icon getHoveredIcon() { return AllIcons.General.OpenDiskHover; } - @NotNull - protected @NlsContexts.Tooltip String getIconTooltip() { + protected @NotNull @NlsContexts.Tooltip String getIconTooltip() { return getTooltip(); } - @NotNull - public static @NlsContexts.Tooltip String getTooltip() { + public static @NotNull @NlsContexts.Tooltip String getTooltip() { return UIBundle.message("component.with.browse.button.browse.button.tooltip.text") + " (" + KeymapUtil.getKeystrokeText(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_DOWN_MASK)) + ")"; } @@ -133,8 +129,7 @@ public class ComponentWithBrowseButton extends JPanel i for (ActionListener listener: myBrowseButton.getActionListeners()) listener.actionPerformed(event); } - @NotNull - public final Comp getChildComponent() { + public final @NotNull Comp getChildComponent() { return myComponent; } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/DetailsComponent.java b/platform/platform-api/src/com/intellij/openapi/ui/DetailsComponent.java index 897fe75abf9f..c513eeca10d9 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/DetailsComponent.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/DetailsComponent.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui; @@ -160,8 +160,8 @@ public class DetailsComponent { myPaintBorder = paintBorder; } - public DetailsComponent setEmptyContentText(@Nullable final String emptyContentText) { - @NonNls final String s = XmlStringUtil.wrapInHtml("
" + (emptyContentText != null ? emptyContentText : "") + "
"); + public DetailsComponent setEmptyContentText(final @Nullable String emptyContentText) { + final @NonNls String s = XmlStringUtil.wrapInHtml("
" + (emptyContentText != null ? emptyContentText : "") + "
"); myEmptyContentLabel.setText(s); return this; } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/DialogBuilder.java b/platform/platform-api/src/com/intellij/openapi/ui/DialogBuilder.java index ba1f8a35373e..55033001a181 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/DialogBuilder.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/DialogBuilder.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui; import com.intellij.CommonBundle; @@ -27,7 +27,7 @@ import java.util.List; */ public class DialogBuilder implements Disposable { - @NonNls public static final String REQUEST_FOCUS_ENABLED = "requestFocusEnabled"; + public static final @NonNls String REQUEST_FOCUS_ENABLED = "requestFocusEnabled"; private JComponent myCenterPanel; private JComponent myNorthPanel; @@ -84,14 +84,12 @@ public class DialogBuilder implements Disposable { myCenterPanel = centerPanel; } - @NotNull - public DialogBuilder centerPanel(@NotNull JComponent centerPanel) { + public @NotNull DialogBuilder centerPanel(@NotNull JComponent centerPanel) { myCenterPanel = centerPanel; return this; } - @NotNull - public DialogBuilder setNorthPanel(@NotNull JComponent northPanel) { + public @NotNull DialogBuilder setNorthPanel(@NotNull JComponent northPanel) { myNorthPanel = northPanel; return this; } @@ -100,8 +98,7 @@ public class DialogBuilder implements Disposable { myTitle = title; } - @NotNull - public DialogBuilder title(@NotNull @DialogTitle String title) { + public @NotNull DialogBuilder title(@NotNull @DialogTitle String title) { myTitle = title; return this; } @@ -201,14 +198,12 @@ public class DialogBuilder implements Disposable { myDialogWrapper.setOKActionEnabled(isEnabled); } - @NotNull - public DialogBuilder okActionEnabled(boolean isEnabled) { + public @NotNull DialogBuilder okActionEnabled(boolean isEnabled) { myDialogWrapper.setOKActionEnabled(isEnabled); return this; } - @NotNull - public DialogBuilder resizable(boolean resizable) { + public @NotNull DialogBuilder resizable(boolean resizable) { myDialogWrapper.setResizable(resizable); return this; } @@ -354,20 +349,17 @@ public class DialogBuilder implements Disposable { myHelpId = helpId; } - @Nullable @Override - protected String getHelpId() { + protected @Nullable String getHelpId() { return myHelpId; } @Override public void init() { super.init(); } @Override - @NotNull - public Action getOKAction() { return super.getOKAction(); } // Make it public + public @NotNull Action getOKAction() { return super.getOKAction(); } // Make it public @Override - @NotNull - public Action getCancelAction() { return super.getCancelAction(); } // Make it public + public @NotNull Action getCancelAction() { return super.getCancelAction(); } // Make it public @Override protected JComponent createCenterPanel() { return myCenterPanel; } @@ -443,11 +435,11 @@ public class DialogBuilder implements Disposable { } } - public void setErrorText(@NlsContexts.DialogMessage @Nullable final String text) { + public void setErrorText(final @NlsContexts.DialogMessage @Nullable String text) { myDialogWrapper.setErrorText(text); } - public void setErrorText(@NlsContexts.DialogMessage @Nullable final String text, @Nullable JComponent component) { + public void setErrorText(final @NlsContexts.DialogMessage @Nullable String text, @Nullable JComponent component) { myDialogWrapper.setErrorText(text, component); } } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapperPeer.java b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapperPeer.java index 79b90c2644b4..2084beaca5a6 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapperPeer.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapperPeer.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui; import com.intellij.openapi.Disposable; @@ -55,8 +55,7 @@ public abstract class DialogWrapperPeer { /** * @see JDialog#getContentPane */ - @Nullable - public abstract Container getContentPane(); + public abstract @Nullable Container getContentPane(); /** * @see Window#getOwner @@ -119,8 +118,7 @@ public abstract class DialogWrapperPeer { /** * @see JDialog#getLocation */ - @NotNull - public abstract Point getLocation(); + public abstract @NotNull Point getLocation(); /** * @see JDialog#setLocation(Point) diff --git a/platform/platform-api/src/com/intellij/openapi/ui/FixedComboBoxEditor.java b/platform/platform-api/src/com/intellij/openapi/ui/FixedComboBoxEditor.java index 45f8a475b26c..cca642d48d2a 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/FixedComboBoxEditor.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/FixedComboBoxEditor.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui; import com.intellij.openapi.wm.IdeFocusManager; @@ -25,12 +25,10 @@ import java.lang.reflect.Method; * Use this editor if you wish your combobox editor to look good on Macs. */ public class FixedComboBoxEditor implements ComboBoxEditor { - @NotNull - private final JBTextField myField = UIUtil.isUnderDefaultMacTheme() ? new MacComboBoxTextField() : new JBTextField(); + private final @NotNull JBTextField myField = UIUtil.isUnderDefaultMacTheme() ? new MacComboBoxTextField() : new JBTextField(); private Object oldValue; - @NotNull - public JBTextField getField() { + public @NotNull JBTextField getField() { return myField; } @@ -84,8 +82,7 @@ public class FixedComboBoxEditor implements ComboBoxEditor { @Override public void removeActionListener(ActionListener l) {} - @Nullable - private static ComboPopup getComboboxPopup(JComboBox comboBox) { + private static @Nullable ComboPopup getComboboxPopup(JComboBox comboBox) { ComboBoxUI ui = comboBox.getUI(); ComboPopup popup = null; if (ui instanceof BasicComboBoxUI) { diff --git a/platform/platform-api/src/com/intellij/openapi/ui/JBPopupMenu.java b/platform/platform-api/src/com/intellij/openapi/ui/JBPopupMenu.java index f810e311218c..bbfc857dfa74 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/JBPopupMenu.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/JBPopupMenu.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui; import com.intellij.icons.AllIcons; @@ -309,9 +309,8 @@ public class JBPopupMenu extends JPopupMenu { return screenRectangle.height; } - @NotNull @Override - public Dimension preferredLayoutSize(Container target) { + public @NotNull Dimension preferredLayoutSize(Container target) { Dimension dimension = super.preferredLayoutSize(target); int maxHeight = getMaxHeight(); switchTimer(dimension.height > maxHeight); diff --git a/platform/platform-api/src/com/intellij/openapi/ui/LabeledComponent.java b/platform/platform-api/src/com/intellij/openapi/ui/LabeledComponent.java index 13ce48484c65..705a9264e19f 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/LabeledComponent.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/LabeledComponent.java @@ -1,4 +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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui; import com.intellij.BundleBase; @@ -30,15 +30,13 @@ public class LabeledComponent extends JPanel implements insertLabel(); } - @NotNull - public static LabeledComponent create(@NotNull Comp component, @NotNull @NlsContexts.Label String text) { + public static @NotNull LabeledComponent create(@NotNull Comp component, @NotNull @NlsContexts.Label String text) { return create(component, text, BorderLayout.NORTH); } - @NotNull - public static LabeledComponent create(@NotNull Comp component, - @NotNull @NlsContexts.Label String text, - @NonNls String labelConstraint) { + public static @NotNull LabeledComponent create(@NotNull Comp component, + @NotNull @NlsContexts.Label String text, + @NonNls String labelConstraint) { LabeledComponent labeledComponent = new LabeledComponent<>(); labeledComponent.setComponent(component); labeledComponent.setText(text); @@ -90,8 +88,7 @@ public class LabeledComponent extends JPanel implements } } - @NonNls - public String getComponentClass() { + public @NonNls String getComponentClass() { return myComponent == null ? null : getComponent().getClass().getName(); } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsComponent.java b/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsComponent.java index 53fab858b9b4..43af78403036 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsComponent.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsComponent.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui; import com.intellij.CommonBundle; @@ -48,8 +48,8 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom protected NamedConfigurable myCurrentConfigurable; private final JBSplitter mySplitter; - @NonNls public static final String TREE_OBJECT = "treeObject"; - @NonNls public static final String TREE_NAME = "treeName"; + public static final @NonNls String TREE_OBJECT = "treeObject"; + public static final @NonNls String TREE_NAME = "treeName"; protected History myHistory = new History(new Place.Navigator() { @Override @@ -271,8 +271,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom } @Override - @NotNull - public JComponent createComponent() { + public @NotNull JComponent createComponent() { myTree.updateUI(); reInitWholePanelIfNeeded(); @@ -386,14 +385,11 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom return path.toString(); } - @Nullable - @NonNls - protected String getComponentStateKey() { + protected @Nullable @NonNls String getComponentStateKey() { return null; } - @Nullable - protected MasterDetailsStateService getStateService() { + protected @Nullable MasterDetailsStateService getStateService() { return null; } @@ -430,8 +426,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom myRoot.removeAllChildren(); } - @Nullable - protected List createActions(boolean fromPopup) { + protected @Nullable List createActions(boolean fromPopup) { return null; } @@ -458,8 +453,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom } } - @Nullable - protected ArrayList getAdditionalActions() { + protected @Nullable ArrayList getAdditionalActions() { return null; } @@ -523,8 +517,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom return TreeUtil.selectFirstNode(myTree); } - @Nullable - public Object getSelectedObject() { + public @Nullable Object getSelectedObject() { final TreePath selectionPath = myTree.getSelectionPath(); if (selectionPath != null && selectionPath.getLastPathComponent() instanceof MyNode node) { final NamedConfigurable configurable = node.getConfigurable(); @@ -539,8 +532,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom return path != null ? (MyNode)path.getLastPathComponent() : null; } - @Nullable - public NamedConfigurable getSelectedConfigurable() { + public @Nullable NamedConfigurable getSelectedConfigurable() { MyNode selectedNode = getSelectedNode(); if (selectedNode != null) { final NamedConfigurable configurable = selectedNode.getConfigurable(); @@ -559,14 +551,12 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom selectNodeInTree(findNodeByObject(myRoot, object), true); } - @Nullable - protected static MyNode findNodeByName(final TreeNode root, final String profileName) { + protected static @Nullable MyNode findNodeByName(final TreeNode root, final String profileName) { if (profileName == null) return null; //do not suggest root node return findNodeByCondition(root, configurable -> Comparing.strEqual(profileName, configurable.getDisplayName())); } - @Nullable - public static MyNode findNodeByObject(final TreeNode root, final Object editableObject) { + public static @Nullable MyNode findNodeByObject(final TreeNode root, final Object editableObject) { if (editableObject == null) return null; //do not suggest root node return findNodeByCondition(root, configurable -> Comparing.equal(editableObject, configurable.getEditableObject())); } @@ -625,9 +615,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom return null; } - @NlsContexts.StatusText - @Nullable - protected String getEmptySelectionString() { + protected @NlsContexts.StatusText @Nullable String getEmptySelectionString() { return null; } @@ -851,8 +839,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom myDisplayInBold = displayInBold; } - @NotNull - public @NlsSafe String getDisplayName() { + public @NotNull @NlsSafe String getDisplayName() { final NamedConfigurable configurable = (NamedConfigurable)getUserObject(); if (configurable != null) return configurable.getDisplayName(); LOG.debug("Tree was already disposed"); // workaround for IDEA-206547 @@ -871,8 +858,7 @@ public abstract class MasterDetailsComponent implements Configurable, DetailsCom myDisplayInBold = displayInBold; } - @Nullable - public Icon getIcon(boolean expanded) { + public @Nullable Icon getIcon(boolean expanded) { // thanks to invokeLater() in TreeUtil.showAndSelect(), we can get calls to getIcon() after the tree has been disposed final NamedConfigurable configurable = getConfigurable(); if (configurable != null) { diff --git a/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsStateService.java b/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsStateService.java index ac09b7b7ba2f..448763d72809 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsStateService.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/MasterDetailsStateService.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui; import com.intellij.configurationStore.XmlSerializer; @@ -25,8 +25,7 @@ public final class MasterDetailsStateService implements PersistentStateComponent return project.getService(MasterDetailsStateService.class); } - @Nullable - public MasterDetailsState getComponentState(@NotNull @NonNls String key, Class stateClass) { + public @Nullable MasterDetailsState getComponentState(@NotNull @NonNls String key, Class stateClass) { ComponentState state = myStates.get(key); if (state == null) return null; final Element settings = state.mySettings; diff --git a/platform/platform-api/src/com/intellij/openapi/ui/NamedConfigurable.java b/platform/platform-api/src/com/intellij/openapi/ui/NamedConfigurable.java index 360932a6aa58..b7d06db62e87 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/NamedConfigurable.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/NamedConfigurable.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui; import com.intellij.ide.IdeBundle; @@ -28,14 +28,14 @@ public abstract class NamedConfigurable implements Configurable { private ErrorLabel myErrorLabel; private JComponent myOptionsComponent; private final boolean myNameEditable; - @Nullable private final Runnable myUpdateTree; + private final @Nullable Runnable myUpdateTree; private boolean myUpdatingNameFieldFromDisplayName; protected NamedConfigurable() { this(false, null); } - protected NamedConfigurable(boolean isNameEditable, @Nullable final Runnable updateTree) { + protected NamedConfigurable(boolean isNameEditable, final @Nullable Runnable updateTree) { myNameEditable = isNameEditable; myUpdateTree = updateTree; } @@ -128,8 +128,7 @@ public abstract class NamedConfigurable implements Configurable { } } - @Nullable - protected JComponent createTopRightComponent() { + protected @Nullable JComponent createTopRightComponent() { return null; } @@ -156,8 +155,7 @@ public abstract class NamedConfigurable implements Configurable { public abstract JComponent createOptionsPanel(); - @Nullable - public Icon getIcon(boolean expanded) { + public @Nullable Icon getIcon(boolean expanded) { return null; } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/NamedItemsListEditor.java b/platform/platform-api/src/com/intellij/openapi/ui/NamedItemsListEditor.java index 0e07426a2c11..a67dd1566422 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/NamedItemsListEditor.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/NamedItemsListEditor.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui; import com.intellij.icons.AllIcons; @@ -106,8 +106,7 @@ public abstract class NamedItemsListEditor extends MasterDetailsComponent { } - @Nullable - public String askForProfileName(@NlsContexts.DialogTitle String title) { + public @Nullable String askForProfileName(@NlsContexts.DialogTitle String title) { return Messages.showInputDialog(getNewLabelText(), title, Messages.getQuestionIcon(), "", new InputValidator() { @Override public boolean checkInput(String s) { @@ -121,8 +120,7 @@ public abstract class NamedItemsListEditor extends MasterDetailsComponent { }); } - @Nullable - protected T findByName(@NlsSafe String name) { + protected @Nullable T findByName(@NlsSafe String name) { for (T item : myItems) { if (Objects.equals(name, myNamer.getName(item))) return item; } @@ -131,8 +129,7 @@ public abstract class NamedItemsListEditor extends MasterDetailsComponent { } @Override - @Nullable - protected List createActions(boolean fromPopup) { + protected @Nullable List createActions(boolean fromPopup) { ArrayList result = new ArrayList<>(); result.add(new AddAction()); //noinspection unchecked @@ -170,8 +167,7 @@ public abstract class NamedItemsListEditor extends MasterDetailsComponent { myShowIcons = showIcons; } - @Nullable - protected UnnamedConfigurable getItemConfigurable(final T item) { + protected @Nullable UnnamedConfigurable getItemConfigurable(final T item) { final Ref result = new Ref<>(); TreeUtil.traverse((TreeNode)myTree.getModel().getRoot(), node -> { final NamedConfigurable configurable = (NamedConfigurable)((DefaultMutableTreeNode)node).getUserObject(); @@ -344,8 +340,7 @@ public abstract class NamedItemsListEditor extends MasterDetailsComponent { selectNodeInTree(findByName(myNamer.getName(item))); } - @Nullable - protected T createItem() { + protected @Nullable T createItem() { String name = askForProfileName(getCreateNewDialogTitle()); if (name == null) return null; final T newItem = myFactory.create(); diff --git a/platform/platform-api/src/com/intellij/openapi/ui/OnePixelDivider.java b/platform/platform-api/src/com/intellij/openapi/ui/OnePixelDivider.java index b29d1324a2d5..b5d5e77803c6 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/OnePixelDivider.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/OnePixelDivider.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui; import com.intellij.openapi.Disposable; @@ -202,8 +202,7 @@ public class OnePixelDivider extends Divider { return false; } - @Nullable - private MouseEvent getTargetEvent(MouseEvent e) { + private @Nullable MouseEvent getTargetEvent(MouseEvent e) { Component eventComponent = e.getComponent(); if (eventComponent == null) return null; Component deepestComponentAt = UIUtil.getDeepestComponentAt(eventComponent, e.getX(), e.getY()); diff --git a/platform/platform-api/src/com/intellij/openapi/ui/ShadowAction.java b/platform/platform-api/src/com/intellij/openapi/ui/ShadowAction.java index eaa0f825e749..61b99ea91272 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/ShadowAction.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/ShadowAction.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui; import com.intellij.openapi.Disposable; @@ -144,8 +144,7 @@ public final class ShadowAction { } } - @Nullable - private static KeymapManager getKeymapManager() { + private static @Nullable KeymapManager getKeymapManager() { return ApplicationManager.getApplication().isDisposed() ? null : KeymapManager.getInstance(); } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/SimpleToolWindowPanel.java b/platform/platform-api/src/com/intellij/openapi/ui/SimpleToolWindowPanel.java index b6bc15a528b9..663b9c8dbeeb 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/SimpleToolWindowPanel.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/SimpleToolWindowPanel.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui; import com.intellij.openapi.actionSystem.*; @@ -219,8 +219,7 @@ public class SimpleToolWindowPanel extends JBPanelWithEmptyText implements Quick } } - @NotNull - public static List collectActions(@Nullable JComponent component) { + public static @NotNull List collectActions(@Nullable JComponent component) { JBIterable toolbars = UIUtil.uiTraverser(component).traverse().filter(ActionToolbar.class); if (toolbars.size() == 0) { return Collections.emptyList(); diff --git a/platform/platform-api/src/com/intellij/openapi/ui/TreeComboBox.java b/platform/platform-api/src/com/intellij/openapi/ui/TreeComboBox.java index 744995c72ba8..fd47ee3d4902 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/TreeComboBox.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/TreeComboBox.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui; import com.intellij.openapi.util.Iconable; @@ -27,22 +27,22 @@ public class TreeComboBox extends ComboBoxWithWidePopup { private TreeModel myTreeModel; private final boolean myShowRootNode; - public TreeComboBox(@NotNull final TreeModel model) { + public TreeComboBox(final @NotNull TreeModel model) { this(model, true); } - public TreeComboBox(@NotNull final TreeModel model, final boolean showRootNode) { + public TreeComboBox(final @NotNull TreeModel model, final boolean showRootNode) { this(model, showRootNode, null); } - public TreeComboBox(@NotNull final TreeModel model, final boolean showRootNode, final String defaultText) { + public TreeComboBox(final @NotNull TreeModel model, final boolean showRootNode, final String defaultText) { myTreeModel = model; myShowRootNode = showRootNode; setModel(new TreeModelWrapper(myTreeModel, showRootNode)); setRenderer(new TreeListCellRenderer(this, showRootNode, defaultText)); } - public void setTreeModel(@NotNull final TreeModel model, final boolean showRootNode) { + public void setTreeModel(final @NotNull TreeModel model, final boolean showRootNode) { myTreeModel = model; setModel(new TreeModelWrapper(model, showRootNode)); } @@ -68,7 +68,7 @@ public class TreeComboBox extends ComboBoxWithWidePopup { private final boolean myShowRootNode; private final @NlsContexts.Label String myDefaultText; - private TreeListCellRenderer(@NotNull final JComboBox comboBox, final boolean showRootNode, @Nullable @NlsContexts.Label String defaultText) { + private TreeListCellRenderer(final @NotNull JComboBox comboBox, final boolean showRootNode, @Nullable @NlsContexts.Label String defaultText) { myComboBox = comboBox; myShowRootNode = showRootNode; myDefaultText = defaultText; @@ -156,7 +156,7 @@ public class TreeComboBox extends ComboBoxWithWidePopup { private final boolean myShowRootNode; private final List myTreeModelAsList = new ArrayList<>(); - private TreeModelWrapper(@NotNull final TreeModel treeModel, final boolean showRootNode) { + private TreeModelWrapper(final @NotNull TreeModel treeModel, final boolean showRootNode) { myTreeModel = treeModel; myShowRootNode = showRootNode; accumulateChildren((TreeNode) treeModel.getRoot(), myTreeModelAsList, showRootNode); @@ -174,7 +174,7 @@ public class TreeComboBox extends ComboBoxWithWidePopup { } } - private static void accumulateChildren(@NotNull final TreeNode node, @NotNull final List list, final boolean showRoot) { + private static void accumulateChildren(final @NotNull TreeNode node, final @NotNull List list, final boolean showRoot) { if (showRoot || node.getParent() != null) list.add(node); final int count = node.getChildCount(); @@ -228,7 +228,7 @@ public class TreeComboBox extends ComboBoxWithWidePopup { private final Object myNode; private int myIndex = -1; - ChildrenEnumeration(@NotNull final TreeModel treeModel, @NotNull final Object node) { + ChildrenEnumeration(final @NotNull TreeModel treeModel, final @NotNull Object node) { myTreeModel = treeModel; myNode = node; } @@ -248,7 +248,7 @@ public class TreeComboBox extends ComboBoxWithWidePopup { private final TreeModel myTreeModel; private final Stack myStack; - PreorderEnumeration(@NotNull final TreeModel treeModel) { + PreorderEnumeration(final @NotNull TreeModel treeModel) { myTreeModel = treeModel; myStack = new Stack<>(); myStack.push(Collections.enumeration(Collections.singleton(treeModel.getRoot()))); diff --git a/platform/platform-api/src/com/intellij/openapi/ui/cellvalidators/CellComponentProvider.java b/platform/platform-api/src/com/intellij/openapi/ui/cellvalidators/CellComponentProvider.java index 484f7f16ba2a..5ed863eab1e7 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/cellvalidators/CellComponentProvider.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/cellvalidators/CellComponentProvider.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui.cellvalidators; import org.jetbrains.annotations.ApiStatus; @@ -13,22 +13,19 @@ import java.beans.PropertyChangeEvent; @ApiStatus.Experimental public abstract class CellComponentProvider { - @NotNull protected final C owner; + protected final @NotNull C owner; public CellComponentProvider(@NotNull C owner) { this.owner = owner; } - @NotNull - public final C getOwner() { + public final @NotNull C getOwner() { return owner; } - @Nullable - abstract public JComponent getCellRendererComponent(@NotNull MouseEvent e); + public abstract @Nullable JComponent getCellRendererComponent(@NotNull MouseEvent e); - @NotNull - abstract public Rectangle getCellRect(@NotNull MouseEvent e); + public abstract @NotNull Rectangle getCellRect(@NotNull MouseEvent e); abstract boolean isEditing(@NotNull MouseEvent e); @@ -48,9 +45,8 @@ public abstract class CellComponentProvider { super(owner); } - @Nullable @Override - public JComponent getCellRendererComponent(@NotNull MouseEvent e) { + public @Nullable JComponent getCellRendererComponent(@NotNull MouseEvent e) { Point p = e.getPoint(); int column = owner.columnAtPoint(p); int row = owner.rowAtPoint(p); @@ -63,9 +59,8 @@ public abstract class CellComponentProvider { } } - @NotNull @Override - public Rectangle getCellRect(@NotNull MouseEvent e) { + public @NotNull Rectangle getCellRect(@NotNull MouseEvent e) { Point p = e.getPoint(); return owner.getCellRect(owner.rowAtPoint(p), owner.columnAtPoint(p), false); } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/cellvalidators/ValidationUtils.java b/platform/platform-api/src/com/intellij/openapi/ui/cellvalidators/ValidationUtils.java index a987340697ca..01929cf703c5 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/cellvalidators/ValidationUtils.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/cellvalidators/ValidationUtils.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui.cellvalidators; import com.intellij.icons.AllIcons; @@ -10,10 +10,10 @@ import org.jetbrains.annotations.Nullable; public final class ValidationUtils { private ValidationUtils() {} - public final static ExtendableTextComponent.Extension ERROR_EXTENSION = + public static final ExtendableTextComponent.Extension ERROR_EXTENSION = ExtendableTextComponent.Extension.create(AllIcons.General.BalloonError, null, null); - public final static ExtendableTextComponent.Extension WARNING_EXTENSION = + public static final ExtendableTextComponent.Extension WARNING_EXTENSION = ExtendableTextComponent.Extension.create(AllIcons.General.BalloonWarning, null, null); public static void setExtension(@NotNull ExtendableTextComponent editor, @NotNull ExtendableTextComponent.Extension extension, boolean set) { diff --git a/platform/platform-api/src/com/intellij/openapi/ui/messages/MessageDialog.java b/platform/platform-api/src/com/intellij/openapi/ui/messages/MessageDialog.java index c4828155cbfa..f839129a31d0 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/messages/MessageDialog.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/messages/MessageDialog.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui.messages; import com.intellij.openapi.project.Project; @@ -153,8 +153,7 @@ public class MessageDialog extends DialogWrapper { return panel; } - @NotNull - protected JPanel createIconPanel() { + protected @NotNull JPanel createIconPanel() { JPanel panel = new JPanel(new BorderLayout(15, 0)); if (myIcon != null) { JLabel iconLabel = new JLabel(myIcon); @@ -166,8 +165,7 @@ public class MessageDialog extends DialogWrapper { return panel; } - @NotNull - protected JPanel createMessagePanel() { + protected @NotNull JPanel createMessagePanel() { JPanel messagePanel = new JPanel(new BorderLayout()); if (myMessage != null) { JLabel textLabel = new JLabel(myMessage); diff --git a/platform/platform-api/src/com/intellij/openapi/ui/messages/TwoStepConfirmationDialog.java b/platform/platform-api/src/com/intellij/openapi/ui/messages/TwoStepConfirmationDialog.java index 4f1505cade76..4ee913bc879a 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/messages/TwoStepConfirmationDialog.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/messages/TwoStepConfirmationDialog.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui.messages; import com.intellij.openapi.util.NlsContexts; @@ -23,7 +23,7 @@ public class TwoStepConfirmationDialog extends MessageDialog { final int defaultOptionIndexed, final int focusedOptionIndex, Icon icon, - @Nullable final BiFunction exitFunc) { + final @Nullable BiFunction exitFunc) { myCheckboxText = checkboxText; myChecked = checked; myExitFunc = exitFunc; @@ -43,8 +43,7 @@ public class TwoStepConfirmationDialog extends MessageDialog { return panel; } - @NotNull - protected JComponent createCheckComponent() { + protected @NotNull JComponent createCheckComponent() { myCheckBox = new JCheckBox(myCheckboxText); myCheckBox.setSelected(myChecked); return myCheckBox; diff --git a/platform/platform-api/src/com/intellij/openapi/ui/panel/ComponentPanel.java b/platform/platform-api/src/com/intellij/openapi/ui/panel/ComponentPanel.java index 866c42106da1..e7e1b7cc598f 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/panel/ComponentPanel.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/panel/ComponentPanel.java @@ -1,4 +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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui.panel; import com.intellij.openapi.util.NlsContexts; @@ -25,8 +25,7 @@ public abstract class ComponentPanel { * @return instance of ComponentPanel or null there is no * ComponentPanel associated with the owner. */ - @Nullable - public static ComponentPanel getComponentPanel(@NotNull JComponent component) { + public static @Nullable ComponentPanel getComponentPanel(@NotNull JComponent component) { return (ComponentPanel)component.getClientProperty(DECORATED_PANEL_PROPERTY); } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/panel/ComponentPanelBuilder.java b/platform/platform-api/src/com/intellij/openapi/ui/panel/ComponentPanelBuilder.java index 395d8e841cb1..8a1549cc27b9 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/panel/ComponentPanelBuilder.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/panel/ComponentPanelBuilder.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui.panel; import com.intellij.icons.AllIcons; @@ -197,8 +197,7 @@ public class ComponentPanelBuilder implements GridBagPanelBuilder { } @Override - @NotNull - public JPanel createPanel() { + public @NotNull JPanel createPanel() { JPanel panel; if (getDeprecatedBackground() == null) { panel = new NonOpaquePanel(new GridBagLayout()); @@ -239,8 +238,7 @@ public class ComponentPanelBuilder implements GridBagPanelBuilder { } } - @NotNull - public static Insets computeCommentInsets(@NotNull JComponent component, boolean commentBelow) { + public static @NotNull Insets computeCommentInsets(@NotNull JComponent component, boolean commentBelow) { boolean isMacDefault = UIUtil.isUnderDefaultMacTheme(); boolean isWin10 = UIUtil.isUnderWin10LookAndFeel(); @@ -396,8 +394,7 @@ public class ComponentPanelBuilder implements GridBagPanelBuilder { comment = createCommentComponent(() -> new CommentLabel("") { @Override - @NotNull - protected HyperlinkListener createHyperlinkListener() { + protected @NotNull HyperlinkListener createHyperlinkListener() { return myHyperlinkListener; } }, myCommentText, myCommentBelow, MAX_COMMENT_WIDTH, myCommentAllowAutoWrapping); diff --git a/platform/platform-api/src/com/intellij/openapi/ui/panel/PanelGridBuilder.java b/platform/platform-api/src/com/intellij/openapi/ui/panel/PanelGridBuilder.java index e822cf3d51f0..36e00baf38f2 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/panel/PanelGridBuilder.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/panel/PanelGridBuilder.java @@ -1,4 +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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui.panel; import com.intellij.util.ui.JBUI; @@ -58,8 +58,7 @@ public class PanelGridBuilder implements PanelBuilder { } @Override - @NotNull - public JPanel createPanel() { + public @NotNull JPanel createPanel() { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints gc = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, null, 0, 0); diff --git a/platform/platform-api/src/com/intellij/openapi/ui/panel/ProgressPanel.java b/platform/platform-api/src/com/intellij/openapi/ui/panel/ProgressPanel.java index 5935e6eb74ba..a7f488fd32e6 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/panel/ProgressPanel.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/panel/ProgressPanel.java @@ -1,16 +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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui.panel; import com.intellij.ui.InplaceButton; @@ -33,8 +21,7 @@ public abstract class ProgressPanel extends ComponentPanel { * @return instance of ProgressPanel or null if no JProgressBar * is found or it has no ProgressPanel associated. */ - @Nullable - public static ProgressPanel getProgressPanel(@NotNull JComponent parent) { + public static @Nullable ProgressPanel getProgressPanel(@NotNull JComponent parent) { JProgressBar pb = UIUtil.findComponentOfType(parent, JProgressBar.class); return pb != null ? (ProgressPanel)pb.getClientProperty(DECORATED_PANEL_PROPERTY) : null; } @@ -59,8 +46,7 @@ public abstract class ProgressPanel extends ComponentPanel { * * @return the state */ - @NotNull - public abstract State getState(); + public abstract @NotNull State getState(); public abstract void setState(@NotNull State state); @@ -95,12 +81,9 @@ public abstract class ProgressPanel extends ComponentPanel { */ public abstract void setSeparatorEnabled(boolean enabled); - @Nullable - public abstract JButton getCancelButtonAsButton(); + public abstract @Nullable JButton getCancelButtonAsButton(); - @Nullable - public abstract InplaceButton getCancelButton(); + public abstract @Nullable InplaceButton getCancelButton(); - @Nullable - public abstract InplaceButton getSuspendButton(); + public abstract @Nullable InplaceButton getSuspendButton(); } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/panel/ProgressPanelBuilder.java b/platform/platform-api/src/com/intellij/openapi/ui/panel/ProgressPanelBuilder.java index 9d357a721bea..bc9307de26bc 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/panel/ProgressPanelBuilder.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/panel/ProgressPanelBuilder.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui.panel; import com.intellij.CommonBundle; @@ -142,8 +142,7 @@ public class ProgressPanelBuilder implements GridBagPanelBuilder, PanelBuilder { return this; } - @NotNull - public ProgressPanelBuilder withText2() { + public @NotNull ProgressPanelBuilder withText2() { text2Enabled = true; return this; } @@ -159,8 +158,7 @@ public class ProgressPanelBuilder implements GridBagPanelBuilder, PanelBuilder { } @Override - @NotNull - public JPanel createPanel() { + public @NotNull JPanel createPanel() { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints gc = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, null, 0, 0); @@ -326,15 +324,13 @@ public class ProgressPanelBuilder implements GridBagPanelBuilder, PanelBuilder { return myCancelButtonAsButton; } - @Nullable @Override - public InplaceButton getCancelButton() { + public @Nullable InplaceButton getCancelButton() { return myCancelButton; } - @Nullable @Override - public InplaceButton getSuspendButton() { + public @Nullable InplaceButton getSuspendButton() { return mySuspendButton; } @@ -351,9 +347,8 @@ public class ProgressPanelBuilder implements GridBagPanelBuilder, PanelBuilder { } } - @NotNull @Override - public State getState() { + public @NotNull State getState() { return state; } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/popup/ActiveIcon.java b/platform/platform-api/src/com/intellij/openapi/ui/popup/ActiveIcon.java index edda8d0a77a3..f417599d232d 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/popup/ActiveIcon.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/popup/ActiveIcon.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui.popup; @@ -36,7 +22,7 @@ public class ActiveIcon implements Icon, ReplaceableIcon { this(icon, icon); } - public ActiveIcon(@Nullable final Icon regular, @Nullable final Icon inactive) { + public ActiveIcon(final @Nullable Icon regular, final @Nullable Icon inactive) { setIcons(regular, inactive); } @@ -45,7 +31,7 @@ public class ActiveIcon implements Icon, ReplaceableIcon { myActive = another.myActive; } - protected void setIcons(@Nullable final Icon regular, @Nullable final Icon inactive) { + protected void setIcons(final @Nullable Icon regular, final @Nullable Icon inactive) { myRegular = regular != null ? regular : EmptyIcon.ICON_0; myInactive = inactive != null ? inactive : myRegular; } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/popup/BalloonBuilder.java b/platform/platform-api/src/com/intellij/openapi/ui/popup/BalloonBuilder.java index 9baad584f1a1..c787f659b721 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/popup/BalloonBuilder.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/popup/BalloonBuilder.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui.popup; import com.intellij.openapi.Disposable; @@ -85,11 +85,9 @@ public interface BalloonBuilder { @NotNull BalloonBuilder setRequestFocus(boolean requestFocus); - @NotNull - default BalloonBuilder setPointerSize(Dimension size) { return this; } + default @NotNull BalloonBuilder setPointerSize(Dimension size) { return this; } - @NotNull - default BalloonBuilder setCornerToPointerDistance(int distance) { return this; } + default @NotNull BalloonBuilder setCornerToPointerDistance(int distance) { return this; } default BalloonBuilder setCornerRadius(int radius) { return this; } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/popup/ComponentPopupBuilder.java b/platform/platform-api/src/com/intellij/openapi/ui/popup/ComponentPopupBuilder.java index 51eb8a2b15ff..d47a3f923cde 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/popup/ComponentPopupBuilder.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/popup/ComponentPopupBuilder.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui.popup; import com.intellij.openapi.project.Project; @@ -168,8 +168,7 @@ public interface ComponentPopupBuilder { @NotNull ComponentPopupBuilder setNormalWindowLevel(boolean b); - @NotNull - default ComponentPopupBuilder setBorderColor(Color color) { + default @NotNull ComponentPopupBuilder setBorderColor(Color color) { return this; } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/popup/IconButton.java b/platform/platform-api/src/com/intellij/openapi/ui/popup/IconButton.java index cd0cd1505911..4689a8d7f43a 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/popup/IconButton.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/popup/IconButton.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui.popup; @@ -30,13 +16,13 @@ public class IconButton extends ActiveIcon { private Icon myHovered; - public IconButton(@Tooltip String tooltip, @Nullable final Icon regular, @Nullable final Icon hovered, @Nullable final Icon inactive) { + public IconButton(@Tooltip String tooltip, final @Nullable Icon regular, final @Nullable Icon hovered, final @Nullable Icon inactive) { super(regular, inactive); myTooltip = tooltip; setHovered(hovered); } - private IconButton(@Tooltip String tooltip, @NotNull final ActiveIcon base, @Nullable final Icon hovered) { + private IconButton(@Tooltip String tooltip, final @NotNull ActiveIcon base, final @Nullable Icon hovered) { super(base); myTooltip = tooltip; setHovered(hovered); @@ -55,7 +41,7 @@ public class IconButton extends ActiveIcon { } @ApiStatus.Internal - public void setIcons(@Nullable final Icon regular, @Nullable final Icon inactive, @Nullable final Icon hovered) { + public void setIcons(final @Nullable Icon regular, final @Nullable Icon inactive, final @Nullable Icon hovered) { setIcons(regular, inactive); setHovered(hovered); } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/popup/JBPopupFactory.java b/platform/platform-api/src/com/intellij/openapi/ui/popup/JBPopupFactory.java index c93b42a3024e..1f81080647e3 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/popup/JBPopupFactory.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/popup/JBPopupFactory.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui.popup; @@ -11,9 +11,9 @@ import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.util.Condition; -import com.intellij.ui.awt.RelativePoint; import com.intellij.openapi.util.NlsContexts; import com.intellij.openapi.util.NlsContexts.PopupTitle; +import com.intellij.ui.awt.RelativePoint; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -90,11 +90,9 @@ public abstract class JBPopupFactory { return ApplicationManager.getApplication().getService(JBPopupFactory.class); } - @NotNull - public abstract IPopupChooserBuilder createPopupChooserBuilder(@NotNull List list); + public abstract @NotNull IPopupChooserBuilder createPopupChooserBuilder(@NotNull List list); - @NotNull - public PopupChooserBuilder createPopupChooserBuilder(@NotNull JTable table) { + public @NotNull PopupChooserBuilder createPopupChooserBuilder(@NotNull JTable table) { return new PopupChooserBuilder(table); } @@ -102,8 +100,7 @@ public abstract class JBPopupFactory { * @deprecated Please use {@link #createPopupChooserBuilder(List)} instead */ @Deprecated - @NotNull - public PopupChooserBuilder createListPopupBuilder(@NotNull JList list) { + public @NotNull PopupChooserBuilder createListPopupBuilder(@NotNull JList list) { return new PopupChooserBuilder<>(list); } @@ -115,8 +112,7 @@ public abstract class JBPopupFactory { * @param defaultOptionIndex the index of the option which is selected by default. * @return the popup instance. */ - @NotNull - public abstract ListPopup createConfirmation(@PopupTitle String title, Runnable onYes, int defaultOptionIndex); + public abstract @NotNull ListPopup createConfirmation(@PopupTitle String title, Runnable onYes, int defaultOptionIndex); /** * Creates a popup allowing to choose one of two specified options and execute code when one of them is selected. @@ -128,8 +124,7 @@ public abstract class JBPopupFactory { * @param defaultOptionIndex the index of the option which is selected by default. * @return the popup instance. */ - @NotNull - public abstract ListPopup createConfirmation(@PopupTitle String title, + public abstract @NotNull ListPopup createConfirmation(@PopupTitle String title, @NlsContexts.Label String yesText, @NlsContexts.Label String noText, Runnable onYes, @@ -146,8 +141,7 @@ public abstract class JBPopupFactory { * @param defaultOptionIndex the index of the option which is selected by default. * @return the popup instance. */ - @NotNull - public abstract ListPopup createConfirmation(@PopupTitle String title, + public abstract @NotNull ListPopup createConfirmation(@PopupTitle String title, @NlsContexts.Label String yesText, @NlsContexts.Label String noText, Runnable onYes, @@ -158,8 +152,7 @@ public abstract class JBPopupFactory { * @deprecated use {@link #createActionsStep(ActionGroup, DataContext, String, boolean, boolean, String, Component, boolean, int, boolean)} */ @Deprecated(forRemoval = true) - @NotNull - public ListPopupStep createActionsStep(@NotNull ActionGroup actionGroup, + public @NotNull ListPopupStep createActionsStep(@NotNull ActionGroup actionGroup, @NotNull DataContext dataContext, boolean showNumbers, boolean showDisabledActions, @@ -173,8 +166,7 @@ public abstract class JBPopupFactory { * @deprecated use {@link #createActionsStep(ActionGroup, DataContext, String, boolean, boolean, String, Component, boolean, int, boolean)} */ @Deprecated(forRemoval = true) - @NotNull - public ListPopupStep createActionsStep(@NotNull ActionGroup actionGroup, + public @NotNull ListPopupStep createActionsStep(@NotNull ActionGroup actionGroup, @NotNull DataContext dataContext, boolean showNumbers, boolean showDisabledActions, @@ -186,20 +178,18 @@ public abstract class JBPopupFactory { return createActionsStep(actionGroup, dataContext, null, showNumbers, showDisabledActions, title, component, honorActionMnemonics, defaultOptionIndex, autoSelectionEnabled); } - @NotNull - public abstract ListPopupStep createActionsStep(@NotNull ActionGroup actionGroup, - @NotNull DataContext dataContext, - @Nullable String actionPlace, - boolean showNumbers, - boolean showDisabledActions, - @PopupTitle String title, - Component component, - boolean honorActionMnemonics, - int defaultOptionIndex, - boolean autoSelectionEnabled); + public abstract @NotNull ListPopupStep createActionsStep(@NotNull ActionGroup actionGroup, + @NotNull DataContext dataContext, + @Nullable String actionPlace, + boolean showNumbers, + boolean showDisabledActions, + @PopupTitle String title, + Component component, + boolean honorActionMnemonics, + int defaultOptionIndex, + boolean autoSelectionEnabled); - @NotNull - public abstract RelativePoint guessBestPopupLocation(@NotNull JComponent component); + public abstract @NotNull RelativePoint guessBestPopupLocation(@NotNull JComponent component); public boolean isChildPopupFocused(@Nullable Component parent) { return getChildFocusedPopup(parent) != null; @@ -255,8 +245,7 @@ public abstract class JBPopupFactory { * @param showDisabledActions if true, disabled actions are shown as disabled; if false, disabled actions are not shown * @return the popup instance. */ - @NotNull - public ListPopup createActionGroupPopup(@Nullable @PopupTitle String title, + public @NotNull ListPopup createActionGroupPopup(@Nullable @PopupTitle String title, @NotNull ActionGroup actionGroup, @NotNull DataContext dataContext, ActionSelectionAid selectionAidMethod, @@ -283,8 +272,7 @@ public abstract class JBPopupFactory { * @param actionPlace action place for ActionManager to use when creating the popup * @return the popup instance. */ - @NotNull - public ListPopup createActionGroupPopup(@PopupTitle String title, + public @NotNull ListPopup createActionGroupPopup(@PopupTitle String title, @NotNull ActionGroup actionGroup, @NotNull DataContext dataContext, ActionSelectionAid selectionAidMethod, @@ -306,8 +294,7 @@ public abstract class JBPopupFactory { * is displayed) * @return the popup instance. */ - @NotNull - public ListPopup createActionGroupPopup(@PopupTitle String title, + public @NotNull ListPopup createActionGroupPopup(@PopupTitle String title, @NotNull ActionGroup actionGroup, @NotNull DataContext dataContext, ActionSelectionAid selectionAidMethod, @@ -317,37 +304,34 @@ public abstract class JBPopupFactory { return createActionGroupPopup(title, actionGroup, dataContext, selectionAidMethod, showDisabledActions, disposeCallback, maxRowCount, null, null); } - @NotNull - public ListPopup createActionGroupPopup(@PopupTitle String title, - @NotNull ActionGroup actionGroup, - @NotNull DataContext dataContext, - boolean showDisabledActions, - @Nullable Runnable disposeCallback, - int maxRowCount) { + public @NotNull ListPopup createActionGroupPopup(@PopupTitle String title, + @NotNull ActionGroup actionGroup, + @NotNull DataContext dataContext, + boolean showDisabledActions, + @Nullable Runnable disposeCallback, + int maxRowCount) { return createActionGroupPopup(title, actionGroup, dataContext, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, showDisabledActions, disposeCallback, maxRowCount); } - @NotNull - public abstract ListPopup createActionGroupPopup(@PopupTitle String title, - @NotNull ActionGroup actionGroup, - @NotNull DataContext dataContext, - boolean showNumbers, - boolean showDisabledActions, - boolean honorActionMnemonics, - @Nullable Runnable disposeCallback, - int maxRowCount, - @Nullable Condition preselectActionCondition); + public abstract @NotNull ListPopup createActionGroupPopup(@PopupTitle String title, + @NotNull ActionGroup actionGroup, + @NotNull DataContext dataContext, + boolean showNumbers, + boolean showDisabledActions, + boolean honorActionMnemonics, + @Nullable Runnable disposeCallback, + int maxRowCount, + @Nullable Condition preselectActionCondition); - @NotNull - public abstract ListPopup createActionGroupPopup(@PopupTitle String title, - @NotNull ActionGroup actionGroup, - @NotNull DataContext dataContext, - ActionSelectionAid aid, - boolean showDisabledActions, - @Nullable Runnable disposeCallback, - int maxRowCount, - @Nullable Condition preselectActionCondition, - @Nullable String actionPlace); + public abstract @NotNull ListPopup createActionGroupPopup(@PopupTitle String title, + @NotNull ActionGroup actionGroup, + @NotNull DataContext dataContext, + ActionSelectionAid aid, + boolean showDisabledActions, + @Nullable Runnable disposeCallback, + int maxRowCount, + @Nullable Condition preselectActionCondition, + @Nullable String actionPlace); /** * Creates a custom list popup with the specified step. @@ -355,8 +339,7 @@ public abstract class JBPopupFactory { * @param step the custom step for the list popup. * @return the popup instance. */ - @NotNull - public abstract ListPopup createListPopup(@NotNull ListPopupStep step); + public abstract @NotNull ListPopup createListPopup(@NotNull ListPopupStep step); /** * Creates a custom list popup with the specified step. @@ -366,23 +349,18 @@ public abstract class JBPopupFactory { * a scrollbar will be displayed). * @return the popup instance. */ - @NotNull - public abstract ListPopup createListPopup(@NotNull ListPopupStep step, int maxRowCount); + public abstract @NotNull ListPopup createListPopup(@NotNull ListPopupStep step, int maxRowCount); - @NotNull - public abstract ListPopup createListPopup(@NotNull Project project, - @NotNull ListPopupStep step, - @NotNull Function cellRendererProducer); + public abstract @NotNull ListPopup createListPopup(@NotNull Project project, + @NotNull ListPopupStep step, + @NotNull Function cellRendererProducer); - @NotNull - public abstract TreePopup createTree(JBPopup parent, @NotNull TreePopupStep step, Object parentValue); + public abstract @NotNull TreePopup createTree(JBPopup parent, @NotNull TreePopupStep step, Object parentValue); - @NotNull - public abstract TreePopup createTree(@NotNull TreePopupStep step); + public abstract @NotNull TreePopup createTree(@NotNull TreePopupStep step); - @NotNull - public abstract ComponentPopupBuilder createComponentPopupBuilder(@NotNull JComponent content, - @Nullable JComponent preferableFocusComponent); + public abstract @NotNull ComponentPopupBuilder createComponentPopupBuilder(@NotNull JComponent content, + @Nullable JComponent preferableFocusComponent); /** * Returns the location where a popup with the specified data context is displayed. @@ -394,8 +372,7 @@ public abstract class JBPopupFactory { * - current selected node for tree
* - current selected row for list
*/ - @NotNull - public abstract RelativePoint guessBestPopupLocation(@NotNull DataContext dataContext); + public abstract @NotNull RelativePoint guessBestPopupLocation(@NotNull DataContext dataContext); /** * Returns the location where a popup invoked from the specified editor should be displayed. @@ -403,8 +380,7 @@ public abstract class JBPopupFactory { * @param editor the editor over which the popup is shown. * @return location as close as possible to the action origin. */ - @NotNull - public abstract RelativePoint guessBestPopupLocation(@NotNull Editor editor); + public abstract @NotNull RelativePoint guessBestPopupLocation(@NotNull Editor editor); /** * @param editor the editor over which the popup is shown. @@ -415,38 +391,27 @@ public abstract class JBPopupFactory { public abstract Point getCenterOf(JComponent container, JComponent content); - @NotNull - public abstract List getChildPopups(@NotNull Component parent); + public abstract @NotNull List getChildPopups(@NotNull Component parent); public abstract boolean isPopupActive(); - @NotNull - public abstract BalloonBuilder createBalloonBuilder(@NotNull JComponent content); + public abstract @NotNull BalloonBuilder createBalloonBuilder(@NotNull JComponent content); - @NotNull - public abstract BalloonBuilder createDialogBalloonBuilder(@NotNull JComponent content, @PopupTitle String title); + public abstract @NotNull BalloonBuilder createDialogBalloonBuilder(@NotNull JComponent content, @PopupTitle String title); - @NotNull - public BalloonBuilder createHtmlTextBalloonBuilder(@NotNull @NlsContexts.PopupContent String htmlContent, @Nullable Icon icon, Color fillColor, @Nullable HyperlinkListener listener) { + public @NotNull BalloonBuilder createHtmlTextBalloonBuilder(@NotNull @NlsContexts.PopupContent String htmlContent, @Nullable Icon icon, Color fillColor, @Nullable HyperlinkListener listener) { return createHtmlTextBalloonBuilder(htmlContent, icon, null, fillColor, listener); } - @NotNull - public abstract BalloonBuilder createHtmlTextBalloonBuilder(@NotNull @NlsContexts.PopupContent String htmlContent, @Nullable Icon icon, Color textColor, Color fillColor, @Nullable HyperlinkListener listener); + public abstract @NotNull BalloonBuilder createHtmlTextBalloonBuilder(@NotNull @NlsContexts.PopupContent String htmlContent, @Nullable Icon icon, Color textColor, Color fillColor, @Nullable HyperlinkListener listener); - @NotNull - public abstract BalloonBuilder createHtmlTextBalloonBuilder(@NotNull @NlsContexts.PopupContent String htmlContent, MessageType messageType, @Nullable HyperlinkListener listener); + public abstract @NotNull BalloonBuilder createHtmlTextBalloonBuilder(@NotNull @NlsContexts.PopupContent String htmlContent, MessageType messageType, @Nullable HyperlinkListener listener); - @NotNull - public abstract JBPopup createMessage(@NlsContexts.PopupContent String text); + public abstract @NotNull JBPopup createMessage(@NlsContexts.PopupContent String text); - @Nullable - public abstract Balloon getParentBalloonFor(@Nullable Component c); + public abstract @Nullable Balloon getParentBalloonFor(@Nullable Component c); - @NotNull - protected abstract PopupChooserBuilder.PopupComponentAdapter createPopupComponentAdapter(@NotNull PopupChooserBuilder builder, @NotNull JList list); - @NotNull - protected abstract PopupChooserBuilder.PopupComponentAdapter createPopupComponentAdapter(@NotNull PopupChooserBuilder builder, @NotNull JTree tree); - @NotNull - protected abstract PopupChooserBuilder.PopupComponentAdapter createPopupComponentAdapter(@NotNull PopupChooserBuilder builder, @NotNull JTable table); + protected abstract @NotNull PopupChooserBuilder.PopupComponentAdapter createPopupComponentAdapter(@NotNull PopupChooserBuilder builder, @NotNull JList list); + protected abstract @NotNull PopupChooserBuilder.PopupComponentAdapter createPopupComponentAdapter(@NotNull PopupChooserBuilder builder, @NotNull JTree tree); + protected abstract @NotNull PopupChooserBuilder.PopupComponentAdapter createPopupComponentAdapter(@NotNull PopupChooserBuilder builder, @NotNull JTable table); } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/popup/PopupChooserBuilder.java b/platform/platform-api/src/com/intellij/openapi/ui/popup/PopupChooserBuilder.java index 78188df797c6..a149e0690296 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/popup/PopupChooserBuilder.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/popup/PopupChooserBuilder.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui.popup; import com.intellij.openapi.application.AccessToken; @@ -118,8 +118,7 @@ public class PopupChooserBuilder implements IPopupChooserBuilder { return false; } - @Nullable - default Predicate getKeyEventHandler() { + default @Nullable Predicate getKeyEventHandler() { return null; } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/popup/util/BaseTreePopupStep.java b/platform/platform-api/src/com/intellij/openapi/ui/popup/util/BaseTreePopupStep.java index 6973a1eabcc4..063e268f10e3 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/popup/util/BaseTreePopupStep.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/popup/util/BaseTreePopupStep.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui.popup.util; import com.intellij.ide.util.treeView.AbstractTreeStructure; @@ -68,8 +68,7 @@ public class BaseTreePopupStep extends BaseStep implements TreePopupStep getValues() { + public @NotNull List getValues() { return Collections.emptyList(); } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/popup/util/PopupUtil.java b/platform/platform-api/src/com/intellij/openapi/ui/popup/util/PopupUtil.java index 2de44f98d2e8..2a8530f4dcac 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/popup/util/PopupUtil.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/popup/util/PopupUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.ui.popup.util; import com.intellij.codeWithMe.ClientId; @@ -48,8 +48,7 @@ public final class PopupUtil { private PopupUtil() { } - @Nullable - public static Component getOwner(@Nullable Component c) { + public static @Nullable Component getOwner(@Nullable Component c) { if (c == null) return null; final Window wnd = SwingUtilities.getWindowAncestor(c); @@ -83,7 +82,7 @@ public final class PopupUtil { return null; } - public static void setPopupType(@NotNull final PopupFactory factory, final int type) { + public static void setPopupType(final @NotNull PopupFactory factory, final int type) { try { final Method method = PopupFactory.class.getDeclaredMethod("setPopupType", int.class); method.setAccessible(true); @@ -94,7 +93,7 @@ public final class PopupUtil { } } - public static int getPopupType(@NotNull final PopupFactory factory) { + public static int getPopupType(final @NotNull PopupFactory factory) { try { if (!ClientId.isCurrentlyUnderLocalId()) { final Field field = PopupFactory.class.getDeclaredField("HEAVY_WEIGHT_POPUP"); @@ -126,7 +125,7 @@ public final class PopupUtil { return JOptionPane.getRootFrame(); } - public static void showBalloonForActiveFrame(@NotNull final @NlsContexts.PopupContent String message, final MessageType type) { + public static void showBalloonForActiveFrame(final @NotNull @NlsContexts.PopupContent String message, final MessageType type) { final Runnable runnable = () -> { final IdeFrame frame = IdeFocusManager.findInstance().getLastFocusedFrame(); if (frame == null) { @@ -145,7 +144,7 @@ public final class PopupUtil { UIUtil.invokeLaterIfNeeded(runnable); } - public static void showBalloonForActiveComponent(@NotNull final @NlsContexts.PopupContent String message, final MessageType type) { + public static void showBalloonForActiveComponent(final @NotNull @NlsContexts.PopupContent String message, final MessageType type) { Runnable runnable = () -> { Window[] windows = Window.getWindows(); Window targetWindow = null; @@ -165,8 +164,8 @@ public final class PopupUtil { UIUtil.invokeLaterIfNeeded(runnable); } - public static void showBalloonForComponent(@NotNull Component component, @NotNull final @NlsContexts.PopupContent String message, final MessageType type, - final boolean atTop, @Nullable final Disposable disposable) { + public static void showBalloonForComponent(@NotNull Component component, final @NotNull @NlsContexts.PopupContent String message, final MessageType type, + final boolean atTop, final @Nullable Disposable disposable) { final JBPopupFactory popupFactory = JBPopupFactory.getInstance(); if (popupFactory == null) return; BalloonBuilder balloonBuilder = popupFactory.createHtmlTextBalloonBuilder(message, type, null); @@ -299,8 +298,7 @@ public final class PopupUtil { content.putClientProperty(POPUP_TOGGLE_COMPONENT, toggleComponent != null ? new WeakReference<>(toggleComponent) : null); } - @Nullable - public static Component getPopupToggleComponent(@NotNull JBPopup jbPopup) { + public static @Nullable Component getPopupToggleComponent(@NotNull JBPopup jbPopup) { return (Component)SoftReference.dereference((WeakReference)jbPopup.getContent().getClientProperty(POPUP_TOGGLE_COMPONENT)); } diff --git a/platform/platform-api/src/com/intellij/openapi/util/DimensionService.java b/platform/platform-api/src/com/intellij/openapi/util/DimensionService.java index b900c29551ad..6be7f1266ecc 100644 --- a/platform/platform-api/src/com/intellij/openapi/util/DimensionService.java +++ b/platform/platform-api/src/com/intellij/openapi/util/DimensionService.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.util; import com.intellij.openapi.application.ApplicationManager; @@ -38,15 +38,15 @@ public final class DimensionService extends SimpleModificationTracker implements private final Map myKeyToLocation = new LinkedHashMap<>(); private final Map myKeToSize = new LinkedHashMap<>(); private final ObjectIntMap myKeyToExtendedState = new ObjectIntHashMap<>(); - @NonNls private static final String EXTENDED_STATE = "extendedState"; - @NonNls private static final String KEY = "key"; - @NonNls private static final String STATE = "state"; - @NonNls private static final String ELEMENT_LOCATION = "location"; - @NonNls private static final String ELEMENT_SIZE = "size"; - @NonNls private static final String ATTRIBUTE_X = "x"; - @NonNls private static final String ATTRIBUTE_Y = "y"; - @NonNls private static final String ATTRIBUTE_WIDTH = "width"; - @NonNls private static final String ATTRIBUTE_HEIGHT = "height"; + private static final @NonNls String EXTENDED_STATE = "extendedState"; + private static final @NonNls String KEY = "key"; + private static final @NonNls String STATE = "state"; + private static final @NonNls String ELEMENT_LOCATION = "location"; + private static final @NonNls String ELEMENT_SIZE = "size"; + private static final @NonNls String ATTRIBUTE_X = "x"; + private static final @NonNls String ATTRIBUTE_Y = "y"; + private static final @NonNls String ATTRIBUTE_WIDTH = "width"; + private static final @NonNls String ATTRIBUTE_HEIGHT = "height"; public static DimensionService getInstance() { return ApplicationManager.getApplication().getService(DimensionService.class); @@ -63,13 +63,11 @@ public final class DimensionService extends SimpleModificationTracker implements * @deprecated use {@link #getLocation(String, Project)} instead. */ @Deprecated(forRemoval = true) - @Nullable - public synchronized Point getLocation(String key) { + public synchronized @Nullable Point getLocation(String key) { return getLocation(key, guessProject()); } - @Nullable - public synchronized Point getLocation(@NotNull String key, @Nullable Project project) { + public synchronized @Nullable Point getLocation(@NotNull String key, @Nullable Project project) { Point point = project == null ? null : WindowStateService.getInstance(project).getLocation(key); if (point != null) return point; @@ -125,13 +123,11 @@ public final class DimensionService extends SimpleModificationTracker implements * @deprecated use {@link #getSize(String, Project)} instead. */ @Deprecated(forRemoval = true) - @Nullable - public synchronized Dimension getSize(@NotNull @NonNls String key) { + public synchronized @Nullable Dimension getSize(@NotNull @NonNls String key) { return getSize(key, guessProject()); } - @Nullable - public synchronized Dimension getSize(@NotNull @NonNls String key, @Nullable Project project) { + public synchronized @Nullable Dimension getSize(@NotNull @NonNls String key, @Nullable Project project) { Dimension size = project == null ? null : WindowStateService.getInstance(project).getSize(key); if (size != null) return size; @@ -248,8 +244,7 @@ public final class DimensionService extends SimpleModificationTracker implements } @Deprecated - @Nullable - private static Project guessProject() { + private static @Nullable Project guessProject() { Project[] openProjects = ProjectManager.getInstance().getOpenProjects(); return openProjects.length == 1 ? openProjects[0] : null; } @@ -259,8 +254,7 @@ public final class DimensionService extends SimpleModificationTracker implements * key is the HiDPI-aware key, * scale is the HiDPI-aware factor to transform size metrics. */ - @NotNull - private static Pair keyPair(String key, @Nullable Project project) { + private static @NotNull Pair keyPair(String key, @Nullable Project project) { GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); if (env.isHeadlessInstance()) { return new Pair<>(key + ".headless", 1f); @@ -310,8 +304,7 @@ public final class DimensionService extends SimpleModificationTracker implements return new Pair<>(realKey, scale); } - @NotNull - private static WindowStateService getWindowStateService(@Nullable Project project) { + private static @NotNull WindowStateService getWindowStateService(@Nullable Project project) { return project == null ? WindowStateService.getInstance() : WindowStateService.getInstance(project); } } diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileWrapper.java b/platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileWrapper.java index 6b2b969c9bef..0020f5b003e7 100644 --- a/platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileWrapper.java +++ b/platform/platform-api/src/com/intellij/openapi/vfs/VirtualFileWrapper.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.vfs; @@ -49,8 +49,7 @@ public final class VirtualFileWrapper { * * @return VirtualFile or null if file is not exist */ - @Nullable - public VirtualFile getVirtualFile() { + public @Nullable VirtualFile getVirtualFile() { return LocalFileSystem.getInstance().refreshAndFindFileByIoFile(myFile); } @@ -63,8 +62,7 @@ public final class VirtualFileWrapper { * * @return virtual file */ - @Nullable - public VirtualFile getVirtualFile(boolean createIfNotExist) { + public @Nullable VirtualFile getVirtualFile(boolean createIfNotExist) { if (createIfNotExist && !myFile.exists()) { try { if (!myFile.createNewFile()) { @@ -81,8 +79,7 @@ public final class VirtualFileWrapper { * * @return original java.io.File */ - @NotNull - public File getFile() { + public @NotNull File getFile() { return myFile; } } diff --git a/platform/platform-api/src/com/intellij/psi/PsiBundle.java b/platform/platform-api/src/com/intellij/psi/PsiBundle.java index 075ccbde8a49..a9d4f69bcb37 100644 --- a/platform/platform-api/src/com/intellij/psi/PsiBundle.java +++ b/platform/platform-api/src/com/intellij/psi/PsiBundle.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.psi; import com.intellij.core.CoreDeprecatedMessagesBundle; @@ -11,8 +11,7 @@ import org.jetbrains.annotations.NotNull; */ @Deprecated public final class PsiBundle { - @NotNull - public static @Nls String message(@NotNull String key, Object @NotNull ... params) { + public static @NotNull @Nls String message(@NotNull String key, Object @NotNull ... params) { return CoreDeprecatedMessagesBundle.message(key, params); } } \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/ui/AbstractFieldPanel.java b/platform/platform-api/src/com/intellij/ui/AbstractFieldPanel.java index e2474e5730ec..63c8994a83d1 100644 --- a/platform/platform-api/src/com/intellij/ui/AbstractFieldPanel.java +++ b/platform/platform-api/src/com/intellij/ui/AbstractFieldPanel.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.icons.AllIcons; @@ -153,18 +153,15 @@ public abstract class AbstractFieldPanel extends JPanel { } } - @NotNull - protected Icon getDefaultIcon() { + protected @NotNull Icon getDefaultIcon() { return AllIcons.General.OpenDisk; } - @NotNull - protected Icon getHoveredIcon() { + protected @NotNull Icon getHoveredIcon() { return AllIcons.General.OpenDiskHover; } - @NotNull - protected @NlsContexts.Tooltip String getIconTooltip() { + protected @NotNull @NlsContexts.Tooltip String getIconTooltip() { return UIBundle.message("component.with.browse.button.browse.button.tooltip.text") + " (" + KeymapUtil.getKeystrokeText(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_DOWN_MASK)) + ")"; } diff --git a/platform/platform-api/src/com/intellij/ui/AddDeleteListPanel.java b/platform/platform-api/src/com/intellij/ui/AddDeleteListPanel.java index d628fe2859fd..14e9bccfd6ad 100644 --- a/platform/platform-api/src/com/intellij/ui/AddDeleteListPanel.java +++ b/platform/platform-api/src/com/intellij/ui/AddDeleteListPanel.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; @@ -65,9 +65,8 @@ public abstract class AddDeleteListPanel extends PanelWithButtons implements protected void customizeDecorator(ToolbarDecorator decorator) { } - @NotNull @Override - public StatusText getEmptyText() { + public @NotNull StatusText getEmptyText() { return myList.getEmptyText(); } @@ -78,8 +77,7 @@ public abstract class AddDeleteListPanel extends PanelWithButtons implements } } - @Nullable - protected abstract T findItemToAdd(); + protected abstract @Nullable T findItemToAdd(); public Object [] getListItems(){ List items = new ArrayList<>(); diff --git a/platform/platform-api/src/com/intellij/ui/AddEditDeleteListPanel.java b/platform/platform-api/src/com/intellij/ui/AddEditDeleteListPanel.java index 724b3956ea1b..b8fc9b72d9b7 100644 --- a/platform/platform-api/src/com/intellij/ui/AddEditDeleteListPanel.java +++ b/platform/platform-api/src/com/intellij/ui/AddEditDeleteListPanel.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.util.NlsContexts.Label; @@ -12,7 +12,7 @@ import java.util.List; * @author Konstantin Bulenkov */ public abstract class AddEditDeleteListPanel extends AddDeleteListPanel { - public AddEditDeleteListPanel(@Label final String title, final List initialList) { + public AddEditDeleteListPanel(final @Label String title, final List initialList) { super(title, initialList); new DoubleClickListener() { @Override @@ -33,8 +33,7 @@ public abstract class AddEditDeleteListPanel extends AddDeleteListPanel { }); } - @Nullable - protected abstract T editSelectedItem(T item); + protected abstract @Nullable T editSelectedItem(T item); private void editSelectedItem() { int index = myList.getSelectedIndex(); diff --git a/platform/platform-api/src/com/intellij/ui/AddEditRemovePanel.java b/platform/platform-api/src/com/intellij/ui/AddEditRemovePanel.java index fa0fc22f0880..3ebb24479f96 100644 --- a/platform/platform-api/src/com/intellij/ui/AddEditRemovePanel.java +++ b/platform/platform-api/src/com/intellij/ui/AddEditRemovePanel.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.util.NlsContexts; @@ -58,13 +44,11 @@ public abstract class AddEditRemovePanel extends PanelWithButtons implements initPanel(); } - @Nullable - protected abstract T addItem(); + protected abstract @Nullable T addItem(); protected abstract boolean removeItem(T o); - @Nullable - protected abstract T editItem(T o); + protected abstract @Nullable T editItem(T o); public boolean isUpDownSupported() { return false; @@ -89,9 +73,8 @@ public abstract class AddEditRemovePanel extends PanelWithButtons implements return myLabel; } - @NotNull @Override - public StatusText getEmptyText() { + public @NotNull StatusText getEmptyText() { return myTable.getEmptyText(); } @@ -292,8 +275,7 @@ public abstract class AddEditRemovePanel extends PanelWithButtons implements public abstract static class TableModel { public abstract int getColumnCount(); - @Nullable - public abstract @ColumnName String getColumnName(int columnIndex); + public abstract @Nullable @ColumnName String getColumnName(int columnIndex); public abstract Object getField(T o, int columnIndex); public Class getColumnClass(int columnIndex) { return String.class; } diff --git a/platform/platform-api/src/com/intellij/ui/AnActionButton.java b/platform/platform-api/src/com/intellij/ui/AnActionButton.java index 04f2afcfe34c..e177c14bb895 100644 --- a/platform/platform-api/src/com/intellij/ui/AnActionButton.java +++ b/platform/platform-api/src/com/intellij/ui/AnActionButton.java @@ -139,13 +139,11 @@ public abstract class AnActionButton extends AnAction implements ShortcutProvide return myContextComponent; } - @NotNull - public DataContext getDataContext() { + public @NotNull DataContext getDataContext() { return DataManager.getInstance().getDataContext(getContextComponent()); } - @NotNull - public final RelativePoint getPreferredPopupPoint() { + public final @NotNull RelativePoint getPreferredPopupPoint() { RelativePoint result = CommonActionsPanel.getPreferredPopupPoint(this, myContextComponent); if (result != null) { return result; @@ -197,9 +195,8 @@ public abstract class AnActionButton extends AnAction implements ShortcutProvide return myAction.isDumbAware(); } - @NotNull @Override - public AnAction getDelegate() { + public @NotNull AnAction getDelegate() { return myAction; } } diff --git a/platform/platform-api/src/com/intellij/ui/AutoScrollFromSourceHandler.java b/platform/platform-api/src/com/intellij/ui/AutoScrollFromSourceHandler.java index e11e07608aa7..42af444da5f4 100644 --- a/platform/platform-api/src/com/intellij/ui/AutoScrollFromSourceHandler.java +++ b/platform/platform-api/src/com/intellij/ui/AutoScrollFromSourceHandler.java @@ -100,7 +100,7 @@ public abstract class AutoScrollFromSourceHandler { } @Override - public boolean isSelected(@NotNull final AnActionEvent event) { + public boolean isSelected(final @NotNull AnActionEvent event) { return isAutoScrollEnabled(); } @@ -110,7 +110,7 @@ public abstract class AutoScrollFromSourceHandler { } @Override - public void setSelected(@NotNull final AnActionEvent event, final boolean flag) { + public void setSelected(final @NotNull AnActionEvent event, final boolean flag) { setAutoScrollEnabled(flag); updateCurrentSelection(); } diff --git a/platform/platform-api/src/com/intellij/ui/AutoScrollToSourceHandler.java b/platform/platform-api/src/com/intellij/ui/AutoScrollToSourceHandler.java index f3693491974a..8c0e43b23648 100644 --- a/platform/platform-api/src/com/intellij/ui/AutoScrollToSourceHandler.java +++ b/platform/platform-api/src/com/intellij/ui/AutoScrollToSourceHandler.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; @@ -182,8 +182,7 @@ public abstract class AutoScrollToSourceHandler { DataManager.getInstance().getDataContext(tree)); } - @NotNull - public ToggleAction createToggleAction() { + public @NotNull ToggleAction createToggleAction() { return new AutoscrollToSourceAction(getActionName(), getActionDescription()); } diff --git a/platform/platform-api/src/com/intellij/ui/CheckBoxList.java b/platform/platform-api/src/com/intellij/ui/CheckBoxList.java index 999fd57c1aba..391f32f90e05 100644 --- a/platform/platform-api/src/com/intellij/ui/CheckBoxList.java +++ b/platform/platform-api/src/com/intellij/ui/CheckBoxList.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.util.NlsContexts; @@ -25,7 +25,7 @@ import java.util.List; import java.util.Map; public class CheckBoxList extends JBList { - private final static int RESET_ROLLOVER = -1; + private static final int RESET_ROLLOVER = -1; private final CellRenderer myCellRenderer; private CheckBoxListListener checkBoxListListener; @@ -154,8 +154,7 @@ public class CheckBoxList extends JBList { UIUtil.repaintViewport(this); } - @NotNull - private static Dimension getCheckBoxDimension(@NotNull JCheckBox checkBox) { + private static @NotNull Dimension getCheckBoxDimension(@NotNull JCheckBox checkBox) { Icon icon = null; BasicRadioButtonUI ui = ObjectUtils.tryCast(checkBox.getUI(), BasicRadioButtonUI.class); if (ui != null) { @@ -178,8 +177,7 @@ public class CheckBoxList extends JBList { * @param index The list cell index * @return A point relative to the checkbox or null, if it's outside of the checkbox. */ - @Nullable - protected Point findPointRelativeToCheckBox(int x, int y, @NotNull JCheckBox checkBox, int index) { + protected @Nullable Point findPointRelativeToCheckBox(int x, int y, @NotNull JCheckBox checkBox, int index) { int cx = x - myCellRenderer.getBorderInsets().left; int cy = y - myCellRenderer.getBorderInsets().top; return cx >= 0 && cy >= 0 ? new Point(cx, cy) : null; @@ -195,8 +193,7 @@ public class CheckBoxList extends JBList { * @param index The list cell index * @return A point relative to the checkbox or null, if it's outside of the checkbox. */ - @Nullable - protected Point findPointRelativeToCheckBoxWithAdjustedRendering(int x, int y, @NotNull JCheckBox checkBox, int index) { + protected @Nullable Point findPointRelativeToCheckBoxWithAdjustedRendering(int x, int y, @NotNull JCheckBox checkBox, int index) { boolean selected = isSelectedIndex(index); boolean hasFocus = hasFocus(); Component component = myCellRenderer.getListCellRendererComponent(this, checkBox, index, selected, hasFocus); @@ -216,8 +213,7 @@ public class CheckBoxList extends JBList { return null; } - @Nullable - private static Point getChildLocationRelativeToAncestor(@NotNull Component ancestor, @NotNull Component child) { + private static @Nullable Point getChildLocationRelativeToAncestor(@NotNull Component ancestor, @NotNull Component child) { int dx = 0, dy = 0; Component c = child; while (c != null && c != ancestor) { @@ -230,8 +226,7 @@ public class CheckBoxList extends JBList { } - @NotNull - private JCheckBox getCheckBoxAt(int index) { + private @NotNull JCheckBox getCheckBoxAt(int index) { return getModel().getElementAt(index); } @@ -270,8 +265,7 @@ public class CheckBoxList extends JBList { } } - @Nullable - public T getItemAt(int index) { + public @Nullable T getItemAt(int index) { JCheckBox checkBox = getModel().getElementAt(index); List value = myItemMap.getKeysByValue(checkBox); return value == null || value.isEmpty() ? null : value.get(0); @@ -381,15 +375,12 @@ public class CheckBoxList extends JBList { return rootComponent; } - @NotNull - private Insets getBorderInsets() { + private @NotNull Insets getBorderInsets() { return myBorderInsets; } } - @Nls - @Nullable - protected String getSecondaryText(int index) { + protected @Nls @Nullable String getSecondaryText(int index) { return null; } diff --git a/platform/platform-api/src/com/intellij/ui/CheckboxTreeBase.java b/platform/platform-api/src/com/intellij/ui/CheckboxTreeBase.java index 816e97b0bcf2..84761e47a65e 100644 --- a/platform/platform-api/src/com/intellij/ui/CheckboxTreeBase.java +++ b/platform/platform-api/src/com/intellij/ui/CheckboxTreeBase.java @@ -1,16 +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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.actionSystem.ActionManager; @@ -90,7 +78,7 @@ public class CheckboxTreeBase extends Tree { * @param the type of the node * @return an array of collected nodes */ - public T[] getCheckedNodes(final Class nodeType, @Nullable final NodeFilter filter) { + public T[] getCheckedNodes(final Class nodeType, final @Nullable NodeFilter filter) { return CheckboxTreeHelper.getCheckedNodes(nodeType, filter, getModel()); } diff --git a/platform/platform-api/src/com/intellij/ui/CheckboxTreeHelper.java b/platform/platform-api/src/com/intellij/ui/CheckboxTreeHelper.java index c4e7ead793be..96bc8ffb2cfa 100644 --- a/platform/platform-api/src/com/intellij/ui/CheckboxTreeHelper.java +++ b/platform/platform-api/src/com/intellij/ui/CheckboxTreeHelper.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.util.Key; @@ -33,7 +33,7 @@ public class CheckboxTreeHelper { myEventDispatcher = dispatcher; } - public void initTree(@NotNull final Tree tree, JComponent mainComponent, CheckboxTreeBase.CheckboxTreeCellRendererBase cellRenderer) { + public void initTree(final @NotNull Tree tree, JComponent mainComponent, CheckboxTreeBase.CheckboxTreeCellRendererBase cellRenderer) { removeTreeListeners(mainComponent); tree.setCellRenderer(cellRenderer); tree.setRootVisible(false); @@ -195,7 +195,7 @@ public class CheckboxTreeHelper { if (remover != null) remover.run(); } - public static T[] getCheckedNodes(final Class nodeType, @Nullable final Tree.NodeFilter filter, final TreeModel model) { + public static T[] getCheckedNodes(final Class nodeType, final @Nullable Tree.NodeFilter filter, final TreeModel model) { final ArrayList nodes = new ArrayList<>(); final Object root = model.getRoot(); if (!(root instanceof CheckedTreeNode)) { diff --git a/platform/platform-api/src/com/intellij/ui/ColorChooser.java b/platform/platform-api/src/com/intellij/ui/ColorChooser.java index fed9e641f72e..036745a12973 100644 --- a/platform/platform-api/src/com/intellij/ui/ColorChooser.java +++ b/platform/platform-api/src/com/intellij/ui/ColorChooser.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.project.Project; @@ -19,75 +19,67 @@ import java.util.List; */ @Deprecated(forRemoval = true) public final class ColorChooser { - @Nullable - public static Color chooseColor(Component parent, - @NlsContexts.DialogTitle String caption, - @Nullable Color preselectedColor, - boolean enableOpacity, - List listeners, - boolean opacityInPercent) { + public static @Nullable Color chooseColor(Component parent, + @NlsContexts.DialogTitle String caption, + @Nullable Color preselectedColor, + boolean enableOpacity, + List listeners, + boolean opacityInPercent) { return ColorChooserService.getInstance().showDialog(parent, caption, preselectedColor, enableOpacity, listeners, opacityInPercent); } - @Nullable - public static Color chooseColor(Component parent, - @NlsContexts.DialogTitle String caption, - @Nullable Color preselectedColor, - boolean enableOpacity) { + public static @Nullable Color chooseColor(Component parent, + @NlsContexts.DialogTitle String caption, + @Nullable Color preselectedColor, + boolean enableOpacity) { return chooseColor(parent, caption, preselectedColor, enableOpacity, Collections.emptyList(), false); } - @Nullable - public static Color chooseColor(Component parent, - @NlsContexts.DialogTitle String caption, - @Nullable Color preselectedColor, - boolean enableOpacity, - boolean opacityInPercent) { + public static @Nullable Color chooseColor(Component parent, + @NlsContexts.DialogTitle String caption, + @Nullable Color preselectedColor, + boolean enableOpacity, + boolean opacityInPercent) { return chooseColor(parent, caption, preselectedColor, enableOpacity, Collections.emptyList(), opacityInPercent); } - @Nullable - public static Color chooseColor(Component parent, - @NlsContexts.DialogTitle String caption, - @Nullable Color preselectedColor) { + public static @Nullable Color chooseColor(Component parent, + @NlsContexts.DialogTitle String caption, + @Nullable Color preselectedColor) { return chooseColor(parent, caption, preselectedColor, false); } - @Nullable - public static Color chooseColor(@Nullable Project project, - Component parent, - @NlsContexts.DialogTitle String caption, - @Nullable Color preselectedColor, - boolean enableOpacity, - List listeners, - boolean opacityInPercent) { + public static @Nullable Color chooseColor(@Nullable Project project, + Component parent, + @NlsContexts.DialogTitle String caption, + @Nullable Color preselectedColor, + boolean enableOpacity, + List listeners, + boolean opacityInPercent) { return ColorChooserService.getInstance().showDialog(project, parent, caption, preselectedColor, enableOpacity, listeners, opacityInPercent); } - @Nullable - public static Color chooseColor(@Nullable Project project, - Component parent, - @NlsContexts.DialogTitle String caption, - @Nullable Color preselectedColor, - boolean enableOpacity) { + public static @Nullable Color chooseColor(@Nullable Project project, + Component parent, + @NlsContexts.DialogTitle String caption, + @Nullable Color preselectedColor, + boolean enableOpacity) { return chooseColor(project, parent, caption, preselectedColor, enableOpacity, Collections.emptyList(), false); } - @Nullable - public static Color chooseColor(@Nullable Project project, - Component parent, - @NlsContexts.DialogTitle String caption, - @Nullable Color preselectedColor, - boolean enableOpacity, - boolean opacityInPercent) { + public static @Nullable Color chooseColor(@Nullable Project project, + Component parent, + @NlsContexts.DialogTitle String caption, + @Nullable Color preselectedColor, + boolean enableOpacity, + boolean opacityInPercent) { return chooseColor(project, parent, caption, preselectedColor, enableOpacity, Collections.emptyList(), opacityInPercent); } - @Nullable - public static Color chooseColor(@Nullable Project project, - Component parent, - @NlsContexts.DialogTitle String caption, - @Nullable Color preselectedColor) { + public static @Nullable Color chooseColor(@Nullable Project project, + Component parent, + @NlsContexts.DialogTitle String caption, + @Nullable Color preselectedColor) { return chooseColor(project, parent, caption, preselectedColor, false); } } \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/ui/ColorPanel.java b/platform/platform-api/src/com/intellij/ui/ColorPanel.java index e6e1a446d44a..84340c6b5dda 100644 --- a/platform/platform-api/src/com/intellij/ui/ColorPanel.java +++ b/platform/platform-api/src/com/intellij/ui/ColorPanel.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.util.text.StringUtil; @@ -116,8 +102,7 @@ public class ColorPanel extends JComponent { myListeners.add(actionlistener); } - @Nullable - public Color getSelectedColor() { + public @Nullable Color getSelectedColor() { return myColor; } diff --git a/platform/platform-api/src/com/intellij/ui/ColoredListCellRenderer.java b/platform/platform-api/src/com/intellij/ui/ColoredListCellRenderer.java index ce34ea9d6817..9867a95b226a 100644 --- a/platform/platform-api/src/com/intellij/ui/ColoredListCellRenderer.java +++ b/platform/platform-api/src/com/intellij/ui/ColoredListCellRenderer.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.ui.list.ListCellBackgroundSupplier; @@ -70,8 +70,7 @@ public abstract class ColoredListCellRenderer extends SimpleColoredComponent } @Override - @NotNull - public Dimension getPreferredSize() { + public @NotNull Dimension getPreferredSize() { // There is a bug in BasicComboPopup. It does not add renderer into CellRendererPane, // so font can be null here. diff --git a/platform/platform-api/src/com/intellij/ui/ColoredTreeCellRenderer.java b/platform/platform-api/src/com/intellij/ui/ColoredTreeCellRenderer.java index b12e4786e7ae..5019decdc74e 100644 --- a/platform/platform-api/src/com/intellij/ui/ColoredTreeCellRenderer.java +++ b/platform/platform-api/src/com/intellij/ui/ColoredTreeCellRenderer.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.actionSystem.ActionManager; @@ -43,8 +43,7 @@ public abstract class ColoredTreeCellRenderer extends SimpleColoredComponent imp private boolean myOpaque = true; - @Nullable @Nls - private String myAccessibleStatusText = null; + private @Nullable @Nls String myAccessibleStatusText = null; @Override public final Component getTreeCellRendererComponent(JTree tree, diff --git a/platform/platform-api/src/com/intellij/ui/CommonActionsPanel.java b/platform/platform-api/src/com/intellij/ui/CommonActionsPanel.java index 3c7ccc5762ae..dab06ebfc8e8 100644 --- a/platform/platform-api/src/com/intellij/ui/CommonActionsPanel.java +++ b/platform/platform-api/src/com/intellij/ui/CommonActionsPanel.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.icons.AllIcons; @@ -69,15 +69,13 @@ public final class CommonActionsPanel extends JPanel { myText = text; } - @NotNull - public Icon getIcon() { + public @NotNull Icon getIcon() { return myIcon; } abstract @NotNull AnActionButton createButton(@NotNull Listener listener, @NlsContexts.Button String name, @NotNull Icon icon); - @NotNull - public @NlsContexts.Button String getText() { + public @NotNull @NlsContexts.Button String getText() { return myText.get(); } } @@ -156,8 +154,7 @@ public final class CommonActionsPanel extends JPanel { add(myToolbar.getComponent(), BorderLayout.CENTER); } - @NotNull - public ActionToolbar getToolbar() { + public @NotNull ActionToolbar getToolbar() { return myToolbar; } @@ -273,8 +270,7 @@ public final class CommonActionsPanel extends JPanel { } } - @NotNull - public ActionToolbarPosition getPosition() { + public @NotNull ActionToolbarPosition getPosition() { return myPosition; } @@ -321,7 +317,7 @@ public final class CommonActionsPanel extends JPanel { return null; } - static abstract class MyActionButton extends AnActionButton implements DumbAware { + abstract static class MyActionButton extends AnActionButton implements DumbAware { private final Buttons myButton; protected final Listener myListener; diff --git a/platform/platform-api/src/com/intellij/ui/ContextHelpLabel.java b/platform/platform-api/src/com/intellij/ui/ContextHelpLabel.java index 6b861c31e410..df3270ac3614 100644 --- a/platform/platform-api/src/com/intellij/ui/ContextHelpLabel.java +++ b/platform/platform-api/src/com/intellij/ui/ContextHelpLabel.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.icons.AllIcons; @@ -58,30 +44,26 @@ public class ContextHelpLabel extends JBLabel { super.removeNotify(); } - @NotNull - public static ContextHelpLabel create(@Tooltip @NotNull String description) { + public static @NotNull ContextHelpLabel create(@Tooltip @NotNull String description) { return new ContextHelpLabel(new HelpTooltip().setDescription(description)); } - @NotNull - public static ContextHelpLabel create(@TooltipTitle @NotNull String title, @Tooltip @NotNull String description) { + public static @NotNull ContextHelpLabel create(@TooltipTitle @NotNull String title, @Tooltip @NotNull String description) { return new ContextHelpLabel(new HelpTooltip().setDescription(description).setTitle(title)); } - @NotNull - public static ContextHelpLabel createWithLink(@TooltipTitle @Nullable String title, - @Tooltip @NotNull String description, - @LinkLabel @NotNull String linkText, - @NotNull Runnable linkAction) { + public static @NotNull ContextHelpLabel createWithLink(@TooltipTitle @Nullable String title, + @Tooltip @NotNull String description, + @LinkLabel @NotNull String linkText, + @NotNull Runnable linkAction) { return createWithLink(title, description, linkText, false, linkAction); } - @NotNull - public static ContextHelpLabel createWithLink(@TooltipTitle @Nullable String title, - @Tooltip @NotNull String description, - @LinkLabel @NotNull String linkText, - boolean linkIsExternal, - @NotNull Runnable linkAction) { + public static @NotNull ContextHelpLabel createWithLink(@TooltipTitle @Nullable String title, + @Tooltip @NotNull String description, + @LinkLabel @NotNull String linkText, + boolean linkIsExternal, + @NotNull Runnable linkAction) { return new ContextHelpLabel(new HelpTooltip().setDescription(description).setTitle(title).setLink(linkText, linkAction, linkIsExternal)); } diff --git a/platform/platform-api/src/com/intellij/ui/CustomizeColoredTreeCellRenderer.java b/platform/platform-api/src/com/intellij/ui/CustomizeColoredTreeCellRenderer.java index 36ef59582337..118d72bbab2c 100644 --- a/platform/platform-api/src/com/intellij/ui/CustomizeColoredTreeCellRenderer.java +++ b/platform/platform-api/src/com/intellij/ui/CustomizeColoredTreeCellRenderer.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import org.jetbrains.annotations.Nullable; @@ -23,8 +9,7 @@ public abstract class CustomizeColoredTreeCellRenderer { public abstract void customizeCellRenderer(final SimpleColoredComponent renderer, final JTree tree, final Object value, final boolean selected, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus); - @Nullable - public Object getTag() { + public @Nullable Object getTag() { return null; } } diff --git a/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java b/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java index c565ce0ad209..57f2bea62a08 100644 --- a/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java +++ b/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.codeInsight.intention.*; @@ -235,11 +235,11 @@ public class EditorNotificationPanel extends JPanel implements IntentionActionPr add(BorderLayout.EAST, myLastPanel); } - private @NotNull static NamedBorder borderWithoutStatus() { + private static @NotNull NamedBorder borderWithoutStatus() { return withName(JBUI.Borders.empty(JBUI.CurrentTheme.Editor.Notification.borderInsetsWithoutStatus()), BORDER_WITHOUT_STATUS); } - private @NotNull static NamedBorder borderWithStatus() { + private static @NotNull NamedBorder borderWithStatus() { return withName(JBUI.Borders.empty(JBUI.CurrentTheme.Editor.Notification.borderInsets()), BORDER_WITH_STATUS); } diff --git a/platform/platform-api/src/com/intellij/ui/EnumComboBoxModel.java b/platform/platform-api/src/com/intellij/ui/EnumComboBoxModel.java index f69fa84e1a5b..e6e579a2c119 100644 --- a/platform/platform-api/src/com/intellij/ui/EnumComboBoxModel.java +++ b/platform/platform-api/src/com/intellij/ui/EnumComboBoxModel.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2013 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import org.jetbrains.annotations.NotNull; @@ -34,8 +20,7 @@ public class EnumComboBoxModel> extends AbstractListModel i mySelected = myList.get(0); } - @NotNull - protected EnumSet createEnumSet(@NotNull Class en) { + protected @NotNull EnumSet createEnumSet(@NotNull Class en) { return EnumSet.allOf(en); } diff --git a/platform/platform-api/src/com/intellij/ui/ExpandableItemsHandlerFactory.java b/platform/platform-api/src/com/intellij/ui/ExpandableItemsHandlerFactory.java index 4d1c787fe34c..eb7ff9080798 100644 --- a/platform/platform-api/src/com/intellij/ui/ExpandableItemsHandlerFactory.java +++ b/platform/platform-api/src/com/intellij/ui/ExpandableItemsHandlerFactory.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.diagnostic.LoadingState; @@ -19,8 +19,7 @@ public abstract class ExpandableItemsHandlerFactory { return (ExpandableItemsHandler)(handler == null ? NULL : handler); } - @Nullable - private static ExpandableItemsHandlerFactory getInstance() { + private static @Nullable ExpandableItemsHandlerFactory getInstance() { if (!LoadingState.COMPONENTS_REGISTERED.isOccurred() || !Registry.is("ide.windowSystem.showListItemsPopup", true)) { return null; } @@ -39,9 +38,8 @@ public abstract class ExpandableItemsHandlerFactory { return false; } - @NotNull @Override - public Collection getExpandedItems() { + public @NotNull Collection getExpandedItems() { return Collections.emptyList(); } }; diff --git a/platform/platform-api/src/com/intellij/ui/ExpandedItemRendererComponentWrapper.java b/platform/platform-api/src/com/intellij/ui/ExpandedItemRendererComponentWrapper.java index 435cb74f1c9d..ef13b8e299f1 100644 --- a/platform/platform-api/src/com/intellij/ui/ExpandedItemRendererComponentWrapper.java +++ b/platform/platform-api/src/com/intellij/ui/ExpandedItemRendererComponentWrapper.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.util.ui.AbstractLayoutManager; @@ -30,7 +16,7 @@ import java.awt.event.MouseEvent; public class ExpandedItemRendererComponentWrapper extends JComponent { JComponent owner; - private ExpandedItemRendererComponentWrapper(@NotNull final Component rendererComponent) { + private ExpandedItemRendererComponentWrapper(final @NotNull Component rendererComponent) { add(rendererComponent); setOpaque(false); setLayout(new AbstractLayoutManager() { @@ -53,16 +39,14 @@ public class ExpandedItemRendererComponentWrapper extends JComponent { }); } - @NotNull - public static ExpandedItemRendererComponentWrapper wrap(@NotNull Component rendererComponent) { + public static @NotNull ExpandedItemRendererComponentWrapper wrap(@NotNull Component rendererComponent) { if (rendererComponent instanceof Accessible) { return new MyComponent(rendererComponent, (Accessible)rendererComponent); } return new ExpandedItemRendererComponentWrapper(rendererComponent); } - @Nullable - public static Component unwrap(@NotNull Component rendererComponent) { + public static @Nullable Component unwrap(@NotNull Component rendererComponent) { if (rendererComponent instanceof ExpandedItemRendererComponentWrapper) { return ((ExpandedItemRendererComponentWrapper)rendererComponent).getDelegate(); } @@ -98,9 +82,8 @@ public class ExpandedItemRendererComponentWrapper extends JComponent { * needs to come from the default implementation to avoid infinite parent/child cycle. */ protected class AccessibleMyComponent extends AbstractAccessibleContextDelegate { - @NotNull @Override - protected AccessibleContext getDelegate() { + protected @NotNull AccessibleContext getDelegate() { return myAccessible.getAccessibleContext(); } @@ -153,8 +136,7 @@ public class ExpandedItemRendererComponentWrapper extends JComponent { return super.getToolTipLocation(event); } - @Nullable - private Component getDelegate() { + private @Nullable Component getDelegate() { return getComponentCount() == 1 ? getComponent(0) : null; } } diff --git a/platform/platform-api/src/com/intellij/ui/Grayer.java b/platform/platform-api/src/com/intellij/ui/Grayer.java index 7b0832166ae1..66800ab08423 100644 --- a/platform/platform-api/src/com/intellij/ui/Grayer.java +++ b/platform/platform-api/src/com/intellij/ui/Grayer.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.util.ui.UIUtil; @@ -80,9 +66,8 @@ public final class Grayer extends Graphics2DDelegate { } } - @NotNull @Override - public Graphics create() { + public @NotNull Graphics create() { return new Grayer((Graphics2D)super.create(), myBackground); } } diff --git a/platform/platform-api/src/com/intellij/ui/GuiUtils.java b/platform/platform-api/src/com/intellij/ui/GuiUtils.java index 456f0de67752..cc0ec9eca47b 100644 --- a/platform/platform-api/src/com/intellij/ui/GuiUtils.java +++ b/platform/platform-api/src/com/intellij/ui/GuiUtils.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.application.Application; @@ -253,8 +253,7 @@ public final class GuiUtils { * @param comp component * @return dimension with width enough to insert provided number of chars into component */ - @NotNull - public static Dimension getSizeByChars(int charCount, @NotNull JComponent comp) { + public static @NotNull Dimension getSizeByChars(int charCount, @NotNull JComponent comp) { Dimension size = comp.getPreferredSize(); FontMetrics fontMetrics = comp.getFontMetrics(comp.getFont()); size.width = fontMetrics.charWidth('a') * charCount; diff --git a/platform/platform-api/src/com/intellij/ui/HelpIdAwareLinkListener.java b/platform/platform-api/src/com/intellij/ui/HelpIdAwareLinkListener.java index 28578f967574..81d36f6d243c 100644 --- a/platform/platform-api/src/com/intellij/ui/HelpIdAwareLinkListener.java +++ b/platform/platform-api/src/com/intellij/ui/HelpIdAwareLinkListener.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.ide.BrowserUtil; @@ -17,11 +17,10 @@ import javax.swing.event.HyperlinkEvent; @ApiStatus.Experimental public final class HelpIdAwareLinkListener extends BrowserHyperlinkListener { - @NonNls private static final String HELP_LINK_MARKER = "helpInstance:"; - @NonNls private static final String URL_TEMPLATE = "https://www.jetbrains.com/help/%s?%s&utm_version=%s"; + private static final @NonNls String HELP_LINK_MARKER = "helpInstance:"; + private static final @NonNls String URL_TEMPLATE = "https://www.jetbrains.com/help/%s?%s&utm_version=%s"; - @NotNull - public static HelpIdAwareLinkListener getInstance() { + public static @NotNull HelpIdAwareLinkListener getInstance() { return ApplicationManager.getApplication().getService(HelpIdAwareLinkListener.class); } diff --git a/platform/platform-api/src/com/intellij/ui/HighlightableComponent.java b/platform/platform-api/src/com/intellij/ui/HighlightableComponent.java index 515a057e72a2..4fb5567f72e5 100644 --- a/platform/platform-api/src/com/intellij/ui/HighlightableComponent.java +++ b/platform/platform-api/src/com/intellij/ui/HighlightableComponent.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.ide.ui.AntialiasingType; @@ -26,8 +26,7 @@ import java.util.HashMap; import java.util.Map; public class HighlightableComponent extends JComponent implements Accessible { - @Nls - protected String myText = ""; + protected @Nls String myText = ""; protected Icon myIcon; protected int myIconTextGap; protected ArrayList myHighlightedRegions; @@ -360,8 +359,7 @@ public class HighlightableComponent extends JComponent implements Accessible { return isIconAtRight() ? getWidth() - myIcon.getIconWidth() : 0; } - @Nullable - public HighlightedRegion findRegionByX(int x) { + public @Nullable HighlightedRegion findRegionByX(int x) { FontMetrics defFontMetrics = getFontMetrics(getFont()); int width = getTextOffset(); @@ -385,8 +383,7 @@ public class HighlightableComponent extends JComponent implements Accessible { return null; } - @NotNull - public Map getHighlightedRegionsBoundsMap() { + public @NotNull Map getHighlightedRegionsBoundsMap() { HashMap map = new HashMap<>(); FontMetrics defFontMetrics = getFontMetrics(getFont()); diff --git a/platform/platform-api/src/com/intellij/ui/HighlightedText.java b/platform/platform-api/src/com/intellij/ui/HighlightedText.java index a8801b5f9a63..8f5d3bb6c617 100644 --- a/platform/platform-api/src/com/intellij/ui/HighlightedText.java +++ b/platform/platform-api/src/com/intellij/ui/HighlightedText.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.editor.markup.TextAttributes; @@ -40,9 +40,7 @@ public final class HighlightedText { myHighlightedRegions.equals(highlightedText.myHighlightedRegions); } - @NotNull - @Nls - public String getText() { + public @NotNull @Nls String getText() { return myBuffer.toString(); } diff --git a/platform/platform-api/src/com/intellij/ui/HtmlToSimpleColoredComponentConverter.java b/platform/platform-api/src/com/intellij/ui/HtmlToSimpleColoredComponentConverter.java index f54c0d624a47..69352cf95552 100644 --- a/platform/platform-api/src/com/intellij/ui/HtmlToSimpleColoredComponentConverter.java +++ b/platform/platform-api/src/com/intellij/ui/HtmlToSimpleColoredComponentConverter.java @@ -129,8 +129,8 @@ public class HtmlToSimpleColoredComponentConverter { * Describes colored fragment (part of {@link SimpleColoredComponent} component) */ public static class Fragment { - @NotNull @Nls private final String myText; - @NotNull private final SimpleTextAttributes myAttributes; + private final @NotNull @Nls String myText; + private final @NotNull SimpleTextAttributes myAttributes; public Fragment(@NotNull @Nls String text, @NotNull SimpleTextAttributes attributes) { myText = text; diff --git a/platform/platform-api/src/com/intellij/ui/HyperlinkLabel.java b/platform/platform-api/src/com/intellij/ui/HyperlinkLabel.java index f354b6c15233..f0ac5afc60f7 100644 --- a/platform/platform-api/src/com/intellij/ui/HyperlinkLabel.java +++ b/platform/platform-api/src/com/intellij/ui/HyperlinkLabel.java @@ -211,7 +211,7 @@ public class HyperlinkLabel extends HighlightableComponent { updateOnTextChange(); } - public void setHyperlinkTarget(@NonNls @Nullable final String url) { + public void setHyperlinkTarget(final @NonNls @Nullable String url) { if (myHyperlinkListener != null) { removeHyperlinkListener(myHyperlinkListener); } @@ -231,8 +231,7 @@ public class HyperlinkLabel extends HighlightableComponent { myListeners.remove(listener); } - @NotNull - public @LinkLabel String getText() { + public @NotNull @LinkLabel String getText() { return myHighlightedText.getText(); } diff --git a/platform/platform-api/src/com/intellij/ui/IdeBorderFactory.java b/platform/platform-api/src/com/intellij/ui/IdeBorderFactory.java index 9c04d5062188..323d143ced30 100644 --- a/platform/platform-api/src/com/intellij/ui/IdeBorderFactory.java +++ b/platform/platform-api/src/com/intellij/ui/IdeBorderFactory.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.util.NlsContexts; @@ -42,18 +42,15 @@ public final class IdeBorderFactory { return new SideBorder(color, borders); } - @NotNull - public static RoundedLineBorder createRoundedBorder() { + public static @NotNull RoundedLineBorder createRoundedBorder() { return createRoundedBorder(BORDER_ROUNDNESS); } - @NotNull - public static RoundedLineBorder createRoundedBorder(int arcSize) { + public static @NotNull RoundedLineBorder createRoundedBorder(int arcSize) { return new RoundedLineBorder(getBorderColor(), arcSize); } - @NotNull - public static RoundedLineBorder createRoundedBorder(int arcSize, final int thickness) { + public static @NotNull RoundedLineBorder createRoundedBorder(int arcSize, final int thickness) { return new RoundedLineBorder(getBorderColor(), arcSize, thickness); } diff --git a/platform/platform-api/src/com/intellij/ui/InplaceAddEditRemovePanel.java b/platform/platform-api/src/com/intellij/ui/InplaceAddEditRemovePanel.java index 2bfb4058dbf4..ec3c314fbf60 100644 --- a/platform/platform-api/src/com/intellij/ui/InplaceAddEditRemovePanel.java +++ b/platform/platform-api/src/com/intellij/ui/InplaceAddEditRemovePanel.java @@ -39,9 +39,8 @@ public abstract class InplaceAddEditRemovePanel extends AddEditRemovePanel } } - @Nullable @Override - protected T editItem(T o) { + protected @Nullable T editItem(T o) { return o; } } diff --git a/platform/platform-api/src/com/intellij/ui/InplaceButton.java b/platform/platform-api/src/com/intellij/ui/InplaceButton.java index f57e634dd49d..3b385432c4e5 100644 --- a/platform/platform-api/src/com/intellij/ui/InplaceButton.java +++ b/platform/platform-api/src/com/intellij/ui/InplaceButton.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.ui.popup.IconButton; @@ -160,9 +160,8 @@ public class InplaceButton extends JComponent implements ActiveComponent, Access return myIcon; } - @NotNull @Override - public JComponent getComponent() { + public @NotNull JComponent getComponent() { return this; } diff --git a/platform/platform-api/src/com/intellij/ui/JBCardLayout.java b/platform/platform-api/src/com/intellij/ui/JBCardLayout.java index d7d558420b6a..309b60e7b5ec 100644 --- a/platform/platform-api/src/com/intellij/ui/JBCardLayout.java +++ b/platform/platform-api/src/com/intellij/ui/JBCardLayout.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.application.Application; @@ -64,11 +64,11 @@ public class JBCardLayout extends CardLayout { } } - public void swipe(@NotNull final Container parent, @NotNull final String name, @NotNull SwipeDirection direction) { + public void swipe(final @NotNull Container parent, final @NotNull String name, @NotNull SwipeDirection direction) { swipe(parent, name, direction, null); } - public void swipe(@NotNull final Container parent, @NotNull final String name, @NotNull SwipeDirection direction, + public void swipe(final @NotNull Container parent, final @NotNull String name, @NotNull SwipeDirection direction, final @Nullable Runnable onDone) { stopSwipeIfNeeded(); mySwipeFrom = findVisible(parent); @@ -145,8 +145,7 @@ public class JBCardLayout extends CardLayout { } } - @Nullable - private static Component findVisible(Container parent) { + private static @Nullable Component findVisible(Container parent) { for (int i = 0; i < parent.getComponentCount(); i++) { Component component = parent.getComponent(i); if (component.isVisible()) return component; diff --git a/platform/platform-api/src/com/intellij/ui/JBDefaultTreeCellRenderer.java b/platform/platform-api/src/com/intellij/ui/JBDefaultTreeCellRenderer.java index dab2ac05d835..2e44e6f22423 100644 --- a/platform/platform-api/src/com/intellij/ui/JBDefaultTreeCellRenderer.java +++ b/platform/platform-api/src/com/intellij/ui/JBDefaultTreeCellRenderer.java @@ -22,7 +22,7 @@ public class JBDefaultTreeCellRenderer extends DefaultTreeCellRenderer { this(true); } - public JBDefaultTreeCellRenderer(@NotNull final JTree tree) { + public JBDefaultTreeCellRenderer(final @NotNull JTree tree) { this(WideSelectionTreeUI.isWideSelection(tree)); } @@ -39,7 +39,7 @@ public class JBDefaultTreeCellRenderer extends DefaultTreeCellRenderer { return myWideSelection ? null : super.getBorderSelectionColor(); } - protected Color getSelectionForeground(@NotNull final JTree tree) { + protected Color getSelectionForeground(final @NotNull JTree tree) { return myWideSelection && !tree.hasFocus() ? UIUtil.getTreeForeground() : UIUtil.getTreeSelectionForeground(); } } diff --git a/platform/platform-api/src/com/intellij/ui/JBIntSpinner.java b/platform/platform-api/src/com/intellij/ui/JBIntSpinner.java index 9da73906cd1b..9e2954ebe83a 100644 --- a/platform/platform-api/src/com/intellij/ui/JBIntSpinner.java +++ b/platform/platform-api/src/com/intellij/ui/JBIntSpinner.java @@ -1,4 +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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.ide.ui.UINumericRange; @@ -43,8 +43,7 @@ public class JBIntSpinner extends JSpinner { super.setEditor(editor); } - @NotNull - private JTextField getTextField() { + private @NotNull JTextField getTextField() { return ((NumberEditor)getEditor()).getTextField(); } diff --git a/platform/platform-api/src/com/intellij/ui/JBListWithHintProvider.java b/platform/platform-api/src/com/intellij/ui/JBListWithHintProvider.java index 2219fdfad4b6..c2ecc70a4220 100644 --- a/platform/platform-api/src/com/intellij/ui/JBListWithHintProvider.java +++ b/platform/platform-api/src/com/intellij/ui/JBListWithHintProvider.java @@ -34,6 +34,5 @@ public abstract class JBListWithHintProvider extends JBList { super(items); } - @Nullable - protected abstract PsiElement getPsiElementForHint(final Object selectedValue); + protected abstract @Nullable PsiElement getPsiElementForHint(final Object selectedValue); } diff --git a/platform/platform-api/src/com/intellij/ui/JBSplitter.java b/platform/platform-api/src/com/intellij/ui/JBSplitter.java index 4de2a8c0d24a..4e54b5b3e5b5 100644 --- a/platform/platform-api/src/com/intellij/ui/JBSplitter.java +++ b/platform/platform-api/src/com/intellij/ui/JBSplitter.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.ide.util.PropertiesComponent; @@ -32,8 +18,7 @@ public class JBSplitter extends Splitter { /** * Used as a key to save and load proportion */ - @Nullable - private String mySplitterProportionKey = null; + private @Nullable String mySplitterProportionKey = null; private final float myDefaultProportion; public JBSplitter() { @@ -89,8 +74,7 @@ public class JBSplitter extends Splitter { * * @return non empty unique String or {@code null} if splitter does not require proportion saving */ - @Nullable - public final String getSplitterProportionKey() { + public final @Nullable String getSplitterProportionKey() { return mySplitterProportionKey; } diff --git a/platform/platform-api/src/com/intellij/ui/ListCellRendererWrapper.java b/platform/platform-api/src/com/intellij/ui/ListCellRendererWrapper.java index 0756faaf0fe5..8df79bc5cb62 100644 --- a/platform/platform-api/src/com/intellij/ui/ListCellRendererWrapper.java +++ b/platform/platform-api/src/com/intellij/ui/ListCellRendererWrapper.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.util.NlsContexts; @@ -73,8 +73,7 @@ public abstract class ListCellRendererWrapper implements ListCellRenderer * @deprecated Use plain {@link JSeparator} instead */ @Deprecated(forRemoval = true) - @NotNull - public static Component createSeparator(@Nullable @NlsContexts.Separator String text) { + public static @NotNull Component createSeparator(@Nullable @NlsContexts.Separator String text) { TitledSeparator separator = new TitledSeparator(text); separator.setBorder(JBUI.Borders.emptyLeft(2)); separator.setOpaque(false); diff --git a/platform/platform-api/src/com/intellij/ui/ListFocusTraversalPolicy.java b/platform/platform-api/src/com/intellij/ui/ListFocusTraversalPolicy.java index 16a2b2757065..d9575320d3c4 100644 --- a/platform/platform-api/src/com/intellij/ui/ListFocusTraversalPolicy.java +++ b/platform/platform-api/src/com/intellij/ui/ListFocusTraversalPolicy.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.util.containers.ObjectIntHashMap; @@ -55,8 +55,7 @@ public final class ListFocusTraversalPolicy extends LayoutFocusTraversalPolicy { return getPreviousComponent((i==-1 ?0:i) - 1); } - @Nullable - private Component getNextComponent(int startIndex) { + private @Nullable Component getNextComponent(int startIndex) { for (int index = startIndex; index < myComponents.length; index++) { Component result = myComponents[index]; if (accept(result)) { @@ -72,8 +71,7 @@ public final class ListFocusTraversalPolicy extends LayoutFocusTraversalPolicy { return null; } - @Nullable - private Component getPreviousComponent(int startIndex) { + private @Nullable Component getPreviousComponent(int startIndex) { for (int index = startIndex; index >= 0; index--) { Component result = myComponents[index]; if (accept(result)) { diff --git a/platform/platform-api/src/com/intellij/ui/ListUtil.java b/platform/platform-api/src/com/intellij/ui/ListUtil.java index 4c3098c481a7..ab29323bc6d1 100644 --- a/platform/platform-api/src/com/intellij/ui/ListUtil.java +++ b/platform/platform-api/src/com/intellij/ui/ListUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.util.Condition; @@ -62,18 +62,15 @@ public final class ListUtil { protected abstract void update(); } - @NotNull - public static List removeSelectedItems(@NotNull JList list) { + public static @NotNull List removeSelectedItems(@NotNull JList list) { return removeSelectedItems(list, null); } - @NotNull - public static List removeIndices(@NotNull JList list, int[] indices) { + public static @NotNull List removeIndices(@NotNull JList list, int[] indices) { return removeIndices(list, indices, null); } - @NotNull - public static List removeSelectedItems(@NotNull JList list, @Nullable Condition condition) { + public static @NotNull List removeSelectedItems(@NotNull JList list, @Nullable Condition condition) { int[] indices = list.getSelectedIndices(); return removeIndices(list, indices, condition); } @@ -204,8 +201,7 @@ public final class ListUtil { return list.isSelectedIndex(row); } - @Nullable - public static Component getDeepestRendererChildComponentAt(@NotNull JList list, @NotNull Point point) { + public static @Nullable Component getDeepestRendererChildComponentAt(@NotNull JList list, @NotNull Point point) { int idx = list.locationToIndex(point); if (idx < 0) return null; @@ -320,8 +316,7 @@ public final class ListUtil { /** * @noinspection unchecked */ - @NotNull - private static > ListModelExtension getExtension(@NotNull ModelType model) { + private static @NotNull > ListModelExtension getExtension(@NotNull ModelType model) { if (model instanceof DefaultListModel) return DEFAULT_MODEL; if (model instanceof SortedListModel) return SORTED_MODEL; if (model instanceof FilteringListModel) return FILTERED_MODEL; diff --git a/platform/platform-api/src/com/intellij/ui/LoadingNode.java b/platform/platform-api/src/com/intellij/ui/LoadingNode.java index 1b187b7d3056..2e767266b8f8 100644 --- a/platform/platform-api/src/com/intellij/ui/LoadingNode.java +++ b/platform/platform-api/src/com/intellij/ui/LoadingNode.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2013 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.ide.IdeBundle; @@ -26,8 +12,7 @@ public class LoadingNode extends DefaultMutableTreeNode { this(getText()); } - @NotNull - public static @Nls String getText() { + public static @NotNull @Nls String getText() { return IdeBundle.message("treenode.loading"); } diff --git a/platform/platform-api/src/com/intellij/ui/MouseDragHelper.java b/platform/platform-api/src/com/intellij/ui/MouseDragHelper.java index b618644a7d70..1190b0ee1011 100644 --- a/platform/platform-api/src/com/intellij/ui/MouseDragHelper.java +++ b/platform/platform-api/src/com/intellij/ui/MouseDragHelper.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.ide.ui.UISettings; @@ -22,11 +22,10 @@ import java.awt.event.*; public abstract class MouseDragHelper extends MouseAdapter implements MouseMotionListener, KeyEventDispatcher, Weighted { public static final int DRAG_START_DEADZONE = 7; - @NonNls private static final String DRAGGABLE_MARKER = "DRAGGABLE_MARKER"; + private static final @NonNls String DRAGGABLE_MARKER = "DRAGGABLE_MARKER"; private static int ourLastDragHash = 0; - @NotNull - protected final T myDragComponent; + protected final @NotNull T myDragComponent; private Point myPressPointScreen; protected Point myPressedOnScreenPoint; @@ -34,8 +33,7 @@ public abstract class MouseDragHelper extends MouseAdapter private boolean myDraggingNow; private boolean myDragJustStarted; private IdeGlassPane myGlassPane; - @NotNull - private final Disposable myParentDisposable; + private final @NotNull Disposable myParentDisposable; private boolean myDetachPostponed; private boolean myDetachingMode; private boolean myCancelled; @@ -279,7 +277,7 @@ public abstract class MouseDragHelper extends MouseAdapter } @Override - public void mouseMoved(@NotNull final MouseEvent e) { + public void mouseMoved(final @NotNull MouseEvent e) { } @Override diff --git a/platform/platform-api/src/com/intellij/ui/OptionGroup.java b/platform/platform-api/src/com/intellij/ui/OptionGroup.java index 3a50b4d7ab9f..87dd143429a0 100644 --- a/platform/platform-api/src/com/intellij/ui/OptionGroup.java +++ b/platform/platform-api/src/com/intellij/ui/OptionGroup.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.util.NlsContexts; @@ -140,8 +140,7 @@ public class OptionGroup implements PanelWithAnchor { return components.toArray(new JComponent[0]); } - @Nullable - public JComponent findAnchor() { + public @Nullable JComponent findAnchor() { double maxWidth = -1; JComponent anchor = null; for (Object o : myOptions) { diff --git a/platform/platform-api/src/com/intellij/ui/OptionalChooserComponent.java b/platform/platform-api/src/com/intellij/ui/OptionalChooserComponent.java index c9960c3a9b3c..d9b1aed267ee 100644 --- a/platform/platform-api/src/com/intellij/ui/OptionalChooserComponent.java +++ b/platform/platform-api/src/com/intellij/ui/OptionalChooserComponent.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.util.Pair; @@ -35,7 +21,7 @@ public abstract class OptionalChooserComponent implements CheckBoxListListene private List> myInitialList; private ArrayList> myWorkingList; - public OptionalChooserComponent(@NotNull final List> list) { + public OptionalChooserComponent(final @NotNull List> list) { setInitialList(list); myWorkingList = new ArrayList<>(myInitialList); @@ -43,9 +29,8 @@ public abstract class OptionalChooserComponent implements CheckBoxListListene reset(); } - @NotNull @Override - public StatusText getEmptyText() { + public @NotNull StatusText getEmptyText() { return myList.getEmptyText(); } @@ -108,7 +93,7 @@ public abstract class OptionalChooserComponent implements CheckBoxListListene return !myWorkingList.equals(myInitialList); } - public void setInitialList(@NotNull final List> list) { + public void setInitialList(final @NotNull List> list) { myInitialList = list; } diff --git a/platform/platform-api/src/com/intellij/ui/PaintingParent.java b/platform/platform-api/src/com/intellij/ui/PaintingParent.java index b8f1b942cf0e..418104504fd2 100644 --- a/platform/platform-api/src/com/intellij/ui/PaintingParent.java +++ b/platform/platform-api/src/com/intellij/ui/PaintingParent.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2013 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import org.jetbrains.annotations.NotNull; @@ -40,8 +26,7 @@ public interface PaintingParent { * @param c a component * @return a rectangle, if null -- the whole component will be repainted */ - @Nullable - default Rectangle getChildRec(@NotNull Component c) { + default @Nullable Rectangle getChildRec(@NotNull Component c) { return null; } diff --git a/platform/platform-api/src/com/intellij/ui/PanelWithButtons.java b/platform/platform-api/src/com/intellij/ui/PanelWithButtons.java index c3f2430edf98..bfc3d11ad145 100644 --- a/platform/platform-api/src/com/intellij/ui/PanelWithButtons.java +++ b/platform/platform-api/src/com/intellij/ui/PanelWithButtons.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.util.NlsContexts; @@ -51,8 +37,7 @@ public abstract class PanelWithButtons extends JPanel { } - @Nullable - protected abstract @NlsContexts.Label String getLabelText(); + protected abstract @Nullable @NlsContexts.Label String getLabelText(); protected abstract JButton[] createButtons(); diff --git a/platform/platform-api/src/com/intellij/ui/PathsChooserComponent.java b/platform/platform-api/src/com/intellij/ui/PathsChooserComponent.java index c43b503a97ea..6635adf430b8 100644 --- a/platform/platform-api/src/com/intellij/ui/PathsChooserComponent.java +++ b/platform/platform-api/src/com/intellij/ui/PathsChooserComponent.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.fileChooser.FileChooser; @@ -28,15 +28,15 @@ public class PathsChooserComponent implements ComponentWithEmptyText { private List<@NlsSafe String> myWorkingCollection; private final List<@NlsSafe String> myInitialCollection; - @Nullable private final Project myProject; + private final @Nullable Project myProject; - public PathsChooserComponent(@NotNull final List collection, @NotNull final PathProcessor processor) { + public PathsChooserComponent(final @NotNull List collection, final @NotNull PathProcessor processor) { this(collection, processor, null); } - public PathsChooserComponent(@NotNull final List collection, - @NotNull final PathProcessor processor, - @Nullable final Project project) { + public PathsChooserComponent(final @NotNull List collection, + final @NotNull PathProcessor processor, + final @Nullable Project project) { myList = new JBList(); myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myInitialCollection = collection; @@ -80,9 +80,8 @@ public class PathsChooserComponent implements ComponentWithEmptyText { reset(); } - @NotNull @Override - public StatusText getEmptyText() { + public @NotNull StatusText getEmptyText() { return myList.getEmptyText(); } diff --git a/platform/platform-api/src/com/intellij/ui/ReorderableListController.java b/platform/platform-api/src/com/intellij/ui/ReorderableListController.java index 4e3c205c154f..c9141a1b3619 100644 --- a/platform/platform-api/src/com/intellij/ui/ReorderableListController.java +++ b/platform/platform-api/src/com/intellij/ui/ReorderableListController.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.icons.AllIcons; @@ -49,12 +49,12 @@ public abstract class ReorderableListController { public void addMoveUpAction() { addAction(new AnAction(UIBundle.messagePointer("move.up.action.name"), Presentation.NULL_STRING, IconUtil.getMoveUpIcon()) { @Override - public void actionPerformed(@NotNull final AnActionEvent e) { + public void actionPerformed(final @NotNull AnActionEvent e) { ListUtil.moveSelectedItemsUp(myList); } @Override - public void update(@NotNull final AnActionEvent e) { + public void update(final @NotNull AnActionEvent e) { e.getPresentation().setEnabled(ListUtil.canMoveSelectedItemsUp(myList)); } @@ -68,12 +68,12 @@ public abstract class ReorderableListController { public void addMoveDownAction() { addAction(new AnAction(UIBundle.messagePointer("move.down.action.name"), Presentation.NULL_STRING, AllIcons.Actions.MoveDown) { @Override - public void actionPerformed(@NotNull final AnActionEvent e) { + public void actionPerformed(final @NotNull AnActionEvent e) { ListUtil.moveSelectedItemsDown(myList); } @Override - public void update(@NotNull final AnActionEvent e) { + public void update(final @NotNull AnActionEvent e) { e.getPresentation().setEnabled(ListUtil.canMoveSelectedItemsDown(myList)); } @@ -109,7 +109,7 @@ public abstract class ReorderableListController { }; } - protected static abstract class ActionDescription { + protected abstract static class ActionDescription { public abstract AnAction createAction(JComponent component); } @@ -117,7 +117,7 @@ public abstract class ReorderableListController { void afterActionPerformed(T change); } - public static abstract class CustomActionDescription extends ActionDescription { + public abstract static class CustomActionDescription extends ActionDescription { private final ArrayList> myPostHandlers = new ArrayList<>(1); private boolean myShowText = false; @@ -160,14 +160,14 @@ public abstract class ReorderableListController { } @Override - public void actionPerformed(@NotNull final AnActionEvent e) { + public void actionPerformed(final @NotNull AnActionEvent e) { final V change = myBehaviour.performAction(e); if (change == null) return; myCustomActionDescription.runPostHandlers(change); } @Override - public void update(@NotNull final AnActionEvent e) { + public void update(final @NotNull AnActionEvent e) { myBehaviour.updateAction(e); } @@ -210,7 +210,7 @@ public abstract class ReorderableListController { public BaseAction createAction(final JComponent component) { final ActionBehaviour> behaviour = new ActionBehaviour<>() { @Override - public List performAction(@NotNull final AnActionEvent e) { + public List performAction(final @NotNull AnActionEvent e) { if (myConfirmation != null && !myConfirmation.value((List)Arrays.asList(myList.getSelectedValues()))) { return Collections.emptyList(); } @@ -218,7 +218,7 @@ public abstract class ReorderableListController { } @Override - public void updateAction(@NotNull final AnActionEvent e) { + public void updateAction(final @NotNull AnActionEvent e) { e.getPresentation().setEnabled(ListUtil.canRemoveSelectedItems(myList, myEnableCondition)); } }; @@ -266,12 +266,12 @@ public abstract class ReorderableListController { public BaseAction createAction(final JComponent component) { final ActionBehaviour behaviour = new ActionBehaviour<>() { @Override - public V performAction(@NotNull final AnActionEvent e) { + public V performAction(final @NotNull AnActionEvent e) { return addInternal(myAddHandler.create()); } @Override - public void updateAction(@NotNull final AnActionEvent e) {} + public void updateAction(final @NotNull AnActionEvent e) {} }; final BaseAction action = createAction(behaviour); if (myCreateShortcut) { @@ -280,8 +280,7 @@ public abstract class ReorderableListController { return action; } - @Nullable - protected abstract V addInternal(final V v); + protected abstract @Nullable V addInternal(final V v); @Override public Icon getActionIcon() { diff --git a/platform/platform-api/src/com/intellij/ui/RowsDnDSupport.java b/platform/platform-api/src/com/intellij/ui/RowsDnDSupport.java index 721d65a08921..3bbede7b10e1 100644 --- a/platform/platform-api/src/com/intellij/ui/RowsDnDSupport.java +++ b/platform/platform-api/src/com/intellij/ui/RowsDnDSupport.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.ide.dnd.*; @@ -18,25 +18,25 @@ public final class RowsDnDSupport { private RowsDnDSupport() { } - public static void install(@NotNull final JTable table, @NotNull final EditableModel model) { + public static void install(final @NotNull JTable table, final @NotNull EditableModel model) { if (GraphicsEnvironment.isHeadless()) return; table.setDragEnabled(true); installImpl(table, model); } - public static void install(@NotNull final JList list, @NotNull final EditableModel model) { + public static void install(final @NotNull JList list, final @NotNull EditableModel model) { if (GraphicsEnvironment.isHeadless()) return; list.setDragEnabled(true); installImpl(list, model); } - public static void install(@NotNull final JTree tree, @NotNull final EditableModel model) { + public static void install(final @NotNull JTree tree, final @NotNull EditableModel model) { if (GraphicsEnvironment.isHeadless()) return; tree.setDragEnabled(true); installImpl(tree, model); } - private static void installImpl(@NotNull final JComponent component, @NotNull final EditableModel model) { + private static void installImpl(final @NotNull JComponent component, final @NotNull EditableModel model) { component.setTransferHandler(new TransferHandler(null)); DnDSupport.createBuilder(component) .setBeanProvider(info -> { diff --git a/platform/platform-api/src/com/intellij/ui/ScrollingUtil.java b/platform/platform-api/src/com/intellij/ui/ScrollingUtil.java index 8d2d3952e297..31fc66cfe8d3 100644 --- a/platform/platform-api/src/com/intellij/ui/ScrollingUtil.java +++ b/platform/platform-api/src/com/intellij/ui/ScrollingUtil.java @@ -30,22 +30,14 @@ import java.awt.event.KeyEvent; */ public final class ScrollingUtil { private static final Logger LOG = Logger.getInstance(ScrollingUtil.class); - @NonNls - private static final String SCROLL_UP_ACTION_ID = "scrollUp"; - @NonNls - private static final String SCROLL_DOWN_ACTION_ID = "scrollDown"; - @NonNls - private static final String SELECT_PREVIOUS_ROW_ACTION_ID = "selectPreviousRow"; - @NonNls - private static final String SELECT_NEXT_ROW_ACTION_ID = "selectNextRow"; - @NonNls - private static final String SELECT_LAST_ROW_ACTION_ID = "selectLastRow"; - @NonNls - private static final String SELECT_FIRST_ROW_ACTION_ID = "selectFirstRow"; - @NonNls - private static final String MOVE_HOME_ID = "MOVE_HOME"; - @NonNls - private static final String MOVE_END_ID = "MOVE_END"; + private static final @NonNls String SCROLL_UP_ACTION_ID = "scrollUp"; + private static final @NonNls String SCROLL_DOWN_ACTION_ID = "scrollDown"; + private static final @NonNls String SELECT_PREVIOUS_ROW_ACTION_ID = "selectPreviousRow"; + private static final @NonNls String SELECT_NEXT_ROW_ACTION_ID = "selectNextRow"; + private static final @NonNls String SELECT_LAST_ROW_ACTION_ID = "selectLastRow"; + private static final @NonNls String SELECT_FIRST_ROW_ACTION_ID = "selectFirstRow"; + private static final @NonNls String MOVE_HOME_ID = "MOVE_HOME"; + private static final @NonNls String MOVE_END_ID = "MOVE_END"; public static final int ROW_PADDING = 2; @@ -349,7 +341,7 @@ public final class ScrollingUtil { } - public static abstract class ListScrollAction extends MyScrollingAction { + public abstract static class ListScrollAction extends MyScrollingAction { protected ListScrollAction(@NotNull ShortcutSet shortcutSet, @NotNull JComponent component) { super(component); registerCustomShortcutSet(shortcutSet, component); @@ -374,8 +366,7 @@ public final class ScrollingUtil { } } - @NotNull - private static Rectangle getCellBounds(@NotNull JTable table, int top, int bottom) { + private static @NotNull Rectangle getCellBounds(@NotNull JTable table, int top, int bottom) { return table.getCellRect(top, 0, true).union(table.getCellRect(bottom,0,true)); } @@ -403,8 +394,7 @@ public final class ScrollingUtil { return 0 < table.getRowCount() ? 0 : -1; } - @NotNull - private static Point getLeadingPoint(@NotNull JTable table, @NotNull Rectangle visibleRect) { + private static @NotNull Point getLeadingPoint(@NotNull JTable table, @NotNull Rectangle visibleRect) { if (table.getComponentOrientation().isLeftToRight()) { return new Point(visibleRect.x, visibleRect.y); } @@ -676,7 +666,7 @@ public final class ScrollingUtil { } private static class ListMoveUpAction extends ListScrollAction { - private @NotNull final JList myList; + private final @NotNull JList myList; private final boolean myCycleScrolling; private ListMoveUpAction(@Nullable JComponent focusParent, @NotNull JList list, boolean cycleScrolling) { @@ -695,7 +685,7 @@ public final class ScrollingUtil { } private static class ListMoveEndAction extends ListScrollAction { - private @NotNull final JList myList; + private final @NotNull JList myList; private ListMoveEndAction(@Nullable JComponent focusParent, @NotNull JList list) { super(CommonShortcuts.getMoveEnd(), focusParent == null ? list : focusParent); @@ -709,7 +699,7 @@ public final class ScrollingUtil { } private static class ListMoveHomeAction extends ListScrollAction { - private @NotNull final JList myList; + private final @NotNull JList myList; private ListMoveHomeAction(@Nullable JComponent focusParent, @NotNull JList list) { super(CommonShortcuts.getMoveHome(), focusParent == null ? list : focusParent); @@ -723,7 +713,7 @@ public final class ScrollingUtil { } private static class ListMovePageDownAction extends ListScrollAction { - private @NotNull final JList myList; + private final @NotNull JList myList; private ListMovePageDownAction(@Nullable JComponent focusParent, @NotNull JList list) { super(CommonShortcuts.getMovePageDown(), focusParent == null ? list : focusParent); @@ -737,7 +727,7 @@ public final class ScrollingUtil { } private static class ListMovePageUpAction extends ListScrollAction { - private @NotNull final JList myList; + private final @NotNull JList myList; private ListMovePageUpAction(@Nullable JComponent focusParent, @NotNull JList list) { super(CommonShortcuts.getMovePageUp(), focusParent == null ? list : focusParent); @@ -751,7 +741,7 @@ public final class ScrollingUtil { } private static class ListMoveDownAction extends ListScrollAction { - private @NotNull final JList myList; + private final @NotNull JList myList; private final boolean myCycleScrolling; private ListMoveDownAction(@Nullable JComponent focusParent, @NotNull JList list, boolean cycleScrolling) { @@ -770,7 +760,7 @@ public final class ScrollingUtil { } private static class TableMoveHomeAction extends MyScrollingAction { - private @NotNull final JTable myTable; + private final @NotNull JTable myTable; private TableMoveHomeAction(@NotNull JTable table) { super(table); @@ -784,7 +774,7 @@ public final class ScrollingUtil { } private static class TableMoveEndAction extends MyScrollingAction { - private @NotNull final JTable myTable; + private final @NotNull JTable myTable; private TableMoveEndAction(@NotNull JTable table) { super(table); @@ -798,7 +788,7 @@ public final class ScrollingUtil { } private static class TableMoveDownAction extends MyScrollingAction { - private @NotNull final JTable myTable; + private final @NotNull JTable myTable; private final boolean myCycleScrolling; private final JComponent myTarget; @@ -821,7 +811,7 @@ public final class ScrollingUtil { } private static class TableMoveUpAction extends MyScrollingAction { - private @NotNull final JTable myTable; + private final @NotNull JTable myTable; private final boolean myCycleScrolling; private final JComponent myTarget; @@ -844,7 +834,7 @@ public final class ScrollingUtil { } private static class TableMovePageUpAction extends MyScrollingAction { - private @NotNull final JTable myTable; + private final @NotNull JTable myTable; private TableMovePageUpAction(@NotNull JTable table) { super(table); @@ -858,7 +848,7 @@ public final class ScrollingUtil { } private static class TableMovePageDownAction extends MyScrollingAction { - private @NotNull final JTable myTable; + private final @NotNull JTable myTable; private TableMovePageDownAction(@NotNull JTable table) { super(table); diff --git a/platform/platform-api/src/com/intellij/ui/SearchTextField.java b/platform/platform-api/src/com/intellij/ui/SearchTextField.java index 7e06239d0ec5..cd1d7835a78b 100644 --- a/platform/platform-api/src/com/intellij/ui/SearchTextField.java +++ b/platform/platform-api/src/com/intellij/ui/SearchTextField.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.ide.util.PropertiesComponent; @@ -44,8 +44,7 @@ public class SearchTextField extends JPanel { private final MyModel myModel; private final TextFieldWithProcessing myTextField; - @Nullable - private JBPopup myPopup; + private @Nullable JBPopup myPopup; private String myHistoryPropertyName; private final boolean historyPopupEnabled; diff --git a/platform/platform-api/src/com/intellij/ui/SeparatorWithText.java b/platform/platform-api/src/com/intellij/ui/SeparatorWithText.java index 2e83c51971e8..2db6dca07487 100644 --- a/platform/platform-api/src/com/intellij/ui/SeparatorWithText.java +++ b/platform/platform-api/src/com/intellij/ui/SeparatorWithText.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.ide.ui.UISettings; @@ -67,8 +67,7 @@ public class SeparatorWithText extends JComponent implements Accessible { return size; } - @NotNull - protected Dimension getLabelSize(Insets labelInsets) { + protected @NotNull Dimension getLabelSize(Insets labelInsets) { String caption = getCaption(); if (caption == null) { return new Dimension(Math.max(myPrefWidth, 0), 1); diff --git a/platform/platform-api/src/com/intellij/ui/SimpleColoredComponent.java b/platform/platform-api/src/com/intellij/ui/SimpleColoredComponent.java index 163e26ca8cf7..eba7aeb5fdc1 100644 --- a/platform/platform-api/src/com/intellij/ui/SimpleColoredComponent.java +++ b/platform/platform-api/src/com/intellij/ui/SimpleColoredComponent.java @@ -120,13 +120,11 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co putClientProperty(RenderingHints.KEY_FRACTIONALMETRICS, value); } - @NotNull - public ColoredIterator iterator() { + public @NotNull ColoredIterator iterator() { return new MyIterator(); } - @NotNull - public ColoredIterator iterator(int fromIndex) { + public @NotNull ColoredIterator iterator(int fromIndex) { MyIterator iterator = new MyIterator(); iterator.myIndex = fromIndex - 1; return iterator; @@ -140,8 +138,7 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co myIconOnTheRight = iconOnTheRight; } - @NotNull - public final SimpleColoredComponent append(@NotNull @Nls String fragment) { + public final @NotNull SimpleColoredComponent append(@NotNull @Nls String fragment) { append(fragment, SimpleTextAttributes.REGULAR_ATTRIBUTES); return this; } @@ -155,12 +152,11 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co * @see DefaultFragmentTextClipper * @see SwingUtilities2#clipStringIfNecessary */ - @NotNull - public final SimpleColoredComponent appendWithClipping(@NotNull @Nls String fragment, @Nullable FragmentTextClipper clipper) { + public final @NotNull SimpleColoredComponent appendWithClipping(@NotNull @Nls String fragment, @Nullable FragmentTextClipper clipper) { return appendWithClipping(fragment, SimpleTextAttributes.REGULAR_ATTRIBUTES, clipper); } - public final SimpleColoredComponent appendWithClipping(@NotNull @Nls String fragment, @NotNull final SimpleTextAttributes attributes, @Nullable FragmentTextClipper clipper) { + public final SimpleColoredComponent appendWithClipping(@NotNull @Nls String fragment, final @NotNull SimpleTextAttributes attributes, @Nullable FragmentTextClipper clipper) { _append(fragment, attributes, clipper, myMainTextLastIndex < 0); revalidateAndRepaint(); return this; @@ -174,7 +170,7 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co * @param attributes text attributes */ @Override - public final void append(@NotNull @Nls String fragment, @NotNull final SimpleTextAttributes attributes) { + public final void append(@NotNull @Nls String fragment, final @NotNull SimpleTextAttributes attributes) { append(fragment, attributes, myMainTextLastIndex < 0); } @@ -188,7 +184,7 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co * @param align alignment between current offset and padding */ public final void append(@NotNull @Nls String fragment, - @NotNull final SimpleTextAttributes attributes, + final @NotNull SimpleTextAttributes attributes, int padding, @JdkConstants.HorizontalAlignment int align) { append(fragment, attributes, myMainTextLastIndex < 0); @@ -203,13 +199,13 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co * @param attributes text attributes * @param isMainText main text of not */ - public void append(@NotNull @Nls String fragment, @NotNull final SimpleTextAttributes attributes, boolean isMainText) { + public void append(@NotNull @Nls String fragment, final @NotNull SimpleTextAttributes attributes, boolean isMainText) { _append(fragment, attributes, null, isMainText); revalidateAndRepaint(); } private void _append(@NotNull @Nls String fragment, - @NotNull final SimpleTextAttributes attributes, + final @NotNull SimpleTextAttributes attributes, @Nullable FragmentTextClipper clipper, boolean isMainText) { synchronized (myFragments) { @@ -231,7 +227,7 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co } @Override - public void append(@NotNull @Nls String fragment, @NotNull final SimpleTextAttributes attributes, Object tag) { + public void append(@NotNull @Nls String fragment, final @NotNull SimpleTextAttributes attributes, Object tag) { _append(fragment, attributes, tag); revalidateAndRepaint(); } @@ -309,7 +305,7 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co * @param icon icon */ @Override - public final void setIcon(@Nullable final Icon icon) { + public final void setIcon(final @Nullable Icon icon) { if (!Objects.equals(icon, myIcon)) { myIcon = icon; revalidateAndRepaint(); @@ -319,8 +315,7 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co /** * @return "leave" (internal) internal paddings of the component */ - @NotNull - public Insets getIpad() { + public @NotNull Insets getIpad() { return myIpad; } @@ -403,20 +398,17 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co } @Override - @NotNull - public Dimension getPreferredSize() { + public @NotNull Dimension getPreferredSize() { return computePreferredSize(false); } @Override - @NotNull - public Dimension getMinimumSize() { + public @NotNull Dimension getMinimumSize() { if (isMinimumSizeSet()) return super.getMinimumSize(); return computePreferredSize(false); } - @Nullable - public Object getFragmentTag(int index) { + public @Nullable Object getFragmentTag(int index) { synchronized (myFragments) { if (0 <= index && index < myFragments.size()) { return myFragments.get(index).tag; @@ -431,8 +423,7 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co } } - @NotNull - public final Dimension computePreferredSize(final boolean mainTextOnly) { + public final @NotNull Dimension computePreferredSize(final boolean mainTextOnly) { synchronized (myFragments) { // Calculate width float width = myIpad.left; @@ -518,8 +509,7 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co return result; } - @NotNull - protected Font getBaseFont() { + protected @NotNull Font getBaseFont() { Font font = getFont(); if (font == null) font = StartupUiUtil.getLabelFont(); return font; @@ -579,8 +569,7 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co return result; } - @NotNull - private static TextLayout createTextLayout(String text, Font basefont, FontRenderContext fontRenderContext) { + private static @NotNull TextLayout createTextLayout(String text, Font basefont, FontRenderContext fontRenderContext) { AttributedString string = new AttributedString(text); int length = text.length(); Font currentFont = basefont; @@ -671,14 +660,12 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co return -1; } - @Nullable - public Object getFragmentTagAt(int x) { + public @Nullable Object getFragmentTagAt(int x) { int index = findFragmentAt(x); return index < 0 ? null : getFragmentTag(index); } - @NotNull - protected JLabel formatToLabel(@NotNull JLabel label) { + protected @NotNull JLabel formatToLabel(@NotNull JLabel label) { label.setIcon(myIcon); synchronized (myFragments) { @@ -1145,8 +1132,7 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co (SystemInfo.isJetBrainsJvm ? metrics.getLeading() : 0); } - @NotNull - private String logSwingPath() { + private @NotNull String logSwingPath() { final StringBuilder buffer = new StringBuilder("Components hierarchy:\n"); for (Container c = this; c != null; c = c.getParent()) { buffer.append('\n'); @@ -1160,9 +1146,7 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co revalidateAndRepaint(); } - @NotNull - @NlsSafe - public CharSequence getCharSequence(boolean mainOnly) { + public @NotNull @NlsSafe CharSequence getCharSequence(boolean mainOnly) { synchronized (myFragments) { int count = myFragments.size(); if (count == 0) return ""; @@ -1283,25 +1267,22 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co return myEndOffset; } - @NotNull @Override - public String getFragment() { + public @NotNull String getFragment() { synchronized (myFragments) { return myFragments.get(myIndex).text; } } - @NotNull @Override - public SimpleTextAttributes getTextAttributes() { + public @NotNull SimpleTextAttributes getTextAttributes() { synchronized (myFragments) { return myFragments.get(myIndex).attributes; } } - @Nullable @Override - public Object getTag() { + public @Nullable Object getTag() { synchronized (myFragments) { return myFragments.get(myIndex).tag; } @@ -1377,9 +1358,9 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co private static class ColoredFragment { private volatile @Nls @NotNull String text; - @NotNull volatile SimpleTextAttributes attributes; - @Nullable volatile Object tag; - @Nullable private volatile TextRenderer renderer; + volatile @NotNull SimpleTextAttributes attributes; + volatile @Nullable Object tag; + private volatile @Nullable TextRenderer renderer; volatile int padding; volatile int alignment; @@ -1407,8 +1388,7 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co renderer = null; } - @NotNull - private TextRenderer getAndCacheRenderer(Font font, FontRenderContext frc) { + private @NotNull TextRenderer getAndCacheRenderer(Font font, FontRenderContext frc) { TextRenderer renderer = this.renderer; if (renderer == null) { String text = this.text; diff --git a/platform/platform-api/src/com/intellij/ui/TableToolbarDecorator.java b/platform/platform-api/src/com/intellij/ui/TableToolbarDecorator.java index 5807782aa252..946b4873b32f 100644 --- a/platform/platform-api/src/com/intellij/ui/TableToolbarDecorator.java +++ b/platform/platform-api/src/com/intellij/ui/TableToolbarDecorator.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.wm.IdeFocusManager; @@ -23,9 +23,9 @@ import java.util.Arrays; */ class TableToolbarDecorator extends ToolbarDecorator { private final JTable myTable; - @Nullable private final ElementProducer myProducer; + private final @Nullable ElementProducer myProducer; - TableToolbarDecorator(@NotNull JTable table, @Nullable final ElementProducer producer) { + TableToolbarDecorator(@NotNull JTable table, final @Nullable ElementProducer producer) { myTable = table; myProducer = producer; myAddActionEnabled = myRemoveActionEnabled = myUpActionEnabled = myDownActionEnabled = isModelEditable(); @@ -96,7 +96,7 @@ class TableToolbarDecorator extends ToolbarDecorator { } } - private void createDefaultTableActions(@Nullable final ElementProducer producer) { + private void createDefaultTableActions(final @Nullable ElementProducer producer) { final JTable table = myTable; final EditableModel tableModel = (EditableModel)table.getModel(); diff --git a/platform/platform-api/src/com/intellij/ui/TextFieldWithStoredHistory.java b/platform/platform-api/src/com/intellij/ui/TextFieldWithStoredHistory.java index c767e71b035e..33613bae670e 100644 --- a/platform/platform-api/src/com/intellij/ui/TextFieldWithStoredHistory.java +++ b/platform/platform-api/src/com/intellij/ui/TextFieldWithStoredHistory.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.ide.util.PropertiesComponent; @@ -25,11 +11,11 @@ public class TextFieldWithStoredHistory extends TextFieldWithHistory { private final String myPropertyName; // API compatibility with 7.0.1 - public TextFieldWithStoredHistory(@NonNls final String propertyName, boolean cropList) { + public TextFieldWithStoredHistory(final @NonNls String propertyName, boolean cropList) { this(propertyName); } - public TextFieldWithStoredHistory(@NonNls final String propertyName) { + public TextFieldWithStoredHistory(final @NonNls String propertyName) { myPropertyName = propertyName; reset(); } diff --git a/platform/platform-api/src/com/intellij/ui/TitledSeparator.java b/platform/platform-api/src/com/intellij/ui/TitledSeparator.java index 5bbcc4985d42..525a976454c3 100644 --- a/platform/platform-api/src/com/intellij/ui/TitledSeparator.java +++ b/platform/platform-api/src/com/intellij/ui/TitledSeparator.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; @@ -37,8 +37,7 @@ public class TitledSeparator extends JPanel implements ComboBox.SelectableItem { private FocusListener labelFocusListener; - @NotNull - public static Border createEmptyBorder() { + public static @NotNull Border createEmptyBorder() { return JBUI.Borders.empty(TOP_INSET, 0, BOTTOM_INSET, 0); } diff --git a/platform/platform-api/src/com/intellij/ui/ToolbarDecorator.java b/platform/platform-api/src/com/intellij/ui/ToolbarDecorator.java index 083480775aff..26cfc7f10517 100644 --- a/platform/platform-api/src/com/intellij/ui/ToolbarDecorator.java +++ b/platform/platform-api/src/com/intellij/ui/ToolbarDecorator.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.actionSystem.*; @@ -72,8 +72,7 @@ public abstract class ToolbarDecorator implements CommonActionsPanel.ListenerFac private Icon myAddIcon; private boolean myForcedDnD; - @NotNull - protected abstract JComponent getComponent(); + protected abstract @NotNull JComponent getComponent(); protected abstract void updateButtons(); @@ -89,8 +88,7 @@ public abstract class ToolbarDecorator implements CommonActionsPanel.ListenerFac return myActionsPanel; } - @NotNull - public ToolbarDecorator initPosition() { + public @NotNull ToolbarDecorator initPosition() { setToolbarPosition(SystemInfo.isMac && Registry.is("action.toolbar.position.bottom.on.mac") ? ActionToolbarPosition.BOTTOM : ActionToolbarPosition.TOP); @@ -106,13 +104,11 @@ public abstract class ToolbarDecorator implements CommonActionsPanel.ListenerFac return setToolbarPosition(ActionToolbarPosition.TOP).setPanelBorder(JBUI.Borders.empty()); } - @NotNull - public static ToolbarDecorator createDecorator(@NotNull JComponent component) { + public static @NotNull ToolbarDecorator createDecorator(@NotNull JComponent component) { return createDecorator(component, null); } - @NotNull - public static ToolbarDecorator createDecorator(@NotNull JComponent component, @Nullable ElementProducer producer) { + public static @NotNull ToolbarDecorator createDecorator(@NotNull JComponent component, @Nullable ElementProducer producer) { if (component instanceof JTree) { return createDecorator((JTree)component, producer); } @@ -134,76 +130,62 @@ public abstract class ToolbarDecorator implements CommonActionsPanel.ListenerFac } } - @NotNull - public static ToolbarDecorator createDecorator(@NotNull JTable table) { + public static @NotNull ToolbarDecorator createDecorator(@NotNull JTable table) { return new TableToolbarDecorator(table, null).initPosition(); } - @NotNull - public static ToolbarDecorator createDecorator(@NotNull JTree tree) { + public static @NotNull ToolbarDecorator createDecorator(@NotNull JTree tree) { return createDecorator(tree, null); } - @NotNull - private static ToolbarDecorator createDecorator(@NotNull JTree tree, @Nullable ElementProducer producer) { + private static @NotNull ToolbarDecorator createDecorator(@NotNull JTree tree, @Nullable ElementProducer producer) { return new TreeToolbarDecorator(tree, producer).initPosition(); } - @NotNull - public static ToolbarDecorator createDecorator(@NotNull JList list) { + public static @NotNull ToolbarDecorator createDecorator(@NotNull JList list) { return new ListToolbarDecorator<>(list, null).initPosition(); } - @NotNull - public static ToolbarDecorator createDecorator(@NotNull JList list, EditableModel editableModel) { + public static @NotNull ToolbarDecorator createDecorator(@NotNull JList list, EditableModel editableModel) { return new ListToolbarDecorator<>(list, editableModel).initPosition(); } - @NotNull - public static ToolbarDecorator createDecorator(@NotNull TableView table, @Nullable ElementProducer producer) { + public static @NotNull ToolbarDecorator createDecorator(@NotNull TableView table, @Nullable ElementProducer producer) { return new TableToolbarDecorator(table, producer).initPosition(); } - @NotNull - public ToolbarDecorator disableAddAction() { + public @NotNull ToolbarDecorator disableAddAction() { return setAddAction(null); } - @NotNull - public ToolbarDecorator disableRemoveAction() { + public @NotNull ToolbarDecorator disableRemoveAction() { return setRemoveAction(null); } - @NotNull - public ToolbarDecorator disableUpAction() { + public @NotNull ToolbarDecorator disableUpAction() { return setMoveUpAction(null); } - @NotNull - public ToolbarDecorator disableUpDownActions() { + public @NotNull ToolbarDecorator disableUpDownActions() { disableUpAction(); return disableDownAction(); } - @NotNull - public ToolbarDecorator disableDownAction() { + public @NotNull ToolbarDecorator disableDownAction() { return setMoveDownAction(null); } - @NotNull - public ToolbarDecorator setPanelBorder(Border border) { + public @NotNull ToolbarDecorator setPanelBorder(Border border) { myPanelBorder = border; return this; } - @NotNull - public ToolbarDecorator setToolbarBorder(Border border) { + public @NotNull ToolbarDecorator setToolbarBorder(Border border) { myToolbarBorder = border; return this; } - @NotNull - public ToolbarDecorator setScrollPaneBorder(Border border) { + public @NotNull ToolbarDecorator setScrollPaneBorder(Border border) { myScrollPaneBorder = border; return this; } @@ -216,8 +198,7 @@ public abstract class ToolbarDecorator implements CommonActionsPanel.ListenerFac * @param actionNames ordered action names corresponding to the value of the {@code text} property of the action's template presentation * @return this ToolbarDecorator */ - @NotNull - public ToolbarDecorator setButtonComparator(@Nls String @NotNull ... actionNames) { + public @NotNull ToolbarDecorator setButtonComparator(@Nls String @NotNull ... actionNames) { final List names = Arrays.asList(actionNames); myButtonComparator = (o1, o2) -> { final String t1 = o1.getTemplatePresentation().getText(); @@ -238,8 +219,7 @@ public abstract class ToolbarDecorator implements CommonActionsPanel.ListenerFac * @param action the action to add * @return this ToolbarDecorator */ - @NotNull - public ToolbarDecorator addExtraAction(@NotNull AnAction action) { + public @NotNull ToolbarDecorator addExtraAction(@NotNull AnAction action) { myExtraActions.add(action); return this; } @@ -251,8 +231,7 @@ public abstract class ToolbarDecorator implements CommonActionsPanel.ListenerFac * @return this ToolbarDecorator */ @Deprecated - @NotNull - public ToolbarDecorator addExtraAction(@NotNull AnActionButton action) { + public @NotNull ToolbarDecorator addExtraAction(@NotNull AnActionButton action) { myExtraActions.add(action); return this; } @@ -262,8 +241,7 @@ public abstract class ToolbarDecorator implements CommonActionsPanel.ListenerFac * @param actions the actions to add * @return this ToolbarDecorator */ - @NotNull - public ToolbarDecorator addExtraActions(AnAction @NotNull ... actions) { + public @NotNull ToolbarDecorator addExtraActions(AnAction @NotNull ... actions) { for (AnAction action : actions) { if (action != null) { addExtraAction(action); @@ -279,8 +257,7 @@ public abstract class ToolbarDecorator implements CommonActionsPanel.ListenerFac * @return this ToolbarDecorator */ @Deprecated - @NotNull - public ToolbarDecorator addExtraActions(AnActionButton @NotNull ... actions) { + public @NotNull ToolbarDecorator addExtraActions(AnActionButton @NotNull ... actions) { for (AnActionButton action : actions) { if (action != null) { addExtraAction(action); @@ -289,115 +266,97 @@ public abstract class ToolbarDecorator implements CommonActionsPanel.ListenerFac return this; } - @NotNull - public ToolbarDecorator setToolbarPosition(ActionToolbarPosition position) { + public @NotNull ToolbarDecorator setToolbarPosition(ActionToolbarPosition position) { myToolbarPosition = position; return this; } - @NotNull - public ToolbarDecorator setAddAction(AnActionButtonRunnable action) { + public @NotNull ToolbarDecorator setAddAction(AnActionButtonRunnable action) { myAddActionEnabled = action != null; myAddAction = action; return this; } - @NotNull - public ToolbarDecorator setEditAction(AnActionButtonRunnable action) { + public @NotNull ToolbarDecorator setEditAction(AnActionButtonRunnable action) { myEditActionEnabled = action != null; myEditAction = action; return this; } - @NotNull - public ToolbarDecorator setRemoveAction(AnActionButtonRunnable action) { + public @NotNull ToolbarDecorator setRemoveAction(AnActionButtonRunnable action) { myRemoveActionEnabled = action != null; myRemoveAction = action; return this; } - @NotNull - public ToolbarDecorator setMoveUpAction(AnActionButtonRunnable action) { + public @NotNull ToolbarDecorator setMoveUpAction(AnActionButtonRunnable action) { myUpActionEnabled = action != null; myUpAction = action; return this; } - @NotNull - public ToolbarDecorator setMoveDownAction(AnActionButtonRunnable action) { + public @NotNull ToolbarDecorator setMoveDownAction(AnActionButtonRunnable action) { myDownActionEnabled = action != null; myDownAction = action; return this; } - @NotNull - public ToolbarDecorator setAddActionName(@ActionText String name) { + public @NotNull ToolbarDecorator setAddActionName(@ActionText String name) { myAddName = name; return this; } - @NotNull - public ToolbarDecorator setEditActionName(@ActionText String name) { + public @NotNull ToolbarDecorator setEditActionName(@ActionText String name) { myEditName = name; return this; } - @NotNull - public ToolbarDecorator setRemoveActionName(@ActionText String name) { + public @NotNull ToolbarDecorator setRemoveActionName(@ActionText String name) { myRemoveName = name; return this; } - @NotNull - public ToolbarDecorator setMoveUpActionName(@ActionText String name) { + public @NotNull ToolbarDecorator setMoveUpActionName(@ActionText String name) { myMoveUpName = name; return this; } - @NotNull - public ToolbarDecorator setMoveDownActionName(@ActionText String name) { + public @NotNull ToolbarDecorator setMoveDownActionName(@ActionText String name) { myMoveDownName = name; return this; } - @NotNull - public ToolbarDecorator setAddActionUpdater(AnActionButtonUpdater updater) { + public @NotNull ToolbarDecorator setAddActionUpdater(AnActionButtonUpdater updater) { myAddActionUpdater = updater; return this; } - @NotNull - public ToolbarDecorator setRemoveActionUpdater(AnActionButtonUpdater updater) { + public @NotNull ToolbarDecorator setRemoveActionUpdater(AnActionButtonUpdater updater) { myRemoveActionUpdater = updater; return this; } - @NotNull - public ToolbarDecorator setEditActionUpdater(AnActionButtonUpdater updater) { + public @NotNull ToolbarDecorator setEditActionUpdater(AnActionButtonUpdater updater) { myEditActionUpdater = updater; return this; } - @NotNull - public ToolbarDecorator setMoveUpActionUpdater(AnActionButtonUpdater updater) { + public @NotNull ToolbarDecorator setMoveUpActionUpdater(AnActionButtonUpdater updater) { myMoveUpActionUpdater = updater; return this; } - @NotNull - public ToolbarDecorator setMoveDownActionUpdater(AnActionButtonUpdater updater) { + public @NotNull ToolbarDecorator setMoveDownActionUpdater(AnActionButtonUpdater updater) { myMoveDownActionUpdater = updater; return this; } - @NotNull - public ToolbarDecorator setForcedDnD() { + public @NotNull ToolbarDecorator setForcedDnD() { myForcedDnD = true; return this; } - @NotNull - public ToolbarDecorator setActionGroup(@NotNull ActionGroup actionGroup) { + public @NotNull ToolbarDecorator setActionGroup(@NotNull ActionGroup actionGroup) { AnAction[] actions = actionGroup.getChildren(null); for (AnAction action : actions) { if (!(action instanceof Separator)) { @@ -407,25 +366,21 @@ public abstract class ToolbarDecorator implements CommonActionsPanel.ListenerFac return this; } - @NotNull - public ToolbarDecorator setPreferredSize(Dimension size) { + public @NotNull ToolbarDecorator setPreferredSize(Dimension size) { myPreferredSize = size; return this; } - @NotNull - public ToolbarDecorator setMinimumSize(Dimension size) { + public @NotNull ToolbarDecorator setMinimumSize(Dimension size) { myMinimumSize = size; return this; } - @NotNull - public ToolbarDecorator setVisibleRowCount(int rowCount) { + public @NotNull ToolbarDecorator setVisibleRowCount(int rowCount) { return this;//do nothing by default } - @NotNull - public ToolbarDecorator setAddIcon(Icon addIcon) { + public @NotNull ToolbarDecorator setAddIcon(Icon addIcon) { myAddIcon = addIcon; return this; } @@ -433,8 +388,7 @@ public abstract class ToolbarDecorator implements CommonActionsPanel.ListenerFac /** * @return panel that contains wrapped component (with added scrollpane) and toolbar panel. */ - @NotNull - public JPanel createPanel() { + public @NotNull JPanel createPanel() { CommonActionsPanel.Buttons[] buttons = getButtons(); JComponent contextComponent = getComponent(); UIUtil.putClientProperty(contextComponent, JBViewport.FORCE_VISIBLE_ROW_COUNT_KEY, true); @@ -544,8 +498,7 @@ public abstract class ToolbarDecorator implements CommonActionsPanel.ListenerFac protected abstract boolean isModelEditable(); - @NotNull - static Object getPlacement(@NotNull ActionToolbarPosition position) { + static @NotNull Object getPlacement(@NotNull ActionToolbarPosition position) { return switch (position) { case TOP -> BorderLayout.NORTH; case LEFT -> BorderLayout.WEST; @@ -613,33 +566,27 @@ public abstract class ToolbarDecorator implements CommonActionsPanel.ListenerFac }; } - @Nullable - public static AnActionButton findAddButton(@NotNull JComponent container) { + public static @Nullable AnActionButton findAddButton(@NotNull JComponent container) { return findButton(container, CommonActionsPanel.Buttons.ADD); } - @Nullable - public static AnActionButton findEditButton(@NotNull JComponent container) { + public static @Nullable AnActionButton findEditButton(@NotNull JComponent container) { return findButton(container, CommonActionsPanel.Buttons.EDIT); } - @Nullable - public static AnActionButton findRemoveButton(@NotNull JComponent container) { + public static @Nullable AnActionButton findRemoveButton(@NotNull JComponent container) { return findButton(container, CommonActionsPanel.Buttons.REMOVE); } - @Nullable - public static AnActionButton findUpButton(@NotNull JComponent container) { + public static @Nullable AnActionButton findUpButton(@NotNull JComponent container) { return findButton(container, CommonActionsPanel.Buttons.UP); } - @Nullable - public static AnActionButton findDownButton(@NotNull JComponent container) { + public static @Nullable AnActionButton findDownButton(@NotNull JComponent container) { return findButton(container, CommonActionsPanel.Buttons.DOWN); } - @Nullable - private static AnActionButton findButton(JComponent comp, CommonActionsPanel.Buttons type) { + private static @Nullable AnActionButton findButton(JComponent comp, CommonActionsPanel.Buttons type) { final CommonActionsPanel panel = UIUtil.findComponentOfType(comp, CommonActionsPanel.class); if (panel != null) { return panel.getAnActionButton(type); diff --git a/platform/platform-api/src/com/intellij/ui/TreeToolbarDecorator.java b/platform/platform-api/src/com/intellij/ui/TreeToolbarDecorator.java index 6d4b42eff26d..de04f005e24a 100644 --- a/platform/platform-api/src/com/intellij/ui/TreeToolbarDecorator.java +++ b/platform/platform-api/src/com/intellij/ui/TreeToolbarDecorator.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui; import com.intellij.openapi.wm.IdeFocusManager; @@ -27,13 +27,13 @@ import java.util.Arrays; class TreeToolbarDecorator extends ToolbarDecorator { private final JComponent myComponent; private final JTree myTree; - @Nullable private final ElementProducer myProducer; + private final @Nullable ElementProducer myProducer; - TreeToolbarDecorator(JTree tree, @Nullable final ElementProducer producer) { + TreeToolbarDecorator(JTree tree, final @Nullable ElementProducer producer) { this(tree, tree, producer); } - TreeToolbarDecorator(@NotNull JComponent component, @NotNull JTree tree, @Nullable final ElementProducer producer) { + TreeToolbarDecorator(@NotNull JComponent component, @NotNull JTree tree, final @Nullable ElementProducer producer) { myComponent = component; myTree = tree; myProducer = producer; diff --git a/platform/platform-api/src/com/intellij/ui/components/Interpolator.java b/platform/platform-api/src/com/intellij/ui/components/Interpolator.java index a38caea794f5..39f1a39e8365 100644 --- a/platform/platform-api/src/com/intellij/ui/components/Interpolator.java +++ b/platform/platform-api/src/com/intellij/ui/components/Interpolator.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components; import org.jetbrains.annotations.NotNull; @@ -126,7 +126,7 @@ public class Interpolator { } } - private static abstract class Segment { + private abstract static class Segment { protected final Position myBegin; protected final Position myEnd; diff --git a/platform/platform-api/src/com/intellij/ui/components/JBLabel.java b/platform/platform-api/src/com/intellij/ui/components/JBLabel.java index f3b7ad53d8dc..299f5abbe579 100644 --- a/platform/platform-api/src/com/intellij/ui/components/JBLabel.java +++ b/platform/platform-api/src/com/intellij/ui/components/JBLabel.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components; import com.intellij.ide.ui.AntialiasingType; @@ -278,8 +278,7 @@ public class JBLabel extends JLabel implements AnchorableComponent, JBComponent< /** * This listener will be used in 'copyable' mode when a link is updated (clicked, entered, etc.). */ - @NotNull - protected HyperlinkListener createHyperlinkListener() { + protected @NotNull HyperlinkListener createHyperlinkListener() { return BrowserHyperlinkListener.INSTANCE; } diff --git a/platform/platform-api/src/com/intellij/ui/components/JBScrollBar.java b/platform/platform-api/src/com/intellij/ui/components/JBScrollBar.java index 28b648cbc265..76e97d95e356 100644 --- a/platform/platform-api/src/com/intellij/ui/components/JBScrollBar.java +++ b/platform/platform-api/src/com/intellij/ui/components/JBScrollBar.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components; import com.intellij.openapi.util.Key; @@ -88,8 +88,7 @@ public class JBScrollBar extends JScrollBar implements TopComponent, Interpolabl } @SuppressWarnings("UnusedParameters") - @NotNull - public static ScrollBarUI createUI(JComponent c) { + public static @NotNull ScrollBarUI createUI(JComponent c) { return createUI(c, false); } @@ -101,8 +100,7 @@ public class JBScrollBar extends JScrollBar implements TopComponent, Interpolabl * @return a new instance of {@link ScrollBarUI} */ @SuppressWarnings("UnusedParameters") - @NotNull - public static ScrollBarUI createUI(JComponent c, boolean isThin) { + public static @NotNull ScrollBarUI createUI(JComponent c, boolean isThin) { if (SystemInfo.isMac) { return isThin ? new ThinMacScrollBarUI() : new MacScrollBarUI(); } diff --git a/platform/platform-api/src/com/intellij/ui/components/JBScrollPane.java b/platform/platform-api/src/com/intellij/ui/components/JBScrollPane.java index 9809f52495e1..d57659e78f0f 100644 --- a/platform/platform-api/src/com/intellij/ui/components/JBScrollPane.java +++ b/platform/platform-api/src/com/intellij/ui/components/JBScrollPane.java @@ -316,9 +316,8 @@ public class JBScrollPane extends JScrollPane { return new JBScrollBar(Adjustable.VERTICAL); } - @NotNull @Override - public JScrollBar createHorizontalScrollBar() { + public @NotNull JScrollBar createHorizontalScrollBar() { return new JBScrollBar(Adjustable.HORIZONTAL); } diff --git a/platform/platform-api/src/com/intellij/ui/components/JBTabbedPane.java b/platform/platform-api/src/com/intellij/ui/components/JBTabbedPane.java index 5da0dc65b271..ca02f056fcea 100644 --- a/platform/platform-api/src/com/intellij/ui/components/JBTabbedPane.java +++ b/platform/platform-api/src/com/intellij/ui/components/JBTabbedPane.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components; import com.intellij.openapi.util.NlsContexts; @@ -106,13 +106,11 @@ public class JBTabbedPane extends JTabbedPane implements HierarchyListener { /** @deprecated Use {@link JBTabbedPane#setTabComponentInsets(Insets)} instead of overriding */ @Deprecated(forRemoval = true) - @NotNull - protected Insets getInsetsForTabComponent() { + protected @NotNull Insets getInsetsForTabComponent() { return myTabComponentInsets; } - @Nullable - public Insets getTabComponentInsets() { + public @Nullable Insets getTabComponentInsets() { return myTabComponentInsets; } diff --git a/platform/platform-api/src/com/intellij/ui/components/JBViewport.java b/platform/platform-api/src/com/intellij/ui/components/JBViewport.java index 9a1b28888bf0..edb0bd792c63 100644 --- a/platform/platform-api/src/com/intellij/ui/components/JBViewport.java +++ b/platform/platform-api/src/com/intellij/ui/components/JBViewport.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components; import com.intellij.notification.Notification; @@ -140,8 +140,7 @@ public class JBViewport extends JViewport implements ZoomableViewport { This helps to improve scrolling performance and to reduce CPU usage (especially if drawing is compute-intensive). Generally, this requires that viewport must not be obscured by its ancestors and must be showing. */ - @Nullable - private static Boolean isWindowBlitterAvailableFor(JViewport viewport) { + private static @Nullable Boolean isWindowBlitterAvailableFor(JViewport viewport) { if (ourCanUseWindowBlitterMethod.isAvailable()) { return (Boolean)ourCanUseWindowBlitterMethod.invoke(viewport); } @@ -164,8 +163,7 @@ public class JBViewport extends JViewport implements ZoomableViewport { Use a breakpoint in JRootPane.disableTrueDoubleBuffering() to detect direct getGraphics() calls. See GraphicsUtil.safelyGetGraphics() for more info. */ - @Nullable - private static Boolean isTrueDoubleBufferingAvailableFor(JComponent component) { + private static @Nullable Boolean isTrueDoubleBufferingAvailableFor(JComponent component) { if (ourGetPaintManagerMethod.isAvailable()) { Object paintManager = ourGetPaintManagerMethod.invoke(RepaintManager.currentManager(component)); @@ -243,9 +241,8 @@ public class JBViewport extends JViewport implements ZoomableViewport { myPaintingNow = false; } - @Nullable @Override - public Magnificator getMagnificator() { + public @Nullable Magnificator getMagnificator() { return ClientProperty.get(getView(), Magnificator.CLIENT_PROPERTY_KEY); } diff --git a/platform/platform-api/src/com/intellij/ui/components/MacScrollBarUI.java b/platform/platform-api/src/com/intellij/ui/components/MacScrollBarUI.java index b59271c2d287..85f4dd2a2180 100644 --- a/platform/platform-api/src/com/intellij/ui/components/MacScrollBarUI.java +++ b/platform/platform-api/src/com/intellij/ui/components/MacScrollBarUI.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components; import com.intellij.openapi.diagnostic.Logger; @@ -196,9 +196,8 @@ class MacScrollBarUI extends DefaultScrollBarUI { NextPage, JumpToSpot; private static final Native CURRENT = new Native<>() { - @NotNull @Override - public Behavior produce() { + public @NotNull Behavior produce() { ID defaults = invoke("NSUserDefaults", "standardUserDefaults"); invoke(defaults, "synchronize"); ID behavior = invoke(defaults, "boolForKey:", nsString("AppleScrollerPagingBehavior")); @@ -246,9 +245,8 @@ class MacScrollBarUI extends DefaultScrollBarUI { } } - @NotNull @Override - public Style produce() { + public @NotNull Style produce() { ID style = invoke(getObjcClass("NSScroller"), "preferredScrollerStyle"); Style value = 1 == style.intValue() ? Overlay : Legacy; Logger.getInstance(MacScrollBarUI.class).debug("scroll bar style ", value, " from ", style); @@ -273,7 +271,7 @@ class MacScrollBarUI extends DefaultScrollBarUI { }; } - private static abstract class Native implements Callback, Runnable, NotNullProducer { + private abstract static class Native implements Callback, Runnable, NotNullProducer { private T myValue; Native() { diff --git a/platform/platform-api/src/com/intellij/ui/components/MultiColumnListModel.java b/platform/platform-api/src/com/intellij/ui/components/MultiColumnListModel.java index 8ee7ce055c44..288cb7415023 100644 --- a/platform/platform-api/src/com/intellij/ui/components/MultiColumnListModel.java +++ b/platform/platform-api/src/com/intellij/ui/components/MultiColumnListModel.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components; import org.jetbrains.annotations.Nullable; @@ -39,9 +25,8 @@ public abstract class MultiColumnListModel extends AbstractTableModel implements return myModel.getSize(); } - @Nullable @Override - public Object getValueAt(int row, int column) { + public @Nullable Object getValueAt(int row, int column) { final int index = toListIndex(row, column); return index == -1 || index >= myModel.getSize() ? null : myModel.getElementAt(index); diff --git a/platform/platform-api/src/com/intellij/ui/components/ProgressBarLoadingDecorator.java b/platform/platform-api/src/com/intellij/ui/components/ProgressBarLoadingDecorator.java index 8de293359ea1..0b5e0bc32062 100644 --- a/platform/platform-api/src/com/intellij/ui/components/ProgressBarLoadingDecorator.java +++ b/platform/platform-api/src/com/intellij/ui/components/ProgressBarLoadingDecorator.java @@ -37,8 +37,7 @@ public class ProgressBarLoadingDecorator extends LoadingDecorator { return true; } - @NotNull - public JProgressBar getProgressBar() { + public @NotNull JProgressBar getProgressBar() { return myProgressBar; } diff --git a/platform/platform-api/src/com/intellij/ui/components/ScrollBarPainter.java b/platform/platform-api/src/com/intellij/ui/components/ScrollBarPainter.java index 2de583d4d2c6..d176451efdb3 100644 --- a/platform/platform-api/src/com/intellij/ui/components/ScrollBarPainter.java +++ b/platform/platform-api/src/com/intellij/ui/components/ScrollBarPainter.java @@ -141,13 +141,11 @@ public abstract class ScrollBarPainter implements RegionPainter { }; } - @NotNull - private static ColorKey key(int light, int dark, @NotNull String name) { + private static @NotNull ColorKey key(int light, int dark, @NotNull String name) { return EditorColorsUtil.createColorKey(name, new JBColor(new Color(light, true), new Color(dark, true))); } - @NotNull - private static Color getColor(@Nullable Component component, @NotNull ColorKey key) { + private static @NotNull Color getColor(@Nullable Component component, @NotNull ColorKey key) { Color color = EditorColorsUtil.getColor(component, key); assert color != null : "default color is not specified for " + key; diff --git a/platform/platform-api/src/com/intellij/ui/components/SelectionAwareListCellRenderer.java b/platform/platform-api/src/com/intellij/ui/components/SelectionAwareListCellRenderer.java index 22d6ae86a7ca..d8e30ab7eead 100644 --- a/platform/platform-api/src/com/intellij/ui/components/SelectionAwareListCellRenderer.java +++ b/platform/platform-api/src/com/intellij/ui/components/SelectionAwareListCellRenderer.java @@ -1,4 +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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components; import com.intellij.util.NotNullFunction; @@ -13,13 +13,12 @@ public class SelectionAwareListCellRenderer implements ListCellRenderer { public SelectionAwareListCellRenderer(NotNullFunction fun) {myFun = fun;} - @NotNull @Override - public Component getListCellRendererComponent(@NotNull JList list, - Object value, - int index, - boolean isSelected, - boolean cellHasFocus) { + public @NotNull Component getListCellRendererComponent(@NotNull JList list, + Object value, + int index, + boolean isSelected, + boolean cellHasFocus) { @SuppressWarnings({"unchecked"}) final JComponent comp = myFun.fun((T)value); comp.setOpaque(true); diff --git a/platform/platform-api/src/com/intellij/ui/components/breadcrumbs/Breadcrumbs.java b/platform/platform-api/src/com/intellij/ui/components/breadcrumbs/Breadcrumbs.java index 288524ec0813..3db844b1f123 100644 --- a/platform/platform-api/src/com/intellij/ui/components/breadcrumbs/Breadcrumbs.java +++ b/platform/platform-api/src/com/intellij/ui/components/breadcrumbs/Breadcrumbs.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components.breadcrumbs; import com.intellij.openapi.actionSystem.ActionManager; @@ -139,8 +139,7 @@ public class Breadcrumbs extends JBPanelWithEmptyText { return hovered == null ? null : hovered.getTooltip(); } - @Nullable - protected Rectangle getCrumbBounds(@NotNull Crumb crumb) { + protected @Nullable Rectangle getCrumbBounds(@NotNull Crumb crumb) { Optional viewOpt = views.stream().filter(v -> v.crumb == crumb).findFirst(); return viewOpt.map(view -> view.bounds).orElse(null); } @@ -650,9 +649,8 @@ public class Breadcrumbs extends JBPanelWithEmptyText { return this; } - @NlsSafe @Override - public String getAccessibleName() { + public @NlsSafe String getAccessibleName() { return myText; } diff --git a/platform/platform-api/src/com/intellij/ui/components/breadcrumbs/Crumb.java b/platform/platform-api/src/com/intellij/ui/components/breadcrumbs/Crumb.java index 46a85871f590..dac75e04f7ea 100644 --- a/platform/platform-api/src/com/intellij/ui/components/breadcrumbs/Crumb.java +++ b/platform/platform-api/src/com/intellij/ui/components/breadcrumbs/Crumb.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components.breadcrumbs; import com.intellij.openapi.util.NlsContexts; @@ -24,14 +24,12 @@ public interface Crumb { /** * @return synchronously calculated tooltip text */ - @Nullable - default @NlsContexts.Tooltip String getTooltip() { return null; } + default @Nullable @NlsContexts.Tooltip String getTooltip() { return null; } /** * @return a list of actions for context menu */ - @NotNull - default List getContextActions() { + default @NotNull List getContextActions() { return Collections.emptyList(); } @@ -40,8 +38,7 @@ public interface Crumb { private final @Nls String text; private final @NlsContexts.Tooltip String tooltip; - @NotNull - private final List actions; + private final @NotNull List actions; public Impl(@NotNull BreadcrumbsProvider provider, @NotNull PsiElement element) { this(provider.getElementIcon(element), @@ -71,15 +68,13 @@ public interface Crumb { return tooltip; } - @Nls @Override - public String getText() { + public @Nls String getText() { return text; } - @NotNull @Override - public List getContextActions() { + public @NotNull List getContextActions() { return actions; } diff --git a/platform/platform-api/src/com/intellij/ui/components/fields/CommaSeparatedIntegersField.java b/platform/platform-api/src/com/intellij/ui/components/fields/CommaSeparatedIntegersField.java index ceec2115a396..8528c44a74be 100644 --- a/platform/platform-api/src/com/intellij/ui/components/fields/CommaSeparatedIntegersField.java +++ b/platform/platform-api/src/com/intellij/ui/components/fields/CommaSeparatedIntegersField.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components.fields; import com.intellij.openapi.options.ConfigurationException; @@ -49,8 +35,7 @@ public class CommaSeparatedIntegersField extends JBTextField { myValueEditor.setValue(newValue); } - @NotNull - public List getValue() { + public @NotNull List getValue() { return myValueEditor.getValue(); } @@ -58,13 +43,11 @@ public class CommaSeparatedIntegersField extends JBTextField { myValueEditor.setDefaultValue(defaultValue); } - @NotNull - public List getDefaultValue() { + public @NotNull List getDefaultValue() { return myValueEditor.getDefaultValue(); } - @Nullable - public String getValueName() { + public @Nullable String getValueName() { return myValueEditor.getValueName(); } diff --git a/platform/platform-api/src/com/intellij/ui/components/fields/ExpandableSupport.java b/platform/platform-api/src/com/intellij/ui/components/fields/ExpandableSupport.java index 451a4722ec58..a07f1e3426c4 100644 --- a/platform/platform-api/src/com/intellij/ui/components/fields/ExpandableSupport.java +++ b/platform/platform-api/src/com/intellij/ui/components/fields/ExpandableSupport.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components.fields; import com.intellij.icons.AllIcons; @@ -61,8 +61,7 @@ public abstract class ExpandableSupport implements Ex * @param onShow a string converter from the source to the popup content * @return a specific content to create the popup */ - @NotNull - protected abstract Content prepare(@NotNull Source source, @NotNull Function onShow); + protected abstract @NotNull Content prepare(@NotNull Source source, @NotNull Function onShow); protected interface Content { /** @@ -181,24 +180,21 @@ public abstract class ExpandableSupport implements Ex } } - @NotNull - public Extension createCollapseExtension() { + public @NotNull Extension createCollapseExtension() { return Extension.create(AllIcons.General.CollapseComponent, AllIcons.General.CollapseComponentHover, createTooltipText(IdeBundle.message("action.collapse"), "CollapseExpandableComponent"), this::collapse); } - @NotNull - public Extension createExpandExtension() { + public @NotNull Extension createExpandExtension() { return Extension.create(AllIcons.General.ExpandComponent, AllIcons.General.ExpandComponentHover, createTooltipText(IdeBundle.message("action.expand"), "ExpandExpandableComponent"), this::expand); } - @NotNull - public static JLabel createLabel(@NotNull Extension extension) { + public static @NotNull JLabel createLabel(@NotNull Extension extension) { JLabel label = new JLabel(extension.getIcon(false)); label.setToolTipText(extension.getTooltip()); label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); diff --git a/platform/platform-api/src/com/intellij/ui/components/fields/ExpandableTextField.java b/platform/platform-api/src/com/intellij/ui/components/fields/ExpandableTextField.java index baf98af86260..6783bdff7dfc 100644 --- a/platform/platform-api/src/com/intellij/ui/components/fields/ExpandableTextField.java +++ b/platform/platform-api/src/com/intellij/ui/components/fields/ExpandableTextField.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components.fields; import com.intellij.openapi.util.NlsContexts; @@ -44,9 +44,8 @@ public class ExpandableTextField extends ExtendableTextField implements Expandab Function onShow = text -> StringUtil.join(parser.fun(text), "\n"); Function onHide = text -> joiner.fun(asList(StringUtil.splitByLines(text))); support = new ExpandableSupport(this, onShow, onHide) { - @NotNull @Override - protected Content prepare(@NotNull JTextComponent field, @NotNull Function onShow) { + protected @NotNull Content prepare(@NotNull JTextComponent field, @NotNull Function onShow) { Font font = field.getFont(); FontMetrics metrics = font == null ? null : field.getFontMetrics(font); int height = metrics == null ? 16 : metrics.getHeight(); @@ -80,9 +79,8 @@ public class ExpandableTextField extends ExtendableTextField implements Expandab ? createEmptyBorder(insets.top, insets.left, insets.bottom, insets.right) : createEmptyBorder()); return new Content() { - @NotNull @Override - public JComponent getContentComponent() { + public @NotNull JComponent getContentComponent() { return pane; } @@ -105,8 +103,7 @@ public class ExpandableTextField extends ExtendableTextField implements Expandab setExtensions(createExtensions()); } - @NotNull - protected JTextArea createTextArea(@Nls @NotNull String text, boolean editable, Color background, Color foreground, Font font) { + protected @NotNull JTextArea createTextArea(@Nls @NotNull String text, boolean editable, Color background, Color foreground, Font font) { JTextArea area = new JTextArea(text); area.putClientProperty(Expandable.class, this); @@ -126,8 +123,7 @@ public class ExpandableTextField extends ExtendableTextField implements Expandab putClientProperty("monospaced", monospaced); } - @NotNull - protected List createExtensions() { + protected @NotNull List createExtensions() { return singletonList(support.createExpandExtension()); } diff --git a/platform/platform-api/src/com/intellij/ui/components/fields/IntegerField.java b/platform/platform-api/src/com/intellij/ui/components/fields/IntegerField.java index e60da1616894..eed93c83530c 100644 --- a/platform/platform-api/src/com/intellij/ui/components/fields/IntegerField.java +++ b/platform/platform-api/src/com/intellij/ui/components/fields/IntegerField.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components.fields; import com.intellij.openapi.options.ConfigurationException; @@ -64,8 +50,7 @@ public class IntegerField extends JBTextField { myValueEditor.setCanBeEmpty(canBeEmpty); } - @NotNull - public Integer getValue() { + public @NotNull Integer getValue() { return myValueEditor.getValue(); } @@ -77,8 +62,7 @@ public class IntegerField extends JBTextField { myValueEditor.setValueName(valueName); } - @Nullable - public String getValueName() { + public @Nullable String getValueName() { return myValueEditor.getValueName(); } @@ -94,8 +78,7 @@ public class IntegerField extends JBTextField { myValueEditor.setDefaultValue(defaultValue); } - @NotNull - public Integer getDefaultValue() { + public @NotNull Integer getDefaultValue() { return myValueEditor.getDefaultValue(); } diff --git a/platform/platform-api/src/com/intellij/ui/components/fields/valueEditors/AbstractValueEditor.java b/platform/platform-api/src/com/intellij/ui/components/fields/valueEditors/AbstractValueEditor.java index b63f2076160e..3a3043a73eb7 100644 --- a/platform/platform-api/src/com/intellij/ui/components/fields/valueEditors/AbstractValueEditor.java +++ b/platform/platform-api/src/com/intellij/ui/components/fields/valueEditors/AbstractValueEditor.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components.fields.valueEditors; import com.intellij.openapi.options.ConfigurationException; @@ -40,8 +26,7 @@ public abstract class AbstractValueEditor implements ValueEditor { * @return The parsed value as returned by {@link #parseValue(String)} method or the default value. */ @Override - @NotNull - public T getValue() { + public @NotNull T getValue() { try { return parseValue(getValueText()); } @@ -54,9 +39,8 @@ public abstract class AbstractValueEditor implements ValueEditor { myValueName = valueName; } - @Nullable @Override - public String getValueName() { + public @Nullable String getValueName() { return myValueName; } @@ -94,9 +78,8 @@ public abstract class AbstractValueEditor implements ValueEditor { myDefaultValue = defaultValue; } - @NotNull @Override - public T getDefaultValue() { + public @NotNull T getDefaultValue() { return myDefaultValue; } diff --git a/platform/platform-api/src/com/intellij/ui/components/fields/valueEditors/CommaSeparatedIntegersValueEditor.java b/platform/platform-api/src/com/intellij/ui/components/fields/valueEditors/CommaSeparatedIntegersValueEditor.java index 4b3bbf77094d..7f15d6928fd0 100644 --- a/platform/platform-api/src/com/intellij/ui/components/fields/valueEditors/CommaSeparatedIntegersValueEditor.java +++ b/platform/platform-api/src/com/intellij/ui/components/fields/valueEditors/CommaSeparatedIntegersValueEditor.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components.fields.valueEditors; import com.intellij.openapi.util.InvalidDataException; @@ -22,9 +22,8 @@ public class CommaSeparatedIntegersValueEditor extends TextFieldValueEditor parseValue(@Nullable String text) throws InvalidDataException { + public @NotNull List parseValue(@Nullable String text) throws InvalidDataException { if (text == null || text.isEmpty()) return Collections.emptyList(); String[] chunks = text.split("\\s*,\\s*"); List values = new ArrayList<>(chunks.length); diff --git a/platform/platform-api/src/com/intellij/ui/components/fields/valueEditors/IntegerValueEditor.java b/platform/platform-api/src/com/intellij/ui/components/fields/valueEditors/IntegerValueEditor.java index 50e2cb5e3ce7..26ceb41f534b 100644 --- a/platform/platform-api/src/com/intellij/ui/components/fields/valueEditors/IntegerValueEditor.java +++ b/platform/platform-api/src/com/intellij/ui/components/fields/valueEditors/IntegerValueEditor.java @@ -1,4 +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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components.fields.valueEditors; import com.intellij.openapi.application.ApplicationBundle; @@ -18,9 +18,8 @@ public class IntegerValueEditor extends TextFieldValueEditor { super(field, valueName, defaultValue); } - @NotNull @Override - public Integer parseValue(@Nullable String text) throws InvalidDataException { + public @NotNull Integer parseValue(@Nullable String text) throws InvalidDataException { try { if (StringUtil.isEmpty(text)) { if (!myCanBeEmpty) { diff --git a/platform/platform-api/src/com/intellij/ui/components/labels/LinkLabel.java b/platform/platform-api/src/com/intellij/ui/components/labels/LinkLabel.java index b4a6b0287b1b..623739365720 100644 --- a/platform/platform-api/src/com/intellij/ui/components/labels/LinkLabel.java +++ b/platform/platform-api/src/com/intellij/ui/components/labels/LinkLabel.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components.labels; import com.intellij.diagnostic.LoadingState; @@ -83,8 +83,7 @@ public class LinkLabel extends JLabel { * @deprecated use {@link com.intellij.ui.components.ActionLink} instead */ @Deprecated - @NotNull - public static LinkLabel create(@Nullable @NlsContexts.LinkLabel String text, @Nullable Runnable action) { + public static @NotNull LinkLabel create(@Nullable @NlsContexts.LinkLabel String text, @Nullable Runnable action) { return new LinkLabel<>(text, null, action == null ? null : (__, ___) -> action.run(), null, null); } @@ -211,8 +210,7 @@ public class LinkLabel extends JLabel { } } - @NotNull - protected Rectangle getTextBounds() { + protected @NotNull Rectangle getTextBounds() { if (textR.isEmpty()) { updateLayoutRectangles(); } diff --git a/platform/platform-api/src/com/intellij/ui/components/panels/StatelessCardLayout.java b/platform/platform-api/src/com/intellij/ui/components/panels/StatelessCardLayout.java index 118cc3e8b528..5ba5c0fd7e73 100644 --- a/platform/platform-api/src/com/intellij/ui/components/panels/StatelessCardLayout.java +++ b/platform/platform-api/src/com/intellij/ui/components/panels/StatelessCardLayout.java @@ -27,8 +27,7 @@ public class StatelessCardLayout implements LayoutManager2 { * @return new panel with this layout manager and the specified component * @see Wrapper */ - @NotNull - public static JPanel wrap(Component component) { + public static @NotNull JPanel wrap(Component component) { JPanel panel = new JPanel(INSTANCE); if (component != null) panel.add(component); panel.setOpaque(false); diff --git a/platform/platform-api/src/com/intellij/ui/components/panels/VerticalLayout.java b/platform/platform-api/src/com/intellij/ui/components/panels/VerticalLayout.java index c2468c4bc2ad..83dd41fc6aec 100644 --- a/platform/platform-api/src/com/intellij/ui/components/panels/VerticalLayout.java +++ b/platform/platform-api/src/com/intellij/ui/components/panels/VerticalLayout.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.components.panels; import com.intellij.util.containers.ContainerUtil; @@ -246,8 +246,7 @@ public final class VerticalLayout implements LayoutManager2 { } } - @NotNull - public List getComponents() { + public @NotNull List getComponents() { return ContainerUtil.concat(myTop, myCenter, myBottom); } } diff --git a/platform/platform-api/src/com/intellij/ui/content/TabbedContent.java b/platform/platform-api/src/com/intellij/ui/content/TabbedContent.java index fda1c1902133..3e5d57d75a82 100644 --- a/platform/platform-api/src/com/intellij/ui/content/TabbedContent.java +++ b/platform/platform-api/src/com/intellij/ui/content/TabbedContent.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.content; import com.intellij.openapi.util.NlsContexts; @@ -59,8 +45,7 @@ public interface TabbedContent extends Content { return getTabs().size() > 1; } - @NotNull - default TabGroupId getId() { + default @NotNull TabGroupId getId() { return new TabGroupId(getTitlePrefix(), getTitlePrefix()); } diff --git a/platform/platform-api/src/com/intellij/ui/dualView/DualView.java b/platform/platform-api/src/com/intellij/ui/dualView/DualView.java index 78039e512563..49baff104a41 100644 --- a/platform/platform-api/src/com/intellij/ui/dualView/DualView.java +++ b/platform/platform-api/src/com/intellij/ui/dualView/DualView.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.dualView; import com.intellij.ide.util.PropertiesComponent; @@ -233,9 +233,8 @@ public final class DualView extends JPanel { return createWrappedRenderer(super.getCellRenderer(row, column)); } - @NotNull @Override - public Component prepareRenderer(@NotNull TableCellRenderer renderer, int row, int column) { + public @NotNull Component prepareRenderer(@NotNull TableCellRenderer renderer, int row, int column) { final Component c = super.prepareRenderer(renderer, row, column); if (c instanceof JComponent && !myFlatView.getCellSelectionEnabled()) { ((JComponent)c).setBorder(null); @@ -412,15 +411,14 @@ public final class DualView extends JPanel { } private class MyTableCellRendererWrapper implements TableCellRendererWrapper { - @NotNull private final TableCellRenderer myRenderer; + private final @NotNull TableCellRenderer myRenderer; MyTableCellRendererWrapper(@NotNull TableCellRenderer renderer) { myRenderer = renderer; } - @NotNull @Override - public TableCellRenderer getBaseRenderer() { + public @NotNull TableCellRenderer getBaseRenderer() { return myRenderer; } diff --git a/platform/platform-api/src/com/intellij/ui/dualView/TreeTableView.java b/platform/platform-api/src/com/intellij/ui/dualView/TreeTableView.java index c9e378775e1e..9ef8070bcb8a 100644 --- a/platform/platform-api/src/com/intellij/ui/dualView/TreeTableView.java +++ b/platform/platform-api/src/com/intellij/ui/dualView/TreeTableView.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.dualView; import com.intellij.openapi.diagnostic.Logger; @@ -162,15 +148,14 @@ public class TreeTableView extends TreeTable implements SelectionProvider { } public static class CellRendererWrapper implements TableCellRendererWrapper { - @NotNull private final TableCellRenderer myBaseRenderer; + private final @NotNull TableCellRenderer myBaseRenderer; public CellRendererWrapper(@NotNull TableCellRenderer baseRenderer) { myBaseRenderer = baseRenderer; } @Override - @NotNull - public TableCellRenderer getBaseRenderer() { + public @NotNull TableCellRenderer getBaseRenderer() { return myBaseRenderer; } diff --git a/platform/platform-api/src/com/intellij/ui/jcef/DisposeHelper.java b/platform/platform-api/src/com/intellij/ui/jcef/DisposeHelper.java index facbf1169a2e..ff6c637fa88b 100644 --- a/platform/platform-api/src/com/intellij/ui/jcef/DisposeHelper.java +++ b/platform/platform-api/src/com/intellij/ui/jcef/DisposeHelper.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.jcef; import org.jetbrains.annotations.NotNull; @@ -11,7 +11,7 @@ import java.util.concurrent.atomic.AtomicBoolean; * @author tav */ final class DisposeHelper { - @NotNull private final AtomicBoolean myIsDisposed = new AtomicBoolean(false); + private final @NotNull AtomicBoolean myIsDisposed = new AtomicBoolean(false); public void dispose(@NotNull Runnable disposer) { if (!myIsDisposed.getAndSet(true)) disposer.run(); diff --git a/platform/platform-api/src/com/intellij/ui/jcef/JBCefApp.java b/platform/platform-api/src/com/intellij/ui/jcef/JBCefApp.java index 5761fbe7afe5..dae863e03d6f 100644 --- a/platform/platform-api/src/com/intellij/ui/jcef/JBCefApp.java +++ b/platform/platform-api/src/com/intellij/ui/jcef/JBCefApp.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.jcef; import com.intellij.notification.NotificationGroup; @@ -50,11 +50,11 @@ public final class JBCefApp { private static final int MIN_SUPPORTED_JCEF_API_MAJOR_VERSION = 1; private static final int MIN_SUPPORTED_JCEF_API_MINOR_VERSION = 12; - @NotNull private final CefApp myCefApp; + private final @NotNull CefApp myCefApp; - @NotNull private final CefSettings myCefSettings; + private final @NotNull CefSettings myCefSettings; - @NotNull private final Disposable myDisposable = new Disposable() { + private final @NotNull Disposable myDisposable = new Disposable() { @Override public void dispose() { myCefApp.dispose(); @@ -105,8 +105,7 @@ public final class JBCefApp { * * @throws IllegalStateException when JCEF initialization is not possible in current env */ - @NotNull - public static JBCefApp getInstance() { + public static @NotNull JBCefApp getInstance() { if (Holder.INSTANCE == null) { synchronized (Holder.class) { if (Holder.INSTANCE == null) { @@ -125,10 +124,9 @@ public final class JBCefApp { } private static final class Holder { - @Nullable static volatile JBCefApp INSTANCE = init(); + static volatile @Nullable JBCefApp INSTANCE = init(); - @Nullable - static JBCefApp init() { + static @Nullable JBCefApp init() { ourInitialized.set(true); JCefAppConfig config = null; if (isSupported()) { @@ -246,8 +244,7 @@ public final class JBCefApp { return myCefSettings.cache_path; } - @NotNull - public JBCefClient createClient() { + public @NotNull JBCefClient createClient() { return createClient(false); } diff --git a/platform/platform-api/src/com/intellij/ui/jcef/JBCefBrowser.java b/platform/platform-api/src/com/intellij/ui/jcef/JBCefBrowser.java index 7ac4c3d3e4d9..e9565ebdfbee 100644 --- a/platform/platform-api/src/com/intellij/ui/jcef/JBCefBrowser.java +++ b/platform/platform-api/src/com/intellij/ui/jcef/JBCefBrowser.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.jcef; import com.intellij.openapi.actionSystem.ActionManager; @@ -434,8 +434,7 @@ public class JBCefBrowser extends JBCefBrowserBase { } } - @NotNull - public JBCefBrowser getJBCefBrowser() { + public @NotNull JBCefBrowser getJBCefBrowser() { return JBCefBrowser.this; } } diff --git a/platform/platform-api/src/com/intellij/ui/jcef/JBCefBrowserBase.java b/platform/platform-api/src/com/intellij/ui/jcef/JBCefBrowserBase.java index cc7891051151..984477382fda 100644 --- a/platform/platform-api/src/com/intellij/ui/jcef/JBCefBrowserBase.java +++ b/platform/platform-api/src/com/intellij/ui/jcef/JBCefBrowserBase.java @@ -361,8 +361,7 @@ public abstract class JBCefBrowserBase implements JBCefDisposable { loadHTML(html, BLANK_URI); } - @NotNull - public final CefBrowser getCefBrowser() { + public final @NotNull CefBrowser getCefBrowser() { return myCefBrowser; } @@ -391,8 +390,7 @@ public abstract class JBCefBrowserBase implements JBCefDisposable { return Math.pow(ZOOM_COMMON_RATIO, myCefBrowser.getZoomLevel()); } - @NotNull - public final JBCefClient getJBCefClient() { + public final @NotNull JBCefClient getJBCefClient() { return myCefClient; } @@ -400,8 +398,7 @@ public abstract class JBCefBrowserBase implements JBCefDisposable { return new JBCefCookieManager(CefCookieManager.getGlobalManager()); } - @NotNull - public final JBCefCookieManager getJBCefCookieManager() { + public final @NotNull JBCefCookieManager getJBCefCookieManager() { myCookieManagerLock.lock(); try { if (myJBCefCookieManager == null) { @@ -536,8 +533,7 @@ public abstract class JBCefBrowserBase implements JBCefDisposable { /** * Returns {@code JBCefBrowser} instance associated with this {@code CefBrowser}. */ - @Nullable - public static JBCefBrowser getJBCefBrowser(@NotNull CefBrowser browser) { + public static @Nullable JBCefBrowser getJBCefBrowser(@NotNull CefBrowser browser) { Component uiComp = browser.getUIComponent(); if (uiComp != null) { Component parentComp = uiComp.getParent(); @@ -674,8 +670,7 @@ public abstract class JBCefBrowserBase implements JBCefDisposable { /** * @see #setProperty(String, Object) */ - @Nullable - public Object getProperty(@NotNull String name) { + public @Nullable Object getProperty(@NotNull String name) { return myPropertiesHelper.getProperty(name); } @@ -774,8 +769,8 @@ public abstract class JBCefBrowserBase implements JBCefDisposable { } private final class LoadDeferrer { - @Nullable private final String myHtml; - @NotNull private final String myUrl; + private final @Nullable String myHtml; + private final @NotNull String myUrl; private LoadDeferrer(@Nullable String html, @NotNull String url) { myHtml = html; diff --git a/platform/platform-api/src/com/intellij/ui/jcef/JBCefClient.java b/platform/platform-api/src/com/intellij/ui/jcef/JBCefClient.java index 96f04a728eb9..79b93188f028 100644 --- a/platform/platform-api/src/com/intellij/ui/jcef/JBCefClient.java +++ b/platform/platform-api/src/com/intellij/ui/jcef/JBCefClient.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.jcef; import com.intellij.openapi.diagnostic.Logger; @@ -61,16 +61,16 @@ public final class JBCefClient implements JBCefDisposable { } } - @NotNull private final PropertiesHelper myPropertiesHelper = new PropertiesHelper(); + private final @NotNull PropertiesHelper myPropertiesHelper = new PropertiesHelper(); private static final int JS_QUERY_POOL_DEFAULT_SIZE = RegistryManager.getInstance().intValue("ide.browser.jcef.jsQueryPoolSize"); private static final int JS_QUERY_POOL_MAX_SIZE = 10000; - @NotNull private final CefClient myCefClient; + private final @NotNull CefClient myCefClient; private final boolean myIsDefault; - @NotNull private final DisposeHelper myDisposeHelper = new DisposeHelper(); - @Nullable private volatile JSQueryPool myJSQueryPool; - @NotNull private final AtomicInteger myJSQueryCounter = new AtomicInteger(0); + private final @NotNull DisposeHelper myDisposeHelper = new DisposeHelper(); + private volatile @Nullable JSQueryPool myJSQueryPool; + private final @NotNull AtomicInteger myJSQueryCounter = new AtomicInteger(0); private final HandlerSupport myContextMenuHandler = new HandlerSupport<>(); private final HandlerSupport myDialogHandler = new HandlerSupport<>(); @@ -107,8 +107,7 @@ public final class JBCefClient implements JBCefDisposable { } } - @NotNull - public CefClient getCefClient() { + public @NotNull CefClient getCefClient() { return myCefClient; } @@ -145,8 +144,7 @@ public final class JBCefClient implements JBCefDisposable { /** * @see #setProperty(String, Object) */ - @Nullable - public Object getProperty(@NotNull String name) { + public @Nullable Object getProperty(@NotNull String name) { return myPropertiesHelper.getProperty(name); } @@ -178,8 +176,7 @@ public final class JBCefClient implements JBCefDisposable { private final List myPool; private final int mySizeLimit; - @Nullable - static JSQueryPool create(@NotNull JBCefClient client) { + static @Nullable JSQueryPool create(@NotNull JBCefClient client) { int poolSize = client.myPropertiesHelper.intValue(Properties.JS_QUERY_POOL_SIZE, JS_QUERY_POOL_DEFAULT_SIZE); if (poolSize > 0) { poolSize = Math.min(poolSize, JS_QUERY_POOL_MAX_SIZE); @@ -197,8 +194,7 @@ public final class JBCefClient implements JBCefDisposable { } } - @Nullable - public JSQueryFunc useFreeSlot() { + public @Nullable JSQueryFunc useFreeSlot() { if (myPool.isEmpty()) { LOG.warn("JavaScript query pool is over [size: " + mySizeLimit + "]", new Throwable()); return null; @@ -582,15 +578,14 @@ public final class JBCefClient implements JBCefDisposable { }); } - @Nullable @Override - public CefResourceRequestHandler getResourceRequestHandler(CefBrowser browser, - CefFrame frame, - CefRequest request, - boolean isNavigation, - boolean isDownload, - String requestInitiator, - BoolRef disableDefaultHandling) + public @Nullable CefResourceRequestHandler getResourceRequestHandler(CefBrowser browser, + CefFrame frame, + CefRequest request, + boolean isNavigation, + boolean isDownload, + String requestInitiator, + BoolRef disableDefaultHandling) { return myRequestHandler.handle(browser, handler -> { return handler.getResourceRequestHandler(browser, frame, request, isNavigation, isDownload, requestInitiator, disableDefaultHandling); @@ -725,13 +720,11 @@ public final class JBCefClient implements JBCefDisposable { } } - @Nullable - public List get(@NotNull CefBrowser browser) { + public @Nullable List get(@NotNull CefBrowser browser) { return myMap != null ? myMap.get(browser) : null; } - @Nullable - public R handle(@NotNull CefBrowser browser, @NotNull HandlerCallable callable) { + public @Nullable R handle(@NotNull CefBrowser browser, @NotNull HandlerCallable callable) { List list = get(browser); if (list == null) { return null; diff --git a/platform/platform-api/src/com/intellij/ui/jcef/JBCefCookie.java b/platform/platform-api/src/com/intellij/ui/jcef/JBCefCookie.java index ef82d3976c48..41cc096f0e4a 100644 --- a/platform/platform-api/src/com/intellij/ui/jcef/JBCefCookie.java +++ b/platform/platform-api/src/com/intellij/ui/jcef/JBCefCookie.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.jcef; import com.intellij.openapi.util.text.StringUtil; @@ -44,28 +44,23 @@ public final class JBCefCookie { this(name, value, domain, path, secure, httponly, null, null, false, null); } - @NotNull - public CefCookie getCefCookie() { + public @NotNull CefCookie getCefCookie() { return myCefCookie; } - @NotNull - public String getName() { + public @NotNull String getName() { return myCefCookie.name; } - @NotNull - public String getValue() { + public @NotNull String getValue() { return myCefCookie.value; } - @NotNull - public String getDomain() { + public @NotNull String getDomain() { return myCefCookie.domain; } - @NotNull - public String getPath() { + public @NotNull String getPath() { return myCefCookie.path; } @@ -77,13 +72,11 @@ public final class JBCefCookie { return myCefCookie.httponly; } - @Nullable - public Date getCreation() { + public @Nullable Date getCreation() { return myCefCookie.creation; } - @Nullable - public Date getLastAccess() { + public @Nullable Date getLastAccess() { return myCefCookie.lastAccess; } @@ -92,8 +85,7 @@ public final class JBCefCookie { return myCefCookie.hasExpires; } - @Nullable - public Date getExpires() { + public @Nullable Date getExpires() { return myCefCookie.expires; } diff --git a/platform/platform-api/src/com/intellij/ui/jcef/JBCefCookieManager.java b/platform/platform-api/src/com/intellij/ui/jcef/JBCefCookieManager.java index 46cc20c4be76..2e181d3b0a04 100644 --- a/platform/platform-api/src/com/intellij/ui/jcef/JBCefCookieManager.java +++ b/platform/platform-api/src/com/intellij/ui/jcef/JBCefCookieManager.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.jcef; import com.intellij.openapi.diagnostic.Logger; @@ -62,8 +62,7 @@ public final class JBCefCookieManager { } @SuppressWarnings("unused") - @NotNull - public CefCookieManager getCefCookieManager() { + public @NotNull CefCookieManager getCefCookieManager() { return myCefCookieManager; } diff --git a/platform/platform-api/src/com/intellij/ui/jcef/JBCefFileSchemeHandlerFactory.java b/platform/platform-api/src/com/intellij/ui/jcef/JBCefFileSchemeHandlerFactory.java index 02397593f1d9..360f4eb2bc1a 100644 --- a/platform/platform-api/src/com/intellij/ui/jcef/JBCefFileSchemeHandlerFactory.java +++ b/platform/platform-api/src/com/intellij/ui/jcef/JBCefFileSchemeHandlerFactory.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.jcef; import com.intellij.util.io.URLUtil; @@ -48,16 +48,14 @@ final class JBCefFileSchemeHandlerFactory implements CefSchemeHandlerFactory { return null; } - @NotNull - public static String registerLoadHTMLRequest(@NotNull CefBrowser browser, @NotNull String html, @NotNull String origUrl) { + public static @NotNull String registerLoadHTMLRequest(@NotNull CefBrowser browser, @NotNull String html, @NotNull String origUrl) { origUrl = normalizeUrl(origUrl); String fileUrl = makeFileUrl(origUrl); getInitMap(browser).put(fileUrl, html); return fileUrl; } - @NotNull - private static Map getInitMap(@NotNull CefBrowser browser) { + private static @NotNull Map getInitMap(@NotNull CefBrowser browser) { Map map = LOADHTML_REQUEST_MAP.get(browser); if (map == null) { synchronized (LOADHTML_REQUEST_MAP) { @@ -70,8 +68,7 @@ final class JBCefFileSchemeHandlerFactory implements CefSchemeHandlerFactory { return map; } - @NotNull - public static String makeFileUrl(@NotNull String url) { + public static @NotNull String makeFileUrl(@NotNull String url) { if (url.startsWith(FILE_SCHEME_NAME + URLUtil.SCHEME_SEPARATOR)) { return url; } @@ -79,8 +76,7 @@ final class JBCefFileSchemeHandlerFactory implements CefSchemeHandlerFactory { return normalizeUrl(LOADHTML_RANDOM_URL_PREFIX + new Random().nextInt(Integer.MAX_VALUE) + "#url=" + url); } - @NotNull - private static String normalizeUrl(@NotNull String url) { + private static @NotNull String normalizeUrl(@NotNull String url) { return url.replaceAll("/$", ""); } } diff --git a/platform/platform-api/src/com/intellij/ui/jcef/JBCefFpsMeter.java b/platform/platform-api/src/com/intellij/ui/jcef/JBCefFpsMeter.java index fb7f578cd676..221b8a170e40 100644 --- a/platform/platform-api/src/com/intellij/ui/jcef/JBCefFpsMeter.java +++ b/platform/platform-api/src/com/intellij/ui/jcef/JBCefFpsMeter.java @@ -10,11 +10,12 @@ import org.jetbrains.annotations.Nullable; import sun.awt.AWTAccessor; import javax.swing.*; -import javax.swing.Timer; import java.awt.*; import java.io.PrintStream; import java.lang.ref.WeakReference; -import java.util.*; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; @@ -47,7 +48,7 @@ public abstract class JBCefFpsMeter { public abstract void registerComponent(@NotNull Component component); - public synchronized static @NotNull JBCefFpsMeter register(@NotNull String id) { + public static synchronized @NotNull JBCefFpsMeter register(@NotNull String id) { JBCefFpsMeter instance = INSTANCES.get(id); if (instance != null) { return instance; @@ -57,7 +58,7 @@ public abstract class JBCefFpsMeter { return instance; } - public synchronized static @Nullable JBCefFpsMeter get(@NotNull String id) { + public static synchronized @Nullable JBCefFpsMeter get(@NotNull String id) { JBCefFpsMeter instance = INSTANCES.get(id); if (instance == null) { Logger.getInstance(JBCefFpsMeter.class).warn(JBCefFpsMeter.class + " not registered: " + id); diff --git a/platform/platform-api/src/com/intellij/ui/jcef/JBCefJSQuery.java b/platform/platform-api/src/com/intellij/ui/jcef/JBCefJSQuery.java index 7503fe4d0910..a1c1e4c954e2 100644 --- a/platform/platform-api/src/com/intellij/ui/jcef/JBCefJSQuery.java +++ b/platform/platform-api/src/com/intellij/ui/jcef/JBCefJSQuery.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.jcef; import com.intellij.openapi.diagnostic.Logger; @@ -23,7 +23,7 @@ import java.util.function.Function; * @author tav */ public final class JBCefJSQuery implements JBCefDisposable { - static private final boolean DEBUG_JS = Boolean.getBoolean("ide.browser.jcef.debug.js"); + private static final boolean DEBUG_JS = Boolean.getBoolean("ide.browser.jcef.debug.js"); private final @NotNull JSQueryFunc myFunc; private final @NotNull JBCefClient myJBCefClient; @@ -41,8 +41,7 @@ public final class JBCefJSQuery implements JBCefDisposable { /** * @return name of the global function JS must call to send query to Java */ - @NotNull - public String getFuncName() { + public @NotNull String getFuncName() { return myFunc.myFuncName; } @@ -52,8 +51,7 @@ public final class JBCefJSQuery implements JBCefDisposable { * @param browser the associated CEF browser * @see JBCefClient.Properties#JS_QUERY_POOL_SIZE */ - @NotNull - public static JBCefJSQuery create(@NotNull JBCefBrowserBase browser) { + public static @NotNull JBCefJSQuery create(@NotNull JBCefBrowserBase browser) { Function create = (v) -> { return new JBCefJSQuery(browser, new JSQueryFunc(browser.getJBCefClient())); }; @@ -85,8 +83,7 @@ public final class JBCefJSQuery implements JBCefDisposable { * * @param queryResult the result (JS variable name, or JS value in single quotes) that will be passed to the Java handler {@link #addHandler(Function)} */ - @NotNull - public String inject(@Nullable String queryResult) { + public @NotNull String inject(@Nullable String queryResult) { return inject(queryResult, "function(response) {}", "function(error_code, error_message) {}"); } @@ -97,8 +94,7 @@ public final class JBCefJSQuery implements JBCefDisposable { * @param onSuccessCallback JS callback in format: {@code function(response) {}} * @param onFailureCallback JS callback in format: {@code function(error_code, error_message) {}} */ - @NotNull - public String inject(@Nullable String queryResult, @NotNull String onSuccessCallback, @NotNull String onFailureCallback) { + public @NotNull String inject(@Nullable String queryResult, @NotNull String onSuccessCallback, @NotNull String onFailureCallback) { checkDisposed(); if (queryResult != null && queryResult.isEmpty()) queryResult = "''"; @@ -195,9 +191,9 @@ public final class JBCefJSQuery implements JBCefDisposable { public static class Response { public static final int ERR_CODE_SUCCESS = 0; - @Nullable private final String myResponse; + private final @Nullable String myResponse; private final int myErrCode; - @Nullable private final String myErrMsg; + private final @Nullable String myErrMsg; public Response(@Nullable String response) { @@ -210,8 +206,7 @@ public final class JBCefJSQuery implements JBCefDisposable { myErrMsg = errMsg; } - @Nullable - public String response() { + public @Nullable String response() { return myResponse; } @@ -219,8 +214,7 @@ public final class JBCefJSQuery implements JBCefDisposable { return myErrCode; } - @Nullable - public String errMsg() { + public @Nullable String errMsg() { return myErrMsg; } diff --git a/platform/platform-api/src/com/intellij/ui/jcef/JBCefLoadHtmlResourceHandler.java b/platform/platform-api/src/com/intellij/ui/jcef/JBCefLoadHtmlResourceHandler.java index 10d867da2f70..284258a45498 100644 --- a/platform/platform-api/src/com/intellij/ui/jcef/JBCefLoadHtmlResourceHandler.java +++ b/platform/platform-api/src/com/intellij/ui/jcef/JBCefLoadHtmlResourceHandler.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.jcef; import com.intellij.openapi.diagnostic.Logger; @@ -23,7 +23,7 @@ import java.nio.charset.StandardCharsets; final class JBCefLoadHtmlResourceHandler extends CefResourceHandlerAdapter { private static final Logger LOG = Logger.getInstance(JBCefLoadHtmlResourceHandler.class.getName()); - @NotNull private final InputStream myInputStream; + private final @NotNull InputStream myInputStream; JBCefLoadHtmlResourceHandler(@NotNull String html) { myInputStream = new ByteArrayInputStream(html.getBytes(StandardCharsets.UTF_8)); diff --git a/platform/platform-api/src/com/intellij/ui/jcef/JBCefOsrComponent.java b/platform/platform-api/src/com/intellij/ui/jcef/JBCefOsrComponent.java index 3d5f546f471a..fc1561e16be3 100644 --- a/platform/platform-api/src/com/intellij/ui/jcef/JBCefOsrComponent.java +++ b/platform/platform-api/src/com/intellij/ui/jcef/JBCefOsrComponent.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.jcef; import com.intellij.openapi.Disposable; @@ -336,9 +336,8 @@ class JBCefOsrComponent extends JPanel { return candidateWindowPosition; } - @Nullable @Override - public TextHitInfo getLocationOffset(int x, int y) { + public @Nullable TextHitInfo getLocationOffset(int x, int y) { Point p = new Point(x, y); var componentLocation = getLocationOnScreen(); p.translate(-componentLocation.x, -componentLocation.y); @@ -374,17 +373,15 @@ class JBCefOsrComponent extends JPanel { return 0; } - @Nullable @Override - public AttributedCharacterIterator cancelLatestCommittedText(AttributedCharacterIterator.Attribute[] attributes) { + public @Nullable AttributedCharacterIterator cancelLatestCommittedText(AttributedCharacterIterator.Attribute[] attributes) { System.out.println("cancelLatestCommittedText"); myBrowser.ImeCancelComposing(); return null; } - @Nullable @Override - public AttributedCharacterIterator getSelectedText(AttributedCharacterIterator.Attribute[] attributes) { + public @Nullable AttributedCharacterIterator getSelectedText(AttributedCharacterIterator.Attribute[] attributes) { return new AttributedString(myRenderHandler.getSelectedText()).getIterator(); } diff --git a/platform/platform-api/src/com/intellij/ui/jcef/JBCefOsrHandler.java b/platform/platform-api/src/com/intellij/ui/jcef/JBCefOsrHandler.java index 4831985d11b3..51dc9e62ac26 100644 --- a/platform/platform-api/src/com/intellij/ui/jcef/JBCefOsrHandler.java +++ b/platform/platform-api/src/com/intellij/ui/jcef/JBCefOsrHandler.java @@ -257,7 +257,7 @@ class JBCefOsrHandler implements CefRenderHandler { return myLocationOnScreenRef.get().getLocation(); } - static private @NotNull Dimension getRealImageSize(JBHiDPIScaledImage image) { + private static @NotNull Dimension getRealImageSize(JBHiDPIScaledImage image) { if (image == null) return new Dimension(0, 0); BufferedImage bi = (BufferedImage)image.getDelegate(); assert bi != null; diff --git a/platform/platform-api/src/com/intellij/ui/jcef/JBCefOsrHandlerBrowser.java b/platform/platform-api/src/com/intellij/ui/jcef/JBCefOsrHandlerBrowser.java index 7b7067053bc9..9d5e1fef1f18 100644 --- a/platform/platform-api/src/com/intellij/ui/jcef/JBCefOsrHandlerBrowser.java +++ b/platform/platform-api/src/com/intellij/ui/jcef/JBCefOsrHandlerBrowser.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.jcef; import org.cef.browser.CefBrowser; @@ -32,8 +32,7 @@ public abstract class JBCefOsrHandlerBrowser extends JBCefBrowserBase { * In order to use {@link JBCefJSQuery} create the browser via {@link #create(String, CefRenderHandler, boolean)} or * {@link #create(String, CefRenderHandler, JBCefClient, boolean)}. */ - @NotNull - public static JBCefOsrHandlerBrowser create(@NotNull String url, @NotNull CefRenderHandler renderHandler) { + public static @NotNull JBCefOsrHandlerBrowser create(@NotNull String url, @NotNull CefRenderHandler renderHandler) { return create(url, renderHandler, true); } @@ -47,8 +46,7 @@ public abstract class JBCefOsrHandlerBrowser extends JBCefBrowserBase { * * @see CefBrowser#createImmediately() */ - @NotNull - public static JBCefOsrHandlerBrowser create(@NotNull String url, @NotNull CefRenderHandler renderHandler, boolean createImmediately) { + public static @NotNull JBCefOsrHandlerBrowser create(@NotNull String url, @NotNull CefRenderHandler renderHandler, boolean createImmediately) { return new JBCefOsrHandlerBrowser(null, url, renderHandler, createImmediately) { @Override public @Nullable JComponent getComponent() { @@ -62,8 +60,7 @@ public abstract class JBCefOsrHandlerBrowser extends JBCefBrowserBase { *

* In order to use {@link JBCefJSQuery} set {@link JBCefClient.Properties#JS_QUERY_POOL_SIZE} before passing the client. */ - @NotNull - public static JBCefOsrHandlerBrowser create(@NotNull String url, @NotNull CefRenderHandler renderHandler, @NotNull JBCefClient client) { + public static @NotNull JBCefOsrHandlerBrowser create(@NotNull String url, @NotNull CefRenderHandler renderHandler, @NotNull JBCefClient client) { return create(url, renderHandler, client, true); } @@ -78,8 +75,7 @@ public abstract class JBCefOsrHandlerBrowser extends JBCefBrowserBase { * * @see CefBrowser#createImmediately() */ - @NotNull - public static JBCefOsrHandlerBrowser create(@NotNull String url, + public static @NotNull JBCefOsrHandlerBrowser create(@NotNull String url, @NotNull CefRenderHandler renderHandler, @NotNull JBCefClient client, boolean createImmediately) diff --git a/platform/platform-api/src/com/intellij/ui/jcef/PropertiesHelper.java b/platform/platform-api/src/com/intellij/ui/jcef/PropertiesHelper.java index 088b94b3f3fe..77541140634a 100644 --- a/platform/platform-api/src/com/intellij/ui/jcef/PropertiesHelper.java +++ b/platform/platform-api/src/com/intellij/ui/jcef/PropertiesHelper.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.jcef; import org.jetbrains.annotations.NotNull; @@ -11,10 +11,10 @@ import java.util.HashMap; import java.util.Map; final class PropertiesHelper { - @NotNull private static final Map> TYPES = Collections.synchronizedMap(new HashMap<>()); + private static final @NotNull Map> TYPES = Collections.synchronizedMap(new HashMap<>()); - @NotNull private final Map myProperties = new HashMap<>(); - @NotNull private final PropertyChangeSupport myPropertyChangeSupport = new PropertyChangeSupport(this); + private final @NotNull Map myProperties = new HashMap<>(); + private final @NotNull PropertyChangeSupport myPropertyChangeSupport = new PropertyChangeSupport(this); void setProperty(@NotNull String name, @Nullable Object value) { // only known properties are validated diff --git a/platform/platform-api/src/com/intellij/ui/mac/screenmenu/MenuBar.java b/platform/platform-api/src/com/intellij/ui/mac/screenmenu/MenuBar.java index 2429b428461c..9ab4d7fcec32 100644 --- a/platform/platform-api/src/com/intellij/ui/mac/screenmenu/MenuBar.java +++ b/platform/platform-api/src/com/intellij/ui/mac/screenmenu/MenuBar.java @@ -13,7 +13,7 @@ import java.util.Arrays; @SuppressWarnings("NonPrivateFieldAccessedInSynchronizedContext") public final class MenuBar extends Menu { - static private long[] ourLastMenubarPeers = null; + private static long[] ourLastMenubarPeers = null; private Window myFrame; private final WindowListener myListener; diff --git a/platform/platform-api/src/com/intellij/ui/mac/screenmenu/MenuItem.java b/platform/platform-api/src/com/intellij/ui/mac/screenmenu/MenuItem.java index 83ad298b581a..d96fe407b728 100644 --- a/platform/platform-api/src/com/intellij/ui/mac/screenmenu/MenuItem.java +++ b/platform/platform-api/src/com/intellij/ui/mac/screenmenu/MenuItem.java @@ -143,8 +143,7 @@ public class MenuItem implements Disposable, PropertyChangeListener { } @Override - synchronized - public void dispose() { + public synchronized void dispose() { if (presentation != null) presentation.removePropertyChangeListener(this); presentation = null; diff --git a/platform/platform-api/src/com/intellij/ui/navigation/BackAction.java b/platform/platform-api/src/com/intellij/ui/navigation/BackAction.java index 699244219f44..c19c06e97b6e 100644 --- a/platform/platform-api/src/com/intellij/ui/navigation/BackAction.java +++ b/platform/platform-api/src/com/intellij/ui/navigation/BackAction.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.navigation; import com.intellij.openapi.Disposable; @@ -25,7 +25,7 @@ public class BackAction extends NavigationAction { } @Override - public void actionPerformed(@NotNull final AnActionEvent e) { + public void actionPerformed(final @NotNull AnActionEvent e) { getHistory(e).back(); } } diff --git a/platform/platform-api/src/com/intellij/ui/navigation/ForwardAction.java b/platform/platform-api/src/com/intellij/ui/navigation/ForwardAction.java index 7d1507d7ff46..b8d43c623166 100644 --- a/platform/platform-api/src/com/intellij/ui/navigation/ForwardAction.java +++ b/platform/platform-api/src/com/intellij/ui/navigation/ForwardAction.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.navigation; import com.intellij.openapi.Disposable; @@ -25,7 +25,7 @@ public class ForwardAction extends NavigationAction { } @Override - public void actionPerformed(@NotNull final AnActionEvent e) { + public void actionPerformed(final @NotNull AnActionEvent e) { getHistory(e).forward(); } } \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/ui/navigation/History.java b/platform/platform-api/src/com/intellij/ui/navigation/History.java index 9b14aa119e06..28d170e6aa6a 100644 --- a/platform/platform-api/src/com/intellij/ui/navigation/History.java +++ b/platform/platform-api/src/com/intellij/ui/navigation/History.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.navigation; import com.intellij.openapi.Disposable; @@ -152,8 +152,7 @@ public final class History { return checkPlace != null && checkPlace.getPath(pathElement) != null; } - @Nullable - private Place getCheckPlace(String pathElement) { + private @Nullable Place getCheckPlace(String pathElement) { Place checkPlace = getCurrent(); if (checkPlace == null || checkPlace.getPath(pathElement) == null) { checkPlace = query(); diff --git a/platform/platform-api/src/com/intellij/ui/navigation/NavigationAction.java b/platform/platform-api/src/com/intellij/ui/navigation/NavigationAction.java index 1e1b9cc516cd..92e5e3b6d81f 100644 --- a/platform/platform-api/src/com/intellij/ui/navigation/NavigationAction.java +++ b/platform/platform-api/src/com/intellij/ui/navigation/NavigationAction.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.navigation; import com.intellij.openapi.Disposable; @@ -24,7 +24,7 @@ abstract class NavigationAction extends AnAction implements DumbAware { } @Override - public final void update(@NotNull final AnActionEvent e) { + public final void update(final @NotNull AnActionEvent e) { e.getPresentation().setEnabled(getHistory(e) != null); if (e.getPresentation().isEnabled()) { doUpdate(e); @@ -33,8 +33,7 @@ abstract class NavigationAction extends AnAction implements DumbAware { protected abstract void doUpdate(final AnActionEvent e); - @Nullable - protected static History getHistory(final AnActionEvent e) { + protected static @Nullable History getHistory(final AnActionEvent e) { return e.getData(History.KEY); } } diff --git a/platform/platform-api/src/com/intellij/ui/navigation/Place.java b/platform/platform-api/src/com/intellij/ui/navigation/Place.java index ab1b43917ca4..efbd6afeed56 100644 --- a/platform/platform-api/src/com/intellij/ui/navigation/Place.java +++ b/platform/platform-api/src/com/intellij/ui/navigation/Place.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.navigation; import com.intellij.openapi.util.ActionCallback; @@ -28,14 +28,12 @@ public final class Place implements ComparableObject { return ComparableObjectCheck.hashCode(this, super.hashCode()); } - @NotNull - public Place putPath(String name, Object value) { + public @NotNull Place putPath(String name, Object value) { myPath.put(name, value); return this; } - @Nullable - public + public @Nullable Object getPath(String name) { return myPath.get(name); } @@ -76,8 +74,7 @@ public final class Place implements ComparableObject { default void setHistory(History history) { } - @Nullable - default ActionCallback navigateTo(@Nullable Place place, boolean requestFocus) { + default @Nullable ActionCallback navigateTo(@Nullable Place place, boolean requestFocus) { return null; } diff --git a/platform/platform-api/src/com/intellij/ui/popup/HintUpdateSupply.java b/platform/platform-api/src/com/intellij/ui/popup/HintUpdateSupply.java index 20e2850150e9..b8f9bdd3bbbd 100644 --- a/platform/platform-api/src/com/intellij/ui/popup/HintUpdateSupply.java +++ b/platform/platform-api/src/com/intellij/ui/popup/HintUpdateSupply.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.popup; import com.intellij.ide.DataManager; @@ -46,12 +32,10 @@ import javax.swing.tree.TreePath; public abstract class HintUpdateSupply { private static final Key HINT_UPDATE_MARKER = Key.create("HINT_UPDATE_MARKER"); - @Nullable - private JBPopup myHint; + private @Nullable JBPopup myHint; private JComponent myComponent; - @Nullable - public static HintUpdateSupply getSupply(@NotNull JComponent component) { + public static @Nullable HintUpdateSupply getSupply(@NotNull JComponent component) { return (HintUpdateSupply)component.getClientProperty(HINT_UPDATE_MARKER); } @@ -70,11 +54,10 @@ public abstract class HintUpdateSupply { CommonDataKeys.PSI_ELEMENT.getData(DataManager.getInstance().getDataContext(component))); } - public static void installHintUpdateSupply(@NotNull final JComponent component, final Function provider) { + public static void installHintUpdateSupply(final @NotNull JComponent component, final Function provider) { HintUpdateSupply supply = new HintUpdateSupply(component) { - @Nullable @Override - protected PsiElement getPsiElementForHint(@Nullable Object selectedValue) { + protected @Nullable PsiElement getPsiElementForHint(@Nullable Object selectedValue) { return provider.fun(selectedValue); } }; @@ -102,7 +85,7 @@ public abstract class HintUpdateSupply { installListListener(list); } - protected void installTableListener(@NotNull final JTable table) { + protected void installTableListener(final @NotNull JTable table) { ListSelectionListener listener = new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent e) { @@ -122,7 +105,7 @@ public abstract class HintUpdateSupply { table.getColumnModel().getSelectionModel().addListSelectionListener(listener); } - protected void installTreeListener(@NotNull final JTree tree) { + protected void installTreeListener(final @NotNull JTree tree) { tree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(final TreeSelectionEvent e) { @@ -156,8 +139,7 @@ public abstract class HintUpdateSupply { }); } - @Nullable - protected abstract PsiElement getPsiElementForHint(@Nullable Object selectedValue); + protected abstract @Nullable PsiElement getPsiElementForHint(@Nullable Object selectedValue); private void installSupply(@NotNull JComponent component) { component.putClientProperty(HINT_UPDATE_MARKER, this); diff --git a/platform/platform-api/src/com/intellij/ui/popup/list/GroupedItemsListRenderer.java b/platform/platform-api/src/com/intellij/ui/popup/list/GroupedItemsListRenderer.java index 327211d5d9e3..350cf69aa3ec 100644 --- a/platform/platform-api/src/com/intellij/ui/popup/list/GroupedItemsListRenderer.java +++ b/platform/platform-api/src/com/intellij/ui/popup/list/GroupedItemsListRenderer.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.popup.list; import com.intellij.openapi.ui.popup.ListItemDescriptor; @@ -72,8 +58,7 @@ public class GroupedItemsListRenderer extends GroupedElementsRenderer.List im return myDescriptor.hasSeparatorAboveOf(value); } - @Nullable - protected Icon getItemIcon(E value, boolean isSelected) { + protected @Nullable Icon getItemIcon(E value, boolean isSelected) { return isSelected ? IconUtil.wrapToSelectionAwareIcon(myDescriptor.getSelectedIconFor(value)) : myDescriptor.getIconFor(value); } diff --git a/platform/platform-api/src/com/intellij/ui/scroll/MouseWheelSmoothScroll.java b/platform/platform-api/src/com/intellij/ui/scroll/MouseWheelSmoothScroll.java index e6f185edc7c0..b3bc877a8fee 100644 --- a/platform/platform-api/src/com/intellij/ui/scroll/MouseWheelSmoothScroll.java +++ b/platform/platform-api/src/com/intellij/ui/scroll/MouseWheelSmoothScroll.java @@ -223,9 +223,8 @@ public final class MouseWheelSmoothScroll { : UISettingsStateKt.getDefaultAnimatedScrollingDuration(); } - @NotNull @Override - public Easing getEasing() { + public @NotNull Easing getEasing() { int points = UISettings.getShadowInstance().getAnimatedScrollingCurvePoints(); if (points != curvePoints || ourEasing == null) { double x1 = (points >> 24 & 0xFF) / 200.0; diff --git a/platform/platform-api/src/com/intellij/ui/scroll/TouchScroll.java b/platform/platform-api/src/com/intellij/ui/scroll/TouchScroll.java index 1f9e6520d657..1aa97e0cd258 100644 --- a/platform/platform-api/src/com/intellij/ui/scroll/TouchScroll.java +++ b/platform/platform-api/src/com/intellij/ui/scroll/TouchScroll.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.scroll; import com.intellij.openapi.util.registry.Registry; @@ -124,9 +124,8 @@ public final class TouchScroll { return max(abs(Registry.doubleValue("idea.inertial.smooth.scrolling.touch.duration")), 0); } - @NotNull @Override - public Easing getEasing() { + public @NotNull Easing getEasing() { if (cubicEaseOut == null) { cubicEaseOut = new CubicBezierEasing(0.215, 0.61, 0.355, 1, 2000); } diff --git a/platform/platform-api/src/com/intellij/ui/speedSearch/ElementFilter.java b/platform/platform-api/src/com/intellij/ui/speedSearch/ElementFilter.java index 60c5e681a2bc..0d3e30732642 100644 --- a/platform/platform-api/src/com/intellij/ui/speedSearch/ElementFilter.java +++ b/platform/platform-api/src/com/intellij/ui/speedSearch/ElementFilter.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.speedSearch; import com.intellij.openapi.Disposable; @@ -17,7 +17,7 @@ public interface ElementFilter { interface Active extends ElementFilter { @NotNull - Promise fireUpdate(@Nullable final T preferredSelection, final boolean adjustSelection, final boolean now); + Promise fireUpdate(final @Nullable T preferredSelection, final boolean adjustSelection, final boolean now); void addListener(Listener listener, Disposable parent); @@ -25,8 +25,7 @@ public interface ElementFilter { Set> myListeners = new CopyOnWriteArraySet<>(); @Override - @NotNull - public Promise fireUpdate(@Nullable T preferredSelection, boolean adjustSelection, boolean now) { + public @NotNull Promise fireUpdate(@Nullable T preferredSelection, boolean adjustSelection, boolean now) { return Promises.all(ContainerUtil.map(myListeners, listener -> listener.update(preferredSelection, adjustSelection, now))); } @@ -45,6 +44,6 @@ public interface ElementFilter { interface Listener { @NotNull - Promise update(@Nullable final T preferredSelection, final boolean adjustSelection, final boolean now); + Promise update(final @Nullable T preferredSelection, final boolean adjustSelection, final boolean now); } } \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/ui/speedSearch/FilteringListModel.java b/platform/platform-api/src/com/intellij/ui/speedSearch/FilteringListModel.java index f0b4066f3ed6..52932eb1453d 100644 --- a/platform/platform-api/src/com/intellij/ui/speedSearch/FilteringListModel.java +++ b/platform/platform-api/src/com/intellij/ui/speedSearch/FilteringListModel.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.speedSearch; import com.intellij.openapi.util.Condition; @@ -72,8 +72,7 @@ public class FilteringListModel extends AbstractListModel { } } - @NotNull - protected Collection getElementsToFilter() { + protected @NotNull Collection getElementsToFilter() { ArrayList result = new ArrayList<>(); for (int i = 0; i < myOriginalModel.getSize(); i++) { result.add(myOriginalModel.getElementAt(i)); @@ -107,8 +106,7 @@ public class FilteringListModel extends AbstractListModel { return myData.contains(value); } - @NotNull - public ListModel getOriginalModel() { + public @NotNull ListModel getOriginalModel() { return myOriginalModel; } diff --git a/platform/platform-api/src/com/intellij/ui/speedSearch/ListWithFilter.java b/platform/platform-api/src/com/intellij/ui/speedSearch/ListWithFilter.java index 0c6eaa6116c2..059a2a6a86ef 100644 --- a/platform/platform-api/src/com/intellij/ui/speedSearch/ListWithFilter.java +++ b/platform/platform-api/src/com/intellij/ui/speedSearch/ListWithFilter.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.speedSearch; import com.intellij.openapi.actionSystem.DataProvider; @@ -42,28 +42,25 @@ public final class ListWithFilter extends JPanel implements DataProvider { return null; } - @NotNull - public static JComponent wrap(@NotNull JList list, - @NotNull JScrollPane scrollPane, - @Nullable Function namer) { + public static @NotNull JComponent wrap(@NotNull JList list, + @NotNull JScrollPane scrollPane, + @Nullable Function namer) { return wrap(list, scrollPane, namer, false); } - @NotNull - public static JComponent wrap(@NotNull JList list, - @NotNull JScrollPane scrollPane, - @Nullable Function namer, - boolean highlightAllOccurrences) { + public static @NotNull JComponent wrap(@NotNull JList list, + @NotNull JScrollPane scrollPane, + @Nullable Function namer, + boolean highlightAllOccurrences) { return new ListWithFilter<>(list, scrollPane, namer, highlightAllOccurrences, false, false); } - @NotNull - public static JComponent wrap(@NotNull JList list, - @NotNull JScrollPane scrollPane, - @Nullable Function namer, - boolean highlightAllOccurrences, - boolean searchFieldAlwaysVisible, - boolean searchFieldWithoutBorder) { + public static @NotNull JComponent wrap(@NotNull JList list, + @NotNull JScrollPane scrollPane, + @Nullable Function namer, + boolean highlightAllOccurrences, + boolean searchFieldAlwaysVisible, + boolean searchFieldWithoutBorder) { return new ListWithFilter<>(list, scrollPane, namer, highlightAllOccurrences, searchFieldAlwaysVisible, searchFieldWithoutBorder); } @@ -221,13 +218,11 @@ public final class ListWithFilter extends JPanel implements DataProvider { } } - @NotNull - public JList getList() { + public @NotNull JList getList() { return myList; } - @NotNull - public JScrollPane getScrollPane() { + public @NotNull JScrollPane getScrollPane() { return myScrollPane; } diff --git a/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearch.java b/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearch.java index 6dd0bc2a7ea1..6456d536ede0 100644 --- a/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearch.java +++ b/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearch.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.speedSearch; import com.intellij.openapi.keymap.KeymapUtil; @@ -144,14 +144,12 @@ public class SpeedSearch extends SpeedSearchSupply implements KeyListener { fireStateChanged(prevString); } - @Nullable - public Matcher getMatcher() { + public @Nullable Matcher getMatcher() { return myMatcher; } - @Nullable @Override - public Iterable matchingFragments(@NotNull String text) { + public @Nullable Iterable matchingFragments(@NotNull String text) { if (myMatcher instanceof MinusculeMatcher) { return ((MinusculeMatcher)myMatcher).matchingFragments(text); } @@ -167,9 +165,8 @@ public class SpeedSearch extends SpeedSearchSupply implements KeyListener { return isHoldingFilter(); } - @Nullable @Override - public String getEnteredPrefix() { + public @Nullable String getEnteredPrefix() { return myString; } diff --git a/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchSupply.java b/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchSupply.java index efaf147484ab..0609b944dcbb 100644 --- a/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchSupply.java +++ b/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchSupply.java @@ -39,13 +39,11 @@ public abstract class SpeedSearchSupply { protected static final JBColor ERROR_FOREGROUND_COLOR = namedColor("SpeedSearch.errorForeground", namedColor("SearchField.errorForeground", JBColor.RED)); - @Nullable - public static SpeedSearchSupply getSupply(@NotNull final JComponent component) { + public static @Nullable SpeedSearchSupply getSupply(final @NotNull JComponent component) { return getSupply(component, false); } - @Nullable - public static SpeedSearchSupply getSupply(@NotNull final JComponent component, boolean evenIfInactive) { + public static @Nullable SpeedSearchSupply getSupply(final @NotNull JComponent component, boolean evenIfInactive) { SpeedSearchSupply speedSearch = (SpeedSearchSupply)component.getClientProperty(SPEED_SEARCH_COMPONENT_MARKER); if (evenIfInactive) { @@ -55,8 +53,7 @@ public abstract class SpeedSearchSupply { return speedSearch != null && speedSearch.isPopupActive() ? speedSearch : null; } - @Nullable - public abstract Iterable matchingFragments(@NotNull final String text); + public abstract @Nullable Iterable matchingFragments(final @NotNull String text); /** * Selects element according to search criteria changes @@ -65,8 +62,7 @@ public abstract class SpeedSearchSupply { public abstract boolean isPopupActive(); - @Nullable - public String getEnteredPrefix() { + public @Nullable String getEnteredPrefix() { return null; } diff --git a/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchUtil.java b/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchUtil.java index 11c8dc84eec2..553e93ef4e7b 100644 --- a/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchUtil.java +++ b/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearchUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.speedSearch; import com.intellij.openapi.util.NlsContexts; @@ -105,7 +105,7 @@ public final class SpeedSearchUtil { public static void appendColoredFragmentForMatcher(@NotNull @NlsContexts.Label String text, SimpleColoredComponent component, - @NotNull final SimpleTextAttributes attributes, + final @NotNull SimpleTextAttributes attributes, @Nullable Matcher matcher, Color selectedBg, boolean selected) { diff --git a/platform/platform-api/src/com/intellij/ui/table/BaseTableView.java b/platform/platform-api/src/com/intellij/ui/table/BaseTableView.java index a41d920a09b5..da3a433bf4d0 100644 --- a/platform/platform-api/src/com/intellij/ui/table/BaseTableView.java +++ b/platform/platform-api/src/com/intellij/ui/table/BaseTableView.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.table; import com.intellij.ide.util.PropertiesComponent; @@ -30,13 +30,11 @@ public class BaseTableView extends JBTable { super(model, columnModel); } - @NonNls - private static String orderPropertyName(final int index) { + private static @NonNls String orderPropertyName(final int index) { return "Order"+index; } - @NonNls - private static String widthPropertyName(int index) { + private static @NonNls String widthPropertyName(int index) { return "Width" + index; } diff --git a/platform/platform-api/src/com/intellij/ui/table/JBTable.java b/platform/platform-api/src/com/intellij/ui/table/JBTable.java index 4f2b970ae9af..367f594bb16c 100644 --- a/platform/platform-api/src/com/intellij/ui/table/JBTable.java +++ b/platform/platform-api/src/com/intellij/ui/table/JBTable.java @@ -158,7 +158,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component final TableModelListener modelListener = new TableModelListener() { @Override - public void tableChanged(@NotNull final TableModelEvent e) { + public void tableChanged(final @NotNull TableModelEvent e) { onTableChanged(e); } }; @@ -194,8 +194,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component } } - @NotNull - protected ExpandableItemsHandler createExpandableItemsHandler() { + protected @NotNull ExpandableItemsHandler createExpandableItemsHandler() { return ExpandableItemsHandlerFactory.install(this); } @@ -322,9 +321,8 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component } } - @NotNull @Override - protected JTableHeader createDefaultTableHeader() { + protected @NotNull JTableHeader createDefaultTableHeader() { return new JBTableHeader(); } @@ -510,15 +508,13 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component }); } - @NotNull @Override - public StatusText getEmptyText() { + public @NotNull StatusText getEmptyText() { return myEmptyText; } @Override - @NotNull - public ExpandableItemsHandler getExpandableItemsHandler() { + public @NotNull ExpandableItemsHandler getExpandableItemsHandler() { return myExpandableItemsHandler; } @@ -617,8 +613,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component } } - @NotNull - protected AsyncProcessIcon createBusyIcon() { + protected @NotNull AsyncProcessIcon createBusyIcon() { return new AsyncProcessIcon(toString()); } @@ -731,9 +726,8 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component || UIUtil.isUnderIntelliJLaF(); } - @NotNull @Override - public Component prepareRenderer(@NotNull TableCellRenderer renderer, int row, int column) { + public @NotNull Component prepareRenderer(@NotNull TableCellRenderer renderer, int row, int column) { Component result = super.prepareRenderer(renderer, row, column); if (result instanceof JComponent component && !isCellSelected(row, column)) { @@ -768,8 +762,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component return result; } - @Nullable - protected Color getStripeColor() { + protected @Nullable Color getStripeColor() { return UIUtil.getDecoratedRowColor(); } @@ -835,7 +828,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component } @Override - public void propertyChange(@NotNull final PropertyChangeEvent e) { + public void propertyChange(final @NotNull PropertyChangeEvent e) { if ("tableCellEditor".equals(e.getPropertyName())) { tableCellEditorChanged(e.getOldValue(), e.getNewValue()); } @@ -905,7 +898,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component private final class MyMouseListener extends MouseAdapter { @Override - public void mousePressed(@NotNull final MouseEvent e) { + public void mousePressed(final @NotNull MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { final int[] selectedRows = getSelectedRows(); if (selectedRows.length < 2) { @@ -1000,9 +993,8 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component return myModel.getValueAt(row, column); } - @NotNull @Override - public String getStringValueAt(int row, int column) { + public @NotNull String getStringValueAt(int row, int column) { TableStringConverter converter = getStringConverter(); if (converter != null) { // Use the converter @@ -1097,7 +1089,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component } @Override - public String getToolTipText(@NotNull final MouseEvent event) { + public String getToolTipText(final @NotNull MouseEvent event) { ColumnInfo[] columnInfos = getColumnInfos(); if (columnInfos != null) { final int i = columnAtPoint(event.getPoint()); @@ -1203,8 +1195,8 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component } protected class InvisibleResizableHeader extends JBTableHeader { - @NotNull private final MyBasicTableHeaderUI myHeaderUI; - @Nullable private Cursor myCursor = null; + private final @NotNull MyBasicTableHeaderUI myHeaderUI; + private @Nullable Cursor myCursor = null; public InvisibleResizableHeader() { myHeaderUI = new MyBasicTableHeaderUI(this); @@ -1255,9 +1247,8 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component return myCursor; } - @NotNull @Override - public Rectangle getHeaderRect(int column) { + public @NotNull Rectangle getHeaderRect(int column) { // if a header has zero height, mouse pointer can never be inside it, so we pretend it is one pixel high Rectangle headerRect = super.getHeaderRect(column); return new Rectangle(headerRect.x, headerRect.y, headerRect.width, 1); @@ -1270,9 +1261,8 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component } private static class EmptyTableCellRenderer extends CellRendererPanel implements TableCellRenderer { - @NotNull @Override - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + public @NotNull Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { return this; } @@ -1292,8 +1282,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component mouseInputListener = createMouseInputListener(); } - @NotNull - private MouseEvent convertMouseEvent(@NotNull MouseEvent e) { + private @NotNull MouseEvent convertMouseEvent(@NotNull MouseEvent e) { // create a new event, almost exactly the same, but in the header return new MouseEvent(e.getComponent(), e.getID(), e.getWhen(), e.getModifiers(), e.getX(), 0, e.getXOnScreen(), header.getY(), e.getClickCount(), e.isPopupTrigger(), e.getButton()); diff --git a/platform/platform-api/src/com/intellij/ui/table/TableView.java b/platform/platform-api/src/com/intellij/ui/table/TableView.java index 9fc41df52a3f..cf9d7374a52f 100644 --- a/platform/platform-api/src/com/intellij/ui/table/TableView.java +++ b/platform/platform-api/src/com/intellij/ui/table/TableView.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.table; import com.intellij.ui.BooleanTableCellRenderer; @@ -50,7 +36,7 @@ public class TableView extends BaseTableView implements SelectionProvider } @Override - public void setModel(@NotNull final TableModel dataModel) { + public void setModel(final @NotNull TableModel dataModel) { assert dataModel instanceof SortableColumnModel : "SortableColumnModel required"; super.setModel(dataModel); } @@ -197,15 +183,13 @@ public class TableView extends BaseTableView implements SelectionProvider return getSelectedObjects(); } - @Nullable - public Item getSelectedObject() { + public @Nullable Item getSelectedObject() { final int row = getSelectedRow(); ListTableModel model = getListTableModel(); return row >= 0 && row < model.getRowCount() ? model.getRowValue(convertRowIndexToModel(row)) : null; } - @NotNull - public List getSelectedObjects() { + public @NotNull List getSelectedObjects() { ListSelectionModel selectionModel = getSelectionModel(); int minSelectionIndex = selectionModel.getMinSelectionIndex(); int maxSelectionIndex = selectionModel.getMaxSelectionIndex(); diff --git a/platform/platform-api/src/com/intellij/ui/tabs/JBTabs.java b/platform/platform-api/src/com/intellij/ui/tabs/JBTabs.java index 58034aacfc7d..b69b5de6ca00 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/JBTabs.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/JBTabs.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.tabs; import com.intellij.openapi.Disposable; @@ -77,7 +77,7 @@ public interface JBTabs extends DropAreaAware { @Nullable TabInfo findInfo(Component component); - int getIndexOf(@Nullable final TabInfo tabInfo); + int getIndexOf(final @Nullable TabInfo tabInfo); void requestFocus(); @@ -96,8 +96,7 @@ public interface JBTabs extends DropAreaAware { Component getTabLabel(TabInfo tabInfo); @Override - @NotNull - default Rectangle getDropArea() { + default @NotNull Rectangle getDropArea() { Rectangle r = new Rectangle(new Point(0, 0), getComponent().getSize()); if (getTabCount() > 0) { @SuppressWarnings("UseDPIAwareInsets") diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/DragHelper.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/DragHelper.java index 20031042d27a..dadb7f985766 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/DragHelper.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/DragHelper.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.tabs.impl; import com.intellij.ide.IdeBundle; @@ -266,8 +266,7 @@ public class DragHelper extends MouseDragHelper { } - @Nullable - private TabLabel findLabel(Point dragPoint) { + private @Nullable TabLabel findLabel(Point dragPoint) { final Component at = myTabs.findComponentAt(dragPoint); if (at instanceof InplaceButton) return null; final TabLabel label = findLabel(at); @@ -276,8 +275,7 @@ public class DragHelper extends MouseDragHelper { } - @Nullable - private TabLabel findLabel(Component c) { + private @Nullable TabLabel findLabel(Component c) { Component eachParent = c; while (eachParent != null && eachParent != myTabs) { if (eachParent instanceof TabLabel) return (TabLabel)eachParent; diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/LayoutPassInfo.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/LayoutPassInfo.java index 4ebb3f581d24..1319bcc565a8 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/LayoutPassInfo.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/LayoutPassInfo.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.tabs.impl; import com.intellij.ui.tabs.TabInfo; @@ -11,21 +11,19 @@ import java.util.List; public abstract class LayoutPassInfo { public final List myVisibleInfos; - @NotNull public Rectangle entryPointRect = new Rectangle(); - @NotNull public Rectangle moreRect = new Rectangle(); - @NotNull public Rectangle titleRect = new Rectangle(); + public @NotNull Rectangle entryPointRect = new Rectangle(); + public @NotNull Rectangle moreRect = new Rectangle(); + public @NotNull Rectangle titleRect = new Rectangle(); protected LayoutPassInfo(List visibleInfos) { myVisibleInfos = visibleInfos; } - @Nullable - public static TabInfo getPrevious(List list, int i) { + public static @Nullable TabInfo getPrevious(List list, int i) { return i > 0 ? list.get(i - 1) : null; } - @Nullable - public static TabInfo getNext(List list, int i) { + public static @Nullable TabInfo getNext(List list, int i) { return i < list.size() - 1 ? list.get(i + 1) : null; } diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/TabsSideSplitter.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/TabsSideSplitter.java index 2bc03bbd1ab7..7b1c7bf22469 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/TabsSideSplitter.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/TabsSideSplitter.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.tabs.impl; import com.intellij.openapi.ui.OnePixelDivider; @@ -16,7 +16,7 @@ import java.beans.PropertyChangeListener; class TabsSideSplitter implements Splittable, PropertyChangeListener { - @NotNull private final JBTabsImpl myTabs; + private final @NotNull JBTabsImpl myTabs; private int mySideTabsLimit = JBTabsImpl.DEFAULT_MAX_TAB_WIDTH; private final OnePixelDivider myDivider; @@ -80,9 +80,8 @@ class TabsSideSplitter implements Splittable, PropertyChangeListener { // ignore } - @NotNull @Override - public Component asComponent() { + public @NotNull Component asComponent() { return myTabs; } diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/ScrollableSingleRowLayout.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/ScrollableSingleRowLayout.java index 3310f2e59edf..fd2e03590bf7 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/ScrollableSingleRowLayout.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/ScrollableSingleRowLayout.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.tabs.impl.singleRow; import com.intellij.ui.ExperimentalUI; @@ -147,9 +147,8 @@ public class ScrollableSingleRowLayout extends SingleRowLayout { || bounds.height < label.getPreferredSize().height - deadzone; } - @Nullable @Override - protected TabLabel findLastVisibleLabel(SingleRowPassInfo data) { + protected @Nullable TabLabel findLastVisibleLabel(SingleRowPassInfo data) { int i = data.toLayout.size() - 1; while (i >= 0) { TabInfo info = data.toLayout.get(i); diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayout.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayout.java index 833670806c0f..a146bbf81a5b 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayout.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayout.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.tabs.impl.singleRow; import com.intellij.ui.ExperimentalUI; @@ -137,8 +137,7 @@ public abstract class SingleRowLayout extends TabLayout { return data; } - @Nullable - protected TabLabel findLastVisibleLabel(SingleRowPassInfo data) { + protected @Nullable TabLabel findLastVisibleLabel(SingleRowPassInfo data) { return myTabs.getInfoToLabel().get(data.toLayout.get(data.toLayout.size() - 1)); } diff --git a/platform/platform-api/src/com/intellij/ui/treeStructure/SimpleNode.java b/platform/platform-api/src/com/intellij/ui/treeStructure/SimpleNode.java index d2e701fcbb25..1f1e081784ca 100644 --- a/platform/platform-api/src/com/intellij/ui/treeStructure/SimpleNode.java +++ b/platform/platform-api/src/com/intellij/ui/treeStructure/SimpleNode.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.treeStructure; import com.intellij.ide.projectView.PresentationData; @@ -62,8 +62,7 @@ public abstract class SimpleNode extends PresentableNodeDescriptor imple return color == null ? SimpleTextAttributes.REGULAR_ATTRIBUTES : new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, color); } - @Nullable - protected Object updateElement() { + protected @Nullable Object updateElement() { return getElement(); } @@ -212,9 +211,8 @@ public abstract class SimpleNode extends PresentableNodeDescriptor imple public void handleDoubleClickOrEnter(SimpleTree tree, InputEvent inputEvent) { } - @NotNull @Override - public LeafState getLeafState() { + public @NotNull LeafState getLeafState() { if (isAlwaysShowPlus()) return LeafState.NEVER; if (isAlwaysLeaf()) return LeafState.ALWAYS; return LeafState.DEFAULT; diff --git a/platform/platform-api/src/com/intellij/ui/treeStructure/SimpleTree.java b/platform/platform-api/src/com/intellij/ui/treeStructure/SimpleTree.java index cde2fc4978b5..3a5762959c52 100644 --- a/platform/platform-api/src/com/intellij/ui/treeStructure/SimpleTree.java +++ b/platform/platform-api/src/com/intellij/ui/treeStructure/SimpleTree.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.treeStructure; import com.intellij.ide.util.treeView.NodeRenderer; @@ -104,8 +104,7 @@ public class SimpleTree extends Tree implements CellEditorListener { return node != null ? node : NULL_NODE; } - @Nullable - public TreePath getPathFor(SimpleNode node) { + public @Nullable TreePath getPathFor(SimpleNode node) { final TreeNode nodeWithObject = TreeUtil.findNodeWithObject((DefaultMutableTreeNode)getModel().getRoot(), node); if (nodeWithObject != null) { return TreeUtil.getPathFromRoot(nodeWithObject); @@ -113,8 +112,7 @@ public class SimpleTree extends Tree implements CellEditorListener { return null; } - @Nullable - public SimpleNode getSelectedNode() { + public @Nullable SimpleNode getSelectedNode() { if (isSelectionEmpty()) { return null; } diff --git a/platform/platform-api/src/com/intellij/ui/treeStructure/SimpleTreeStructure.java b/platform/platform-api/src/com/intellij/ui/treeStructure/SimpleTreeStructure.java index 194ba0d27568..49221656c020 100644 --- a/platform/platform-api/src/com/intellij/ui/treeStructure/SimpleTreeStructure.java +++ b/platform/platform-api/src/com/intellij/ui/treeStructure/SimpleTreeStructure.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.treeStructure; import com.intellij.ide.util.treeView.AbstractTreeStructure; @@ -23,8 +23,7 @@ public abstract class SimpleTreeStructure extends AbstractTreeStructure { } @Override - @NotNull - public NodeDescriptor createDescriptor(@NotNull Object element, NodeDescriptor parentDescriptor) { + public @NotNull NodeDescriptor createDescriptor(@NotNull Object element, NodeDescriptor parentDescriptor) { return (NodeDescriptor) element; } @@ -61,9 +60,8 @@ public abstract class SimpleTreeStructure extends AbstractTreeStructure { myRoot = root; } - @NotNull @Override - public Object getRootElement() { + public @NotNull Object getRootElement() { return myRoot; } } diff --git a/platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java b/platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java index 348ed4678cfc..9a77896799e6 100644 --- a/platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java +++ b/platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java @@ -156,8 +156,7 @@ public class Tree extends JTree implements ComponentWithEmptyText, ComponentWith * @return a strategy which determines if a wide selection should be drawn for a target row (it's number is * {@link Condition#value(Object) given} as an argument to the strategy) */ - @NotNull - protected Condition getWideSelectionBackgroundCondition() { + protected @NotNull Condition getWideSelectionBackgroundCondition() { return Conditions.alwaysTrue(); } @@ -170,15 +169,13 @@ public class Tree extends JTree implements ComponentWithEmptyText, ComponentWith return isEmpty(); } - @NotNull @Override - public StatusText getEmptyText() { + public @NotNull StatusText getEmptyText() { return myEmptyText; } @Override - @NotNull - public ExpandableItemsHandler getExpandableItemsHandler() { + public @NotNull ExpandableItemsHandler getExpandableItemsHandler() { return myExpandableItemsHandler; } @@ -391,18 +388,15 @@ public class Tree extends JTree implements ComponentWithEmptyText, ComponentWith } @Override - @Nullable - public Color getPathBackground(@NotNull TreePath path, int row) { + public @Nullable Color getPathBackground(@NotNull TreePath path, int row) { return isFileColorsEnabled() && !Registry.is("ide.file.colors.at.left") ? getFileColorForPath(path) : null; } - @Nullable - public Color getFileColorForRow(int row) { + public @Nullable Color getFileColorForRow(int row) { TreePath path = getPathForRow(row); return path != null ? getFileColorForPath(path) : null; } - @Nullable - public Color getFileColorForPath(@NotNull TreePath path) { + public @Nullable Color getFileColorForPath(@NotNull TreePath path) { Object component = path.getLastPathComponent(); if (component instanceof LoadingNode) { Object[] pathObjects = path.getPath(); @@ -413,8 +407,7 @@ public class Tree extends JTree implements ComponentWithEmptyText, ComponentWith return getFileColorFor(TreeUtil.getUserObject(component)); } - @Nullable - public Color getFileColorFor(Object object) { + public @Nullable Color getFileColorFor(Object object) { return null; } @@ -915,8 +908,7 @@ public class Tree extends JTree implements ComponentWithEmptyText, ComponentWith * @param y vertical location in the tree * @return the deepest visible component of the renderer */ - @Nullable - public Component getDeepestRendererComponentAt(int x, int y) { + public @Nullable Component getDeepestRendererComponentAt(int x, int y) { int row = getRowForLocation(x, y); if (row >= 0) { TreeCellRenderer renderer = getCellRenderer(); diff --git a/platform/platform-api/src/com/intellij/ui/treeStructure/filtered/FilteringTreeBuilder.java b/platform/platform-api/src/com/intellij/ui/treeStructure/filtered/FilteringTreeBuilder.java index 57dc3af7aaa3..e3d0d58c2c74 100644 --- a/platform/platform-api/src/com/intellij/ui/treeStructure/filtered/FilteringTreeBuilder.java +++ b/platform/platform-api/src/com/intellij/ui/treeStructure/filtered/FilteringTreeBuilder.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.treeStructure.filtered; import com.intellij.ide.util.treeView.AbstractTreeBuilder; @@ -54,9 +54,8 @@ public class FilteringTreeBuilder extends AbstractTreeBuilder { if (filter instanceof ElementFilter.Active) { ((ElementFilter.Active)filter).addListener(new ElementFilter.Listener() { - @NotNull @Override - public Promise update(final Object preferredSelection, final boolean adjustSelection, final boolean now) { + public @NotNull Promise update(final Object preferredSelection, final boolean adjustSelection, final boolean now) { return refilter(preferredSelection, adjustSelection, now); } }, this); @@ -114,20 +113,17 @@ public class FilteringTreeBuilder extends AbstractTreeBuilder { /** * @deprecated use {@link #refilter(Object, boolean, boolean)} */ - @NotNull @Deprecated(forRemoval = true) - public ActionCallback refilter() { + public @NotNull ActionCallback refilter() { return Promises.toActionCallback(refilter(null, true, false)); } @SuppressWarnings("UnusedReturnValue") - @NotNull - public Promise refilterAsync() { + public @NotNull Promise refilterAsync() { return refilter(null, true, false); } - @NotNull - public Promise refilter(@Nullable final Object preferredSelection, final boolean adjustSelection, final boolean now) { + public @NotNull Promise refilter(final @Nullable Object preferredSelection, final boolean adjustSelection, final boolean now) { if (myRefilterQueue != null) { myRefilterQueue.cancelAllUpdates(); } @@ -171,8 +167,7 @@ public class FilteringTreeBuilder extends AbstractTreeBuilder { } - @NotNull - protected Promise refilterNow(Object preferredSelection, boolean adjustSelection) { + protected @NotNull Promise refilterNow(Object preferredSelection, boolean adjustSelection) { final ActionCallback selectionDone = new ActionCallback(); getFilteredStructure().refilter(); @@ -261,8 +256,7 @@ public class FilteringTreeBuilder extends AbstractTreeBuilder { return getOriginalNode(object); } - @Nullable - public Object getElementFor(Object node) { + public @Nullable Object getElementFor(Object node) { AbstractTreeUi ui = getUi(); return ui == null ? null : ui.getElementFor(node); } diff --git a/platform/platform-api/src/com/intellij/ui/treeStructure/filtered/FilteringTreeStructure.java b/platform/platform-api/src/com/intellij/ui/treeStructure/filtered/FilteringTreeStructure.java index 16eb89dedd14..91d273e8f2c4 100644 --- a/platform/platform-api/src/com/intellij/ui/treeStructure/filtered/FilteringTreeStructure.java +++ b/platform/platform-api/src/com/intellij/ui/treeStructure/filtered/FilteringTreeStructure.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.treeStructure.filtered; import com.intellij.ide.projectView.PresentationData; @@ -128,9 +114,8 @@ public class FilteringTreeStructure extends AbstractTreeStructure { return myDescriptors2Nodes.get(nodeObject); } - @NotNull @Override - public FilteringNode getRootElement() { + public @NotNull FilteringNode getRootElement() { return myRoot; } @@ -155,8 +140,7 @@ public class FilteringTreeStructure extends AbstractTreeStructure { } @Override - @NotNull - public NodeDescriptor createDescriptor(@NotNull Object element, NodeDescriptor parentDescriptor) { + public @NotNull NodeDescriptor createDescriptor(@NotNull Object element, NodeDescriptor parentDescriptor) { return element instanceof FilteringNode ? (FilteringNode)element : new FilteringNode((SimpleNode)parentDescriptor, element); } @@ -170,9 +154,8 @@ public class FilteringTreeStructure extends AbstractTreeStructure { return myBaseStructure.hasSomethingToCommit(); } - @NotNull @Override - public ActionCallback asyncCommit() { + public @NotNull ActionCallback asyncCommit() { return myBaseStructure.asyncCommit(); } @@ -217,7 +200,7 @@ public class FilteringTreeStructure extends AbstractTreeStructure { } @Override - public boolean isHighlightableContentNode(@NotNull final PresentableNodeDescriptor kid) { + public boolean isHighlightableContentNode(final @NotNull PresentableNodeDescriptor kid) { return myDelegate instanceof PresentableNodeDescriptor && ((PresentableNodeDescriptor)myDelegate).isHighlightableContentNode(kid); } diff --git a/platform/platform-api/src/com/intellij/ui/treeStructure/treetable/TreeTableTree.java b/platform/platform-api/src/com/intellij/ui/treeStructure/treetable/TreeTableTree.java index ba79304a103f..445b5a012cfd 100644 --- a/platform/platform-api/src/com/intellij/ui/treeStructure/treetable/TreeTableTree.java +++ b/platform/platform-api/src/com/intellij/ui/treeStructure/treetable/TreeTableTree.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ui.treeStructure.treetable; import com.intellij.ui.treeStructure.Tree; @@ -123,9 +123,8 @@ public class TreeTableTree extends Tree { return renderer; } - @Nullable @Override - public Rectangle getPathBounds(TreePath path) { + public @Nullable Rectangle getPathBounds(TreePath path) { Rectangle bounds = super.getPathBounds(path); if (bounds == null) { return null; diff --git a/platform/platform-api/src/com/intellij/util/animation/Animation.java b/platform/platform-api/src/com/intellij/util/animation/Animation.java index 745b60b72b02..e938d72eabf4 100644 --- a/platform/platform-api/src/com/intellij/util/animation/Animation.java +++ b/platform/platform-api/src/com/intellij/util/animation/Animation.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.animation; import com.intellij.openapi.diagnostic.Logger; @@ -31,7 +31,7 @@ import java.util.function.DoubleFunction; @ApiStatus.Experimental public final class Animation { - private @NotNull final DoubleConsumer myConsumer; + private final @NotNull DoubleConsumer myConsumer; private @NotNull Easing myEasing = Easing.EASE; private int myDelay = 0; private int myDuration = 500; @@ -67,8 +67,7 @@ public final class Animation { /** * @param delay in milliseconds. */ - @NotNull - public Animation setDelay(int delay) { + public @NotNull Animation setDelay(int delay) { myDelay = Math.max(delay, 0); return this; } @@ -83,8 +82,7 @@ public final class Animation { /** * @param duration in milliseconds. */ - @NotNull - public Animation setDuration(int duration) { + public @NotNull Animation setDuration(int duration) { myDuration = Math.max(duration, 0); return this; } @@ -100,19 +98,16 @@ public final class Animation { myConsumer.accept(myEasing.calc(timeline)); } - @NotNull - public Easing getEasing() { + public @NotNull Easing getEasing() { return myEasing; } - @NotNull - public Animation setEasing(@NotNull Easing easing) { + public @NotNull Animation setEasing(@NotNull Easing easing) { myEasing = easing; return this; } - @NotNull - public Animation addListener(@NotNull Listener listener) { + public @NotNull Animation addListener(@NotNull Listener listener) { if (myListeners == null) { myListeners = new ArrayList<>(); } @@ -124,32 +119,28 @@ public final class Animation { * Runnable is called before first {@link Animation#update(double)} is called. * The time between animation is scheduled and updated can differ. */ - @NotNull - public Animation runWhenScheduled(@NotNull Runnable runnable) { + public @NotNull Animation runWhenScheduled(@NotNull Runnable runnable) { return addListener(Phase.SCHEDULED, runnable); } /** * Runnable is called right after {@link Animation#update(double)} is called. */ - @NotNull - public Animation runWhenUpdated(@NotNull Runnable runnable) { + public @NotNull Animation runWhenUpdated(@NotNull Runnable runnable) { return addListener(Phase.UPDATED, runnable); } /** * Runnable is called if animation is expired. */ - @NotNull - public Animation runWhenExpired(@NotNull Runnable runnable) { + public @NotNull Animation runWhenExpired(@NotNull Runnable runnable) { return addListener(Phase.EXPIRED, runnable); } /** * Runnable is called if animation is cancelled but not expired. */ - @NotNull - public Animation runWhenCancelled(@NotNull Runnable runnable) { + public @NotNull Animation runWhenCancelled(@NotNull Runnable runnable) { return addListener(Phase.CANCELLED, runnable); } @@ -159,8 +150,7 @@ public final class Animation { }); } - @NotNull - private Animation addListener(@NotNull Phase phase, @NotNull Runnable runnable) { + private @NotNull Animation addListener(@NotNull Phase phase, @NotNull Runnable runnable) { return addListener(p -> { if (p == phase) runnable.run(); }); diff --git a/platform/platform-api/src/com/intellij/util/animation/AnimationContext.java b/platform/platform-api/src/com/intellij/util/animation/AnimationContext.java index b8ad7da81edb..2e8bc8016870 100644 --- a/platform/platform-api/src/com/intellij/util/animation/AnimationContext.java +++ b/platform/platform-api/src/com/intellij/util/animation/AnimationContext.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.animation; import org.jetbrains.annotations.Nullable; @@ -17,8 +17,7 @@ public final class AnimationContext implements Consumer { this.value = t; } - @Nullable - public T getValue() { + public @Nullable T getValue() { return value; } } diff --git a/platform/platform-api/src/com/intellij/util/animation/JBAnimator.java b/platform/platform-api/src/com/intellij/util/animation/JBAnimator.java index c38ed7526190..c5c27711d706 100644 --- a/platform/platform-api/src/com/intellij/util/animation/JBAnimator.java +++ b/platform/platform-api/src/com/intellij/util/animation/JBAnimator.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.animation; import com.intellij.ide.PowerSaveMode; @@ -79,8 +79,7 @@ public final class JBAnimator implements Disposable { private static final Logger LOG = Logger.getInstance(JBAnimator.class); private @Nullable Statistic myStatistic; - @NotNull - private volatile Future myCurrentAnimatorFuture = CompletableFuture.completedFuture(null); // a future scheduled to display the next part of the animation + private volatile @NotNull Future myCurrentAnimatorFuture = CompletableFuture.completedFuture(null); // a future scheduled to display the next part of the animation public JBAnimator() { this(Thread.SWING_THREAD, null); @@ -458,7 +457,7 @@ public final class JBAnimator implements Disposable { @ApiStatus.Internal public static class Statistic { - private @Nullable final String myName; + private final @Nullable String myName; private final AtomicLong count = new AtomicLong(0); private long start; private long end; diff --git a/platform/platform-api/src/com/intellij/util/config/AbstractProperty.java b/platform/platform-api/src/com/intellij/util/config/AbstractProperty.java index 5e0b71798954..4f250f6a1d0b 100644 --- a/platform/platform-api/src/com/intellij/util/config/AbstractProperty.java +++ b/platform/platform-api/src/com/intellij/util/config/AbstractProperty.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.config; import com.intellij.openapi.util.Comparing; @@ -9,8 +9,7 @@ import java.util.Comparator; public abstract class AbstractProperty { public static final Comparator NAME_COMPARATOR = Comparator.comparing(AbstractProperty::getName); - @NonNls - public abstract String getName(); + public abstract @NonNls String getName(); public abstract T getDefault(AbstractPropertyContainer container); @@ -36,7 +35,7 @@ public abstract class AbstractProperty { return getName(); } - public static abstract class AbstractPropertyContainer { + public abstract static class AbstractPropertyContainer { public static final AbstractPropertyContainer EMPTY = new AbstractPropertyContainer() { @Override public Object getValueOf(AbstractProperty property) { diff --git a/platform/platform-api/src/com/intellij/util/config/ExternalizablePropertyContainer.java b/platform/platform-api/src/com/intellij/util/config/ExternalizablePropertyContainer.java index 955e51801ec0..0280df494d50 100644 --- a/platform/platform-api/src/com/intellij/util/config/ExternalizablePropertyContainer.java +++ b/platform/platform-api/src/com/intellij/util/config/ExternalizablePropertyContainer.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.config; import com.intellij.openapi.diagnostic.Logger; @@ -102,7 +102,7 @@ public final class ExternalizablePropertyContainer extends AbstractProperty.Abst } private static class ListExternalizer implements Externalizer> { - @NonNls private static final String NULL_ELEMENT = "NULL_VALUE_ELEMENT"; + private static final @NonNls String NULL_ELEMENT = "NULL_VALUE_ELEMENT"; private final Externalizer myItemExternalizer; private final String myItemTagName; diff --git a/platform/platform-api/src/com/intellij/util/config/Externalizer.java b/platform/platform-api/src/com/intellij/util/config/Externalizer.java index 822ca983c7c7..782f70bf1bb7 100644 --- a/platform/platform-api/src/com/intellij/util/config/Externalizer.java +++ b/platform/platform-api/src/com/intellij/util/config/Externalizer.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.config; import com.intellij.openapi.util.Factory; @@ -71,9 +71,9 @@ public interface Externalizer { } final class StorageExternalizer implements Externalizer { - @NonNls private static final String ITEM_TAG = "item"; - @NonNls private static final String KEY_ATTR = "key"; - @NonNls private static final String VALUE_ATTR = "value"; + private static final @NonNls String ITEM_TAG = "item"; + private static final @NonNls String KEY_ATTR = "key"; + private static final @NonNls String VALUE_ATTR = "value"; @Override public Storage readValue(Element dataElement) { diff --git a/platform/platform-api/src/com/intellij/util/config/ToggleBooleanProperty.java b/platform/platform-api/src/com/intellij/util/config/ToggleBooleanProperty.java index 0e52848709c2..c9b201b70e42 100644 --- a/platform/platform-api/src/com/intellij/util/config/ToggleBooleanProperty.java +++ b/platform/platform-api/src/com/intellij/util/config/ToggleBooleanProperty.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.config; @@ -57,7 +43,7 @@ public class ToggleBooleanProperty extends ToggleAction { return myProperty; } - public static abstract class Disablable extends ToggleBooleanProperty { + public abstract static class Disablable extends ToggleBooleanProperty { public Disablable(@NlsActions.ActionText String text, @NlsActions.ActionDescription String description, Icon icon, AbstractProperty.AbstractPropertyContainer properties, BooleanProperty property) { super(text, description, icon, properties, property); } diff --git a/platform/platform-api/src/com/intellij/util/net/AuthenticationDialog.java b/platform/platform-api/src/com/intellij/util/net/AuthenticationDialog.java index 23e04173aaf2..34bced5ad9c4 100644 --- a/platform/platform-api/src/com/intellij/util/net/AuthenticationDialog.java +++ b/platform/platform-api/src/com/intellij/util/net/AuthenticationDialog.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.net; import com.intellij.openapi.MnemonicHelper; @@ -47,15 +33,13 @@ public class AuthenticationDialog extends DialogWrapper { init(); } - @Nullable @Override - public JComponent getPreferredFocusedComponent() { + public @Nullable JComponent getPreferredFocusedComponent() { return panel.getPreferredFocusedComponent(); } @Override - @Nullable - protected JComponent createCenterPanel() { + protected @Nullable JComponent createCenterPanel() { return panel; } diff --git a/platform/platform-api/src/com/intellij/util/net/AuthenticationPanel.java b/platform/platform-api/src/com/intellij/util/net/AuthenticationPanel.java index 717cd74a34bf..7ebd0724de74 100644 --- a/platform/platform-api/src/com/intellij/util/net/AuthenticationPanel.java +++ b/platform/platform-api/src/com/intellij/util/net/AuthenticationPanel.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.net; import com.intellij.openapi.util.NlsContexts; @@ -44,8 +44,7 @@ public class AuthenticationPanel extends JPanel { } } - @NotNull - public String getLogin() { + public @NotNull String getLogin() { return StringUtil.notNullize(myLoginTextField.getText()); } diff --git a/platform/platform-api/src/com/intellij/util/net/HttpProxyConfigurable.java b/platform/platform-api/src/com/intellij/util/net/HttpProxyConfigurable.java index 9b8377e6b4d7..ee498e3e4931 100644 --- a/platform/platform-api/src/com/intellij/util/net/HttpProxyConfigurable.java +++ b/platform/platform-api/src/com/intellij/util/net/HttpProxyConfigurable.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.net; import com.intellij.ide.IdeBundle; @@ -32,9 +18,8 @@ public class HttpProxyConfigurable extends ConfigurableBase { !Comparing.strEqual(settings.PROXY_HOST, myProxyHostTextField.getText()); } - HttpProxySettingsUi(@NotNull final HttpConfigurable settings) { + HttpProxySettingsUi(final @NotNull HttpConfigurable settings) { ButtonGroup group = new ButtonGroup(); group.add(myUseHTTPProxyRb); group.add(myAutoDetectProxyRb); @@ -217,13 +217,11 @@ class HttpProxySettingsUi implements ConfigurableUi { }, strings -> StringUtil.join(strings, ", ")); } - @NotNull - private static @NlsContexts.DialogMessage String errorText(@NotNull String s) { + private static @NotNull @NlsContexts.DialogMessage String errorText(@NotNull String s) { return IdeBundle.message("dialog.message.problem.with.connection", s); } - @Nullable - private @NlsContexts.DialogMessage String isValid() { + private @Nullable @NlsContexts.DialogMessage String isValid() { if (myUseHTTPProxyRb.isSelected()) { String host = getText(myProxyHostTextField); if (host == null) { @@ -287,8 +285,7 @@ class HttpProxySettingsUi implements ConfigurableUi { } } - @Nullable - private static String getText(@NotNull JTextField field) { + private static @Nullable String getText(@NotNull JTextField field) { return StringUtil.nullize(field.getText(), true); } @@ -321,8 +318,7 @@ class HttpProxySettingsUi implements ConfigurableUi { } @Override - @NotNull - public JComponent getComponent() { + public @NotNull JComponent getComponent() { return myMainPanel; } } diff --git a/platform/platform-api/src/com/intellij/util/net/IOExceptionDialog.java b/platform/platform-api/src/com/intellij/util/net/IOExceptionDialog.java index 44f25b6f9f2a..430478eaca27 100644 --- a/platform/platform-api/src/com/intellij/util/net/IOExceptionDialog.java +++ b/platform/platform-api/src/com/intellij/util/net/IOExceptionDialog.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.net; import com.intellij.openapi.application.ApplicationManager; @@ -36,9 +36,8 @@ public final class IOExceptionDialog extends DialogWrapper { init(); } - @Nullable @Override - protected JComponent createCenterPanel() { + protected @Nullable JComponent createCenterPanel() { return myErrorLabel; } diff --git a/platform/platform-api/src/com/intellij/util/net/IdeaWideAuthenticator.java b/platform/platform-api/src/com/intellij/util/net/IdeaWideAuthenticator.java index d96e431c7bbc..2f47c98a1dd8 100644 --- a/platform/platform-api/src/com/intellij/util/net/IdeaWideAuthenticator.java +++ b/platform/platform-api/src/com/intellij/util/net/IdeaWideAuthenticator.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.net; import com.intellij.ide.IdeBundle; @@ -13,7 +13,7 @@ import java.net.Authenticator; import java.net.PasswordAuthentication; public final class IdeaWideAuthenticator extends NonStaticAuthenticator { - private final static Logger LOG = Logger.getInstance(IdeaWideAuthenticator.class); + private static final Logger LOG = Logger.getInstance(IdeaWideAuthenticator.class); private final HttpConfigurable myHttpConfigurable; public IdeaWideAuthenticator(@NotNull HttpConfigurable configurable) { diff --git a/platform/platform-api/src/com/intellij/util/net/IdeaWideProxySelector.java b/platform/platform-api/src/com/intellij/util/net/IdeaWideProxySelector.java index b3e9c335a144..71896fe279d8 100644 --- a/platform/platform-api/src/com/intellij/util/net/IdeaWideProxySelector.java +++ b/platform/platform-api/src/com/intellij/util/net/IdeaWideProxySelector.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.net; import com.intellij.openapi.diagnostic.Logger; @@ -16,7 +16,7 @@ import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; public final class IdeaWideProxySelector extends ProxySelector { - private final static Logger LOG = Logger.getInstance(IdeaWideProxySelector.class); + private static final Logger LOG = Logger.getInstance(IdeaWideProxySelector.class); private static final String DOCUMENT_BUILDER_FACTORY_KEY = "javax.xml.parsers.DocumentBuilderFactory"; private final HttpConfigurable myHttpConfigurable; @@ -72,8 +72,7 @@ public final class IdeaWideProxySelector extends ProxySelector { return CommonProxy.NO_PROXY_LIST; } - @NotNull - private List selectUsingPac(@NotNull URI uri) { + private @NotNull List selectUsingPac(@NotNull URI uri) { // It is important to avoid resetting Pac based ProxySelector unless option was changed // New instance will download configuration file and interpret it before making the connection String pacUrlForUse = myHttpConfigurable.USE_PAC_URL && !StringUtil.isEmpty(myHttpConfigurable.PAC_URL) ? myHttpConfigurable.PAC_URL : null; diff --git a/platform/platform-api/src/com/intellij/util/net/ssl/CertificateInfoPanel.java b/platform/platform-api/src/com/intellij/util/net/ssl/CertificateInfoPanel.java index 26c378d6d177..069526a83f2a 100644 --- a/platform/platform-api/src/com/intellij/util/net/ssl/CertificateInfoPanel.java +++ b/platform/platform-api/src/com/intellij/util/net/ssl/CertificateInfoPanel.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.net.ssl; import com.intellij.ide.IdeBundle; @@ -58,9 +58,7 @@ public class CertificateInfoPanel extends JPanel { add(builder.getPanel(), BorderLayout.NORTH); } - @NotNull - @NlsSafe - public static String formatHex(@NotNull String hex, boolean split) { + public static @NotNull @NlsSafe String formatHex(@NotNull String hex, boolean split) { if (NOT_AVAILABLE.equals(hex)) return hex; StringBuilder builder = new StringBuilder(); diff --git a/platform/platform-api/src/com/intellij/util/net/ssl/CertificateUtil.java b/platform/platform-api/src/com/intellij/util/net/ssl/CertificateUtil.java index 881e8d7b3fbd..9831fdf39e5f 100644 --- a/platform/platform-api/src/com/intellij/util/net/ssl/CertificateUtil.java +++ b/platform/platform-api/src/com/intellij/util/net/ssl/CertificateUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.net.ssl; import com.intellij.openapi.diagnostic.Logger; @@ -37,8 +37,7 @@ public final class CertificateUtil { private CertificateUtil() { } - @Nullable - public static X509Certificate loadX509Certificate(@NotNull String path) { + public static @Nullable X509Certificate loadX509Certificate(@NotNull String path) { try (InputStream stream = new FileInputStream(path)) { return (X509Certificate)ourFactory.generateCertificate(stream); } diff --git a/platform/platform-api/src/com/intellij/util/net/ssl/CertificateWarningDialog.java b/platform/platform-api/src/com/intellij/util/net/ssl/CertificateWarningDialog.java index 4d45b3707363..dceefdecb8a3 100644 --- a/platform/platform-api/src/com/intellij/util/net/ssl/CertificateWarningDialog.java +++ b/platform/platform-api/src/com/intellij/util/net/ssl/CertificateWarningDialog.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.net.ssl; import com.intellij.CommonBundle; @@ -95,9 +95,8 @@ public class CertificateWarningDialog extends DialogWrapper { LOG.debug("Preferred size: " + getPreferredSize()); } - @Nullable @Override - protected JComponent createCenterPanel() { + protected @Nullable JComponent createCenterPanel() { return myRootPanel; } } diff --git a/platform/platform-api/src/com/intellij/util/net/ssl/CertificateWrapper.java b/platform/platform-api/src/com/intellij/util/net/ssl/CertificateWrapper.java index d00c4fb3a709..f5229c30d53e 100644 --- a/platform/platform-api/src/com/intellij/util/net/ssl/CertificateWrapper.java +++ b/platform/platform-api/src/com/intellij/util/net/ssl/CertificateWrapper.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.net.ssl; import com.intellij.openapi.util.NlsSafe; @@ -21,7 +21,7 @@ import java.util.Map; */ @SuppressWarnings("UnusedDeclaration") public final class CertificateWrapper { - @NonNls public static final String NOT_AVAILABLE = "N/A"; + public static final @NonNls String NOT_AVAILABLE = "N/A"; private final X509Certificate myCertificate; private final Map myIssuerFields; diff --git a/platform/platform-api/src/com/intellij/util/text/CustomJBDateTimeFormatter.java b/platform/platform-api/src/com/intellij/util/text/CustomJBDateTimeFormatter.java index 5e39af44cfae..acc4e7ebedd2 100644 --- a/platform/platform-api/src/com/intellij/util/text/CustomJBDateTimeFormatter.java +++ b/platform/platform-api/src/com/intellij/util/text/CustomJBDateTimeFormatter.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.text; import org.jetbrains.annotations.NotNull; @@ -10,9 +10,9 @@ import java.util.Date; * @author Konstantin Bulenkov */ public class CustomJBDateTimeFormatter extends JBDateTimeFormatter { - @NotNull private final SyncDateFormat myDateFormat; - @NotNull private final SyncDateFormat myDateTimeFormat; - @NotNull private final SyncDateFormat myDateTimeSecondsFormat; + private final @NotNull SyncDateFormat myDateFormat; + private final @NotNull SyncDateFormat myDateTimeFormat; + private final @NotNull SyncDateFormat myDateTimeSecondsFormat; public CustomJBDateTimeFormatter(@NotNull String pattern, boolean use24hour) { myDateFormat = new SyncDateFormat(new SimpleDateFormat(pattern)); @@ -20,18 +20,15 @@ public class CustomJBDateTimeFormatter extends JBDateTimeFormatter { myDateTimeSecondsFormat = new SyncDateFormat(new SimpleDateFormat(pattern + ", " + (use24hour ? "HH:mm:ss" : "h:mm:ss a"))); } - @NotNull - private SyncDateFormat getFormat() { + private @NotNull SyncDateFormat getFormat() { return myDateFormat; } - @NotNull - private SyncDateFormat getDateTimeFormat() { + private @NotNull SyncDateFormat getDateTimeFormat() { return myDateTimeFormat; } - @NotNull - private SyncDateFormat getDateTimeSecondsFormat() { + private @NotNull SyncDateFormat getDateTimeSecondsFormat() { return myDateTimeSecondsFormat; } @@ -40,27 +37,23 @@ public class CustomJBDateTimeFormatter extends JBDateTimeFormatter { return false; } - @NotNull @Override - public String formatTime(long time) { + public @NotNull String formatTime(long time) { return getDateTimeFormat().format(new Date(time)); } - @NotNull @Override - public String formatTimeWithSeconds(long time) { + public @NotNull String formatTimeWithSeconds(long time) { return getDateTimeSecondsFormat().format(time); } - @NotNull @Override - public String formatDate(long time) { + public @NotNull String formatDate(long time) { return getFormat().format(time); } - @NotNull @Override - public String formatPrettyDateTime(long time) { + public @NotNull String formatPrettyDateTime(long time) { if (DateTimeFormatManager.getInstance().isPrettyFormattingAllowed() && DateFormatUtil.isPrettyFormattingPossible(time)) { return DateFormatUtil.formatPrettyDateTime(time); } @@ -68,36 +61,31 @@ public class CustomJBDateTimeFormatter extends JBDateTimeFormatter { return formatTime(time); } - @NotNull @Override - public String formatPrettyDate(long time) { + public @NotNull String formatPrettyDate(long time) { if (DateTimeFormatManager.getInstance().isPrettyFormattingAllowed() && DateFormatUtil.isPrettyFormattingPossible(time)) { return DateFormatUtil.formatPrettyDate(time); } return formatDate(time); } - @NotNull @Override - public String formatDateTime(Date date) { + public @NotNull String formatDateTime(Date date) { return formatTime(date); } - @NotNull @Override - public String formatDateTime(long time) { + public @NotNull String formatDateTime(long time) { return formatTime(time); } - @NotNull @Override - public String formatPrettyDateTime(@NotNull Date date) { + public @NotNull String formatPrettyDateTime(@NotNull Date date) { return formatPrettyDateTime(date.getTime()); } - @NotNull @Override - public String formatPrettyDate(@NotNull Date date) { + public @NotNull String formatPrettyDate(@NotNull Date date) { return formatPrettyDate(date.getTime()); } } diff --git a/platform/platform-api/src/com/intellij/util/text/DateTimeFormatManager.java b/platform/platform-api/src/com/intellij/util/text/DateTimeFormatManager.java index 65fa67ec1d31..24ca467c612d 100644 --- a/platform/platform-api/src/com/intellij/util/text/DateTimeFormatManager.java +++ b/platform/platform-api/src/com/intellij/util/text/DateTimeFormatManager.java @@ -1,10 +1,10 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.text; import com.intellij.configurationStore.XmlSerializer; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.components.SettingsCategory; import com.intellij.openapi.components.PersistentStateComponent; +import com.intellij.openapi.components.SettingsCategory; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; import com.intellij.util.xmlb.XmlSerializerUtil; @@ -28,9 +28,8 @@ public final class DateTimeFormatManager implements PersistentStateComponent bean.id).collect(Collectors.toSet()); } - @NotNull - public String getDateFormatPattern() { + public @NotNull String getDateFormatPattern() { return myPattern; } diff --git a/platform/platform-api/src/com/intellij/util/text/DefaultJBDateTimeFormatter.java b/platform/platform-api/src/com/intellij/util/text/DefaultJBDateTimeFormatter.java index f74c587675a8..3686cb22648c 100644 --- a/platform/platform-api/src/com/intellij/util/text/DefaultJBDateTimeFormatter.java +++ b/platform/platform-api/src/com/intellij/util/text/DefaultJBDateTimeFormatter.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.text; import org.jetbrains.annotations.NotNull; @@ -14,26 +14,22 @@ public class DefaultJBDateTimeFormatter extends JBDateTimeFormatter { } @Override - @NotNull - public String formatTime(long time) { + public @NotNull String formatTime(long time) { return DateFormatUtil.formatTime(time); } @Override - @NotNull - public String formatTimeWithSeconds(long time) { + public @NotNull String formatTimeWithSeconds(long time) { return DateFormatUtil.formatTimeWithSeconds(time); } @Override - @NotNull - public String formatDate(long time) { + public @NotNull String formatDate(long time) { return DateFormatUtil.formatDate(time); } @Override - @NotNull - public String formatPrettyDateTime(long time) { + public @NotNull String formatPrettyDateTime(long time) { if (isPrettyFormattingSupported()) { return DateFormatUtil.formatPrettyDateTime(time); } @@ -41,8 +37,7 @@ public class DefaultJBDateTimeFormatter extends JBDateTimeFormatter { } @Override - @NotNull - public String formatPrettyDate(long time) { + public @NotNull String formatPrettyDate(long time) { if (isPrettyFormattingSupported()) { return DateFormatUtil.formatPrettyDate(time); } diff --git a/platform/platform-api/src/com/intellij/util/text/JBDateTimeFormatter.java b/platform/platform-api/src/com/intellij/util/text/JBDateTimeFormatter.java index 4b54065b9329..27a187411c0c 100644 --- a/platform/platform-api/src/com/intellij/util/text/JBDateTimeFormatter.java +++ b/platform/platform-api/src/com/intellij/util/text/JBDateTimeFormatter.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.text; import com.intellij.openapi.util.NlsSafe; @@ -12,53 +12,41 @@ import java.util.Date; public abstract class JBDateTimeFormatter { protected abstract boolean isPrettyFormattingSupported(); - @NotNull - public String formatTime(@NotNull Date time) { + public @NotNull String formatTime(@NotNull Date time) { return formatTime(time.getTime()); } - @NotNull - public abstract String formatTime(long time); + public abstract @NotNull String formatTime(long time); - @NotNull - public String formatTimeWithSeconds(@NotNull Date time) { + public @NotNull String formatTimeWithSeconds(@NotNull Date time) { return formatTimeWithSeconds(time.getTime()); } - @NotNull - public abstract String formatTimeWithSeconds(long time); + public abstract @NotNull String formatTimeWithSeconds(long time); - @NotNull - public @NlsSafe String formatDate(@NotNull Date time) { + public @NotNull @NlsSafe String formatDate(@NotNull Date time) { return formatDate(time.getTime()); } - @NotNull - public abstract String formatDate(long time); + public abstract @NotNull String formatDate(long time); - @NotNull - public String formatDateTime(Date date) { + public @NotNull String formatDateTime(Date date) { return formatDateTime(date.getTime()); } - @NotNull - public @NlsSafe String formatDateTime(long time) { + public @NotNull @NlsSafe String formatDateTime(long time) { return DateFormatUtil.formatDateTime(time); } - @NotNull - public @NlsSafe String formatPrettyDateTime(@NotNull Date date) { + public @NotNull @NlsSafe String formatPrettyDateTime(@NotNull Date date) { return formatPrettyDateTime(date.getTime()); } - @NotNull - public abstract String formatPrettyDateTime(long time); + public abstract @NotNull String formatPrettyDateTime(long time); - @NotNull - public String formatPrettyDate(@NotNull Date date) { + public @NotNull String formatPrettyDate(@NotNull Date date) { return formatPrettyDate(date.getTime()); } - @NotNull - public abstract String formatPrettyDate(long time); + public abstract @NotNull String formatPrettyDate(long time); } diff --git a/platform/platform-api/src/com/intellij/util/ui/CalendarView.java b/platform/platform-api/src/com/intellij/util/ui/CalendarView.java index 94c604e86859..b62cf66e9942 100644 --- a/platform/platform-api/src/com/intellij/util/ui/CalendarView.java +++ b/platform/platform-api/src/com/intellij/util/ui/CalendarView.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.ui; import com.intellij.openapi.actionSystem.ActionUpdateThread; @@ -53,7 +39,7 @@ public class CalendarView extends JPanel { } } - private final static int[] DAYS_IN_THE_MONTH = new int[]{ + private static final int[] DAYS_IN_THE_MONTH = new int[]{ 31, -1, 31, @@ -144,8 +130,7 @@ public class CalendarView extends JPanel { field.getActionMap().put(DECREASE_NUMBER_ID, getIncAction(spinner, field, -1)); } - @NotNull - private static AbstractAction getIncAction(@NotNull JSpinner spinner, @NotNull JFormattedTextField field, int inc) { + private static @NotNull AbstractAction getIncAction(@NotNull JSpinner spinner, @NotNull JFormattedTextField field, int inc) { return new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { @@ -176,8 +161,7 @@ public class CalendarView extends JPanel { }); } - @NotNull - public Calendar getCalendar() { + public @NotNull Calendar getCalendar() { return myCalendar; } diff --git a/platform/platform-api/src/com/intellij/util/ui/EditorAdapter.java b/platform/platform-api/src/com/intellij/util/ui/EditorAdapter.java index b284e89851d7..9df580955ac2 100644 --- a/platform/platform-api/src/com/intellij/util/ui/EditorAdapter.java +++ b/platform/platform-api/src/com/intellij/util/ui/EditorAdapter.java @@ -71,8 +71,7 @@ public class EditorAdapter { myScrollToTheEndOnAppend = scrollToTheEndOnAppend; LOG.assertTrue(myEditor.isViewer()); } - @NotNull - public Editor getEditor() { + public @NotNull Editor getEditor() { return myEditor; } @@ -86,8 +85,7 @@ public class EditorAdapter { } } - @NotNull - private Runnable writingCommand(@NotNull Collection lines) { + private @NotNull Runnable writingCommand(@NotNull Collection lines) { final Runnable command = () -> { Document document = myEditor.getDocument(); diff --git a/platform/platform-api/src/com/intellij/util/ui/FormBuilder.java b/platform/platform-api/src/com/intellij/util/ui/FormBuilder.java index e593b43ecc6f..18b0b1c5e5a3 100644 --- a/platform/platform-api/src/com/intellij/util/ui/FormBuilder.java +++ b/platform/platform-api/src/com/intellij/util/ui/FormBuilder.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.ui; import com.intellij.openapi.util.NlsContexts; @@ -69,8 +69,7 @@ public class FormBuilder { return addLabeledComponent(label, component, topInset, labelOnTop); } - @NotNull - private static JLabel createLabelForComponent(@NotNull @NlsContexts.Label String labelText, @NotNull JComponent component) { + private static @NotNull JLabel createLabelForComponent(@NotNull @NlsContexts.Label String labelText, @NotNull JComponent component) { JLabel label = new JLabel(UIUtil.replaceMnemonicAmpersand(labelText)); label.setLabelFor(component); return label; @@ -84,8 +83,7 @@ public class FormBuilder { return addLabeledComponent((JLabel)null, component, topInset, false); } - @NotNull - public FormBuilder addComponentFillVertically(@NotNull JComponent component, int topInset) { + public @NotNull FormBuilder addComponentFillVertically(@NotNull JComponent component, int topInset) { return addLabeledComponent(null, component, topInset, false, true); } @@ -113,11 +111,11 @@ public class FormBuilder { return addComponentToRightColumn(label, 1); } - public FormBuilder addComponentToRightColumn(@NotNull final JComponent component) { + public FormBuilder addComponentToRightColumn(final @NotNull JComponent component) { return addComponentToRightColumn(component, myVerticalGap); } - public FormBuilder addComponentToRightColumn(@NotNull final JComponent component, final int topInset) { + public FormBuilder addComponentToRightColumn(final @NotNull JComponent component, final int topInset) { return addLabeledComponent(new JLabel(), component, topInset); } diff --git a/platform/platform-api/src/com/intellij/util/ui/ListTableModel.java b/platform/platform-api/src/com/intellij/util/ui/ListTableModel.java index fd7aba6e9ae9..902773e1853e 100644 --- a/platform/platform-api/src/com/intellij/util/ui/ListTableModel.java +++ b/platform/platform-api/src/com/intellij/util/ui/ListTableModel.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.ui; import com.intellij.util.containers.ContainerUtil; @@ -143,9 +143,8 @@ public class ListTableModel extends TableViewModel implements Editab return true; } - @NotNull @Override - public List getItems() { + public @NotNull List getItems() { return Collections.unmodifiableList(myItems); } diff --git a/platform/platform-api/src/com/intellij/util/ui/NSScrollerHelper.java b/platform/platform-api/src/com/intellij/util/ui/NSScrollerHelper.java index 0b7b97eb1389..9f1945272ec8 100644 --- a/platform/platform-api/src/com/intellij/util/ui/NSScrollerHelper.java +++ b/platform/platform-api/src/com/intellij/util/ui/NSScrollerHelper.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.ui; import com.intellij.openapi.util.SystemInfoRt; @@ -90,8 +90,7 @@ final class NSScrollerHelper { } } - @Nullable - static ClickBehavior getClickBehavior() { + static @Nullable ClickBehavior getClickBehavior() { if (!SystemInfoRt.isMac) return null; return ourClickBehavior; } @@ -111,8 +110,7 @@ final class NSScrollerHelper { } } - @Nullable - static Style getScrollerStyle() { + static @Nullable Style getScrollerStyle() { if (!isOverlayScrollbarSupported()) return null; Foundation.NSAutoreleasePool pool = new Foundation.NSAutoreleasePool(); diff --git a/platform/platform-api/src/com/intellij/util/ui/OptionsDialog.java b/platform/platform-api/src/com/intellij/util/ui/OptionsDialog.java index 1e4d9444a29f..e7f0a3f6aa1b 100644 --- a/platform/platform-api/src/com/intellij/util/ui/OptionsDialog.java +++ b/platform/platform-api/src/com/intellij/util/ui/OptionsDialog.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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.ui; import com.intellij.openapi.project.Project; @@ -47,9 +33,8 @@ public abstract class OptionsDialog extends DialogWrapper { return OptionsDialog.this.shouldSaveOptionsOnCancel(); } - @NotNull @Override - public String getDoNotShowMessage() { + public @NotNull String getDoNotShowMessage() { return OptionsDialog.this.getDoNotShowMessage(); } } diff --git a/platform/platform-api/src/com/intellij/util/ui/OptionsMessageDialog.java b/platform/platform-api/src/com/intellij/util/ui/OptionsMessageDialog.java index d04213f63248..1a15a0730874 100644 --- a/platform/platform-api/src/com/intellij/util/ui/OptionsMessageDialog.java +++ b/platform/platform-api/src/com/intellij/util/ui/OptionsMessageDialog.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.ui; import com.intellij.openapi.project.Project; @@ -24,10 +24,8 @@ public abstract class OptionsMessageDialog extends OptionsDialog{ setTitle(title); } - @ActionText - protected abstract String getOkActionName(); - @ActionText - protected abstract String getCancelActionName(); + protected abstract @ActionText String getOkActionName(); + protected abstract @ActionText String getCancelActionName(); @Override protected Action @NotNull [] createActions() { @@ -51,8 +49,7 @@ public abstract class OptionsMessageDialog extends OptionsDialog{ } @Override - @NotNull - protected JComponent createNorthPanel() { + protected @NotNull JComponent createNorthPanel() { JPanel panel = new JPanel(new BorderLayout(15, 0)); if (myIcon != null) { JLabel iconLabel = new JLabel(myIcon); diff --git a/platform/platform-api/src/com/intellij/util/ui/StatusText.java b/platform/platform-api/src/com/intellij/util/ui/StatusText.java index 76d6cadf99fd..4f80b06711ae 100644 --- a/platform/platform-api/src/com/intellij/util/ui/StatusText.java +++ b/platform/platform-api/src/com/intellij/util/ui/StatusText.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.ui; import com.intellij.openapi.util.NlsContexts; @@ -337,9 +337,8 @@ public abstract class StatusText { public Iterable getWrappedFragmentsIterable() { return new Iterable<>() { - @NotNull @Override - public Iterator iterator() { + public @NotNull Iterator iterator() { Iterable components = JBIterable.empty() .append(myPrimaryColumn.fragments) .append(mySecondaryColumn.fragments) diff --git a/platform/platform-api/src/com/intellij/util/ui/TableViewModel.java b/platform/platform-api/src/com/intellij/util/ui/TableViewModel.java index 911e4348aad2..f95869a0095d 100644 --- a/platform/platform-api/src/com/intellij/util/ui/TableViewModel.java +++ b/platform/platform-api/src/com/intellij/util/ui/TableViewModel.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.ui; import org.jetbrains.annotations.NotNull; @@ -8,6 +8,5 @@ import java.util.List; public abstract class TableViewModel extends AbstractTableModel implements SortableColumnModel { public abstract void setItems(@NotNull List items); - @NotNull - public abstract List getItems(); + public abstract @NotNull List getItems(); } \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/util/ui/TimedDeadzone.java b/platform/platform-api/src/com/intellij/util/ui/TimedDeadzone.java index 41998d12887d..e87e0cd4282c 100644 --- a/platform/platform-api/src/com/intellij/util/ui/TimedDeadzone.java +++ b/platform/platform-api/src/com/intellij/util/ui/TimedDeadzone.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.ui; import org.jetbrains.annotations.NotNull; @@ -53,7 +39,7 @@ public final class TimedDeadzone { return myMouseWithin && now > myTimeEntered && now - myTimeEntered < getLength(); } - public void setLength(@NotNull final Length deadZone) { + public void setLength(final @NotNull Length deadZone) { myLength = deadZone; } diff --git a/platform/platform-api/src/com/intellij/util/ui/tree/TreeUtil.java b/platform/platform-api/src/com/intellij/util/ui/tree/TreeUtil.java index ba77516239c9..979260e427e5 100644 --- a/platform/platform-api/src/com/intellij/util/ui/tree/TreeUtil.java +++ b/platform/platform-api/src/com/intellij/util/ui/tree/TreeUtil.java @@ -1558,15 +1558,13 @@ public final class TreeUtil { this.promise = promise; } - @Nullable @Override - public Action preVisitEDT(@NotNull TreePath path) { + public @Nullable Action preVisitEDT(@NotNull TreePath path) { return promise.isCancelled() ? TreeVisitor.Action.SKIP_SIBLINGS : null; } - @NotNull @Override - public Action postVisitEDT(@NotNull TreePath path, @NotNull TreeVisitor.Action action) { + public @NotNull Action postVisitEDT(@NotNull TreePath path, @NotNull TreeVisitor.Action action) { if (action == TreeVisitor.Action.CONTINUE || action == TreeVisitor.Action.INTERRUPT) { // do not expand children if parent path is collapsed if (!tree.isVisible(path)) { diff --git a/platform/platform-api/src/com/intellij/xml/breadcrumbs/BreadcrumbsItem.java b/platform/platform-api/src/com/intellij/xml/breadcrumbs/BreadcrumbsItem.java index 1a06cb8b074a..cd811cfd715e 100644 --- a/platform/platform-api/src/com/intellij/xml/breadcrumbs/BreadcrumbsItem.java +++ b/platform/platform-api/src/com/intellij/xml/breadcrumbs/BreadcrumbsItem.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.xml.breadcrumbs; import com.intellij.openapi.util.NlsContexts; @@ -26,8 +12,7 @@ public abstract class BreadcrumbsItem { return ""; } - @Nullable - public CrumbPresentation getPresentation() { + public @Nullable CrumbPresentation getPresentation() { return null; } } diff --git a/platform/platform-api/src/com/intellij/xml/breadcrumbs/BreadcrumbsItemListener.java b/platform/platform-api/src/com/intellij/xml/breadcrumbs/BreadcrumbsItemListener.java index 1281ea130dba..9be9ad3d974b 100644 --- a/platform/platform-api/src/com/intellij/xml/breadcrumbs/BreadcrumbsItemListener.java +++ b/platform/platform-api/src/com/intellij/xml/breadcrumbs/BreadcrumbsItemListener.java @@ -1,24 +1,10 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.xml.breadcrumbs; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public interface BreadcrumbsItemListener { - void itemSelected(@NotNull final T item, final int modifiers); - void itemHovered(@Nullable final T item); + void itemSelected(final @NotNull T item, final int modifiers); + void itemHovered(final @Nullable T item); }