-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from valb3r/feature/FBP-5-support-for-add-remo…
…ve-bpmn-elem Feature/fbp 5 support for add remove bpmn elem
- Loading branch information
Showing
36 changed files
with
894 additions
and
164 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
11 changes: 9 additions & 2 deletions
11
...n/intellij/plugin/render/CanvasBuilder.kt → ...b3r/bpmn/intellij/plugin/CanvasBuilder.kt
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,20 +1,27 @@ | ||
package com.valb3r.bpmn.intellij.plugin.render | ||
package com.valb3r.bpmn.intellij.plugin | ||
|
||
import com.intellij.psi.PsiFile | ||
import com.intellij.ui.EditorTextField | ||
import com.valb3r.bpmn.intellij.plugin.events.updateEventsRegistry | ||
import com.valb3r.bpmn.intellij.plugin.flowable.parser.FlowableObjectFactory | ||
import com.valb3r.bpmn.intellij.plugin.flowable.parser.FlowableParser | ||
import com.valb3r.bpmn.intellij.plugin.newelements.NewElementsProvider | ||
import com.valb3r.bpmn.intellij.plugin.newelements.newElementsFactory | ||
import com.valb3r.bpmn.intellij.plugin.render.BpmnProcessRenderer | ||
import com.valb3r.bpmn.intellij.plugin.render.Canvas | ||
import javax.swing.JTable | ||
|
||
class CanvasBuilder { | ||
|
||
private val updateEvents = updateEventsRegistry() | ||
private var newObjectsFactory: NewElementsProvider? = null | ||
|
||
fun build(properties: JTable, editorFactory: (value: String) -> EditorTextField, canvas: Canvas, bpmnFile: PsiFile) { | ||
updateEvents.reset() | ||
bpmnFile.virtualFile.inputStream.use { | ||
val process = FlowableParser().parse(it) | ||
canvas.reset(properties, editorFactory, process.toView(), BpmnProcessRenderer()) | ||
newObjectsFactory = newElementsFactory(FlowableObjectFactory()) | ||
canvas.reset(properties, editorFactory, process.toView(newObjectsFactory!!), BpmnProcessRenderer()) | ||
} | ||
} | ||
} |
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
9 changes: 9 additions & 0 deletions
9
bpmn-intellij-plugin/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/MouseEventHandler.kt
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
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
23 changes: 23 additions & 0 deletions
23
...plugin/src/main/kotlin/com/valb3r/bpmn/intellij/plugin/newelements/NewElementsProvider.kt
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.valb3r.bpmn.intellij.plugin.newelements | ||
|
||
import com.valb3r.bpmn.intellij.plugin.bpmn.api.BpmnObjectFactory | ||
import java.util.concurrent.atomic.AtomicReference | ||
|
||
private val newElements = AtomicReference<NewElementsProvider>() | ||
|
||
fun newElementsFactory(factory: BpmnObjectFactory): NewElementsProvider { | ||
return newElements.updateAndGet { | ||
if (null == it) { | ||
return@updateAndGet NewElementsProvider(factory) | ||
} | ||
|
||
return@updateAndGet it | ||
} | ||
} | ||
|
||
fun newElementsFactory(): NewElementsProvider { | ||
return newElements.get()!! | ||
} | ||
|
||
|
||
class NewElementsProvider(private val factory: BpmnObjectFactory): BpmnObjectFactory by factory |
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
Oops, something went wrong.