From 1e6aca512545152f825a975f4e776caf3756e8f9 Mon Sep 17 00:00:00 2001
From: Mykhailo Lytvyn <>
Date: Thu, 29 Dec 2022 14:58:14 +0100
Subject: [PATCH] Added possibility to preview preformatted Flexible Search
Queries and copy them to Clipboard
---
.../META-INF/optional-java-dependencies.xml | 1 +
.../META-INF/optional-lang-dependencies.xml | 11 +-
resources/META-INF/plugin-release-info.xml | 1 +
resources/i18n/HybrisBundle.properties | 27 ++--
.../daemon/BSEnumValueLineMarkerProvider.kt | 6 +-
.../daemon/BSPropertyLineMarkerProvider.kt | 6 +-
.../daemon/BSTypeLineMarkerProvider.kt | 10 +-
.../FlexibleSearchQueryLineMarkerProvider.kt | 152 ++++++++++++++++++
.../daemon/PopulatorLineMarkerProvider.kt | 6 +-
.../daemon/TSAttributeLineMarkerProvider.java | 6 +-
.../daemon/TSEnumValueLineMarkerProvider.kt | 6 +-
.../daemon/TSTypeLineMarkerProvider.java | 6 +-
.../plugin/hybris/common/HybrisConstants.kt | 2 +
.../analyzer/FSKeywordTableClauseAnalyzer.kt | 1 -
.../folding/ImpexFoldingBuilder.java | 10 +-
.../folding/ImpexFoldingLinesBuilder.java | 8 +-
.../folding/ImpexMacroFoldingBuilder.java | 22 ++-
.../hybris/notifications/Notifications.kt | 6 +-
.../ItemsXmlFileOpenStartupActivity.kt | 2 +-
.../ItemsXmlFileEditorManagerListener.kt | 2 +-
20 files changed, 234 insertions(+), 57 deletions(-)
create mode 100644 src/com/intellij/idea/plugin/hybris/codeInsight/daemon/FlexibleSearchQueryLineMarkerProvider.kt
rename src/com/intellij/idea/plugin/hybris/{impex => lang}/folding/ImpexFoldingBuilder.java (90%)
rename src/com/intellij/idea/plugin/hybris/{impex => lang}/folding/ImpexFoldingLinesBuilder.java (94%)
rename src/com/intellij/idea/plugin/hybris/{impex => lang}/folding/ImpexMacroFoldingBuilder.java (92%)
diff --git a/resources/META-INF/optional-java-dependencies.xml b/resources/META-INF/optional-java-dependencies.xml
index 3cacf0a5d..49f5e06dc 100644
--- a/resources/META-INF/optional-java-dependencies.xml
+++ b/resources/META-INF/optional-java-dependencies.xml
@@ -82,6 +82,7 @@
+
diff --git a/resources/META-INF/optional-lang-dependencies.xml b/resources/META-INF/optional-lang-dependencies.xml
index d644fe23c..ac2d719b8 100644
--- a/resources/META-INF/optional-lang-dependencies.xml
+++ b/resources/META-INF/optional-lang-dependencies.xml
@@ -154,14 +154,9 @@
-
-
-
-
-
+
+
+
diff --git a/resources/META-INF/plugin-release-info.xml b/resources/META-INF/plugin-release-info.xml
index f66b288cf..46a77f3f8 100644
--- a/resources/META-INF/plugin-release-info.xml
+++ b/resources/META-INF/plugin-release-info.xml
@@ -89,6 +89,7 @@
Introduced the Bean System Management - the powerful tool to observe SAP Commerce bean system
+ Added possibility to preview preformatted Flexible Search Queries and copy them to Clipboard
Added customized Structure View for beans.xml files
Added new beans.xml inspection rules
Added navigation to items.xml Type attributes from generated classes
diff --git a/resources/i18n/HybrisBundle.properties b/resources/i18n/HybrisBundle.properties
index aa87c7036..331c2da51 100644
--- a/resources/i18n/HybrisBundle.properties
+++ b/resources/i18n/HybrisBundle.properties
@@ -190,6 +190,20 @@ hybris.editor.gutter.alternativeDefinitions=Alternative definitions
hybris.editor.gutter.alternativeDefinition=Alternative definition
hybris.editor.gutter.spring.bean.definitions=Spring bean definitions
hybris.editor.gutter.spring.bean.definition=Spring bean definition
+hybris.editor.gutter.fsq.tooltip=Preview of the Flexible Search Query (click to copy)
+hybris.editor.gutter.fsq.name=Flexible Search Query preview and copy to Clipboard
+hybris.editor.gutter.fsq.notification.title=Flexible Search Query copied to Clipboard
+hybris.editor.gutter.bs.enum.value.title=Navigate to the Enum value declaration
+hybris.editor.gutter.bs.bean.property.title=Navigate to the Bean property declaration
+hybris.editor.gutter.bean.type.navigate.choose.class.title=Choose Bean
+hybris.editor.gutter.bean.attribute.navigate.choose.class.title=Choose Attribute
+hybris.editor.gutter.item.class.tooltip.navigate.declaration=Navigate to the SAP Commerce item declaration(s)
+hybris.editor.gutter.item.attribute.tooltip.navigate.declaration=Navigate to the SAP Commerce attribute declaration(s)
+hybris.editor.gutter.navigate.no.matching.beans=No matching beans found
+hybris.editor.gutter.navigate.no.matching.attributes=No matching attributes found
+hybris.editor.gutter.navigate.no.matching.populators=No matching populators found
+hybris.editor.gutter.populator.class.navigate.choose.class.title=Choose Populator
+hybris.editor.gutter.populator.class.tooltip.navigate.declaration=Navigate to the SAP Commerce populator
hybris.inspections.ts.AttributeHandlerMustBeSetForDynamicAttribute.key=[y] Attribute handler must be defined for Dynamic Attribute
hybris.inspections.ts.DeploymentTypeCodeMustBeUnique.key=[y] Deployment type code must be unique
@@ -258,19 +272,6 @@ hybris.project.import.gradle=Configuring Gradle modules
hybris.project.import.data.sources=Configuring Data Sources
hybris.project.import.compiler=Configuring compiler
-hybris.gutter.navigate.no.matching.beans=No matching beans found
-hybris.gutter.navigate.no.matching.attributes=No matching attributes found
-hybris.gutter.bs.enum.value.title=Navigate to the Enum value declaration
-hybris.gutter.bs.bean.property.title=Navigate to the Bean property declaration
-hybris.gutter.bean.type.navigate.choose.class.title=Choose Bean
-hybris.gutter.bean.attribute.navigate.choose.class.title=Choose Attribute
-hybris.gutter.item.class.tooltip.navigate.declaration=Navigate to the SAP Commerce item declaration(s)
-hybris.gutter.item.attribute.tooltip.navigate.declaration=Navigate to the SAP Commerce attribute declaration(s)
-
-hybris.gutter.navigate.no.matching.populators=No matching populators found
-hybris.gutter.populator.class.navigate.choose.class.title=Choose Populator
-hybris.gutter.populator.class.tooltip.navigate.declaration=Navigate to the SAP Commerce populator
-
hybris.module.dependencies.diagram.provider.name=[y] module dependencies
hybris.stats.permission.no=I disagree
diff --git a/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/BSEnumValueLineMarkerProvider.kt b/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/BSEnumValueLineMarkerProvider.kt
index 7138e4a35..a4777b026 100644
--- a/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/BSEnumValueLineMarkerProvider.kt
+++ b/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/BSEnumValueLineMarkerProvider.kt
@@ -1,6 +1,6 @@
/*
- * This file is part of "hybris integration" plugin for Intellij IDEA.
- * Copyright (C) 2014-2016 Alexander Bartash
+ * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
+ * Copyright (C) 2019 EPAM Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
@@ -54,7 +54,7 @@ class BSEnumValueLineMarkerProvider : RelatedItemLineMarkerProvider() {
psi: PsiElement
) = NavigationGutterIconBuilder.create(HybrisIcons.ENUM_VALUE)
.setTarget(psi)
- .setTooltipText(message("hybris.gutter.bs.enum.value.title"))
+ .setTooltipText(message("hybris.editor.gutter.bs.enum.value.title"))
.createLineMarkerInfo(dom.nameIdentifier)
}
\ No newline at end of file
diff --git a/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/BSPropertyLineMarkerProvider.kt b/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/BSPropertyLineMarkerProvider.kt
index ccfacd439..812d23c15 100644
--- a/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/BSPropertyLineMarkerProvider.kt
+++ b/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/BSPropertyLineMarkerProvider.kt
@@ -1,6 +1,6 @@
/*
- * This file is part of "hybris integration" plugin for Intellij IDEA.
- * Copyright (C) 2014-2016 Alexander Bartash
+ * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
+ * Copyright (C) 2019 EPAM Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
@@ -58,7 +58,7 @@ class BSPropertyLineMarkerProvider : RelatedItemLineMarkerProvider() {
psi: PsiElement
) = NavigationGutterIconBuilder.create(HybrisIcons.PROPERTY)
.setTarget(psi)
- .setTooltipText(message("hybris.gutter.bs.bean.property.title"))
+ .setTooltipText(message("hybris.editor.gutter.bs.bean.property.title"))
.createLineMarkerInfo(dom.nameIdentifier)
}
\ No newline at end of file
diff --git a/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/BSTypeLineMarkerProvider.kt b/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/BSTypeLineMarkerProvider.kt
index 4c9a132b8..84721bc0b 100644
--- a/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/BSTypeLineMarkerProvider.kt
+++ b/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/BSTypeLineMarkerProvider.kt
@@ -1,6 +1,6 @@
/*
- * This file is part of "hybris integration" plugin for Intellij IDEA.
- * Copyright (C) 2014-2016 Alexander Bartash
+ * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
+ * Copyright (C) 2019 EPAM Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
@@ -58,9 +58,9 @@ class BSTypeLineMarkerProvider : RelatedItemLineMarkerProvider() {
list: Collection
) = NavigationGutterIconBuilder.create(HybrisIcons.BEAN)
.setTargets(list)
- .setEmptyPopupText(message("hybris.gutter.navigate.no.matching.beans"))
- .setPopupTitle(message("hybris.gutter.bean.type.navigate.choose.class.title"))
- .setTooltipText(message("hybris.gutter.item.class.tooltip.navigate.declaration"))
+ .setEmptyPopupText(message("hybris.editor.gutter.navigate.no.matching.beans"))
+ .setPopupTitle(message("hybris.editor.gutter.bean.type.navigate.choose.class.title"))
+ .setTooltipText(message("hybris.editor.gutter.item.class.tooltip.navigate.declaration"))
.createLineMarkerInfo(psiClass.nameIdentifier!!)
}
\ No newline at end of file
diff --git a/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/FlexibleSearchQueryLineMarkerProvider.kt b/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/FlexibleSearchQueryLineMarkerProvider.kt
new file mode 100644
index 000000000..71e58655a
--- /dev/null
+++ b/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/FlexibleSearchQueryLineMarkerProvider.kt
@@ -0,0 +1,152 @@
+/*
+ * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
+ * Copyright (C) 2019 EPAM Systems
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.intellij.idea.plugin.hybris.codeInsight.daemon
+
+import com.intellij.codeInsight.daemon.LineMarkerInfo
+import com.intellij.codeInsight.daemon.LineMarkerProviderDescriptor
+import com.intellij.codeInsight.daemon.MergeableLineMarkerInfo
+import com.intellij.idea.plugin.hybris.common.services.CommonIdeaService
+import com.intellij.idea.plugin.hybris.common.utils.HybrisI18NBundleUtils.message
+import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons
+import com.intellij.idea.plugin.hybris.notifications.Notifications
+import com.intellij.notification.NotificationType
+import com.intellij.openapi.actionSystem.AnAction
+import com.intellij.openapi.actionSystem.AnActionEvent
+import com.intellij.openapi.editor.markup.GutterIconRenderer
+import com.intellij.openapi.editor.markup.MarkupEditorFilter
+import com.intellij.openapi.editor.markup.MarkupEditorFilterFactory
+import com.intellij.openapi.ide.CopyPasteManager
+import com.intellij.psi.PsiElement
+import com.intellij.psi.PsiPolyadicExpression
+import com.intellij.psi.PsiReference
+import com.intellij.psi.PsiVariable
+import com.intellij.psi.impl.JavaConstantExpressionEvaluator
+import com.intellij.util.Function
+import java.awt.datatransfer.StringSelection
+import java.util.function.Supplier
+import javax.swing.Icon
+
+private val topRegex = "(SELECT )|( UNION )|( DISTINCT )|( ORDER BY )|( LEFT JOIN )|( JOIN )|( FROM )|( WHERE )|( ASC )|( DESC )|( ON )".toRegex(RegexOption.IGNORE_CASE)
+private val regexFrom = " FROM ".toRegex(RegexOption.IGNORE_CASE)
+private val regexLeftJoin = " LEFT JOIN ".toRegex(RegexOption.IGNORE_CASE)
+private val regexWhere = " WHERE ".toRegex(RegexOption.IGNORE_CASE)
+private val regexUnit = " UNION ".toRegex(RegexOption.IGNORE_CASE)
+private val whitespaceRegex = "\\s+".toRegex()
+
+class FlexibleSearchQueryLineMarkerProvider : LineMarkerProviderDescriptor() {
+
+ override fun getName() = message("hybris.editor.gutter.fsq.name")
+
+ override fun getLineMarkerInfo(element: PsiElement): LineMarkerInfo<*>? {
+ if (element !is PsiPolyadicExpression) return null
+ val parent = element.parent
+ if (parent !is PsiVariable || parent.nameIdentifier == null) return null
+ if (!CommonIdeaService.getInstance().isHybrisProject(element.project)) return null
+
+ val expression = computeExpression(element)
+ val formattedExpression = formatExpression(expression)
+
+ if (!(expression.contains(topRegex) && expression.contains('{') && expression.contains('}'))) return null
+
+ val tooltipProvider = Function { _: PsiElement? ->
+ "${message("hybris.editor.gutter.fsq.tooltip")}
$formattedExpression"
+ }
+
+ return FlexibleSearchQueryLineMarkerInfo(parent.nameIdentifier!!, icon, tooltipProvider, CopyToClipboard(formattedExpression))
+ }
+
+ private fun formatExpression(expression: String): String {
+ return expression
+ .replace(regexFrom, "\n FROM ")
+ .replace(regexLeftJoin, "\n LEFT JOIN ")
+ .replace(regexWhere, "\n WHERE \n")
+ .replace(regexUnit, "\n UNION ")
+ .replace(" ({{ ", " (\n {{\n")
+ .replace(" ( {{ ", "\n (\n {{\n")
+ .replace(" )}} ", "\n )\n }}\n")
+ .replace(" ) }} ", "\n )\n }}\n")
+ .replace(" }} ", "\n }} \n")
+ .replace(" {{ ", "\n {{ \n")
+ }
+
+ private fun computeExpression(literalExpression: PsiPolyadicExpression): String {
+ var computedValue = ""
+
+ literalExpression.operands
+ .forEach { operand ->
+ if (operand is PsiReference) {
+ val probableDefinition = operand.resolve()
+ if (probableDefinition is PsiVariable) {
+ probableDefinition.initializer?.let { initializer ->
+ val value = JavaConstantExpressionEvaluator.computeConstantExpression(initializer, true);
+ if (value is String) {
+ computedValue += value;
+ }
+ }
+ }
+ } else {
+ val value = JavaConstantExpressionEvaluator.computeConstantExpression(operand, true);
+ if (value is String) {
+ computedValue += value;
+ }
+ }
+ }
+ return computedValue
+ .trim()
+ .replace("\n", "")
+ .replace("\t", "")
+ .replace(whitespaceRegex, " ")
+ }
+
+ internal class CopyToClipboard(val content: String) : AnAction() {
+ override fun actionPerformed(e: AnActionEvent) {
+ CopyPasteManager.getInstance().setContents(StringSelection(content))
+ Notifications.create(NotificationType.INFORMATION, message("hybris.editor.gutter.fsq.notification.title"), content)
+ .hideAfter(10)
+ .notify(e.project)
+ }
+ }
+
+ override fun getIcon() = HybrisIcons.FS_FILE
+
+ internal class FlexibleSearchQueryLineMarkerInfo(
+ element: PsiElement,
+ icon: Icon,
+ tooltipProvider: Function,
+ val action: AnAction
+ ) :
+ MergeableLineMarkerInfo(element, element.textRange, icon, tooltipProvider, null, GutterIconRenderer.Alignment.CENTER,
+ Supplier { tooltipProvider.`fun`(element) }) {
+
+ override fun createGutterRenderer(): GutterIconRenderer {
+ return object : LineMarkerGutterIconRenderer(this) {
+ override fun getClickAction() = action
+ override fun isNavigateAction() = true
+ override fun getPopupMenuActions() = null
+ }
+ }
+
+ override fun getEditorFilter(): MarkupEditorFilter = MarkupEditorFilterFactory.createIsNotDiffFilter()
+
+ override fun canMergeWith(info: MergeableLineMarkerInfo<*>) = info is FlexibleSearchQueryLineMarkerInfo && info.getIcon() === icon
+
+ override fun getCommonIcon(infos: List?>): Icon = icon
+ }
+
+}
diff --git a/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/PopulatorLineMarkerProvider.kt b/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/PopulatorLineMarkerProvider.kt
index fa23eeb5d..cadfc95e6 100644
--- a/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/PopulatorLineMarkerProvider.kt
+++ b/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/PopulatorLineMarkerProvider.kt
@@ -101,13 +101,13 @@ class PopulatorLineMarkerProvider : RelatedItemLineMarkerProvider() {
NavigationGutterIconBuilder.create(HybrisIcons.GUTTER_POPULATOR)
.setTargets(list)
.setEmptyPopupText(HybrisI18NBundleUtils.message(
- "hybris.gutter.navigate.no.matching.populators"
+ "hybris.editor.gutter.navigate.no.matching.populators"
))
.setPopupTitle(HybrisI18NBundleUtils.message(
- "hybris.gutter.populator.class.navigate.choose.class.title"
+ "hybris.editor.gutter.populator.class.navigate.choose.class.title"
))
.setTooltipText(HybrisI18NBundleUtils.message(
- "hybris.gutter.populator.class.tooltip.navigate.declaration"
+ "hybris.editor.gutter.populator.class.tooltip.navigate.declaration"
))
.createLineMarkerInfo(psiElement)
diff --git a/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/TSAttributeLineMarkerProvider.java b/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/TSAttributeLineMarkerProvider.java
index e7fbbc64f..e1f31bb88 100644
--- a/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/TSAttributeLineMarkerProvider.java
+++ b/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/TSAttributeLineMarkerProvider.java
@@ -93,17 +93,17 @@ protected Optional> collectDeclarations(fi
@Override
protected String getTooltipText() {
- return HybrisI18NBundleUtils.message("hybris.gutter.item.attribute.tooltip.navigate.declaration");
+ return HybrisI18NBundleUtils.message("hybris.editor.gutter.item.attribute.tooltip.navigate.declaration");
}
@Override
protected String getPopupTitle() {
- return HybrisI18NBundleUtils.message("hybris.gutter.bean.attribute.navigate.choose.class.title");
+ return HybrisI18NBundleUtils.message("hybris.editor.gutter.bean.attribute.navigate.choose.class.title");
}
@Override
protected String getEmptyPopupText() {
- return HybrisI18NBundleUtils.message("hybris.gutter.navigate.no.matching.attributes");
+ return HybrisI18NBundleUtils.message("hybris.editor.gutter.navigate.no.matching.attributes");
}
private static List getAttributeElements(final TSGlobalMetaItem meta, final String name) {
diff --git a/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/TSEnumValueLineMarkerProvider.kt b/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/TSEnumValueLineMarkerProvider.kt
index 106a23946..b966b71ac 100644
--- a/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/TSEnumValueLineMarkerProvider.kt
+++ b/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/TSEnumValueLineMarkerProvider.kt
@@ -1,6 +1,6 @@
/*
- * This file is part of "hybris integration" plugin for Intellij IDEA.
- * Copyright (C) 2014-2016 Alexander Bartash
+ * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
+ * Copyright (C) 2019 EPAM Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
@@ -54,7 +54,7 @@ class TSEnumValueLineMarkerProvider : RelatedItemLineMarkerProvider() {
psi: PsiElement
) = NavigationGutterIconBuilder.create(HybrisIcons.ENUM_VALUE)
.setTarget(psi)
- .setTooltipText(message("hybris.gutter.bs.enum.value.title"))
+ .setTooltipText(message("hybris.editor.gutter.bs.enum.value.title"))
.createLineMarkerInfo(dom.nameIdentifier)
}
\ No newline at end of file
diff --git a/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/TSTypeLineMarkerProvider.java b/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/TSTypeLineMarkerProvider.java
index b46b82c88..29f145eb2 100644
--- a/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/TSTypeLineMarkerProvider.java
+++ b/src/com/intellij/idea/plugin/hybris/codeInsight/daemon/TSTypeLineMarkerProvider.java
@@ -67,16 +67,16 @@ protected Optional> collectDeclarations(
@Override
protected String getTooltipText() {
- return HybrisI18NBundleUtils.message("hybris.gutter.item.class.tooltip.navigate.declaration");
+ return HybrisI18NBundleUtils.message("hybris.editor.gutter.item.class.tooltip.navigate.declaration");
}
@Override
protected String getPopupTitle() {
- return HybrisI18NBundleUtils.message("hybris.gutter.bean.type.navigate.choose.class.title");
+ return HybrisI18NBundleUtils.message("hybris.editor.gutter.bean.type.navigate.choose.class.title");
}
@Override
protected String getEmptyPopupText() {
- return HybrisI18NBundleUtils.message("hybris.gutter.navigate.no.matching.beans");
+ return HybrisI18NBundleUtils.message("hybris.editor.gutter.navigate.no.matching.beans");
}
}
diff --git a/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.kt b/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.kt
index c6469bbbc..55626a6aa 100644
--- a/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.kt
+++ b/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.kt
@@ -195,6 +195,7 @@ object HybrisConstants {
const val OPTIONAL_CONFIG_DIR_KEY = "hybris.optional.config.dir"
const val DIALOG_TITLE = "copy.file.dialog."
const val FLEXIBLE_SEARCH_FILE_EXTENSION = "fxs"
+
const val LIB_DIRECTORY = "lib"
const val BIN_DIRECTORY = "bin"
const val RESOURCES_DIRECTORY = "resources"
@@ -216,6 +217,7 @@ object HybrisConstants {
private const val WEB_XML_FILE_NAME = "web.xml"
private const val WEB_INF_DIRECTORY = "WEB-INF"
+ @JvmField val FLEXIBLE_SEARCH_KEYWORDS = hashSetOf("SELECT", "FROM", "WHERE", "ORDER", "LEFT", "JOIN", "ON", "BY", "ASC", "DESC")
@JvmField val RESERVED_TYPE_CODES_FILE = FileUtilRt.toSystemDependentName("resources/core/unittest/reservedTypecodes.txt")
@JvmField val HYBRIS_SERVER_SHELL_SCRIPT_NAME = FileUtilRt.toSystemDependentName("bin/platform/hybrisserver.sh")
diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/analyzer/FSKeywordTableClauseAnalyzer.kt b/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/analyzer/FSKeywordTableClauseAnalyzer.kt
index 6783a7623..c96069c17 100644
--- a/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/analyzer/FSKeywordTableClauseAnalyzer.kt
+++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/analyzer/FSKeywordTableClauseAnalyzer.kt
@@ -42,7 +42,6 @@ import javax.swing.Icon
* @author Nosov Aleksandr
*/
object FSKeywordTableClauseAnalyzer {
- private val topLevelKeywords = hashSetOf("SELECT", "FROM", "WHERE", "ORDER", /* Temporarily place this*/ "LEFT", "JOIN", "ON", "BY", "ASC", "DESC")
fun analyzeKeyword(parameters: CompletionParameters, completionResultSet: CompletionResultSet) {
if ((parameters.originalPosition == null && !isTableNameIdentifier(parameters) && !isColumnReferenceIdentifier(parameters)) || isFile(parameters)) {
diff --git a/src/com/intellij/idea/plugin/hybris/impex/folding/ImpexFoldingBuilder.java b/src/com/intellij/idea/plugin/hybris/lang/folding/ImpexFoldingBuilder.java
similarity index 90%
rename from src/com/intellij/idea/plugin/hybris/impex/folding/ImpexFoldingBuilder.java
rename to src/com/intellij/idea/plugin/hybris/lang/folding/ImpexFoldingBuilder.java
index c402efea7..1c07278f7 100644
--- a/src/com/intellij/idea/plugin/hybris/impex/folding/ImpexFoldingBuilder.java
+++ b/src/com/intellij/idea/plugin/hybris/lang/folding/ImpexFoldingBuilder.java
@@ -1,6 +1,6 @@
/*
- * This file is part of "hybris integration" plugin for Intellij IDEA.
- * Copyright (C) 2014-2016 Alexander Bartash
+ * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
+ * Copyright (C) 2019 EPAM Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
@@ -16,8 +16,12 @@
* along with this program. If not, see .
*/
-package com.intellij.idea.plugin.hybris.impex.folding;
+package com.intellij.idea.plugin.hybris.lang.folding;
+import com.intellij.idea.plugin.hybris.impex.folding.ImpexFoldingPlaceholderBuilderFactory;
+import com.intellij.idea.plugin.hybris.impex.folding.ImpexMacroDescriptor;
+import com.intellij.idea.plugin.hybris.impex.folding.ImpexMacroUtils;
+import com.intellij.idea.plugin.hybris.impex.folding.PsiElementFilterFactory;
import com.intellij.idea.plugin.hybris.settings.HybrisApplicationSettingsComponent;
import com.intellij.lang.ASTNode;
import com.intellij.lang.folding.FoldingBuilderEx;
diff --git a/src/com/intellij/idea/plugin/hybris/impex/folding/ImpexFoldingLinesBuilder.java b/src/com/intellij/idea/plugin/hybris/lang/folding/ImpexFoldingLinesBuilder.java
similarity index 94%
rename from src/com/intellij/idea/plugin/hybris/impex/folding/ImpexFoldingLinesBuilder.java
rename to src/com/intellij/idea/plugin/hybris/lang/folding/ImpexFoldingLinesBuilder.java
index f24d49d47..6c7069b3d 100644
--- a/src/com/intellij/idea/plugin/hybris/impex/folding/ImpexFoldingLinesBuilder.java
+++ b/src/com/intellij/idea/plugin/hybris/lang/folding/ImpexFoldingLinesBuilder.java
@@ -1,6 +1,6 @@
/*
- * This file is part of "hybris integration" plugin for Intellij IDEA.
- * Copyright (C) 2014-2016 Alexander Bartash
+ * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
+ * Copyright (C) 2019 EPAM Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
@@ -16,8 +16,10 @@
* along with this program. If not, see .
*/
-package com.intellij.idea.plugin.hybris.impex.folding;
+package com.intellij.idea.plugin.hybris.lang.folding;
+import com.intellij.idea.plugin.hybris.impex.folding.ImpexFoldingDescriptor;
+import com.intellij.idea.plugin.hybris.impex.folding.ImpexFoldingPlaceholderBuilderFactory;
import com.intellij.idea.plugin.hybris.impex.folding.smart.ImpexFoldingLinesFilter;
import com.intellij.idea.plugin.hybris.impex.psi.ImpexTypes;
import com.intellij.idea.plugin.hybris.settings.HybrisApplicationSettingsComponent;
diff --git a/src/com/intellij/idea/plugin/hybris/impex/folding/ImpexMacroFoldingBuilder.java b/src/com/intellij/idea/plugin/hybris/lang/folding/ImpexMacroFoldingBuilder.java
similarity index 92%
rename from src/com/intellij/idea/plugin/hybris/impex/folding/ImpexMacroFoldingBuilder.java
rename to src/com/intellij/idea/plugin/hybris/lang/folding/ImpexMacroFoldingBuilder.java
index 9b654e5bb..9e4734c79 100644
--- a/src/com/intellij/idea/plugin/hybris/impex/folding/ImpexMacroFoldingBuilder.java
+++ b/src/com/intellij/idea/plugin/hybris/lang/folding/ImpexMacroFoldingBuilder.java
@@ -1,6 +1,26 @@
-package com.intellij.idea.plugin.hybris.impex.folding;
+/*
+ * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
+ * Copyright (C) 2019 EPAM Systems
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+package com.intellij.idea.plugin.hybris.lang.folding;
import com.intellij.idea.plugin.hybris.common.HybrisConstants;
+import com.intellij.idea.plugin.hybris.impex.folding.ImpexMacroDescriptor;
+import com.intellij.idea.plugin.hybris.impex.folding.ImpexMacroUtils;
import com.intellij.idea.plugin.hybris.impex.psi.ImpexFile;
import com.intellij.idea.plugin.hybris.impex.psi.ImpexHeaderLine;
import com.intellij.idea.plugin.hybris.impex.psi.ImpexMacroDeclaration;
diff --git a/src/com/intellij/idea/plugin/hybris/notifications/Notifications.kt b/src/com/intellij/idea/plugin/hybris/notifications/Notifications.kt
index 9b1dee690..aaaaa9744 100644
--- a/src/com/intellij/idea/plugin/hybris/notifications/Notifications.kt
+++ b/src/com/intellij/idea/plugin/hybris/notifications/Notifications.kt
@@ -30,9 +30,9 @@ class Notifications private constructor(type: NotificationType, title: String, c
return this
}
- fun delay(delay: Long): Notifications {
- if (delay > 0) {
- this.delay = delay
+ fun hideAfter(seconds: Long): Notifications {
+ if (seconds > 0) {
+ this.delay = seconds
}
return this
}
diff --git a/src/com/intellij/idea/plugin/hybris/startup/ItemsXmlFileOpenStartupActivity.kt b/src/com/intellij/idea/plugin/hybris/startup/ItemsXmlFileOpenStartupActivity.kt
index 7604d5695..a63a0c22a 100644
--- a/src/com/intellij/idea/plugin/hybris/startup/ItemsXmlFileOpenStartupActivity.kt
+++ b/src/com/intellij/idea/plugin/hybris/startup/ItemsXmlFileOpenStartupActivity.kt
@@ -49,7 +49,7 @@ class ItemsXmlFileOpenStartupActivity : StartupActivity {
HybrisI18NBundleUtils.message("hybris.notification.ts.validation.content")
)
.important(true)
- .delay(10)
+ .hideAfter(10)
.notify(project)
}
}
diff --git a/src/com/intellij/idea/plugin/hybris/startup/event/ItemsXmlFileEditorManagerListener.kt b/src/com/intellij/idea/plugin/hybris/startup/event/ItemsXmlFileEditorManagerListener.kt
index bf87717cb..dacf47f9b 100644
--- a/src/com/intellij/idea/plugin/hybris/startup/event/ItemsXmlFileEditorManagerListener.kt
+++ b/src/com/intellij/idea/plugin/hybris/startup/event/ItemsXmlFileEditorManagerListener.kt
@@ -42,7 +42,7 @@ class ItemsXmlFileEditorManagerListener(private val project: Project) : FileEdit
HybrisI18NBundleUtils.message("hybris.notification.ts.validation.title"),
HybrisI18NBundleUtils.message("hybris.notification.ts.validation.content")
)
- .delay(10)
+ .hideAfter(10)
.notify(project)
}
}