diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectStructureConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectStructureConfigurable.java index 99cd2a4f9158..4ddbc81a9872 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectStructureConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectStructureConfigurable.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-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. package com.intellij.openapi.roots.ui.configuration; import com.intellij.compiler.server.BuildManager; @@ -665,7 +665,7 @@ public class ProjectStructureConfigurable implements SearchableConfigurable, Pla } @Override - public JComponent getPreferredFocusedComponent() { + public @Nullable JComponent getPreferredFocusedComponent() { return myToFocus; } } diff --git a/json/src/com/jetbrains/jsonSchema/JsonSchemaCatalogConfigurable.java b/json/src/com/jetbrains/jsonSchema/JsonSchemaCatalogConfigurable.java index 022aad956737..fb888dc0b59c 100644 --- a/json/src/com/jetbrains/jsonSchema/JsonSchemaCatalogConfigurable.java +++ b/json/src/com/jetbrains/jsonSchema/JsonSchemaCatalogConfigurable.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-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. package com.jetbrains.jsonSchema; import com.intellij.json.JsonBundle; @@ -64,7 +64,7 @@ public class JsonSchemaCatalogConfigurable implements Configurable { } @Override - public JComponent getPreferredFocusedComponent() { + public @Nullable JComponent getPreferredFocusedComponent() { return myCatalogCheckBox; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionSettingsConfigurable.java b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionSettingsConfigurable.java index cc0f7085ad3f..762fbf28816c 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionSettingsConfigurable.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionSettingsConfigurable.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-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. package com.intellij.codeInsight.intention.impl.config; import com.intellij.codeInsight.CodeInsightBundle; @@ -9,6 +9,7 @@ import com.intellij.openapi.util.NlsContexts; import com.intellij.util.ui.JBUI; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -51,7 +52,7 @@ public final class IntentionSettingsConfigurable implements SearchableConfigurab } @Override - public JComponent getPreferredFocusedComponent() { + public @Nullable JComponent getPreferredFocusedComponent() { return myPanel == null ? null : myPanel.getIntentionTree(); } diff --git a/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependencyConfigurable.java b/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependencyConfigurable.java index 9ba57a3084f1..e3288cf8ec82 100644 --- a/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependencyConfigurable.java +++ b/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependencyConfigurable.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-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. package com.intellij.packageDependencies.ui; import com.intellij.codeInsight.CodeInsightBundle; @@ -17,6 +17,7 @@ import com.intellij.psi.search.scope.packageSet.PackageSet; import com.intellij.ui.ToolbarDecorator; import com.intellij.ui.table.TableView; import com.intellij.util.ui.*; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; @@ -85,7 +86,7 @@ public class DependencyConfigurable implements Configurable { } @Override - public JComponent getPreferredFocusedComponent() { + public @Nullable JComponent getPreferredFocusedComponent() { return myDenyTable; } diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/InspectionToolsConfigurable.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/InspectionToolsConfigurable.java index 0fc00d4cfa05..3bf39e53b3e3 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/InspectionToolsConfigurable.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/InspectionToolsConfigurable.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-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. package com.intellij.profile.codeInspection.ui.header; import com.intellij.codeInsight.CodeInsightBundle; @@ -21,6 +21,7 @@ import com.intellij.util.Alarm; import com.intellij.util.ui.JBInsets; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; @@ -233,7 +234,7 @@ public abstract class InspectionToolsConfigurable implements ErrorsConfigurable, } @Override - public JComponent getPreferredFocusedComponent() { + public @Nullable JComponent getPreferredFocusedComponent() { final SingleInspectionProfilePanel panel = getSelectedPanel(); return panel == null ? null : panel.getPreferredFocusedComponent(); } diff --git a/platform/platform-api/src/com/intellij/openapi/options/BaseConfigurable.java b/platform/platform-api/src/com/intellij/openapi/options/BaseConfigurable.java index dca82426286c..8d07e2a89023 100644 --- a/platform/platform-api/src/com/intellij/openapi/options/BaseConfigurable.java +++ b/platform/platform-api/src/com/intellij/openapi/options/BaseConfigurable.java @@ -1,6 +1,8 @@ -// 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-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. package com.intellij.openapi.options; +import org.jetbrains.annotations.Nullable; + import javax.swing.*; public abstract class BaseConfigurable implements Configurable { @@ -17,7 +19,7 @@ public abstract class BaseConfigurable implements Configurable { // defined here for backward-compatibility @Override - public JComponent getPreferredFocusedComponent() { + public @Nullable JComponent getPreferredFocusedComponent() { return null; } } \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/openapi/options/ConfigurableBase.java b/platform/platform-api/src/com/intellij/openapi/options/ConfigurableBase.java index df17e8cfc3c3..1c2d1aa24aab 100644 --- a/platform/platform-api/src/com/intellij/openapi/options/ConfigurableBase.java +++ b/platform/platform-api/src/com/intellij/openapi/options/ConfigurableBase.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-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. package com.intellij.openapi.options; import com.intellij.openapi.Disposable; @@ -79,7 +79,7 @@ public abstract class ConfigurableBase, S> implemen } @Override - public JComponent getPreferredFocusedComponent() { + public @Nullable JComponent getPreferredFocusedComponent() { return ui != null ? ui.getPreferredFocusedComponent() : null; } diff --git a/platform/platform-api/src/com/intellij/openapi/options/UnnamedConfigurable.java b/platform/platform-api/src/com/intellij/openapi/options/UnnamedConfigurable.java index 051245575655..f13bb96792cc 100644 --- a/platform/platform-api/src/com/intellij/openapi/options/UnnamedConfigurable.java +++ b/platform/platform-api/src/com/intellij/openapi/options/UnnamedConfigurable.java @@ -28,7 +28,7 @@ public interface UnnamedConfigurable { /** * @return component which should be focused when the dialog appears on the screen. */ - default JComponent getPreferredFocusedComponent() { + default @Nullable JComponent getPreferredFocusedComponent() { return null; } diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/config/TaskRepositoriesConfigurable.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/config/TaskRepositoriesConfigurable.java index 07a70e7cfa5b..2e086bc43c2d 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/config/TaskRepositoriesConfigurable.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/config/TaskRepositoriesConfigurable.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-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. package com.intellij.tasks.config; import com.intellij.ide.DataManager; @@ -202,7 +202,7 @@ public class TaskRepositoriesConfigurable implements Configurable.NoScroll, Sear } @Override - public JComponent getPreferredFocusedComponent() { + public @Nullable JComponent getPreferredFocusedComponent() { return myRepositoriesList; } diff --git a/xml/impl/src/com/intellij/javaee/XMLCatalogConfigurable.java b/xml/impl/src/com/intellij/javaee/XMLCatalogConfigurable.java index 5e435eb53684..2e46498cd74c 100644 --- a/xml/impl/src/com/intellij/javaee/XMLCatalogConfigurable.java +++ b/xml/impl/src/com/intellij/javaee/XMLCatalogConfigurable.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-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. package com.intellij.javaee; import com.intellij.openapi.fileChooser.FileChooserDescriptor; @@ -8,6 +8,7 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton; import com.intellij.openapi.util.text.StringUtil; import com.intellij.xml.XmlBundle; import org.jetbrains.annotations.Nls; +import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -40,7 +41,7 @@ public class XMLCatalogConfigurable implements Configurable { } @Override - public JComponent getPreferredFocusedComponent() { + public @Nullable JComponent getPreferredFocusedComponent() { return myPropertyFile.getTextField(); }