Skip to content

Commit

Permalink
Merge pull request #52 from Backbase/BEFOUND-1543-SSDK17-18-Adapt-Use…
Browse files Browse the repository at this point in the history
…rContext

BEFOUND-1543-SSDK17-18-Adapt-UserContext
  • Loading branch information
MalarsriA authored Oct 16, 2024
2 parents 27ad1c3 + b38dfe1 commit 7144bba
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 28 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

## 1.0.0

- Intellij service plugin update
- Intellij service plugin 2.x update
- Fix deprecated usage and scheduled for removal
- Supported SSDK 18.0.1
- Supported SSDK 18.0.1,17.1.0 (Latest 2 release lines)

## 0.0.12

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Plugin based on the [IntelliJ Platform Plugin Template][template].

## Documentation
* Documentation for the plugin is [here](https://github.com/Backbase/intellij-docs) which is published [here](http://engineering.backbase.com/intellij-docs/)
* Plugin is publeshed in [IntelliJ marketplace](https://plugins.jetbrains.com/plugin/18745-backbase-services-toolkit)
* Plugin is published in [IntelliJ marketplace](https://plugins.jetbrains.com/plugin/18745-backbase-services-toolkit)

### Support

Expand Down
2 changes: 1 addition & 1 deletion TECHNICAL_DETAILS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Technical Details

There project requires Gradle 7+, Kotlin 1.7+ and Java version specified in the `gradle.properties`.
There project requires Gradle 8+, Kotlin 1.9+ and Java 17 version specified in the `gradle.properties`.

Once a pull request is merged a new version will be automatically built along with a draft release.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.backbase.bst.common.Library
import com.backbase.bst.common.MavenTools
import com.intellij.notification.Notification
import com.intellij.notification.NotificationType
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.command.WriteCommandAction
Expand Down Expand Up @@ -133,4 +134,8 @@ class AddAnyServiceSSDKModuleAction : DumbAwareAction() {
}
}

override fun getActionUpdateThread(): ActionUpdateThread {
return ActionUpdateThread.BGT
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.backbase.bst.common.SsdkUtils
import com.intellij.ide.fileTemplates.FileTemplateManager
import com.intellij.notification.Notification
import com.intellij.notification.NotificationType
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.LangDataKeys
import com.intellij.openapi.command.WriteCommandAction
Expand Down Expand Up @@ -143,4 +144,8 @@ class ConsumeEventAction : DumbAwareAction() {
return
}
}

override fun getActionUpdateThread(): ActionUpdateThread {
return ActionUpdateThread.BGT
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.backbase.bst.actions

import com.intellij.codeInsight.template.TemplateManager
import com.intellij.codeInsight.template.impl.TemplateSettings
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.project.DumbAwareAction
Expand All @@ -25,6 +26,9 @@ class ConsumeEventFunctionalStyleAction : DumbAwareAction() {
val psiFile = e.getRequiredData(CommonDataKeys.PSI_FILE)

if (psiFile !is PsiJavaFile) e.presentation.isVisible = false
}

override fun getActionUpdateThread(): ActionUpdateThread {
return ActionUpdateThread.BGT
}
}
5 changes: 5 additions & 0 deletions src/main/kotlin/com/backbase/bst/actions/DefineEventAction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.intellij.ide.fileTemplates.FileTemplate
import com.intellij.ide.fileTemplates.FileTemplateManager
import com.intellij.notification.Notification
import com.intellij.notification.NotificationType
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.actionSystem.LangDataKeys
Expand All @@ -23,6 +24,7 @@ import com.intellij.psi.PsiDirectory
import com.intellij.ui.GotItMessage

import com.intellij.ui.awt.RelativePoint

import com.intellij.util.xml.DomElement
import com.intellij.util.xml.reflect.DomCollectionChildDescription
import org.jetbrains.annotations.NotNull
Expand Down Expand Up @@ -205,5 +207,8 @@ class DefineEventAction : DumbAwareAction(){
}
}

override fun getActionUpdateThread(): ActionUpdateThread {
return ActionUpdateThread.BGT
}

}
5 changes: 5 additions & 0 deletions src/main/kotlin/com/backbase/bst/actions/EmitEventAction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.backbase.bst.actions

import com.intellij.codeInsight.template.TemplateManager
import com.intellij.codeInsight.template.impl.TemplateSettings
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.project.DumbAwareAction
Expand Down Expand Up @@ -36,4 +37,8 @@ class EmitEventAction : DumbAwareAction() {


}

