forked from unshare/hybris-integration-intellij-idea-plugin
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#267 | Added node properties for Business Process Diagrams
- Loading branch information
Showing
28 changed files
with
360 additions
and
151 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
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
29 changes: 29 additions & 0 deletions
29
src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpDiagramNodeContentManager.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,29 @@ | ||
/* | ||
* This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. | ||
* Copyright (C) 2019 EPAM Systems <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.intellij.idea.plugin.hybris.diagram.businessProcess | ||
|
||
import com.intellij.diagram.DiagramNodeContentManager | ||
import com.intellij.openapi.application.ApplicationManager | ||
|
||
interface BpDiagramNodeContentManager : DiagramNodeContentManager { | ||
|
||
companion object { | ||
val instance: BpDiagramNodeContentManager = ApplicationManager.getApplication().getService(BpDiagramNodeContentManager::class.java) | ||
} | ||
} |
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
82 changes: 82 additions & 0 deletions
82
src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpGraphFactory.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,82 @@ | ||
/* | ||
* This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. | ||
* Copyright (C) 2019 EPAM Systems <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.intellij.idea.plugin.hybris.diagram.businessProcess | ||
|
||
import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphDefaultNode | ||
import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphNode | ||
import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphParameterNodeField | ||
import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphRootNode | ||
import com.intellij.idea.plugin.hybris.system.businessProcess.model.* | ||
import com.intellij.util.xml.DomElement | ||
|
||
object BpGraphFactory { | ||
|
||
fun buildNode(nodeName: String, element: Action, rootGraphNode: BpGraphRootNode): BpGraphNode { | ||
val properties = mutableListOf( | ||
BpGraphParameterNodeField(Action.CAN_JOIN_PREVIOUS_NODE, (element.canJoinPreviousNode.stringValue | ||
?: "false")) | ||
) | ||
element.node.stringValue | ||
?.let { properties.add(BpGraphParameterNodeField(Action.NODE, it)) } | ||
element.nodeGroup.stringValue | ||
?.let { properties.add(BpGraphParameterNodeField(Action.NODE_GROUP, it)) } | ||
element.bean.stringValue | ||
?.let { properties.add(BpGraphParameterNodeField(Action.BEAN, it)) } | ||
element.parameters | ||
.forEach { | ||
properties.add(BpGraphParameterNodeField(it.name.stringValue ?: "", it.value.stringValue ?: "")) | ||
} | ||
|
||
return BpGraphDefaultNode(nodeName, element, rootGraphNode.virtualFile, rootGraphNode.process, properties.toTypedArray()) | ||
} | ||
|
||
fun buildNode(nodeName: String, element: End, rootGraphNode: BpGraphRootNode): BpGraphNode { | ||
val properties = (element.state.stringValue | ||
?.let { arrayOf(BpGraphParameterNodeField(End.STATE, it)) } | ||
?: emptyArray()) | ||
return BpGraphDefaultNode(nodeName, element, rootGraphNode.virtualFile, rootGraphNode.process, properties) | ||
} | ||
|
||
fun buildNode(nodeName: String, element: Wait, rootGraphNode: BpGraphRootNode): BpGraphNode { | ||
val properties = mutableListOf( | ||
BpGraphParameterNodeField(Wait.PREPEND_PROCESS_CODE, (element.prependProcessCode.stringValue | ||
?: "true")) | ||
) | ||
return BpGraphDefaultNode(nodeName, element, rootGraphNode.virtualFile, rootGraphNode.process, properties.toTypedArray()) | ||
} | ||
|
||
fun buildNode(nodeName: String, element: Notify, rootGraphNode: BpGraphRootNode): BpGraphNode { | ||
val properties = element.userGroups | ||
.filter { it.name.stringValue?.isNotEmpty() ?: false } | ||
.map { BpGraphParameterNodeField(it.name.stringValue!!, "") } | ||
.toTypedArray() | ||
return BpGraphDefaultNode(nodeName, element, rootGraphNode.virtualFile, rootGraphNode.process, properties) | ||
} | ||
|
||
fun buildNode(nodeName: String, element: ScriptAction, rootGraphNode: BpGraphRootNode): BpGraphNode { | ||
val properties = element.script.type.stringValue | ||
?.let { arrayOf(BpGraphParameterNodeField(ScriptAction.SCRIPT, it)) } | ||
?: emptyArray() | ||
return BpGraphDefaultNode(nodeName, element, rootGraphNode.virtualFile, rootGraphNode.process, properties) | ||
} | ||
|
||
fun buildNode(nodeName: String, element: DomElement, rootGraphNode: BpGraphRootNode) = BpGraphDefaultNode(nodeName, element, rootGraphNode.virtualFile, rootGraphNode.process) | ||
|
||
|
||
} |
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
42 changes: 42 additions & 0 deletions
42
...tellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramNodeContentManagerImpl.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,42 @@ | ||
/* | ||
* This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. | ||
* Copyright (C) 2019 EPAM Systems <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.intellij.idea.plugin.hybris.diagram.businessProcess.impl | ||
|
||
import com.intellij.diagram.AbstractDiagramNodeContentManager | ||
import com.intellij.diagram.DiagramBuilder | ||
import com.intellij.diagram.DiagramCategory | ||
import com.intellij.icons.AllIcons | ||
import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpDiagramNodeContentManager | ||
import com.intellij.idea.plugin.hybris.diagram.businessProcess.node.graph.BpGraphParameterNodeField | ||
|
||
class BpDiagramNodeContentManagerImpl : AbstractDiagramNodeContentManager(), BpDiagramNodeContentManager { | ||
|
||
override fun getContentCategories() = CATEGORIES | ||
|
||
override fun isInCategory(nodeElement: Any?, item: Any?, category: DiagramCategory, builder: DiagramBuilder?) = when (nodeElement) { | ||
is BpGraphParameterNodeField -> category == PARAMETERS | ||
else -> super<AbstractDiagramNodeContentManager>.isInCategory(nodeElement, item, category, builder) | ||
} | ||
|
||
companion object { | ||
private val PARAMETERS = DiagramCategory({ "Parameters" }, AllIcons.Nodes.Property, true, false) | ||
private val CATEGORIES = arrayOf(PARAMETERS) | ||
} | ||
|
||
} |
Oops, something went wrong.