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.
#265 | Added edges coloring for Business Process Diagrams
- Loading branch information
Showing
11 changed files
with
117 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<list> | ||
<colors> | ||
<!-- EDGES --> | ||
|
||
<option name="BP_DIAGRAM_OK_EDGE" value="098000"/> | ||
<option name="BP_DIAGRAM_NOK_EDGE" value="A1312A"/> | ||
<option name="BP_DIAGRAM_TIMEOUT_EDGE" value="A1312A"/> | ||
<option name="BP_DIAGRAM_DEFAULT_EDGE" value="9B9EA1"/> | ||
</colors> | ||
</list> |
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,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<list> | ||
<colors> | ||
<!-- EDGES --> | ||
|
||
<option name="BP_DIAGRAM_OK_EDGE" value="098000"/> | ||
<option name="BP_DIAGRAM_NOK_EDGE" value="A1312A"/> | ||
<option name="BP_DIAGRAM_TIMEOUT_EDGE" value="A1312A"/> | ||
<option name="BP_DIAGRAM_DEFAULT_EDGE" value="474747"/> | ||
|
||
</colors> | ||
</list> |
31 changes: 31 additions & 0 deletions
31
src/com/intellij/idea/plugin/hybris/diagram/businessProcess/BpColors.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,31 @@ | ||
/* | ||
* 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.openapi.editor.colors.ColorKey | ||
import com.intellij.openapi.editor.colors.ColorKey.createColorKeyWithFallback | ||
import com.intellij.openapi.editor.colors.ColorKey.find | ||
|
||
object BpColors { | ||
|
||
val OK: ColorKey = createColorKeyWithFallback("BP_DIAGRAM_OK_EDGE", find("DIAGRAM_DEFAULT_EDGE")) | ||
val NOK: ColorKey = createColorKeyWithFallback("BP_DIAGRAM_NOK_EDGE", find("DIAGRAM_DEFAULT_EDGE")) | ||
val TIMEOUT: ColorKey = createColorKeyWithFallback("BP_DIAGRAM_TIMEOUT_EDGE", find("DIAGRAM_DEFAULT_EDGE")) | ||
val DEFAULT: ColorKey = createColorKeyWithFallback("BP_DIAGRAM_DEFAULT_EDGE", find("DIAGRAM_DEFAULT_EDGE")) | ||
} |
68 changes: 0 additions & 68 deletions
68
...om/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramColorManagerIml.java
This file was deleted.
Oops, something went wrong.
49 changes: 49 additions & 0 deletions
49
src/com/intellij/idea/plugin/hybris/diagram/businessProcess/impl/BpDiagramColorManagerIml.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,49 @@ | ||
/* | ||
* This file is part of "hybris integration" plugin for Intellij IDEA. | ||
* Copyright (C) 2014-2016 Alexander Bartash <[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.DiagramBuilder | ||
import com.intellij.diagram.DiagramEdge | ||
import com.intellij.idea.plugin.hybris.common.utils.HybrisI18NBundleUtils.message | ||
import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpColors.DEFAULT | ||
import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpColors.NOK | ||
import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpColors.OK | ||
import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpColors.TIMEOUT | ||
import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpDiagramColorManager | ||
import com.intellij.openapi.editor.colors.ColorKey | ||
import org.apache.commons.lang3.StringUtils | ||
|
||
class BpDiagramColorManagerIml : BpDiagramColorManager() { | ||
|
||
private val badEdges = arrayOf("NOK", "ERROR", "FAIL") | ||
|
||
override fun getEdgeColorKey(builder: DiagramBuilder, edge: DiagramEdge<*>): ColorKey { | ||
val edgeType = edge.relationship.toString() | ||
|
||
return when { | ||
isOK(edgeType) -> OK | ||
isNOK(edgeType) -> NOK | ||
isTIMEOUT(edgeType) -> TIMEOUT | ||
else -> DEFAULT | ||
} | ||
} | ||
|
||
private fun isOK(edgeType: String) = StringUtils.isBlank(edgeType) || "OK".equals(edgeType, ignoreCase = true) | ||
private fun isNOK(edgeType: String) = badEdges.contains(edgeType.uppercase()) | ||
private fun isTIMEOUT(edgeType: String) = StringUtils.startsWith(edgeType, message("hybris.business.process.timeout")) | ||
} |
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