override fun getActionUpdateThread(): ActionUpdateThread {
return ActionUpdateThread.BGT
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.backbase.bst.actions

import com.intellij.ide.BrowserUtil
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.project.DumbAwareAction
Expand Down Expand Up @@ -30,4 +31,8 @@ class SearchGoldenSamplesAction : DumbAwareAction() {
e.presentation.isVisible = false
}
}

override fun getActionUpdateThread(): ActionUpdateThread {
return ActionUpdateThread.BGT
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.backbase.bst.BackbaseBundle
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.DialogPanel
import com.intellij.openapi.ui.DialogWrapper
import com.intellij.ui.dsl.builder.Align
import com.intellij.ui.dsl.builder.bindSelected
import com.intellij.ui.dsl.builder.bindText
import com.intellij.ui.dsl.builder.panel
Expand Down Expand Up @@ -36,20 +37,20 @@ class GenerateClientDialog(project: Project, fileName: String?) : DialogWrapper(

override fun createCenterPanel(): JComponent? {
mainPanel = panel {
row {
textField().label(BackbaseBundle.message("action.add.openapi.client.dialog.serviceName"))
row (BackbaseBundle.message("action.add.openapi.client.dialog.serviceName")){
textField().align(Align.FILL)
.bindText(::serviceName).focused()
}
row {
textField().label(BackbaseBundle.message("action.add.openapi.client.dialog.inputSpec"))
row(BackbaseBundle.message("action.add.openapi.client.dialog.inputSpec")) {
textField().align(Align.FILL)
.bindText(::specPath).focused()
}
row {
textField().label(BackbaseBundle.message("action.add.openapi.client.dialog.apiPackage"))
row(BackbaseBundle.message("action.add.openapi.client.dialog.apiPackage")) {
textField().align(Align.FILL)
.bindText(::apiPackage).focused()
}
row {
textField().label(BackbaseBundle.message("action.add.openapi.client.dialog.modelPackage"))
row(BackbaseBundle.message("action.add.openapi.client.dialog.modelPackage")) {
textField().align(Align.FILL)
.bindText(::modelPackage).focused()
}
row {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.backbase.bst.wizard.extensions

import com.intellij.ide.util.projectWizard.ModuleWizardStep
import com.intellij.openapi.ui.DialogPanel
import com.intellij.ui.dsl.builder.Align
import com.intellij.ui.dsl.builder.bindText
import com.intellij.ui.dsl.builder.panel

Expand All @@ -18,28 +19,28 @@ class CaptureServiceStep(

private val panel: DialogPanel = panel {

row{
label("ServiceGroupId")
row(" ServiceGroupId ") {
textField().bindText(::serviceGroupId).align(Align.FILL)
.comment("The groupId of the service you are creating an extension for")
textField().bindText(::serviceGroupId)
}

row{
label("ServiceArtifactId")
row(" ServiceArtifactId ") {
textField().bindText(::serviceArtifactId).align(Align.FILL)
.comment("The artifactId of the service you are creating an extension for")
textField().bindText(::serviceArtifactId)

}
row {
label("BBVersion")
row(" BBVersion ") {

textField().bindText(::bbVersion).align(Align.FILL)
.comment("The version number of Backbase you want to create an extension for")
textField().bindText(::bbVersion)

}
row {
comment("Check <a href=\\\"https://community.backbase.com/\\\">Community</a> for service details")
comment("Check <a href=\\\"https://community.backbase.com/\\\">Community</a> for service details").align(
Align.CENTER
)
}
}
}

override fun getComponent(): JComponent {
return panel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.backbase.bst.common.SsdkUtils
import com.intellij.ide.util.projectWizard.ModuleWizardStep
import com.intellij.ide.util.projectWizard.WizardContext
import com.intellij.openapi.ui.DialogPanel
import com.intellij.ui.dsl.builder.Align
import com.intellij.ui.dsl.builder.bindItem
import com.intellij.ui.dsl.builder.bindText
import com.intellij.ui.dsl.builder.panel
Expand All @@ -25,14 +26,14 @@ class ExtensionProjectStep(
private val panel: DialogPanel = panel {

row (" GroupId "){
textField().bindText(::groupId).comment("The groupId of the generated Maven project")
textField().bindText(::groupId).align(Align.FILL).comment("The groupId of the generated Maven project")
}
row (" ArtifactId "){
textField().bindText(::artifactId)
textField().bindText(::artifactId).align(Align.FILL)
.comment("The artifactId of the generated Maven project")
}
row (" Version "){
textField().bindText(::version)
textField().bindText(::version).align(Align.FILL)
.comment("The version number of the generated Maven project")
}
row (" Extension Version "){
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/liveTemplates/backbase.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<templateSet group="backbase">
<template name="emitevent" value="private final com.backbase.buildingblocks.backend.communication.event.proxy.EventBus eventBus;&#10;private final com.backbase.buildingblocks.backend.communication.context.OriginatorContextUtil originatorContextUtil;&#10;&#10; public $CLASS_NAME$(com.backbase.buildingblocks.backend.communication.event.proxy.EventBus eventBus, com.backbase.buildingblocks.backend.communication.context.OriginatorContextUtil originatorContextUtil) {&#10; this.eventBus = eventBus;&#10; this.originatorContextUtil = originatorContextUtil;&#10; }&#10;public void exampleEmitEvent(com.backbase.buildingblocks.backend.internalrequest.InternalRequest&lt;?&gt; request) {&#10;&#10; var event = new $EVENT_CLASS$();&#10; event.setData(&quot;some data&quot;); //TODO fill event based on the request. &#10;&#10; var envelopedEvent = new com.backbase.buildingblocks.backend.communication.event.EnvelopedEvent&lt;$EVENT_CLASS$&gt;();&#10; envelopedEvent.setEvent(event);&#10; envelopedEvent.setOriginatorContext(originatorContextUtil.create(request.getInternalRequestContext()));&#10; eventBus.emitEvent(envelopedEvent);&#10;}" description="Method to emit an event" toReformat="true" toShortenFQNames="true">
<template name="emitevent" value="private final com.backbase.buildingblocks.backend.communication.event.proxy.EventBus eventBus;&#10;private final com.backbase.buildingblocks.backend.internalrequest.UserRequestContext context;&#10;&#10; public $CLASS_NAME$(com.backbase.buildingblocks.backend.communication.event.proxy.EventBus eventBus, com.backbase.buildingblocks.backend.internalrequest.UserRequestContext context) {&#10; this.eventBus = eventBus;&#10; this.context= context;&#10; }&#10;public void exampleEmitEvent(com.backbase.buildingblocks.backend.internalrequest.InternalRequest&lt;?&gt; request) {&#10;&#10; var event = new $EVENT_CLASS$();&#10; event.setData(&quot;some data&quot;); //TODO fill event based on the request. &#10;&#10;var envelopedEvent = new com.backbase.buildingblocks.backend.communication.event.EnvelopedEvent&lt;$EVENT_CLASS$&gt;();&#10; envelopedEvent.setEvent(event);&#10; envelopedEvent.setUserRequestContext(context);&#10; eventBus.emitEvent(envelopedEvent);&#10;}" description="Method to emit an event" toReformat="true" toShortenFQNames="true">
<variable name="CLASS_NAME" expression="className()" defaultValue="" alwaysStopAt="false" />
<variable name="EVENT_CLASS" expression="subtypes(&quot;com.backbase.buildingblocks.persistence.model.Event&quot;)" defaultValue="" alwaysStopAt="true" />
<context>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,22 @@ import org.junit.Ignore
import java.io.File

@Ignore
/*
Test ignored temporarily, as it throws "com.intellij.openapi.util.TraceableDisposable$DisposalException: Editor EditorImplEditor EditorImpl[file:///private/var/folders/d8/jn_7qn4n1gv30gct2svbrcfh0000gp/T/unitTest_createProject_2nVdvm8HV6nAnqQMzPCmZAlxLcH/pom.xml] hasn't been released:
hasn't been released:" Exception.
It is a known issue in intellij plugin, there are multiple issues related to our issue
https://youtrack.jetbrains.com/issue/CWM-9356/com.intellij.openapi.util.TraceableDisposableDisposalException-Editor-is-already-disposed
https://youtrack.jetbrains.com/issue/IJPL-71075/com.intellij.openapi.util.TraceableDisposableDisposalException-Editor-EditorImplnull-hasnt-been-released-at-Down-and-Edit
Some Clues: We should verify the pom file creation or availability to the Editor( com.intellij.openapi.editor.impl.EditorImpl)
*/
internal class BackbaseMavenModuleBuilderTest : BasePlatformTestCase() {

private val GROUP_ID = "com.backbase"
private val VERSION= "1.0.1"


fun testCreateProject() { //TODO test failed
fun testCreateProject() {
val myProjectId = MavenId(GROUP_ID,project.name,VERSION)
val ssdkMavenId = MavenId("com.backbase.buildingblocks", "service-sdk-starter-core", "17.0.0")
val builder = BackbaseMavenModuleBuilder(myProjectId, ssdkMavenId)
Expand Down

0 comments on commit 7144bba

Please sign in to comment.