forked from unshare/hybris-integration-intellij-idea-plugin
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#935 | Moved project settings to developer specific settings
- Loading branch information
Showing
32 changed files
with
150 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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"/> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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"/> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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>() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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 | ||
|
||
|
@@ -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( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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 | ||
|
@@ -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>()) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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 | ||
|
@@ -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) | ||
|
@@ -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() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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 | ||
|
@@ -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 } | ||
|
@@ -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 | ||
|
Oops, something went wrong.