Skip to content

Commit

Permalink
#935 | Moved project settings to developer specific settings
Browse files Browse the repository at this point in the history
  • Loading branch information
mlytvyn authored Jan 7, 2024
1 parent 9365bfb commit 2b3d8d9
Show file tree
Hide file tree
Showing 32 changed files with 150 additions and 138 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Features
- Added `extends` information for Type System Item completion results [#892](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/892)
- Moved project settings to developer specific settings [#935](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/935)

### `Project Build` enhancements
- Re-generate the code and `models.jar` before the `Build` -> `Rebuild Project` [#906](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/906)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
~ This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
~ Copyright (C) 2019-2023 EPAM Systems <[email protected]> and contributors
~ This file is part of "SAP Commerce Developers Toolset" plugin for IntelliJ IDEA.
~ Copyright (C) 2019-2024 EPAM Systems <[email protected]> and contributors
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Lesser General Public License as
Expand Down Expand Up @@ -35,7 +35,7 @@

<completion.contributor language="XML" implementationClass="com.intellij.idea.plugin.hybris.system.cockpitng.codeInsight.completion.CngCompletionContributor"/>

<projectConfigurable id="hybris.project.cng.settings" parentId="hybris.project.settings"
<projectConfigurable id="hybris.project.cng.settings" groupId="hybris.project.settings"
nonDefaultProject="true" dynamic="true"
bundle="i18n.HybrisBundle" key="hybris.settings.project.cng.title"
provider="com.intellij.idea.plugin.hybris.system.cockpitng.settings.CngConfigurableProvider"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
~ This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
~ This file is part of "SAP Commerce Developers Toolset" plugin for IntelliJ IDEA.
~ Copyright (C) 2014-2016 Alexander Bartash <[email protected]>
~ Copyright (C) 2019-2023 EPAM Systems <[email protected]> and contributors
~ Copyright (C) 2019-2024 EPAM Systems <[email protected]> and contributors
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Lesser General Public License as
Expand Down Expand Up @@ -45,6 +45,7 @@
<applicationService serviceImplementation="com.intellij.idea.plugin.hybris.diagram.typeSystem.TSDiagramToolbarActionsProvider"/>

<projectConfigurable id="hybris.project.diagram.ts.settings" parentId="hybris.project.settings" nonDefaultProject="true" dynamic="true"
bundle="i18n.HybrisBundle" key="hybris.settings.project.diagram.ts.title"
provider="com.intellij.idea.plugin.hybris.settings.HybrisProjectDiagramTSSettingsConfigurableProvider"/>

<runLineMarkerContributor language="XML" implementationClass="com.intellij.idea.plugin.hybris.diagram.businessProcess.execution.lineMarker.ShowBPDiagramRunLineMarkerContributor"/>
Expand Down
2 changes: 1 addition & 1 deletion resources/META-INF/plugin-internal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<treeStructureProvider order="first" implementation="com.intellij.idea.plugin.hybris.project.view.HybrisProjectView"/>

<projectViewNodeDecorator order="last" implementation="com.intellij.idea.plugin.hybris.project.view.HybrisProjectViewNodeDecorator"/>

<psi.referenceContributor language="XML" implementation="com.intellij.idea.plugin.hybris.system.cockpitng.psi.contributor.CngReferenceContributor"/>
<psi.referenceContributor language="XML" implementation="com.intellij.idea.plugin.hybris.system.bean.psi.contributor.BSReferenceContributor"/>
<psi.referenceContributor language="XML" implementation="com.intellij.idea.plugin.hybris.system.type.psi.contributor.TSReferenceContributor"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
* Copyright (C) 2019 EPAM Systems <[email protected]>
* This file is part of "SAP Commerce Developers Toolset" plugin for IntelliJ IDEA.
* Copyright (C) 2019-2024 EPAM Systems <[email protected]> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand All @@ -21,18 +21,18 @@ package com.intellij.idea.plugin.hybris.flexibleSearch.completion.provider
import com.intellij.codeInsight.completion.CompletionParameters
import com.intellij.codeInsight.completion.CompletionProvider
import com.intellij.codeInsight.completion.CompletionResultSet
import com.intellij.idea.plugin.hybris.flexibleSearch.FxSUtils
import com.intellij.idea.plugin.hybris.flexibleSearch.codeInsight.lookup.FxSLookupElementFactory
import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchColumnRefExpression
import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchResultColumns
import com.intellij.idea.plugin.hybris.flexibleSearch.FxSUtils
import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent
import com.intellij.idea.plugin.hybris.settings.HybrisDeveloperSpecificProjectSettingsComponent
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.psi.util.parentOfType
import com.intellij.util.ProcessingContext

class FxSHybrisColumnCompletionProvider : CompletionProvider<CompletionParameters>() {
override fun addCompletions(parameters: CompletionParameters, context: ProcessingContext, result: CompletionResultSet) {
val fxsSettings = HybrisProjectSettingsComponent.getInstance(parameters.position.project).state.flexibleSearchSettings
val fxsSettings = HybrisDeveloperSpecificProjectSettingsComponent.getInstance(parameters.position.project).state.flexibleSearchSettings
val addComma = FxSUtils.shouldAddCommaAfterExpression(parameters.position, fxsSettings)

val parent = parameters.position.parentOfType<FlexibleSearchColumnRefExpression>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
* Copyright (C) 2019 EPAM Systems <[email protected]>
* This file is part of "SAP Commerce Developers Toolset" plugin for IntelliJ IDEA.
* Copyright (C) 2019-2024 EPAM Systems <[email protected]> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand All @@ -22,13 +22,13 @@ import com.intellij.codeInsight.completion.CompletionParameters
import com.intellij.codeInsight.completion.CompletionProvider
import com.intellij.codeInsight.completion.CompletionResultSet
import com.intellij.idea.plugin.hybris.flexibleSearch.codeInsight.lookup.FxSLookupElementFactory
import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent
import com.intellij.idea.plugin.hybris.settings.HybrisDeveloperSpecificProjectSettingsComponent
import com.intellij.util.ProcessingContext

class FxSKeywordsCompletionProvider(private val keywords: Set<String>) : CompletionProvider<CompletionParameters>() {

override fun addCompletions(parameters: CompletionParameters, context: ProcessingContext, result: CompletionResultSet) {
val fxsSettings = HybrisProjectSettingsComponent.getInstance(parameters.position.project).state.flexibleSearchSettings
val fxsSettings = HybrisDeveloperSpecificProjectSettingsComponent.getInstance(parameters.position.project).state.flexibleSearchSettings
result.addAllElements(FxSLookupElementFactory.buildKeywords(keywords, fxsSettings))
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
* Copyright (C) 2019 EPAM Systems <[email protected]>
* This file is part of "SAP Commerce Developers Toolset" plugin for IntelliJ IDEA.
* Copyright (C) 2019-2024 EPAM Systems <[email protected]> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand All @@ -22,7 +22,7 @@ import com.intellij.codeInsight.completion.CompletionParameters
import com.intellij.codeInsight.completion.CompletionProvider
import com.intellij.codeInsight.completion.CompletionResultSet
import com.intellij.idea.plugin.hybris.flexibleSearch.codeInsight.lookup.FxSLookupElementFactory
import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent
import com.intellij.idea.plugin.hybris.settings.HybrisDeveloperSpecificProjectSettingsComponent
import com.intellij.psi.PsiErrorElement
import com.intellij.util.ProcessingContext

Expand All @@ -32,7 +32,7 @@ class FxSRootCompletionProvider : CompletionProvider<CompletionParameters>() {
val psiErrorElement = parameters.position.parent as? PsiErrorElement
?: return

val fxsSettings = HybrisProjectSettingsComponent.getInstance(parameters.position.project).state.flexibleSearchSettings
val fxsSettings = HybrisDeveloperSpecificProjectSettingsComponent.getInstance(parameters.position.project).state.flexibleSearchSettings
// FlexibleSearchTokenType.toString()
when (psiErrorElement.errorDescription.substringBefore(">") + ">") {
"<statement>" -> result.addAllElements(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
* Copyright (C) 2019 EPAM Systems <[email protected]>
* This file is part of "SAP Commerce Developers Toolset" plugin for IntelliJ IDEA.
* Copyright (C) 2019-2024 EPAM Systems <[email protected]> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand All @@ -23,13 +23,13 @@ import com.intellij.codeInsight.completion.CompletionProvider
import com.intellij.codeInsight.completion.CompletionResultSet
import com.intellij.idea.plugin.hybris.flexibleSearch.codeInsight.lookup.FxSLookupElementFactory
import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTableAliasName
import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent
import com.intellij.idea.plugin.hybris.settings.HybrisDeveloperSpecificProjectSettingsComponent
import com.intellij.util.ProcessingContext

class FxSTablesAliasCompletionProvider : CompletionProvider<CompletionParameters>() {

override fun addCompletions(parameters: CompletionParameters, context: ProcessingContext, result: CompletionResultSet) {
val fxsSettings = HybrisProjectSettingsComponent.getInstance(parameters.position.project).state.flexibleSearchSettings
val fxsSettings = HybrisDeveloperSpecificProjectSettingsComponent.getInstance(parameters.position.project).state.flexibleSearchSettings

if (!fxsSettings.completion.suggestTableAliasNames) return

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
* Copyright (C) 2019-2023 EPAM Systems <[email protected]> and contributors
* This file is part of "SAP Commerce Developers Toolset" plugin for IntelliJ IDEA.
* Copyright (C) 2019-2024 EPAM Systems <[email protected]> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand All @@ -27,7 +27,7 @@ import com.intellij.idea.plugin.hybris.impex.psi.ImpexString
import com.intellij.idea.plugin.hybris.impex.psi.ImpexValueGroup
import com.intellij.idea.plugin.hybris.impex.psi.ImpexValueLine
import com.intellij.idea.plugin.hybris.lang.injection.impl.AbstractLanguageInjectorProvider
import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent
import com.intellij.idea.plugin.hybris.settings.HybrisDeveloperSpecificProjectSettingsComponent
import com.intellij.lang.Language
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.Service
Expand Down Expand Up @@ -98,7 +98,7 @@ class FlexibleSearchToImpexInjectorProvider : AbstractLanguageInjectorProvider(F
?.computeValue()
?: return injectSimple(injectionPlacesRegistrar, host, expression)

val alias = HybrisProjectSettingsComponent.getInstance(host.project)
val alias = HybrisDeveloperSpecificProjectSettingsComponent.getInstance(host.project)
.state
.flexibleSearchSettings
.fallbackToTableNameIfNoAliasProvided
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
* Copyright (C) 2023 EPAM Systems <[email protected]>
* This file is part of "SAP Commerce Developers Toolset" plugin for IntelliJ IDEA.
* Copyright (C) 2019-2024 EPAM Systems <[email protected]> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand All @@ -21,6 +21,7 @@ package com.intellij.idea.plugin.hybris.flexibleSearch.lang.documentation
import com.intellij.idea.plugin.hybris.flexibleSearch.file.FlexibleSearchFile
import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchDefinedTableName
import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes
import com.intellij.idea.plugin.hybris.settings.HybrisDeveloperSpecificProjectSettingsComponent
import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent
import com.intellij.platform.backend.documentation.DocumentationTarget
import com.intellij.platform.backend.documentation.DocumentationTargetProvider
Expand All @@ -34,11 +35,13 @@ class FlexibleSearchDocumentationTargetProvider : DocumentationTargetProvider {
if (file !is FlexibleSearchFile) return emptyList()

val element = file.findElementAt(offset) ?: return emptyList()
val settingsComponent = HybrisProjectSettingsComponent.getInstance(file.project)
val projectSettings = HybrisProjectSettingsComponent.getInstance(file.project)

if (!settingsComponent.isHybrisProject()) return emptyList()
if (!projectSettings.isHybrisProject()) return emptyList()

val documentationSettings = settingsComponent.state.flexibleSearchSettings.documentation
val developerSettings = HybrisDeveloperSpecificProjectSettingsComponent.getInstance(file.project).state

val documentationSettings = developerSettings.flexibleSearchSettings.documentation
if (!documentationSettings.enabled) return emptyList()

val allowedElementTypes = with(mutableListOf<IElementType>()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
* Copyright (C) 2019-2023 EPAM Systems <[email protected]> and contributors
* This file is part of "SAP Commerce Developers Toolset" plugin for IntelliJ IDEA.
* Copyright (C) 2019-2024 EPAM Systems <[email protected]> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand All @@ -19,7 +19,7 @@ package com.intellij.idea.plugin.hybris.flexibleSearch.lang.folding

import com.intellij.idea.plugin.hybris.flexibleSearch.file.FlexibleSearchFile
import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*
import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent
import com.intellij.idea.plugin.hybris.settings.HybrisDeveloperSpecificProjectSettingsComponent
import com.intellij.lang.ASTNode
import com.intellij.lang.folding.FoldingBuilderEx
import com.intellij.lang.folding.FoldingDescriptor
Expand All @@ -40,10 +40,8 @@ class FlexibleSearchFoldingBuilder : FoldingBuilderEx(), DumbAware {
private val filter = FlexibleSearchFoldingBlocksFilter()

override fun buildFoldRegions(root: PsiElement, document: Document, quick: Boolean): Array<FoldingDescriptor> {
val foldingSettings = HybrisProjectSettingsComponent.getInstance(root.project).state.flexibleSearchSettings.folding
if (!foldingSettings.enabled) {
return emptyArray()
}
val foldingSettings = HybrisDeveloperSpecificProjectSettingsComponent.getInstance(root.project).state.flexibleSearchSettings.folding
if (!foldingSettings.enabled) return emptyArray()

return CachedValuesManager.getCachedValue(root) {
val results = SyntaxTraverser.psiTraverser(root)
Expand Down Expand Up @@ -123,7 +121,7 @@ class FlexibleSearchFoldingBuilder : FoldingBuilderEx(), DumbAware {
?: FALLBACK_PLACEHOLDER

private fun getColumnPlaceholderText(node: ASTNode, columnNameType: IElementType, tableAliasType: IElementType): String {
val fxsSettings = HybrisProjectSettingsComponent.getInstance(node.psi.project).state.flexibleSearchSettings
val fxsSettings = HybrisDeveloperSpecificProjectSettingsComponent.getInstance(node.psi.project).state.flexibleSearchSettings
val columnName = node.findChildByType(columnNameType)
?.text
?.trim()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
* Copyright (C) 2019-2023 EPAM Systems <[email protected]> and contributors
* This file is part of "SAP Commerce Developers Toolset" plugin for IntelliJ IDEA.
* Copyright (C) 2019-2024 EPAM Systems <[email protected]> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand All @@ -26,7 +26,7 @@ import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*
import com.intellij.idea.plugin.hybris.flexibleSearch.psi.reference.result.FxSColumnAliasNameResolveResult
import com.intellij.idea.plugin.hybris.flexibleSearch.psi.reference.result.FxSYColumnNameResolveResult
import com.intellij.idea.plugin.hybris.psi.util.PsiUtils
import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent
import com.intellij.idea.plugin.hybris.settings.HybrisDeveloperSpecificProjectSettingsComponent
import com.intellij.openapi.util.Key
import com.intellij.openapi.util.TextRange
import com.intellij.psi.PsiElement
Expand All @@ -53,7 +53,7 @@ class FxSColumnNameReference(owner: FlexibleSearchColumnName) : PsiReferenceBase
?.resolve()
?.parent
?.let { fromClause ->
val fxsSettings = HybrisProjectSettingsComponent.getInstance(element.project).state.flexibleSearchSettings
val fxsSettings = HybrisDeveloperSpecificProjectSettingsComponent.getInstance(element.project).state.flexibleSearchSettings
val addComma = FxSUtils.shouldAddCommaAfterExpression(element, fxsSettings)

val aliases = findColumnAliasNames(fromClause) { true }
Expand Down Expand Up @@ -122,7 +122,7 @@ class FxSColumnNameReference(owner: FlexibleSearchColumnName) : PsiReferenceBase
.toList()

private fun getAlternativeVariants(element: PsiElement): Array<LookupElementBuilder> {
val fxsSettings = HybrisProjectSettingsComponent.getInstance(element.project).state.flexibleSearchSettings
val fxsSettings = HybrisDeveloperSpecificProjectSettingsComponent.getInstance(element.project).state.flexibleSearchSettings

val addComma = FxSUtils.shouldAddCommaAfterExpression(element, fxsSettings)
// only DOT allowed for non [y] columns
Expand Down
Loading

0 comments on commit 2b3d8d9

Please sign in to comment.