forked from unshare/hybris-integration-intellij-idea-plugin
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#331 | Added generate Diagram run line marker for Business Process an…
…d `items.xml`
- Loading branch information
Showing
9 changed files
with
138 additions
and
6 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
32 changes: 32 additions & 0 deletions
32
...ij/idea/plugin/hybris/diagram/businessProcess/actions/ShowBusinessProcessDiagramAction.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,32 @@ | ||
/* | ||
* 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.actions | ||
|
||
import com.intellij.idea.plugin.hybris.actions.ActionUtils | ||
import com.intellij.idea.plugin.hybris.diagram.businessProcess.BpDiagramProvider | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.uml.core.actions.ShowDiagram | ||
|
||
class ShowBusinessProcessDiagramAction : ShowDiagram() { | ||
|
||
override fun update(e: AnActionEvent) { | ||
e.presentation.isEnabledAndVisible = ActionUtils.isHybrisContext(e) | ||
} | ||
|
||
override fun getForcedProvider(e: AnActionEvent) = BpDiagramProvider() | ||
} |
44 changes: 44 additions & 0 deletions
44
...ris/diagram/businessProcess/execution/lineMarker/ShowBPDiagramRunLineMarkerContributor.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,44 @@ | ||
/* | ||
* 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.execution.lineMarker | ||
|
||
import com.intellij.execution.lineMarker.RunLineMarkerContributor | ||
import com.intellij.icons.AllIcons | ||
import com.intellij.idea.plugin.hybris.common.HybrisConstants | ||
import com.intellij.idea.plugin.hybris.system.businessProcess.model.Process | ||
import com.intellij.openapi.actionSystem.ActionManager | ||
import com.intellij.psi.PsiElement | ||
import com.intellij.psi.xml.XmlFile | ||
import com.intellij.psi.xml.XmlTag | ||
import com.intellij.psi.xml.XmlToken | ||
import com.intellij.util.xml.DomManager | ||
|
||
class ShowBPDiagramRunLineMarkerContributor : RunLineMarkerContributor() { | ||
|
||
override fun getInfo(element: PsiElement): Info? { | ||
if (element !is XmlToken) return null | ||
if (element.parent !is XmlTag) return null | ||
val xmlFile = element.containingFile as? XmlFile ?: return null | ||
|
||
if (element.text != HybrisConstants.ROOT_TAG_BUSINESS_PROCESS_XML) return null | ||
if (DomManager.getDomManager(xmlFile.project).getFileElement(xmlFile, Process::class.java) == null) return null | ||
|
||
val action = ActionManager.getInstance().getAction("ShowBusinessProcessDiagram") ?: return null | ||
return Info(AllIcons.FileTypes.Diagram, arrayOf(action)) { action.templateText } | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...n/hybris/diagram/typeSystem/execution/lineMarker/ShowTSDiagramRunLineMarkerContributor.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,44 @@ | ||
/* | ||
* 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.typeSystem.execution.lineMarker | ||
|
||
import com.intellij.execution.lineMarker.RunLineMarkerContributor | ||
import com.intellij.icons.AllIcons | ||
import com.intellij.idea.plugin.hybris.common.HybrisConstants | ||
import com.intellij.idea.plugin.hybris.system.type.model.Items | ||
import com.intellij.openapi.actionSystem.ActionManager | ||
import com.intellij.psi.PsiElement | ||
import com.intellij.psi.xml.XmlFile | ||
import com.intellij.psi.xml.XmlTag | ||
import com.intellij.psi.xml.XmlToken | ||
import com.intellij.util.xml.DomManager | ||
|
||
class ShowTSDiagramRunLineMarkerContributor : RunLineMarkerContributor() { | ||
|
||
override fun getInfo(element: PsiElement): Info? { | ||
if (element !is XmlToken) return null | ||
if (element.parent !is XmlTag) return null | ||
val xmlFile = element.containingFile as? XmlFile ?: return null | ||
|
||
if (element.text != HybrisConstants.ROOT_TAG_ITEMS_XML) return null | ||
if (DomManager.getDomManager(xmlFile.project).getFileElement(xmlFile, Items::class.java) == null) return null | ||
|
||
val action = ActionManager.getInstance().getAction("ShowTypeSystemDiagram") ?: return null | ||
return Info(AllIcons.FileTypes.Diagram, arrayOf(action)) { action.templateText } | ||
} | ||
} |
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