From 1f7e9180782b3a4dbf294d71000159f6a9b479de Mon Sep 17 00:00:00 2001 From: Mykhailo Lytvyn Date: Thu, 12 Jan 2023 19:41:52 +0100 Subject: [PATCH] #155 | Added localextensions.xml DOM model and custom Icon --- .../META-INF/optional-lang-dependencies.xml | 6 + resources/META-INF/plugin-release-info.xml | 1 + resources/i18n/HybrisBundle.properties | 3 + .../hybris/common/utils/HybrisIcons.java | 1 + .../localExtensions/LeSDomFileDescription.kt | 36 ++++++ .../localExtensions/model/Extension.java | 63 ++++++++++ .../localExtensions/model/Extensions.java | 109 ++++++++++++++++++ .../localExtensions/model/Hybrisconfig.java | 51 ++++++++ .../system/localExtensions/model/Scan.java | 77 +++++++++++++ .../system/localExtensions/model/Webapp.java | 76 ++++++++++++ 10 files changed, 423 insertions(+) create mode 100644 src/com/intellij/idea/plugin/hybris/system/localExtensions/LeSDomFileDescription.kt create mode 100644 src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Extension.java create mode 100644 src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Extensions.java create mode 100644 src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Hybrisconfig.java create mode 100644 src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Scan.java create mode 100644 src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Webapp.java diff --git a/resources/META-INF/optional-lang-dependencies.xml b/resources/META-INF/optional-lang-dependencies.xml index c1c5c1d97..55a27e2e0 100644 --- a/resources/META-INF/optional-lang-dependencies.xml +++ b/resources/META-INF/optional-lang-dependencies.xml @@ -57,6 +57,12 @@ + + + + + diff --git a/resources/META-INF/plugin-release-info.xml b/resources/META-INF/plugin-release-info.xml index 3a55d5000..59cfd059e 100644 --- a/resources/META-INF/plugin-release-info.xml +++ b/resources/META-INF/plugin-release-info.xml @@ -131,6 +131,7 @@
  • Feature: Inspection for beans.xml rely on whole Bean System, not only current file (#88)
  • Feature: Regrouped [y] Application settings into separate sections (#130)
  • Feature: New Remote Instance Wizard will prefill some data from [y] properties (#143)
  • +
  • Feature: Added localextensions.xml DOM model and custom Icon (#155)
  • Feature: Added extensioninfo.xml DOM model and custom Icon (#147)
  • Feature: Added process.xml DOM model and custom Icon (#148)
  • Feature: Decreases cognitive complexity for Code Completion and custom Icons (#152)
  • diff --git a/resources/i18n/HybrisBundle.properties b/resources/i18n/HybrisBundle.properties index 36f43566b..7959d9d30 100644 --- a/resources/i18n/HybrisBundle.properties +++ b/resources/i18n/HybrisBundle.properties @@ -244,6 +244,9 @@ hybris.inspections.ei.EiDuplicateExtensionDefinition.key=[y] Dependency on exten hybris.inspections.fix.ei.EiDuplicateExtensionDefinition.message=[y] Dependency on ''{0}'' extension is already declared hybris.inspections.fix.ei.EiUnknownExtensionDefinition.message=[y] Unknown ''{0}'' extension +hybris.inspections.le.LeUnknownExtensionDefinition.key=[y] Unknown extension +hybris.inspections.fix.le.LeUnknownExtensionDefinition.message=[y] Unknown ''{0}'' extension + hybris.inspections.fix.xml.AddTag=Add tag {0} hybris.inspections.fix.xml.AddTagWithAttributes=Add tag {0} with {1} hybris.inspections.fix.xml.AddAttribute=Add attribute {0} diff --git a/src/com/intellij/idea/plugin/hybris/common/utils/HybrisIcons.java b/src/com/intellij/idea/plugin/hybris/common/utils/HybrisIcons.java index 0b1cb6f70..e34610ee3 100644 --- a/src/com/intellij/idea/plugin/hybris/common/utils/HybrisIcons.java +++ b/src/com/intellij/idea/plugin/hybris/common/utils/HybrisIcons.java @@ -42,6 +42,7 @@ private HybrisIcons() { public static final Icon HYBRIS = getIcon("/icons/hybrisIcon.svg"); public static final Icon EXTENSION_INFO = getIcon("/icons/extensionInfo.svg"); + public static final Icon LOCAL_EXTENSIONS = getIcon("/icons/extensionInfo.svg"); public static final Icon BUSINESS_PROCESS = getIcon("/icons/businessProcess.svg"); public static final Icon HYBRIS_REMOTE = getIcon("/icons/hybrisRemoteIcon.svg"); public static final Icon MONITORING = getIcon("/icons/monitoring.svg"); diff --git a/src/com/intellij/idea/plugin/hybris/system/localExtensions/LeSDomFileDescription.kt b/src/com/intellij/idea/plugin/hybris/system/localExtensions/LeSDomFileDescription.kt new file mode 100644 index 000000000..c87b0b949 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/system/localExtensions/LeSDomFileDescription.kt @@ -0,0 +1,36 @@ +/* + * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. + * Copyright (C) 2019 EPAM Systems + * + * 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 . + */ + +package com.intellij.idea.plugin.hybris.system.localExtensions + +import com.intellij.idea.plugin.hybris.common.HybrisConstants +import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons +import com.intellij.idea.plugin.hybris.system.localExtensions.model.Hybrisconfig +import com.intellij.openapi.module.Module +import com.intellij.psi.xml.XmlFile +import com.intellij.util.xml.DomFileDescription +import javax.swing.Icon + +class LeSDomFileDescription : DomFileDescription(Hybrisconfig::class.java, "hybrisconfig") { + + override fun getFileIcon(flags: Int): Icon = HybrisIcons.LOCAL_EXTENSIONS + + override fun isMyFile(file: XmlFile, module: Module?) = super.isMyFile(file, module) + && file.name == HybrisConstants.LOCAL_EXTENSIONS_XML + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Extension.java b/src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Extension.java new file mode 100644 index 000000000..a5052a553 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Extension.java @@ -0,0 +1,63 @@ +/* + * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. + * Copyright (C) 2019 EPAM Systems + * + * 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 . + */ + +// Generated on Thu Jan 12 19:15:30 CET 2023 +// DTD/Schema : null + +package com.intellij.idea.plugin.hybris.system.localExtensions.model; + +import com.intellij.util.xml.*; +import com.intellij.util.xml.DomElement; +import org.jetbrains.annotations.NotNull; + +/** + * null:extensionType interface. + *
    + * 

    Type null:extensionType documentation

    + * Adds an extension to the hybris platform. + *
    + */ +public interface Extension extends DomElement { + + /** + * Returns the value of the dir child. + *
    +	 * 

    Attribute null:dir documentation

    + * Path to the extension folder relative to the platform home. + *
    + * @return the value of the dir child. + */ + @NotNull + @Attribute ("dir") + GenericAttributeValue getDir(); + + + /** + * Returns the value of the name child. + *
    +	 * 

    Attribute null:name documentation

    + * The name of the extension. Requires at least one <scan> entry to be able to look up the extension location. + *
    + * @return the value of the name child. + */ + @NotNull + @Attribute ("name") + GenericAttributeValue getName(); + + +} diff --git a/src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Extensions.java b/src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Extensions.java new file mode 100644 index 000000000..2a35494de --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Extensions.java @@ -0,0 +1,109 @@ +/* + * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. + * Copyright (C) 2019 EPAM Systems + * + * 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 . + */ + +// Generated on Thu Jan 12 19:15:30 CET 2023 +// DTD/Schema : null + +package com.intellij.idea.plugin.hybris.system.localExtensions.model; + +import com.intellij.util.xml.*; +import com.intellij.util.xml.DomElement; +import org.jetbrains.annotations.NotNull; + +/** + * null:extensionsType interface. + *
    + * 

    Type null:extensionsType documentation

    + * Configures the installed extensions for the hybris platform.. + *
    + */ +public interface Extensions extends DomElement { + + /** + * Returns the value of the autoload child. + *
    +	 * 

    Attribute null:autoload documentation

    + * Loads automatically all extensions of the platform. If set to 'false', you + * have to manually add the platform extensions in the (local)extensions.xml file. + * Default value is 'true'. + *
    + * @return the value of the autoload child. + */ + @NotNull + @Attribute ("autoload") + GenericAttributeValue getAutoload(); + + + /** + * Returns the list of path children. + *
    +	 * 

    Element null:path documentation

    + * Adds a directory to scan for extensions in. + *
    + * @return the list of path children. + */ + @NotNull + @SubTagList ("path") + java.util.List getPaths(); + /** + * Adds new child to the list of path children. + * @return created child + */ + @SubTagList ("path") + Scan addPath(); + + + /** + * Returns the list of extension children. + *
    +	 * 

    Element null:extension documentation

    + * Adds an extension to the hybris platform. + *
    + * @return the list of extension children. + */ + @NotNull + @SubTagList ("extension") + java.util.List getExtensions(); + /** + * Adds new child to the list of extension children. + * @return created child + */ + @SubTagList ("extension") + Extension addExtension(); + + + /** + * Returns the list of webapp children. + *
    +	 * 

    Element null:webapp documentation

    + * Adds external extensions to the hybris platform. + *
    + * @return the list of webapp children. + */ + @NotNull + @SubTagList ("webapp") + java.util.List getWebapps(); + /** + * Adds new child to the list of webapp children. + * @return created child + */ + @SubTagList ("webapp") + Webapp addWebapp(); + + +} diff --git a/src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Hybrisconfig.java b/src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Hybrisconfig.java new file mode 100644 index 000000000..df2d5bc13 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Hybrisconfig.java @@ -0,0 +1,51 @@ +/* + * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. + * Copyright (C) 2019 EPAM Systems + * + * 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 . + */ + +// Generated on Thu Jan 12 19:15:30 CET 2023 +// DTD/Schema : null + +package com.intellij.idea.plugin.hybris.system.localExtensions.model; + +import com.intellij.util.xml.*; +import com.intellij.util.xml.DomElement; +import org.jetbrains.annotations.NotNull; + +/** + * null:hybrisconfigElemType interface. + *
    + * 

    Type null:hybrisconfigElemType documentation

    + * Configures the installed extensions for the hybris platform. + *
    + */ +public interface Hybrisconfig extends DomElement { + + /** + * Returns the value of the extensions child. + *
    +	 * 

    Element null:extensions documentation

    + * Configures the installed extensions for the hybris platform.. + *
    + * @return the value of the extensions child. + */ + @NotNull + @SubTag ("extensions") + @Required + Extensions getExtensions(); + + +} diff --git a/src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Scan.java b/src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Scan.java new file mode 100644 index 000000000..b7ef4be0c --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Scan.java @@ -0,0 +1,77 @@ +/* + * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. + * Copyright (C) 2019 EPAM Systems + * + * 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 . + */ + +// Generated on Thu Jan 12 19:15:30 CET 2023 +// DTD/Schema : null + +package com.intellij.idea.plugin.hybris.system.localExtensions.model; + +import com.intellij.util.xml.*; +import com.intellij.util.xml.DomElement; +import org.jetbrains.annotations.NotNull; + +/** + * null:scanType interface. + *
    + * 

    Type null:scanType documentation

    + * Scans for extensions in a given folder. + *
    + */ +public interface Scan extends DomElement { + + /** + * Returns the value of the dir child. + *
    +	 * 

    Attribute null:dir documentation

    + * Path to the extension folder relative to the platform home. + *
    + * @return the value of the dir child. + */ + @NotNull + @Attribute ("dir") + @Required + GenericAttributeValue getDir(); + + + /** + * Returns the value of the autoload child. + *
    +	 * 

    Attribute null:autoload documentation

    + * Defines which extensions shall be loaded. Can be 'true' for loading all that can be found inside that folder or 'false' to load only extensions that are required by others. + *
    + * @return the value of the autoload child. + */ + @NotNull + @Attribute ("autoload") + GenericAttributeValue getAutoload(); + + + /** + * Returns the value of the depth child. + *
    +	 * 

    Attribute null:depth documentation

    + * The maximum directory depth to traverse when scanning for extensions. + *
    + * @return the value of the depth child. + */ + @NotNull + @Attribute ("depth") + GenericAttributeValue getDepth(); + + +} diff --git a/src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Webapp.java b/src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Webapp.java new file mode 100644 index 000000000..e3c2d6d4b --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/system/localExtensions/model/Webapp.java @@ -0,0 +1,76 @@ +/* + * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. + * Copyright (C) 2019 EPAM Systems + * + * 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 . + */ + +// Generated on Thu Jan 12 19:15:30 CET 2023 +// DTD/Schema : null + +package com.intellij.idea.plugin.hybris.system.localExtensions.model; + +import com.intellij.util.xml.*; +import com.intellij.util.xml.DomElement; +import org.jetbrains.annotations.NotNull; + +/** + * null:webappType interface. + *
    + * 

    Type null:webappType documentation

    + * Adds external extension to the hybris platform. + *
    + */ +public interface Webapp extends DomElement { + + /** + * Returns the value of the contextroot child. + *
    +	 * 

    Attribute null:contextroot documentation

    + * External extension's webroot. + *
    + * @return the value of the contextroot child. + */ + @NotNull + @Attribute ("contextroot") + GenericAttributeValue getContextroot(); + + + /** + * Returns the value of the context child. + *
    +	 * 

    Attribute null:context documentation

    + * External extension's context.xml file. + *
    + * @return the value of the context child. + */ + @NotNull + @Attribute ("context") + GenericAttributeValue getContext(); + + + /** + * Returns the value of the path child. + *
    +	 * 

    Attribute null:path documentation

    + * Path to external extension's war file (or exploded directory). + *
    + * @return the value of the path child. + */ + @NotNull + @Attribute ("path") + GenericAttributeValue getPath(); + + +}