diff --git a/platform/extensions/src/com/intellij/openapi/extensions/SimpleSmartExtensionPoint.java b/platform/extensions/src/com/intellij/openapi/extensions/SimpleSmartExtensionPoint.java index 390e5498e42b..5a528fc5a49c 100644 --- a/platform/extensions/src/com/intellij/openapi/extensions/SimpleSmartExtensionPoint.java +++ b/platform/extensions/src/com/intellij/openapi/extensions/SimpleSmartExtensionPoint.java @@ -1,19 +1,13 @@ -// 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-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. package com.intellij.openapi.extensions; import com.intellij.util.SmartList; import org.jetbrains.annotations.NotNull; -import java.util.Collection; - /** * @author peter */ public abstract class SimpleSmartExtensionPoint extends SmartExtensionPoint{ - public SimpleSmartExtensionPoint(@NotNull final Collection explicitExtensions) { - super(explicitExtensions); - } - public SimpleSmartExtensionPoint() { super(new SmartList<>()); } diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SelectInAction.java b/platform/lang-impl/src/com/intellij/ide/actions/SelectInAction.java index f4f02fcfe4fa..4553ef72b636 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/SelectInAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/SelectInAction.java @@ -1,5 +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. - package com.intellij.ide.actions; import com.intellij.featureStatistics.FeatureUsageTracker; @@ -21,7 +20,7 @@ import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.util.*; -public class SelectInAction extends AnAction implements DumbAware { +public final class SelectInAction extends AnAction implements DumbAware { @Override public void actionPerformed(@NotNull AnActionEvent e) { FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.select.in"); @@ -52,7 +51,7 @@ public class SelectInAction extends AnAction implements DumbAware { } private static void invoke(@NotNull DataContext dataContext, @NotNull SelectInContext context) { - final List targetVector = Arrays.asList(getSelectInManager(context.getProject()).getTargets()); + final List targetVector = Arrays.asList(SelectInManager.getInstance(context.getProject()).getTargets()); ListPopup popup; if (targetVector.isEmpty()) { DefaultActionGroup group = new DefaultActionGroup(); @@ -67,11 +66,11 @@ public class SelectInAction extends AnAction implements DumbAware { popup.showInBestPositionFor(dataContext); } - private static class SelectInActionsStep extends BaseListPopupStep { + private static final class SelectInActionsStep extends BaseListPopupStep { private final SelectInContext mySelectInContext; private final List myVisibleTargets; - SelectInActionsStep(@NotNull final Collection targetVector, @NotNull SelectInContext selectInContext) { + SelectInActionsStep(@NotNull Collection targetVector, @NotNull SelectInContext selectInContext) { mySelectInContext = selectInContext; myVisibleTargets = new ArrayList<>(targetVector); List icons = fillInIcons(targetVector, selectInContext); @@ -154,11 +153,7 @@ public class SelectInAction extends AnAction implements DumbAware { return text; } - private static SelectInManager getSelectInManager(Project project) { - return SelectInManager.getInstance(project); - } - - private static class NoTargetsAction extends AnAction { + private static final class NoTargetsAction extends AnAction { NoTargetsAction() { super(IdeBundle.message("message.no.targets.available")); } diff --git a/platform/platform-api/src/com/intellij/ide/SelectInManager.java b/platform/platform-api/src/com/intellij/ide/SelectInManager.java index cdf29e0d2145..51d399c6a796 100644 --- a/platform/platform-api/src/com/intellij/ide/SelectInManager.java +++ b/platform/platform-api/src/com/intellij/ide/SelectInManager.java @@ -1,7 +1,6 @@ // 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. package com.intellij.ide; -import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.extensions.SimpleSmartExtensionPoint; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; @@ -13,7 +12,7 @@ import java.util.Comparator; import java.util.List; import java.util.Objects; -public class SelectInManager { +public final class SelectInManager { private final Project myProject; private final SimpleSmartExtensionPoint myTargets; @NonNls public static final String PROJECT = IdeBundle.message("select.in.project"); @@ -23,7 +22,7 @@ public class SelectInManager { @NonNls public static final String NAV_BAR = IdeBundle.message("select.in.nav.bar"); @NonNls public static final String SCOPE = IdeBundle.message("select.in.scope"); - public SelectInManager(final Project project) { + public SelectInManager(@NotNull Project project) { myProject = project; myTargets = SimpleSmartExtensionPoint.create(myProject.getExtensionArea(), SelectInTarget.EP_NAME); } @@ -48,12 +47,12 @@ public class SelectInManager { return ContainerUtil.sorted(targets, SelectInTargetComparator.INSTANCE).toArray(new SelectInTarget[0]); } - public static SelectInManager getInstance(Project project) { - return ServiceManager.getService(project, SelectInManager.class); + public static SelectInManager getInstance(@NotNull Project project) { + return project.getService(SelectInManager.class); } public static SelectInTarget findSelectInTarget(@NotNull String id, Project project) { - SelectInManager manager = project == null || project.isDisposed() ? null : SelectInManager.getInstance(project); + SelectInManager manager = project == null || project.isDisposed() ? null : getInstance(project); SelectInTarget[] targets = manager == null ? null : manager.getTargets(); if (targets != null) { for (SelectInTarget target : targets) { diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/InternalDecorator.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/InternalDecorator.java index 8efbc14d06af..2705a7cd934a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/InternalDecorator.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/InternalDecorator.java @@ -171,10 +171,9 @@ public final class InternalDecorator extends JPanel implements Queryable, DataPr validate(); repaint(); - // Push "apply" request forward - + // push "apply" request forward if (myInfo.isFloating() && myInfo.isVisible()) { - final FloatingDecorator floatingDecorator = (FloatingDecorator)SwingUtilities.getAncestorOfClass(FloatingDecorator.class, this); + FloatingDecorator floatingDecorator = (FloatingDecorator)SwingUtilities.getAncestorOfClass(FloatingDecorator.class, this); if (floatingDecorator != null) { floatingDecorator.apply(myInfo); } diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.kt b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.kt index a45d14e66f67..9ef2962a9126 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.kt +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.kt @@ -887,7 +887,7 @@ open class ToolWindowManagerImpl(val project: Project) : ToolWindowManagerEx(), val decorator = InternalDecorator(project, info.copy(), toolWindow, task.canWorkInDumbMode, disposable, internalDecoratorListener) // create and show tool button - val button = StripeButton(decorator, (toolWindowPane)!!) + val button = StripeButton(decorator, toolWindowPane!!) val commands = mutableListOf() appendAddButtonCmd(button, info, commands) @@ -1989,7 +1989,7 @@ open class ToolWindowManagerImpl(val project: Project) : ToolWindowManagerEx(), } val violations = mutableListOf() - idToEntry.forEach { id, entry -> + idToEntry.forEach { (id, entry) -> val info = layout.getInfo(id) ?: return@forEach if (info.isVisible) { if (info.isFloating) {