From dfacd78b918d0c71e18041a6dd004d6b91bd935e Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Wed, 14 Jun 2017 14:32:51 +0200 Subject: [PATCH] add 'based on' if and only if scheme has name 'Other' --- .../openapi/actionSystem/AnActionEvent.java | 22 ++++++++++++++++--- .../EditorColorSchemesUsagesCollector.java | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnActionEvent.java b/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnActionEvent.java index 2f379c2c71dc..12a0c566ba19 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnActionEvent.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnActionEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * 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. @@ -45,6 +45,7 @@ public class AnActionEvent implements PlaceProvider { private boolean myWorksInInjected; @NonNls private static final String ourInjectedPrefix = "$injected$."; private static final Map ourInjectedIds = new HashMap<>(); + private boolean myIsToolbarAction; /** * @throws IllegalArgumentException if dataContext is null or @@ -99,8 +100,19 @@ public class AnActionEvent implements PlaceProvider { @NotNull String place, @NotNull Presentation presentation, @NotNull DataContext dataContext) { - return new AnActionEvent(event, dataContext, place, presentation, ActionManager.getInstance(), - event == null ? 0 : event.getModifiers()); + return createFromInputEvent(event, place, presentation, dataContext, false); + } + + @NotNull + public static AnActionEvent createFromInputEvent(@Nullable InputEvent event, + @NotNull String place, + @NotNull Presentation presentation, + @NotNull DataContext dataContext, + boolean isToolbarAction) { + AnActionEvent e = new AnActionEvent(event, dataContext, place, presentation, ActionManager.getInstance(), + event == null ? 0 : event.getModifiers()); + e.myIsToolbarAction = isToolbarAction; + return e; } /** @@ -208,6 +220,10 @@ public class AnActionEvent implements PlaceProvider { return myPlace; } + public boolean isToolbarAction() { + return myIsToolbarAction; + } + /** * Returns the presentation which represents the action in the place from where it is invoked * or updated. diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorSchemesUsagesCollector.java b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorSchemesUsagesCollector.java index bb71eaa26d8c..9a1b3249bbd6 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorSchemesUsagesCollector.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorSchemesUsagesCollector.java @@ -46,7 +46,7 @@ public class EditorColorSchemesUsagesCollector extends UsagesCollector { schemeName = original.getName(); } } - if (currentScheme instanceof AbstractColorsScheme) { + if (schemeName == SCHEME_NAME_OTHER) { EditorColorsScheme parentScheme = ((AbstractColorsScheme)currentScheme).getParentScheme(); if (parentScheme != null) { schemeName += " based on " + parentScheme.getName();