From 1509ba99669952a8203f5073434e56402f97dd9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20C=C3=A9bron?= Date: Wed, 28 Jul 2021 17:08:34 +0200 Subject: [PATCH] code samples: update deprecated API use --- .../src/main/java/icons/SdkIcons.java | 4 +-- .../src/main/java/icons/SdkIcons.java | 4 +-- .../src/main/java/icons/SdkIcons.java | 4 +-- .../src/main/java/icons/SdkIcons.java | 4 +-- module/src/main/java/icons/SdkIcons.java | 4 +-- .../src/main/java/icons/SdkIcons.java | 4 +-- .../SimpleFormattingModelBuilder.java | 25 ++++++------------- .../intellij/sdk/language/SimpleIcons.java | 4 +-- 8 files changed, 21 insertions(+), 32 deletions(-) diff --git a/action_basics/src/main/java/icons/SdkIcons.java b/action_basics/src/main/java/icons/SdkIcons.java index 204f14ff6..f0387f454 100644 --- a/action_basics/src/main/java/icons/SdkIcons.java +++ b/action_basics/src/main/java/icons/SdkIcons.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. and other contributors. 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. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package icons; @@ -8,6 +8,6 @@ import javax.swing.*; public class SdkIcons { - public static final Icon Sdk_default_icon = IconLoader.getIcon("/icons/sdk_16.svg"); + public static final Icon Sdk_default_icon = IconLoader.getIcon("/icons/sdk_16.svg", SdkIcons.class); } diff --git a/editor_basics/src/main/java/icons/SdkIcons.java b/editor_basics/src/main/java/icons/SdkIcons.java index 204f14ff6..f0387f454 100644 --- a/editor_basics/src/main/java/icons/SdkIcons.java +++ b/editor_basics/src/main/java/icons/SdkIcons.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. and other contributors. 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. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package icons; @@ -8,6 +8,6 @@ import javax.swing.*; public class SdkIcons { - public static final Icon Sdk_default_icon = IconLoader.getIcon("/icons/sdk_16.svg"); + public static final Icon Sdk_default_icon = IconLoader.getIcon("/icons/sdk_16.svg", SdkIcons.class); } diff --git a/facet_basics/src/main/java/icons/SdkIcons.java b/facet_basics/src/main/java/icons/SdkIcons.java index 204f14ff6..f0387f454 100644 --- a/facet_basics/src/main/java/icons/SdkIcons.java +++ b/facet_basics/src/main/java/icons/SdkIcons.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. and other contributors. 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. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package icons; @@ -8,6 +8,6 @@ import javax.swing.*; public class SdkIcons { - public static final Icon Sdk_default_icon = IconLoader.getIcon("/icons/sdk_16.svg"); + public static final Icon Sdk_default_icon = IconLoader.getIcon("/icons/sdk_16.svg", SdkIcons.class); } diff --git a/framework_basics/src/main/java/icons/SdkIcons.java b/framework_basics/src/main/java/icons/SdkIcons.java index 204f14ff6..f0387f454 100644 --- a/framework_basics/src/main/java/icons/SdkIcons.java +++ b/framework_basics/src/main/java/icons/SdkIcons.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. and other contributors. 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. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package icons; @@ -8,6 +8,6 @@ import javax.swing.*; public class SdkIcons { - public static final Icon Sdk_default_icon = IconLoader.getIcon("/icons/sdk_16.svg"); + public static final Icon Sdk_default_icon = IconLoader.getIcon("/icons/sdk_16.svg", SdkIcons.class); } diff --git a/module/src/main/java/icons/SdkIcons.java b/module/src/main/java/icons/SdkIcons.java index 204f14ff6..f0387f454 100644 --- a/module/src/main/java/icons/SdkIcons.java +++ b/module/src/main/java/icons/SdkIcons.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. and other contributors. 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. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package icons; @@ -8,6 +8,6 @@ import javax.swing.*; public class SdkIcons { - public static final Icon Sdk_default_icon = IconLoader.getIcon("/icons/sdk_16.svg"); + public static final Icon Sdk_default_icon = IconLoader.getIcon("/icons/sdk_16.svg", SdkIcons.class); } diff --git a/project_model/src/main/java/icons/SdkIcons.java b/project_model/src/main/java/icons/SdkIcons.java index 204f14ff6..f0387f454 100644 --- a/project_model/src/main/java/icons/SdkIcons.java +++ b/project_model/src/main/java/icons/SdkIcons.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. and other contributors. 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. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package icons; @@ -8,6 +8,6 @@ import javax.swing.*; public class SdkIcons { - public static final Icon Sdk_default_icon = IconLoader.getIcon("/icons/sdk_16.svg"); + public static final Icon Sdk_default_icon = IconLoader.getIcon("/icons/sdk_16.svg", SdkIcons.class); } diff --git a/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFormattingModelBuilder.java b/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFormattingModelBuilder.java index b65e22cd8..8886920fa 100644 --- a/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFormattingModelBuilder.java +++ b/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFormattingModelBuilder.java @@ -1,16 +1,11 @@ -// Copyright 2000-2020 JetBrains s.r.o. and other contributors. 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. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.intellij.sdk.language; import com.intellij.formatting.*; -import com.intellij.lang.ASTNode; -import com.intellij.openapi.util.TextRange; -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiFile; import com.intellij.psi.codeStyle.CodeStyleSettings; import org.intellij.sdk.language.psi.SimpleTypes; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; public class SimpleFormattingModelBuilder implements FormattingModelBuilder { @@ -22,22 +17,16 @@ public class SimpleFormattingModelBuilder implements FormattingModelBuilder { .none(); } - @NotNull @Override - public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) { + public @NotNull FormattingModel createModel(@NotNull FormattingContext formattingContext) { + final CodeStyleSettings codeStyleSettings = formattingContext.getCodeStyleSettings(); return FormattingModelProvider - .createFormattingModelForPsiFile(element.getContainingFile(), - new SimpleBlock(element.getNode(), + .createFormattingModelForPsiFile(formattingContext.getContainingFile(), + new SimpleBlock(formattingContext.getNode(), Wrap.createWrap(WrapType.NONE, false), Alignment.createAlignment(), - createSpaceBuilder(settings)), - settings); - } - - @Nullable - @Override - public TextRange getRangeAffectingIndent(PsiFile file, int offset, ASTNode elementAtOffset) { - return null; + createSpaceBuilder(codeStyleSettings)), + codeStyleSettings); } } diff --git a/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleIcons.java b/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleIcons.java index b439ba485..ded3f282c 100644 --- a/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleIcons.java +++ b/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleIcons.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. and other contributors. 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. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.intellij.sdk.language; @@ -8,6 +8,6 @@ import javax.swing.*; public class SimpleIcons { - public static final Icon FILE = IconLoader.getIcon("/icons/jar-gray.png"); + public static final Icon FILE = IconLoader.getIcon("/icons/jar-gray.png", SimpleIcons.class); }