Skip to content

Commit

Permalink
Merge pull request #265 from valb3r/feature/FBP-261-camunda-plugin
Browse files Browse the repository at this point in the history
Feature/fbp 261 camunda plugin
  • Loading branch information
valb3r authored Oct 21, 2021
2 parents 98acb0d + 93abbf9 commit 1324435
Show file tree
Hide file tree
Showing 196 changed files with 7,096 additions and 597 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<!-- <helpset file="myhelp.jar" path="/Help.hs" /> -->

<!-- Minimum and maximum build of IDE compatible with the plugin -->
<idea-version since-build="182"/>
<idea-version since-build="192"/>

<!-- Resource bundle (/messages/MyPluginBundle.properties) to be used with `key` attributes in extension points
and implicit keys like `action.[pluginID].[ActionID].text` -->
Expand Down
2 changes: 1 addition & 1 deletion activiti-xml-parser/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id 'org.jetbrains.kotlin.jvm'
}

group = 'com.valb3r.bpmn.intellij.plugin'
group = 'com.valb3r.bpmn.intellij.plugin.activiti.parser'


sourceCompatibility = 1.8
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ internal class ActivityDecisionTaskTest {
{value: Boolean -> readAndUpdate(PropertyType.ASYNC, value).async.shouldBeEqualTo(value)} (false);
{value: Boolean -> readAndUpdate(PropertyType.IS_FOR_COMPENSATION, value).isForCompensation.shouldBeEqualTo(value)} (false);
{value: String -> readAndUpdate(PropertyType.DECISION_TABLE_REFERENCE_KEY, value).decisionTableReferenceKey.shouldBeEqualTo(value)} ("My table");
{value: Boolean -> assertThrows<IllegalStateException> { readAndUpdate(PropertyType.DECISION_TASK_THROW_ERROR_ON_NO_HITS, value) }} (false);
{value: Boolean -> assertThrows<IllegalStateException> { readAndUpdate(PropertyType.FALLBACK_TO_DEF_TENANT_CDATA, value) }} (false);
{value: Boolean -> readAndUpdate(PropertyType.DECISION_TASK_THROW_ERROR_ON_NO_HITS, value).decisionTaskThrowErrorOnNoHits.shouldBeNull()} (false);
{value: Boolean -> readAndUpdate(PropertyType.FALLBACK_TO_DEF_TENANT_CDATA, value).fallbackToDefaultTenantCdata.shouldBeNull()} (false);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ internal class ActivityMailTaskTest {
{value: String -> readAndUpdate(PropertyType.DOCUMENTATION, value).documentation.shouldBeEqualTo(value)} ("new docs");
{value: Boolean -> readAndUpdate(PropertyType.ASYNC, value).async.shouldBeEqualTo(value)} (false);
{value: Boolean -> readAndUpdate(PropertyType.IS_FOR_COMPENSATION, value).isForCompensation.shouldBeEqualTo(value)} (false);
{value: String -> assertThrows<IllegalStateException> {readAndUpdate(PropertyType.HEADERS, value).headers.shouldBeEqualTo(value)}} ("Header111");
{value: String -> readAndUpdate(PropertyType.HEADERS, value).headers.shouldBeNull()} ("Header111");
{value: String -> readAndUpdate(PropertyType.TO, value).to.shouldBeEqualTo(value)} ("[email protected]");
{value: String -> readAndUpdate(PropertyType.FROM, value).from.shouldBeEqualTo(value)} ("[email protected]");
{value: String -> readAndUpdate(PropertyType.SUBJECT, value).subject.shouldBeEqualTo(value)} ("Some subject to discuss?");
Expand All @@ -81,7 +81,7 @@ internal class ActivityMailTaskTest {
fun `Mail task fields are emptyable`() {
readAndSetNullString(PropertyType.NAME).name.shouldBeNullOrEmpty()
readAndSetNullString(PropertyType.DOCUMENTATION).documentation.shouldBeNullOrEmpty()
assertThrows<IllegalStateException> {readAndSetNullString(PropertyType.HEADERS)}
readAndSetNullString(PropertyType.HEADERS).headers.shouldBeNull()
readAndSetNullString(PropertyType.TO).to.shouldBeNullOrEmpty()
readAndSetNullString(PropertyType.FROM).from.shouldBeNullOrEmpty()
readAndSetNullString(PropertyType.SUBJECT).subject.shouldBeNullOrEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ internal class ActivityServiceTaskTest {
{value: String -> readAndUpdate(PropertyType.CLASS, value).clazz.shouldBeEqualTo(value)} ("com.foo.bar.another.class");
{value: String -> readAndUpdate(PropertyType.EXPRESSION, value).expression.shouldBeEqualTo(value)} ("#{some.expr()}");
{value: String -> readAndUpdate(PropertyType.RESULT_VARIABLE_NAME, value).resultVariableName.shouldBeEqualTo(value)} ("NEW_RESULT_TO");
{value: String -> assertThrows<IllegalStateException> {readAndUpdate(PropertyType.SKIP_EXPRESSION, value).skipExpression.shouldBeEqualTo(value)}} ("#{skipStuff.yes()}");
{value: Boolean -> assertThrows<IllegalStateException> {readAndUpdate(PropertyType.IS_TRIGGERABLE, value).triggerable.shouldBeEqualTo(value)}} (false);
{value: Boolean -> assertThrows<IllegalStateException> {readAndUpdate(PropertyType.IS_USE_LOCAL_SCOPE_FOR_RESULT_VARIABLE, value).useLocalScopeForResultVariable.shouldBeEqualTo(value)}} (false)
{value: String -> readAndUpdate(PropertyType.SKIP_EXPRESSION, value).skipExpression.shouldBeNull()} ("#{skipStuff.yes()}");
{value: Boolean -> readAndUpdate(PropertyType.IS_TRIGGERABLE, value).triggerable.shouldBeNull()} (false);
{value: Boolean -> readAndUpdate(PropertyType.IS_USE_LOCAL_SCOPE_FOR_RESULT_VARIABLE, value).useLocalScopeForResultVariable.shouldBeNull()} (false)
}

@Test
Expand All @@ -80,7 +80,7 @@ internal class ActivityServiceTaskTest {
readAndSetNullString(PropertyType.CLASS).clazz.shouldBeNullOrEmpty()
readAndSetNullString(PropertyType.EXPRESSION).expression.shouldBeNullOrEmpty()
readAndSetNullString(PropertyType.RESULT_VARIABLE_NAME).resultVariableName.shouldBeNullOrEmpty()
assertThrows<IllegalStateException> {readAndSetNullString(PropertyType.SKIP_EXPRESSION)}
readAndSetNullString(PropertyType.SKIP_EXPRESSION).skipExpression.shouldBeNull()
}

private fun readAndSetNullString(property: PropertyType): BpmnServiceTask {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ internal class ActivityUserTaskTest {
{value: Boolean -> readAndUpdate(PropertyType.IS_FOR_COMPENSATION, value).isForCompensation.shouldBeEqualTo(value)} (false);
{value: String -> readAndUpdate(PropertyType.ASSIGNEE, value).assignee.shouldBeEqualTo(value)} ("Assigned to");
{value: String -> readAndUpdate(PropertyType.DUE_DATE, value).dueDate.shouldBeEqualTo(value)} ("2000-01-01");
{value: String -> assertThrows<IllegalStateException> {readAndUpdate(PropertyType.CATEGORY, value).category.shouldBeEqualTo(value)}} ("SOME_CAT123");
{value: String -> readAndUpdate(PropertyType.CATEGORY, value).category.shouldBeNull()} ("SOME_CAT123");
{value: String -> readAndUpdate(PropertyType.FORM_KEY, value).formKey.shouldBeEqualTo(value)} ("KEY_90");
{value: Boolean -> assertThrows<IllegalStateException> {readAndUpdate(PropertyType.FORM_FIELD_VALIDATION, value).formFieldValidation.shouldBeEqualTo(value)}} (false);
{value: Boolean -> readAndUpdate(PropertyType.FORM_FIELD_VALIDATION, value).formFieldValidation.shouldBeNull()} (false);
{value: String -> readAndUpdate(PropertyType.PRIORITY, value).priority.shouldBeEqualTo(value)} ("22");
{value: String -> assertThrows<IllegalStateException> {readAndUpdate(PropertyType.SKIP_EXPRESSION, value).skipExpression.shouldBeEqualTo(value)}} ("#{something.wrong()}")
{value: String -> readAndUpdate(PropertyType.SKIP_EXPRESSION, value).skipExpression.shouldBeNull()} ("#{something.wrong()}")
}

@Test
Expand All @@ -77,10 +77,10 @@ internal class ActivityUserTaskTest {
readAndSetNullString(PropertyType.DOCUMENTATION).documentation.shouldBeNullOrEmpty()
readAndSetNullString(PropertyType.ASSIGNEE).assignee.shouldBeNullOrEmpty()
readAndSetNullString(PropertyType.DUE_DATE).dueDate.shouldBeNullOrEmpty()
assertThrows<IllegalStateException> {readAndSetNullString(PropertyType.CATEGORY)}
readAndSetNullString(PropertyType.CATEGORY).category.shouldBeNull()
readAndSetNullString(PropertyType.FORM_KEY).formKey.shouldBeNullOrEmpty()
readAndSetNullString(PropertyType.PRIORITY).priority.shouldBeNullOrEmpty()
assertThrows<IllegalStateException> {readAndSetNullString(PropertyType.SKIP_EXPRESSION)}
readAndSetNullString(PropertyType.SKIP_EXPRESSION).skipExpression.shouldBeNull()
}

private fun readAndSetNullString(property: PropertyType): BpmnUserTask {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.FunctionalGroupType
import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.Property
import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType
import com.valb3r.bpmn.intellij.plugin.core.CanvasBuilder
import com.valb3r.bpmn.intellij.plugin.core.events.BpmnEdgeObjectAddedEvent
import com.valb3r.bpmn.intellij.plugin.core.events.BpmnShapeObjectAddedEvent
import com.valb3r.bpmn.intellij.plugin.core.events.FileCommitter
import com.valb3r.bpmn.intellij.plugin.core.events.updateEventsRegistry
import com.valb3r.bpmn.intellij.plugin.core.events.*
import com.valb3r.bpmn.intellij.plugin.core.newelements.newElementsFactory
import com.valb3r.bpmn.intellij.plugin.core.properties.SelectedValueAccessor
import com.valb3r.bpmn.intellij.plugin.core.properties.TextValueAccessor
import com.valb3r.bpmn.intellij.plugin.core.properties.propertiesVisualizer
Expand Down Expand Up @@ -108,11 +106,11 @@ abstract class BaseUiTest {
protected val serviceTaskEndDiagramId = DiagramElementId("DIAGRAM-endServiceTask")
protected val sequenceFlowDiagramId = DiagramElementId("DIAGRAM-sequenceFlow")

protected val bpmnServiceTaskStart = BpmnServiceTask(serviceTaskStartBpmnId, null, null, null, null, null, null, null, null, null, null, null, null)
protected val bpmnSubProcess = BpmnSubProcess(subprocessBpmnId, null, null, null, null, false, false)
protected val bpmnNestedSubProcess = BpmnSubProcess(subprocessInSubProcessBpmnId, null, null, null, null, false, false)
protected val bpmnServiceTaskEnd = BpmnServiceTask(serviceTaskEndBpmnId, null, null, null, null, null, null, null, null, null, null, null, null)
protected val bpmnSequenceFlow = BpmnSequenceFlow(sequenceFlowBpmnId, null, null, null, null, null)
protected val bpmnServiceTaskStart = BpmnServiceTask(serviceTaskStartBpmnId)
protected val bpmnSubProcess = BpmnSubProcess(subprocessBpmnId, triggeredByEvent = false, transactionalSubprocess = false)
protected val bpmnNestedSubProcess = BpmnSubProcess(subprocessInSubProcessBpmnId, triggeredByEvent = false, transactionalSubprocess = false)
protected val bpmnServiceTaskEnd = BpmnServiceTask(serviceTaskEndBpmnId)
protected val bpmnSequenceFlow = BpmnSequenceFlow(sequenceFlowBpmnId)
protected val diagramServiceTaskStart = ShapeElement(serviceTaskStartDiagramId, bpmnServiceTaskStart.id, BoundsElement(startElemX, startElemY, serviceTaskSize, serviceTaskSize))
protected val diagramServiceTaskEnd = ShapeElement(serviceTaskEndDiagramId, bpmnServiceTaskEnd.id, BoundsElement(endElemX, endElemY, serviceTaskSize, serviceTaskSize))
protected val diagramSubProcess = ShapeElement(subprocessDiagramId, subprocessBpmnId, BoundsElement(subProcessElemX, subProcessElemY, subProcessSize, subProcessSize))
Expand Down Expand Up @@ -146,7 +144,7 @@ abstract class BaseUiTest {
null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null,
null, null, null, null, null
null, null, null, null, null, null ,null, null, null
)

protected val textFieldsConstructed: MutableMap<Pair<BpmnElementId, PropertyType>, TextValueAccessor> = mutableMapOf()
Expand Down Expand Up @@ -227,6 +225,7 @@ abstract class BaseUiTest {
val id = Pair(elementId, PropertyType.ID)
clickOnId(diagramElementId)
propertiesVisualizer(project).visualize(
newElementsFactory(project),
currentStateProvider(project).currentState().elemPropertiesByStaticElementId,
elementId
)
Expand All @@ -237,6 +236,7 @@ abstract class BaseUiTest {
protected fun changeSelectedIdViaPropertiesVisualizer(elementId: BpmnElementId, newId: String) {
val id = Pair(elementId, PropertyType.ID)
propertiesVisualizer(project).visualize(
newElementsFactory(project),
currentStateProvider(project).currentState().elemPropertiesByStaticElementId,
elementId
)
Expand Down Expand Up @@ -276,7 +276,8 @@ abstract class BaseUiTest {

argumentCaptor<List<EventPropagatableToXml>>().let {
verify(fileCommitter).executeCommitAndGetHash(any(), it.capture(), any(), any())
it.firstValue.shouldHaveSize(1)
it.firstValue.shouldHaveSize(3)
it.firstValue.filterIsInstance<StringValueUpdatedEvent>().shouldHaveSize(2).map { value -> value.property }.toSet().shouldContainSame(arrayOf(PropertyType.BPMN_INCOMING, PropertyType.BPMN_OUTGOING))
return it.firstValue.filterIsInstance<BpmnEdgeObjectAddedEvent>().shouldHaveSingleItem()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ abstract class DefaultXmlInjector: MultiHostInjector {
return
}

if (!context.containingFile.name.endsWith("bpmn20.xml") && context.containingFile?.context?.containingFile?.name?.endsWith("bpmn20.xml") != true) {
return
}
if (invalidXmlFileExtension(context)) return

when (context) {
is XmlAttributeValue -> {
Expand All @@ -38,6 +36,10 @@ abstract class DefaultXmlInjector: MultiHostInjector {
}
}

protected open fun invalidXmlFileExtension(context: PsiLanguageInjectionHost): Boolean {
return !context.containingFile.name.endsWith("bpmn20.xml") && context.containingFile?.context?.containingFile?.name?.endsWith("bpmn20.xml") != true
}

private fun tryToInjectSkipExpression(context: XmlAttributeValue, asHost: PsiLanguageInjectionHost, registrar: MultiHostRegistrar): Boolean {
return injectByAttrName("skipExpression", context, asHost, registrar)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class ProcessModelUpdateEvents(private val committer: FileCommitter, private val
}

@Synchronized
fun addElementRemovedEvent(diagram: List<DiagramElementRemovedEvent>, bpmn: List<BpmnElementRemovedEvent>) {
fun addElementRemovedEvent(diagram: List<DiagramElementRemovedEvent>, bpmn: List<BpmnElementRemovedEvent>, other: List<PropertyUpdateWithId> = emptyList()) {
disableRedo()
val current = allBeforeThis
val blockSize = diagram.size + bpmn.size
Expand All @@ -182,6 +182,12 @@ class ProcessModelUpdateEvents(private val committer: FileCommitter, private val
deletionsByStaticBpmnId.computeIfAbsent(event.bpmnElementId) { CopyOnWriteArrayList() } += toStore
}

other.forEachIndexed { index, event ->
val toStore = Order(current + index, event, EventBlock(blockSize))
updates.add(toStore)
propertyUpdatesByStaticId.computeIfAbsent(event.bpmnElementId) { CopyOnWriteArrayList() } += toStore
}

commitToFile()
}

Expand Down
Loading

0 comments on commit 1324435

Please sign in to comment.