diff --git a/.gitignore b/.gitignore index 11c162f80..5a3d2e4db 100644 --- a/.gitignore +++ b/.gitignore @@ -9,13 +9,24 @@ .idea/modules .idea/modules.xml .idea/encodings.xml +.idea/codeStyles +.idea/kotlinScripting.xml /out/ /build/ +/buildsrc/build +/buildsrc/.gradle /common/build/ /rt-ant/build/ /.gradle/ -Hybris-Integration.zip - **/.directory +/.idea/consolestorage/ +/.idea/dictionaries/ +/.idea/inspectionProfiles/ +/.idea/compiler.xml +/.idea/dataSources.xml +/.idea/jarRepositories.xml +/.idea/misc.xml +/.idea/vcs.xml +/.idea/.gitignore diff --git a/.idea/copyright/LGPL.xml b/.idea/copyright/LGPL.xml index 169e8ed8a..6bdb18a1d 100644 --- a/.idea/copyright/LGPL.xml +++ b/.idea/copyright/LGPL.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 20fc4709a..d6c7c58dd 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,18 +1,21 @@ + diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index d5d79e0ca..000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7f4..e44deea92 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 920c6782a..c0f392ba5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ * Please read [Contributor License Agreement](http://developercertificate.org) -* Available tasks are in our JIRA: [IIP](https://hybris-integration.atlassian.net/projects/IIP) and [IIPS](https://hybris-integration.atlassian.net/projects/IIPS) (requires a login but you can [sign-up](https://hybris-integration.atlassian.net/admin/users/sign-up)) -* [How to Configure Project Environment For Plugin Developers](https://hybris-integration.atlassian.net/wiki/spaces/IIPPS/pages/9863192/How+to+Configure+Project+Environment+For+Plugin+Developers") +* Available tasks are in our [project board](https://github.com/epam/sap-commerce-intellij-idea-plugin/projects/1) +* [How to Configure Project Environment For Plugin Developers](https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/setting_up_environment.html) * We are working with [Pull Requests](https://help.github.com/articles/about-pull-requests/). You need to fork this repository, implement a feature in a separate branch, then send us a pull request. * Be sure to include into your pull request and all commit messages the following line: "Signed-off-by: Your Real Name your.email@email.com" otherwise it can not be accepted. Use your real name (sorry, no pseudonyms or anonymous contributions). -* For additional questions you can send an [email](mailto:AlexanderBartash@gmail.com?cc=martin.zdarsky@hybris.com). +* For additional questions you can send an [email](mailto:hybrisideaplugin@epam.com). \ No newline at end of file diff --git a/README.md b/README.md index a86d944fc..843e47aff 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -[![Donate](https://img.shields.io/badge/Open%20Source-Donate-green.svg)](https://opencollective.com/hybris-integration-intellij-idea-plugin) -[![Support Desk](https://img.shields.io/badge/Help-Support%20Desk-red.svg)](https://hybris-integration.atlassian.net/projects/IIPS) -[![Email](https://img.shields.io/badge/Help-Contact%20a%20human-blue.svg)](mailto:AlexanderBartash@gmail.com?cc=martin.zdarsky@hybris.com) +[![Email](https://img.shields.io/badge/Help-Contact%20us-blue)](mailto:hybrisideaplugin@epam.com) [![Join the chat at https://gitter.im/sap-commerce-intellij-idea-plugin/community](https://badges.gitter.im/sap-commerce-intellij-idea-plugin/community.svg)](https://gitter.im/sap-commerce-intellij-idea-plugin/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ## Licence ## [GNU Lesser General Public License 3.0](http://www.gnu.org/licenses/) Copyright (C) 2014-2016 Alexander Bartash +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 @@ -20,47 +20,23 @@ 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 . -## Hybris Integration Intellij IDEA Plugin ## +## SAP Commerce Developers Toolset ## -This plugin provides [hybris](https://hybris.com/) integration into [Intellij IDEA](https://www.jetbrains.com/idea/) and another IDE based on it. -You can install this plugin to your IDE directly from the [repository](https://plugins.jetbrains.com/plugin/7525) by clicking on the ["Browse Repositories"](https://www.jetbrains.com/idea/help/installing-updating-and-uninstalling-repository-plugins.html) button in Settings/Plugins dialog. +This plugin provides [SAP Commerce](https://www.sap.com/products/crm/e-commerce-platforms.html) integration into [Intellij IDEA](https://www.jetbrains.com/idea/) and another IDE based on it. ## Contribution guidelines ## * Please read [Contributor License Agreement](http://developercertificate.org) -* Available tasks are in our JIRA: [IIP](https://hybris-integration.atlassian.net/projects/IIP) and [IIPS](https://hybris-integration.atlassian.net/projects/IIPS) (requires a login but you can [sign-up](https://hybris-integration.atlassian.net/admin/users/sign-up)) -* [How to Configure Project Environment For Plugin Developers](https://hybris-integration.atlassian.net/wiki/spaces/IIPPS/pages/9863192/How+to+Configure+Project+Environment+For+Plugin+Developers") +* Available tasks are in our [project board](https://github.com/epam/sap-commerce-intellij-idea-plugin/projects/1) +* [How to Configure Project Environment For Plugin Developers](https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/setting_up_environment.html) * We are working with [Pull Requests](https://help.github.com/articles/about-pull-requests/). You need to fork this repository, implement a feature in a separate branch, then send us a pull request. * Be sure to include into your pull request and all commit messages the following line: "Signed-off-by: Your Real Name your.email@email.com" otherwise it can not be accepted. Use your real name (sorry, no pseudonyms or anonymous contributions). -* For additional questions you can send an [email](mailto:AlexanderBartash@gmail.com?cc=martin.zdarsky@hybris.com). - -### Backers - -Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/hybris-integration-intellij-idea-plugin#backer)] - - - -### Sponsors - -Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/hybris-integration-intellij-idea-plugin#sponsor)] - - - - - - - - - - - +* For additional questions you can send an [email](mailto:hybrisideaplugin@epam.com). ### Contributors and Developers This project exists thanks to all the people who contribute. - - * Alexander Bartash * Vlad Bozhenok * Martin Zdarsky-Jones @@ -79,3 +55,13 @@ This project exists thanks to all the people who contribute. * Fabian Necci * Markus Perndorfer * FAIR Consulting Group +* Mykyta Kostiuk +* Dmytro Lytvynenko +* Oleksandr Shkurat +* Maxim Bilohay +* Eugene Koryakin +* Yevhenii Koshevyi +* Mykhailo Lytvyn +* Viktors Jengovatovs +* Rustam Burmenskyi +* Oleksandr Dihtiar \ No newline at end of file diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml deleted file mode 100644 index 12fe5d27a..000000000 --- a/bitbucket-pipelines.yml +++ /dev/null @@ -1,16 +0,0 @@ -# This is a sample build configuration for Java (Gradle). -# Check our guides at https://confluence.atlassian.com/x/zd-5Mw for more examples. -# Only use spaces to indent your .yml configuration. -# ----- -# You can specify a custom docker image from Docker Hub as your build environment. -image: java:8 - -pipelines: - default: - - step: - caches: - - gradle - script: # Modify the commands below to build your repository. - # You must commit the Gradle wrapper to your repository - # https://docs.gradle.org/current/userguide/gradle_wrapper.html - - bash ./gradlew buildPlugin \ No newline at end of file diff --git a/build.gradle b/build.gradle deleted file mode 100644 index b41bed5db..000000000 --- a/build.gradle +++ /dev/null @@ -1,77 +0,0 @@ -/* - * This file is part of "hybris integration" plugin for Intellij IDEA. - * Copyright (C) 2014-2016 Alexander Bartash - * - * 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 . - */ -buildscript { - repositories { - mavenCentral() - - //noinspection GroovyAssignabilityCheck - maven { - url "https://plugins.gradle.org/m2/" - } - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "gradle.plugin.org.jetbrains.intellij.plugins:gradle-intellij-plugin:$gradleIntellijPluginVersion" - } -} - -apply from: "community.gradle" - -dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - //compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - //testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" - //testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" - - compile "commons-codec:commons-codec:1.12" - compile "commons-io:commons-io:2.6" - compile "com.google.guava:guava:27.1-jre" - compile "com.google.code.findbugs:jsr305:3.0.2" - compile "org.apache.commons:commons-lang3:3.9" - compile "org.apache.commons:commons-collections4:4.3" - compile "org.apache.maven:maven-model:3.6.1" - compile "com.wutka:dtdparser:1.21" - - compile("org.apache.solr:solr-solrj:8.0.0") { - exclude group: 'org.slf4j', module: 'slf4j-api' - exclude group: 'org.apache.httpcomponents', module: 'httpclient' - exclude group: 'org.apache.httpcomponents', module: 'httpcore' - exclude group: 'org.apache.httpcomponents', module: 'httpmime' - } - - compile "com.github.ben-manes.caffeine:caffeine:2.7.0" - compile "org.jsoup:jsoup:1.11.3" - - testCompile "org.mockito:mockito-core:2.27.0" - - compile project("common") - compile project("rt-ant") -} - - -//noinspection GroovyAssignabilityCheck -task addPsiViewerPlugin { - def majorIntellijVersion = (intelijVersion as String).split("\\.").first() - def psiVersion = findProperty("psiViewerVersions.$majorIntellijVersion") - if (psiVersion != null) { - intellij.plugins += "PsiViewer:$psiVersion" - } -} - -prepareSandbox.finalizedBy addPsiViewerPlugin diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 000000000..6045aa0da --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,114 @@ +/* + * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. + * Copyright (C) 2019-2020 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 . + */ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + idea + kotlin("jvm") + id("org.jetbrains.intellij") version "1.7.0" +} + +sourceSets.main { + java.srcDirs( + file("src"), + file("gen") + ) + resources.srcDir(file("resources")) +} + +allprojects { + apply { + plugin("java") + } + + repositories { + mavenCentral() + } + + java { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + +} + +intellij { + type.set(platformType) + version.set(platformVersion) + pluginName.set(pluginName_) + downloadSources.set(platformDownloadSources) + updateSinceUntilBuild.set(intellijUpdateSinceUntilBuild) + + // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file. + plugins.addAll(*platformPlugins.split(',').map(String::trim).filter(String::isNotEmpty).toTypedArray()) +} + +tasks { + + withType().configureEach { + kotlinOptions { + jvmTarget = sourceVersion + apiVersion = kotlinApiVersion + languageVersion = kotlinApiVersion + } + } + + runIde { + jvmArgs = listOf(intellijJvmArgs) + } + + patchPluginXml { + version.set(pluginVersion) + sinceBuild.set(pluginSinceBuild) + untilBuild.set(pluginUntilBuild) + } + + runPluginVerifier { + ideVersions.addAll(pluginVerifierIdeVersions) + } + + clean { + doFirst { + delete("out") + } + } +} + +dependencies { + + implementation(kotlin("stdlib")) + implementation("org.jsoup:jsoup:$jsoupVersion") + implementation("com.wutka:dtdparser:$dtdparserVersion") + implementation("commons-io:commons-io:$commonsIOVersion") + implementation("com.google.code.findbugs:jsr305:$findbugsVersion") + implementation("org.apache.maven:maven-model:$mavenModelVersion") + implementation("commons-codec:commons-codec:$commonsCodecVersion") + implementation("org.apache.commons:commons-lang3:$commonsLang3Version") + implementation("com.github.ben-manes.caffeine:caffeine:$caffeineVersion") + implementation("org.apache.commons:commons-collections4:$commonsCollections4Version") + + implementation("org.apache.solr:solr-solrj:$solrjVersion") { + exclude("org.slf4j", "slf4j-api") + exclude("org.apache.httpcomponents", "httpclient") + exclude("org.apache.httpcomponents", "httpcore") + exclude("org.apache.httpcomponents", "httpmime") + } + + implementation(project(":rt-ant")) +} + diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 000000000..de2b702bb --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,31 @@ +/* + * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. + * Copyright (C) 2019-2020 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 . + */ + +plugins { + `kotlin-dsl` +} + + +repositories { + mavenCentral() +} + +dependencies { + val kotlin = "1.7.0" + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin") +} diff --git a/buildSrc/src/main/kotlin/configuration.kt b/buildSrc/src/main/kotlin/configuration.kt new file mode 100644 index 000000000..bba271f6c --- /dev/null +++ b/buildSrc/src/main/kotlin/configuration.kt @@ -0,0 +1,46 @@ +/* + * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. + * Copyright (C) 2019-2020 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 . + */ + +const val sourceVersion="11" +const val kotlinApiVersion="1.5" + + +// https://www.jetbrains.com/intellij-repository/releases +// https://www.jetbrains.com/intellij-repository/snapshots +// https://www.jetbrains.org/intellij/sdk/docs/reference_guide/intellij_artifacts.html +// https://data.services.jetbrains.com/products?fields=code,name,releases.downloads,releases.version,releases.build,releases.type&code=IIC,IIU + +const val intellijJvmArgs="-Xmx2G" +const val intellijUpdateSinceUntilBuild=true + +const val pluginName_ = "SAP-Commerce-Developers-Toolset" +const val pluginVersion = "2022.2" +const val pluginSinceBuild = "222.3345.118" +const val pluginUntilBuild = "222.*" + +// Plugin Verifier integration -> https://github.com/JetBrains/intellij-plugin-verifier +// https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl +// See https://jb.gg/intellij-platform-builds-list for available build versions +const val pluginVerifierIdeVersions = "IIU-221.5080.40" + +const val platformType = "IU" +const val platformVersion = "222.3345.118" +const val platformDownloadSources = true +// Plugin Dependencies -> https://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_dependencies.html +// Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 +const val platformPlugins = "ant, Spring, uml, junit, JavaEE, maven, eclipse, gradle, properties, Groovy, java-i18n, PersistenceSupport, CSS, java, gradle-java, PsiViewer:222-SNAPSHOT, copyright" diff --git a/buildSrc/src/main/kotlin/dependencies.kt b/buildSrc/src/main/kotlin/dependencies.kt new file mode 100644 index 000000000..77f9f9927 --- /dev/null +++ b/buildSrc/src/main/kotlin/dependencies.kt @@ -0,0 +1,11 @@ +const val antVersion="1.10.9" +const val solrjVersion="8.7.0" +const val jsoupVersion="1.11.3" +const val dtdparserVersion="1.21" +const val caffeineVersion="2.8.6" +const val findbugsVersion="3.0.2" +const val commonsIOVersion="2.8.0" +const val mavenModelVersion="3.6.3" +const val commonsCodecVersion="1.15" +const val commonsLang3Version="3.11" +const val commonsCollections4Version="4.4" diff --git a/community.gradle b/community.gradle deleted file mode 100644 index f660f0b10..000000000 --- a/community.gradle +++ /dev/null @@ -1,87 +0,0 @@ -/* - * This file is part of "hybris integration" plugin for Intellij IDEA. - * Copyright (C) 2014-2016 Alexander Bartash - * - * 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 . - */ -repositories { - mavenCentral() -} - -//noinspection GroovyAssignabilityCheck -allprojects { - repositories { - //noinspection GroovyAssignabilityCheck - maven { - url "https://jcenter.bintray.com" - } - } - - apply plugin: "kotlin" - - // Set source version for Java code - sourceCompatibility = sourceVersion - targetCompatibility = sourceVersion - - // Set source version for Kotlin code - compileKotlin { - kotlinOptions { - jvmTarget = sourceVersion - } - } - - sourceSets { - main { - java.srcDirs "src", "gen" - resources.srcDirs "resources" - } - - test { - java.srcDir "tests" - } - } - - //compileJava { - // options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" - //} - - //compileTestJava { - // options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" - //} - - // - // https://github.com/JetBrains/gradle-intellij-plugin - // - apply plugin: "org.jetbrains.intellij" - intellij { - setType(intelijType) - setVersion(intelijVersion) - setUpdateSinceUntilBuild(intellijUpdateSinceUntilBuild.toBoolean()) - setPlugins((intelijPlugins as String).split(", ")) - - runIde { - jvmArgs intellijJvmArgs - } - } - - patchPluginXml { - sinceBuild intellijSinceBuild - } - - // Remove Intellij build output directory - //noinspection GroovyAssignabilityCheck - clean.doFirst { - delete "out" - } -} diff --git a/gen/com/intellij/idea/plugin/hybris/impex/ImpexParser.java b/gen/com/intellij/idea/plugin/hybris/impex/ImpexParser.java index e34fa9647..e224768e4 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/ImpexParser.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/ImpexParser.java @@ -6,7 +6,6 @@ import static com.intellij.idea.plugin.hybris.impex.psi.ImpexTypes.*; import static com.intellij.idea.plugin.hybris.impex.utils.ImpexParserUtils.*; import com.intellij.psi.tree.IElementType; -import com.intellij.psi.tree.IFileElementType; import com.intellij.lang.ASTNode; import com.intellij.psi.tree.TokenSet; import com.intellij.lang.PsiParser; @@ -24,16 +23,15 @@ public void parseLight(IElementType t, PsiBuilder b) { boolean r; b = adapt_builder_(t, b, this, EXTENDS_SETS_); Marker m = enter_section_(b, 0, _COLLAPSE_, null); - if (t instanceof IFileElementType) { - r = parse_root_(t, b, 0); - } - else { - r = false; - } + r = parse_root_(t, b); exit_section_(b, 0, m, t, r, true, TRUE_CONDITION); } - protected boolean parse_root_(IElementType t, PsiBuilder b, int l) { + protected boolean parse_root_(IElementType t, PsiBuilder b) { + return parse_root_(t, b, 0); + } + + static boolean parse_root_(IElementType t, PsiBuilder b, int l) { return impexFile(b, l + 1); } @@ -129,7 +127,7 @@ public static boolean any_header_parameter_name(PsiBuilder b, int l) { if (!r) r = macro_usage_dec(b, l + 1); if (!r) r = consumeToken(b, DOCUMENT_ID); if (!r) r = consumeToken(b, FUNCTION); - exit_section_(b, l, m, r, false, recover_parameter_name_parser_); + exit_section_(b, l, m, r, false, ImpexParser::recover_parameter_name); return r; } @@ -178,24 +176,15 @@ private static boolean bean_shell_1_0(PsiBuilder b, int l) { } /* ********************************************************** */ - // COMMENT_MARKER COMMENT_BODY? + // LINE_COMMENT public static boolean comment(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "comment")) return false; - if (!nextTokenIs(b, COMMENT_MARKER)) return false; - boolean r, p; - Marker m = enter_section_(b, l, _NONE_, COMMENT, null); - r = consumeToken(b, COMMENT_MARKER); - p = r; // pin = 1 - r = r && comment_1(b, l + 1); - exit_section_(b, l, m, r, p, null); - return r || p; - } - - // COMMENT_BODY? - private static boolean comment_1(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "comment_1")) return false; - consumeToken(b, COMMENT_BODY); - return true; + if (!nextTokenIs(b, LINE_COMMENT)) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, LINE_COMMENT); + exit_section_(b, m, COMMENT, r); + return r; } /* ********************************************************** */ @@ -209,7 +198,7 @@ public static boolean full_header_parameter(PsiBuilder b, int l) { r = r && report_error_(b, full_header_parameter_1(b, l + 1)); r = p && report_error_(b, full_header_parameter_2(b, l + 1)) && r; r = p && full_header_parameter_3(b, l + 1) && r; - exit_section_(b, l, m, r, p, not_line_break_or_parameters_separator_parser_); + exit_section_(b, l, m, r, p, ImpexParser::not_line_break_or_parameters_separator); return r || p; } @@ -246,7 +235,7 @@ public static boolean full_header_type(PsiBuilder b, int l) { Marker m = enter_section_(b, l, _NONE_, FULL_HEADER_TYPE, ""); r = header_type_name(b, l + 1); r = r && full_header_type_1(b, l + 1); - exit_section_(b, l, m, r, false, not_line_break_or_parameters_separator_parser_); + exit_section_(b, l, m, r, false, ImpexParser::not_line_break_or_parameters_separator); return r; } @@ -311,7 +300,7 @@ public static boolean header_type_name(PsiBuilder b, int l) { boolean r; Marker m = enter_section_(b, l, _NONE_, HEADER_TYPE_NAME, "
"); r = consumeToken(b, HEADER_TYPE); - exit_section_(b, l, m, r, false, recover_header_type_parser_); + exit_section_(b, l, m, r, false, ImpexParser::recover_header_type); return r; } @@ -479,7 +468,7 @@ public static boolean modifiers(PsiBuilder b, int l) { p = r; // pin = 1 r = r && report_error_(b, modifiers_1(b, l + 1)); r = p && consumeToken(b, RIGHT_SQUARE_BRACKET) && r; - exit_section_(b, l, m, r, p, recover_modifiers_parser_); + exit_section_(b, l, m, r, p, ImpexParser::recover_modifiers); return r || p; } @@ -647,7 +636,7 @@ public static boolean parameters(PsiBuilder b, int l) { p = r; // pin = 1 r = r && report_error_(b, parameters_1(b, l + 1)); r = p && consumeToken(b, RIGHT_ROUND_BRACKET) && r; - exit_section_(b, l, m, r, p, recover_parameters_parser_); + exit_section_(b, l, m, r, p, ImpexParser::recover_parameters); return r || p; } @@ -798,7 +787,7 @@ private static boolean recover_parameters_0(PsiBuilder b, int l) { // | HEADER_MODE_UPDATE // | VALUE_SUBTYPE // | FIELD_VALUE_SEPARATOR - // | COMMENT_MARKER + // | LINE_COMMENT // | macro_name_dec // | BEAN_SHELL_MARKER // | DOUBLE_STRING @@ -821,7 +810,7 @@ static boolean recover_root(PsiBuilder b, int l) { // | HEADER_MODE_UPDATE // | VALUE_SUBTYPE // | FIELD_VALUE_SEPARATOR - // | COMMENT_MARKER + // | LINE_COMMENT // | macro_name_dec // | BEAN_SHELL_MARKER // | DOUBLE_STRING @@ -837,7 +826,7 @@ private static boolean recover_root_0(PsiBuilder b, int l) { if (!r) r = consumeToken(b, HEADER_MODE_UPDATE); if (!r) r = consumeToken(b, VALUE_SUBTYPE); if (!r) r = consumeToken(b, FIELD_VALUE_SEPARATOR); - if (!r) r = consumeToken(b, COMMENT_MARKER); + if (!r) r = consumeToken(b, LINE_COMMENT); if (!r) r = macro_name_dec(b, l + 1); if (!r) r = consumeToken(b, BEAN_SHELL_MARKER); if (!r) r = consumeToken(b, DOUBLE_STRING); @@ -854,7 +843,7 @@ static boolean root(PsiBuilder b, int l) { Marker m = enter_section_(b, l, _NONE_); r = consumeToken(b, CRLF); if (!r) r = root_1(b, l + 1); - exit_section_(b, l, m, r, false, recover_root_parser_); + exit_section_(b, l, m, r, false, ImpexParser::recover_root); return r; } @@ -910,7 +899,7 @@ static boolean root_group(PsiBuilder b, int l) { if (!r) r = bean_shell(b, l + 1); if (!r) r = root_group_5(b, l + 1); if (!r) r = macro_declaration(b, l + 1); - exit_section_(b, l, m, r, false, not_line_break_parser_); + exit_section_(b, l, m, r, false, ImpexParser::not_line_break); return r; } @@ -1188,39 +1177,4 @@ private static boolean value_line_1(PsiBuilder b, int l) { return r; } - static final Parser not_line_break_or_parameters_separator_parser_ = new Parser() { - public boolean parse(PsiBuilder b, int l) { - return not_line_break_or_parameters_separator(b, l + 1); - } - }; - static final Parser not_line_break_parser_ = new Parser() { - public boolean parse(PsiBuilder b, int l) { - return not_line_break(b, l + 1); - } - }; - static final Parser recover_header_type_parser_ = new Parser() { - public boolean parse(PsiBuilder b, int l) { - return recover_header_type(b, l + 1); - } - }; - static final Parser recover_modifiers_parser_ = new Parser() { - public boolean parse(PsiBuilder b, int l) { - return recover_modifiers(b, l + 1); - } - }; - static final Parser recover_parameter_name_parser_ = new Parser() { - public boolean parse(PsiBuilder b, int l) { - return recover_parameter_name(b, l + 1); - } - }; - static final Parser recover_parameters_parser_ = new Parser() { - public boolean parse(PsiBuilder b, int l) { - return recover_parameters(b, l + 1); - } - }; - static final Parser recover_root_parser_ = new Parser() { - public boolean parse(PsiBuilder b, int l) { - return recover_root(b, l + 1); - } - }; } diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/ImpexTypes.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/ImpexTypes.java index 080c40b8a..4daaab8f0 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/ImpexTypes.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/ImpexTypes.java @@ -43,8 +43,6 @@ public interface ImpexTypes { IElementType BEAN_SHELL_MARKER = new ImpexTokenType("BEAN_SHELL_MARKER"); IElementType BOOLEAN = new ImpexTokenType("BOOLEAN"); IElementType COMMA = new ImpexTokenType("COMMA"); - IElementType COMMENT_BODY = new ImpexTokenType("COMMENT_BODY"); - IElementType COMMENT_MARKER = new ImpexTokenType("COMMENT_MARKER"); IElementType CRLF = new ImpexTokenType("CRLF"); IElementType DEFAULT_KEY_VALUE_DELIMITER = new ImpexTokenType("DEFAULT_KEY_VALUE_DELIMITER"); IElementType DEFAULT_PATH_DELIMITER = new ImpexTokenType("DEFAULT_PATH_DELIMITER"); @@ -67,6 +65,7 @@ public interface ImpexTypes { IElementType HEADER_TYPE = new ImpexTokenType("HEADER_TYPE"); IElementType LEFT_ROUND_BRACKET = new ImpexTokenType("LEFT_ROUND_BRACKET"); IElementType LEFT_SQUARE_BRACKET = new ImpexTokenType("LEFT_SQUARE_BRACKET"); + IElementType LINE_COMMENT = new ImpexTokenType("LINE_COMMENT"); IElementType MACRO_NAME_DECLARATION = new ImpexTokenType("MACRO_NAME_DECLARATION"); IElementType MACRO_USAGE = new ImpexTokenType("MACRO_USAGE"); IElementType MACRO_VALUE = new ImpexTokenType("MACRO_VALUE"); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAnyAttributeNameImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAnyAttributeNameImpl.java index d5a04cd14..674227dc0 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAnyAttributeNameImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAnyAttributeNameImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitAnyAttributeName(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAnyAttributeValueImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAnyAttributeValueImpl.java index 60784fa84..7405e07e9 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAnyAttributeValueImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAnyAttributeValueImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitAnyAttributeValue(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAnyHeaderModeImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAnyHeaderModeImpl.java index 19c379386..298bca5ae 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAnyHeaderModeImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAnyHeaderModeImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitAnyHeaderMode(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAnyHeaderParameterNameImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAnyHeaderParameterNameImpl.java index a3259fd38..68af8c7df 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAnyHeaderParameterNameImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAnyHeaderParameterNameImpl.java @@ -13,14 +13,15 @@ public class ImpexAnyHeaderParameterNameImpl extends ImpexAnyHeaderParameterNameMixin implements ImpexAnyHeaderParameterName { - public ImpexAnyHeaderParameterNameImpl(@NotNull ASTNode node) { - super(node); + public ImpexAnyHeaderParameterNameImpl(@NotNull ASTNode astNode) { + super(astNode); } public void accept(@NotNull ImpexVisitor visitor) { visitor.visitAnyHeaderParameterName(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAttributeImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAttributeImpl.java index dc6e173ee..4daf7370b 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAttributeImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexAttributeImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitAttribute(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexBeanShellImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexBeanShellImpl.java index 614bc4896..9fb6a9d61 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexBeanShellImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexBeanShellImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitBeanShell(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexCommentImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexCommentImpl.java index 72833b022..c7e866aab 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexCommentImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexCommentImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitComment(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexFullHeaderParameterImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexFullHeaderParameterImpl.java index bd8a52648..da6a8026c 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexFullHeaderParameterImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexFullHeaderParameterImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitFullHeaderParameter(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexFullHeaderTypeImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexFullHeaderTypeImpl.java index e99a35749..c04bd0904 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexFullHeaderTypeImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexFullHeaderTypeImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitFullHeaderType(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexHeaderLineImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexHeaderLineImpl.java index 30d01b328..32abd3091 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexHeaderLineImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexHeaderLineImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitHeaderLine(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexHeaderTypeNameImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexHeaderTypeNameImpl.java index f69812a89..8857d2f91 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexHeaderTypeNameImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexHeaderTypeNameImpl.java @@ -13,14 +13,15 @@ public class ImpexHeaderTypeNameImpl extends ImpexHeaderTypeNameMixin implements ImpexHeaderTypeName { - public ImpexHeaderTypeNameImpl(@NotNull ASTNode node) { - super(node); + public ImpexHeaderTypeNameImpl(@NotNull ASTNode astNode) { + super(astNode); } public void accept(@NotNull ImpexVisitor visitor) { visitor.visitHeaderTypeName(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexMacroDeclarationImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexMacroDeclarationImpl.java index 3deff5473..107a816dc 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexMacroDeclarationImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexMacroDeclarationImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitMacroDeclaration(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexMacroNameDecImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexMacroNameDecImpl.java index 29fa47021..ae7c7f9e2 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexMacroNameDecImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexMacroNameDecImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitMacroNameDec(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexMacroUsageDecImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexMacroUsageDecImpl.java index 1170b014b..ee865d828 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexMacroUsageDecImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexMacroUsageDecImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitMacroUsageDec(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexMacroValueDecImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexMacroValueDecImpl.java index 7a8bf6682..8ec6745ca 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexMacroValueDecImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexMacroValueDecImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitMacroValueDec(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexModifiersImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexModifiersImpl.java index 8955a85ef..6f2d17bba 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexModifiersImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexModifiersImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitModifiers(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexParameterImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexParameterImpl.java index 117db9e60..f03fb89ff 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexParameterImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexParameterImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitParameter(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexParametersImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexParametersImpl.java index b87ee7ccf..8ab17b396 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexParametersImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexParametersImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitParameters(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexRootMacroUsageImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexRootMacroUsageImpl.java index e9897176c..15054028a 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexRootMacroUsageImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexRootMacroUsageImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitRootMacroUsage(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexStringImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexStringImpl.java index 96b2a42fc..ac12a721f 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexStringImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexStringImpl.java @@ -20,6 +20,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitString(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexSubParametersImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexSubParametersImpl.java index eb04573fe..5632b2ea0 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexSubParametersImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexSubParametersImpl.java @@ -16,10 +16,12 @@ public ImpexSubParametersImpl(@NotNull ASTNode node) { super(node); } + @Override public void accept(@NotNull ImpexVisitor visitor) { visitor.visitSubParameters(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexValueGroupImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexValueGroupImpl.java index 548e2630a..c06a9ffd2 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexValueGroupImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexValueGroupImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitValueGroup(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexValueImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexValueImpl.java index cd18155bf..bc244bb1e 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexValueImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexValueImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitValue(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexValueLineImpl.java b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexValueLineImpl.java index bd544c35e..d9f84f6aa 100644 --- a/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexValueLineImpl.java +++ b/gen/com/intellij/idea/plugin/hybris/impex/psi/impl/ImpexValueLineImpl.java @@ -21,6 +21,7 @@ public void accept(@NotNull ImpexVisitor visitor) { visitor.visitValueLine(this); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof ImpexVisitor) accept((ImpexVisitor)visitor); else super.accept(visitor); diff --git a/gradle.properties b/gradle.properties index 828a1326f..31b0debad 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,25 +1,6 @@ -gradleIntellijPluginVersion=0.4.8 - -kotlin_version=1.3.31 -kotlin.incremental.usePreciseJavaTracking=true - -sourceVersion=1.8 - -# See for possible values: -# https://www.jetbrains.com/intellij-repository/releases -# https://www.jetbrains.com/intellij-repository/snapshots -intelijType=IU -# Leave empty to always build with the latest version -intelijVersion=LATEST-EAP-SNAPSHOT -intelijPlugins=ant, Spring, uml, junit, JavaEE, maven, eclipse, gradle, properties, Groovy, java-i18n, PersistenceSupport, CSS -intellijJvmArgs=-Xmx2G -intellijSinceBuild=191 -intellijUpdateSinceUntilBuild=false - -# https://plugins.jetbrains.com/plugin/227-psiviewer -psiViewerVersions.182=182.2371.2 -psiViewerVersions.183=183.2153 -psiViewerVersions.191=191.4212 +# Opt-out flag for bundling Kotlin standard library. +# See https://kotlinlang.org/docs/reference/using-gradle.html#dependency-on-the-standard-library for details. +kotlin.stdlib.default.dependency = true # This is required because after upgrading to Gradle 5.1.1 the daemon runs out of memory during compilation with the # default value of 512m diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 070e6c851..d51447715 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -17,6 +17,6 @@ # distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/resources/META-INF/ant-support-optional-dependencies.xml b/resources/META-INF/ant-support-optional-dependencies.xml index d3989355c..d3d6d9057 100644 --- a/resources/META-INF/ant-support-optional-dependencies.xml +++ b/resources/META-INF/ant-support-optional-dependencies.xml @@ -28,10 +28,4 @@ - - - com.intellij.idea.plugin.hybris.ant.AntTreeUpdatingHack - - - diff --git a/resources/META-INF/impex-optional-copyright.xml b/resources/META-INF/impex-optional-copyright.xml new file mode 100644 index 000000000..572929cd3 --- /dev/null +++ b/resources/META-INF/impex-optional-copyright.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/META-INF/java-optional-dependencies.xml b/resources/META-INF/java-optional-dependencies.xml index 656537418..8ac69ae6b 100644 --- a/resources/META-INF/java-optional-dependencies.xml +++ b/resources/META-INF/java-optional-dependencies.xml @@ -38,13 +38,9 @@ - + - + @@ -58,8 +54,7 @@ - + @@ -67,12 +62,10 @@ - + - + diff --git a/resources/META-INF/lang-optional-dependencies.xml b/resources/META-INF/lang-optional-dependencies.xml index 535167940..a6bc3e7bf 100644 --- a/resources/META-INF/lang-optional-dependencies.xml +++ b/resources/META-INF/lang-optional-dependencies.xml @@ -42,6 +42,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -49,7 +89,7 @@ - + @@ -212,19 +252,13 @@ - - com.intellij.idea.plugin.hybris.impex.assistance.ImpexHeaderHighlighterComponent - + com.intellij.idea.plugin.hybris.impex.assistance.ImpexHeaderHighlighterComponent - - com.intellij.idea.plugin.hybris.project.components.HybrisProjectApplicationComponent - + com.intellij.idea.plugin.hybris.project.components.HybrisProjectApplicationComponent - - com.intellij.idea.plugin.hybris.type.system.validation.TypeSystemValidationComponent - + com.intellij.idea.plugin.hybris.type.system.validation.TypeSystemValidationComponent @@ -235,6 +269,25 @@ + + + + + + + + + + + + + @@ -274,6 +327,18 @@ + + + + + + + + diff --git a/resources/META-INF/plugin-community.xml b/resources/META-INF/plugin-community.xml index 4dcb19043..157461adb 100644 --- a/resources/META-INF/plugin-community.xml +++ b/resources/META-INF/plugin-community.xml @@ -17,9 +17,5 @@ - - com.intellij.idea.plugin.hybris.statistics.StatsCollector - com.intellij.idea.plugin.hybris.statistics.impl.DefaultStatsCollector - \ No newline at end of file diff --git a/resources/META-INF/plugin-extensions.xml b/resources/META-INF/plugin-extensions.xml index 4cc5514cb..c4eaa8e5a 100644 --- a/resources/META-INF/plugin-extensions.xml +++ b/resources/META-INF/plugin-extensions.xml @@ -6,8 +6,9 @@ icon="/icons/grayHybrisIcon.svg" anchor="right" secondary="true" - conditionClass="com.intellij.idea.plugin.hybris.toolwindow.HybrisToolWindowCondition" factoryClass="com.intellij.idea.plugin.hybris.toolwindow.HybrisToolWindow"/> + + \ No newline at end of file diff --git a/resources/META-INF/plugin-internal.xml b/resources/META-INF/plugin-internal.xml index 08b244c69..7143981e6 100644 --- a/resources/META-INF/plugin-internal.xml +++ b/resources/META-INF/plugin-internal.xml @@ -47,12 +47,19 @@ + com.intellij.idea.plugin.hybris.tools.remote.http.HybrisHacHttpClient + + + com.intellij.idea.plugin.hybris.tools.remote.http.solr.SolrHttpClient + com.intellij.idea.plugin.hybris.tools.remote.http.solr.impl.DefaultSolrHttpClient + + diff --git a/resources/META-INF/plugin-release-info.xml b/resources/META-INF/plugin-release-info.xml index 246b2b4fc..bdf35c059 100644 --- a/resources/META-INF/plugin-release-info.xml +++ b/resources/META-INF/plugin-release-info.xml @@ -1,40 +1,37 @@ - ccom.intellij.idea.plugin.hybris.impex - hybris integration - 10.5.1 + com.intellij.idea.plugin.sap.commerce + SAP Commerce Developers Toolset + 2022.2 - + - - Alexander Bartash + + EPAM Systems This plugin is a plugin for SAP Hybris Commerce integration.

-

Bug tracker: Intellij IDEA Plugin Support

+

This plugin is a plugin for SAP Commerce integration.

If you have any questions you can send an email to: Features:
    -
  • Import of Hybris extensions to Intellij IDEA with automatic dependency resolution and classpath configuration optimized for fast compilation and correct unit and integration tests execution.
  • +
  • Import of Hybris extensions to Intellij IDEA with automatic dependency resolution and classpath configuration optimized for fast compilation.
  • Automatic configuration of Spring, Web, Ant, Database Connector Intellij IDEA plugins.
  • -
  • Import your custom Eclise, Maven and Gradle extensions together with Hybris platform.
  • -
  • Custom editor for flexible Search queries with an ability to execute them on a remote Hybris instance right from your IDE by single click of a button.
  • -
  • Custom editor for impex files with automatic formatting, find usages and go to declaration actions, validation and import of impexes into a remote Hybris instance right from your IDE by single click of a button.
  • +
  • Import your custom Eclipse, Maven and Gradle extensions together with Hybris platform.
  • +
  • Custom editor for flexible Search queries with an ability to execute them on a remote Hybris instance right from your IDE by a single click of a button.
  • +
  • Custom editor for impex files with automatic formatting, find usages and go to declaration actions, validation and import of impexes into a remote Hybris instance right from your IDE by a single click of a button.
  • Custom editor for items.xml with validation, best-practices analyses, quick-fix autosuggestion and easy navigation.
  • Custom editor for beans.xml with custom automated Intellij refactorings actions.
  • Visualization of business process graph (use context menu of the file "Diagrams/Show Diagram", only Ultimate IDEA).
  • Enhanced project view tree.
  • -
  • JRebel and DCEVM support.
  • Execution of Flexible Search queries, Groovy scripts, Impexes though IDE using HAC Integration tool.
  • Execution of queries on remote Solr instances.
  • And much more
  • @@ -43,41 +40,16 @@ Contribution guidelines:
    • Please read Contributor License Agreement
    • -
    • Available tasks are in our JIRA: IIP and IIPS (requires a login but you can sign-up)
    • -
    • How to Configure Project Environment For Plugin Developers
    • +
    • Available tasks are in our board: Project board
    • +
    • How to Configure Project Environment For Plugin Developers
    • We are working with Pull Requests. You need to fork this repository, implement a feature in a separate branch, then send us a pull request.
    • -
    • Be sure to include into your pull request and all commit messages the following line: "Signed-off-by: Your Real Name your.email@email.com" otherwise it can not be accepted. Use your real name (sorry, no pseudonyms or anonymous contributions).
    • -
    • For additional questions you can send an email
    • +
    • Be sure to include into your pull request and all commit messages the following line: "Signed-off-by: Your Real Name your.email@email.com" otherwise it can not be accepted. Use your real name.
    • +
    • For additional questions you can send an email
    -

    By installing thing plugin you agree to sending us anonymous statistics about plugin usage. We do not collect any information about you or your project. We just want to know which features from this plugin our users need most and learn new ways to make thing plugin better.

    - - Backers -

    Thank you to all our backers!

    -

    - -

    - - Sponsors -

    Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

    -

    - - - - - - - - - - -

    - Contributors and Developers

    This project exists thanks to all the people who contribute.

    -

    - -

    +
    • Alexander Bartash
    • Vlad Bozhenok
    • @@ -97,16 +69,29 @@
    • Fabian Necci
    • Markus Perndorfer
    • FAIR Consulting Group
    • +
    • Mykyta Kostiuk
    • +
    • Dmytro Lytvynenko
    • +
    • Oleksandr Shkurat
    • +
    • Maxim Bilohay
    • +
    • Eugene Koryakin
    • +
    • Yevhenii Koshevyi
    • +
    • Mykhailo Lytvyn
    • +
    • Viktors Jengovatovs
    • +
    • Oleksandr Dihtiar
    • +
    • Rustam Burmenskyi
    • +
    • Vladyslav Yanytskyi
    ]]> Fault
      -
    • [IIPS-213] - Account for possibility of"-SNAPSHOT" in hybris version
    • +
    • New action 'Copy to Hybris console' for impex/fxs files
    • +
    • Exclude directories from index in `Settings`
    • +
    • Bug fixing
    - ]]> + ]]>
    + diff --git a/resources/META-INF/plugin.xml b/resources/META-INF/plugin.xml index 043a1f70d..839877bef 100644 --- a/resources/META-INF/plugin.xml +++ b/resources/META-INF/plugin.xml @@ -22,8 +22,6 @@ - com.intellij.modules.lang - AntSupport JUnit org.jetbrains.idea.maven @@ -36,9 +34,24 @@ com.intellij.diagram com.intellij.properties org.intellij.groovy + com.intellij.copyright + + + + + + + + + diff --git a/resources/META-INF/pluginIcon.svg b/resources/META-INF/pluginIcon.svg new file mode 100644 index 000000000..136b6668c --- /dev/null +++ b/resources/META-INF/pluginIcon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/META-INF/pluginIcon_dark.svg b/resources/META-INF/pluginIcon_dark.svg new file mode 100644 index 000000000..39f4e738c --- /dev/null +++ b/resources/META-INF/pluginIcon_dark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/META-INF/spring-optional-dependencies.xml b/resources/META-INF/spring-optional-dependencies.xml index c41158da8..c27ad183f 100644 --- a/resources/META-INF/spring-optional-dependencies.xml +++ b/resources/META-INF/spring-optional-dependencies.xml @@ -29,9 +29,6 @@ - - diff --git a/resources/fileTemplates/internal/Impex File.impex.ft b/resources/fileTemplates/internal/Impex File.impex.ft index e69de29bb..5d6067f51 100644 --- a/resources/fileTemplates/internal/Impex File.impex.ft +++ b/resources/fileTemplates/internal/Impex File.impex.ft @@ -0,0 +1,3 @@ +UPDATE GenericItem[processor = de.hybris.platform.commerceservices.impex.impl.ConfigPropertyImportProcessor]; pk[unique = true] + + diff --git a/resources/i18n/HybrisBundle.properties b/resources/i18n/HybrisBundle.properties index 7808d9949..5637a4994 100644 --- a/resources/i18n/HybrisBundle.properties +++ b/resources/i18n/HybrisBundle.properties @@ -22,6 +22,9 @@ action.ImpexRemoteControl.Validate.short.text=Validate action.ImpexRemoteControl.Import.text=Import selected Impex action.ImpexRemoteControl.Import.description=Import IMPEX file to remote hybris instance action.ImpexRemoteControl.Import.short.text=Import +action.FSRemoteControl.Execute.text=Execute selected FlexibleSearch Statement +action.FSRemoteControl.Execute.short.text=Execute +action.FSRemoteControl.Execute.description=Execute FlexibleSearch file via remote hybris instance action.GroovyRemoteControl.Execute.description=Execute groovy script on a remote hybris instance action.GroovyRemoteControl.Execute.short.text=Execute @@ -86,6 +89,11 @@ hybris.import.settings.exclude.resources.popup.edit.title=Edit hybris.import.settings.exclude.resources.popup.edit.text=Edit Extension name hybris.import.settings.exclude.resources.popup.add.title=Add hybris.import.settings.exclude.resources.popup.add.text=Add Extension name +hybris.import.settings.excludedFromIndex.directory.name=Excluded from index +hybris.import.settings.excludedFromIndex.directory.popup.edit.title=Edit +hybris.import.settings.excludedFromIndex.directory.popup.edit.text=Edit directory name +hybris.import.settings.excludedFromIndex.directory.popup.add.title=Add +hybris.import.settings.excludedFromIndex.directory.popup.add.text=Add directory name hybris.toolwindow.solr.ip=Solr IP address hybris.toolwindow.solr.label=Remote SOLR Instance @@ -93,10 +101,11 @@ hybris.toolwindow.solr.login=Solr admin name hybris.toolwindow.solr.pswd=Solr admin password hybris.toolwindow.solr.port=Solr port hybris.toolwindow.solr.webroot.label=Solr webroot +hybris.toolwindow.solr.test.connection.fail=Unable to connect to Solr server. Reason: {0} hybris.toolwindow.remote.label=Remote Hybris Instance hybris.toolwindow.diplay.name.label=Connection name hybris.toolwindow.ip.label=Running instance IP address -hybris.toolwindow.port.label=Running instance SSL port +hybris.toolwindow.port.label=Running instance port hybris.toolwindow.preview.label=full URL preview hybris.toolwindow.hac.webroot.label=HAC webroot hybris.toolwindow.hac.login.label=HAC login name @@ -106,6 +115,9 @@ hybris.toolwindow.hac.test.connection.fail=Connection failed at {0}. Reason {1} hybris.toolwindow.hac.test.connection.success=Successfully connected to {0} console at {1} hybris.toolwindow.hac.test.connection.title=Test connection hybris.toolwindow.ok.button.title=OK +hybris.toolwindow.ssl.label=SSL + +hybris.solr.search.console.reload.cores.button.tooltip=Reload Solr Cores hybris.import.wizard.import.ootb.modules.read.only.label=Import OOTB modules in read-only mode hybris.import.wizard.import.ootb.modules.read.only.tooltip=Extremely improves compilation performance and reduces possible amount of compilation errors but you wont be able to use code assistance in OOTB modules. @@ -162,6 +174,9 @@ hybris.stats.permission.checkbox=I agree to send statistics for the plugin devel hybris.project.view.tree.settings=Project Tree Settings hybris.project.view.tree.hide.empty.middle.folders=Hide Empty Middle Folders +hybris.project.maven.download.sources.folders=Download and attach Maven artifacts sources +hybris.project.maven.download.javadocs.folders=Download and attach Maven artifacts javadocs +hybris.project.attach.standard.sources=Attach Standard Sources (e.g. backoffice) hybris.inspection.tsv.key=hybris TSV Inspections @@ -200,21 +215,6 @@ hybris.gutter.populator.class.tooltip.navigate.declaration=Navigate to the hybri hybris.module.dependencies.diagram.provider.name=hybris Module Dependencies hybris.notification.group=Hybris -support.us.step.title=We need your support -support.us.step.text=\ -

    We would like to remind that this is an open source project and that we need all the help we can get:

    \ -
      \ -
    • On GitHub you can see our contribution guidelines. One free contributor worth 10 paid contributors.
    • \n\ -
    • On OpenCollective you can send us a buck. Nothing is free, so far we have been paying for this from our own pockets and by our free time. We will use the money to hire freelancers to do some extra work. For you it is just a small contribution and for us it ia monthly budget we can count on, which means regular bug fixes and new features for you!
    • \n\ -
    • If you have any kind of useful skills please contact us and let us know how we can rock Hybris community together!
    • \n\ -
    • If you represent a company you should be interested in well-being of this project as well because it saves time of your developers and your money. Please contact us and we can figure out how we can help each other. We can also offer support, training etc. If you work at a company please contact us and put us in touch with your managers.
    • \n\ -
    \n\ -

    We have already revolutionized the way people work with Hybris and we have much more to come believe it or not, all we need is a bit of help to get the required resources. Thank you!

    \ -

    For more information on the hybris Integration Plugin, see here.

    \ -

    Backed by:\ -

    project.import.finished=Project Import Finished project.refresh.finished=Project Refresh Finished @@ -227,8 +227,8 @@ scope.custom.ts.beans.impex.files=Custom Type System, Beans and Impex files scope.all.ts.files=All Type System Files flexible.search.table.empty.text=query parameters appear here -obsolete.ide.version.title=Update IDEA now -obsolete.ide.version.text=Upgrade your IDE now. Hybris integration plugin is no longer supported for <= 2018.2 IDE version. - hybris.ts.items.validation.settings.enabled=Warn if generated items are out of date hybris.ts.items.validation.warn=Generated classes are out of date. Please run Build -> Build Project or ant all. + +copy.file.dialog.impex=Impex Console +copy.file.dialog.fxs=Flexible Search Console diff --git a/resources/icons/delete.png b/resources/icons/delete.png new file mode 100644 index 000000000..c6ff278b5 Binary files /dev/null and b/resources/icons/delete.png differ diff --git a/resources/icons/fileTypes/flexibleSearchFile@2x.svg b/resources/icons/fileTypes/flexibleSearchFile@2x.svg new file mode 100644 index 000000000..423fa581e --- /dev/null +++ b/resources/icons/fileTypes/flexibleSearchFile@2x.svg @@ -0,0 +1,12 @@ + + + xml + + + + + + + + + \ No newline at end of file diff --git a/resources/icons/fileTypes/flexibleSearchFileIcon.svg b/resources/icons/fileTypes/flexibleSearchFileIcon.svg new file mode 100644 index 000000000..942d1e4a8 --- /dev/null +++ b/resources/icons/fileTypes/flexibleSearchFileIcon.svg @@ -0,0 +1,12 @@ + + + xml + + + + + + + + + \ No newline at end of file diff --git a/resources/icons/menu-saveall.svg b/resources/icons/menu-saveall.svg new file mode 100644 index 000000000..f9e537d2a --- /dev/null +++ b/resources/icons/menu-saveall.svg @@ -0,0 +1,3 @@ + + + diff --git a/resources/icons/upload.svg b/resources/icons/upload.svg new file mode 100644 index 000000000..92a6db09b --- /dev/null +++ b/resources/icons/upload.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/resources/ruleset.xml b/resources/ruleset.xml index e5b1fe9a4..5da7925ec 100644 --- a/resources/ruleset.xml +++ b/resources/ruleset.xml @@ -24,7 +24,7 @@ description="A deployment table must be defined for all Items extending GenericItem" priority="H" selectionQuery="//itemtype[@extends='GenericItem' or not(@extends)]" - testQuery="count(./deployment) > 0 or (./@autocreate='false' and ./@generate='false')" + testQuery="count(./deployment) > 0 or (./@autocreate='false' and ./@generate='false') or ./@abstract='true'" nameQuery="./@code"/> diff --git a/rt-ant/build.gradle b/rt-ant/build.gradle.kts similarity index 75% rename from rt-ant/build.gradle rename to rt-ant/build.gradle.kts index 955129472..5006e1ede 100644 --- a/rt-ant/build.gradle +++ b/rt-ant/build.gradle.kts @@ -15,19 +15,35 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ -jar.archiveName = "rt-ant.jar" +plugins { + id("org.jetbrains.intellij") +} + +intellij { + version.set(platformVersion) +} // Should be 1.7 otherwise it will not work in Hybris 5.X which require java 1.7. -compileJava { +java { sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 } -repositories { - mavenCentral() +tasks { + buildSearchableOptions { + enabled = false + } +} + +sourceSets.main { + java.srcDirs( + file("src") + ) } dependencies { - //this should be pulled from /lib/ant/lib - compileOnly "org.apache.ant:ant:1.10.6" + compileOnly("org.apache.ant:ant:$antVersion") } + +val jar: Jar by tasks +jar.archiveFileName.set("rt-ant.jar") \ No newline at end of file diff --git a/common/build.gradle b/settings.gradle.kts similarity index 92% rename from common/build.gradle rename to settings.gradle.kts index cf757d394..c912d147d 100644 --- a/common/build.gradle +++ b/settings.gradle.kts @@ -15,4 +15,6 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ -jar.archiveName = "common.jar" \ No newline at end of file + +rootProject.name = "SAP-Commerce-Developers-Toolset" +include("rt-ant") \ No newline at end of file diff --git a/src/Impex.bnf b/src/Impex.bnf index 4508384c8..94a5a967a 100644 --- a/src/Impex.bnf +++ b/src/Impex.bnf @@ -62,7 +62,7 @@ private recover_root ::= !( | HEADER_MODE_UPDATE | VALUE_SUBTYPE | FIELD_VALUE_SEPARATOR - | COMMENT_MARKER + | LINE_COMMENT | macro_name_dec | BEAN_SHELL_MARKER | DOUBLE_STRING @@ -88,7 +88,7 @@ header_line ::= any_header_mode full_header_type ((PARAMETERS_SEPARATOR full_hea {pin = 1} -comment ::= COMMENT_MARKER COMMENT_BODY? +comment ::= LINE_COMMENT {pin = 1} macro_value_dec ::= MACRO_VALUE diff --git a/src/Impex.flex b/src/Impex.flex index 16f302117..f1c83c6c5 100644 --- a/src/Impex.flex +++ b/src/Impex.flex @@ -42,8 +42,7 @@ crlf = (([\n])|([\r])|(\r\n)) not_crlf = [^\r\n] white_space = [ \t\f] -end_of_line_comment_marker = [#] -end_of_line_comment_body = {not_crlf}* +line_comment = [#][^\r\n]* bean_shell_marker = [#][%] bean_shell_body = (({double_string})|{not_crlf}*) @@ -98,7 +97,6 @@ field_value = ({not_crlf}|{identifier}+) field_value_url = ([/]{identifier}+)+[.]{identifier}+ field_value_ignore = "" -%state COMMENT %state WAITING_MACRO_VALUE %state MACRO_DECLARATION %state HEADER_TYPE @@ -122,7 +120,7 @@ field_value_ignore = "" {bean_shell_marker} { yybegin(BEAN_SHELL); return ImpexTypes.BEAN_SHELL_MARKER; } {double_string} { return ImpexTypes.DOUBLE_STRING; } - {end_of_line_comment_marker} { yybegin(COMMENT); return ImpexTypes.COMMENT_MARKER; } + {line_comment} { yybegin(YYINITIAL); return ImpexTypes.LINE_COMMENT; } {root_macro_usage} { return ImpexTypes.MACRO_USAGE; } {macro_usage} { return ImpexTypes.MACRO_USAGE; } @@ -150,10 +148,6 @@ field_value_ignore = "" // {semicolon} { return ImpexTypes.SEMICOLON; } //} - { - {end_of_line_comment_body} { return ImpexTypes.COMMENT_BODY; } -} - { {bean_shell_body} { return ImpexTypes.BEAN_SHELL_BODY; } } diff --git a/src/com/intellij/idea/plugin/hybris/actions/ActionUtils.java b/src/com/intellij/idea/plugin/hybris/actions/ActionUtils.java index fbb5a481f..84f33ffb2 100644 --- a/src/com/intellij/idea/plugin/hybris/actions/ActionUtils.java +++ b/src/com/intellij/idea/plugin/hybris/actions/ActionUtils.java @@ -41,4 +41,8 @@ public static boolean isHybrisContext(@NotNull final DataContext dataContext) { final Project project = CommonDataKeys.PROJECT.getData(dataContext); return project != null && CommonIdeaService.getInstance().isHybrisProject(project); } + + public static boolean isHybrisContext(@NotNull final Project project) { + return CommonIdeaService.getInstance().isHybrisProject(project); + } } diff --git a/src/com/intellij/idea/plugin/hybris/actions/CopyFileToHybrisConsoleUtils.java b/src/com/intellij/idea/plugin/hybris/actions/CopyFileToHybrisConsoleUtils.java new file mode 100644 index 000000000..3d48a70ed --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/actions/CopyFileToHybrisConsoleUtils.java @@ -0,0 +1,172 @@ +/* + * 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.actions; + +import com.intellij.execution.console.ConsoleExecutionEditor; +import com.intellij.execution.console.LanguageConsoleImpl; +import com.intellij.ide.projectView.ProjectView; +import com.intellij.ide.projectView.ProjectViewNode; +import com.intellij.idea.plugin.hybris.common.utils.HybrisI18NBundleUtils; +import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisConsole; +import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisConsoleToolWindowFactory; +import com.intellij.idea.plugin.hybris.tools.remote.console.view.HybrisConsolePanel; +import com.intellij.idea.plugin.hybris.tools.remote.console.view.HybrisConsolePanelView; +import com.intellij.idea.plugin.hybris.toolwindow.CopyFileToHybrisConsoleDialog; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.openapi.wm.ToolWindowManager; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; +import com.intellij.psi.PsiManager; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.NotNull; + +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreePath; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +import static com.intellij.idea.plugin.hybris.common.HybrisConstants.DIALOG_TITLE; +import static java.lang.System.lineSeparator; + +public final class CopyFileToHybrisConsoleUtils { + + private CopyFileToHybrisConsoleUtils() { + } + + private static Optional cast(@NotNull R obj, Class clazz) { + if (clazz.isAssignableFrom(obj.getClass())) { + return Optional.ofNullable((T) obj); + } else { + return Optional.empty(); + } + } + + public static void copySelectedFilesToHybrisConsole(Project project, String consoleTitle, String dialogTitle) { + var hybrisConsole = getHybrisConsole(project, consoleTitle); + if (hybrisConsole != null) { + boolean isConsoleNotEmpty = StringUtils.isNotEmpty(getTextFromHybrisConsole(project, hybrisConsole)); + String query = getQueryFromSelectedFiles(project); + if (isConsoleNotEmpty) { + var consoleDialog = new CopyFileToHybrisConsoleDialog( + project, + getDialogTitleFromProperties(dialogTitle) + ); + consoleDialog.show(() -> copyToHybrisConsole(project, consoleTitle, query)); + } else { + copyToHybrisConsole(project, consoleTitle, query); + } + } + } + + public static boolean isRequiredSingleFileExtension(Project project, String fileExtension) { + var fileExtensions = getFileExtensions(project); + return fileExtensions.size() == 1 && fileExtensions.get(0).equals(fileExtension); + } + + public static boolean isRequiredMultipleFileExtension(Project project, String fileExtension) { + var fileExtensions = getFileExtensions(project); + return !fileExtensions.isEmpty() && fileExtensions.stream().allMatch(fileExtension::equals); + } + + private static List getFileExtensions(Project project) { + var extensions = new ArrayList(); + for (var virtualFile : getSelectedFiles(project)) { + if (virtualFile.isDirectory()) { + return Collections.emptyList(); + } + extensions.add(virtualFile.getExtension()); + } + return extensions; + } + + private static HybrisConsole getHybrisConsole(Project project, String consoleTitle) { + var hybrisConsolePanel = HybrisConsolePanelView.Companion.getInstance(project).getConsolePanel(); + return hybrisConsolePanel.findConsole(consoleTitle); + } + + private static String getQueryFromSelectedFiles(Project project) { + return getSelectedFiles(project).stream() + .map(virtualFile -> getPsiFileNode(project, virtualFile)) + .map(PsiElement::getText) + .collect(Collectors.joining(lineSeparator())); + } + + private static PsiFile getPsiFileNode(Project project, VirtualFile virtualFile) { + return PsiManager.getInstance(project).findFile(virtualFile); + } + + private static List getSelectedFiles(Project project) { + return Arrays.stream(getSelectedTreePaths(project)) + .map(CopyFileToHybrisConsoleUtils::getVirtualFile) + .filter(Optional::isPresent) + .map(Optional::get) + .collect(Collectors.toList()); + } + + @NotNull + private static Optional getVirtualFile(final TreePath treePath) { + return cast(treePath.getLastPathComponent(), DefaultMutableTreeNode.class) + .flatMap(lastPathNode -> cast(lastPathNode.getUserObject(), ProjectViewNode.class)) + .map(ProjectViewNode::getVirtualFile); + } + + private static TreePath[] getSelectedTreePaths(final Project project) { + var currentProjectViewPane = ProjectView.getInstance(project).getCurrentProjectViewPane(); + var selectionPaths = currentProjectViewPane.getSelectionPaths(); + return ObjectUtils.getIfNull(selectionPaths, () -> new TreePath[0]); + } + + private static HybrisConsolePanel getHybrisConsolePanel(Project project) { + return HybrisConsolePanelView.Companion.getInstance(project).getConsolePanel(); + } + + private static String getTextFromHybrisConsole(Project project, HybrisConsole hybrisConsole) { + var helper = new LanguageConsoleImpl.Helper(project, hybrisConsole.getVirtualFile()); + var consoleExecutionEditor = new ConsoleExecutionEditor(helper); + return consoleExecutionEditor.getDocument().getText(); + } + + private static void copyToHybrisConsole(Project project, String consoleTitle, String query) { + var hybrisConsolePanel = getHybrisConsolePanel(project); + var hybrisConsole = hybrisConsolePanel.findConsole(consoleTitle); + if (hybrisConsole != null) { + hybrisConsole.clear(); + hybrisConsole.setInputText(query); + hybrisConsolePanel.setActiveConsole(hybrisConsole); + openHybrisConsole(project); + } + } + + private static void openHybrisConsole(Project project) { + var toolWindow = ToolWindowManager.getInstance(project).getToolWindow(HybrisConsoleToolWindowFactory.ID); + if (toolWindow != null) { + toolWindow.activate(null); + } + } + + private static String getDialogTitleFromProperties(String fileExtension) { + return HybrisI18NBundleUtils.message(DIALOG_TITLE + fileExtension); + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/ant/AntTreeUpdatingHack.java b/src/com/intellij/idea/plugin/hybris/ant/AntTreeUpdatingHack.java deleted file mode 100644 index 0f6535ac9..000000000 --- a/src/com/intellij/idea/plugin/hybris/ant/AntTreeUpdatingHack.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * This file is part of "hybris integration" plugin for Intellij IDEA. - * Copyright (C) 2014-2016 Alexander Bartash - * - * 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.ant; - -import com.intellij.ide.util.treeView.AbstractTreeBuilder; -import com.intellij.idea.plugin.hybris.common.services.CommonIdeaService; -import com.intellij.lang.ant.config.explorer.AntExplorer; -import com.intellij.openapi.components.AbstractProjectComponent; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.project.DumbService; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.startup.StartupManager; -import com.intellij.openapi.wm.IdeFocusManager; -import com.intellij.openapi.wm.ToolWindow; -import com.intellij.openapi.wm.ex.ToolWindowManagerAdapter; -import com.intellij.openapi.wm.ex.ToolWindowManagerEx; -import com.intellij.ui.ListenerUtil; -import com.intellij.util.ui.UIUtil; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.util.Arrays; -import java.util.Objects; - -/** - * @author Eugene.Kudelevsky - */ -public class AntTreeUpdatingHack extends AbstractProjectComponent { - - private static final Logger LOG = Logger.getInstance(AntTreeUpdatingHack.class); - - private static final String ANT_TOOL_WINDOW_ID = "Ant Build"; - - public AntTreeUpdatingHack(final Project project) { - super(project); - } - - @Override - public void initComponent() { - StartupManager.getInstance(myProject).runWhenProjectIsInitialized(this::onProjectInitialized); - } - - private void onProjectInitialized() { - if (!CommonIdeaService.getInstance().isHybrisProject(myProject)) { - return; - } - final ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(myProject); - final ToolWindow antToolWindow = toolWindowManager.getToolWindow(ANT_TOOL_WINDOW_ID); - - if (antToolWindow == null) { - LOG.info("Cannot get Ant tool window"); - return; - } - if (!tryToPatchToolWindow(antToolWindow)) { - toolWindowManager.addToolWindowManagerListener(new ToolWindowManagerAdapter() { - - private boolean pending = true; - - @Override - public void stateChanged() { - if (pending && tryToPatchToolWindow(antToolWindow)) { - pending = false; - toolWindowManager.removeToolWindowManagerListener(this); - } - } - }); - } - } - - private boolean tryToPatchToolWindow(@NotNull final ToolWindow antToolWindow) { - final AntExplorer antExplorer = getAntExplorer(antToolWindow); - final AbstractTreeBuilder antTreeBuilder = antExplorer == null ? null : getAntTreeBuilder(antExplorer); - - if (antTreeBuilder == null) { - return false; - } - ListenerUtil.addFocusListener(antExplorer, new FocusListener() { - - private boolean focused = false; - - @Override - public void focusGained(final FocusEvent e) { - stateChanged(); - } - - @Override - public void focusLost(final FocusEvent e) { - stateChanged(); - } - - private void stateChanged() { - final Component focusOwner = IdeFocusManager.getInstance(myProject).getFocusOwner(); - final boolean newFocused = focusOwner != null && UIUtil.isAncestor(antExplorer, focusOwner); - - if (focused != newFocused) { - focused = newFocused; - - if (newFocused && !antTreeBuilder.isDisposed()) { - queueUpdate(antTreeBuilder); - } - } - } - }); - queueUpdate(antTreeBuilder); - - DumbService.getInstance(myProject).runWhenSmart(() -> { - if (!antTreeBuilder.isDisposed()) { - queueUpdate(antTreeBuilder); - } - }); - return true; - } - - private static void queueUpdate(@NotNull final AbstractTreeBuilder antTreeBuilder) { - antTreeBuilder.queueUpdate(); - antTreeBuilder.getTree().repaint(); - } - - @Nullable - private static AbstractTreeBuilder getAntTreeBuilder(final AntExplorer antExplorer) { - final JTree tree = UIUtil.findComponentOfType(antExplorer, JTree.class); - - if (tree == null) { - LOG.info("Cannot get tree object from AntExplorer"); - return null; - } - final AbstractTreeBuilder antTreeBuilder = AbstractTreeBuilder.getBuilderFor(tree); - - if (antTreeBuilder == null) { - LOG.info("Cannot get Ant tree builder"); - return null; - } - if (antTreeBuilder.isDisposed()) { - LOG.info("Ant tree builder is disposed"); - return null; - } - return antTreeBuilder; - } - - @Nullable - private static AntExplorer getAntExplorer(final @NotNull ToolWindow antToolWindow) { - final AntExplorer antExplorer = Arrays - .stream(antToolWindow.getContentManager().getContents()) - .map(content -> { - final JComponent component = content.getComponent(); - return component instanceof AntExplorer ? (AntExplorer) component : null; - }) - .filter(Objects::nonNull) - .findFirst() - .orElse(null); - - if (antExplorer == null) { - LOG.info("Cannot get AntExplorer object"); - } - return antExplorer; - } -} diff --git a/src/com/intellij/idea/plugin/hybris/ant/HybrisAntBuildListener.java b/src/com/intellij/idea/plugin/hybris/ant/HybrisAntBuildListener.java index 1e68cc3db..5502eaebd 100644 --- a/src/com/intellij/idea/plugin/hybris/ant/HybrisAntBuildListener.java +++ b/src/com/intellij/idea/plugin/hybris/ant/HybrisAntBuildListener.java @@ -23,7 +23,6 @@ import com.intellij.idea.plugin.hybris.project.actions.ProjectRefreshAction; import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettings; import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent; -import com.intellij.idea.plugin.hybris.statistics.StatsCollector; import com.intellij.lang.ant.config.AntBuildFileBase; import com.intellij.lang.ant.config.AntBuildListener; import com.intellij.lang.ant.config.AntConfigurationBase; @@ -52,9 +51,8 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; +import java.util.*; +import java.util.List; import static com.intellij.idea.plugin.hybris.common.HybrisConstants.PLATFORM_MODULE_PREFIX; @@ -72,7 +70,7 @@ public class HybrisAntBuildListener implements AntExecutionListener { private static final Key STATE = Key.create("hybrisAntStateMachine"); - private static final String[] antCleanAll = new String[]{"clean", "all"}; + private static final List antCleanAll = Arrays.asList("clean", "all"); public static void registerAntListener(@NotNull Project project) { project.getMessageBus().connect().subscribe(AntExecutionListener.TOPIC, new HybrisAntBuildListener()); @@ -86,7 +84,6 @@ public void beforeExecution(final AntBeforeExecutionEvent event) { public void buildFinished(final AntFinishedExecutionEvent event) { final Map resultMap = new HashMap<>(); findAntResult(resultMap); - StatsCollector.getInstance().collectStat(StatsCollector.ACTIONS.ANT); processNewExtensions(resultMap); triggerNextAction(); } @@ -161,41 +158,37 @@ private void modifyLocalExtensions(final Project project, final AntGenResult res if (xmlFile == null) { return; } - new WriteCommandAction.Simple(project, xmlFile) { + WriteCommandAction.writeCommandAction(project, xmlFile).run(() -> { - @Override - protected void run() throws Throwable { - - final XmlTag hybrisconfig = xmlFile.getRootTag(); - if (hybrisconfig == null) { - return; + final XmlTag hybrisconfig = xmlFile.getRootTag(); + if (hybrisconfig == null) { + return; + } + for (XmlTag extensions : hybrisconfig.getSubTags()) { + if (!extensions.getName().equals("extensions")) { + continue; } - for (XmlTag extensions : hybrisconfig.getSubTags()) { - if (!extensions.getName().equals("extensions")) { + for (XmlTag extension : extensions.getSubTags()) { + if (!extension.getName().equals("extension")) { continue; } - for (XmlTag extension : extensions.getSubTags()) { - if (!extension.getName().equals("extension")) { - continue; - } - if (result.getExtensionsToRemove().contains(extension.getAttributeValue("name"))) { - extension.delete(); - } - } - - for (String newExtension : result.getExtensionsToAdd()) { - final XmlTag newTag = extensions.createChildTag("extension", null, null, false); - final String name = newExtension.substring(newExtension.lastIndexOf("/") + 1); - final String dir = "${HYBRIS_BIN_DIR}" + newExtension.substring(newExtension.indexOf("/custom")); - newTag.setAttribute("dir", dir); - newTag.setAttribute("name", name); - extensions.addSubTag(newTag, false); + if (result.getExtensionsToRemove().contains(extension.getAttributeValue("name"))) { + extension.delete(); } } - FileDocumentManager.getInstance().saveAllDocuments(); + for (String newExtension : result.getExtensionsToAdd()) { + final XmlTag newTag = extensions.createChildTag("extension", null, null, false); + final String name = newExtension.substring(newExtension.lastIndexOf("/") + 1); + final String dir = "${HYBRIS_BIN_DIR}" + newExtension.substring(newExtension.indexOf("/custom")); + newTag.setAttribute("dir", dir); + newTag.setAttribute("name", name); + extensions.addSubTag(newTag, false); + } } - }.execute(); + + FileDocumentManager.getInstance().saveAllDocuments(); + }); } private void triggerCleanAll(final Project project) { diff --git a/src/com/intellij/idea/plugin/hybris/business/process/diagram/impl/BpDiagramElementManagerIml.java b/src/com/intellij/idea/plugin/hybris/business/process/diagram/impl/BpDiagramElementManagerIml.java index 9aa370528..6d3ca0c5f 100644 --- a/src/com/intellij/idea/plugin/hybris/business/process/diagram/impl/BpDiagramElementManagerIml.java +++ b/src/com/intellij/idea/plugin/hybris/business/process/diagram/impl/BpDiagramElementManagerIml.java @@ -95,12 +95,6 @@ public String getElementTitle(final BpGraphNode t) { return t.getGenericAction().getId(); } - @Nullable - @Override - public SimpleColoredText getItemName(final Object o, final DiagramState diagramState) { - return null; - } - @Override public String getNodeTooltip(final BpGraphNode t) { return t.getGenericAction().getId(); diff --git a/src/com/intellij/idea/plugin/hybris/business/process/diagram/impl/DefaultBpDiagramProvider.java b/src/com/intellij/idea/plugin/hybris/business/process/diagram/impl/DefaultBpDiagramProvider.java index bba8a0b2e..f458762d8 100644 --- a/src/com/intellij/idea/plugin/hybris/business/process/diagram/impl/DefaultBpDiagramProvider.java +++ b/src/com/intellij/idea/plugin/hybris/business/process/diagram/impl/DefaultBpDiagramProvider.java @@ -29,7 +29,6 @@ import com.intellij.idea.plugin.hybris.business.process.diagram.BpDiagramProvider; import com.intellij.idea.plugin.hybris.business.process.diagram.BpDiagramVfsResolver; import com.intellij.idea.plugin.hybris.common.utils.HybrisI18NBundleUtils; -import com.intellij.idea.plugin.hybris.statistics.StatsCollector; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; @@ -80,7 +79,6 @@ public DiagramDataModel createDataModel( final BpDiagramDataModel bpDiagramDataModel = new BpDiagramDataModel(project, t); bpDiagramDataModel.refreshDataModel(); - collectStatistics(); return bpDiagramDataModel; } @@ -89,8 +87,4 @@ public DiagramDataModel createDataModel( public DiagramColorManager getColorManager() { return ServiceManager.getService(BpDiagramColorManager.class); } - - private void collectStatistics() { - StatsCollector.getInstance().collectStat(StatsCollector.ACTIONS.BUSINESS_DIAGRAM); - } } diff --git a/common/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.java b/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.java similarity index 95% rename from common/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.java rename to src/com/intellij/idea/plugin/hybris/common/HybrisConstants.java index 09e7a9509..79e691fbe 100644 --- a/common/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.java +++ b/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.java @@ -20,6 +20,7 @@ import com.google.common.collect.ImmutableSet; +import java.io.File; import java.util.Arrays; import java.util.List; import java.util.Set; @@ -38,6 +39,7 @@ public interface HybrisConstants { String IMPEX_MONITOR_CONSOLE_TITLE = "Hybris Monitor Console"; String GROOVY_CONSOLE_TITLE = "Hybris Groovy Console"; String FLEXIBLE_SEARCH_CONSOLE_TITLE = "Hybris FS Console"; + String SOLR_SEARCH_CONSOLE_TITLE = "Hybris Solr search"; String EXTENSION_INFO_XML = "extensioninfo.xml"; String DOT_PROJECT = ".project"; String SETTINGS_GRADLE = "settings.gradle"; @@ -100,11 +102,16 @@ public interface HybrisConstants { String DEFAULT_JAVADOC_ROOT_URL = "https://download.hybris.com/api/%s/commercesuite"; String HYBRIS_6_0_PLUS_JAVADOC_ROOT_URL = "https://help.hybris.com/%s/api/commercesuite/index.html"; + String QUERY_STORAGE_FOLDER_PATH = EXCLUDE_IDEA_DIRECTORY + File.separator + "consolestorage"; + String SRC_DIRECTORY = "src"; + String SCALA_SRC_DIRECTORY = "scalasrc"; + List SRC_DIR_NAMES = Arrays.asList(SRC_DIRECTORY, SCALA_SRC_DIRECTORY); String GEN_SRC_DIRECTORY = "gensrc"; String TEST_SRC_DIRECTORY = "testsrc"; String GROOVY_TEST_SRC_DIRECTORY = "groovytestsrc"; - List TEST_SRC_DIR_NAMES = Arrays.asList(TEST_SRC_DIRECTORY, GROOVY_TEST_SRC_DIRECTORY); + String SCALA_TEST_SRC_DIRECTORY = "scalatestsrc"; + List TEST_SRC_DIR_NAMES = Arrays.asList(TEST_SRC_DIRECTORY, GROOVY_TEST_SRC_DIRECTORY, SCALA_TEST_SRC_DIRECTORY); String HMC_MODULE_DIRECTORY = "hmc"; String HAC_MODULE_DIRECTORY = "hac"; String HAC_MODULE_EXTENSION_NAME = "hac"; @@ -143,6 +150,7 @@ public interface HybrisConstants { String HMC_LIB_DIRECTORY = toSystemDependentName("hmc/bin"); String BACKOFFICE_LIB_DIRECTORY = toSystemDependentName("backoffice/bin"); String BACKOFFICE_JAR_DIRECTORY = toSystemDependentName("resources/backoffice"); + String DOC_SOURCES_JAR_DIRECTORY = toSystemDependentName("doc/sources"); String PL_BOOTSTRAP_LIB_DIRECTORY = toSystemDependentName("bootstrap/bin"); String PL_BOOTSTRAP_GEN_SRC_DIRECTORY = toSystemDependentName("bootstrap/gensrc"); @@ -164,7 +172,7 @@ public interface HybrisConstants { String HYBRIS_DEVELOPER_SPECIFIC_PROJECT_SETTINGS_COMPONENT_NAME = "HybrisDeveloperSpecificProjectSettings"; String DEFAULT_DIRECTORY_NAME_FOR_IDEA_MODULE_FILES = "idea-module-files"; - String PLUGIN_ID = "ccom.intellij.idea.plugin.hybris.impex"; + String PLUGIN_ID = "com.intellij.idea.plugin.sap.commerce"; String JREBEL_PLUGIN_ID = "JRebelPlugin"; String CONFIGURATOR_FACTORY_ID = PLUGIN_ID + ".hybrisConfiguratorFactory"; @@ -323,4 +331,8 @@ interface IMPEX { "Undo Reformat Code", "Auto-Indent Lines" }; + + String DIALOG_TITLE = "copy.file.dialog."; + String FLEXIBLE_SEARCH_FILE_EXTENSION = "fxs"; + String IMPEX_FILE_EXTENSION = "impex"; } diff --git a/common/src/com/intellij/idea/plugin/hybris/common/HybrisUtil.java b/src/com/intellij/idea/plugin/hybris/common/HybrisUtil.java similarity index 100% rename from common/src/com/intellij/idea/plugin/hybris/common/HybrisUtil.java rename to src/com/intellij/idea/plugin/hybris/common/HybrisUtil.java diff --git a/src/com/intellij/idea/plugin/hybris/common/LibraryDescriptorType.java b/src/com/intellij/idea/plugin/hybris/common/LibraryDescriptorType.java new file mode 100644 index 000000000..ee81047ba --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/common/LibraryDescriptorType.java @@ -0,0 +1,23 @@ +/* + * 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.common; + +public enum LibraryDescriptorType { + UNKNOWN, LIB, WEB_INF_LIB +} diff --git a/src/com/intellij/idea/plugin/hybris/common/Version.java b/src/com/intellij/idea/plugin/hybris/common/Version.java index 16284dec3..4e42b6d80 100644 --- a/src/com/intellij/idea/plugin/hybris/common/Version.java +++ b/src/com/intellij/idea/plugin/hybris/common/Version.java @@ -77,19 +77,24 @@ public static Version parseVersion(String v) { } String[] split = fixedVersion.split("\\."); int major = 0, minor = 0, release = 0, patch = 0; - switch (split.length) { - case 4: - patch = Integer.parseInt(split[3]); - case 3: - release = Integer.parseInt(split[2]); - case 2: - minor = Integer.parseInt(split[1]); - case 1: - major = Integer.parseInt(split[0]); - break; - default: - throw new IllegalArgumentException("Could not parse " + fixedVersion); + try { + switch (split.length) { + case 4: + patch = Integer.parseInt(split[3]); + case 3: + release = Integer.parseInt(split[2]); + case 2: + minor = Integer.parseInt(split[1]); + case 1: + major = Integer.parseInt(split[0]); + break; + default: + return UNDEFINED; + } + } catch (NumberFormatException exception) { + return UNDEFINED; } + return new Version(major, minor, release, patch, fixedVersion); } diff --git a/src/com/intellij/idea/plugin/hybris/common/services/CommonIdeaService.java b/src/com/intellij/idea/plugin/hybris/common/services/CommonIdeaService.java index 7e2140980..ce04b5968 100644 --- a/src/com/intellij/idea/plugin/hybris/common/services/CommonIdeaService.java +++ b/src/com/intellij/idea/plugin/hybris/common/services/CommonIdeaService.java @@ -57,21 +57,18 @@ static CommonIdeaService getInstance() { return ServiceManager.getService(CommonIdeaService.class); } - boolean shouldShowPermissionToSendStatisticsDialog(); - - String getHostHacUrl(@NotNull Project project); + String getActiveHacUrl(@NotNull Project project); String getHostHacUrl(@NotNull final Project project, @Nullable HybrisRemoteConnectionSettings mySettings); - String getHostUrl(@NotNull final Project project); - - String getHostUrl(@NotNull final Project project, @Nullable HybrisRemoteConnectionSettings settings); - - String getHostSolrUrl(Project project, HybrisRemoteConnectionSettings item); + String getSolrUrl(Project project, HybrisRemoteConnectionSettings settings); String getBackofficeWebInfLib(Project project); String getBackofficeWebInfClasses(Project project); void fixRemoteConnectionSettings(Project project); + + @NotNull + String getActiveSslProtocol(@NotNull Project project, @Nullable HybrisRemoteConnectionSettings settings); } diff --git a/src/com/intellij/idea/plugin/hybris/common/services/impl/DefaultCommonIdeaService.java b/src/com/intellij/idea/plugin/hybris/common/services/impl/DefaultCommonIdeaService.java deleted file mode 100644 index 531b7bee8..000000000 --- a/src/com/intellij/idea/plugin/hybris/common/services/impl/DefaultCommonIdeaService.java +++ /dev/null @@ -1,356 +0,0 @@ -/* - * This file is part of "hybris integration" plugin for Intellij IDEA. - * Copyright (C) 2014-2016 Alexander Bartash - * - * 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.common.services.impl; - -import com.intellij.idea.plugin.hybris.common.HybrisConstants; -import com.intellij.idea.plugin.hybris.common.Version; -import com.intellij.idea.plugin.hybris.common.services.CommonIdeaService; -import com.intellij.idea.plugin.hybris.project.descriptors.HybrisProjectDescriptor; -import com.intellij.idea.plugin.hybris.project.descriptors.PlatformHybrisModuleDescriptor; -import com.intellij.idea.plugin.hybris.settings.HybrisApplicationSettings; -import com.intellij.idea.plugin.hybris.settings.HybrisApplicationSettingsComponent; -import com.intellij.idea.plugin.hybris.settings.HybrisDeveloperSpecificProjectSettings; -import com.intellij.idea.plugin.hybris.settings.HybrisDeveloperSpecificProjectSettingsComponent; -import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettings; -import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent; -import com.intellij.idea.plugin.hybris.settings.HybrisRemoteConnectionSettings; -import com.intellij.idea.plugin.hybris.statistics.StatsCollector; -import com.intellij.openapi.command.CommandProcessor; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.editor.EditorBundle; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleManager; -import com.intellij.openapi.project.Project; -import com.intellij.util.proxy.ProtocolDefaultPorts; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; -import org.apache.commons.lang3.math.NumberUtils; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.Optional; -import java.util.Properties; -import java.util.stream.Collectors; - -import static com.intellij.idea.plugin.hybris.common.HybrisConstants.TYPING_EDITOR_ACTIONS; -import static com.intellij.idea.plugin.hybris.common.HybrisConstants.UNDO_REDO_EDITOR_ACTIONS; -import static com.intellij.idea.plugin.hybris.settings.HybrisRemoteConnectionSettings.Type.Hybris; -import static com.intellij.idea.plugin.hybris.settings.HybrisRemoteConnectionSettings.Type.SOLR; - -/** - * Created 10:24 PM 10 February 2016. - * - * @author Alexander Bartash - */ -public class DefaultCommonIdeaService implements CommonIdeaService { - private static final Logger LOG = Logger.getInstance(DefaultCommonIdeaService.class); - private static final Version _1905 = Version.parseVersion("1905.0"); - - private final CommandProcessor commandProcessor; - - - public DefaultCommonIdeaService(@NotNull final CommandProcessor commandProcessor) { - Validate.notNull(commandProcessor); - - this.commandProcessor = commandProcessor; - } - - @Override - public boolean isTypingActionInProgress() { - final boolean isTyping = StringUtils.equalsAnyIgnoreCase( - this.commandProcessor.getCurrentCommandName(), TYPING_EDITOR_ACTIONS - ); - - final boolean isUndoOrRedo = StringUtils.startsWithAny( - this.commandProcessor.getCurrentCommandName(), UNDO_REDO_EDITOR_ACTIONS - ); - - return isTyping || isUndoOrRedo; - } - - @Override - @NotNull - public Optional getHybrisDirectory(@NotNull final Project project) { - Validate.notNull(project); - - return Optional.ofNullable(HybrisProjectSettingsComponent.getInstance(project)) - .map(HybrisProjectSettingsComponent::getState) - .map(HybrisProjectSettings::getHybrisDirectory); - } - - @Override - @NotNull - public Optional getCustomDirectory(@NotNull final Project project) { - Validate.notNull(project); - - return Optional.ofNullable(HybrisProjectSettingsComponent.getInstance(project)) - .map(HybrisProjectSettingsComponent::getState) - .map(HybrisProjectSettings::getCustomDirectory); - } - - - - @Override - public boolean isHybrisProject(@NotNull final Project project) { - return HybrisProjectSettingsComponent.getInstance(project).getState().isHybrisProject(); - } - - @Override - public boolean isOutDatedHybrisProject(@NotNull final Project project) { - final HybrisProjectSettings hybrisProjectSettings = HybrisProjectSettingsComponent.getInstance(project) - .getState(); - final String version = hybrisProjectSettings.getImportedByVersion(); - if (version == null) { - return true; - } - final String[] versionParts = version.split("\\."); - if (versionParts.length < 2) { - return true; - } - final String majorVersion = versionParts[0]; - final String minorVersion = versionParts[1]; - try { - final int majorVersionNumber = Integer.parseInt(majorVersion); - final int minorVersionNumber = Integer.parseInt(minorVersion); - final int versionNumber = majorVersionNumber * 100 + minorVersionNumber; - return versionNumber < 900; - } catch (NumberFormatException nfe) { - return true; - } - } - - @Override - public boolean isPotentiallyHybrisProject(@NotNull final Project project) { - final Module[] modules = ModuleManager.getInstance(project).getModules(); - if (modules.length == 0) { - return false; - } - final ArrayList moduleNames = Arrays.stream(modules) - .map(Module::getName) - .collect(Collectors.toCollection(ArrayList::new)); - - final Collection acceleratorNames = Arrays.asList("*cockpits", "*core", "*facades", "*storefront"); - if (matchAllModuleNames(acceleratorNames, moduleNames)) { - return true; - } - final Collection webservicesNames = Arrays.asList("*hmc", "hmc", "platform"); - return matchAllModuleNames(webservicesNames, moduleNames); - } - - @Override - public PlatformHybrisModuleDescriptor getPlatformDescriptor(final HybrisProjectDescriptor hybrisProjectDescriptor) { - return (PlatformHybrisModuleDescriptor) hybrisProjectDescriptor - .getFoundModules() - .stream() - .filter(e -> e instanceof PlatformHybrisModuleDescriptor) - .findAny() - .orElse(null); - } - - @Override - public boolean shouldShowPermissionToSendStatisticsDialog() { - final HybrisApplicationSettings settings = HybrisApplicationSettingsComponent.getInstance().getState(); - if (StatsCollector.getInstance().isOpenCollectiveContributor()) { - return !settings.isAllowedSendingPlainStatistics() && !settings.isDisallowedSendingStatistics(); - } - return !settings.isAllowedSendingPlainStatistics() && !settings.isDevelopmentMode(); - } - - @Override - public String getHostHacUrl(@NotNull final Project project) { - return getHostHacUrl(project, null); - } - - @Override - public String getHostHacUrl(@NotNull final Project project, @Nullable HybrisRemoteConnectionSettings settings) { - final StringBuilder sb = new StringBuilder(); - - // First try to get the HAC webroot from the project settings, fallback to local props if not set in settings; - // For a remote server configured with hac on the root context, use / in the tool settings - if (settings == null) { - settings = HybrisDeveloperSpecificProjectSettingsComponent.getInstance(project).getActiveHybrisRemoteConnectionSettings(project); - } - sb.append(getHostUrl(project, settings)); - String hac = settings.getHacWebroot(); - if (StringUtils.isEmpty(hac)) { - final Properties localProperties = getLocalProperties(project); - if (localProperties != null) { - hac = localProperties.getProperty(HybrisConstants.HAC_WEBROOT_KEY); - } - } - - if (hac != null) { - sb.append('/'); - sb.append(StringUtils.strip(hac, " /")); - } - - final String result = sb.toString(); - - LOG.debug("Calculated hostHacURL=" + result); - - return result; - } - - @Override - public String getHostSolrUrl(final Project project, @Nullable HybrisRemoteConnectionSettings settings) { - final StringBuilder sb = new StringBuilder(); - - if (settings == null) { - settings = HybrisDeveloperSpecificProjectSettingsComponent.getInstance(project).getActiveSolrConnectionSettings(project); - } - if (!settings.getHostIP().startsWith("http")) { - sb.append("https://"); - } - sb.append(settings.getHostIP()); - sb.append(":"); - sb.append(settings.getPort()); - sb.append("/"); - sb.append(settings.getSolrWebroot()); - final String result = sb.toString(); - - LOG.debug("Calculated host SOLR URL=" + result); - - return result; - } - - @Override - public String getHostUrl(@NotNull final Project project) { - return getHostUrl(project, null); - } - - @Override - public String getHostUrl(@NotNull final Project project, @Nullable HybrisRemoteConnectionSettings settings) { - if (settings == null) { - settings = HybrisDeveloperSpecificProjectSettingsComponent.getInstance(project).getActiveHybrisRemoteConnectionSettings(project); - } - final String ip = settings.getHostIP(); - StringBuilder sb = new StringBuilder(); - final Properties localProperties = getLocalProperties(project); - String sslPort = HybrisConstants.DEFAULT_TOMCAT_SSL_PORT; - String httpPort = HybrisConstants.DEFAULT_TOMCAT_HTTP_PORT; - if (localProperties != null) { - sslPort = localProperties.getProperty(HybrisConstants.TOMCAT_SSL_PORT_KEY, HybrisConstants.DEFAULT_TOMCAT_SSL_PORT); - httpPort = localProperties.getProperty(HybrisConstants.TOMCAT_HTTP_PORT_KEY, HybrisConstants.DEFAULT_TOMCAT_HTTP_PORT); - } - String port = settings.getPort(); - if (port == null || port.isEmpty()) { - port = sslPort; - } - if (port.equals(httpPort) || port.equals(String.valueOf(ProtocolDefaultPorts.HTTP))) { - sb.append(HybrisConstants.HTTP_PROTOCOL); - } else { - sb.append(HybrisConstants.HTTPS_PROTOCOL); - } - sb.append(ip); - sb.append(HybrisConstants.URL_PORT_DELIMITER); - sb.append(port); - - return sb.toString(); - } - - - private boolean is2019plus(final Project project) { - final String hybrisVersion = HybrisProjectSettingsComponent.getInstance(project).getState().getHybrisVersion(); - - if (StringUtils.isBlank(hybrisVersion)) { - return false; - } - Version projectVersion = Version.parseVersion(hybrisVersion); - return projectVersion.compareTo(_1905) >= 0; - } - - @Override - public String getBackofficeWebInfLib(final Project project) { - return is2019plus(project) ? HybrisConstants.BACKOFFICE_WEB_INF_LIB_2019 : HybrisConstants.BACKOFFICE_WEB_INF_LIB; - } - - @Override - public String getBackofficeWebInfClasses(final Project project) { - return is2019plus(project) ? HybrisConstants.BACKOFFICE_WEB_INF_CLASSES_2019 : HybrisConstants.BACKOFFICE_WEB_INF_CLASSES; - } - - @Override - public void fixRemoteConnectionSettings(final Project project) { - HybrisDeveloperSpecificProjectSettingsComponent developerSpecificSettings = HybrisDeveloperSpecificProjectSettingsComponent.getInstance(project); - HybrisDeveloperSpecificProjectSettings state = developerSpecificSettings.getState(); - if (state != null) { - List connectionList = state.getRemoteConnectionSettingsList(); - connectionList.stream().forEach(it->{ - if (it.getType() == null) { - it.setType(Hybris); - } - }); - final List remoteList = connectionList - .stream().filter(it -> it.getType() == Hybris).collect(Collectors.toList()); - if (remoteList.isEmpty()) { - HybrisRemoteConnectionSettings newSettings = developerSpecificSettings.getDefaultHybrisRemoteConnectionSettings(project); - connectionList.add(newSettings); - state.setActiveRemoteConnectionID(newSettings.getUuid()); - } - final List solrList = connectionList - .stream().filter(it -> it.getType() == SOLR).collect(Collectors.toList()); - if (solrList.isEmpty()) { - HybrisRemoteConnectionSettings newSettings = developerSpecificSettings.getDefaultSolrRemoteConnectionSettings(project); - connectionList.add(newSettings); - state.setActiveSolrConnectionID(newSettings.getUuid()); - } - } - } - - private Properties getLocalProperties(final Project project) { - final String configDir = HybrisProjectSettingsComponent.getInstance(project).getState().getConfigDirectory(); - if (configDir == null) { - return null; - } - final File propFile = new File(configDir, HybrisConstants.LOCAL_PROPERTIES); - if (!propFile.exists()) { - return null; - } - final Properties prop = new Properties(); - try (final FileReader fr = new FileReader(propFile)) { - prop.load(fr); - return prop; - } catch (IOException e) { - LOG.info(e.getMessage(), e); - } - return null; - } - - private boolean matchAllModuleNames( - @NotNull final Collection namePatterns, - @NotNull final Collection moduleNames - ) { - return namePatterns.stream() - .allMatch(pattern -> matchModuleName(pattern, moduleNames)); - } - - private boolean matchModuleName(@NotNull final String pattern, final Collection moduleNames) { - String regex = ("\\Q" + pattern + "\\E").replace("*", "\\E.*\\Q"); - return moduleNames.stream() - .parallel() - .anyMatch(p -> p.matches(regex)); - } -} diff --git a/src/com/intellij/idea/plugin/hybris/common/services/impl/DefaultCommonIdeaService.kt b/src/com/intellij/idea/plugin/hybris/common/services/impl/DefaultCommonIdeaService.kt new file mode 100644 index 000000000..5352a1eba --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/common/services/impl/DefaultCommonIdeaService.kt @@ -0,0 +1,279 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.common.services.impl + +import com.intellij.idea.plugin.hybris.common.HybrisConstants +import com.intellij.idea.plugin.hybris.common.Version +import com.intellij.idea.plugin.hybris.common.services.CommonIdeaService +import com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptor +import com.intellij.idea.plugin.hybris.project.descriptors.HybrisProjectDescriptor +import com.intellij.idea.plugin.hybris.project.descriptors.PlatformHybrisModuleDescriptor +import com.intellij.idea.plugin.hybris.settings.HybrisDeveloperSpecificProjectSettingsComponent +import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent +import com.intellij.idea.plugin.hybris.settings.HybrisRemoteConnectionSettings +import com.intellij.openapi.command.CommandProcessor +import com.intellij.openapi.diagnostic.Logger +import com.intellij.openapi.module.ModuleManager +import com.intellij.openapi.project.Project +import org.apache.commons.lang3.StringUtils +import org.jetbrains.annotations.Nullable +import java.io.File +import java.io.FileReader +import java.io.IOException +import java.util.* +import java.util.function.Consumer +import java.util.stream.Collectors + +/** + * Created 10:24 PM 10 February 2016. + * + * @author Alexander Bartash @gmail.com> + */ +class DefaultCommonIdeaService : CommonIdeaService { + private val commandProcessor: CommandProcessor = CommandProcessor.getInstance() + override fun isTypingActionInProgress(): Boolean { + val isTyping = StringUtils.equalsAnyIgnoreCase( + commandProcessor.currentCommandName, *HybrisConstants.TYPING_EDITOR_ACTIONS + ) + val isUndoOrRedo = StringUtils.startsWithAny( + commandProcessor.currentCommandName, *HybrisConstants.UNDO_REDO_EDITOR_ACTIONS + ) + return isTyping || isUndoOrRedo + } + + override fun getHybrisDirectory(project: Project): Optional { + return Optional.ofNullable(HybrisProjectSettingsComponent.getInstance(project)) + .map { it.state} + .map { it.hybrisDirectory } + } + + override fun getCustomDirectory(project: Project): Optional { + return Optional.ofNullable(HybrisProjectSettingsComponent.getInstance(project)) + .map { it.state } + .map { it.customDirectory } + } + + override fun isHybrisProject(project: Project): Boolean { + return HybrisProjectSettingsComponent.getInstance(project).state.isHybrisProject + } + + override fun isOutDatedHybrisProject(project: Project): Boolean { + val hybrisProjectSettings = HybrisProjectSettingsComponent.getInstance(project) + .state + val version = hybrisProjectSettings.importedByVersion ?: return true + val versionParts = version.split("\\.").toTypedArray() + if (versionParts.size < 2) { + return true + } + val majorVersion = versionParts[0] + val minorVersion = versionParts[1] + return try { + val majorVersionNumber = majorVersion.toInt() + val minorVersionNumber = minorVersion.toInt() + val versionNumber = majorVersionNumber * 100 + minorVersionNumber + versionNumber < 900 + } catch (nfe: NumberFormatException) { + true + } + } + + override fun isPotentiallyHybrisProject(project: Project): Boolean { + val modules = ModuleManager.getInstance(project).modules + if (modules.isEmpty()) { + return false + } + val moduleNames = modules.map { it.name } + val acceleratorNames: Collection = listOf("*cockpits", "*core", "*facades", "*storefront") + if (matchAllModuleNames(acceleratorNames, moduleNames)) { + return true + } + val webservicesNames: Collection = listOf("*hmc", "hmc", "platform") + return matchAllModuleNames(webservicesNames, moduleNames) + } + + override fun getPlatformDescriptor(hybrisProjectDescriptor: HybrisProjectDescriptor): PlatformHybrisModuleDescriptor { + return hybrisProjectDescriptor.foundModules + .first { e: HybrisModuleDescriptor? -> e is PlatformHybrisModuleDescriptor } as PlatformHybrisModuleDescriptor + + + } + + override fun getActiveHacUrl(project: Project): String { + return HybrisDeveloperSpecificProjectSettingsComponent + .getInstance(project) + .getActiveHybrisRemoteConnectionSettings(project) + .let { getUrl(it) } + } + + override fun getActiveSslProtocol(project: Project, settings: @Nullable HybrisRemoteConnectionSettings?): String { + var settings = settings + if (settings == null) { + settings = HybrisDeveloperSpecificProjectSettingsComponent.getInstance(project) + .getActiveHybrisRemoteConnectionSettings(project) + } + return settings?.sslProtocol ?: "TLSv1" + } + + override fun getHostHacUrl(project: Project, settings: HybrisRemoteConnectionSettings?): String { + var settings = settings + if (settings == null) { + settings = HybrisDeveloperSpecificProjectSettingsComponent.getInstance(project) + .getActiveHybrisRemoteConnectionSettings(project) + } + return getUrl(settings) + } + + override fun getSolrUrl(project: Project, settings: HybrisRemoteConnectionSettings?): String { + var settings = settings + val sb = StringBuilder() + if (settings == null) { + settings = HybrisDeveloperSpecificProjectSettingsComponent.getInstance(project) + .getActiveSolrConnectionSettings(project) + } + if (settings!!.isSsl) { + sb.append(HybrisConstants.HTTPS_PROTOCOL) + } else { + sb.append(HybrisConstants.HTTP_PROTOCOL) + } + sb.append(settings.hostIP) + sb.append(":") + sb.append(settings.port) + sb.append("/") + sb.append(settings.solrWebroot) + val result = sb.toString() + LOG.debug("Calculated host SOLR URL=$result") + return result + } + + private fun is2019plus(project: Project): Boolean { + val hybrisVersion = HybrisProjectSettingsComponent.getInstance(project).state.hybrisVersion + if (StringUtils.isBlank(hybrisVersion)) { + return false + } + val projectVersion = Version.parseVersion(hybrisVersion) + return projectVersion.compareTo(_1905) >= 0 + } + + override fun getBackofficeWebInfLib(project: Project): String { + return if (is2019plus(project)) HybrisConstants.BACKOFFICE_WEB_INF_LIB_2019 else HybrisConstants.BACKOFFICE_WEB_INF_LIB + } + + override fun getBackofficeWebInfClasses(project: Project): String { + return if (is2019plus(project)) HybrisConstants.BACKOFFICE_WEB_INF_CLASSES_2019 else HybrisConstants.BACKOFFICE_WEB_INF_CLASSES + } + + override fun fixRemoteConnectionSettings(project: Project) { + val developerSpecificSettings = HybrisDeveloperSpecificProjectSettingsComponent + .getInstance(project) + val state = developerSpecificSettings.state + if (state != null) { + val connectionList = state.remoteConnectionSettingsList + connectionList.forEach(Consumer { + if (it.type == null) { + it.type = HybrisRemoteConnectionSettings.Type.Hybris + } + prepareSslRemoteConnectionSettings(it) + }) + val remoteList = connectionList + .stream().filter { it.type == HybrisRemoteConnectionSettings.Type.Hybris }.collect(Collectors.toList()) + if (remoteList.isEmpty()) { + val newSettings = developerSpecificSettings.getDefaultHybrisRemoteConnectionSettings( + project) + connectionList.add(newSettings) + state.activeRemoteConnectionID = newSettings.uuid + } + val solrList = connectionList + .stream().filter { it.type == HybrisRemoteConnectionSettings.Type.SOLR }.collect(Collectors.toList()) + if (solrList.isEmpty()) { + val newSettings = developerSpecificSettings.getDefaultSolrRemoteConnectionSettings( + project) + connectionList.add(newSettings) + state.activeSolrConnectionID = newSettings.uuid + } + } + } + + private fun prepareSslRemoteConnectionSettings(connectionSettings: HybrisRemoteConnectionSettings) { + connectionSettings.isSsl = StringUtils.startsWith(connectionSettings.generatedURL, HybrisConstants.HTTPS_PROTOCOL) + cleanUpRemoteConnectionSettingsHostIp(connectionSettings) + } + + private fun cleanUpRemoteConnectionSettingsHostIp(connectionSettings: HybrisRemoteConnectionSettings) { + val regex = Regex("https?://") + connectionSettings.hostIP = connectionSettings.hostIP.replace(regex, "") + } + + private fun getLocalProperties(project: Project): Properties? { + val configDir = HybrisProjectSettingsComponent.getInstance(project).state.configDirectory ?: return null + val propFile = File(configDir, HybrisConstants.LOCAL_PROPERTIES) + if (!propFile.exists()) { + return null + } + val prop = Properties() + try { + FileReader(propFile).use { fr -> + prop.load(fr) + return prop + } + } catch (e: IOException) { + LOG.info(e.message, e) + } + return null + } + + private fun matchAllModuleNames( + namePatterns: Collection, + moduleNames: Collection + ): Boolean { + return namePatterns.stream() + .allMatch { pattern: String -> matchModuleName(pattern, moduleNames) } + } + + private fun matchModuleName(pattern: String, moduleNames: Collection): Boolean { + val regex = Regex("\\Q$pattern\\E".replace("*", "\\E.*\\Q")) + return moduleNames.stream() + .parallel() + .anyMatch { p: String -> p.matches(regex) } + } + + private fun getUrl(settings: HybrisRemoteConnectionSettings?): String { + val ip = settings!!.hostIP + val sb = StringBuilder() + if (settings.isSsl) { + sb.append(HybrisConstants.HTTPS_PROTOCOL) + } else { + sb.append(HybrisConstants.HTTP_PROTOCOL) + } + sb.append(ip) + sb.append(HybrisConstants.URL_PORT_DELIMITER) + sb.append(settings.port) + val hac = settings.hacWebroot + if (StringUtils.isNoneBlank(hac)) { + sb.append('/') + sb.append(StringUtils.strip(hac, " /")) + } + val result = sb.toString() + LOG.debug("Calculated hostHacURL=$result") + return result + } + + companion object { + private val LOG = Logger.getInstance(DefaultCommonIdeaService::class.java) + private val _1905 = Version.parseVersion("1905.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 714e2db7c..6c9ea6829 100644 --- a/src/com/intellij/idea/plugin/hybris/common/utils/HybrisIcons.java +++ b/src/com/intellij/idea/plugin/hybris/common/utils/HybrisIcons.java @@ -19,6 +19,7 @@ package com.intellij.idea.plugin.hybris.common.utils; import com.intellij.openapi.util.IconLoader; +import com.intellij.util.ReflectionUtil; import javax.swing.*; @@ -29,34 +30,41 @@ */ public interface HybrisIcons { - Icon IMPEX_FILE = IconLoader.getIcon("/icons/fileTypes/impexFile.svg"); - Icon BEAN_FILE = IconLoader.getIcon("/icons/beanIcon.svg"); + Icon IMPEX_FILE = getIcon("/icons/fileTypes/impexFile.svg"); + Icon FS_FILE = getIcon("/icons/fileTypes/flexibleSearchFileIcon.svg"); + Icon BEAN_FILE = getIcon("/icons/beanIcon.svg"); - Icon HYBRIS_ICON = IconLoader.getIcon("/icons/hybrisIcon.svg"); - Icon HYBRIS_ICON_13x13 = IconLoader.getIcon("/icons/hybrisIcon_13x13.svg"); - Icon HYBRIS_REMOTE_ICON = IconLoader.getIcon("/icons/hybrisRemoteIcon.svg"); + Icon HYBRIS_ICON = getIcon("/icons/hybrisIcon.svg"); + Icon HYBRIS_ICON_13x13 = getIcon("/icons/hybrisIcon_13x13.svg"); + Icon HYBRIS_REMOTE_ICON = getIcon("/icons/hybrisRemoteIcon.svg"); - Icon WAIT = IconLoader.getIcon("/icons/waitIcon.svg"); - Icon END = IconLoader.getIcon("/icons/endIcon.svg"); - Icon NOTIFY = IconLoader.getIcon("/icons/notifyIcon.svg"); - Icon ACTION = IconLoader.getIcon("/icons/actionIcon.svg"); - Icon SPLIT = IconLoader.getIcon("/icons/splitIcon.svg"); - Icon JOIN = IconLoader.getIcon("/icons/joinIcon.svg"); - Icon SCRIPT = IconLoader.getIcon("/icons/scriptIcon.svg"); + Icon WAIT = getIcon("/icons/waitIcon.svg"); + Icon END = getIcon("/icons/endIcon.svg"); + Icon NOTIFY = getIcon("/icons/notifyIcon.svg"); + Icon ACTION = getIcon("/icons/actionIcon.svg"); + Icon SPLIT = getIcon("/icons/splitIcon.svg"); + Icon JOIN = getIcon("/icons/joinIcon.svg"); + Icon SCRIPT = getIcon("/icons/scriptIcon.svg"); - Icon TYPE_SYSTEM = IconLoader.getIcon("/icons/typeSystem.svg"); - Icon BEAN = IconLoader.getIcon("/icons/beanIcon.svg"); - Icon LOCALIZED = IconLoader.getIcon("/icons/localized.svg"); + Icon TYPE_SYSTEM = getIcon("/icons/typeSystem.svg"); + Icon BEAN = getIcon("/icons/beanIcon.svg"); + Icon LOCALIZED = getIcon("/icons/localized.svg"); - Icon MACROS = IconLoader.getIcon("/icons/macros.png"); + Icon MACROS = getIcon("/icons/macros.png"); interface Gutter { - Icon POPULATOR = IconLoader.getIcon("/icons/gutter/populator.svg"); + Icon POPULATOR = getIcon("/icons/gutter/populator.svg"); } interface Console { - Icon SOLR = IconLoader.getIcon("/icons/console/solr.svg"); + Icon SOLR = getIcon("/icons/console/solr.svg"); + } + + static Icon getIcon(final String path) { + final Class callerClass = ReflectionUtil.getGrandCallerClass(); + assert callerClass != null : path; + return IconLoader.getIcon(path, callerClass); } } diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchLanguage.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchLanguage.java new file mode 100644 index 000000000..8a23288ea --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchLanguage.java @@ -0,0 +1,34 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch; + +import com.intellij.lang.Language; + +public class FlexibleSearchLanguage extends Language { + + private static final FlexibleSearchLanguage INSTANCE = new FlexibleSearchLanguage(); + + public static FlexibleSearchLanguage getInstance() { + return INSTANCE; + } + + protected FlexibleSearchLanguage() { + super("FlexibleSearch"); + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchLexer.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchLexer.java new file mode 100644 index 000000000..228f1f3a3 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchLexer.java @@ -0,0 +1,1583 @@ +/* The following code was generated by JFlex 1.7.0 tweaked for IntelliJ platform */ + +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch; + +import com.intellij.lexer.FlexLexer; +import com.intellij.psi.tree.IElementType; + +import com.intellij.psi.TokenType; + +import static com.intellij.psi.TokenType.WHITE_SPACE; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import static com.intellij.idea.plugin.hybris.flexibleSearch.FlexibleSearchParserDefinition.COMMENT; + +/** + * This class is a scanner generated by + * JFlex 1.7.0 + * from the specification file flexibleSearch.flex + */ +public class FlexibleSearchLexer implements FlexLexer { + + /** This character denotes the end of file */ + public static final int YYEOF = -1; + + /** initial size of the lookahead buffer */ + private static final int ZZ_BUFFERSIZE = 16384; + + /** lexical states */ + public static final int YYINITIAL = 0; + public static final int SELECT_EXP = 2; + public static final int FROM_EXP = 4; + public static final int TABLE_IDENTIFIER = 6; + public static final int COLUMN_IDENTIFIER = 8; + public static final int PARAMETER_EXP = 10; + public static final int LOCALIZATION = 12; + public static final int WHERE_EXP = 14; + public static final int ON_EXP = 16; + public static final int CORRELATION_NAME = 18; + public static final int SUB_QUERY = 20; + + /** + * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l + * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l + * at the beginning of a line + * l is of the form l = 2*k, k a non negative integer + */ + private static final int ZZ_LEXSTATE[] = { + 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, + 8, 8, 9, 9, 10, 10 + }; + + /** + * Translates characters to character classes + * Chosen bits are [12, 6, 3] + * Total runtime size is 15728 bytes + */ + public static int ZZ_CMAP(int ch) { + return ZZ_CMAP_A[(ZZ_CMAP_Y[(ZZ_CMAP_Z[ch>>9]<<6)|((ch>>3)&0x3f)]<<3)|(ch&0x7)]; + } + + /* The ZZ_CMAP_Z table has 2176 entries */ + static final char ZZ_CMAP_Z[] = zzUnpackCMap( + "\1\0\1\1\1\2\1\3\1\4\1\5\1\6\1\7\1\10\1\11\1\12\1\13\1\14\1\15\1\16\1\17\1"+ + "\20\5\21\1\22\1\23\1\24\1\21\14\25\1\26\50\25\1\27\2\25\1\30\1\31\1\32\1\33"+ + "\25\25\1\34\20\21\1\35\1\36\1\37\1\40\1\41\1\42\1\43\1\21\1\44\1\45\1\46\1"+ + "\21\1\47\1\50\1\51\1\52\1\53\1\21\1\54\1\21\1\25\1\55\1\56\5\21\2\25\1\57"+ + "\31\21\1\25\1\60\1\21\1\61\40\21\1\62\17\21\1\63\1\64\1\65\1\66\10\21\1\67"+ + "\2\21\1\70\10\21\123\25\1\71\7\25\1\72\1\73\37\21\1\25\1\73\u0582\21\1\74"+ + "\u017f\21"); + + /* The ZZ_CMAP_Y table has 3904 entries */ + static final char ZZ_CMAP_Y[] = zzUnpackCMap( + "\1\0\1\1\1\0\1\2\1\3\1\4\1\5\1\6\1\7\1\10\1\11\1\12\1\7\1\10\1\11\1\13\1\14"+ + "\3\0\1\15\1\16\1\17\1\20\2\21\1\22\3\21\1\22\7\21\1\23\10\21\1\24\50\21\1"+ + "\25\1\21\1\26\1\27\1\30\1\31\2\27\16\0\1\32\1\33\1\34\1\35\2\21\1\36\11\21"+ + "\1\37\21\21\1\40\1\41\23\21\1\27\1\42\3\21\1\22\1\43\1\42\4\21\1\44\1\45\4"+ + "\0\1\46\1\47\1\27\3\21\2\50\1\27\1\51\1\52\1\0\1\53\5\21\1\54\2\0\1\5\1\55"+ + "\1\56\13\21\1\57\1\46\1\60\1\61\1\5\1\62\1\27\1\63\1\64\3\21\3\0\1\65\12\21"+ + "\1\66\1\0\1\67\1\27\1\5\1\70\3\21\1\54\1\71\1\20\2\21\1\66\1\72\1\73\1\74"+ + "\2\27\3\21\1\75\10\27\1\76\1\30\6\27\1\77\2\0\1\100\1\101\6\21\1\102\2\0\1"+ + "\103\1\21\1\104\1\5\2\42\1\105\1\106\1\107\2\21\1\76\1\110\1\111\1\112\1\113"+ + "\1\63\1\114\1\104\1\5\1\115\1\52\1\105\1\116\1\107\2\21\1\76\1\117\1\120\1"+ + "\121\1\122\1\123\1\124\1\125\1\5\1\126\1\27\1\105\1\37\1\36\2\21\1\76\1\127"+ + "\1\111\1\46\1\130\1\131\1\27\1\104\1\5\1\43\1\27\1\105\1\106\1\107\2\21\1"+ + "\76\1\127\1\111\1\112\1\122\1\132\1\114\1\104\1\5\1\43\1\27\1\133\1\134\1"+ + "\135\1\136\1\137\1\134\1\21\1\140\1\141\1\142\1\143\1\27\1\125\1\5\1\27\1"+ + "\43\1\105\1\32\1\76\2\21\1\76\1\144\1\145\1\146\1\142\1\147\1\26\1\104\1\5"+ + "\2\27\1\150\1\32\1\76\2\21\1\76\1\144\1\111\1\146\1\142\1\147\1\34\1\104\1"+ + "\5\1\151\1\27\1\150\1\32\1\76\4\21\1\152\1\146\1\153\1\63\1\27\1\104\1\5\1"+ + "\27\1\41\1\150\1\21\1\22\1\41\2\21\1\36\1\154\1\22\1\155\1\156\1\0\1\157\1"+ + "\160\1\161\1\27\1\42\5\21\1\162\1\163\1\164\1\100\1\5\1\165\4\27\1\166\1\167"+ + "\1\170\1\42\1\171\1\172\1\162\1\173\1\174\1\175\1\5\1\176\4\27\1\131\2\27"+ + "\1\177\1\5\1\165\1\200\1\201\1\21\1\42\3\21\1\30\1\45\1\0\1\146\1\202\1\0"+ + "\1\45\3\0\1\51\1\203\7\27\5\21\1\54\1\0\1\204\1\5\1\165\1\66\1\205\1\206\1"+ + "\207\1\210\1\21\1\211\1\212\1\5\1\213\4\21\1\37\1\17\5\21\1\214\51\21\1\135"+ + "\1\22\1\135\5\21\1\135\4\21\1\135\1\22\1\135\1\21\1\22\7\21\1\135\10\21\1"+ + "\215\4\27\2\21\2\27\12\21\1\30\1\27\1\42\114\21\1\106\2\21\1\216\2\21\1\50"+ + "\11\21\1\134\1\131\1\27\1\21\1\32\1\217\1\27\2\21\1\217\1\27\2\21\1\220\1"+ + "\27\1\21\1\32\1\221\1\27\6\21\1\222\3\0\1\223\1\224\1\5\1\165\3\27\1\225\1"+ + "\5\1\165\13\21\1\27\5\21\1\226\10\21\1\227\1\27\3\21\1\30\1\0\1\2\1\0\1\2"+ + "\1\125\1\5\3\21\1\227\1\30\1\27\5\21\1\115\2\0\1\56\1\177\1\5\1\165\4\27\2"+ + "\21\1\164\1\2\6\21\1\202\1\100\3\0\1\112\1\5\1\165\1\5\1\165\1\44\13\27\1"+ + "\230\5\21\1\222\1\0\1\230\1\115\1\5\1\165\1\27\1\231\1\2\1\27\1\232\3\21\1"+ + "\103\1\207\1\5\1\70\4\21\1\66\1\0\1\2\1\27\4\21\1\222\2\0\1\27\1\5\1\233\1"+ + "\5\1\70\3\21\1\227\12\27\1\234\2\0\1\235\1\236\1\27\30\21\4\0\1\100\2\27\1"+ + "\77\42\21\2\227\4\21\2\227\1\21\1\237\3\21\1\227\6\21\1\32\1\174\1\240\1\30"+ + "\1\241\1\115\1\21\1\30\1\240\1\30\1\242\1\243\3\27\1\244\1\27\1\44\1\131\1"+ + "\27\1\245\1\246\1\51\1\247\1\43\1\44\2\27\1\21\1\30\3\21\1\50\2\27\1\0\1\51"+ + "\1\250\1\0\1\251\1\27\1\252\1\41\1\154\1\253\1\31\1\254\1\21\1\255\1\256\1"+ + "\257\2\27\5\21\1\131\116\27\5\21\1\22\5\21\1\22\20\21\1\30\1\260\1\261\1\27"+ + "\4\21\1\37\1\17\7\21\1\44\1\27\1\63\2\21\1\22\1\27\10\22\4\0\5\27\1\44\72"+ + "\27\1\262\3\27\1\42\1\211\1\253\1\30\1\42\11\21\1\22\1\263\1\42\12\21\1\214"+ + "\1\256\4\21\1\227\1\42\12\21\1\22\2\27\3\21\1\50\6\27\170\21\1\227\11\27\71"+ + "\21\1\30\6\27\21\21\1\30\10\27\5\21\1\227\41\21\1\30\2\21\1\5\1\264\2\27\5"+ + "\21\1\164\1\77\1\265\3\21\1\63\12\21\1\177\3\27\1\44\1\21\1\41\14\21\1\266"+ + "\1\115\1\27\1\21\1\50\11\27\1\21\1\267\1\270\2\21\1\54\2\27\1\131\6\21\1\115"+ + "\1\27\1\271\5\21\1\222\1\0\1\51\1\27\1\5\1\165\2\0\1\271\1\52\1\5\1\70\2\21"+ + "\1\66\1\175\2\21\1\164\1\0\1\2\1\27\3\21\1\30\1\101\5\21\1\54\1\0\1\251\1"+ + "\44\1\5\1\165\2\27\1\160\1\272\5\21\1\103\1\100\1\27\1\270\1\273\1\5\1\165"+ + "\2\21\1\22\1\274\6\21\1\206\1\275\1\226\2\27\1\276\1\21\1\54\1\277\1\27\3"+ + "\300\1\27\2\22\22\27\4\21\1\54\1\301\1\5\1\165\64\21\1\115\1\27\2\21\1\22"+ + "\1\302\5\21\1\115\40\27\55\21\1\227\15\21\1\26\4\27\1\22\1\27\1\302\1\303"+ + "\1\21\1\76\1\22\1\174\1\304\15\21\1\26\3\27\1\302\54\21\1\227\2\27\10\21\1"+ + "\41\6\21\5\27\1\21\1\30\2\0\2\27\1\100\1\27\1\137\2\27\1\256\3\27\1\43\1\32"+ + "\20\21\1\305\1\245\1\27\1\5\1\165\1\42\2\21\1\116\1\42\2\21\1\50\1\306\12"+ + "\21\1\22\3\41\1\307\1\310\2\27\1\311\1\21\1\144\2\21\1\22\2\21\1\312\1\21"+ + "\1\227\1\21\1\227\4\27\17\21\1\50\10\27\6\21\1\30\20\27\1\313\20\27\3\21\1"+ + "\30\6\21\1\131\5\27\3\21\1\22\2\27\3\21\1\50\6\27\3\21\1\227\4\21\1\115\1"+ + "\21\1\253\5\27\23\21\1\227\1\5\1\165\52\27\1\227\1\76\4\21\1\37\1\314\2\21"+ + "\1\227\25\27\2\21\1\227\1\27\3\21\1\26\10\27\7\21\1\306\10\27\1\315\1\77\1"+ + "\144\1\42\2\21\1\115\1\121\4\27\3\21\1\30\20\27\6\21\1\227\1\27\2\21\1\227"+ + "\1\27\2\21\1\50\21\27\11\21\1\131\66\27\1\232\6\21\1\0\1\100\3\27\1\125\1"+ + "\5\2\27\1\232\5\21\1\0\1\316\2\27\3\21\1\131\1\5\1\165\1\232\3\21\1\164\1"+ + "\0\1\317\1\5\10\27\1\232\5\21\1\54\1\0\1\320\1\27\1\5\1\165\42\27\1\160\1"+ + "\272\52\27\1\160\1\272\16\27\1\160\1\272\56\27\1\160\1\272\4\27\5\21\1\54"+ + "\1\0\1\27\1\5\1\165\14\27\1\160\1\272\64\27\1\160\1\272\54\27\1\160\1\272"+ + "\64\27\55\21\1\22\22\27\14\21\1\50\63\27\5\21\1\22\72\27\7\21\1\131\4\27\1"+ + "\160\1\272\34\27\1\160\1\272\64\27\10\21\1\30\1\27\1\103\4\0\1\100\1\27\1"+ + "\63\1\232\1\21\14\27\1\26\153\27\1\321\1\322\2\0\1\323\1\2\3\27\1\324\22\27"+ + "\1\325\67\27\12\21\1\32\10\21\1\32\1\326\1\327\1\21\1\330\1\144\7\21\1\37"+ + "\1\331\2\32\3\21\1\332\1\174\1\41\1\76\51\21\1\227\3\21\1\76\2\21\1\214\3"+ + "\21\1\214\2\21\1\32\3\21\1\32\2\21\1\22\3\21\1\22\3\21\1\76\3\21\1\76\2\21"+ + "\1\214\1\333\6\5\52\27\1\160\1\272\24\27\1\144\3\21\1\166\1\42\1\214\1\334"+ + "\1\252\1\335\1\166\1\237\1\166\2\214\1\124\1\21\1\36\1\21\1\115\1\336\1\36"+ + "\1\21\1\115\50\27\32\21\1\22\5\27\106\21\1\30\1\27\33\21\1\227\74\27\1\123"+ + "\3\27\14\0\20\27\36\0\2\27"); + + /* The ZZ_CMAP_A table has 1784 entries */ + static final char ZZ_CMAP_A[] = zzUnpackCMap( + "\11\2\1\12\1\3\2\12\1\3\6\2\4\0\1\12\1\27\1\7\1\0\1\1\2\0\1\6\1\20\1\21\1"+ + "\22\1\0\1\14\1\4\1\15\1\0\12\11\1\16\1\17\1\23\1\24\1\25\1\26\1\0\1\41\1\55"+ + "\1\37\1\42\1\35\1\56\1\50\1\60\1\43\1\63\1\61\1\36\1\51\1\44\1\45\1\62\1\1"+ + "\1\53\1\34\1\40\1\46\1\47\1\57\1\52\1\54\1\1\1\30\1\5\1\31\1\0\1\1\1\52\1"+ + "\54\1\1\1\32\1\0\1\33\1\0\6\2\1\13\2\2\1\12\1\0\4\1\4\0\1\1\2\0\1\2\7\0\1"+ + "\1\4\0\1\1\5\0\17\1\1\0\2\43\15\1\1\34\2\1\4\0\4\1\16\0\5\1\7\0\1\1\1\0\1"+ + "\1\1\0\5\1\1\0\2\1\2\0\4\1\10\0\1\1\1\0\3\1\1\0\1\1\1\0\4\1\1\0\13\1\1\0\3"+ + "\1\1\0\5\2\2\0\6\1\1\0\7\1\1\0\1\1\15\0\1\1\1\0\15\2\1\0\1\2\1\0\2\2\1\0\2"+ + "\2\1\0\1\2\3\1\5\0\5\2\6\0\1\1\4\0\3\2\5\0\3\1\5\2\2\11\4\0\2\1\1\2\13\1\1"+ + "\0\1\1\7\2\2\1\2\2\1\0\4\2\2\1\2\11\3\1\2\0\1\1\7\0\1\2\1\1\1\2\6\1\3\2\2"+ + "\0\11\1\3\2\1\1\6\0\2\11\6\1\4\2\2\1\2\0\2\2\1\1\11\2\1\1\3\2\1\1\5\2\2\0"+ + "\1\1\3\2\4\0\1\1\1\0\6\1\4\0\13\2\1\0\4\2\6\1\3\2\1\1\2\2\1\1\7\2\2\1\2\2"+ + "\2\0\2\11\1\0\3\2\1\0\10\1\2\0\2\1\2\0\6\1\1\0\1\1\3\0\4\1\2\0\1\2\1\1\7\2"+ + "\2\0\2\2\2\0\3\2\1\1\5\0\2\1\1\0\5\1\4\0\3\1\4\0\2\1\1\0\2\1\1\0\2\1\1\0\2"+ + "\1\2\0\1\2\1\0\5\2\4\0\2\2\2\0\3\2\3\0\1\2\7\0\4\1\1\0\1\1\7\0\2\11\2\2\3"+ + "\1\1\2\2\0\1\1\1\0\2\1\1\0\3\1\2\2\1\0\3\2\2\0\1\1\15\0\2\2\2\0\1\2\1\1\1"+ + "\0\6\1\3\0\3\1\1\0\4\1\3\0\2\1\1\0\1\1\1\0\2\1\3\0\2\1\3\0\2\1\4\0\5\2\3\0"+ + "\3\2\1\0\4\2\2\0\1\1\6\0\1\2\4\1\1\0\5\1\3\0\1\1\7\2\1\0\2\2\5\0\2\2\3\0\2"+ + "\2\1\0\3\1\1\0\2\1\5\0\3\1\2\0\1\1\3\2\1\0\4\2\1\1\1\0\4\1\1\0\1\1\4\0\1\2"+ + "\4\0\6\2\1\0\1\2\7\0\12\10\2\0\2\2\4\0\1\1\1\2\2\1\7\2\4\0\10\1\1\2\2\11\7"+ + "\0\2\1\1\0\1\1\2\0\2\1\1\0\1\1\2\0\1\1\6\0\4\1\1\0\3\1\1\0\1\1\1\0\1\1\2\0"+ + "\2\1\1\0\3\1\2\2\1\0\2\2\1\1\2\0\5\1\1\0\1\1\1\0\6\2\2\0\2\11\2\0\4\1\2\2"+ + "\13\0\1\2\1\0\1\2\1\0\1\2\4\0\2\2\5\1\3\2\6\0\1\2\1\0\7\2\1\1\2\2\4\1\3\2"+ + "\1\1\3\2\2\1\7\2\3\1\4\2\5\1\14\2\1\1\1\2\2\11\4\2\2\0\3\1\1\0\7\1\2\0\3\2"+ + "\1\12\11\1\3\2\3\0\2\1\2\2\4\0\1\1\1\0\2\2\4\0\4\1\10\2\3\0\1\1\3\0\2\1\1"+ + "\2\5\0\3\2\2\0\1\1\1\2\1\1\5\0\6\1\2\0\5\2\3\1\3\0\10\2\5\1\2\11\3\0\3\1\3"+ + "\2\1\0\5\2\4\1\1\2\4\1\3\2\2\1\2\0\1\1\1\0\1\1\1\0\1\1\1\0\1\1\2\0\3\1\1\0"+ + "\6\1\2\0\2\1\13\12\5\2\2\12\5\2\1\12\4\0\1\1\12\0\1\12\2\0\6\2\1\0\1\2\3\0"+ + "\4\2\11\0\1\1\4\0\1\1\1\0\5\1\2\0\1\1\1\0\1\61\3\1\1\0\3\1\2\0\4\1\5\0\5\1"+ + "\4\0\1\1\4\0\4\1\3\2\2\1\4\0\1\12\4\0\3\1\1\0\2\2\2\0\3\1\2\11\2\1\4\0\6\2"+ + "\1\0\2\1\2\0\4\1\1\0\2\1\1\2\3\1\1\2\4\1\1\2\4\1\2\2\6\1\2\10\6\0\4\1\2\2"+ + "\4\0\1\1\1\2\4\0\1\2\5\1\2\2\3\0\3\1\4\0\3\1\2\2\2\0\6\1\1\0\3\2\1\0\2\2\5"+ + "\0\5\1\5\0\1\1\1\2\3\1\1\0\2\1\1\0\7\1\2\0\1\2\6\0\2\1\2\0\3\1\3\0\2\1\3\0"+ + "\2\1\2\0\3\2\4\0\3\1\1\0\2\1\1\0\1\1\5\0\1\2\2\0\1\1\3\0\1\1\2\0\2\1\3\2\1"+ + "\0\2\2\1\0\3\2\2\0\1\2\2\0\5\2\1\0\2\11\1\2\4\1\10\0\5\2\3\0\6\2\2\0\3\2\2"+ + "\0\4\2\4\0\3\2\5\0\1\1\2\0\2\1\2\0\4\1\1\0\4\1\1\0\1\1\1\0\6\1\2\0\5\1\1\0"+ + "\4\1\1\0\4\1\2\0\2\11\1\0\1\1\1\0\1\1\5\0\1\1\1\0\1\1\1\0\3\1\1\0\3\1\1\0"+ + "\3\1"); + + /** + * Translates DFA states to action switch labels. + */ + private static final int [] ZZ_ACTION = zzUnpackAction(); + + private static final String ZZ_ACTION_PACKED_0 = + "\13\0\1\1\1\2\1\3\1\1\2\4\1\5\1\6"+ + "\1\7\1\10\1\11\1\12\1\13\1\14\1\15\1\16"+ + "\1\17\20\2\1\20\1\21\1\17\12\20\1\22\1\23"+ + "\1\24\1\25\13\2\1\26\1\27\1\30\2\26\1\31"+ + "\1\32\1\33\1\31\1\34\1\35\1\36\1\20\1\37"+ + "\1\40\1\41\1\42\1\17\15\20\1\43\1\44\1\2"+ + "\2\45\2\1\1\46\3\4\1\47\1\50\11\2\1\51"+ + "\5\2\1\52\1\53\2\2\1\54\1\55\5\2\1\56"+ + "\4\2\1\57\6\20\1\60\4\20\1\52\2\20\1\56"+ + "\1\20\1\61\3\2\1\62\1\2\1\55\2\2\1\63"+ + "\1\26\1\64\1\65\1\66\1\67\1\70\1\71\1\72"+ + "\1\73\1\74\12\20\1\52\1\53\2\20\1\55\2\20"+ + "\1\56\2\20\1\2\1\75\1\76\1\0\2\2\1\77"+ + "\7\2\1\100\1\101\1\102\1\103\1\104\2\2\1\105"+ + "\4\2\1\106\1\107\5\2\2\20\1\77\4\20\1\101"+ + "\1\103\1\104\1\20\1\106\1\107\1\20\4\2\1\26"+ + "\7\20\1\100\1\102\1\20\1\105\6\20\1\2\1\0"+ + "\1\2\1\110\2\2\1\111\1\112\2\2\1\113\1\114"+ + "\1\2\1\115\6\2\1\116\1\2\1\20\1\110\1\20"+ + "\1\117\3\20\1\120\1\2\1\121\1\2\1\122\1\123"+ + "\2\20\1\124\1\111\1\112\1\20\1\113\1\114\1\115"+ + "\5\20\1\123\1\0\1\2\1\125\2\2\1\126\1\2"+ + "\1\127\1\130\1\131\1\2\1\132\1\133\1\134\1\20"+ + "\1\125\1\20\1\126\1\20\1\2\1\135\3\20\1\127"+ + "\1\131\1\20\1\132\1\133\1\0\1\136\1\137\1\140"+ + "\2\2\1\141\1\140\1\20\1\142\1\143\1\137\1\140"+ + "\1\20\1\144\1\2\1\145\1\20\1\145\2\146"; + + private static int [] zzUnpackAction() { + int [] result = new int[373]; + int offset = 0; + offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAction(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do result[j++] = value; while (--count > 0); + } + return j; + } + + + /** + * Translates a state to a row index in the transition table + */ + private static final int [] ZZ_ROWMAP = zzUnpackRowMap(); + + private static final String ZZ_ROWMAP_PACKED_0 = + "\0\0\0\64\0\150\0\234\0\320\0\u0104\0\u0138\0\u016c"+ + "\0\u01a0\0\u01d4\0\u0208\0\u023c\0\u0270\0\u02a4\0\u02d8\0\u030c"+ + "\0\u0340\0\u0374\0\u023c\0\u023c\0\u023c\0\u023c\0\u023c\0\u023c"+ + "\0\u023c\0\u023c\0\u03a8\0\u03dc\0\u0410\0\u0444\0\u0478\0\u04ac"+ + "\0\u04e0\0\u0514\0\u0548\0\u057c\0\u05b0\0\u05e4\0\u0618\0\u064c"+ + "\0\u0680\0\u06b4\0\u06e8\0\u071c\0\u0750\0\u023c\0\u023c\0\u0784"+ + "\0\u07b8\0\u07ec\0\u0820\0\u0854\0\u0888\0\u08bc\0\u08f0\0\u0924"+ + "\0\u0958\0\u023c\0\u023c\0\u023c\0\u098c\0\u09c0\0\u09f4\0\u0a28"+ + "\0\u0a5c\0\u0a90\0\u0ac4\0\u0af8\0\u0b2c\0\u0b60\0\u0b94\0\u0bc8"+ + "\0\u0bfc\0\u023c\0\u023c\0\u0c30\0\u0c64\0\u0c98\0\u023c\0\u023c"+ + "\0\u0ccc\0\u0d00\0\u023c\0\u023c\0\u0d34\0\u0d68\0\u0d9c\0\u023c"+ + "\0\u03a8\0\u0dd0\0\u0e04\0\u0e38\0\u0e6c\0\u0ea0\0\u0ed4\0\u0f08"+ + "\0\u0f3c\0\u0f70\0\u0fa4\0\u0fd8\0\u100c\0\u1040\0\u1074\0\u023c"+ + "\0\u023c\0\u10a8\0\u10dc\0\u1110\0\u1144\0\u1178\0\u11ac\0\u11e0"+ + "\0\u023c\0\u1214\0\u023c\0\u023c\0\u1248\0\u127c\0\u12b0\0\u12e4"+ + "\0\u1318\0\u134c\0\u1380\0\u13b4\0\u13e8\0\u141c\0\u1450\0\u1484"+ + "\0\u14b8\0\u14ec\0\u1520\0\u0270\0\u0270\0\u1554\0\u1588\0\u0270"+ + "\0\u15bc\0\u15f0\0\u1624\0\u1658\0\u168c\0\u16c0\0\u0270\0\u16f4"+ + "\0\u1728\0\u175c\0\u1790\0\u023c\0\u17c4\0\u17f8\0\u182c\0\u1860"+ + "\0\u1894\0\u18c8\0\u0750\0\u18fc\0\u1930\0\u1964\0\u1998\0\u0750"+ + "\0\u19cc\0\u1a00\0\u0750\0\u1a34\0\u023c\0\u1a68\0\u1a9c\0\u1ad0"+ + "\0\u0270\0\u1b04\0\u0270\0\u1b38\0\u1b6c\0\u023c\0\u1ba0\0\u0bfc"+ + "\0\u023c\0\u023c\0\u0c98\0\u023c\0\u023c\0\u023c\0\u023c\0\u023c"+ + "\0\u1bd4\0\u1c08\0\u1c3c\0\u1c70\0\u1ca4\0\u1cd8\0\u1d0c\0\u1d40"+ + "\0\u1d74\0\u1da8\0\u0d34\0\u0d34\0\u1ddc\0\u1e10\0\u1e44\0\u1e78"+ + "\0\u1eac\0\u0d34\0\u1ee0\0\u1f14\0\u1f48\0\u10dc\0\u023c\0\u1f7c"+ + "\0\u1fb0\0\u1fe4\0\u0270\0\u2018\0\u204c\0\u2080\0\u20b4\0\u20e8"+ + "\0\u211c\0\u2150\0\u0270\0\u0270\0\u0270\0\u0270\0\u0270\0\u2184"+ + "\0\u21b8\0\u0270\0\u21ec\0\u2220\0\u2254\0\u2288\0\u0270\0\u0270"+ + "\0\u22bc\0\u22f0\0\u2324\0\u2358\0\u238c\0\u23c0\0\u23f4\0\u0750"+ + "\0\u2428\0\u245c\0\u2490\0\u24c4\0\u0750\0\u0750\0\u0750\0\u24f8"+ + "\0\u0750\0\u0750\0\u252c\0\u2560\0\u2594\0\u25c8\0\u25fc\0\u2630"+ + "\0\u2664\0\u2698\0\u26cc\0\u2700\0\u2734\0\u2768\0\u279c\0\u0d34"+ + "\0\u0d34\0\u27d0\0\u0d34\0\u2804\0\u2838\0\u286c\0\u28a0\0\u28d4"+ + "\0\u2908\0\u293c\0\u2970\0\u29a4\0\u0270\0\u29d8\0\u2a0c\0\u0270"+ + "\0\u0270\0\u2a40\0\u2a74\0\u0270\0\u0270\0\u2aa8\0\u0270\0\u2adc"+ + "\0\u2b10\0\u2b44\0\u2b78\0\u2bac\0\u2be0\0\u0270\0\u2c14\0\u2c48"+ + "\0\u0750\0\u2c7c\0\u0750\0\u2cb0\0\u2ce4\0\u2d18\0\u0750\0\u2d4c"+ + "\0\u0270\0\u2d80\0\u0270\0\u0bfc\0\u2db4\0\u2de8\0\u0d34\0\u0d34"+ + "\0\u0d34\0\u2e1c\0\u0d34\0\u0d34\0\u0d34\0\u2e50\0\u2e84\0\u2eb8"+ + "\0\u2eec\0\u2f20\0\u0270\0\u2f54\0\u2f88\0\u0270\0\u2fbc\0\u2ff0"+ + "\0\u0270\0\u3024\0\u0270\0\u0270\0\u0270\0\u3058\0\u0270\0\u0270"+ + "\0\u0270\0\u308c\0\u0750\0\u30c0\0\u0750\0\u30f4\0\u3128\0\u0270"+ + "\0\u315c\0\u3190\0\u31c4\0\u0d34\0\u0d34\0\u31f8\0\u0d34\0\u0d34"+ + "\0\u322c\0\u0270\0\u0270\0\u0270\0\u3260\0\u3294\0\u0750\0\u0750"+ + "\0\u32c8\0\u0270\0\u0d34\0\u0d34\0\u0d34\0\u32fc\0\u023c\0\u3330"+ + "\0\u0270\0\u3364\0\u0d34\0\u0270\0\u0750"; + + private static int [] zzUnpackRowMap() { + int [] result = new int[373]; + int offset = 0; + offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackRowMap(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int high = packed.charAt(i++) << 16; + result[j++] = high | packed.charAt(i++); + } + return j; + } + + /** + * The transition table of the DFA + */ + private static final int [] ZZ_TRANS = zzUnpackTrans(); + + private static final String ZZ_TRANS_PACKED_0 = + "\1\14\1\15\1\14\1\16\1\17\1\14\1\20\1\21"+ + "\2\22\2\16\1\23\1\24\1\25\1\26\1\27\1\30"+ + "\1\31\5\14\2\32\1\33\1\34\1\35\1\36\1\37"+ + "\1\40\1\41\1\42\1\43\1\44\1\45\1\46\1\47"+ + "\1\15\1\50\1\51\3\15\1\52\1\53\1\54\4\15"+ + "\1\14\1\55\1\14\1\16\1\17\1\14\1\20\1\21"+ + "\2\22\2\16\1\23\1\24\1\25\1\26\1\27\1\30"+ + "\1\31\7\14\1\56\1\57\1\60\1\61\1\62\1\63"+ + "\1\55\1\64\1\65\1\66\5\55\1\67\3\55\1\70"+ + "\1\71\5\55\1\14\1\15\1\14\1\16\1\17\1\14"+ + "\1\20\1\21\2\22\2\16\1\23\1\24\1\25\1\26"+ + "\1\27\1\30\2\14\1\72\1\14\1\73\1\74\2\14"+ + "\1\75\1\34\1\76\1\77\1\100\1\101\1\41\1\102"+ + "\1\15\1\103\1\45\1\104\1\47\1\15\1\50\4\15"+ + "\1\105\1\106\1\107\3\15\1\110\1\14\1\111\1\14"+ + "\1\16\1\17\5\14\2\16\1\112\11\14\1\73\1\74"+ + "\3\14\1\113\2\111\1\114\2\111\1\115\22\111\1\14"+ + "\1\116\1\14\1\16\1\17\5\14\2\16\1\112\1\24"+ + "\1\25\1\26\1\14\1\117\1\31\1\14\1\120\6\14"+ + "\1\113\5\116\1\121\22\116\1\14\1\122\1\14\1\16"+ + "\1\17\5\14\2\16\20\14\30\122\1\14\1\15\1\14"+ + "\1\16\1\17\5\14\2\16\14\14\1\123\1\124\2\14"+ + "\30\15\1\14\1\125\1\14\1\16\1\17\1\14\1\20"+ + "\1\21\2\22\2\16\1\23\1\24\1\25\1\26\1\27"+ + "\1\30\1\14\1\126\1\72\1\127\1\130\1\74\2\14"+ + "\1\131\1\132\1\133\1\134\1\135\1\136\1\137\1\140"+ + "\1\141\1\142\1\143\1\144\2\125\1\145\4\125\1\146"+ + "\1\147\5\125\1\14\1\15\1\14\1\16\1\17\3\14"+ + "\2\22\2\16\12\14\1\150\3\14\1\151\1\113\2\15"+ + "\1\152\25\15\1\14\1\153\1\14\1\16\1\17\5\14"+ + "\2\16\20\14\5\153\1\154\22\153\3\14\1\16\1\17"+ + "\5\14\2\16\17\14\1\155\1\156\27\14\65\0\2\15"+ + "\6\0\1\15\1\0\1\15\20\0\30\15\3\0\1\16"+ + "\6\0\2\16\54\0\1\157\57\0\3\20\1\0\1\20"+ + "\1\160\1\161\55\20\3\21\1\0\1\21\1\162\1\21"+ + "\1\161\54\21\10\0\2\22\104\0\1\163\64\0\1\164"+ + "\31\0\2\15\6\0\1\15\1\0\1\15\20\0\1\15"+ + "\1\165\7\15\1\166\1\167\15\15\1\0\2\15\6\0"+ + "\1\15\1\0\1\15\20\0\13\15\1\170\2\15\1\171"+ + "\11\15\1\0\2\15\6\0\1\15\1\0\1\15\20\0"+ + "\5\15\1\172\1\15\1\173\20\15\1\0\2\15\6\0"+ + "\1\15\1\0\1\15\20\0\11\15\1\174\16\15\1\0"+ + "\2\15\6\0\1\15\1\0\1\15\20\0\17\15\1\175"+ + "\10\15\1\0\2\15\6\0\1\15\1\0\1\15\20\0"+ + "\1\176\1\15\1\177\5\15\1\200\2\15\1\201\14\15"+ + "\1\0\2\15\6\0\1\15\1\0\1\15\20\0\1\15"+ + "\1\202\5\15\1\203\20\15\1\0\2\15\6\0\1\15"+ + "\1\0\1\15\20\0\1\204\7\15\1\205\17\15\1\0"+ + "\2\15\6\0\1\15\1\0\1\15\20\0\11\15\1\206"+ + "\1\207\15\15\1\0\2\15\6\0\1\15\1\0\1\15"+ + "\20\0\10\15\1\210\6\15\1\211\10\15\1\0\2\15"+ + "\6\0\1\15\1\0\1\15\20\0\10\15\1\212\17\15"+ + "\1\0\2\15\6\0\1\15\1\0\1\15\20\0\17\15"+ + "\1\213\10\15\1\0\2\15\6\0\1\15\1\0\1\15"+ + "\20\0\5\15\1\214\1\15\1\215\20\15\1\0\2\15"+ + "\6\0\1\15\1\0\1\15\20\0\1\15\1\216\16\15"+ + "\1\217\7\15\1\0\2\15\6\0\1\15\1\0\1\15"+ + "\20\0\5\15\1\220\1\15\1\221\7\15\1\222\10\15"+ + "\1\0\2\15\6\0\1\15\1\0\1\15\20\0\24\15"+ + "\1\223\3\15\1\0\2\55\6\0\1\55\1\0\1\55"+ + "\1\0\1\224\16\0\30\55\1\0\2\55\6\0\1\55"+ + "\1\0\1\55\1\0\1\224\16\0\1\55\1\225\7\55"+ + "\1\226\1\227\15\55\1\0\2\55\6\0\1\55\1\0"+ + "\1\55\1\0\1\224\16\0\13\55\1\230\14\55\1\0"+ + "\2\55\6\0\1\55\1\0\1\55\1\0\1\224\16\0"+ + "\1\55\1\231\26\55\1\0\2\55\6\0\1\55\1\0"+ + "\1\55\1\0\1\224\16\0\11\55\1\232\16\55\1\0"+ + "\2\55\6\0\1\55\1\0\1\55\1\0\1\224\16\0"+ + "\1\233\1\55\1\234\5\55\1\235\2\55\1\236\14\55"+ + "\1\0\2\55\6\0\1\55\1\0\1\55\1\0\1\224"+ + "\16\0\7\55\1\237\20\55\1\0\2\55\6\0\1\55"+ + "\1\0\1\55\1\0\1\224\16\0\1\240\27\55\1\0"+ + "\2\55\6\0\1\55\1\0\1\55\1\0\1\224\16\0"+ + "\5\55\1\241\1\55\1\242\20\55\1\0\2\55\6\0"+ + "\1\55\1\0\1\55\1\0\1\224\16\0\20\55\1\243"+ + "\7\55\1\0\2\55\6\0\1\55\1\0\1\55\1\0"+ + "\1\224\16\0\17\55\1\244\10\55\32\0\1\245\32\0"+ + "\2\15\6\0\1\15\1\0\1\15\20\0\1\15\1\246"+ + "\26\15\1\0\2\15\6\0\1\15\1\0\1\15\20\0"+ + "\16\15\1\171\11\15\1\0\2\15\6\0\1\15\1\0"+ + "\1\15\20\0\1\15\1\247\5\15\1\173\20\15\1\0"+ + "\2\15\6\0\1\15\1\0\1\15\20\0\11\15\1\250"+ + "\16\15\1\0\2\15\6\0\1\15\1\0\1\15\20\0"+ + "\1\251\1\15\1\177\5\15\1\252\17\15\1\0\2\15"+ + "\6\0\1\15\1\0\1\15\20\0\1\204\27\15\1\0"+ + "\2\15\6\0\1\15\1\0\1\15\20\0\10\15\1\210"+ + "\6\15\1\253\10\15\1\0\2\15\6\0\1\15\1\0"+ + "\1\15\20\0\1\15\1\216\26\15\1\0\2\15\6\0"+ + "\1\15\1\0\1\15\20\0\5\15\1\220\22\15\1\0"+ + "\2\15\6\0\1\15\1\0\1\15\20\0\24\15\1\254"+ + "\3\15\1\0\2\15\6\0\1\15\1\0\1\15\20\0"+ + "\11\15\1\255\16\15\1\0\2\111\6\0\1\111\1\0"+ + "\1\111\1\0\2\256\15\0\30\111\1\0\2\111\6\0"+ + "\1\111\1\0\1\111\1\0\2\256\15\0\1\111\1\257"+ + "\26\111\1\0\2\111\6\0\1\111\1\0\1\111\1\0"+ + "\2\256\15\0\1\260\27\111\1\0\2\116\6\0\1\116"+ + "\1\0\1\116\1\0\2\261\11\0\1\262\3\0\30\116"+ + "\1\0\2\116\6\0\1\116\1\0\1\116\1\0\2\261"+ + "\11\0\1\262\3\0\1\263\27\116\1\0\2\122\6\0"+ + "\1\122\1\0\1\122\20\0\30\122\1\0\2\125\6\0"+ + "\1\125\1\0\1\125\1\0\1\264\16\0\30\125\24\0"+ + "\1\265\1\266\62\0\1\267\72\0\1\270\31\0\2\125"+ + "\6\0\1\125\1\0\1\125\1\0\1\264\16\0\1\125"+ + "\1\271\26\125\1\0\2\125\6\0\1\125\1\0\1\125"+ + "\1\0\1\264\16\0\16\125\1\272\11\125\1\0\2\125"+ + "\6\0\1\125\1\0\1\125\1\0\1\264\16\0\1\125"+ + "\1\273\3\125\1\274\1\125\1\275\20\125\1\0\2\125"+ + "\6\0\1\125\1\0\1\125\1\0\1\264\16\0\11\125"+ + "\1\276\16\125\1\0\2\125\6\0\1\125\1\0\1\125"+ + "\1\0\1\264\16\0\17\125\1\277\10\125\1\0\2\125"+ + "\6\0\1\125\1\0\1\125\1\0\1\264\16\0\1\300"+ + "\7\125\1\301\17\125\1\0\2\125\6\0\1\125\1\0"+ + "\1\125\1\0\1\264\16\0\1\125\1\302\26\125\1\0"+ + "\2\125\6\0\1\125\1\0\1\125\1\0\1\264\16\0"+ + "\1\303\7\125\1\304\17\125\1\0\2\125\6\0\1\125"+ + "\1\0\1\125\1\0\1\264\16\0\11\125\1\305\1\306"+ + "\15\125\1\0\2\125\6\0\1\125\1\0\1\125\1\0"+ + "\1\264\16\0\17\125\1\307\10\125\1\0\2\125\6\0"+ + "\1\125\1\0\1\125\1\0\1\264\16\0\17\125\1\310"+ + "\10\125\1\0\2\125\6\0\1\125\1\0\1\125\1\0"+ + "\1\264\16\0\1\125\1\311\16\125\1\312\7\125\1\0"+ + "\2\125\6\0\1\125\1\0\1\125\1\0\1\264\16\0"+ + "\5\125\1\313\1\125\1\314\20\125\1\0\2\15\6\0"+ + "\1\15\1\0\1\15\20\0\1\15\1\315\26\15\1\0"+ + "\2\153\6\0\1\153\1\0\1\153\20\0\30\153\1\0"+ + "\2\153\6\0\1\153\1\0\1\153\20\0\1\316\27\153"+ + "\33\0\1\317\65\0\1\320\26\0\3\157\1\0\60\157"+ + "\3\20\1\0\60\20\3\21\1\0\60\21\1\0\2\15"+ + "\6\0\1\15\1\0\1\15\20\0\2\15\1\321\25\15"+ + "\1\0\2\15\6\0\1\15\1\0\1\15\20\0\15\15"+ + "\1\322\12\15\1\0\2\15\6\0\1\15\1\0\1\15"+ + "\20\0\15\15\1\323\12\15\1\0\2\15\6\0\1\15"+ + "\1\0\1\15\20\0\1\15\1\324\26\15\1\0\2\15"+ + "\6\0\1\15\1\0\1\15\20\0\7\15\1\325\20\15"+ + "\1\0\2\15\6\0\1\15\1\0\1\15\20\0\1\326"+ + "\27\15\1\0\2\15\6\0\1\15\1\0\1\15\20\0"+ + "\25\15\1\327\2\15\1\0\2\15\6\0\1\15\1\0"+ + "\1\15\20\0\10\15\1\330\1\15\1\331\15\15\1\0"+ + "\2\15\6\0\1\15\1\0\1\15\20\0\12\15\1\332"+ + "\15\15\1\0\2\15\6\0\1\15\1\0\1\15\20\0"+ + "\3\15\1\333\24\15\1\0\2\15\6\0\1\15\1\0"+ + "\1\15\20\0\2\15\1\334\25\15\1\0\2\15\6\0"+ + "\1\15\1\0\1\15\20\0\6\15\1\335\11\15\1\336"+ + "\7\15\1\0\2\15\6\0\1\15\1\0\1\15\20\0"+ + "\14\15\1\337\13\15\1\0\2\15\6\0\1\15\1\0"+ + "\1\15\20\0\1\340\27\15\1\0\2\15\6\0\1\15"+ + "\1\0\1\15\20\0\1\341\27\15\1\0\2\15\6\0"+ + "\1\15\1\0\1\15\20\0\4\15\1\342\23\15\1\0"+ + "\2\15\6\0\1\15\1\0\1\15\20\0\2\15\1\343"+ + "\25\15\1\0\2\15\6\0\1\15\1\0\1\15\20\0"+ + "\6\15\1\344\21\15\1\0\2\15\6\0\1\15\1\0"+ + "\1\15\20\0\7\15\1\345\20\15\1\0\2\15\6\0"+ + "\1\15\1\0\1\15\20\0\11\15\1\346\16\15\1\0"+ + "\2\15\6\0\1\15\1\0\1\15\20\0\16\15\1\347"+ + "\11\15\1\0\2\15\6\0\1\15\1\0\1\15\20\0"+ + "\10\15\1\350\17\15\1\0\2\15\6\0\1\15\1\0"+ + "\1\15\20\0\4\15\1\351\23\15\1\0\2\15\6\0"+ + "\1\15\1\0\1\15\20\0\2\15\1\352\25\15\1\0"+ + "\2\15\6\0\1\15\1\0\1\15\20\0\17\15\1\353"+ + "\10\15\1\0\2\15\6\0\1\15\1\0\1\15\20\0"+ + "\11\15\1\354\16\15\1\0\2\15\6\0\1\15\1\0"+ + "\1\15\20\0\1\15\1\355\26\15\1\0\2\55\6\0"+ + "\1\55\1\0\1\55\1\0\1\224\16\0\2\55\1\356"+ + "\25\55\1\0\2\55\6\0\1\55\1\0\1\55\1\0"+ + "\1\224\16\0\15\55\1\357\12\55\1\0\2\55\6\0"+ + "\1\55\1\0\1\55\1\0\1\224\16\0\15\55\1\360"+ + "\12\55\1\0\2\55\6\0\1\55\1\0\1\55\1\0"+ + "\1\224\16\0\1\55\1\361\26\55\1\0\2\55\6\0"+ + "\1\55\1\0\1\55\1\0\1\224\16\0\22\55\1\362"+ + "\5\55\1\0\2\55\6\0\1\55\1\0\1\55\1\0"+ + "\1\224\16\0\10\55\1\363\1\55\1\364\15\55\1\0"+ + "\2\55\6\0\1\55\1\0\1\55\1\0\1\224\16\0"+ + "\2\55\1\365\25\55\1\0\2\55\6\0\1\55\1\0"+ + "\1\55\1\0\1\224\16\0\20\55\1\366\7\55\1\0"+ + "\2\55\6\0\1\55\1\0\1\55\1\0\1\224\16\0"+ + "\14\55\1\367\13\55\1\0\2\55\6\0\1\55\1\0"+ + "\1\55\1\0\1\224\16\0\1\370\27\55\1\0\2\55"+ + "\6\0\1\55\1\0\1\55\1\0\1\224\16\0\16\55"+ + "\1\371\11\55\1\0\2\55\6\0\1\55\1\0\1\55"+ + "\1\0\1\224\16\0\10\55\1\372\17\55\1\0\2\55"+ + "\6\0\1\55\1\0\1\55\1\0\1\224\16\0\11\55"+ + "\1\373\16\55\1\0\2\15\6\0\1\15\1\0\1\15"+ + "\20\0\2\15\1\374\25\15\1\0\2\15\6\0\1\15"+ + "\1\0\1\15\20\0\22\15\1\375\5\15\1\0\2\15"+ + "\6\0\1\15\1\0\1\15\20\0\10\15\1\330\17\15"+ + "\1\0\2\15\6\0\1\15\1\0\1\15\20\0\6\15"+ + "\1\335\21\15\1\0\2\15\6\0\1\15\1\0\1\15"+ + "\20\0\1\15\1\376\26\15\1\0\2\15\6\0\1\15"+ + "\1\0\1\15\20\0\7\15\1\377\20\15\1\0\2\111"+ + "\6\0\1\111\1\0\1\111\1\0\2\256\15\0\22\111"+ + "\1\u0100\5\111\1\0\2\125\6\0\1\125\1\0\1\125"+ + "\1\0\1\264\16\0\2\125\1\u0101\25\125\1\0\2\125"+ + "\6\0\1\125\1\0\1\125\1\0\1\264\16\0\7\125"+ + "\1\u0102\20\125\1\0\2\125\6\0\1\125\1\0\1\125"+ + "\1\0\1\264\16\0\22\125\1\u0103\5\125\1\0\2\125"+ + "\6\0\1\125\1\0\1\125\1\0\1\264\16\0\1\u0104"+ + "\27\125\1\0\2\125\6\0\1\125\1\0\1\125\1\0"+ + "\1\264\16\0\25\125\1\u0105\2\125\1\0\2\125\6\0"+ + "\1\125\1\0\1\125\1\0\1\264\16\0\10\125\1\u0106"+ + "\17\125\1\0\2\125\6\0\1\125\1\0\1\125\1\0"+ + "\1\264\16\0\12\125\1\u0107\15\125\1\0\2\125\6\0"+ + "\1\125\1\0\1\125\1\0\1\264\16\0\3\125\1\u0108"+ + "\24\125\1\0\2\125\6\0\1\125\1\0\1\125\1\0"+ + "\1\264\16\0\6\125\1\u0109\21\125\1\0\2\125\6\0"+ + "\1\125\1\0\1\125\1\0\1\264\16\0\1\u010a\27\125"+ + "\1\0\2\125\6\0\1\125\1\0\1\125\1\0\1\264"+ + "\16\0\4\125\1\u010b\23\125\1\0\2\125\6\0\1\125"+ + "\1\0\1\125\1\0\1\264\16\0\2\125\1\u010c\25\125"+ + "\1\0\2\125\6\0\1\125\1\0\1\125\1\0\1\264"+ + "\16\0\6\125\1\u010d\21\125\1\0\2\125\6\0\1\125"+ + "\1\0\1\125\1\0\1\264\16\0\11\125\1\u010e\16\125"+ + "\1\0\2\125\6\0\1\125\1\0\1\125\1\0\1\264"+ + "\16\0\4\125\1\u010f\23\125\1\0\2\125\6\0\1\125"+ + "\1\0\1\125\1\0\1\264\16\0\2\125\1\u0110\25\125"+ + "\1\0\2\125\6\0\1\125\1\0\1\125\1\0\1\264"+ + "\16\0\17\125\1\u0111\10\125\1\0\2\15\6\0\1\15"+ + "\1\0\1\15\20\0\22\15\1\u0112\5\15\36\0\1\u0113"+ + "\26\0\2\15\6\0\1\15\1\0\1\15\20\0\1\15"+ + "\1\u0114\26\15\1\0\2\15\6\0\1\15\1\0\1\15"+ + "\20\0\1\15\1\u0115\26\15\1\0\2\15\6\0\1\15"+ + "\1\0\1\15\20\0\17\15\1\u0116\10\15\1\0\2\15"+ + "\6\0\1\15\1\0\1\15\20\0\1\u0117\27\15\1\0"+ + "\2\15\6\0\1\15\1\0\1\15\20\0\4\15\1\u0118"+ + "\23\15\1\0\2\15\6\0\1\15\1\0\1\15\20\0"+ + "\1\15\1\u0119\26\15\1\0\2\15\6\0\1\15\1\0"+ + "\1\15\20\0\3\15\1\u011a\24\15\1\0\2\15\6\0"+ + "\1\15\1\0\1\15\20\0\10\15\1\u011b\17\15\1\0"+ + "\2\15\6\0\1\15\1\0\1\15\20\0\1\15\1\u011c"+ + "\26\15\1\0\2\15\6\0\1\15\1\0\1\15\20\0"+ + "\3\15\1\u011d\24\15\1\0\2\15\6\0\1\15\1\0"+ + "\1\15\20\0\4\15\1\u011e\23\15\1\0\2\15\6\0"+ + "\1\15\1\0\1\15\20\0\2\15\1\u011f\25\15\1\0"+ + "\2\15\6\0\1\15\1\0\1\15\20\0\1\15\1\u0120"+ + "\26\15\1\0\2\15\6\0\1\15\1\0\1\15\20\0"+ + "\11\15\1\u0121\16\15\1\0\2\15\6\0\1\15\1\0"+ + "\1\15\20\0\12\15\1\u0122\15\15\1\0\2\15\6\0"+ + "\1\15\1\0\1\15\20\0\23\15\1\u0123\4\15\1\0"+ + "\2\15\6\0\1\15\1\0\1\15\20\0\1\u0124\27\15"+ + "\1\0\2\15\6\0\1\15\1\0\1\15\20\0\1\u0125"+ + "\27\15\1\0\2\15\6\0\1\15\1\0\1\15\20\0"+ + "\15\15\1\u0126\12\15\1\0\2\15\6\0\1\15\1\0"+ + "\1\15\20\0\17\15\1\u0127\10\15\1\0\2\55\6\0"+ + "\1\55\1\0\1\55\1\0\1\224\16\0\1\55\1\u0128"+ + "\26\55\1\0\2\55\6\0\1\55\1\0\1\55\1\0"+ + "\1\224\16\0\1\55\1\u0129\26\55\1\0\2\55\6\0"+ + "\1\55\1\0\1\55\1\0\1\224\16\0\17\55\1\u012a"+ + "\10\55\1\0\2\55\6\0\1\55\1\0\1\55\1\0"+ + "\1\224\16\0\4\55\1\u012b\23\55\1\0\2\55\6\0"+ + "\1\55\1\0\1\55\1\0\1\224\16\0\3\55\1\u012c"+ + "\24\55\1\0\2\55\6\0\1\55\1\0\1\55\1\0"+ + "\1\224\16\0\10\55\1\u012d\17\55\1\0\2\55\6\0"+ + "\1\55\1\0\1\55\1\0\1\224\16\0\4\55\1\u012e"+ + "\23\55\1\0\2\55\6\0\1\55\1\0\1\55\1\0"+ + "\1\224\16\0\15\55\1\u012f\12\55\1\0\2\15\6\0"+ + "\1\15\1\0\1\15\20\0\1\15\1\u0130\26\15\1\0"+ + "\2\15\6\0\1\15\1\0\1\15\20\0\4\15\1\u0131"+ + "\23\15\1\0\2\15\6\0\1\15\1\0\1\15\20\0"+ + "\17\15\1\u0132\10\15\1\0\2\15\6\0\1\15\1\0"+ + "\1\15\20\0\10\15\1\u0133\17\15\1\0\2\111\6\0"+ + "\1\111\1\0\1\111\1\0\2\256\15\0\4\111\1\u0134"+ + "\23\111\1\0\2\125\6\0\1\125\1\0\1\125\1\0"+ + "\1\264\16\0\1\125\1\u0135\26\125\1\0\2\125\6\0"+ + "\1\125\1\0\1\125\1\0\1\264\16\0\1\u0136\27\125"+ + "\1\0\2\125\6\0\1\125\1\0\1\125\1\0\1\264"+ + "\16\0\4\125\1\u0137\23\125\1\0\2\125\6\0\1\125"+ + "\1\0\1\125\1\0\1\264\16\0\4\125\1\u0138\23\125"+ + "\1\0\2\125\6\0\1\125\1\0\1\125\1\0\1\264"+ + "\16\0\1\125\1\u0139\26\125\1\0\2\125\6\0\1\125"+ + "\1\0\1\125\1\0\1\264\16\0\3\125\1\u013a\24\125"+ + "\1\0\2\125\6\0\1\125\1\0\1\125\1\0\1\264"+ + "\16\0\1\125\1\u013b\26\125\1\0\2\125\6\0\1\125"+ + "\1\0\1\125\1\0\1\264\16\0\3\125\1\u013c\24\125"+ + "\1\0\2\125\6\0\1\125\1\0\1\125\1\0\1\264"+ + "\16\0\2\125\1\u013d\25\125\1\0\2\125\6\0\1\125"+ + "\1\0\1\125\1\0\1\264\16\0\1\125\1\u013e\26\125"+ + "\1\0\2\125\6\0\1\125\1\0\1\125\1\0\1\264"+ + "\16\0\12\125\1\u013f\15\125\1\0\2\125\6\0\1\125"+ + "\1\0\1\125\1\0\1\264\16\0\23\125\1\u0140\4\125"+ + "\1\0\2\125\6\0\1\125\1\0\1\125\1\0\1\264"+ + "\16\0\1\u0141\27\125\1\0\2\125\6\0\1\125\1\0"+ + "\1\125\1\0\1\264\16\0\1\u0142\27\125\1\0\2\15"+ + "\6\0\1\15\1\0\1\15\20\0\4\15\1\u0143\23\15"+ + "\35\0\1\u0144\27\0\2\15\6\0\1\15\1\0\1\15"+ + "\20\0\3\15\1\u0145\24\15\1\0\2\15\6\0\1\15"+ + "\1\0\1\15\20\0\20\15\1\u0146\7\15\1\0\2\15"+ + "\6\0\1\15\1\0\1\15\20\0\4\15\1\u0147\23\15"+ + "\1\0\2\15\6\0\1\15\1\0\1\15\20\0\5\15"+ + "\1\u0148\22\15\1\0\2\15\6\0\1\15\1\0\1\15"+ + "\20\0\4\15\1\u0149\23\15\1\0\2\15\6\0\1\15"+ + "\1\0\1\15\20\0\7\15\1\u014a\20\15\1\0\2\15"+ + "\6\0\1\15\1\0\1\15\20\0\17\15\1\u014b\10\15"+ + "\1\0\2\15\6\0\1\15\1\0\1\15\20\0\10\15"+ + "\1\u014c\17\15\1\0\2\15\6\0\1\15\1\0\1\15"+ + "\20\0\26\15\1\u014d\1\15\1\0\2\15\6\0\1\15"+ + "\1\0\1\15\20\0\1\15\1\u014e\26\15\1\0\2\15"+ + "\6\0\1\15\1\0\1\15\20\0\1\15\1\u014f\26\15"+ + "\1\0\2\15\6\0\1\15\1\0\1\15\20\0\4\15"+ + "\1\u0150\23\15\1\0\2\15\6\0\1\15\1\0\1\15"+ + "\20\0\1\15\1\u0151\26\15\1\0\2\55\6\0\1\55"+ + "\1\0\1\55\1\0\1\224\16\0\3\55\1\u0152\24\55"+ + "\1\0\2\55\6\0\1\55\1\0\1\55\1\0\1\224"+ + "\16\0\20\55\1\u0153\7\55\1\0\2\55\6\0\1\55"+ + "\1\0\1\55\1\0\1\224\16\0\5\55\1\u0154\22\55"+ + "\1\0\2\55\6\0\1\55\1\0\1\55\1\0\1\224"+ + "\16\0\4\55\1\u0155\23\55\1\0\2\55\6\0\1\55"+ + "\1\0\1\55\1\0\1\224\16\0\7\55\1\u0156\20\55"+ + "\1\0\2\15\6\0\1\15\1\0\1\15\20\0\3\15"+ + "\1\u0157\24\15\1\0\2\15\6\0\1\15\1\0\1\15"+ + "\20\0\1\15\1\u0158\26\15\1\0\2\125\6\0\1\125"+ + "\1\0\1\125\1\0\1\264\16\0\3\125\1\u0159\24\125"+ + "\1\0\2\125\6\0\1\125\1\0\1\125\1\0\1\264"+ + "\16\0\4\125\1\u015a\23\125\1\0\2\125\6\0\1\125"+ + "\1\0\1\125\1\0\1\264\16\0\5\125\1\u015b\22\125"+ + "\1\0\2\125\6\0\1\125\1\0\1\125\1\0\1\264"+ + "\16\0\17\125\1\u015c\10\125\1\0\2\125\6\0\1\125"+ + "\1\0\1\125\1\0\1\264\16\0\26\125\1\u015d\1\125"+ + "\1\0\2\125\6\0\1\125\1\0\1\125\1\0\1\264"+ + "\16\0\1\125\1\u015e\26\125\1\0\2\125\6\0\1\125"+ + "\1\0\1\125\1\0\1\264\16\0\1\125\1\u015f\26\125"+ + "\1\0\2\125\6\0\1\125\1\0\1\125\1\0\1\264"+ + "\16\0\4\125\1\u0160\23\125\37\0\1\u0161\25\0\2\15"+ + "\6\0\1\15\1\0\1\15\20\0\4\15\1\u0162\23\15"+ + "\1\0\2\15\6\0\1\15\1\0\1\15\20\0\1\u0163"+ + "\27\15\1\0\2\15\6\0\1\15\1\0\1\15\20\0"+ + "\4\15\1\u0164\23\15\1\0\2\15\6\0\1\15\1\0"+ + "\1\15\20\0\10\15\1\u0165\17\15\1\0\2\15\6\0"+ + "\1\15\1\0\1\15\20\0\1\15\1\u0166\26\15\1\0"+ + "\2\55\6\0\1\55\1\0\1\55\1\0\1\224\16\0"+ + "\4\55\1\u0167\23\55\1\0\2\55\6\0\1\55\1\0"+ + "\1\55\1\0\1\224\16\0\4\55\1\u0168\23\55\1\0"+ + "\2\55\6\0\1\55\1\0\1\55\1\0\1\224\16\0"+ + "\10\55\1\u0169\17\55\1\0\2\15\6\0\1\15\1\0"+ + "\1\15\20\0\4\15\1\u016a\23\15\1\0\2\125\6\0"+ + "\1\125\1\0\1\125\1\0\1\264\16\0\4\125\1\u016b"+ + "\23\125\1\0\2\125\6\0\1\125\1\0\1\125\1\0"+ + "\1\264\16\0\1\u016c\27\125\1\0\2\125\6\0\1\125"+ + "\1\0\1\125\1\0\1\264\16\0\4\125\1\u016d\23\125"+ + "\1\0\2\125\6\0\1\125\1\0\1\125\1\0\1\264"+ + "\16\0\1\125\1\u016e\26\125\40\0\1\u016f\24\0\2\15"+ + "\6\0\1\15\1\0\1\15\20\0\3\15\1\u0170\24\15"+ + "\1\0\2\15\6\0\1\15\1\0\1\15\20\0\10\15"+ + "\1\u0171\17\15\1\0\2\55\6\0\1\55\1\0\1\55"+ + "\1\0\1\224\16\0\3\55\1\u0172\24\55\1\0\2\125"+ + "\6\0\1\125\1\0\1\125\1\0\1\264\16\0\10\125"+ + "\1\u0173\17\125\1\0\2\15\6\0\1\15\1\0\1\15"+ + "\20\0\4\15\1\u0174\23\15\1\0\2\55\6\0\1\55"+ + "\1\0\1\55\1\0\1\224\16\0\4\55\1\u0175\23\55"; + + private static int [] zzUnpackTrans() { + int [] result = new int[13208]; + int offset = 0; + offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackTrans(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + value--; + do result[j++] = value; while (--count > 0); + } + return j; + } + + + /* error codes */ + private static final int ZZ_UNKNOWN_ERROR = 0; + private static final int ZZ_NO_MATCH = 1; + private static final int ZZ_PUSHBACK_2BIG = 2; + + /* error messages for the codes above */ + private static final String[] ZZ_ERROR_MSG = { + "Unknown internal scanner error", + "Error: could not match input", + "Error: pushback value was too large" + }; + + /** + * ZZ_ATTRIBUTE[aState] contains the attributes of state aState + */ + private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); + + private static final String ZZ_ATTRIBUTE_PACKED_0 = + "\13\0\1\11\6\1\10\11\23\1\2\11\12\1\3\11"+ + "\15\1\2\11\3\1\2\11\2\1\2\11\3\1\1\11"+ + "\17\1\2\11\7\1\1\11\1\1\2\11\37\1\1\11"+ + "\20\1\1\11\10\1\1\11\2\1\2\11\1\1\5\11"+ + "\26\1\1\11\1\0\102\1\1\0\60\1\1\0\34\1"+ + "\1\0\15\1\1\11\6\1"; + + private static int [] zzUnpackAttribute() { + int [] result = new int[373]; + int offset = 0; + offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAttribute(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do result[j++] = value; while (--count > 0); + } + return j; + } + + /** the input device */ + private java.io.Reader zzReader; + + /** the current state of the DFA */ + private int zzState; + + /** the current lexical state */ + private int zzLexicalState = YYINITIAL; + + /** this buffer contains the current text to be matched and is + the source of the yytext() string */ + private CharSequence zzBuffer = ""; + + /** the textposition at the last accepting state */ + private int zzMarkedPos; + + /** the current text position in the buffer */ + private int zzCurrentPos; + + /** startRead marks the beginning of the yytext() string in the buffer */ + private int zzStartRead; + + /** endRead marks the last character in the buffer, that has been read + from input */ + private int zzEndRead; + + /** + * zzAtBOL == true <=> the scanner is currently at the beginning of a line + */ + private boolean zzAtBOL = true; + + /** zzAtEOF == true <=> the scanner is at the EOF */ + private boolean zzAtEOF; + + /** denotes if the user-EOF-code has already been executed */ + private boolean zzEOFDone; + + /* user code: */ + private int myPrevState = YYINITIAL; + + public int yyprevstate() { + return myPrevState; + } + + private int popState() { + final int prev = myPrevState; + myPrevState = YYINITIAL; + return prev; + } + + protected void pushState(int state){ + myPrevState = state; + } + + + + /** + * Creates a new scanner + * + * @param in the java.io.Reader to read input from. + */ + public FlexibleSearchLexer(java.io.Reader in) { + this.zzReader = in; + } + + + /** + * Unpacks the compressed character translation table. + * + * @param packed the packed character translation table + * @return the unpacked character translation table + */ + private static char [] zzUnpackCMap(String packed) { + int size = 0; + for (int i = 0, length = packed.length(); i < length; i += 2) { + size += packed.charAt(i); + } + char[] map = new char[size]; + int i = 0; /* index in packed string */ + int j = 0; /* index in unpacked array */ + while (i < packed.length()) { + int count = packed.charAt(i++); + char value = packed.charAt(i++); + do map[j++] = value; while (--count > 0); + } + return map; + } + + public final int getTokenStart() { + return zzStartRead; + } + + public final int getTokenEnd() { + return getTokenStart() + yylength(); + } + + public void reset(CharSequence buffer, int start, int end, int initialState) { + zzBuffer = buffer; + zzCurrentPos = zzMarkedPos = zzStartRead = start; + zzAtEOF = false; + zzAtBOL = true; + zzEndRead = end; + yybegin(initialState); + } + + /** + * Refills the input buffer. + * + * @return false, iff there was new input. + * + * @exception java.io.IOException if any I/O-Error occurs + */ + private boolean zzRefill() throws java.io.IOException { + return true; + } + + + /** + * Returns the current lexical state. + */ + public final int yystate() { + return zzLexicalState; + } + + + /** + * Enters a new lexical state + * + * @param newState the new lexical state + */ + public final void yybegin(int newState) { + zzLexicalState = newState; + } + + + /** + * Returns the text matched by the current regular expression. + */ + public final CharSequence yytext() { + return zzBuffer.subSequence(zzStartRead, zzMarkedPos); + } + + + /** + * Returns the character at position pos from the + * matched text. + * + * It is equivalent to yytext().charAt(pos), but faster + * + * @param pos the position of the character to fetch. + * A value from 0 to yylength()-1. + * + * @return the character at position pos + */ + public final char yycharat(int pos) { + return zzBuffer.charAt(zzStartRead+pos); + } + + + /** + * Returns the length of the matched text region. + */ + public final int yylength() { + return zzMarkedPos-zzStartRead; + } + + + /** + * Reports an error that occured while scanning. + * + * In a wellformed scanner (no or only correct usage of + * yypushback(int) and a match-all fallback rule) this method + * will only be called with things that "Can't Possibly Happen". + * If this method is called, something is seriously wrong + * (e.g. a JFlex bug producing a faulty scanner etc.). + * + * Usual syntax/scanner level error handling should be done + * in error fallback rules. + * + * @param errorCode the code of the errormessage to display + */ + private void zzScanError(int errorCode) { + String message; + try { + message = ZZ_ERROR_MSG[errorCode]; + } + catch (ArrayIndexOutOfBoundsException e) { + message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; + } + + throw new Error(message); + } + + + /** + * Pushes the specified amount of characters back into the input stream. + * + * They will be read again by then next call of the scanning method + * + * @param number the number of characters to be read again. + * This number must not be greater than yylength()! + */ + public void yypushback(int number) { + if ( number > yylength() ) + zzScanError(ZZ_PUSHBACK_2BIG); + + zzMarkedPos -= number; + } + + + /** + * Contains user EOF-code, which will be executed exactly once, + * when the end of file is reached + */ + private void zzDoEOF() { + if (!zzEOFDone) { + zzEOFDone = true; + return; + + } + } + + + /** + * Resumes scanning until the next regular expression is matched, + * the end of input is encountered or an I/O-Error occurs. + * + * @return the next token + * @exception java.io.IOException if any I/O-Error occurs + */ + public IElementType advance() throws java.io.IOException { + int zzInput; + int zzAction; + + // cached fields: + int zzCurrentPosL; + int zzMarkedPosL; + int zzEndReadL = zzEndRead; + CharSequence zzBufferL = zzBuffer; + + int [] zzTransL = ZZ_TRANS; + int [] zzRowMapL = ZZ_ROWMAP; + int [] zzAttrL = ZZ_ATTRIBUTE; + + while (true) { + zzMarkedPosL = zzMarkedPos; + + zzAction = -1; + + zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; + + zzState = ZZ_LEXSTATE[zzLexicalState]; + + // set up zzAction for empty match case: + int zzAttributes = zzAttrL[zzState]; + if ( (zzAttributes & 1) == 1 ) { + zzAction = zzState; + } + + + zzForAction: { + while (true) { + + if (zzCurrentPosL < zzEndReadL) { + zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL/*, zzEndReadL*/); + zzCurrentPosL += Character.charCount(zzInput); + } + else if (zzAtEOF) { + zzInput = YYEOF; + break zzForAction; + } + else { + // store back cached positions + zzCurrentPos = zzCurrentPosL; + zzMarkedPos = zzMarkedPosL; + boolean eof = zzRefill(); + // get translated positions and possibly new buffer + zzCurrentPosL = zzCurrentPos; + zzMarkedPosL = zzMarkedPos; + zzBufferL = zzBuffer; + zzEndReadL = zzEndRead; + if (eof) { + zzInput = YYEOF; + break zzForAction; + } + else { + zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL/*, zzEndReadL*/); + zzCurrentPosL += Character.charCount(zzInput); + } + } + int zzNext = zzTransL[ zzRowMapL[zzState] + ZZ_CMAP(zzInput) ]; + if (zzNext == -1) break zzForAction; + zzState = zzNext; + + zzAttributes = zzAttrL[zzState]; + if ( (zzAttributes & 1) == 1 ) { + zzAction = zzState; + zzMarkedPosL = zzCurrentPosL; + if ( (zzAttributes & 8) == 8 ) break zzForAction; + } + + } + } + + // store back cached position + zzMarkedPos = zzMarkedPosL; + + if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { + zzAtEOF = true; + zzDoEOF(); + return null; + } + else { + switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { + case 1: + { return TokenType.BAD_CHARACTER; + } + // fall through + case 103: break; + case 2: + { return IDENTIFIER; + } + // fall through + case 104: break; + case 3: + { return WHITE_SPACE; + } + // fall through + case 105: break; + case 4: + { return STRING; + } + // fall through + case 106: break; + case 5: + { return NUMBER; + } + // fall through + case 107: break; + case 6: + { return COMMA; + } + // fall through + case 108: break; + case 7: + { return DOT; + } + // fall through + case 109: break; + case 8: + { return COLON; + } + // fall through + case 110: break; + case 9: + { return SEMICOLON; + } + // fall through + case 111: break; + case 10: + { return LEFT_PAREN; + } + // fall through + case 112: break; + case 11: + { return RIGHT_PAREN; + } + // fall through + case 113: break; + case 12: + { return ASTERISK; + } + // fall through + case 114: break; + case 13: + { return RIGHT_BRACKET; + } + // fall through + case 115: break; + case 14: + { return LEFT_BRACE; + } + // fall through + case 116: break; + case 15: + { return RIGHT_BRACE; + } + // fall through + case 117: break; + case 16: + { return COLUMN_REFERENCE_IDENTIFIER; + } + // fall through + case 118: break; + case 17: + { yybegin(COLUMN_IDENTIFIER); pushState(SELECT_EXP); return LEFT_BRACE; + } + // fall through + case 119: break; + case 18: + { return EQUALS_OPERATOR; + } + // fall through + case 120: break; + case 19: + { return QUESTION_MARK; + } + // fall through + case 121: break; + case 20: + { return EXCLAMATION_MARK; + } + // fall through + case 122: break; + case 21: + { yybegin(TABLE_IDENTIFIER); pushState(FROM_EXP); return LEFT_BRACE; + } + // fall through + case 123: break; + case 22: + { yybegin(popState()); return TABLE_NAME_IDENTIFIER; + } + // fall through + case 124: break; + case 23: + { yybegin(popState()); return COMMA; + } + // fall through + case 125: break; + case 24: + { yybegin(popState()); return RIGHT_BRACE; + } + // fall through + case 126: break; + case 25: + { yybegin(popState()); return COLUMN_REFERENCE_IDENTIFIER; + } + // fall through + case 127: break; + case 26: + { yybegin(popState()); return RIGHT_PAREN; + } + // fall through + case 128: break; + case 27: + { yybegin(popState()); return EQUALS_OPERATOR; + } + // fall through + case 129: break; + case 28: + { yybegin(popState()); return PARAMETER_IDENTIFIER; + } + // fall through + case 130: break; + case 29: + { return LEFT_BRACKET; + } + // fall through + case 131: break; + case 30: + { yybegin(COLUMN_IDENTIFIER); return RIGHT_BRACKET; + } + // fall through + case 132: break; + case 31: + { return LESS_THAN_OPERATOR; + } + // fall through + case 133: break; + case 32: + { return GREATER_THAN_OPERATOR; + } + // fall through + case 134: break; + case 33: + { yybegin(PARAMETER_EXP); pushState(WHERE_EXP); return QUESTION_MARK; + } + // fall through + case 135: break; + case 34: + { yybegin(COLUMN_IDENTIFIER); pushState(WHERE_EXP); return LEFT_BRACE; + } + // fall through + case 136: break; + case 35: + { yybegin(PARAMETER_EXP); pushState(FROM_EXP); return QUESTION_MARK; + } + // fall through + case 137: break; + case 36: + { yybegin(COLUMN_IDENTIFIER); return LEFT_BRACE; + } + // fall through + case 138: break; + case 37: + { yybegin(popState()); return IDENTIFIER; + } + // fall through + case 139: break; + case 38: + { return COMMENT; + } + // fall through + case 140: break; + case 39: + { return LEFT_DOUBLE_BRACE; + } + // fall through + case 141: break; + case 40: + { return RIGHT_DOUBLE_BRACE; + } + // fall through + case 142: break; + case 41: + { yybegin(CORRELATION_NAME);return AS; + } + // fall through + case 143: break; + case 42: + { return IS; + } + // fall through + case 144: break; + case 43: + { return IN; + } + // fall through + case 145: break; + case 44: + { yybegin(ON_EXP); pushState(FROM_EXP); return ON; + } + // fall through + case 146: break; + case 45: + { return OR; + } + // fall through + case 147: break; + case 46: + { return BY; + } + // fall through + case 148: break; + case 47: + { yypushback(yylength()); yybegin(COLUMN_IDENTIFIER); pushState(SELECT_EXP); + } + // fall through + case 149: break; + case 48: + { yybegin(CORRELATION_NAME); pushState(SELECT_EXP); return AS; + } + // fall through + case 150: break; + case 49: + { yybegin(SUB_QUERY); pushState(FROM_EXP); return LEFT_DOUBLE_BRACE; + } + // fall through + case 151: break; + case 50: + { yybegin(CORRELATION_NAME); pushState(FROM_EXP); return AS; + } + // fall through + case 152: break; + case 51: + { yypushback(1); yybegin(COLUMN_IDENTIFIER); return TABLE_NAME_IDENTIFIER; + } + // fall through + case 153: break; + case 52: + { yybegin(CORRELATION_NAME); pushState(TABLE_IDENTIFIER); return AS; + } + // fall through + case 154: break; + case 53: + { yypushback(yylength()); yybegin(TABLE_IDENTIFIER); + } + // fall through + case 155: break; + case 54: + { yypushback(1); yybegin(LOCALIZATION); return COLUMN_REFERENCE_IDENTIFIER; + } + // fall through + case 156: break; + case 55: + { yybegin(CORRELATION_NAME); pushState(COLUMN_IDENTIFIER); return AS; + } + // fall through + case 157: break; + case 56: + { yypushback(yylength()); yybegin(COLUMN_IDENTIFIER); pushState(WHERE_EXP); + } + // fall through + case 158: break; + case 57: + { return LESS_THAN_OR_EQUALS_OPERATOR; + } + // fall through + case 159: break; + case 58: + { return NOT_EQUALS_OPERATOR; + } + // fall through + case 160: break; + case 59: + { return GREATER_THAN_OR_EQUALS_OPERATOR; + } + // fall through + case 161: break; + case 60: + { yybegin(popState()); return RIGHT_DOUBLE_BRACE; + } + // fall through + case 162: break; + case 61: + { return AS; + } + // fall through + case 163: break; + case 62: + { yybegin(FROM_EXP); return RIGHT_DOUBLE_BRACE; + } + // fall through + case 164: break; + case 63: + { return SUM; + } + // fall through + case 165: break; + case 64: + { return ASC; + } + // fall through + case 166: break; + case 65: + { return ALL; + } + // fall through + case 167: break; + case 66: + { return AND; + } + // fall through + case 168: break; + case 67: + { return ANY; + } + // fall through + case 169: break; + case 68: + { return AVG; + } + // fall through + case 170: break; + case 69: + { return NOT; + } + // fall through + case 171: break; + case 70: + { return MAX; + } + // fall through + case 172: break; + case 71: + { return MIN; + } + // fall through + case 173: break; + case 72: + { return SOME; + } + // fall through + case 174: break; + case 73: + { return LAST; + } + // fall through + case 175: break; + case 74: + { return LIKE; + } + // fall through + case 176: break; + case 75: + { return TRUE; + } + // fall through + case 177: break; + case 76: + { return DESC; + } + // fall through + case 178: break; + case 77: + { return NULL; + } + // fall through + case 179: break; + case 78: + { yybegin(FROM_EXP); return FROM; + } + // fall through + case 180: break; + case 79: + { yybegin(popState()); return LEFT; + } + // fall through + case 181: break; + case 80: + { yybegin(FROM_EXP); pushState(SELECT_EXP); return FROM; + } + // fall through + case 182: break; + case 81: + { return LEFT; + } + // fall through + case 183: break; + case 82: + { yybegin(TABLE_IDENTIFIER); pushState(FROM_EXP); return JOIN; + } + // fall through + case 184: break; + case 83: + { yybegin(FROM_EXP); return LEFT; + } + // fall through + case 185: break; + case 84: + { yybegin(FROM_EXP); pushState(WHERE_EXP); return LEFT; + } + // fall through + case 186: break; + case 85: + { return EVERY; + } + // fall through + case 187: break; + case 86: + { return COUNT; + } + // fall through + case 188: break; + case 87: + { return ORDER; + } + // fall through + case 189: break; + case 88: + { return UNION; + } + // fall through + case 190: break; + case 89: + { return GROUP; + } + // fall through + case 191: break; + case 90: + { return FALSE; + } + // fall through + case 192: break; + case 91: + { return FIRST; + } + // fall through + case 193: break; + case 92: + { yybegin(WHERE_EXP); return WHERE; + } + // fall through + case 194: break; + case 93: + { yybegin(WHERE_EXP); pushState(FROM_EXP); return WHERE; + } + // fall through + case 195: break; + case 94: + { yybegin(SELECT_EXP); pushState(YYINITIAL); return SELECT; + } + // fall through + case 196: break; + case 95: + { return EXISTS; + } + // fall through + case 197: break; + case 96: + { return CONCAT; + } + // fall through + case 198: break; + case 97: + { return SELECT; + } + // fall through + case 199: break; + case 98: + { yybegin(SELECT_EXP); pushState(FROM_EXP); return SELECT; + } + // fall through + case 200: break; + case 99: + { yybegin(SELECT_EXP); pushState(WHERE_EXP); return SELECT; + } + // fall through + case 201: break; + case 100: + { yybegin(SELECT_EXP); pushState(SUB_QUERY); return SELECT; + } + // fall through + case 202: break; + case 101: + { return BETWEEN; + } + // fall through + case 203: break; + case 102: + { return DISTINCT; + } + // fall through + case 204: break; + default: + zzScanError(ZZ_NO_MATCH); + } + } + } + } + + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchLexerAdapter.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchLexerAdapter.java new file mode 100644 index 000000000..6df227aa8 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchLexerAdapter.java @@ -0,0 +1,30 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch; + +import com.intellij.lexer.FlexAdapter; + +import java.io.Reader; + +public class FlexibleSearchLexerAdapter extends FlexAdapter { + + public FlexibleSearchLexerAdapter() { + super(new FlexibleSearchLexer((Reader) null)); + } +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchParser.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchParser.java new file mode 100644 index 000000000..cbc6ed9c8 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchParser.java @@ -0,0 +1,2330 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch; + +import com.intellij.lang.PsiBuilder; +import com.intellij.lang.PsiBuilder.Marker; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import static com.intellij.idea.plugin.hybris.flexibleSearch.utils.FlexibleSearchParserUtils.*; +import com.intellij.psi.tree.IElementType; +import com.intellij.lang.ASTNode; +import com.intellij.psi.tree.TokenSet; +import com.intellij.lang.PsiParser; +import com.intellij.lang.LightPsiParser; + +@SuppressWarnings({"SimplifiableIfStatement", "UnusedAssignment"}) +public class FlexibleSearchParser implements PsiParser, LightPsiParser { + + public ASTNode parse(IElementType t, PsiBuilder b) { + parseLight(t, b); + return b.getTreeBuilt(); + } + + public void parseLight(IElementType t, PsiBuilder b) { + boolean r; + b = adapt_builder_(t, b, this, null); + Marker m = enter_section_(b, 0, _COLLAPSE_, null); + if (t == AGGREGATE_FUNCTION) { + r = aggregate_function(b, 0); + } + else if (t == BETWEEN_PREDICATE) { + r = between_predicate(b, 0); + } + else if (t == BOOLEAN_FACTOR) { + r = boolean_factor(b, 0); + } + else if (t == BOOLEAN_PREDICAND) { + r = boolean_predicand(b, 0); + } + else if (t == BOOLEAN_PRIMARY) { + r = boolean_primary(b, 0); + } + else if (t == BOOLEAN_TERM) { + r = boolean_term(b, 0); + } + else if (t == BOOLEAN_TEST) { + r = boolean_test(b, 0); + } + else if (t == BOOLEAN_VALUE_EXPRESSION) { + r = boolean_value_expression(b, 0); + } + else if (t == CHARACTER_LIKE_PREDICATE) { + r = character_like_predicate(b, 0); + } + else if (t == CHARACTER_PATTERN) { + r = character_pattern(b, 0); + } + else if (t == CHARACTER_STRING_LITERAL) { + r = character_string_literal(b, 0); + } + else if (t == CHARACTER_SUBSTRING_FUNCTION) { + r = character_substring_function(b, 0); + } + else if (t == CHARACTER_VALUE_FUNCTION) { + r = character_value_function(b, 0); + } + else if (t == COLUMN_LOCALIZATION) { + r = column_localization(b, 0); + } + else if (t == COLUMN_REFERENCE) { + r = column_reference(b, 0); + } + else if (t == COMMON_VALUE_EXPRESSION) { + r = common_value_expression(b, 0); + } + else if (t == COMP_OP) { + r = comp_op(b, 0); + } + else if (t == CORRELATION_NAME) { + r = correlation_name(b, 0); + } + else if (t == DERIVED_COLUMN) { + r = derived_column(b, 0); + } + else if (t == EXISTS_PREDICATE) { + r = exists_predicate(b, 0); + } + else if (t == FROM_CLAUSE) { + r = from_clause(b, 0); + } + else if (t == GENERAL_LITERAL) { + r = general_literal(b, 0); + } + else if (t == GENERAL_SET_FUNCTION) { + r = general_set_function(b, 0); + } + else if (t == GROUP_BY_CLAUSE) { + r = group_by_clause(b, 0); + } + else if (t == GROUPING_COLUMN_REFERENCE) { + r = grouping_column_reference(b, 0); + } + else if (t == GROUPING_COLUMN_REFERENCE_LIST) { + r = grouping_column_reference_list(b, 0); + } + else if (t == GROUPING_ELEMENT) { + r = grouping_element(b, 0); + } + else if (t == GROUPING_ELEMENT_LIST) { + r = grouping_element_list(b, 0); + } + else if (t == IN_PREDICATE) { + r = in_predicate(b, 0); + } + else if (t == JOIN_CONDITION) { + r = join_condition(b, 0); + } + else if (t == JOIN_SPECIFICATION) { + r = join_specification(b, 0); + } + else if (t == JOIN_TYPE) { + r = join_type(b, 0); + } + else if (t == JOINED_TABLE) { + r = joined_table(b, 0); + } + else if (t == LIKE_PREDICATE) { + r = like_predicate(b, 0); + } + else if (t == NULL_ORDERING) { + r = null_ordering(b, 0); + } + else if (t == NULL_PREDICATE) { + r = null_predicate(b, 0); + } + else if (t == ORDER_BY_CLAUSE) { + r = order_by_clause(b, 0); + } + else if (t == ORDERING_SPECIFICATION) { + r = ordering_specification(b, 0); + } + else if (t == ORDINARY_GROUPING_SET) { + r = ordinary_grouping_set(b, 0); + } + else if (t == PARAMETER_REFERENCE) { + r = parameter_reference(b, 0); + } + else if (t == PREDICATE) { + r = predicate(b, 0); + } + else if (t == QUERY_SPECIFICATION) { + r = query_specification(b, 0); + } + else if (t == ROW_VALUE_PREDICAND) { + r = row_value_predicand(b, 0); + } + else if (t == SEARCH_CONDITION) { + r = search_condition(b, 0); + } + else if (t == SELECT_LIST) { + r = select_list(b, 0); + } + else if (t == SELECT_SUBLIST) { + r = select_sublist(b, 0); + } + else if (t == SET_FUNCTION_TYPE) { + r = set_function_type(b, 0); + } + else if (t == SET_QUANTIFIER) { + r = set_quantifier(b, 0); + } + else if (t == SORT_KEY) { + r = sort_key(b, 0); + } + else if (t == SORT_SPECIFICATION) { + r = sort_specification(b, 0); + } + else if (t == SORT_SPECIFICATION_LIST) { + r = sort_specification_list(b, 0); + } + else if (t == STRING_VALUE_EXPRESSION) { + r = string_value_expression(b, 0); + } + else if (t == STRING_VALUE_FUNCTION) { + r = string_value_function(b, 0); + } + else if (t == SUBQUERY) { + r = subquery(b, 0); + } + else if (t == TABLE_EXPRESSION) { + r = table_expression(b, 0); + } + else if (t == TABLE_NAME) { + r = table_name(b, 0); + } + else if (t == TABLE_PRIMARY) { + r = table_primary(b, 0); + } + else if (t == TABLE_REFERENCE) { + r = table_reference(b, 0); + } + else if (t == TABLE_REFERENCE_LIST) { + r = table_reference_list(b, 0); + } + else if (t == TABLE_SUBQUERY) { + r = table_subquery(b, 0); + } + else if (t == TRUTH_VALUE) { + r = truth_value(b, 0); + } + else if (t == VALUE_EXPRESSION) { + r = value_expression(b, 0); + } + else if (t == WHERE_CLAUSE) { + r = where_clause(b, 0); + } + else { + r = parse_root_(t, b, 0); + } + exit_section_(b, 0, m, t, r, true, TRUE_CONDITION); + } + + protected boolean parse_root_(IElementType t, PsiBuilder b, int l) { + return flexibleSearchFile(b, l + 1); + } + + /* ********************************************************** */ + // COUNT LEFT_PAREN ASTERISK RIGHT_PAREN + // | general_set_function + public static boolean aggregate_function(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "aggregate_function")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, AGGREGATE_FUNCTION, ""); + r = parseTokens(b, 0, COUNT, LEFT_PAREN, ASTERISK, RIGHT_PAREN); + if (!r) r = general_set_function(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // row_value_predicand [ NOT ] BETWEEN row_value_predicand AND row_value_predicand + public static boolean between_predicate(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "between_predicate")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, BETWEEN_PREDICATE, ""); + r = row_value_predicand(b, l + 1); + r = r && between_predicate_1(b, l + 1); + r = r && consumeToken(b, BETWEEN); + r = r && row_value_predicand(b, l + 1); + r = r && consumeToken(b, AND); + r = r && row_value_predicand(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // [ NOT ] + private static boolean between_predicate_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "between_predicate_1")) return false; + consumeToken(b, NOT); + return true; + } + + /* ********************************************************** */ + // [ NOT ] boolean_test + public static boolean boolean_factor(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "boolean_factor")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, BOOLEAN_FACTOR, ""); + r = boolean_factor_0(b, l + 1); + r = r && boolean_test(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // [ NOT ] + private static boolean boolean_factor_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "boolean_factor_0")) return false; + consumeToken(b, NOT); + return true; + } + + /* ********************************************************** */ + // parenthesized_boolean_value_expression | nonparenthesized_value_expression_primary + public static boolean boolean_predicand(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "boolean_predicand")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, BOOLEAN_PREDICAND, ""); + r = parenthesized_boolean_value_expression(b, l + 1); + if (!r) r = nonparenthesized_value_expression_primary(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // boolean_predicand | predicate + public static boolean boolean_primary(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "boolean_primary")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, BOOLEAN_PRIMARY, ""); + r = boolean_predicand(b, l + 1); + if (!r) r = predicate(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // boolean_factor [([AND|OR] boolean_term)*] + public static boolean boolean_term(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "boolean_term")) return false; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, BOOLEAN_TERM, ""); + r = boolean_factor(b, l + 1); + p = r; // pin = 1 + r = r && boolean_term_1(b, l + 1); + exit_section_(b, l, m, r, p, null); + return r || p; + } + + // [([AND|OR] boolean_term)*] + private static boolean boolean_term_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "boolean_term_1")) return false; + boolean_term_1_0(b, l + 1); + return true; + } + + // ([AND|OR] boolean_term)* + private static boolean boolean_term_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "boolean_term_1_0")) return false; + while (true) { + int c = current_position_(b); + if (!boolean_term_1_0_0(b, l + 1)) break; + if (!empty_element_parsed_guard_(b, "boolean_term_1_0", c)) break; + } + return true; + } + + // [AND|OR] boolean_term + private static boolean boolean_term_1_0_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "boolean_term_1_0_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = boolean_term_1_0_0_0(b, l + 1); + r = r && boolean_term(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // [AND|OR] + private static boolean boolean_term_1_0_0_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "boolean_term_1_0_0_0")) return false; + boolean_term_1_0_0_0_0(b, l + 1); + return true; + } + + // AND|OR + private static boolean boolean_term_1_0_0_0_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "boolean_term_1_0_0_0_0")) return false; + boolean r; + r = consumeToken(b, AND); + if (!r) r = consumeToken(b, OR); + return r; + } + + /* ********************************************************** */ + // !(JOIN) + static boolean boolean_term_recover(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "boolean_term_recover")) return false; + boolean r; + Marker m = enter_section_(b, l, _NOT_); + r = !consumeToken(b, JOIN); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // boolean_primary [ IS [ NOT ] truth_value ] + public static boolean boolean_test(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "boolean_test")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, BOOLEAN_TEST, ""); + r = boolean_primary(b, l + 1); + r = r && boolean_test_1(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // [ IS [ NOT ] truth_value ] + private static boolean boolean_test_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "boolean_test_1")) return false; + boolean_test_1_0(b, l + 1); + return true; + } + + // IS [ NOT ] truth_value + private static boolean boolean_test_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "boolean_test_1_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, IS); + r = r && boolean_test_1_0_1(b, l + 1); + r = r && truth_value(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // [ NOT ] + private static boolean boolean_test_1_0_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "boolean_test_1_0_1")) return false; + consumeToken(b, NOT); + return true; + } + + /* ********************************************************** */ + // boolean_term + public static boolean boolean_value_expression(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "boolean_value_expression")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, BOOLEAN_VALUE_EXPRESSION, ""); + r = boolean_term(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // row_value_predicand [ NOT ] LIKE (character_pattern | value_expression) + public static boolean character_like_predicate(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "character_like_predicate")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, CHARACTER_LIKE_PREDICATE, ""); + r = row_value_predicand(b, l + 1); + r = r && character_like_predicate_1(b, l + 1); + r = r && consumeToken(b, LIKE); + r = r && character_like_predicate_3(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // [ NOT ] + private static boolean character_like_predicate_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "character_like_predicate_1")) return false; + consumeToken(b, NOT); + return true; + } + + // character_pattern | value_expression + private static boolean character_like_predicate_3(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "character_like_predicate_3")) return false; + boolean r; + r = character_pattern(b, l + 1); + if (!r) r = value_expression(b, l + 1); + return r; + } + + /* ********************************************************** */ + // STRING | string_value_function + public static boolean character_pattern(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "character_pattern")) return false; + if (!nextTokenIs(b, "", CONCAT, STRING)) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, CHARACTER_PATTERN, ""); + r = consumeToken(b, STRING); + if (!r) r = string_value_function(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // STRING + public static boolean character_string_literal(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "character_string_literal")) return false; + if (!nextTokenIs(b, STRING)) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, STRING); + exit_section_(b, m, CHARACTER_STRING_LITERAL, r); + return r; + } + + /* ********************************************************** */ + // CONCAT LEFT_PAREN string_value_expression COMMA (character_substring_function | string_value_expression) RIGHT_PAREN + public static boolean character_substring_function(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "character_substring_function")) return false; + if (!nextTokenIs(b, CONCAT)) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeTokens(b, 0, CONCAT, LEFT_PAREN); + r = r && string_value_expression(b, l + 1); + r = r && consumeToken(b, COMMA); + r = r && character_substring_function_4(b, l + 1); + r = r && consumeToken(b, RIGHT_PAREN); + exit_section_(b, m, CHARACTER_SUBSTRING_FUNCTION, r); + return r; + } + + // character_substring_function | string_value_expression + private static boolean character_substring_function_4(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "character_substring_function_4")) return false; + boolean r; + r = character_substring_function(b, l + 1); + if (!r) r = string_value_expression(b, l + 1); + return r; + } + + /* ********************************************************** */ + // character_substring_function + public static boolean character_value_function(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "character_value_function")) return false; + if (!nextTokenIs(b, CONCAT)) return false; + boolean r; + Marker m = enter_section_(b); + r = character_substring_function(b, l + 1); + exit_section_(b, m, CHARACTER_VALUE_FUNCTION, r); + return r; + } + + /* ********************************************************** */ + // LEFT_BRACKET IDENTIFIER RIGHT_BRACKET + public static boolean column_localization(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "column_localization")) return false; + if (!nextTokenIs(b, LEFT_BRACKET)) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeTokens(b, 0, LEFT_BRACKET, IDENTIFIER, RIGHT_BRACKET); + exit_section_(b, m, COLUMN_LOCALIZATION, r); + return r; + } + + /* ********************************************************** */ + // identifier_chain + public static boolean column_reference(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "column_reference")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, COLUMN_REFERENCE, ""); + r = identifier_chain(b, l + 1); + exit_section_(b, l, m, r, false, column_reference_recover_parser_); + return r; + } + + /* ********************************************************** */ + // !(<> | IDENTIFIER | LINE_TERMINATOR | RIGHT_BRACE | FROM | LEFT_BRACKET | SEMICOLON | WHITE_SPACE | AND | ORDER | IS | OR | COMMA | RIGHT_PAREN | IN | RIGHT_DOUBLE_BRACE | comp_op) + static boolean column_reference_recover(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "column_reference_recover")) return false; + boolean r; + Marker m = enter_section_(b, l, _NOT_); + r = !column_reference_recover_0(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // <> | IDENTIFIER | LINE_TERMINATOR | RIGHT_BRACE | FROM | LEFT_BRACKET | SEMICOLON | WHITE_SPACE | AND | ORDER | IS | OR | COMMA | RIGHT_PAREN | IN | RIGHT_DOUBLE_BRACE | comp_op + private static boolean column_reference_recover_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "column_reference_recover_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = eof(b, l + 1); + if (!r) r = consumeToken(b, IDENTIFIER); + if (!r) r = consumeToken(b, LINE_TERMINATOR); + if (!r) r = consumeToken(b, RIGHT_BRACE); + if (!r) r = consumeToken(b, FROM); + if (!r) r = consumeToken(b, LEFT_BRACKET); + if (!r) r = consumeToken(b, SEMICOLON); + if (!r) r = consumeToken(b, WHITE_SPACE); + if (!r) r = consumeToken(b, AND); + if (!r) r = consumeToken(b, ORDER); + if (!r) r = consumeToken(b, IS); + if (!r) r = consumeToken(b, OR); + if (!r) r = consumeToken(b, COMMA); + if (!r) r = consumeToken(b, RIGHT_PAREN); + if (!r) r = consumeToken(b, IN); + if (!r) r = consumeToken(b, RIGHT_DOUBLE_BRACE); + if (!r) r = comp_op(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + /* ********************************************************** */ + // LEFT_BRACE? column_reference column_localization? RIGHT_BRACE? + static boolean column_reference_value(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "column_reference_value")) return false; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_); + r = column_reference_value_0(b, l + 1); + r = r && column_reference(b, l + 1); + p = r; // pin = 2 + r = r && report_error_(b, column_reference_value_2(b, l + 1)); + r = p && column_reference_value_3(b, l + 1) && r; + exit_section_(b, l, m, r, p, null); + return r || p; + } + + // LEFT_BRACE? + private static boolean column_reference_value_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "column_reference_value_0")) return false; + consumeToken(b, LEFT_BRACE); + return true; + } + + // column_localization? + private static boolean column_reference_value_2(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "column_reference_value_2")) return false; + column_localization(b, l + 1); + return true; + } + + // RIGHT_BRACE? + private static boolean column_reference_value_3(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "column_reference_value_3")) return false; + consumeToken(b, RIGHT_BRACE); + return true; + } + + /* ********************************************************** */ + // string_value_expression | NUMBER + public static boolean common_value_expression(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "common_value_expression")) return false; + if (!nextTokenIs(b, "", NUMBER, STRING)) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, COMMON_VALUE_EXPRESSION, ""); + r = string_value_expression(b, l + 1); + if (!r) r = consumeToken(b, NUMBER); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // EQUALS_OPERATOR + // | GREATER_THAN_OPERATOR + // | NOT_EQUALS_OPERATOR + // | LESS_THAN_OPERATOR + // | LESS_THAN_OR_EQUALS_OPERATOR + // | GREATER_THAN_OR_EQUALS_OPERATOR + public static boolean comp_op(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "comp_op")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, COMP_OP, ""); + r = consumeToken(b, EQUALS_OPERATOR); + if (!r) r = consumeToken(b, GREATER_THAN_OPERATOR); + if (!r) r = consumeToken(b, NOT_EQUALS_OPERATOR); + if (!r) r = consumeToken(b, LESS_THAN_OPERATOR); + if (!r) r = consumeToken(b, LESS_THAN_OR_EQUALS_OPERATOR); + if (!r) r = consumeToken(b, GREATER_THAN_OR_EQUALS_OPERATOR); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // row_value_predicand? comp_op row_value_predicand + static boolean comparison_predicate(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "comparison_predicate")) return false; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_); + r = comparison_predicate_0(b, l + 1); + r = r && comp_op(b, l + 1); + p = r; // pin = 2 + r = r && row_value_predicand(b, l + 1); + exit_section_(b, l, m, r, p, null); + return r || p; + } + + // row_value_predicand? + private static boolean comparison_predicate_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "comparison_predicate_0")) return false; + row_value_predicand(b, l + 1); + return true; + } + + /* ********************************************************** */ + // AVG | MAX | MIN | SUM + // | EVERY | ANY | SOME + // | COUNT + static boolean computational_operation(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "computational_operation")) return false; + boolean r; + r = consumeToken(b, AVG); + if (!r) r = consumeToken(b, MAX); + if (!r) r = consumeToken(b, MIN); + if (!r) r = consumeToken(b, SUM); + if (!r) r = consumeToken(b, EVERY); + if (!r) r = consumeToken(b, ANY); + if (!r) r = consumeToken(b, SOME); + if (!r) r = consumeToken(b, COUNT); + return r; + } + + /* ********************************************************** */ + // IDENTIFIER + public static boolean correlation_name(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "correlation_name")) return false; + if (!nextTokenIs(b, IDENTIFIER)) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, IDENTIFIER); + exit_section_(b, m, CORRELATION_NAME, r); + return r; + } + + /* ********************************************************** */ + // value_expression [ AS correlation_name ] + public static boolean derived_column(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "derived_column")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, DERIVED_COLUMN, ""); + r = value_expression(b, l + 1); + r = r && derived_column_1(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // [ AS correlation_name ] + private static boolean derived_column_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "derived_column_1")) return false; + derived_column_1_0(b, l + 1); + return true; + } + + // AS correlation_name + private static boolean derived_column_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "derived_column_1_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, AS); + r = r && correlation_name(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + /* ********************************************************** */ + // SEMICOLON | <> + static boolean empty_statement(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "empty_statement")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, SEMICOLON); + if (!r) r = eof(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + /* ********************************************************** */ + // EXISTS table_subquery + public static boolean exists_predicate(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "exists_predicate")) return false; + if (!nextTokenIs(b, EXISTS)) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, EXISTS); + r = r && table_subquery(b, l + 1); + exit_section_(b, m, EXISTS_PREDICATE, r); + return r; + } + + /* ********************************************************** */ + // !(SEMICOLON | <> ) + static boolean expressionRecoverWhile(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "expressionRecoverWhile")) return false; + boolean r; + Marker m = enter_section_(b, l, _NOT_); + r = !expressionRecoverWhile_0(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // SEMICOLON | <> + private static boolean expressionRecoverWhile_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "expressionRecoverWhile_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, SEMICOLON); + if (!r) r = eof(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + /* ********************************************************** */ + // ( statement )? ( ';' ( statement )? )* + static boolean flexibleSearchFile(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "flexibleSearchFile")) return false; + boolean r; + Marker m = enter_section_(b); + r = flexibleSearchFile_0(b, l + 1); + r = r && flexibleSearchFile_1(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // ( statement )? + private static boolean flexibleSearchFile_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "flexibleSearchFile_0")) return false; + flexibleSearchFile_0_0(b, l + 1); + return true; + } + + // ( statement ) + private static boolean flexibleSearchFile_0_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "flexibleSearchFile_0_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = statement(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // ( ';' ( statement )? )* + private static boolean flexibleSearchFile_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "flexibleSearchFile_1")) return false; + while (true) { + int c = current_position_(b); + if (!flexibleSearchFile_1_0(b, l + 1)) break; + if (!empty_element_parsed_guard_(b, "flexibleSearchFile_1", c)) break; + } + return true; + } + + // ';' ( statement )? + private static boolean flexibleSearchFile_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "flexibleSearchFile_1_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, SEMICOLON); + r = r && flexibleSearchFile_1_0_1(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // ( statement )? + private static boolean flexibleSearchFile_1_0_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "flexibleSearchFile_1_0_1")) return false; + flexibleSearchFile_1_0_1_0(b, l + 1); + return true; + } + + // ( statement ) + private static boolean flexibleSearchFile_1_0_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "flexibleSearchFile_1_0_1_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = statement(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + /* ********************************************************** */ + // FROM LEFT_PAREN? (LEFT_BRACE table_reference_list RIGHT_BRACE | subquery ) RIGHT_PAREN? + public static boolean from_clause(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "from_clause")) return false; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, FROM_CLAUSE, ""); + r = consumeToken(b, FROM); + p = r; // pin = 1 + r = r && report_error_(b, from_clause_1(b, l + 1)); + r = p && report_error_(b, from_clause_2(b, l + 1)) && r; + r = p && from_clause_3(b, l + 1) && r; + exit_section_(b, l, m, r, p, from_clause_recover_parser_); + return r || p; + } + + // LEFT_PAREN? + private static boolean from_clause_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "from_clause_1")) return false; + consumeToken(b, LEFT_PAREN); + return true; + } + + // LEFT_BRACE table_reference_list RIGHT_BRACE | subquery + private static boolean from_clause_2(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "from_clause_2")) return false; + boolean r; + Marker m = enter_section_(b); + r = from_clause_2_0(b, l + 1); + if (!r) r = subquery(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // LEFT_BRACE table_reference_list RIGHT_BRACE + private static boolean from_clause_2_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "from_clause_2_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, LEFT_BRACE); + r = r && table_reference_list(b, l + 1); + r = r && consumeToken(b, RIGHT_BRACE); + exit_section_(b, m, null, r); + return r; + } + + // RIGHT_PAREN? + private static boolean from_clause_3(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "from_clause_3")) return false; + consumeToken(b, RIGHT_PAREN); + return true; + } + + /* ********************************************************** */ + // !(WHERE | SELECT | FROM | SEMICOLON ) + static boolean from_clause_recover(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "from_clause_recover")) return false; + boolean r; + Marker m = enter_section_(b, l, _NOT_); + r = !from_clause_recover_0(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // WHERE | SELECT | FROM | SEMICOLON + private static boolean from_clause_recover_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "from_clause_recover_0")) return false; + boolean r; + r = consumeToken(b, WHERE); + if (!r) r = consumeToken(b, SELECT); + if (!r) r = consumeToken(b, FROM); + if (!r) r = consumeToken(b, SEMICOLON); + return r; + } + + /* ********************************************************** */ + // character_string_literal + public static boolean general_literal(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "general_literal")) return false; + if (!nextTokenIs(b, STRING)) return false; + boolean r; + Marker m = enter_section_(b); + r = character_string_literal(b, l + 1); + exit_section_(b, m, GENERAL_LITERAL, r); + return r; + } + + /* ********************************************************** */ + // set_function_type LEFT_PAREN [ set_quantifier ] value_expression RIGHT_PAREN [ [ AS ] correlation_name ] + public static boolean general_set_function(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "general_set_function")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, GENERAL_SET_FUNCTION, ""); + r = set_function_type(b, l + 1); + r = r && consumeToken(b, LEFT_PAREN); + r = r && general_set_function_2(b, l + 1); + r = r && value_expression(b, l + 1); + r = r && consumeToken(b, RIGHT_PAREN); + r = r && general_set_function_5(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // [ set_quantifier ] + private static boolean general_set_function_2(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "general_set_function_2")) return false; + set_quantifier(b, l + 1); + return true; + } + + // [ [ AS ] correlation_name ] + private static boolean general_set_function_5(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "general_set_function_5")) return false; + general_set_function_5_0(b, l + 1); + return true; + } + + // [ AS ] correlation_name + private static boolean general_set_function_5_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "general_set_function_5_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = general_set_function_5_0_0(b, l + 1); + r = r && correlation_name(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // [ AS ] + private static boolean general_set_function_5_0_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "general_set_function_5_0_0")) return false; + consumeToken(b, AS); + return true; + } + + /* ********************************************************** */ + // GROUP BY [ set_quantifier ] grouping_element_list + public static boolean group_by_clause(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "group_by_clause")) return false; + if (!nextTokenIs(b, GROUP)) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeTokens(b, 0, GROUP, BY); + r = r && group_by_clause_2(b, l + 1); + r = r && grouping_element_list(b, l + 1); + exit_section_(b, m, GROUP_BY_CLAUSE, r); + return r; + } + + // [ set_quantifier ] + private static boolean group_by_clause_2(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "group_by_clause_2")) return false; + set_quantifier(b, l + 1); + return true; + } + + /* ********************************************************** */ + // value_expression + public static boolean grouping_column_reference(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "grouping_column_reference")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, GROUPING_COLUMN_REFERENCE, ""); + r = value_expression(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // grouping_column_reference [ { COMMA grouping_column_reference }* ] + public static boolean grouping_column_reference_list(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "grouping_column_reference_list")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, GROUPING_COLUMN_REFERENCE_LIST, ""); + r = grouping_column_reference(b, l + 1); + r = r && grouping_column_reference_list_1(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // [ { COMMA grouping_column_reference }* ] + private static boolean grouping_column_reference_list_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "grouping_column_reference_list_1")) return false; + grouping_column_reference_list_1_0(b, l + 1); + return true; + } + + // { COMMA grouping_column_reference }* + private static boolean grouping_column_reference_list_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "grouping_column_reference_list_1_0")) return false; + while (true) { + int c = current_position_(b); + if (!grouping_column_reference_list_1_0_0(b, l + 1)) break; + if (!empty_element_parsed_guard_(b, "grouping_column_reference_list_1_0", c)) break; + } + return true; + } + + // COMMA grouping_column_reference + private static boolean grouping_column_reference_list_1_0_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "grouping_column_reference_list_1_0_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, COMMA); + r = r && grouping_column_reference(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + /* ********************************************************** */ + // ordinary_grouping_set + public static boolean grouping_element(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "grouping_element")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, GROUPING_ELEMENT, ""); + r = ordinary_grouping_set(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // grouping_element [ { COMMA grouping_element }* ] + public static boolean grouping_element_list(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "grouping_element_list")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, GROUPING_ELEMENT_LIST, ""); + r = grouping_element(b, l + 1); + r = r && grouping_element_list_1(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // [ { COMMA grouping_element }* ] + private static boolean grouping_element_list_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "grouping_element_list_1")) return false; + grouping_element_list_1_0(b, l + 1); + return true; + } + + // { COMMA grouping_element }* + private static boolean grouping_element_list_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "grouping_element_list_1_0")) return false; + while (true) { + int c = current_position_(b); + if (!grouping_element_list_1_0_0(b, l + 1)) break; + if (!empty_element_parsed_guard_(b, "grouping_element_list_1_0", c)) break; + } + return true; + } + + // COMMA grouping_element + private static boolean grouping_element_list_1_0_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "grouping_element_list_1_0_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, COMMA); + r = r && grouping_element(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + /* ********************************************************** */ + // (IDENTIFIER | TABLE_NAME_IDENTIFIER | COLUMN_REFERENCE_IDENTIFIER) [ ( (DOT|COLON) (IDENTIFIER | COLUMN_REFERENCE_IDENTIFIER) )* ] + static boolean identifier_chain(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "identifier_chain")) return false; + boolean r; + Marker m = enter_section_(b); + r = identifier_chain_0(b, l + 1); + r = r && identifier_chain_1(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // IDENTIFIER | TABLE_NAME_IDENTIFIER | COLUMN_REFERENCE_IDENTIFIER + private static boolean identifier_chain_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "identifier_chain_0")) return false; + boolean r; + r = consumeToken(b, IDENTIFIER); + if (!r) r = consumeToken(b, TABLE_NAME_IDENTIFIER); + if (!r) r = consumeToken(b, COLUMN_REFERENCE_IDENTIFIER); + return r; + } + + // [ ( (DOT|COLON) (IDENTIFIER | COLUMN_REFERENCE_IDENTIFIER) )* ] + private static boolean identifier_chain_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "identifier_chain_1")) return false; + identifier_chain_1_0(b, l + 1); + return true; + } + + // ( (DOT|COLON) (IDENTIFIER | COLUMN_REFERENCE_IDENTIFIER) )* + private static boolean identifier_chain_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "identifier_chain_1_0")) return false; + while (true) { + int c = current_position_(b); + if (!identifier_chain_1_0_0(b, l + 1)) break; + if (!empty_element_parsed_guard_(b, "identifier_chain_1_0", c)) break; + } + return true; + } + + // (DOT|COLON) (IDENTIFIER | COLUMN_REFERENCE_IDENTIFIER) + private static boolean identifier_chain_1_0_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "identifier_chain_1_0_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = identifier_chain_1_0_0_0(b, l + 1); + r = r && identifier_chain_1_0_0_1(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // DOT|COLON + private static boolean identifier_chain_1_0_0_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "identifier_chain_1_0_0_0")) return false; + boolean r; + r = consumeToken(b, DOT); + if (!r) r = consumeToken(b, COLON); + return r; + } + + // IDENTIFIER | COLUMN_REFERENCE_IDENTIFIER + private static boolean identifier_chain_1_0_0_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "identifier_chain_1_0_0_1")) return false; + boolean r; + r = consumeToken(b, IDENTIFIER); + if (!r) r = consumeToken(b, COLUMN_REFERENCE_IDENTIFIER); + return r; + } + + /* ********************************************************** */ + // row_value_predicand IN (table_subquery | LEFT_PAREN? row_value_predicand RIGHT_PAREN?) + public static boolean in_predicate(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "in_predicate")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, IN_PREDICATE, ""); + r = row_value_predicand(b, l + 1); + r = r && consumeToken(b, IN); + r = r && in_predicate_2(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // table_subquery | LEFT_PAREN? row_value_predicand RIGHT_PAREN? + private static boolean in_predicate_2(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "in_predicate_2")) return false; + boolean r; + Marker m = enter_section_(b); + r = table_subquery(b, l + 1); + if (!r) r = in_predicate_2_1(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // LEFT_PAREN? row_value_predicand RIGHT_PAREN? + private static boolean in_predicate_2_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "in_predicate_2_1")) return false; + boolean r; + Marker m = enter_section_(b); + r = in_predicate_2_1_0(b, l + 1); + r = r && row_value_predicand(b, l + 1); + r = r && in_predicate_2_1_2(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // LEFT_PAREN? + private static boolean in_predicate_2_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "in_predicate_2_1_0")) return false; + consumeToken(b, LEFT_PAREN); + return true; + } + + // RIGHT_PAREN? + private static boolean in_predicate_2_1_2(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "in_predicate_2_1_2")) return false; + consumeToken(b, RIGHT_PAREN); + return true; + } + + /* ********************************************************** */ + // ON search_condition + public static boolean join_condition(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "join_condition")) return false; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, JOIN_CONDITION, ""); + r = consumeToken(b, ON); + p = r; // pin = 1 + r = r && search_condition(b, l + 1); + exit_section_(b, l, m, r, p, join_condition_recover_parser_); + return r || p; + } + + /* ********************************************************** */ + // !( RIGHT_BRACE | LEFT | JOIN ) + static boolean join_condition_recover(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "join_condition_recover")) return false; + boolean r; + Marker m = enter_section_(b, l, _NOT_); + r = !join_condition_recover_0(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // RIGHT_BRACE | LEFT | JOIN + private static boolean join_condition_recover_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "join_condition_recover_0")) return false; + boolean r; + r = consumeToken(b, RIGHT_BRACE); + if (!r) r = consumeToken(b, LEFT); + if (!r) r = consumeToken(b, JOIN); + return r; + } + + /* ********************************************************** */ + // join_condition + public static boolean join_specification(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "join_specification")) return false; + if (!nextTokenIs(b, ON)) return false; + boolean r; + Marker m = enter_section_(b); + r = join_condition(b, l + 1); + exit_section_(b, m, JOIN_SPECIFICATION, r); + return r; + } + + /* ********************************************************** */ + // LEFT | + public static boolean join_type(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "join_type")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, JOIN_TYPE, ""); + r = consumeToken(b, LEFT); + if (!r) r = consumeToken(b, JOIN_TYPE_1_0); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // [ join_type ] JOIN table_reference join_specification + public static boolean joined_table(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "joined_table")) return false; + if (!nextTokenIs(b, "", JOIN, LEFT)) return false; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, JOINED_TABLE, ""); + r = joined_table_0(b, l + 1); + r = r && consumeToken(b, JOIN); + p = r; // pin = 2 + r = r && report_error_(b, table_reference(b, l + 1)); + r = p && join_specification(b, l + 1) && r; + exit_section_(b, l, m, r, p, null); + return r || p; + } + + // [ join_type ] + private static boolean joined_table_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "joined_table_0")) return false; + join_type(b, l + 1); + return true; + } + + /* ********************************************************** */ + // character_like_predicate + public static boolean like_predicate(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "like_predicate")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, LIKE_PREDICATE, ""); + r = character_like_predicate(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // column_reference + static boolean nonparenthesized_value_expression_primary(PsiBuilder b, int l) { + return column_reference(b, l + 1); + } + + /* ********************************************************** */ + // NULLS FIRST | NULLS LAST + public static boolean null_ordering(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "null_ordering")) return false; + if (!nextTokenIs(b, NULLS)) return false; + boolean r; + Marker m = enter_section_(b); + r = parseTokens(b, 0, NULLS, FIRST); + if (!r) r = parseTokens(b, 0, NULLS, LAST); + exit_section_(b, m, NULL_ORDERING, r); + return r; + } + + /* ********************************************************** */ + // row_value_predicand IS [ NOT ] NULL + public static boolean null_predicate(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "null_predicate")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, NULL_PREDICATE, ""); + r = row_value_predicand(b, l + 1); + r = r && consumeToken(b, IS); + r = r && null_predicate_2(b, l + 1); + r = r && consumeToken(b, NULL); + exit_section_(b, l, m, r, false, null); + return r; + } + + // [ NOT ] + private static boolean null_predicate_2(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "null_predicate_2")) return false; + consumeToken(b, NOT); + return true; + } + + /* ********************************************************** */ + // !( SEMICOLON | query_specification | RIGHT_DOUBLE_BRACE) + static boolean orderByClauseRecoverWhile(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "orderByClauseRecoverWhile")) return false; + boolean r; + Marker m = enter_section_(b, l, _NOT_); + r = !orderByClauseRecoverWhile_0(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // SEMICOLON | query_specification | RIGHT_DOUBLE_BRACE + private static boolean orderByClauseRecoverWhile_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "orderByClauseRecoverWhile_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, SEMICOLON); + if (!r) r = query_specification(b, l + 1); + if (!r) r = consumeToken(b, RIGHT_DOUBLE_BRACE); + exit_section_(b, m, null, r); + return r; + } + + /* ********************************************************** */ + // ORDER BY sort_specification_list + public static boolean order_by_clause(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "order_by_clause")) return false; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, ORDER_BY_CLAUSE, ""); + r = consumeTokens(b, 1, ORDER, BY); + p = r; // pin = 1 + r = r && sort_specification_list(b, l + 1); + exit_section_(b, l, m, r, p, orderByClauseRecoverWhile_parser_); + return r || p; + } + + /* ********************************************************** */ + // ASC | DESC + public static boolean ordering_specification(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "ordering_specification")) return false; + if (!nextTokenIs(b, "", ASC, DESC)) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, ORDERING_SPECIFICATION, ""); + r = consumeToken(b, ASC); + if (!r) r = consumeToken(b, DESC); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // grouping_column_reference | LEFT_PAREN grouping_column_reference_list RIGHT_PAREN + public static boolean ordinary_grouping_set(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "ordinary_grouping_set")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, ORDINARY_GROUPING_SET, ""); + r = grouping_column_reference(b, l + 1); + if (!r) r = ordinary_grouping_set_1(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // LEFT_PAREN grouping_column_reference_list RIGHT_PAREN + private static boolean ordinary_grouping_set_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "ordinary_grouping_set_1")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, LEFT_PAREN); + r = r && grouping_column_reference_list(b, l + 1); + r = r && consumeToken(b, RIGHT_PAREN); + exit_section_(b, m, null, r); + return r; + } + + /* ********************************************************** */ + // QUESTION_MARK PARAMETER_IDENTIFIER + public static boolean parameter_reference(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "parameter_reference")) return false; + if (!nextTokenIs(b, QUESTION_MARK)) return false; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, PARAMETER_REFERENCE, null); + r = consumeTokens(b, 1, QUESTION_MARK, PARAMETER_IDENTIFIER); + p = r; // pin = 1 + exit_section_(b, l, m, r, p, null); + return r || p; + } + + /* ********************************************************** */ + // LEFT_PAREN boolean_value_expression RIGHT_PAREN + static boolean parenthesized_boolean_value_expression(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "parenthesized_boolean_value_expression")) return false; + if (!nextTokenIs(b, LEFT_PAREN)) return false; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_); + r = consumeToken(b, LEFT_PAREN); + p = r; // pin = 1 + r = r && report_error_(b, boolean_value_expression(b, l + 1)); + r = p && consumeToken(b, RIGHT_PAREN) && r; + exit_section_(b, l, m, r, p, null); + return r || p; + } + + /* ********************************************************** */ + // comparison_predicate + // | between_predicate + // | like_predicate + // | null_predicate + // | exists_predicate + // | in_predicate + public static boolean predicate(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "predicate")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, PREDICATE, ""); + r = comparison_predicate(b, l + 1); + if (!r) r = between_predicate(b, l + 1); + if (!r) r = like_predicate(b, l + 1); + if (!r) r = null_predicate(b, l + 1); + if (!r) r = exists_predicate(b, l + 1); + if (!r) r = in_predicate(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // !( SEMICOLON | query_specification | RIGHT_DOUBLE_BRACE) + static boolean querySpecificationRecoverWhile(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "querySpecificationRecoverWhile")) return false; + boolean r; + Marker m = enter_section_(b, l, _NOT_); + r = !querySpecificationRecoverWhile_0(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // SEMICOLON | query_specification | RIGHT_DOUBLE_BRACE + private static boolean querySpecificationRecoverWhile_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "querySpecificationRecoverWhile_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, SEMICOLON); + if (!r) r = query_specification(b, l + 1); + if (!r) r = consumeToken(b, RIGHT_DOUBLE_BRACE); + exit_section_(b, m, null, r); + return r; + } + + /* ********************************************************** */ + // SELECT [ set_quantifier ] select_list table_expression (SEMICOLON | <>)? + public static boolean query_specification(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "query_specification")) return false; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, QUERY_SPECIFICATION, ""); + r = consumeToken(b, SELECT); + p = r; // pin = 1 + r = r && report_error_(b, query_specification_1(b, l + 1)); + r = p && report_error_(b, select_list(b, l + 1)) && r; + r = p && report_error_(b, table_expression(b, l + 1)) && r; + r = p && query_specification_4(b, l + 1) && r; + exit_section_(b, l, m, r, p, querySpecificationRecoverWhile_parser_); + return r || p; + } + + // [ set_quantifier ] + private static boolean query_specification_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "query_specification_1")) return false; + set_quantifier(b, l + 1); + return true; + } + + // (SEMICOLON | <>)? + private static boolean query_specification_4(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "query_specification_4")) return false; + query_specification_4_0(b, l + 1); + return true; + } + + // SEMICOLON | <> + private static boolean query_specification_4_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "query_specification_4_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, SEMICOLON); + if (!r) r = eof(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + /* ********************************************************** */ + // value_expression | common_value_expression (','common_value_expression)* + public static boolean row_value_predicand(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "row_value_predicand")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, ROW_VALUE_PREDICAND, ""); + r = value_expression(b, l + 1); + if (!r) r = row_value_predicand_1(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // common_value_expression (','common_value_expression)* + private static boolean row_value_predicand_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "row_value_predicand_1")) return false; + boolean r; + Marker m = enter_section_(b); + r = common_value_expression(b, l + 1); + r = r && row_value_predicand_1_1(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // (','common_value_expression)* + private static boolean row_value_predicand_1_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "row_value_predicand_1_1")) return false; + while (true) { + int c = current_position_(b); + if (!row_value_predicand_1_1_0(b, l + 1)) break; + if (!empty_element_parsed_guard_(b, "row_value_predicand_1_1", c)) break; + } + return true; + } + + // ','common_value_expression + private static boolean row_value_predicand_1_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "row_value_predicand_1_1_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, COMMA); + r = r && common_value_expression(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + /* ********************************************************** */ + // boolean_value_expression + public static boolean search_condition(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "search_condition")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, SEARCH_CONDITION, ""); + r = boolean_value_expression(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // ASTERISK | select_sublist [ ( COMMA select_sublist )* ] + public static boolean select_list(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "select_list")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, SELECT_LIST, ""); + r = derived_column(b, l + 1); + if (!r) r = select_sublist_1(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // aggregate_function [COMMA aggregate_function*] + private static boolean select_sublist_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "select_sublist_1")) return false; + boolean r; + Marker m = enter_section_(b); + r = aggregate_function(b, l + 1); + r = r && select_sublist_1_1(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // [COMMA aggregate_function*] + private static boolean select_sublist_1_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "select_sublist_1_1")) return false; + select_sublist_1_1_0(b, l + 1); + return true; + } + + // COMMA aggregate_function* + private static boolean select_sublist_1_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "select_sublist_1_1_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, COMMA); + r = r && select_sublist_1_1_0_1(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // aggregate_function* + private static boolean select_sublist_1_1_0_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "select_sublist_1_1_0_1")) return false; + while (true) { + int c = current_position_(b); + if (!aggregate_function(b, l + 1)) break; + if (!empty_element_parsed_guard_(b, "select_sublist_1_1_0_1", c)) break; + } + return true; + } + + /* ********************************************************** */ + // computational_operation + public static boolean set_function_type(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "set_function_type")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, SET_FUNCTION_TYPE, ""); + r = computational_operation(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // DISTINCT | ALL + public static boolean set_quantifier(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "set_quantifier")) return false; + if (!nextTokenIs(b, "", ALL, DISTINCT)) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, SET_QUANTIFIER, ""); + r = consumeToken(b, DISTINCT); + if (!r) r = consumeToken(b, ALL); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // value_expression + public static boolean sort_key(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "sort_key")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, SORT_KEY, ""); + r = value_expression(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // sort_key [ ordering_specification ] [ null_ordering ] + public static boolean sort_specification(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "sort_specification")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, SORT_SPECIFICATION, ""); + r = sort_key(b, l + 1); + r = r && sort_specification_1(b, l + 1); + r = r && sort_specification_2(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // [ ordering_specification ] + private static boolean sort_specification_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "sort_specification_1")) return false; + ordering_specification(b, l + 1); + return true; + } + + // [ null_ordering ] + private static boolean sort_specification_2(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "sort_specification_2")) return false; + null_ordering(b, l + 1); + return true; + } + + /* ********************************************************** */ + // sort_specification [ { COMMA sort_specification }* ] + public static boolean sort_specification_list(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "sort_specification_list")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, SORT_SPECIFICATION_LIST, ""); + r = sort_specification(b, l + 1); + r = r && sort_specification_list_1(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // [ { COMMA sort_specification }* ] + private static boolean sort_specification_list_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "sort_specification_list_1")) return false; + sort_specification_list_1_0(b, l + 1); + return true; + } + + // { COMMA sort_specification }* + private static boolean sort_specification_list_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "sort_specification_list_1_0")) return false; + while (true) { + int c = current_position_(b); + if (!sort_specification_list_1_0_0(b, l + 1)) break; + if (!empty_element_parsed_guard_(b, "sort_specification_list_1_0", c)) break; + } + return true; + } + + // COMMA sort_specification + private static boolean sort_specification_list_1_0_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "sort_specification_list_1_0_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, COMMA); + r = r && sort_specification(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + /* ********************************************************** */ + // !<> (query_specification empty_statement?)* empty_statement? + static boolean statement(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "statement")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_); + r = statement_0(b, l + 1); + r = r && statement_1(b, l + 1); + r = r && statement_2(b, l + 1); + exit_section_(b, l, m, r, false, expressionRecoverWhile_parser_); + return r; + } + + // !<> + private static boolean statement_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "statement_0")) return false; + boolean r; + Marker m = enter_section_(b, l, _NOT_); + r = !eof(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // (query_specification empty_statement?)* + private static boolean statement_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "statement_1")) return false; + while (true) { + int c = current_position_(b); + if (!statement_1_0(b, l + 1)) break; + if (!empty_element_parsed_guard_(b, "statement_1", c)) break; + } + return true; + } + + // query_specification empty_statement? + private static boolean statement_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "statement_1_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = query_specification(b, l + 1); + r = r && statement_1_0_1(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // empty_statement? + private static boolean statement_1_0_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "statement_1_0_1")) return false; + empty_statement(b, l + 1); + return true; + } + + // empty_statement? + private static boolean statement_2(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "statement_2")) return false; + empty_statement(b, l + 1); + return true; + } + + /* ********************************************************** */ + // general_literal + public static boolean string_value_expression(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "string_value_expression")) return false; + if (!nextTokenIs(b, STRING)) return false; + boolean r; + Marker m = enter_section_(b); + r = general_literal(b, l + 1); + exit_section_(b, m, STRING_VALUE_EXPRESSION, r); + return r; + } + + /* ********************************************************** */ + // character_value_function + public static boolean string_value_function(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "string_value_function")) return false; + if (!nextTokenIs(b, CONCAT)) return false; + boolean r; + Marker m = enter_section_(b); + r = character_value_function(b, l + 1); + exit_section_(b, m, STRING_VALUE_FUNCTION, r); + return r; + } + + /* ********************************************************** */ + // LEFT_PAREN? LEFT_DOUBLE_BRACE query_specification RIGHT_DOUBLE_BRACE [(UNION ALL? subquery)*] RIGHT_PAREN? [ [ AS ] correlation_name ] + public static boolean subquery(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "subquery")) return false; + if (!nextTokenIs(b, "", LEFT_DOUBLE_BRACE, LEFT_PAREN)) return false; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, SUBQUERY, ""); + r = subquery_0(b, l + 1); + r = r && consumeToken(b, LEFT_DOUBLE_BRACE); + p = r; // pin = 2 + r = r && report_error_(b, query_specification(b, l + 1)); + r = p && report_error_(b, consumeToken(b, RIGHT_DOUBLE_BRACE)) && r; + r = p && report_error_(b, subquery_4(b, l + 1)) && r; + r = p && report_error_(b, subquery_5(b, l + 1)) && r; + r = p && subquery_6(b, l + 1) && r; + exit_section_(b, l, m, r, p, null); + return r || p; + } + + // LEFT_PAREN? + private static boolean subquery_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "subquery_0")) return false; + consumeToken(b, LEFT_PAREN); + return true; + } + + // [(UNION ALL? subquery)*] + private static boolean subquery_4(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "subquery_4")) return false; + subquery_4_0(b, l + 1); + return true; + } + + // (UNION ALL? subquery)* + private static boolean subquery_4_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "subquery_4_0")) return false; + while (true) { + int c = current_position_(b); + if (!subquery_4_0_0(b, l + 1)) break; + if (!empty_element_parsed_guard_(b, "subquery_4_0", c)) break; + } + return true; + } + + // UNION ALL? subquery + private static boolean subquery_4_0_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "subquery_4_0_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, UNION); + r = r && subquery_4_0_0_1(b, l + 1); + r = r && subquery(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // ALL? + private static boolean subquery_4_0_0_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "subquery_4_0_0_1")) return false; + consumeToken(b, ALL); + return true; + } + + // RIGHT_PAREN? + private static boolean subquery_5(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "subquery_5")) return false; + consumeToken(b, RIGHT_PAREN); + return true; + } + + // [ [ AS ] correlation_name ] + private static boolean subquery_6(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "subquery_6")) return false; + subquery_6_0(b, l + 1); + return true; + } + + // [ AS ] correlation_name + private static boolean subquery_6_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "subquery_6_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = subquery_6_0_0(b, l + 1); + r = r && correlation_name(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // [ AS ] + private static boolean subquery_6_0_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "subquery_6_0_0")) return false; + consumeToken(b, AS); + return true; + } + + /* ********************************************************** */ + // from_clause + // where_clause? + // order_by_clause? + // group_by_clause? + public static boolean table_expression(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_expression")) return false; + if (!nextTokenIs(b, FROM)) return false; + boolean r; + Marker m = enter_section_(b); + r = from_clause(b, l + 1); + r = r && table_expression_1(b, l + 1); + r = r && table_expression_2(b, l + 1); + r = r && table_expression_3(b, l + 1); + exit_section_(b, m, TABLE_EXPRESSION, r); + return r; + } + + // where_clause? + private static boolean table_expression_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_expression_1")) return false; + where_clause(b, l + 1); + return true; + } + + // order_by_clause? + private static boolean table_expression_2(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_expression_2")) return false; + order_by_clause(b, l + 1); + return true; + } + + // group_by_clause? + private static boolean table_expression_3(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_expression_3")) return false; + group_by_clause(b, l + 1); + return true; + } + + /* ********************************************************** */ + // TABLE_NAME_IDENTIFIER [ EXCLAMATION_MARK ] + public static boolean table_name(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_name")) return false; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, TABLE_NAME, ""); + r = consumeToken(b, TABLE_NAME_IDENTIFIER); + p = r; // pin = 1 + r = r && table_name_1(b, l + 1); + exit_section_(b, l, m, r, p, table_name_recover_parser_); + return r || p; + } + + // [ EXCLAMATION_MARK ] + private static boolean table_name_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_name_1")) return false; + consumeToken(b, EXCLAMATION_MARK); + return true; + } + + /* ********************************************************** */ + // !(RIGHT_BRACE | AS | JOIN | ON | SPACE | " ") + static boolean table_name_recover(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_name_recover")) return false; + boolean r; + Marker m = enter_section_(b, l, _NOT_); + r = !table_name_recover_0(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // RIGHT_BRACE | AS | JOIN | ON | SPACE | " " + private static boolean table_name_recover_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_name_recover_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, RIGHT_BRACE); + if (!r) r = consumeToken(b, AS); + if (!r) r = consumeToken(b, JOIN); + if (!r) r = consumeToken(b, ON); + if (!r) r = consumeToken(b, SPACE); + if (!r) r = consumeToken(b, " "); + exit_section_(b, m, null, r); + return r; + } + + /* ********************************************************** */ + // table_name [ [ AS ] correlation_name ] + public static boolean table_primary(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_primary")) return false; + if (!nextTokenIs(b, TABLE_NAME_IDENTIFIER)) return false; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, TABLE_PRIMARY, null); + r = table_name(b, l + 1); + p = r; // pin = 1 + r = r && table_primary_1(b, l + 1); + exit_section_(b, l, m, r, p, null); + return r || p; + } + + // [ [ AS ] correlation_name ] + private static boolean table_primary_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_primary_1")) return false; + table_primary_1_0(b, l + 1); + return true; + } + + // [ AS ] correlation_name + private static boolean table_primary_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_primary_1_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = table_primary_1_0_0(b, l + 1); + r = r && correlation_name(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // [ AS ] + private static boolean table_primary_1_0_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_primary_1_0_0")) return false; + consumeToken(b, AS); + return true; + } + + /* ********************************************************** */ + // !(JOIN) + static boolean table_primary_recover(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_primary_recover")) return false; + boolean r; + Marker m = enter_section_(b, l, _NOT_); + r = !consumeToken(b, JOIN); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // table_primary [joined_table*] + public static boolean table_reference(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_reference")) return false; + if (!nextTokenIs(b, TABLE_NAME_IDENTIFIER)) return false; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, TABLE_REFERENCE, null); + r = table_primary(b, l + 1); + p = r; // pin = 1 + r = r && table_reference_1(b, l + 1); + exit_section_(b, l, m, r, p, null); + return r || p; + } + + // [joined_table*] + private static boolean table_reference_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_reference_1")) return false; + table_reference_1_0(b, l + 1); + return true; + } + + // joined_table* + private static boolean table_reference_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_reference_1_0")) return false; + while (true) { + int c = current_position_(b); + if (!joined_table(b, l + 1)) break; + if (!empty_element_parsed_guard_(b, "table_reference_1_0", c)) break; + } + return true; + } + + /* ********************************************************** */ + // table_reference [ ( COMMA? table_reference )* ] + public static boolean table_reference_list(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_reference_list")) return false; + if (!nextTokenIs(b, TABLE_NAME_IDENTIFIER)) return false; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, TABLE_REFERENCE_LIST, null); + r = table_reference(b, l + 1); + p = r; // pin = 1 + r = r && table_reference_list_1(b, l + 1); + exit_section_(b, l, m, r, p, null); + return r || p; + } + + // [ ( COMMA? table_reference )* ] + private static boolean table_reference_list_1(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_reference_list_1")) return false; + table_reference_list_1_0(b, l + 1); + return true; + } + + // ( COMMA? table_reference )* + private static boolean table_reference_list_1_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_reference_list_1_0")) return false; + while (true) { + int c = current_position_(b); + if (!table_reference_list_1_0_0(b, l + 1)) break; + if (!empty_element_parsed_guard_(b, "table_reference_list_1_0", c)) break; + } + return true; + } + + // COMMA? table_reference + private static boolean table_reference_list_1_0_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_reference_list_1_0_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = table_reference_list_1_0_0_0(b, l + 1); + r = r && table_reference(b, l + 1); + exit_section_(b, m, null, r); + return r; + } + + // COMMA? + private static boolean table_reference_list_1_0_0_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_reference_list_1_0_0_0")) return false; + consumeToken(b, COMMA); + return true; + } + + /* ********************************************************** */ + // subquery + public static boolean table_subquery(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "table_subquery")) return false; + if (!nextTokenIs(b, "
    ", LEFT_DOUBLE_BRACE, LEFT_PAREN)) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, TABLE_SUBQUERY, "
    "); + r = subquery(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // TRUE | FALSE + public static boolean truth_value(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "truth_value")) return false; + if (!nextTokenIs(b, "", FALSE, TRUE)) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, TRUTH_VALUE, ""); + r = consumeToken(b, TRUE); + if (!r) r = consumeToken(b, FALSE); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // NUMBER + // | parameter_reference + // | column_reference_value + public static boolean value_expression(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "value_expression")) return false; + boolean r; + Marker m = enter_section_(b, l, _NONE_, VALUE_EXPRESSION, ""); + r = consumeToken(b, NUMBER); + if (!r) r = parameter_reference(b, l + 1); + if (!r) r = column_reference_value(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + /* ********************************************************** */ + // WHERE search_condition + public static boolean where_clause(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "where_clause")) return false; + boolean r, p; + Marker m = enter_section_(b, l, _NONE_, WHERE_CLAUSE, ""); + r = consumeToken(b, WHERE); + p = r; // pin = 1 + r = r && search_condition(b, l + 1); + exit_section_(b, l, m, r, p, where_clause_recover_parser_); + return r || p; + } + + /* ********************************************************** */ + // !('{{' | <> | SELECT | ORDER | LEFT_PAREN | SEMICOLON | RIGHT_DOUBLE_BRACE ) + static boolean where_clause_recover(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "where_clause_recover")) return false; + boolean r; + Marker m = enter_section_(b, l, _NOT_); + r = !where_clause_recover_0(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // '{{' | <> | SELECT | ORDER | LEFT_PAREN | SEMICOLON | RIGHT_DOUBLE_BRACE + private static boolean where_clause_recover_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "where_clause_recover_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, "{{"); + if (!r) r = eof(b, l + 1); + if (!r) r = consumeToken(b, SELECT); + if (!r) r = consumeToken(b, ORDER); + if (!r) r = consumeToken(b, LEFT_PAREN); + if (!r) r = consumeToken(b, SEMICOLON); + if (!r) r = consumeToken(b, RIGHT_DOUBLE_BRACE); + exit_section_(b, m, null, r); + return r; + } + + final static Parser column_reference_recover_parser_ = new Parser() { + public boolean parse(PsiBuilder b, int l) { + return column_reference_recover(b, l + 1); + } + }; + final static Parser expressionRecoverWhile_parser_ = new Parser() { + public boolean parse(PsiBuilder b, int l) { + return expressionRecoverWhile(b, l + 1); + } + }; + final static Parser from_clause_recover_parser_ = new Parser() { + public boolean parse(PsiBuilder b, int l) { + return from_clause_recover(b, l + 1); + } + }; + final static Parser join_condition_recover_parser_ = new Parser() { + public boolean parse(PsiBuilder b, int l) { + return join_condition_recover(b, l + 1); + } + }; + final static Parser orderByClauseRecoverWhile_parser_ = new Parser() { + public boolean parse(PsiBuilder b, int l) { + return orderByClauseRecoverWhile(b, l + 1); + } + }; + final static Parser querySpecificationRecoverWhile_parser_ = new Parser() { + public boolean parse(PsiBuilder b, int l) { + return querySpecificationRecoverWhile(b, l + 1); + } + }; + final static Parser select_list_recover_parser_ = new Parser() { + public boolean parse(PsiBuilder b, int l) { + return select_list_recover(b, l + 1); + } + }; + final static Parser table_name_recover_parser_ = new Parser() { + public boolean parse(PsiBuilder b, int l) { + return table_name_recover(b, l + 1); + } + }; + final static Parser where_clause_recover_parser_ = new Parser() { + public boolean parse(PsiBuilder b, int l) { + return where_clause_recover(b, l + 1); + } + }; +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchParserDefinition.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchParserDefinition.java new file mode 100644 index 000000000..421bdd01d --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchParserDefinition.java @@ -0,0 +1,89 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch; + +import com.intellij.idea.plugin.hybris.flexibleSearch.file.FlexibleSearchFile; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTokenType; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes; +import com.intellij.lang.ASTNode; +import com.intellij.lang.ParserDefinition; +import com.intellij.lang.PsiParser; +import com.intellij.lexer.Lexer; +import com.intellij.openapi.project.Project; +import com.intellij.psi.FileViewProvider; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; +import com.intellij.psi.TokenType; +import com.intellij.psi.tree.IFileElementType; +import com.intellij.psi.tree.TokenSet; +import org.jetbrains.annotations.NotNull; + +public class FlexibleSearchParserDefinition implements ParserDefinition { + + public static final TokenSet WHITE_SPACES = TokenSet.create(TokenType.WHITE_SPACE); + public static final FlexibleSearchTokenType COMMENT = new FlexibleSearchTokenType("COMMENT"); + public static final TokenSet COMMENTS = TokenSet.create(COMMENT); + + public static final IFileElementType FILE = new IFileElementType(FlexibleSearchLanguage.getInstance()); + + @NotNull + @Override + public Lexer createLexer(Project project) { + return new FlexibleSearchLexerAdapter(); + } + + @NotNull + public TokenSet getWhitespaceTokens() { + return WHITE_SPACES; + } + + @NotNull + @Override + public TokenSet getCommentTokens() { + return COMMENTS; + } + + @NotNull + public TokenSet getStringLiteralElements() { + return TokenSet.EMPTY; + } + + @NotNull + public PsiParser createParser(final Project project) { + return new FlexibleSearchParser(); + } + + @Override + public IFileElementType getFileNodeType() { + return FILE; + } + + public PsiFile createFile(FileViewProvider viewProvider) { + return new FlexibleSearchFile(viewProvider); + } + + public SpaceRequirements spaceExistanceTypeBetweenTokens(ASTNode left, ASTNode right) { + return SpaceRequirements.MAY; + } + + @NotNull + public PsiElement createElement(ASTNode node) { + return FlexibleSearchTypes.Factory.createElement(node); + } +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/commenter/FlexibleSearchCommenter.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/commenter/FlexibleSearchCommenter.java new file mode 100644 index 000000000..e0a8a76af --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/commenter/FlexibleSearchCommenter.java @@ -0,0 +1,55 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.commenter; + +import com.intellij.lang.Commenter; +import org.jetbrains.annotations.Nullable; + +public class FlexibleSearchCommenter implements Commenter { + + @Nullable + @Override + public String getLineCommentPrefix() { + return "-- "; + } + + @Nullable + @Override + public String getBlockCommentPrefix() { + return ""; + } + + @Nullable + @Override + public String getBlockCommentSuffix() { + return null; + } + + @Nullable + @Override + public String getCommentedBlockCommentPrefix() { + return null; + } + + @Nullable + @Override + public String getCommentedBlockCommentSuffix() { + return null; + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/FlexibleSearchCompletionContributor.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/FlexibleSearchCompletionContributor.java new file mode 100644 index 000000000..eb32ebdd8 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/FlexibleSearchCompletionContributor.java @@ -0,0 +1,104 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.completion; + +import com.intellij.codeInsight.completion.CompletionContributor; +import com.intellij.codeInsight.completion.CompletionType; +import com.intellij.codeInsight.lookup.LookupElementBuilder; +import com.intellij.icons.AllIcons; +import com.intellij.idea.plugin.hybris.completion.provider.ItemTypeCodeCompletionProvider; +import com.intellij.idea.plugin.hybris.flexibleSearch.FlexibleSearchLanguage; +import com.intellij.idea.plugin.hybris.flexibleSearch.completion.provider.FSFieldsCompletionProvider; +import com.intellij.idea.plugin.hybris.flexibleSearch.completion.provider.FSKeywordCompletionProvider; +import com.intellij.idea.plugin.hybris.flexibleSearch.completion.provider.FSKeywords; +import com.intellij.openapi.diagnostic.Logger; +import com.intellij.patterns.PlatformPatterns; +import com.intellij.psi.PsiElement; +import com.intellij.psi.tree.TokenSet; + +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.COLUMN_REFERENCE_IDENTIFIER; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.TABLE_NAME_IDENTIFIER; +import static com.intellij.patterns.PlatformPatterns.psiElement; + +public class FlexibleSearchCompletionContributor extends CompletionContributor { + + private static final Logger LOG = Logger.getInstance(FlexibleSearchCompletionContributor.class); + + public FlexibleSearchCompletionContributor() { + // keywords + extend( + CompletionType.BASIC, + PlatformPatterns.psiElement(PsiElement.class) + .withLanguage(FlexibleSearchLanguage.getInstance()) +// .andNot(psiElement().withParents( +// FlexibleSearchTableName.class, +// FlexibleSearchFromClause.class, +// FlexibleSearchWhereClause.class +// )) +// .andNot(psiElement().inside(psiElement(COLUMN_REFERENCE))) +// .andNot(psiElement().inside(psiElement(TABLE_NAME_IDENTIFIER))) + /*.andNot(psiElement().inside(psiElement(COLUMN_REFERENCE_IDENTIFIER)))*/, + new FSKeywordCompletionProvider(FSKeywords.topLevelKeywords(), (keyword) -> + LookupElementBuilder.create(keyword) + .withCaseSensitivity(false) + .withIcon(AllIcons.Nodes.Function)) + ); + + extend( + CompletionType.BASIC, + psiElement() + .withElementType(TokenSet.create(TABLE_NAME_IDENTIFIER)) + .withLanguage(FlexibleSearchLanguage.getInstance()), + ItemTypeCodeCompletionProvider.getInstance() + ); + + extend( + CompletionType.BASIC, + psiElement().inside(psiElement(COLUMN_REFERENCE_IDENTIFIER)) + .withLanguage(FlexibleSearchLanguage.getInstance()), + FSFieldsCompletionProvider.Companion.getInstance() + ); + +// extend( +// CompletionType.BASIC, +// psiElement() +// .afterLeaf(psiElement().withElementType(TokenSet.create(TABLE_NAME_IDENTIFIER))) +// .withLanguage(FlexibleSearchLanguage.getInstance()), +// new FSKeywordCompletionProvider(newHashSet("AS"), (keyword) -> +// LookupElementBuilder.create(keyword) +// .withCaseSensitivity(false) +// .withIcon(AllIcons.Nodes.Function)) +// ); + + +// extend( +// CompletionType.BASIC, +// psiElement() +// .inside(psiElement(SELECT_LIST)) +// .withLanguage(FlexibleSearchLanguage.getInstance()) +// .andNot(psiElement().inside(psiElement(COLUMN_REFERENCE))), +// new FSKeywordCompletionProvider(newHashSet("*", "DISTINCT", "COUNT"), (keyword) -> +// LookupElementBuilder.create(keyword) +// .bold() +// .withCaseSensitivity(false) +// .withIcon(AllIcons.Nodes.Static)) +// ); + + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/analyzer/FSKeywordTableClauseAnalyzer.kt b/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/analyzer/FSKeywordTableClauseAnalyzer.kt new file mode 100644 index 000000000..6783a7623 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/analyzer/FSKeywordTableClauseAnalyzer.kt @@ -0,0 +1,91 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.completion.analyzer + +import com.intellij.codeInsight.completion.CompletionParameters +import com.intellij.codeInsight.completion.CompletionResultSet +import com.intellij.codeInsight.lookup.LookupElementBuilder +import com.intellij.icons.AllIcons +import com.intellij.idea.plugin.hybris.flexibleSearch.completion.analyzer.checker.FSFromClauseKeywordsAnalyzer +import com.intellij.idea.plugin.hybris.flexibleSearch.completion.analyzer.checker.FSSelectClauseKeywordsAnalyzer +import com.intellij.idea.plugin.hybris.flexibleSearch.completion.analyzer.checker.FSWhereClauseKeywordsAnalyzer +import com.intellij.idea.plugin.hybris.flexibleSearch.completion.provider.FSFieldsCompletionProvider +import com.intellij.idea.plugin.hybris.flexibleSearch.file.FlexibleSearchFile +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchJoinCondition +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchSelectList +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiWhiteSpace +import com.intellij.psi.impl.source.tree.LeafPsiElement +import com.intellij.psi.util.PsiTreeUtil +import com.intellij.util.ProcessingContext +import javax.swing.Icon + + +/** + * @author Nosov Aleksandr + */ +object FSKeywordTableClauseAnalyzer { + private val topLevelKeywords = hashSetOf("SELECT", "FROM", "WHERE", "ORDER", /* Temporarily place this*/ "LEFT", "JOIN", "ON", "BY", "ASC", "DESC") + + fun analyzeKeyword(parameters: CompletionParameters, completionResultSet: CompletionResultSet) { + if ((parameters.originalPosition == null && !isTableNameIdentifier(parameters) && !isColumnReferenceIdentifier(parameters)) || isFile(parameters)) { + addToResult(hashSetOf("SELECT", "FROM", "WHERE"), completionResultSet, AllIcons.Nodes.Static, true) + } + if ((isColumnReferenceIdentifier(parameters) && parameters.position.skipWhitespaceSiblingsBackward() != null && parameters.position.skipWhitespaceSiblingsBackward()!!.text != "}") || + (isColumnReferenceIdentifier(parameters) && PsiTreeUtil.getParentOfType(parameters.position, FlexibleSearchSelectList::class.java) != null)) { + FSFieldsCompletionProvider.instance.addCompletionVariants(parameters, ProcessingContext(), completionResultSet) + + } + if (isFile(parameters)) { + addToResult(hashSetOf("SELECT", "FROM", "WHERE"), completionResultSet, AllIcons.Nodes.Static, true) + } + + FSSelectClauseKeywordsAnalyzer.analyzeCompletions(parameters, completionResultSet) + FSWhereClauseKeywordsAnalyzer.analyzeCompletions(parameters, completionResultSet) + FSFromClauseKeywordsAnalyzer.analyzeCompletions(parameters, completionResultSet) + + } +} + +fun isFile(parameters: CompletionParameters) = + parameters.position.parent != null && parameters.position.parent.parent != null && parameters.position.parent.parent is FlexibleSearchFile + +fun isJoinCondition(parameters: CompletionParameters) = + parameters.position.parent != null && parameters.position.parent.parent != null && parameters.position.parent.parent is FlexibleSearchJoinCondition + +fun isTableNameIdentifier(parameters: CompletionParameters) = + (parameters.position as LeafPsiElement).elementType == FlexibleSearchTypes.TABLE_NAME_IDENTIFIER + +fun isColumnReferenceIdentifier(parameters: CompletionParameters) = + (parameters.position as LeafPsiElement).elementType == FlexibleSearchTypes.COLUMN_REFERENCE_IDENTIFIER + +fun isIdentifier(parameters: CompletionParameters) = + (parameters.position as LeafPsiElement).elementType == FlexibleSearchTypes.IDENTIFIER + + +fun addToResult(results: Set, completionResultSet: CompletionResultSet, icon: Icon, bold: Boolean = false) { + results.forEach { completionResultSet.addElement(LookupElementBuilder.create(it).withCaseSensitivity(false).withBoldness(bold).withIcon(icon)) } +} + +fun addSymbolToResult(results: Set, completionResultSet: CompletionResultSet, icon: Icon, bold: Boolean = false) { + results.forEach { completionResultSet.addElement(LookupElementBuilder.create(it).withPresentableText(it).withCaseSensitivity(false).withBoldness(bold).withIcon(icon)) } +} + +fun PsiElement.skipWhitespaceSiblingsBackward() = PsiTreeUtil.skipSiblingsBackward(this, PsiWhiteSpace::class.java) diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/analyzer/checker/FSFromClauseKeywordsAnalyzer.kt b/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/analyzer/checker/FSFromClauseKeywordsAnalyzer.kt new file mode 100644 index 000000000..b094ebe0c --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/analyzer/checker/FSFromClauseKeywordsAnalyzer.kt @@ -0,0 +1,76 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.completion.analyzer.checker + +import com.intellij.codeInsight.completion.CompletionParameters +import com.intellij.codeInsight.completion.CompletionResultSet +import com.intellij.codeInsight.lookup.LookupElementBuilder +import com.intellij.icons.AllIcons +import com.intellij.idea.plugin.hybris.flexibleSearch.completion.analyzer.* +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.* +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiErrorElement +import com.intellij.psi.impl.source.tree.PsiErrorElementImpl +import com.intellij.psi.util.PsiTreeUtil + +/** + * @author Nosov Aleksandr + */ +object FSFromClauseKeywordsAnalyzer { + private val errorIdendifier = "IntellijIdeaRulezzz" + + fun analyzeCompletions(parameters: CompletionParameters, completionResultSet: CompletionResultSet) { + val context = parameters.originalPosition ?: parameters.position + if (!isTableNameIdentifier(parameters) && parameters.position.parent != null /*&& parameters.position.parent is FlexibleSearchTableName*/ && !isJoinCondition(parameters) && PsiTreeUtil.getPrevSiblingOfType(context, FlexibleSearchTableReferenceList::class.java) != null) { + addToResult(hashSetOf("AS"), completionResultSet.withPrefixMatcher(""), AllIcons.Nodes.Function) + } + if (isIdentifier(parameters) && context.parentIsFromClause() && PsiTreeUtil.getPrevSiblingOfType(parameters.position, FlexibleSearchTableReferenceList::class.java) == null) { + completionResultSet.addElement(LookupElementBuilder.create("{}").withPresentableText("{...}").withInsertHandler { ctx, _ -> + val cursorOffset = ctx.editor.caretModel.offset + ctx.editor.caretModel.moveToOffset(cursorOffset - 1) + }.withCaseSensitivity(false)) + } + + if (isIdentifier(parameters) && parameters.position.parent is PsiErrorElement) { + if ((parameters.position.parent as PsiErrorElementImpl).errorDescription.contains("join")) { + addToResult(hashSetOf("ON"), completionResultSet, AllIcons.Nodes.Function) + } + } + if (isIdentifier(parameters) && context.prevSibling is FlexibleSearchQuerySpecification) { + addToResult(hashSetOf("WHERE"), completionResultSet.withPrefixMatcher(""), AllIcons.Nodes.Function) + } + if (context.parent != null && context.parent is FlexibleSearchFromClause) { + val siblingBackward = context.skipWhitespaceSiblingsBackward() + + if (siblingBackward != null && siblingBackward is FlexibleSearchTableReferenceList && isIdentifier(parameters) && !isJoinCondition(parameters)) { + addSymbolToResult(hashSetOf("ON"), completionResultSet.withPrefixMatcher(""), AllIcons.Nodes.Function) + if (PsiTreeUtil.findChildrenOfAnyType(context.parent, FlexibleSearchJoinType::class.java, FlexibleSearchJoinedTable::class.java).isEmpty()) + addToResult(hashSetOf("JOIN", "LEFT JOIN"), completionResultSet.withPrefixMatcher(""), AllIcons.Nodes.Function) + } + } + if (isJoinCondition(parameters)) { + addSymbolToResult(hashSetOf("=", ">", "<>", "<", "<=", ">="), completionResultSet.withPrefixMatcher(""), AllIcons.Nodes.Function) + addToResult(hashSetOf("IS", "NOT"), completionResultSet.withPrefixMatcher(""), AllIcons.Nodes.Function) + } + + } +} + + +fun PsiElement.parentIsFromClause() = PsiTreeUtil.getParentOfType(this, FlexibleSearchFromClause::class.java) != null diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/analyzer/checker/FSSelectClauseKeywordsAnalyzer.kt b/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/analyzer/checker/FSSelectClauseKeywordsAnalyzer.kt new file mode 100644 index 000000000..f326536a5 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/analyzer/checker/FSSelectClauseKeywordsAnalyzer.kt @@ -0,0 +1,64 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.completion.analyzer.checker + +import com.intellij.codeInsight.completion.CompletionParameters +import com.intellij.codeInsight.completion.CompletionResultSet +import com.intellij.icons.AllIcons +import com.intellij.idea.plugin.hybris.flexibleSearch.completion.analyzer.addToResult +import com.intellij.idea.plugin.hybris.flexibleSearch.completion.analyzer.isColumnReferenceIdentifier +import com.intellij.idea.plugin.hybris.flexibleSearch.completion.analyzer.skipWhitespaceSiblingsBackward +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchQuerySpecification +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchSelectList +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTableName +import com.intellij.psi.util.PsiTreeUtil + +/** + * @author Nosov Aleksandr + */ +object FSSelectClauseKeywordsAnalyzer { + private val errorIdendifier = "IntellijIdeaRulezzz" + + fun analyzeCompletions(parameters: CompletionParameters, completionResultSet: CompletionResultSet) { + val context = parameters.originalPosition ?: parameters.position + + if (context.parent != null && PsiTreeUtil.getParentOfType(parameters.position.parent, FlexibleSearchSelectList::class.java) != null) { + val siblingBackward = context.skipWhitespaceSiblingsBackward() + + if (siblingBackward is FlexibleSearchQuerySpecification) { + val tableNames = PsiTreeUtil.findChildrenOfType(siblingBackward, FlexibleSearchTableName::class.java) + + if (tableNames.isEmpty()) { + addToResult(hashSetOf("*", "COUNT", "DISTINCT", "FROM"), completionResultSet.withPrefixMatcher(""), AllIcons.Nodes.Function) + } + } + } + + if (isColumnReferenceIdentifier(parameters) && PsiTreeUtil.getParentOfType(context, FlexibleSearchSelectList::class.java) != null) { + addToResult(hashSetOf("FROM"), completionResultSet.withPrefixMatcher(""), AllIcons.Nodes.Static) + addToResult(hashSetOf("*", "COUNT", "DISTINCT", "FROM"), completionResultSet.withPrefixMatcher(""), AllIcons.Nodes.Function) + } + if (isColumnReferenceIdentifier(parameters) && PsiTreeUtil.getPrevSiblingOfType(context, FlexibleSearchQuerySpecification::class.java) != null) { + addToResult(hashSetOf("*", "COUNT", "DISTINCT", "FROM"), completionResultSet.withPrefixMatcher(""), AllIcons.Nodes.Function) + } +// if (isColumnReferenceIdentifier(parameters)) { +// addToResult(hashSetOf("*"), completionResultSet.withPrefixMatcher(""), AllIcons.Nodes.Function) +// } + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/analyzer/checker/FSWhereClauseKeywordsAnalyzer.kt b/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/analyzer/checker/FSWhereClauseKeywordsAnalyzer.kt new file mode 100644 index 000000000..cf6adfa69 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/analyzer/checker/FSWhereClauseKeywordsAnalyzer.kt @@ -0,0 +1,71 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.completion.analyzer.checker + +import com.intellij.codeInsight.completion.CompletionParameters +import com.intellij.codeInsight.completion.CompletionResultSet +import com.intellij.codeInsight.lookup.LookupElementBuilder +import com.intellij.icons.AllIcons +import com.intellij.idea.plugin.hybris.flexibleSearch.completion.analyzer.* +import com.intellij.idea.plugin.hybris.flexibleSearch.completion.provider.FSFieldsCompletionProvider +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchJoinType +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchJoinedTable +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTableReferenceList +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchWhereClause +import com.intellij.psi.PsiElement +import com.intellij.psi.util.PsiTreeUtil +import com.intellij.util.ProcessingContext + +/** + * @author Nosov Aleksandr + */ +object FSWhereClauseKeywordsAnalyzer { + private val errorIdendifier = "IntellijIdeaRulezzz" + + fun analyzeCompletions(parameters: CompletionParameters, completionResultSet: CompletionResultSet) { + val context = parameters.originalPosition ?: parameters.position + + if (isColumnReferenceIdentifier(parameters)) { + FSFieldsCompletionProvider.instance.addCompletionVariants(parameters, ProcessingContext(), completionResultSet) + } + + if (context.parent != null && PsiTreeUtil.getParentOfType(parameters.position.parent, FlexibleSearchWhereClause::class.java) != null) { + val siblingBackward = context.skipWhitespaceSiblingsBackward() + + if (siblingBackward != null && siblingBackward is FlexibleSearchTableReferenceList && isIdentifier(parameters) && !isJoinCondition(parameters)) { + addSymbolToResult(hashSetOf("ON"), completionResultSet.withPrefixMatcher(""), AllIcons.Nodes.Function) + if (PsiTreeUtil.findChildrenOfAnyType(context.parent, FlexibleSearchJoinType::class.java, FlexibleSearchJoinedTable::class.java).isEmpty()) + addToResult(hashSetOf("JOIN", "LEFT JOIN"), completionResultSet.withPrefixMatcher(""), AllIcons.Nodes.Function) + } + } + if (isColumnReferenceIdentifier(parameters) && context.parentIsWhereClause()) { + completionResultSet.addElement(LookupElementBuilder.create("{}").withPresentableText("{...}").withInsertHandler { ctx, _ -> + val cursorOffset = ctx.editor.caretModel.offset + ctx.editor.caretModel.moveToOffset(cursorOffset - 1) + }.withCaseSensitivity(false)) + } + if (isJoinCondition(parameters)) { + addSymbolToResult(hashSetOf("=", ">", "<>", "<", "<=", ">="), completionResultSet.withPrefixMatcher(""), AllIcons.Nodes.Function) + addToResult(hashSetOf("IS", "NOT"), completionResultSet.withPrefixMatcher(""), AllIcons.Nodes.Function) + } + + } +} + +fun PsiElement.parentIsWhereClause() = PsiTreeUtil.getParentOfType(this, FlexibleSearchWhereClause::class.java) != null diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/provider/FSFieldsCompletionProvider.kt b/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/provider/FSFieldsCompletionProvider.kt new file mode 100644 index 000000000..1b0f8e5a9 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/provider/FSFieldsCompletionProvider.kt @@ -0,0 +1,157 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.completion.provider + +import com.intellij.codeInsight.completion.CompletionParameters +import com.intellij.codeInsight.completion.CompletionProvider +import com.intellij.codeInsight.completion.CompletionResultSet +import com.intellij.codeInsight.lookup.LookupElementBuilder +import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons +import com.intellij.idea.plugin.hybris.flexibleSearch.completion.analyzer.isColumnReferenceIdentifier +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchCorrelationName +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchQuerySpecification +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTableName +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTableReference +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes +import com.intellij.idea.plugin.hybris.type.system.meta.TSMetaModelAccess +import com.intellij.idea.plugin.hybris.type.system.meta.TSMetaProperty +import com.intellij.idea.plugin.hybris.type.system.meta.TSMetaReference +import com.intellij.openapi.project.Project +import com.intellij.openapi.util.text.StringUtil +import com.intellij.psi.util.PsiTreeUtil +import com.intellij.psi.util.PsiTreeUtil.findSiblingBackward +import com.intellij.javaee.JavaeeIcons.PARAMETER_ICON +import com.intellij.util.ProcessingContext +import java.util.Objects +import java.util.Optional +import java.util.stream.Stream + +/** + * @author Nosov Aleksandr + */ +class FSFieldsCompletionProvider : CompletionProvider() { + companion object { + val instance: FSFieldsCompletionProvider = FSFieldsCompletionProvider() + } + + override fun addCompletions(parameters: CompletionParameters, context: ProcessingContext, result: CompletionResultSet) { + val project = getProject(parameters) ?: return + val psiElementUnderCaret = parameters.originalPosition ?: parameters.position + + if (isColumnReferenceIdentifier(parameters)) { + val tableNameId = findSiblingBackward(parameters.position, FlexibleSearchTypes.TABLE_NAME_IDENTIFIER, null) + + if (tableNameId == null) { + val querySpecification = PsiTreeUtil.getParentOfType(psiElementUnderCaret, FlexibleSearchQuerySpecification::class.java) + + val tableRefs = PsiTreeUtil.findChildrenOfType(querySpecification, FlexibleSearchTableReference::class.java) + val correlationNames = if (tableRefs.isNotEmpty()) PsiTreeUtil.findChildrenOfType(tableRefs.first(), FlexibleSearchCorrelationName::class.java) else listOf() + + if (correlationNames.isNotEmpty()) { + correlationNames.map { it.text } + .map { LookupElementBuilder.create(it).withPresentableText(it).withIcon(PARAMETER_ICON) } + .forEach { result.addElement(it) } + + } else { + val tableName = PsiTreeUtil.findChildOfType(querySpecification, FlexibleSearchTableName::class.java) + if (tableName != null) { + fillDomAttributesCompletions(project, tableName.text, result) + } + } + } else { + val querySpecification = PsiTreeUtil.getTopmostParentOfType(psiElementUnderCaret, FlexibleSearchQuerySpecification::class.java) + val tableNames = PsiTreeUtil.findChildrenOfType(querySpecification, FlexibleSearchTableReference::class.java) + + if (tableNames.isNotEmpty()) { + val foundTableName = tableNames + .map { PsiTreeUtil.findChildOfType(it, FlexibleSearchTableName::class.java) } + .filter { + if (it != null) { + val element = PsiTreeUtil.getNextSiblingOfType(it, FlexibleSearchCorrelationName::class.java) + element != null && element.text == tableNameId.text + } else { + false + } + } + if (foundTableName.isNotEmpty()) { + fillDomAttributesCompletions(project, foundTableName.first()!!.text, result) + } + } + } + } + } + + private fun getProject(parameters: CompletionParameters): Project? = parameters.editor.project + + private fun fillDomAttributesCompletions( + project: Project, + itemTypeCode: String, + resultSet: CompletionResultSet + ) { + val metaModel = TSMetaModelAccess.getInstance(project).typeSystemMeta + val metaClass = Optional.ofNullable(metaModel.findMetaClassByName(itemTypeCode)) + + val currentPrefix = resultSet.prefixMatcher.prefix + val delimiters = arrayOf('.', ':') + val emptyPrefixResultSet = resultSet.withPrefixMatcher(currentPrefix.substringAfter(delimiters)) + metaClass + .map { meta -> meta.getPropertiesStream(true) } + .orElse(Stream.empty()) + .map { prop -> + val name = prop.name ?: return@map null + + val builder = LookupElementBuilder + .create(name) + .withIcon(HybrisIcons.TYPE_SYSTEM) + .withStrikeoutness(prop.isDeprecated) + val typeText = getTypePresentableText(prop.type) + return@map if (StringUtil.isEmpty(typeText)) builder else builder.withTypeText(typeText, true) + } + .filter { Objects.nonNull(it) } + .forEach { emptyPrefixResultSet.addElement(it) } + metaClass + .map { meta -> meta.getReferenceEndsStream(true) } + .orElse(Stream.empty()) + .map { ref -> + LookupElementBuilder + .create(ref.role) + .withTypeText(ref.typeName) + .withIcon(HybrisIcons.TYPE_SYSTEM) + } + .forEach { emptyPrefixResultSet.addElement(it) } + } + + private fun getTypePresentableText(type: String?): String { + if (type == null) { + return "" + } + val index = type.lastIndexOf('.') + return if (index >= 0) type.substring(index + 1) else type + } + + + private fun String.substringAfter(delimiters: Array, missingDelimiterValue: String = this): String { + val result = delimiters + .filter { delimiter -> indexOf(delimiter) != -1 } + .map { delimiter -> substring(indexOf(delimiter) + 1, length) } + return if (result.isEmpty()) missingDelimiterValue else result.first() + } + + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/provider/FSKeywordCompletionProvider.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/provider/FSKeywordCompletionProvider.java new file mode 100644 index 000000000..841c3a514 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/provider/FSKeywordCompletionProvider.java @@ -0,0 +1,57 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.completion.provider; + +import com.intellij.codeInsight.completion.CompletionParameters; +import com.intellij.codeInsight.completion.CompletionProvider; +import com.intellij.codeInsight.completion.CompletionResultSet; +import com.intellij.codeInsight.lookup.LookupElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.completion.analyzer.FSKeywordTableClauseAnalyzer; +import com.intellij.util.ProcessingContext; +import org.jetbrains.annotations.NotNull; + +import java.util.Set; +import java.util.function.Function; + +public class FSKeywordCompletionProvider extends CompletionProvider { + + @NotNull + private final Set keywords; + + @NotNull + private final Function func; + + public FSKeywordCompletionProvider( + @NotNull final Set keywords, + @NotNull final Function func + ) { + this.keywords = keywords; + this.func = func; + } + + @Override + protected void addCompletions( + @NotNull final CompletionParameters parameters, + final ProcessingContext processingContext, + @NotNull final CompletionResultSet completionResultSet + ) { + final FSKeywordTableClauseAnalyzer keywordAnalyzer = FSKeywordTableClauseAnalyzer.INSTANCE; + keywordAnalyzer.analyzeKeyword(parameters, completionResultSet); + } +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/provider/FSKeywords.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/provider/FSKeywords.java new file mode 100644 index 000000000..ddc6889dd --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/completion/provider/FSKeywords.java @@ -0,0 +1,68 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.completion.provider; + +import com.intellij.util.containers.ContainerUtil; + +import java.util.Set; + +public final class FSKeywords { + + private FSKeywords() { + } + + /** + * @return set of keywords. + */ + public static Set topLevelKeywords() { + return ContainerUtil.newHashSet( + "SELECT", + "FROM", + "WHERE", + "ORDER", + + // Temporarily place this + "LEFT", + "JOIN", + "ON", + "IN", + + "BY", + "ASC", + "DESC" + ); + } + + public static Set joinKeywords() { + return ContainerUtil.newHashSet( + "LEFT", + "JOIN", + "ON" + ); + } + + public static Set orderKeywords() { + return ContainerUtil.newHashSet( + "BY", + "ASC", + "DESC" + ); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/file/FlexibleSearchFile.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/file/FlexibleSearchFile.java new file mode 100644 index 000000000..0711592c6 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/file/FlexibleSearchFile.java @@ -0,0 +1,52 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.file; + +import com.intellij.extapi.psi.PsiFileBase; +import com.intellij.idea.plugin.hybris.flexibleSearch.FlexibleSearchLanguage; +import com.intellij.openapi.fileTypes.FileType; +import com.intellij.psi.FileViewProvider; +import org.jetbrains.annotations.NotNull; + +import javax.swing.*; + +public class FlexibleSearchFile extends PsiFileBase { + + public FlexibleSearchFile(@NotNull final FileViewProvider viewProvider) { + super(viewProvider, FlexibleSearchLanguage.getInstance()); + } + + @NotNull + @Override + public FileType getFileType() { + return FlexibleSearchFileType.getInstance(); + } + + @NotNull + @Override + public String toString() { + return "FlexibleSearch File"; + } + + @Override + public Icon getIcon(final int flags) { + return super.getIcon(flags); + } + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/file/FlexibleSearchFileType.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/file/FlexibleSearchFileType.java new file mode 100644 index 000000000..c12284477 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/file/FlexibleSearchFileType.java @@ -0,0 +1,64 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.file; + +import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons; +import com.intellij.idea.plugin.hybris.flexibleSearch.FlexibleSearchLanguage; +import com.intellij.openapi.fileTypes.LanguageFileType; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import javax.swing.*; + +public class FlexibleSearchFileType extends LanguageFileType { + + private static final FlexibleSearchFileType INSTANCE = new FlexibleSearchFileType(); + + public static FlexibleSearchFileType getInstance() { + return INSTANCE; + } + + protected FlexibleSearchFileType() { + super(FlexibleSearchLanguage.getInstance()); + } + + @NotNull + @Override + public String getName() { + return "FlexibleSearch file"; + } + + @NotNull + @Override + public String getDescription() { + return "FlexibleSearch language file"; + } + + @NotNull + @Override + public String getDefaultExtension() { + return "fxs"; + } + + @Nullable + @Override + public Icon getIcon() { + return HybrisIcons.FS_FILE; + } +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/file/actions/CopyFlexibleSearchFileAction.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/file/actions/CopyFlexibleSearchFileAction.java new file mode 100644 index 000000000..7937c87d3 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/file/actions/CopyFlexibleSearchFileAction.java @@ -0,0 +1,50 @@ +/* + * 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.flexibleSearch.file.actions; + +import com.intellij.idea.plugin.hybris.actions.ActionUtils; +import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; + +import static com.intellij.idea.plugin.hybris.actions.CopyFileToHybrisConsoleUtils.copySelectedFilesToHybrisConsole; +import static com.intellij.idea.plugin.hybris.actions.CopyFileToHybrisConsoleUtils.isRequiredSingleFileExtension; +import static com.intellij.idea.plugin.hybris.common.HybrisConstants.*; + +public class CopyFlexibleSearchFileAction extends AnAction { + + @Override + public void update(@NotNull final AnActionEvent event) { + Project project = event.getProject(); + if (project != null) { + event.getPresentation() + .setEnabledAndVisible(ActionUtils.isHybrisContext(project) && isRequiredSingleFileExtension( + project, FLEXIBLE_SEARCH_FILE_EXTENSION)); + } + } + + @Override + public void actionPerformed(@NotNull final AnActionEvent event) { + Project project = event.getProject(); + if (project != null) { + copySelectedFilesToHybrisConsole(project, FLEXIBLE_SEARCH_CONSOLE_TITLE, FLEXIBLE_SEARCH_FILE_EXTENSION); + } + } +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/file/actions/FlexibleSearchFileCreateAction.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/file/actions/FlexibleSearchFileCreateAction.java new file mode 100644 index 000000000..9d8c8a392 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/file/actions/FlexibleSearchFileCreateAction.java @@ -0,0 +1,91 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.file.actions; + +import com.intellij.ide.actions.CreateFileFromTemplateAction; +import com.intellij.ide.actions.CreateFileFromTemplateDialog; +import com.intellij.idea.plugin.hybris.actions.ActionUtils; +import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons; +import com.intellij.openapi.actionSystem.DataContext; +import com.intellij.openapi.project.DumbAware; +import com.intellij.openapi.project.Project; +import com.intellij.psi.PsiDirectory; +import com.intellij.psi.PsiFile; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Map; + +/** + * @author Nosov Aleksandr + */ +public class FlexibleSearchFileCreateAction extends CreateFileFromTemplateAction implements DumbAware { + + public static final String FILE_TEMPLATE = "FlexibleSearch File"; + + + private static final String NEW_FS_FILE = "New FlexibleSearch File"; + + public FlexibleSearchFileCreateAction() { + super(NEW_FS_FILE, "", HybrisIcons.FS_FILE); + } + + @Override + protected void buildDialog( + final Project project, + final PsiDirectory directory, + final CreateFileFromTemplateDialog.Builder builder + ) { + builder.setTitle(NEW_FS_FILE) + .addKind("Empty file", HybrisIcons.FS_FILE, FILE_TEMPLATE); + } + + @Nullable + @Override + protected String getDefaultTemplateProperty() { + return null; + } + + @NotNull + @Override + protected String getActionName(PsiDirectory directory, String newName, String templateName) { + return NEW_FS_FILE; + } + + + @Override + protected void postProcess(PsiFile createdElement, String templateName, Map customProperties) { + super.postProcess(createdElement, templateName, customProperties); + } + + @Override + public int hashCode() { + return getClass().hashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof FlexibleSearchFileCreateAction; + } + + @Override + protected boolean isAvailable(final DataContext dataContext) { + return super.isAvailable(dataContext) && ActionUtils.isHybrisContext(dataContext); + } +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FSBlock.kt b/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FSBlock.kt new file mode 100644 index 000000000..d98c83c88 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FSBlock.kt @@ -0,0 +1,158 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.formatting + +import com.intellij.formatting.ASTBlock +import com.intellij.formatting.Alignment +import com.intellij.formatting.Block +import com.intellij.formatting.ChildAttributes +import com.intellij.formatting.Indent +import com.intellij.formatting.Spacing +import com.intellij.formatting.SpacingBuilder +import com.intellij.formatting.Wrap +import com.intellij.formatting.WrapType +import com.intellij.formatting.alignment.AlignmentStrategy +import com.intellij.formatting.alignment.AlignmentStrategy.createAlignmentPerTypeStrategy +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.BOOLEAN_PREDICAND +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.FROM +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.FROM_CLAUSE +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.ON +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.SEARCH_CONDITION +import com.intellij.lang.ASTNode +import com.intellij.openapi.util.TextRange +import com.intellij.psi.TokenType +import com.intellij.psi.codeStyle.CodeStyleSettings +import com.intellij.psi.formatter.FormatterUtil +import java.util.function.Predicate + +/** + * @author Nosov Aleksandr + */ +class FSBlock internal constructor( + private val node: ASTNode, + private val alignment: Alignment?, + private val indent: Indent?, + private val wrap: Wrap?, + private val codeStyleSettings: CodeStyleSettings, + private val spacingBuilder: SpacingBuilder +) : ASTBlock { + + private var subBlocks: MutableList? = null + + override fun getNode() = node + + override fun getTextRange(): TextRange = node.textRange + + override fun getSubBlocks(): List { + if (subBlocks == null) { + val isWhitespaceOrEmpty = Predicate { isWhitespaceOrEmpty(it) } + val strategy = createStrategy(getNode()) + + subBlocks = mutableListOf() + var subNode: ASTNode? = node.firstChildNode + while (subNode != null) { + if (isWhitespaceOrEmpty.test(subNode)) { + subNode = subNode.treeNext + continue + } + + val alignment = strategy?.getAlignment(getNode().elementType, subNode.elementType) + + val block = makeSubBlock(subNode, alignment) + subBlocks!!.add(block) + subNode = subNode.treeNext + } + } + return subBlocks as MutableList + } + + private fun createStrategy(node: ASTNode?): AlignmentStrategy.AlignmentPerTypeStrategy? { + return if (node == null) { + null + } else createAlignmentPerTypeStrategy(arrayListOf(node.elementType), node.elementType, true + ) + + } + + private fun makeSubBlock(node: ASTNode, alignment: Alignment?): FSBlock { + val wrap = Wrap.createWrap(WrapType.NONE, false) + val indent = calcIndent(node) + + return FSBlock(node, alignment, indent, wrap, codeStyleSettings, spacingBuilder) + } + + private fun calcIndent(node: ASTNode): Indent { + val parentType = this.node.elementType + val type = node.elementType + + if (parentType === FlexibleSearchTypes.QUERY_SPECIFICATION && type === FlexibleSearchTypes.SUBQUERY) { + return Indent.getNoneIndent() + } + if (type === FlexibleSearchTypes.LEFT_DOUBLE_BRACE || type === FlexibleSearchTypes.RIGHT_DOUBLE_BRACE) { + return Indent.getNormalIndent() + } + if (parentType === FlexibleSearchTypes.SUBQUERY && type === FlexibleSearchTypes.QUERY_SPECIFICATION) { + return Indent.getContinuationWithoutFirstIndent() + } + if (type === FlexibleSearchTypes.FROM_CLAUSE) { + return Indent.getNormalIndent() + } + if (type !== FROM && parentType === FROM_CLAUSE) { + return Indent.getNormalIndent() + } + if (type === ON || type === BOOLEAN_PREDICAND) { + return Indent.getNormalIndent() + } + if (isReturnBodyKeywords(node)) { + return Indent.getNormalIndent() + } + return if (type === FlexibleSearchTypes.WHERE) { + Indent.getNormalIndent() + } else Indent.getNoneIndent() + + } + + override fun getWrap() = wrap + override fun getIndent() = indent + override fun getAlignment() = alignment + + override fun getSpacing(child1: Block?, child2: Block): Spacing? { + return spacingBuilder.getSpacing(this, child1, child2) + } + + override fun getChildAttributes(newChildIndex: Int) = ChildAttributes(Indent.getNoneIndent(), null) + + override fun isIncomplete() = false + + override fun isLeaf() = node.firstChildNode == null + + private fun isWhitespaceOrEmpty(node: ASTNode): Boolean { + return node.elementType === TokenType.WHITE_SPACE || node.textLength == 0 + } + + private fun isReturnBodyKeywords(node: ASTNode): Boolean { + return FormatterUtil.isOneOf( + node, + FlexibleSearchTypes.LEFT, + FlexibleSearchTypes.JOIN, + FlexibleSearchTypes.ORDER + ) + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FSCodeStyleSettings.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FSCodeStyleSettings.java new file mode 100644 index 000000000..0ec31e579 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FSCodeStyleSettings.java @@ -0,0 +1,36 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.formatting; + +import com.intellij.psi.codeStyle.CodeStyleSettings; +import com.intellij.psi.codeStyle.CustomCodeStyleSettings; + +/** + * @author Nosov Aleksandr + */ +public class FSCodeStyleSettings extends CustomCodeStyleSettings { + + public static boolean SPACES_INSIDE_BRACES = true; + public static boolean SPACES_INSIDE_DOUBLE_BRACES = true; + public static boolean SPACE_AROUND_OP = true; + + public FSCodeStyleSettings(final CodeStyleSettings settings) { + super("FSCodeStyleSettings", settings); + } +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FSCodeStyleSettingsProvider.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FSCodeStyleSettingsProvider.java new file mode 100644 index 000000000..84ec7587d --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FSCodeStyleSettingsProvider.java @@ -0,0 +1,70 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.formatting; + +import com.intellij.application.options.CodeStyleAbstractConfigurable; +import com.intellij.application.options.CodeStyleAbstractPanel; +import com.intellij.application.options.TabbedLanguageCodeStylePanel; +import com.intellij.idea.plugin.hybris.flexibleSearch.FlexibleSearchLanguage; +import com.intellij.openapi.options.Configurable; +import com.intellij.psi.codeStyle.CodeStyleSettings; +import com.intellij.psi.codeStyle.CodeStyleSettingsProvider; +import com.intellij.psi.codeStyle.CustomCodeStyleSettings; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + + +public class FSCodeStyleSettingsProvider extends CodeStyleSettingsProvider { + + @Override + public CustomCodeStyleSettings createCustomSettings(final CodeStyleSettings settings) { + return new FSCodeStyleSettings(settings); + } + + @Nullable + @Override + public String getConfigurableDisplayName() { + return "FlexibleSearch"; + } + + @NotNull + @Override + public Configurable createSettingsPage(final CodeStyleSettings settings, final CodeStyleSettings modelSettings) { + return new CodeStyleAbstractConfigurable(settings, modelSettings, "FlexibleSearch") { + + @Override + protected CodeStyleAbstractPanel createPanel(final CodeStyleSettings settings) { + return new SimpleCodeStyleMainPanel(getCurrentSettings(), settings); + } + + @Nullable + @Override + public String getHelpTopic() { + return null; + } + }; + } + + private static class SimpleCodeStyleMainPanel extends TabbedLanguageCodeStylePanel { + + public SimpleCodeStyleMainPanel(final CodeStyleSettings currentSettings, final CodeStyleSettings settings) { + super(FlexibleSearchLanguage.getInstance(), currentSettings, settings); + } + } +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FSLanguageCodeStyleSettingsProvider.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FSLanguageCodeStyleSettingsProvider.java new file mode 100644 index 000000000..a0c61969a --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FSLanguageCodeStyleSettingsProvider.java @@ -0,0 +1,73 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.formatting; + +import com.intellij.idea.plugin.hybris.flexibleSearch.FlexibleSearchLanguage; +import com.intellij.lang.Language; +import com.intellij.psi.codeStyle.CodeStyleSettingsCustomizable; +import com.intellij.psi.codeStyle.CodeStyleSettingsCustomizableOptions; +import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider; +import org.jetbrains.annotations.NotNull; + +public class FSLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSettingsProvider { + + @NotNull + @Override + public Language getLanguage() { + return FlexibleSearchLanguage.getInstance(); + } + + @Override + public void customizeSettings( + @NotNull final CodeStyleSettingsCustomizable consumer, + @NotNull final SettingsType settingsType + ) { + if (SettingsType.SPACING_SETTINGS == settingsType) { + final var styleOptions = CodeStyleSettingsCustomizableOptions.getInstance(); + consumer.showCustomOption( + FSCodeStyleSettings.class, + "SPACE_AROUND_OP", + "Around comparision operator", + styleOptions.SPACES_AROUND_OPERATORS + ); + consumer.showCustomOption( + FSCodeStyleSettings.class, + "SPACES_INSIDE_BRACES", + "Inside braces", + styleOptions.SPACES_AROUND_OPERATORS + ); + consumer.showCustomOption( + FSCodeStyleSettings.class, + "SPACES_INSIDE_DOUBLE_BRACES", + "Inside double braces", + styleOptions.SPACES_AROUND_OPERATORS + ); + } else if (settingsType == SettingsType.BLANK_LINES_SETTINGS) { + consumer.showStandardOptions("KEEP_BLANK_LINES_IN_CODE"); + } + } + + @Override + public String getCodeSample(@NotNull final SettingsType settingsType) { + return "SELECT DISTINCT * FROM {Category AS c} WHERE NOT EXISTS (\n" + + " {{\n" + + " SELECT * FROM {CategoryCategoryRelation} WHERE{target}={c:pk}\n" + + " }}\n)"; + } +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FlexibleSearchFormattingModelBuilder.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FlexibleSearchFormattingModelBuilder.java new file mode 100644 index 000000000..a4ddacb66 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FlexibleSearchFormattingModelBuilder.java @@ -0,0 +1,99 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.formatting; + + +import com.intellij.formatting.*; +import com.intellij.idea.plugin.hybris.flexibleSearch.FlexibleSearchLanguage; +import com.intellij.lang.ASTNode; +import com.intellij.openapi.util.TextRange; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; +import com.intellij.psi.codeStyle.CodeStyleSettings; +import com.intellij.psi.tree.TokenSet; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.COMP_OP; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.FROM; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.FROM_CLAUSE; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.LEFT_BRACE; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.LEFT_DOUBLE_BRACE; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.ON; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.QUERY_SPECIFICATION; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.RIGHT_BRACE; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.RIGHT_DOUBLE_BRACE; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.SELECT_LIST; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.WHERE; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.WHERE_CLAUSE; + +public class FlexibleSearchFormattingModelBuilder implements FormattingModelBuilder { + + @Override + public @NotNull FormattingModel createModel(@NotNull FormattingContext formattingContext) { + return createModelInternally(formattingContext.getPsiElement(), formattingContext.getCodeStyleSettings()); + } + + @NotNull + private FormattingModel createModelInternally( + final PsiElement element, final CodeStyleSettings settings + ) { + + final FSBlock block = new FSBlock( + element.getNode(), + Alignment.createAlignment(), + Indent.getNoneIndent(), + Wrap.createWrap(WrapType.NONE, false), + settings, + createSpaceBuilder(settings) + ); + return FormattingModelProvider.createFormattingModelForPsiFile(element.getContainingFile(), block, settings); + } + + private static SpacingBuilder createSpaceBuilder(final CodeStyleSettings settings) { + return new SpacingBuilder(settings, FlexibleSearchLanguage.getInstance()) + .around(TokenSet.create(WHERE, FROM, SELECT_LIST, ON)) + .spaces(1) + .between(FROM_CLAUSE, WHERE_CLAUSE) + .spaces(1) + + .around(COMP_OP) + .spaceIf(FSCodeStyleSettings.SPACE_AROUND_OP) + + .before(RIGHT_BRACE) + .spaceIf(FSCodeStyleSettings.SPACES_INSIDE_BRACES) + .after(LEFT_BRACE) + .spaceIf(FSCodeStyleSettings.SPACES_INSIDE_BRACES) + + .before(RIGHT_DOUBLE_BRACE) + .spaceIf(FSCodeStyleSettings.SPACES_INSIDE_DOUBLE_BRACES) + .between(QUERY_SPECIFICATION, RIGHT_DOUBLE_BRACE) + .spaceIf(FSCodeStyleSettings.SPACES_INSIDE_DOUBLE_BRACES) + .after(LEFT_DOUBLE_BRACE) + .spaceIf(FSCodeStyleSettings.SPACES_INSIDE_DOUBLE_BRACES); + } + + @Nullable + @Override + public TextRange getRangeAffectingIndent( + final PsiFile file, final int offset, final ASTNode elementAtOffset + ) { + return null; + } +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/highlighting/FlexibleSearchColorSettingsPage.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/highlighting/FlexibleSearchColorSettingsPage.java new file mode 100644 index 000000000..7ea3546dc --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/highlighting/FlexibleSearchColorSettingsPage.java @@ -0,0 +1,132 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.highlighting; + +import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons; +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.editor.HighlighterColors; +import com.intellij.openapi.editor.colors.TextAttributesKey; +import com.intellij.openapi.fileTypes.SyntaxHighlighter; +import com.intellij.openapi.options.colors.AttributesDescriptor; +import com.intellij.openapi.options.colors.ColorDescriptor; +import com.intellij.openapi.options.colors.ColorSettingsPage; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import javax.swing.*; +import java.util.Map; + +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_BRACES; +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_BRACKETS; +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_COLUMN; +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_COMMENT; +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_KEYWORD; +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_NUMBER; +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_PARAMETER; +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_PARENTHESES; +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_SYMBOL; + +public class FlexibleSearchColorSettingsPage implements ColorSettingsPage { + + private static final AttributesDescriptor[] DESCRIPTORS = new AttributesDescriptor[]{ + new AttributesDescriptor("Comment", FS_COMMENT), + new AttributesDescriptor("Parameter", FS_PARAMETER), + new AttributesDescriptor("Keywords", FS_KEYWORD), + new AttributesDescriptor("Column", FS_COLUMN), + new AttributesDescriptor("Comma", FS_SYMBOL), + new AttributesDescriptor("Number", FS_NUMBER), + new AttributesDescriptor("Braces", FS_BRACES), + new AttributesDescriptor("Brackets", FS_BRACKETS), + new AttributesDescriptor("Parentheses", FS_PARENTHESES), + new AttributesDescriptor("Bad character", HighlighterColors.BAD_CHARACTER) + }; + + @Nullable + @Override + public Icon getIcon() { + return HybrisIcons.FS_FILE; + } + + @NotNull + @Override + public SyntaxHighlighter getHighlighter() { + return ServiceManager.getService(FlexibleSearchSyntaxHighlighter.class); + } + + @NotNull + @Override + public String getDemoText() { + return "SELECT {cat:pk} FROM {Category AS cat} WHERE NOT EXISTS (\n" + + " {{ SELECT * FROM {CategoryCategoryRelation} WHERE {target}={cat:pk} }}\n" + + ")\n" + + "\n" + + "SELECT * FROM {Product} WHERE {code} LIKE '%al%'\n" + + "\n" + + "\n" + + "SELECT * FROM {Product} WHERE {code} LIKE '%al%' AND {code} LIKE '%15%'\n" + + "\n" + + "SELECT * FROM {Product} WHERE {code} IS NULL\n" + + "\n" + + "SELECT * FROM {Product} WHERE {code} NOT LIKE '%al%' AND {code} NOT LIKE '%15%' OR {code} IS NULL\n" + + "\n" + + "SELECT * FROM {Product} WHERE {code} LIKE '%al%' AND {code} NOT LIKE '%15%'\n" + + "\n" + + "SELECT * FROM {Product} WHERE {code} IS NOT NULL\n" + + "\n" + + "SELECT {cat:pk} FROM {Category AS cat} WHERE NOT EXISTS (\n" + + " {{ SELECT * FROM {CategoryCategoryRelation} WHERE {target}={cat.spk} }}\n" + + ")\n" + + "\n" + + "SELECT {code},{pk} FROM {Product} ORDER BY {code} DESC\n" + + "\n" + + "SELECT {pk} FROM {Product} WHERE {modifiedtime} >= ?startDate AND {modifiedtime} <= ?endDate\n" + + "\n" + + "SELECT {p:PK}\n" + + " FROM {Product AS p}\n" + + " WHERE {p:code} LIKE '%myProduct'\n" + + " OR {p:name} LIKE '%myProduct'\n" + + " ORDER BY {p:code} ASC\n" + + "\n" + + "@@@@@\n"; + } + + @Nullable + @Override + public Map getAdditionalHighlightingTagToDescriptorMap() { + return null; + } + + @NotNull + @Override + public AttributesDescriptor[] getAttributeDescriptors() { + return DESCRIPTORS; + } + + @NotNull + @Override + public ColorDescriptor[] getColorDescriptors() { + return ColorDescriptor.EMPTY_ARRAY; + } + + @NotNull + @Override + public String getDisplayName() { + return "FlexibleSearch"; + } +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/highlighting/FlexibleSearchHighlighterColors.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/highlighting/FlexibleSearchHighlighterColors.java new file mode 100644 index 000000000..40c9ed1b6 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/highlighting/FlexibleSearchHighlighterColors.java @@ -0,0 +1,75 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.highlighting; + +import com.intellij.openapi.editor.colors.TextAttributesKey; +import com.intellij.openapi.editor.markup.TextAttributes; +import com.intellij.ui.JBColor; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; + +import java.awt.*; + +import static com.intellij.ide.highlighter.JavaHighlightingColors.CLASS_NAME_ATTRIBUTES; +import static com.intellij.openapi.editor.DefaultLanguageHighlighterColors.BRACES; +import static com.intellij.openapi.editor.DefaultLanguageHighlighterColors.BRACKETS; +import static com.intellij.openapi.editor.DefaultLanguageHighlighterColors.INSTANCE_FIELD; +import static com.intellij.openapi.editor.DefaultLanguageHighlighterColors.KEYWORD; +import static com.intellij.openapi.editor.DefaultLanguageHighlighterColors.LINE_COMMENT; +import static com.intellij.openapi.editor.DefaultLanguageHighlighterColors.NUMBER; +import static com.intellij.openapi.editor.DefaultLanguageHighlighterColors.PARENTHESES; +import static com.intellij.openapi.editor.DefaultLanguageHighlighterColors.STRING; + +public final class FlexibleSearchHighlighterColors { + + private FlexibleSearchHighlighterColors() { + } + + public static final TextAttributesKey FS_KEYWORD = key("KEYWORD", KEYWORD); + public static final TextAttributesKey FS_STRING = key("STRING", STRING); + + public static final TextAttributesKey FS_BRACES = key("BRACES", BRACES); + public static final TextAttributesKey FS_PARENTHESES = key("PARENTHESES", PARENTHESES); + public static final TextAttributesKey FS_BRACKETS = key("BRACKETS", BRACKETS); + + public static final TextAttributesKey FS_SYMBOL = key("COMMA", KEYWORD); + public static final TextAttributesKey FS_NUMBER = key("NUMBER", NUMBER); + + public static final TextAttributesKey FS_COLUMN = key("COLUMN", INSTANCE_FIELD); + public static final TextAttributesKey FS_TABLE = key("TABLE NAME", CLASS_NAME_ATTRIBUTES); + + public static final TextAttributesKey FS_COMMENT = key("COMMENT", LINE_COMMENT); + + public static final TextAttributesKey FS_PARAMETER = + TextAttributesKey.createTextAttributesKey("FS_PARAMETER", new TextAttributes( + new JBColor(0x0D96D9, 0x0097C5), + null, + null, + null, + Font.PLAIN + )); + + + private static TextAttributesKey key( + @NonNls @NotNull final String externalName, + final TextAttributesKey fallbackAttributeKey + ) { + return TextAttributesKey.createTextAttributesKey(externalName, fallbackAttributeKey); + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/highlighting/FlexibleSearchSyntaxHighlighter.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/highlighting/FlexibleSearchSyntaxHighlighter.java new file mode 100644 index 000000000..2482bc5e4 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/highlighting/FlexibleSearchSyntaxHighlighter.java @@ -0,0 +1,163 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.highlighting; + +import com.intellij.idea.plugin.hybris.flexibleSearch.FlexibleSearchLexerAdapter; +import com.intellij.idea.plugin.hybris.flexibleSearch.FlexibleSearchParserDefinition; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes; +import com.intellij.lexer.Lexer; +import com.intellij.openapi.editor.HighlighterColors; +import com.intellij.openapi.editor.colors.TextAttributesKey; +import com.intellij.openapi.fileTypes.SyntaxHighlighterBase; +import com.intellij.psi.TokenType; +import com.intellij.psi.tree.IElementType; +import com.intellij.psi.tree.TokenSet; +import org.jetbrains.annotations.NotNull; + +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_BRACES; +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_BRACKETS; +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_COLUMN; +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_COMMENT; +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_KEYWORD; +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_NUMBER; +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_PARAMETER; +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_PARENTHESES; +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_STRING; +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_SYMBOL; +import static com.intellij.idea.plugin.hybris.flexibleSearch.highlighting.FlexibleSearchHighlighterColors.FS_TABLE; + +public class FlexibleSearchSyntaxHighlighter extends SyntaxHighlighterBase { + + private static final TokenSet BRACES_TOKEN_SET = TokenSet.create( + FlexibleSearchTypes.LEFT_BRACE, + FlexibleSearchTypes.LEFT_DOUBLE_BRACE, + FlexibleSearchTypes.RIGHT_BRACE, + FlexibleSearchTypes.RIGHT_DOUBLE_BRACE + ); + private static final TokenSet BRACKETS_TOKEN_SET = TokenSet.create( + FlexibleSearchTypes.LEFT_BRACKET, + FlexibleSearchTypes.RIGHT_BRACKET + ); + private static final TokenSet PARENTHESES_TOKEN_SET = TokenSet.create( + FlexibleSearchTypes.LEFT_PAREN, + FlexibleSearchTypes.RIGHT_PAREN + ); + + private static final TokenSet SYMBOL_TOKEN_SET = TokenSet.create( + FlexibleSearchTypes.DOT, + FlexibleSearchTypes.COLON, + FlexibleSearchTypes.COMMA + ); + + private static final TokenSet COLUMN_TOKEN_SET = TokenSet.create( + FlexibleSearchTypes.COLUMN_REFERENCE_IDENTIFIER + ); + + private static final TokenSet TABLE_NAME_TOKEN_SET = TokenSet.create( + FlexibleSearchTypes.TABLE_NAME_IDENTIFIER + ); + + private static final TokenSet PARAMETER_REFERENCE_TOKEN_SET = TokenSet.create( + FlexibleSearchTypes.QUESTION_MARK, + FlexibleSearchTypes.PARAMETER_IDENTIFIER + ); + + private static final TokenSet KEYWORD_TOKEN_SET = TokenSet.create( + FlexibleSearchTypes.SELECT, + FlexibleSearchTypes.FROM, + FlexibleSearchTypes.WHERE, + FlexibleSearchTypes.DISTINCT, + FlexibleSearchTypes.GROUP, + FlexibleSearchTypes.AS, + FlexibleSearchTypes.IS, + FlexibleSearchTypes.NULL, + FlexibleSearchTypes.LIKE, + FlexibleSearchTypes.AND, + FlexibleSearchTypes.OR, + FlexibleSearchTypes.IN, + FlexibleSearchTypes.ORDER, + FlexibleSearchTypes.BY, + FlexibleSearchTypes.DESC, + FlexibleSearchTypes.ASC, + FlexibleSearchTypes.ALL, + FlexibleSearchTypes.JOIN, + FlexibleSearchTypes.ON, + FlexibleSearchTypes.LEFT, + FlexibleSearchTypes.UNION, + FlexibleSearchTypes.NOT, + FlexibleSearchTypes.EXISTS + ); + + public static final TextAttributesKey[] KEYWORD_KEYS = pack(FS_KEYWORD); + public static final TextAttributesKey[] STRING_KEYS = pack(FS_STRING); + public static final TextAttributesKey[] SYMBOL_KEYS = pack(FS_SYMBOL); + + public static final TextAttributesKey[] BRACES_KEYS = pack(FS_BRACES); + public static final TextAttributesKey[] BRACKETS_KEYS = pack(FS_BRACKETS); + public static final TextAttributesKey[] PARENTHESES_KEYS = pack(FS_PARENTHESES); + + public static final TextAttributesKey[] NUMBER_KEYS = pack(FS_NUMBER); + + public static final TextAttributesKey[] COLUMN_KEYS = pack(FS_COLUMN); + public static final TextAttributesKey[] TABLE_KEYS = pack(FS_TABLE); + + public static final TextAttributesKey[] COMMENT_KEYS = pack(FS_COMMENT); + + public static final TextAttributesKey[] BAD_CHARACTER_KEYS = pack(HighlighterColors.BAD_CHARACTER); + + private static final TextAttributesKey[] EMPTY_KEYS = new TextAttributesKey[0]; + + @NotNull + @Override + public Lexer getHighlightingLexer() { + return new FlexibleSearchLexerAdapter(); + } + + @NotNull + @Override + public TextAttributesKey[] getTokenHighlights(IElementType tokenType) { + if (KEYWORD_TOKEN_SET.contains(tokenType)) { + return KEYWORD_KEYS; + } else if (tokenType.equals(FlexibleSearchTypes.STRING)) { + return STRING_KEYS; + } else if (SYMBOL_TOKEN_SET.contains(tokenType)) { + return SYMBOL_KEYS; + } else if (COLUMN_TOKEN_SET.contains(tokenType)) { + return COLUMN_KEYS; + } else if (TABLE_NAME_TOKEN_SET.contains(tokenType)) { + return TABLE_KEYS; + } else if (PARAMETER_REFERENCE_TOKEN_SET.contains(tokenType)) { + return pack(FS_PARAMETER); + } else if (BRACES_TOKEN_SET.contains(tokenType)) { + return BRACES_KEYS; + } else if (BRACKETS_TOKEN_SET.contains(tokenType)) { + return BRACKETS_KEYS; + } else if (PARENTHESES_TOKEN_SET.contains(tokenType)) { + return PARENTHESES_KEYS; + } else if (tokenType.equals(FlexibleSearchTypes.NUMBER)) { + return NUMBER_KEYS; + } else if (tokenType.equals(FlexibleSearchParserDefinition.COMMENT)) { + return COMMENT_KEYS; + } else if (tokenType.equals(TokenType.BAD_CHARACTER)) { + return STRING_KEYS; + } else { + return EMPTY_KEYS; + } + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/impex/view/ImpexStructureViewComponent.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/highlighting/FlexibleSearchSyntaxHighlighterFactory.java similarity index 58% rename from src/com/intellij/idea/plugin/hybris/impex/view/ImpexStructureViewComponent.java rename to src/com/intellij/idea/plugin/hybris/flexibleSearch/highlighting/FlexibleSearchSyntaxHighlighterFactory.java index d0099a210..6ead5ec90 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/view/ImpexStructureViewComponent.java +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/highlighting/FlexibleSearchSyntaxHighlighterFactory.java @@ -16,24 +16,19 @@ * along with this program. If not, see . */ -package com.intellij.idea.plugin.hybris.impex.view; +package com.intellij.idea.plugin.hybris.flexibleSearch.highlighting; -import com.intellij.ide.structureView.StructureViewModel; -import com.intellij.ide.structureView.newStructureView.StructureViewComponent; -import com.intellij.openapi.fileEditor.FileEditor; +import com.intellij.openapi.fileTypes.SyntaxHighlighter; +import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory; import com.intellij.openapi.project.Project; +import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; -/** - * Created by Martin Zdarsky-Jones (martin.zdarsky@hybris.com) on 7/3/17. - */ -public class ImpexStructureViewComponent extends StructureViewComponent { +public class FlexibleSearchSyntaxHighlighterFactory extends SyntaxHighlighterFactory { - public ImpexStructureViewComponent( - final FileEditor editor, - @NotNull final StructureViewModel structureViewModel, - @NotNull final Project project - ) { - super(editor, structureViewModel, project, false); + @NotNull + @Override + public SyntaxHighlighter getSyntaxHighlighter(Project project, VirtualFile virtualFile) { + return new FlexibleSearchSyntaxHighlighter(); } -} +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/injection/FlexibleSearchInjector.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/injection/FlexibleSearchInjector.java new file mode 100644 index 000000000..5dc53df84 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/injection/FlexibleSearchInjector.java @@ -0,0 +1,94 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.injection; + +import com.intellij.idea.plugin.hybris.flexibleSearch.FlexibleSearchLanguage; +import com.intellij.idea.plugin.hybris.impex.psi.impl.ImpexStringImpl; +import com.intellij.lang.Language; +import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.progress.ProcessCanceledException; +import com.intellij.openapi.util.TextRange; +import com.intellij.openapi.util.text.StringUtil; +import com.intellij.psi.InjectedLanguagePlaces; +import com.intellij.psi.LanguageInjector; +import com.intellij.psi.PsiClass; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiLanguageInjectionHost; +import com.intellij.psi.PsiMethod; +import com.intellij.psi.impl.source.tree.java.PsiMethodCallExpressionImpl; +import org.jetbrains.annotations.NotNull; + +/** + * @author Nosov Aleksandr + */ +public class FlexibleSearchInjector implements LanguageInjector { + + private static final Logger LOG = Logger.getInstance(FlexibleSearchInjector.class); + + @Override + public void getLanguagesToInject( + @NotNull final PsiLanguageInjectionHost host, + @NotNull final InjectedLanguagePlaces injectionPlacesRegistrar + ) { + final PsiElement hostParent = host.getParent(); + if (host instanceof ImpexStringImpl) { + final String hostString = StringUtil.unquoteString(host.getText()).toLowerCase(); + if (StringUtil.trim(hostString).startsWith("select ")) { + registerInjectionPlace(injectionPlacesRegistrar, host); + } + } + + if (hostParent != null) { + if (hostParent.getParent() instanceof PsiMethodCallExpressionImpl) { + final PsiMethodCallExpressionImpl callExpression = (PsiMethodCallExpressionImpl) hostParent.getParent(); + final PsiMethod method = callExpression.resolveMethod(); + if (method != null) { + final PsiClass containingClass = method.getContainingClass(); + if (containingClass != null + && "FlexibleSearchService".equals(containingClass.getName()) + && "search".equals(method.getName())) { + + registerInjectionPlace(injectionPlacesRegistrar, host); + } + } + } + } + } + + private void registerInjectionPlace( + @NotNull final InjectedLanguagePlaces injectionPlacesRegistrar, + @NotNull final PsiElement host + ) { + final Language language = FlexibleSearchLanguage.getInstance(); + if (language != null) { + try { + injectionPlacesRegistrar.addPlace( + language, + TextRange.from(1, host.getTextLength() - 2), + null, + null + ); + } catch (ProcessCanceledException e) { + // ignore + } catch (Throwable e) { + LOG.error(e); + } + } + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/lang/FlexibleSearchPairedBraceMatcher.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/lang/FlexibleSearchPairedBraceMatcher.java new file mode 100644 index 000000000..a4a809bbf --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/lang/FlexibleSearchPairedBraceMatcher.java @@ -0,0 +1,61 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.lang; + +import com.intellij.lang.BracePair; +import com.intellij.lang.PairedBraceMatcher; +import com.intellij.psi.PsiFile; +import com.intellij.psi.tree.IElementType; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.LEFT_BRACE; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.LEFT_BRACKET; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.LEFT_DOUBLE_BRACE; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.LEFT_PAREN; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.RIGHT_BRACE; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.RIGHT_BRACKET; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.RIGHT_DOUBLE_BRACE; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.RIGHT_PAREN; + +public class FlexibleSearchPairedBraceMatcher implements PairedBraceMatcher { + + private static final BracePair[] PAIRS = new BracePair[]{ + new BracePair(LEFT_BRACE, RIGHT_BRACE, false), + new BracePair(LEFT_BRACKET, RIGHT_BRACKET, false), + new BracePair(LEFT_DOUBLE_BRACE, RIGHT_DOUBLE_BRACE, false), + new BracePair(LEFT_PAREN, RIGHT_PAREN, false), + }; + + public BracePair[] getPairs() { + return PAIRS; + } + + @Override + public boolean isPairedBracesAllowedBeforeType( + @NotNull final IElementType lbraceType, @Nullable final IElementType contextType + ) { + return true; + } + + @Override + public int getCodeConstructStart(final PsiFile file, final int openingBraceOffset) { + return openingBraceOffset; + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchAggregateFunction.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchAggregateFunction.java new file mode 100644 index 000000000..007a49462 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchAggregateFunction.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchAggregateFunction extends PsiElement { + + @Nullable + FlexibleSearchGeneralSetFunction getGeneralSetFunction(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBasicIdentifierChain.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBasicIdentifierChain.java new file mode 100644 index 000000000..825be450d --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBasicIdentifierChain.java @@ -0,0 +1,30 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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 . + */ + +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; + +public interface FlexibleSearchBasicIdentifierChain extends PsiElement { + + @NotNull + FlexibleSearchIdentifierChain getIdentifierChain(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBetweenPredicate.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBetweenPredicate.java new file mode 100644 index 000000000..f4df2d247 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBetweenPredicate.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchBetweenPredicate extends PsiElement { + + @NotNull + List getRowValuePredicandList(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBetweenPredicatePart2.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBetweenPredicatePart2.java new file mode 100644 index 000000000..21f09d2f1 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBetweenPredicatePart2.java @@ -0,0 +1,32 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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 . + */ + +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; + +import java.util.List; + +public interface FlexibleSearchBetweenPredicatePart2 extends PsiElement { + + @NotNull + List getRowValuePredicandList(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBooleanFactor.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBooleanFactor.java new file mode 100644 index 000000000..4605a85c0 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBooleanFactor.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchBooleanFactor extends PsiElement { + + @NotNull + FlexibleSearchBooleanTest getBooleanTest(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBooleanPredicand.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBooleanPredicand.java new file mode 100644 index 000000000..11bf9c5b1 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBooleanPredicand.java @@ -0,0 +1,16 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchBooleanPredicand extends PsiElement { + + @Nullable + FlexibleSearchBooleanValueExpression getBooleanValueExpression(); + + @Nullable + FlexibleSearchColumnReference getColumnReference(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBooleanPrimary.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBooleanPrimary.java new file mode 100644 index 000000000..c0922073d --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBooleanPrimary.java @@ -0,0 +1,16 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchBooleanPrimary extends PsiElement { + + @Nullable + FlexibleSearchBooleanPredicand getBooleanPredicand(); + + @Nullable + FlexibleSearchPredicate getPredicate(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBooleanTerm.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBooleanTerm.java new file mode 100644 index 000000000..aec00a090 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBooleanTerm.java @@ -0,0 +1,16 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchBooleanTerm extends PsiElement { + + @NotNull + FlexibleSearchBooleanFactor getBooleanFactor(); + + @NotNull + List getBooleanTermList(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBooleanTest.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBooleanTest.java new file mode 100644 index 000000000..d3d827540 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBooleanTest.java @@ -0,0 +1,16 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchBooleanTest extends PsiElement { + + @NotNull + FlexibleSearchBooleanPrimary getBooleanPrimary(); + + @Nullable + FlexibleSearchTruthValue getTruthValue(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBooleanValueExpression.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBooleanValueExpression.java new file mode 100644 index 000000000..6172461ca --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchBooleanValueExpression.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchBooleanValueExpression extends PsiElement { + + @NotNull + FlexibleSearchBooleanTerm getBooleanTerm(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCharacterLikePredicate.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCharacterLikePredicate.java new file mode 100644 index 000000000..48f7937f4 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCharacterLikePredicate.java @@ -0,0 +1,19 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchCharacterLikePredicate extends PsiElement { + + @Nullable + FlexibleSearchCharacterPattern getCharacterPattern(); + + @NotNull + FlexibleSearchRowValuePredicand getRowValuePredicand(); + + @Nullable + FlexibleSearchValueExpression getValueExpression(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCharacterLikePredicatePart2.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCharacterLikePredicatePart2.java new file mode 100644 index 000000000..0002edeba --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCharacterLikePredicatePart2.java @@ -0,0 +1,33 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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 . + */ + +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.Nullable; + +public interface FlexibleSearchCharacterLikePredicatePart2 extends PsiElement { + + @Nullable + FlexibleSearchCharacterPattern getCharacterPattern(); + + @Nullable + FlexibleSearchValueExpression getValueExpression(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCharacterPattern.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCharacterPattern.java new file mode 100644 index 000000000..6f76792f8 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCharacterPattern.java @@ -0,0 +1,16 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchCharacterPattern extends PsiElement { + + @Nullable + FlexibleSearchStringValueFunction getStringValueFunction(); + + @Nullable + PsiElement getString(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCharacterStringLiteral.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCharacterStringLiteral.java new file mode 100644 index 000000000..1c6f81200 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCharacterStringLiteral.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchCharacterStringLiteral extends PsiElement { + + @NotNull + PsiElement getString(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCharacterSubstringFunction.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCharacterSubstringFunction.java new file mode 100644 index 000000000..122ccb1ce --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCharacterSubstringFunction.java @@ -0,0 +1,16 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchCharacterSubstringFunction extends PsiElement { + + @Nullable + FlexibleSearchCharacterSubstringFunction getCharacterSubstringFunction(); + + @NotNull + List getStringValueExpressionList(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCharacterValueFunction.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCharacterValueFunction.java new file mode 100644 index 000000000..d12382564 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCharacterValueFunction.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchCharacterValueFunction extends PsiElement { + + @NotNull + FlexibleSearchCharacterSubstringFunction getCharacterSubstringFunction(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchColumnLocalization.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchColumnLocalization.java new file mode 100644 index 000000000..f24542048 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchColumnLocalization.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchColumnLocalization extends PsiElement { + + @NotNull + PsiElement getIdentifier(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchColumnReference.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchColumnReference.java new file mode 100644 index 000000000..f6bc720da --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchColumnReference.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchColumnReference extends PsiElement { + + @Nullable + PsiElement getTableNameIdentifier(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchComment.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchComment.java new file mode 100644 index 000000000..0e9e51167 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchComment.java @@ -0,0 +1,30 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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 . + */ + +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; + +public interface FlexibleSearchComment extends PsiElement { + + @NotNull + PsiElement getEndOfLineComment(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCommonValueExpression.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCommonValueExpression.java new file mode 100644 index 000000000..826630378 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCommonValueExpression.java @@ -0,0 +1,16 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchCommonValueExpression extends PsiElement { + + @Nullable + FlexibleSearchStringValueExpression getStringValueExpression(); + + @Nullable + PsiElement getNumber(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCompOp.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCompOp.java new file mode 100644 index 000000000..0c563d7d8 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCompOp.java @@ -0,0 +1,19 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchCompOp extends PsiElement { + + @Nullable + PsiElement getEqualsOperator(); + + @Nullable + PsiElement getGreaterThanOrEqualsOperator(); + + @Nullable + PsiElement getLessThanOrEqualsOperator(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/statistics/impl/StatsResponse.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchComparisonPredicate.java similarity index 68% rename from src/com/intellij/idea/plugin/hybris/statistics/impl/StatsResponse.java rename to src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchComparisonPredicate.java index 14679eee1..43ce40846 100644 --- a/src/com/intellij/idea/plugin/hybris/statistics/impl/StatsResponse.java +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchComparisonPredicate.java @@ -16,25 +16,20 @@ * along with this program. If not, see . */ -package com.intellij.idea.plugin.hybris.statistics.impl; +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; -import org.apache.http.HttpResponse; +import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; -/** - * Created by Martin Zdarsky-Jones (martin.zdarsky@hybris.com) on 28/2/17. - */ -public class StatsResponse { +import java.util.List; - @NotNull - private HttpResponse response; +public interface FlexibleSearchComparisonPredicate extends PsiElement { - public StatsResponse(@NotNull HttpResponse response) { - this.response = response; - } + @NotNull + FlexibleSearchCompOp getCompOp(); @NotNull - public HttpResponse getResponse() { - return response; - } + List getRowValuePredicandList(); + } diff --git a/src/com/intellij/idea/plugin/hybris/impex/file/ImpexFileTypeFactory.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchComparisonPredicatePart2.java similarity index 67% rename from src/com/intellij/idea/plugin/hybris/impex/file/ImpexFileTypeFactory.java rename to src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchComparisonPredicatePart2.java index b47e629ea..013ff3921 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/file/ImpexFileTypeFactory.java +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchComparisonPredicatePart2.java @@ -16,17 +16,18 @@ * along with this program. If not, see . */ -package com.intellij.idea.plugin.hybris.impex.file; +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; -import com.intellij.openapi.fileTypes.FileTypeConsumer; -import com.intellij.openapi.fileTypes.FileTypeFactory; +import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; -public class ImpexFileTypeFactory extends FileTypeFactory { +public interface FlexibleSearchComparisonPredicatePart2 extends PsiElement { - @Override - public void createFileTypes(@NotNull final FileTypeConsumer consumer) { - consumer.consume(ImpexFileType.getInstance(), ImpexFileType.getInstance().getDefaultExtension()); - } + @NotNull + FlexibleSearchCompOp getCompOp(); + + @NotNull + FlexibleSearchRowValuePredicand getRowValuePredicand(); } diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchComputationalOperation.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchComputationalOperation.java new file mode 100644 index 000000000..eabecc98a --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchComputationalOperation.java @@ -0,0 +1,26 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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 . + */ + +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchComputationalOperation extends PsiElement { + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCorrelationName.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCorrelationName.java new file mode 100644 index 000000000..5e7a92758 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchCorrelationName.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchCorrelationName extends PsiElement { + + @NotNull + PsiElement getIdentifier(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchDerivedColumn.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchDerivedColumn.java new file mode 100644 index 000000000..f2d2927a4 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchDerivedColumn.java @@ -0,0 +1,16 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchDerivedColumn extends PsiElement { + + @Nullable + FlexibleSearchCorrelationName getCorrelationName(); + + @NotNull + FlexibleSearchValueExpression getValueExpression(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchElementType.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchElementType.java new file mode 100644 index 000000000..58765a47d --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchElementType.java @@ -0,0 +1,31 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.psi; + +import com.intellij.idea.plugin.hybris.flexibleSearch.FlexibleSearchLanguage; +import com.intellij.psi.tree.IElementType; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; + +public class FlexibleSearchElementType extends IElementType { + + public FlexibleSearchElementType(@NotNull @NonNls final String debugName) { + super(debugName, FlexibleSearchLanguage.getInstance()); + } +} diff --git a/settings.gradle b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchEndOfExpression.java similarity index 78% rename from settings.gradle rename to src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchEndOfExpression.java index 862c3f58d..3d17a419d 100644 --- a/settings.gradle +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchEndOfExpression.java @@ -16,7 +16,11 @@ * along with this program. If not, see . */ -rootProject.name = "Hybris-Integration" +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; -include ":common" -include ":rt-ant" +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchEndOfExpression extends PsiElement { + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchExistsPredicate.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchExistsPredicate.java new file mode 100644 index 000000000..6599d5773 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchExistsPredicate.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchExistsPredicate extends PsiElement { + + @NotNull + FlexibleSearchTableSubquery getTableSubquery(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchFromClause.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchFromClause.java new file mode 100644 index 000000000..4d3cc7644 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchFromClause.java @@ -0,0 +1,22 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchFromClause extends PsiElement { + + @Nullable + FlexibleSearchSubquery getSubquery(); + + @Nullable + FlexibleSearchTableReferenceList getTableReferenceList(); + + @Nullable + PsiElement getLeftBrace(); + + @Nullable + PsiElement getRightBrace(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGeneralLiteral.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGeneralLiteral.java new file mode 100644 index 000000000..880793b78 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGeneralLiteral.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchGeneralLiteral extends PsiElement { + + @NotNull + FlexibleSearchCharacterStringLiteral getCharacterStringLiteral(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGeneralSetFunction.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGeneralSetFunction.java new file mode 100644 index 000000000..58e268c72 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGeneralSetFunction.java @@ -0,0 +1,22 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchGeneralSetFunction extends PsiElement { + + @Nullable + FlexibleSearchCorrelationName getCorrelationName(); + + @NotNull + FlexibleSearchSetFunctionType getSetFunctionType(); + + @Nullable + FlexibleSearchSetQuantifier getSetQuantifier(); + + @NotNull + FlexibleSearchValueExpression getValueExpression(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGreaterThanOrEqualsOperator.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGreaterThanOrEqualsOperator.java new file mode 100644 index 000000000..9f4c35085 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGreaterThanOrEqualsOperator.java @@ -0,0 +1,26 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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 . + */ + +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchGreaterThanOrEqualsOperator extends PsiElement { + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGroupByClause.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGroupByClause.java new file mode 100644 index 000000000..311d60967 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGroupByClause.java @@ -0,0 +1,16 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchGroupByClause extends PsiElement { + + @NotNull + FlexibleSearchGroupingElementList getGroupingElementList(); + + @Nullable + FlexibleSearchSetQuantifier getSetQuantifier(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGroupingColumnReference.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGroupingColumnReference.java new file mode 100644 index 000000000..dae7ed310 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGroupingColumnReference.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchGroupingColumnReference extends PsiElement { + + @NotNull + FlexibleSearchValueExpression getValueExpression(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGroupingColumnReferenceList.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGroupingColumnReferenceList.java new file mode 100644 index 000000000..710e31e5b --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGroupingColumnReferenceList.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchGroupingColumnReferenceList extends PsiElement { + + @NotNull + List getGroupingColumnReferenceList(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGroupingElement.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGroupingElement.java new file mode 100644 index 000000000..35930de7b --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGroupingElement.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchGroupingElement extends PsiElement { + + @NotNull + FlexibleSearchOrdinaryGroupingSet getOrdinaryGroupingSet(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGroupingElementList.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGroupingElementList.java new file mode 100644 index 000000000..229a40ac7 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchGroupingElementList.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchGroupingElementList extends PsiElement { + + @NotNull + List getGroupingElementList(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchIdentifier.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchIdentifier.java new file mode 100644 index 000000000..0e0e5d0d8 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchIdentifier.java @@ -0,0 +1,30 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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 . + */ + +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; + +public interface FlexibleSearchIdentifier extends PsiElement { + + @NotNull + PsiElement getId(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/SolrConsole.kt b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchIdentifierChain.java similarity index 77% rename from src/com/intellij/idea/plugin/hybris/tools/remote/console/SolrConsole.kt rename to src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchIdentifierChain.java index e87fdf0f9..ba5e05ac1 100644 --- a/src/com/intellij/idea/plugin/hybris/tools/remote/console/SolrConsole.kt +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchIdentifierChain.java @@ -3,8 +3,8 @@ * Copyright (C) 2014-2016 Alexander Bartash * * 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 + * 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, @@ -16,14 +16,11 @@ * along with this program. If not, see . */ -package com.intellij.idea.plugin.hybris.tools.remote.console +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; -import com.intellij.openapi.ui.ComboBox +import com.intellij.psi.PsiElement; -/** - * @author Nosov Aleksandr - */ -interface SolrConsole { +public interface FlexibleSearchIdentifierChain extends PsiElement { - val coresComboBox: ComboBox -} \ No newline at end of file +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchInPredicate.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchInPredicate.java new file mode 100644 index 000000000..2aee7af43 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchInPredicate.java @@ -0,0 +1,16 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchInPredicate extends PsiElement { + + @NotNull + List getRowValuePredicandList(); + + @Nullable + FlexibleSearchTableSubquery getTableSubquery(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchJoinCondition.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchJoinCondition.java new file mode 100644 index 000000000..85b66278f --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchJoinCondition.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchJoinCondition extends PsiElement { + + @Nullable + FlexibleSearchSearchCondition getSearchCondition(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchJoinSpecification.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchJoinSpecification.java new file mode 100644 index 000000000..97dc92011 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchJoinSpecification.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchJoinSpecification extends PsiElement { + + @NotNull + FlexibleSearchJoinCondition getJoinCondition(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchJoinType.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchJoinType.java new file mode 100644 index 000000000..3df8a8721 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchJoinType.java @@ -0,0 +1,10 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchJoinType extends PsiElement { + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchJoinedTable.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchJoinedTable.java new file mode 100644 index 000000000..cb47a84b4 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchJoinedTable.java @@ -0,0 +1,19 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchJoinedTable extends PsiElement { + + @Nullable + FlexibleSearchJoinSpecification getJoinSpecification(); + + @Nullable + FlexibleSearchJoinType getJoinType(); + + @Nullable + FlexibleSearchTableReference getTableReference(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchLang.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchLang.java new file mode 100644 index 000000000..6b63ce554 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchLang.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchLang extends PsiElement { + + @NotNull + PsiElement getIdentifier(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchLessThanOrEqualsOperator.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchLessThanOrEqualsOperator.java new file mode 100644 index 000000000..ce3505d41 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchLessThanOrEqualsOperator.java @@ -0,0 +1,26 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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 . + */ + +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchLessThanOrEqualsOperator extends PsiElement { + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchLikePredicate.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchLikePredicate.java new file mode 100644 index 000000000..76f204bdd --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchLikePredicate.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchLikePredicate extends PsiElement { + + @NotNull + FlexibleSearchCharacterLikePredicate getCharacterLikePredicate(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchNonparenthesizedValueExpressionPrimary.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchNonparenthesizedValueExpressionPrimary.java new file mode 100644 index 000000000..8e22cf12d --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchNonparenthesizedValueExpressionPrimary.java @@ -0,0 +1,30 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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 . + */ + +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; + +public interface FlexibleSearchNonparenthesizedValueExpressionPrimary extends PsiElement { + + @NotNull + FlexibleSearchBooleanValueExpression getBooleanValueExpression(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchNotEqualsOperator.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchNotEqualsOperator.java new file mode 100644 index 000000000..6a7bad82c --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchNotEqualsOperator.java @@ -0,0 +1,26 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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 . + */ + +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchNotEqualsOperator extends PsiElement { + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchNullOrdering.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchNullOrdering.java new file mode 100644 index 000000000..ff91e9003 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchNullOrdering.java @@ -0,0 +1,10 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchNullOrdering extends PsiElement { + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchNullPredicate.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchNullPredicate.java new file mode 100644 index 000000000..5824bb507 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchNullPredicate.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchNullPredicate extends PsiElement { + + @NotNull + FlexibleSearchRowValuePredicand getRowValuePredicand(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchNullPredicatePart2.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchNullPredicatePart2.java new file mode 100644 index 000000000..e272b047a --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchNullPredicatePart2.java @@ -0,0 +1,26 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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 . + */ + +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchNullPredicatePart2 extends PsiElement { + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchOrderByClause.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchOrderByClause.java new file mode 100644 index 000000000..65f5a923b --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchOrderByClause.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchOrderByClause extends PsiElement { + + @Nullable + FlexibleSearchSortSpecificationList getSortSpecificationList(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchOrderingSpecification.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchOrderingSpecification.java new file mode 100644 index 000000000..cf75c3d5b --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchOrderingSpecification.java @@ -0,0 +1,10 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchOrderingSpecification extends PsiElement { + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchOrdinaryGroupingSet.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchOrdinaryGroupingSet.java new file mode 100644 index 000000000..ca289b7c8 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchOrdinaryGroupingSet.java @@ -0,0 +1,16 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchOrdinaryGroupingSet extends PsiElement { + + @Nullable + FlexibleSearchGroupingColumnReference getGroupingColumnReference(); + + @Nullable + FlexibleSearchGroupingColumnReferenceList getGroupingColumnReferenceList(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchParameterReference.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchParameterReference.java new file mode 100644 index 000000000..4fb3b97d0 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchParameterReference.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchParameterReference extends PsiElement { + + @Nullable + PsiElement getParameterIdentifier(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchParenthesizedBooleanValueExpression.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchParenthesizedBooleanValueExpression.java new file mode 100644 index 000000000..e929c36c5 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchParenthesizedBooleanValueExpression.java @@ -0,0 +1,30 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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 . + */ + +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; + +public interface FlexibleSearchParenthesizedBooleanValueExpression extends PsiElement { + + @NotNull + FlexibleSearchBooleanValueExpression getBooleanValueExpression(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchPredicate.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchPredicate.java new file mode 100644 index 000000000..3ce20589d --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchPredicate.java @@ -0,0 +1,31 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchPredicate extends PsiElement { + + @Nullable + FlexibleSearchBetweenPredicate getBetweenPredicate(); + + @Nullable + FlexibleSearchCompOp getCompOp(); + + @Nullable + FlexibleSearchExistsPredicate getExistsPredicate(); + + @Nullable + FlexibleSearchInPredicate getInPredicate(); + + @Nullable + FlexibleSearchLikePredicate getLikePredicate(); + + @Nullable + FlexibleSearchNullPredicate getNullPredicate(); + + @NotNull + List getRowValuePredicandList(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchQuerySpecification.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchQuerySpecification.java new file mode 100644 index 000000000..7acca318e --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchQuerySpecification.java @@ -0,0 +1,19 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchQuerySpecification extends PsiElement { + + @Nullable + FlexibleSearchSelectList getSelectList(); + + @Nullable + FlexibleSearchSetQuantifier getSetQuantifier(); + + @Nullable + FlexibleSearchTableExpression getTableExpression(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchRowValuePredicand.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchRowValuePredicand.java new file mode 100644 index 000000000..17d1dd8ef --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchRowValuePredicand.java @@ -0,0 +1,16 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchRowValuePredicand extends PsiElement { + + @NotNull + List getCommonValueExpressionList(); + + @Nullable + FlexibleSearchValueExpression getValueExpression(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSearchCondition.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSearchCondition.java new file mode 100644 index 000000000..46fcde82d --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSearchCondition.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchSearchCondition extends PsiElement { + + @NotNull + FlexibleSearchBooleanValueExpression getBooleanValueExpression(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSelectList.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSelectList.java new file mode 100644 index 000000000..87de0070b --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSelectList.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchSelectList extends PsiElement { + + @NotNull + List getSelectSublistList(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSelectSublist.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSelectSublist.java new file mode 100644 index 000000000..41c248ba9 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSelectSublist.java @@ -0,0 +1,16 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchSelectSublist extends PsiElement { + + @NotNull + List getAggregateFunctionList(); + + @Nullable + FlexibleSearchDerivedColumn getDerivedColumn(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSetFunctionType.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSetFunctionType.java new file mode 100644 index 000000000..03549506c --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSetFunctionType.java @@ -0,0 +1,10 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchSetFunctionType extends PsiElement { + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSetQuantifier.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSetQuantifier.java new file mode 100644 index 000000000..284dd0367 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSetQuantifier.java @@ -0,0 +1,10 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchSetQuantifier extends PsiElement { + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSortKey.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSortKey.java new file mode 100644 index 000000000..13a4b537e --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSortKey.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchSortKey extends PsiElement { + + @NotNull + FlexibleSearchValueExpression getValueExpression(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSortSpecification.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSortSpecification.java new file mode 100644 index 000000000..62194966a --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSortSpecification.java @@ -0,0 +1,19 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchSortSpecification extends PsiElement { + + @Nullable + FlexibleSearchNullOrdering getNullOrdering(); + + @Nullable + FlexibleSearchOrderingSpecification getOrderingSpecification(); + + @NotNull + FlexibleSearchSortKey getSortKey(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSortSpecificationList.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSortSpecificationList.java new file mode 100644 index 000000000..ed7e93d4e --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSortSpecificationList.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchSortSpecificationList extends PsiElement { + + @NotNull + List getSortSpecificationList(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchStringValueExpression.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchStringValueExpression.java new file mode 100644 index 000000000..8c9ec687f --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchStringValueExpression.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchStringValueExpression extends PsiElement { + + @NotNull + FlexibleSearchGeneralLiteral getGeneralLiteral(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchStringValueFunction.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchStringValueFunction.java new file mode 100644 index 000000000..b02970d16 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchStringValueFunction.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchStringValueFunction extends PsiElement { + + @NotNull + FlexibleSearchCharacterValueFunction getCharacterValueFunction(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSubquery.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSubquery.java new file mode 100644 index 000000000..d8506c436 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchSubquery.java @@ -0,0 +1,25 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchSubquery extends PsiElement { + + @Nullable + FlexibleSearchCorrelationName getCorrelationName(); + + @Nullable + FlexibleSearchQuerySpecification getQuerySpecification(); + + @NotNull + List getSubqueryList(); + + @NotNull + PsiElement getLeftDoubleBrace(); + + @Nullable + PsiElement getRightDoubleBrace(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTableExpression.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTableExpression.java new file mode 100644 index 000000000..3d6a76ca0 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTableExpression.java @@ -0,0 +1,22 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchTableExpression extends PsiElement { + + @NotNull + FlexibleSearchFromClause getFromClause(); + + @Nullable + FlexibleSearchGroupByClause getGroupByClause(); + + @Nullable + FlexibleSearchOrderByClause getOrderByClause(); + + @Nullable + FlexibleSearchWhereClause getWhereClause(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTableName.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTableName.java new file mode 100644 index 000000000..ff96e4c53 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTableName.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchTableName extends PsiElement { + + @NotNull + PsiElement getTableNameIdentifier(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTableNameVal.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTableNameVal.java new file mode 100644 index 000000000..e77627941 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTableNameVal.java @@ -0,0 +1,30 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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 . + */ + +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; + +public interface FlexibleSearchTableNameVal extends PsiElement { + + @NotNull + PsiElement getId(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTablePrimary.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTablePrimary.java new file mode 100644 index 000000000..1e70319ed --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTablePrimary.java @@ -0,0 +1,16 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchTablePrimary extends PsiElement { + + @Nullable + FlexibleSearchCorrelationName getCorrelationName(); + + @NotNull + FlexibleSearchTableName getTableName(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTableReference.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTableReference.java new file mode 100644 index 000000000..64e3faa36 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTableReference.java @@ -0,0 +1,16 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchTableReference extends PsiElement { + + @NotNull + List getJoinedTableList(); + + @NotNull + FlexibleSearchTablePrimary getTablePrimary(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTableReferenceList.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTableReferenceList.java new file mode 100644 index 000000000..0ff741a9c --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTableReferenceList.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchTableReferenceList extends PsiElement { + + @NotNull + List getTableReferenceList(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTableSubquery.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTableSubquery.java new file mode 100644 index 000000000..a4b3f51c6 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTableSubquery.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchTableSubquery extends PsiElement { + + @NotNull + FlexibleSearchSubquery getSubquery(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTokenType.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTokenType.java new file mode 100644 index 000000000..8849e9304 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTokenType.java @@ -0,0 +1,51 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.psi; + +import com.intellij.idea.plugin.hybris.flexibleSearch.FlexibleSearchLanguage; +import com.intellij.psi.tree.IElementType; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; + +import java.util.regex.Pattern; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.lowerCase; + +public class FlexibleSearchTokenType extends IElementType { + + private static final Pattern PATTERN = Pattern.compile("[_]"); + + public FlexibleSearchTokenType(@NotNull @NonNls final String debugName) { + super(debugName, FlexibleSearchLanguage.getInstance()); + } + + @Override + public String toString() { + final String name = super.toString(); + + if (isBlank(name)) { + return name; + } + + final String fixedName = PATTERN.matcher(lowerCase(name)).replaceAll(" "); + + return new StringBuilder("<").append(fixedName).append('>').toString(); + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTruthValue.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTruthValue.java new file mode 100644 index 000000000..939ad86e1 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTruthValue.java @@ -0,0 +1,10 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchTruthValue extends PsiElement { + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTypes.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTypes.java new file mode 100644 index 000000000..2c7de943a --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchTypes.java @@ -0,0 +1,345 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import com.intellij.psi.tree.IElementType; +import com.intellij.psi.PsiElement; +import com.intellij.lang.ASTNode; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl.*; + +public interface FlexibleSearchTypes { + + IElementType AGGREGATE_FUNCTION = new FlexibleSearchElementType("AGGREGATE_FUNCTION"); + IElementType BETWEEN_PREDICATE = new FlexibleSearchElementType("BETWEEN_PREDICATE"); + IElementType BOOLEAN_FACTOR = new FlexibleSearchElementType("BOOLEAN_FACTOR"); + IElementType BOOLEAN_PREDICAND = new FlexibleSearchElementType("BOOLEAN_PREDICAND"); + IElementType BOOLEAN_PRIMARY = new FlexibleSearchElementType("BOOLEAN_PRIMARY"); + IElementType BOOLEAN_TERM = new FlexibleSearchElementType("BOOLEAN_TERM"); + IElementType BOOLEAN_TEST = new FlexibleSearchElementType("BOOLEAN_TEST"); + IElementType BOOLEAN_VALUE_EXPRESSION = new FlexibleSearchElementType("BOOLEAN_VALUE_EXPRESSION"); + IElementType CHARACTER_LIKE_PREDICATE = new FlexibleSearchElementType("CHARACTER_LIKE_PREDICATE"); + IElementType CHARACTER_PATTERN = new FlexibleSearchElementType("CHARACTER_PATTERN"); + IElementType CHARACTER_STRING_LITERAL = new FlexibleSearchElementType("CHARACTER_STRING_LITERAL"); + IElementType CHARACTER_SUBSTRING_FUNCTION = new FlexibleSearchElementType("CHARACTER_SUBSTRING_FUNCTION"); + IElementType CHARACTER_VALUE_FUNCTION = new FlexibleSearchElementType("CHARACTER_VALUE_FUNCTION"); + IElementType COLUMN_LOCALIZATION = new FlexibleSearchElementType("COLUMN_LOCALIZATION"); + IElementType COLUMN_REFERENCE = new FlexibleSearchElementType("COLUMN_REFERENCE"); + IElementType COMMON_VALUE_EXPRESSION = new FlexibleSearchElementType("COMMON_VALUE_EXPRESSION"); + IElementType COMP_OP = new FlexibleSearchElementType("COMP_OP"); + IElementType CORRELATION_NAME = new FlexibleSearchElementType("CORRELATION_NAME"); + IElementType DERIVED_COLUMN = new FlexibleSearchElementType("DERIVED_COLUMN"); + IElementType EXISTS_PREDICATE = new FlexibleSearchElementType("EXISTS_PREDICATE"); + IElementType FROM_CLAUSE = new FlexibleSearchElementType("FROM_CLAUSE"); + IElementType GENERAL_LITERAL = new FlexibleSearchElementType("GENERAL_LITERAL"); + IElementType GENERAL_SET_FUNCTION = new FlexibleSearchElementType("GENERAL_SET_FUNCTION"); + IElementType GROUPING_COLUMN_REFERENCE = new FlexibleSearchElementType("GROUPING_COLUMN_REFERENCE"); + IElementType GROUPING_COLUMN_REFERENCE_LIST = new FlexibleSearchElementType("GROUPING_COLUMN_REFERENCE_LIST"); + IElementType GROUPING_ELEMENT = new FlexibleSearchElementType("GROUPING_ELEMENT"); + IElementType GROUPING_ELEMENT_LIST = new FlexibleSearchElementType("GROUPING_ELEMENT_LIST"); + IElementType GROUP_BY_CLAUSE = new FlexibleSearchElementType("GROUP_BY_CLAUSE"); + IElementType IN_PREDICATE = new FlexibleSearchElementType("IN_PREDICATE"); + IElementType JOINED_TABLE = new FlexibleSearchElementType("JOINED_TABLE"); + IElementType JOIN_CONDITION = new FlexibleSearchElementType("JOIN_CONDITION"); + IElementType JOIN_SPECIFICATION = new FlexibleSearchElementType("JOIN_SPECIFICATION"); + IElementType JOIN_TYPE = new FlexibleSearchElementType("JOIN_TYPE"); + IElementType LIKE_PREDICATE = new FlexibleSearchElementType("LIKE_PREDICATE"); + IElementType NULL_ORDERING = new FlexibleSearchElementType("NULL_ORDERING"); + IElementType NULL_PREDICATE = new FlexibleSearchElementType("NULL_PREDICATE"); + IElementType ORDERING_SPECIFICATION = new FlexibleSearchElementType("ORDERING_SPECIFICATION"); + IElementType ORDER_BY_CLAUSE = new FlexibleSearchElementType("ORDER_BY_CLAUSE"); + IElementType ORDINARY_GROUPING_SET = new FlexibleSearchElementType("ORDINARY_GROUPING_SET"); + IElementType PARAMETER_REFERENCE = new FlexibleSearchElementType("PARAMETER_REFERENCE"); + IElementType PREDICATE = new FlexibleSearchElementType("PREDICATE"); + IElementType QUERY_SPECIFICATION = new FlexibleSearchElementType("QUERY_SPECIFICATION"); + IElementType ROW_VALUE_PREDICAND = new FlexibleSearchElementType("ROW_VALUE_PREDICAND"); + IElementType SEARCH_CONDITION = new FlexibleSearchElementType("SEARCH_CONDITION"); + IElementType SELECT_LIST = new FlexibleSearchElementType("SELECT_LIST"); + IElementType SELECT_SUBLIST = new FlexibleSearchElementType("SELECT_SUBLIST"); + IElementType SET_FUNCTION_TYPE = new FlexibleSearchElementType("SET_FUNCTION_TYPE"); + IElementType SET_QUANTIFIER = new FlexibleSearchElementType("SET_QUANTIFIER"); + IElementType SORT_KEY = new FlexibleSearchElementType("SORT_KEY"); + IElementType SORT_SPECIFICATION = new FlexibleSearchElementType("SORT_SPECIFICATION"); + IElementType SORT_SPECIFICATION_LIST = new FlexibleSearchElementType("SORT_SPECIFICATION_LIST"); + IElementType STRING_VALUE_EXPRESSION = new FlexibleSearchElementType("STRING_VALUE_EXPRESSION"); + IElementType STRING_VALUE_FUNCTION = new FlexibleSearchElementType("STRING_VALUE_FUNCTION"); + IElementType SUBQUERY = new FlexibleSearchElementType("SUBQUERY"); + IElementType TABLE_EXPRESSION = new FlexibleSearchElementType("TABLE_EXPRESSION"); + IElementType TABLE_NAME = new FlexibleSearchElementType("TABLE_NAME"); + IElementType TABLE_PRIMARY = new FlexibleSearchElementType("TABLE_PRIMARY"); + IElementType TABLE_REFERENCE = new FlexibleSearchElementType("TABLE_REFERENCE"); + IElementType TABLE_REFERENCE_LIST = new FlexibleSearchElementType("TABLE_REFERENCE_LIST"); + IElementType TABLE_SUBQUERY = new FlexibleSearchElementType("TABLE_SUBQUERY"); + IElementType TRUTH_VALUE = new FlexibleSearchElementType("TRUTH_VALUE"); + IElementType VALUE_EXPRESSION = new FlexibleSearchElementType("VALUE_EXPRESSION"); + IElementType WHERE_CLAUSE = new FlexibleSearchElementType("WHERE_CLAUSE"); + + IElementType ALL = new FlexibleSearchTokenType("ALL"); + IElementType AND = new FlexibleSearchTokenType("AND"); + IElementType ANY = new FlexibleSearchTokenType("ANY"); + IElementType AS = new FlexibleSearchTokenType("AS"); + IElementType ASC = new FlexibleSearchTokenType("ASC"); + IElementType ASTERISK = new FlexibleSearchTokenType("*"); + IElementType AVG = new FlexibleSearchTokenType("AVG"); + IElementType BETWEEN = new FlexibleSearchTokenType("BETWEEN"); + IElementType BY = new FlexibleSearchTokenType("BY"); + IElementType COLON = new FlexibleSearchTokenType(":"); + IElementType COLUMN_REFERENCE_IDENTIFIER = new FlexibleSearchTokenType("COLUMN_REFERENCE_IDENTIFIER"); + IElementType COMMA = new FlexibleSearchTokenType(","); + IElementType CONCAT = new FlexibleSearchTokenType("CONCAT"); + IElementType COUNT = new FlexibleSearchTokenType("COUNT"); + IElementType DESC = new FlexibleSearchTokenType("DESC"); + IElementType DISTINCT = new FlexibleSearchTokenType("DISTINCT"); + IElementType DOT = new FlexibleSearchTokenType("."); + IElementType EQUALS_OPERATOR = new FlexibleSearchTokenType("EQUALS_OPERATOR"); + IElementType EVERY = new FlexibleSearchTokenType("EVERY"); + IElementType EXCLAMATION_MARK = new FlexibleSearchTokenType("!"); + IElementType EXISTS = new FlexibleSearchTokenType("EXISTS"); + IElementType FALSE = new FlexibleSearchTokenType("FALSE"); + IElementType FIRST = new FlexibleSearchTokenType("FIRST"); + IElementType FROM = new FlexibleSearchTokenType("FROM"); + IElementType GREATER_THAN_OPERATOR = new FlexibleSearchTokenType(">"); + IElementType GREATER_THAN_OR_EQUALS_OPERATOR = new FlexibleSearchTokenType("GREATER_THAN_OR_EQUALS_OPERATOR"); + IElementType GROUP = new FlexibleSearchTokenType("GROUP"); + IElementType IDENTIFIER = new FlexibleSearchTokenType("IDENTIFIER"); + IElementType IN = new FlexibleSearchTokenType("IN"); + IElementType IS = new FlexibleSearchTokenType("IS"); + IElementType JOIN = new FlexibleSearchTokenType("JOIN"); + IElementType JOIN_TYPE_1_0 = new FlexibleSearchTokenType("join_type_1_0"); + IElementType LAST = new FlexibleSearchTokenType("LAST"); + IElementType LEFT = new FlexibleSearchTokenType("LEFT"); + IElementType LEFT_BRACE = new FlexibleSearchTokenType("LEFT_BRACE"); + IElementType LEFT_BRACKET = new FlexibleSearchTokenType("["); + IElementType LEFT_DOUBLE_BRACE = new FlexibleSearchTokenType("LEFT_DOUBLE_BRACE"); + IElementType LEFT_PAREN = new FlexibleSearchTokenType("("); + IElementType LESS_THAN_OPERATOR = new FlexibleSearchTokenType("<"); + IElementType LESS_THAN_OR_EQUALS_OPERATOR = new FlexibleSearchTokenType("LESS_THAN_OR_EQUALS_OPERATOR"); + IElementType LIKE = new FlexibleSearchTokenType("LIKE"); + IElementType LINE_TERMINATOR = new FlexibleSearchTokenType("LINE_TERMINATOR"); + IElementType MAX = new FlexibleSearchTokenType("MAX"); + IElementType MIN = new FlexibleSearchTokenType("MIN"); + IElementType MINUS_SIGN = new FlexibleSearchTokenType("-"); + IElementType NOT = new FlexibleSearchTokenType("NOT"); + IElementType NOT_EQUALS_OPERATOR = new FlexibleSearchTokenType("<>"); + IElementType NULL = new FlexibleSearchTokenType("NULL"); + IElementType NULLS = new FlexibleSearchTokenType("NULLS"); + IElementType NUMBER = new FlexibleSearchTokenType("NUMBER"); + IElementType ON = new FlexibleSearchTokenType("ON"); + IElementType OR = new FlexibleSearchTokenType("OR"); + IElementType ORDER = new FlexibleSearchTokenType("ORDER"); + IElementType PARAMETER_IDENTIFIER = new FlexibleSearchTokenType("PARAMETER_IDENTIFIER"); + IElementType PERCENT = new FlexibleSearchTokenType("%"); + IElementType PLUS_SIGN = new FlexibleSearchTokenType("+"); + IElementType QUESTION_MARK = new FlexibleSearchTokenType("?"); + IElementType QUOTE = new FlexibleSearchTokenType("'"); + IElementType RIGHT_BRACE = new FlexibleSearchTokenType("RIGHT_BRACE"); + IElementType RIGHT_BRACKET = new FlexibleSearchTokenType("]"); + IElementType RIGHT_DOUBLE_BRACE = new FlexibleSearchTokenType("RIGHT_DOUBLE_BRACE"); + IElementType RIGHT_PAREN = new FlexibleSearchTokenType(")"); + IElementType SELECT = new FlexibleSearchTokenType("SELECT"); + IElementType SEMICOLON = new FlexibleSearchTokenType(";"); + IElementType SOME = new FlexibleSearchTokenType("SOME"); + IElementType SPACE = new FlexibleSearchTokenType("SPACE"); + IElementType STRING = new FlexibleSearchTokenType("STRING"); + IElementType SUM = new FlexibleSearchTokenType("SUM"); + IElementType TABLE_NAME_IDENTIFIER = new FlexibleSearchTokenType("TABLE_NAME_IDENTIFIER"); + IElementType TRUE = new FlexibleSearchTokenType("TRUE"); + IElementType UNDERSCORE = new FlexibleSearchTokenType("_"); + IElementType UNION = new FlexibleSearchTokenType("UNION"); + IElementType WHERE = new FlexibleSearchTokenType("WHERE"); + IElementType WHITE_SPACE = new FlexibleSearchTokenType("WHITE_SPACE"); + + class Factory { + public static PsiElement createElement(ASTNode node) { + IElementType type = node.getElementType(); + if (type == AGGREGATE_FUNCTION) { + return new FlexibleSearchAggregateFunctionImpl(node); + } + else if (type == BETWEEN_PREDICATE) { + return new FlexibleSearchBetweenPredicateImpl(node); + } + else if (type == BOOLEAN_FACTOR) { + return new FlexibleSearchBooleanFactorImpl(node); + } + else if (type == BOOLEAN_PREDICAND) { + return new FlexibleSearchBooleanPredicandImpl(node); + } + else if (type == BOOLEAN_PRIMARY) { + return new FlexibleSearchBooleanPrimaryImpl(node); + } + else if (type == BOOLEAN_TERM) { + return new FlexibleSearchBooleanTermImpl(node); + } + else if (type == BOOLEAN_TEST) { + return new FlexibleSearchBooleanTestImpl(node); + } + else if (type == BOOLEAN_VALUE_EXPRESSION) { + return new FlexibleSearchBooleanValueExpressionImpl(node); + } + else if (type == CHARACTER_LIKE_PREDICATE) { + return new FlexibleSearchCharacterLikePredicateImpl(node); + } + else if (type == CHARACTER_PATTERN) { + return new FlexibleSearchCharacterPatternImpl(node); + } + else if (type == CHARACTER_STRING_LITERAL) { + return new FlexibleSearchCharacterStringLiteralImpl(node); + } + else if (type == CHARACTER_SUBSTRING_FUNCTION) { + return new FlexibleSearchCharacterSubstringFunctionImpl(node); + } + else if (type == CHARACTER_VALUE_FUNCTION) { + return new FlexibleSearchCharacterValueFunctionImpl(node); + } + else if (type == COLUMN_LOCALIZATION) { + return new FlexibleSearchColumnLocalizationImpl(node); + } + else if (type == COLUMN_REFERENCE) { + return new FlexibleSearchColumnReferenceImpl(node); + } + else if (type == COMMON_VALUE_EXPRESSION) { + return new FlexibleSearchCommonValueExpressionImpl(node); + } + else if (type == COMP_OP) { + return new FlexibleSearchCompOpImpl(node); + } + else if (type == CORRELATION_NAME) { + return new FlexibleSearchCorrelationNameImpl(node); + } + else if (type == DERIVED_COLUMN) { + return new FlexibleSearchDerivedColumnImpl(node); + } + else if (type == EXISTS_PREDICATE) { + return new FlexibleSearchExistsPredicateImpl(node); + } + else if (type == FROM_CLAUSE) { + return new FlexibleSearchFromClauseImpl(node); + } + else if (type == GENERAL_LITERAL) { + return new FlexibleSearchGeneralLiteralImpl(node); + } + else if (type == GENERAL_SET_FUNCTION) { + return new FlexibleSearchGeneralSetFunctionImpl(node); + } + else if (type == GROUPING_COLUMN_REFERENCE) { + return new FlexibleSearchGroupingColumnReferenceImpl(node); + } + else if (type == GROUPING_COLUMN_REFERENCE_LIST) { + return new FlexibleSearchGroupingColumnReferenceListImpl(node); + } + else if (type == GROUPING_ELEMENT) { + return new FlexibleSearchGroupingElementImpl(node); + } + else if (type == GROUPING_ELEMENT_LIST) { + return new FlexibleSearchGroupingElementListImpl(node); + } + else if (type == GROUP_BY_CLAUSE) { + return new FlexibleSearchGroupByClauseImpl(node); + } + else if (type == IN_PREDICATE) { + return new FlexibleSearchInPredicateImpl(node); + } + else if (type == JOINED_TABLE) { + return new FlexibleSearchJoinedTableImpl(node); + } + else if (type == JOIN_CONDITION) { + return new FlexibleSearchJoinConditionImpl(node); + } + else if (type == JOIN_SPECIFICATION) { + return new FlexibleSearchJoinSpecificationImpl(node); + } + else if (type == JOIN_TYPE) { + return new FlexibleSearchJoinTypeImpl(node); + } + else if (type == LIKE_PREDICATE) { + return new FlexibleSearchLikePredicateImpl(node); + } + else if (type == NULL_ORDERING) { + return new FlexibleSearchNullOrderingImpl(node); + } + else if (type == NULL_PREDICATE) { + return new FlexibleSearchNullPredicateImpl(node); + } + else if (type == ORDERING_SPECIFICATION) { + return new FlexibleSearchOrderingSpecificationImpl(node); + } + else if (type == ORDER_BY_CLAUSE) { + return new FlexibleSearchOrderByClauseImpl(node); + } + else if (type == ORDINARY_GROUPING_SET) { + return new FlexibleSearchOrdinaryGroupingSetImpl(node); + } + else if (type == PARAMETER_REFERENCE) { + return new FlexibleSearchParameterReferenceImpl(node); + } + else if (type == PREDICATE) { + return new FlexibleSearchPredicateImpl(node); + } + else if (type == QUERY_SPECIFICATION) { + return new FlexibleSearchQuerySpecificationImpl(node); + } + else if (type == ROW_VALUE_PREDICAND) { + return new FlexibleSearchRowValuePredicandImpl(node); + } + else if (type == SEARCH_CONDITION) { + return new FlexibleSearchSearchConditionImpl(node); + } + else if (type == SELECT_LIST) { + return new FlexibleSearchSelectListImpl(node); + } + else if (type == SELECT_SUBLIST) { + return new FlexibleSearchSelectSublistImpl(node); + } + else if (type == SET_FUNCTION_TYPE) { + return new FlexibleSearchSetFunctionTypeImpl(node); + } + else if (type == SET_QUANTIFIER) { + return new FlexibleSearchSetQuantifierImpl(node); + } + else if (type == SORT_KEY) { + return new FlexibleSearchSortKeyImpl(node); + } + else if (type == SORT_SPECIFICATION) { + return new FlexibleSearchSortSpecificationImpl(node); + } + else if (type == SORT_SPECIFICATION_LIST) { + return new FlexibleSearchSortSpecificationListImpl(node); + } + else if (type == STRING_VALUE_EXPRESSION) { + return new FlexibleSearchStringValueExpressionImpl(node); + } + else if (type == STRING_VALUE_FUNCTION) { + return new FlexibleSearchStringValueFunctionImpl(node); + } + else if (type == SUBQUERY) { + return new FlexibleSearchSubqueryImpl(node); + } + else if (type == TABLE_EXPRESSION) { + return new FlexibleSearchTableExpressionImpl(node); + } + else if (type == TABLE_NAME) { + return new FlexibleSearchTableNameImpl(node); + } + else if (type == TABLE_PRIMARY) { + return new FlexibleSearchTablePrimaryImpl(node); + } + else if (type == TABLE_REFERENCE) { + return new FlexibleSearchTableReferenceImpl(node); + } + else if (type == TABLE_REFERENCE_LIST) { + return new FlexibleSearchTableReferenceListImpl(node); + } + else if (type == TABLE_SUBQUERY) { + return new FlexibleSearchTableSubqueryImpl(node); + } + else if (type == TRUTH_VALUE) { + return new FlexibleSearchTruthValueImpl(node); + } + else if (type == VALUE_EXPRESSION) { + return new FlexibleSearchValueExpressionImpl(node); + } + else if (type == WHERE_CLAUSE) { + return new FlexibleSearchWhereClauseImpl(node); + } + throw new AssertionError("Unknown element type: " + type); + } + } +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchValueExpression.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchValueExpression.java new file mode 100644 index 000000000..576fa81d1 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchValueExpression.java @@ -0,0 +1,28 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchValueExpression extends PsiElement { + + @Nullable + FlexibleSearchColumnLocalization getColumnLocalization(); + + @Nullable + FlexibleSearchColumnReference getColumnReference(); + + @Nullable + FlexibleSearchParameterReference getParameterReference(); + + @Nullable + PsiElement getLeftBrace(); + + @Nullable + PsiElement getNumber(); + + @Nullable + PsiElement getRightBrace(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchVisitor.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchVisitor.java new file mode 100644 index 000000000..00ca7de36 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchVisitor.java @@ -0,0 +1,266 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.PsiElement; + +public class FlexibleSearchVisitor extends PsiElementVisitor { + + public void visitAggregateFunction(@NotNull FlexibleSearchAggregateFunction o) { + visitPsiElement(o); + } + + public void visitBetweenPredicate(@NotNull FlexibleSearchBetweenPredicate o) { + visitPsiElement(o); + } + + public void visitBooleanFactor(@NotNull FlexibleSearchBooleanFactor o) { + visitPsiElement(o); + } + + public void visitBooleanPredicand(@NotNull FlexibleSearchBooleanPredicand o) { + visitPsiElement(o); + } + + public void visitBooleanPrimary(@NotNull FlexibleSearchBooleanPrimary o) { + visitPsiElement(o); + } + + public void visitBooleanTerm(@NotNull FlexibleSearchBooleanTerm o) { + visitPsiElement(o); + } + + public void visitBooleanTest(@NotNull FlexibleSearchBooleanTest o) { + visitPsiElement(o); + } + + public void visitBooleanValueExpression(@NotNull FlexibleSearchBooleanValueExpression o) { + visitPsiElement(o); + } + + public void visitCharacterLikePredicate(@NotNull FlexibleSearchCharacterLikePredicate o) { + visitPsiElement(o); + } + + public void visitCharacterPattern(@NotNull FlexibleSearchCharacterPattern o) { + visitPsiElement(o); + } + + public void visitCharacterStringLiteral(@NotNull FlexibleSearchCharacterStringLiteral o) { + visitPsiElement(o); + } + + public void visitCharacterSubstringFunction(@NotNull FlexibleSearchCharacterSubstringFunction o) { + visitPsiElement(o); + } + + public void visitCharacterValueFunction(@NotNull FlexibleSearchCharacterValueFunction o) { + visitPsiElement(o); + } + + public void visitColumnLocalization(@NotNull FlexibleSearchColumnLocalization o) { + visitPsiElement(o); + } + + public void visitColumnReference(@NotNull FlexibleSearchColumnReference o) { + visitPsiElement(o); + } + + public void visitCommonValueExpression(@NotNull FlexibleSearchCommonValueExpression o) { + visitPsiElement(o); + } + + public void visitCompOp(@NotNull FlexibleSearchCompOp o) { + visitPsiElement(o); + } + + public void visitCorrelationName(@NotNull FlexibleSearchCorrelationName o) { + visitPsiElement(o); + } + + public void visitDerivedColumn(@NotNull FlexibleSearchDerivedColumn o) { + visitPsiElement(o); + } + + public void visitExistsPredicate(@NotNull FlexibleSearchExistsPredicate o) { + visitPsiElement(o); + } + + public void visitFromClause(@NotNull FlexibleSearchFromClause o) { + visitPsiElement(o); + } + + public void visitGeneralLiteral(@NotNull FlexibleSearchGeneralLiteral o) { + visitPsiElement(o); + } + + public void visitGeneralSetFunction(@NotNull FlexibleSearchGeneralSetFunction o) { + visitPsiElement(o); + } + + public void visitGroupByClause(@NotNull FlexibleSearchGroupByClause o) { + visitPsiElement(o); + } + + public void visitGroupingColumnReference(@NotNull FlexibleSearchGroupingColumnReference o) { + visitPsiElement(o); + } + + public void visitGroupingColumnReferenceList(@NotNull FlexibleSearchGroupingColumnReferenceList o) { + visitPsiElement(o); + } + + public void visitGroupingElement(@NotNull FlexibleSearchGroupingElement o) { + visitPsiElement(o); + } + + public void visitGroupingElementList(@NotNull FlexibleSearchGroupingElementList o) { + visitPsiElement(o); + } + + public void visitInPredicate(@NotNull FlexibleSearchInPredicate o) { + visitPsiElement(o); + } + + public void visitJoinCondition(@NotNull FlexibleSearchJoinCondition o) { + visitPsiElement(o); + } + + public void visitJoinSpecification(@NotNull FlexibleSearchJoinSpecification o) { + visitPsiElement(o); + } + + public void visitJoinType(@NotNull FlexibleSearchJoinType o) { + visitPsiElement(o); + } + + public void visitJoinedTable(@NotNull FlexibleSearchJoinedTable o) { + visitPsiElement(o); + } + + public void visitLikePredicate(@NotNull FlexibleSearchLikePredicate o) { + visitPsiElement(o); + } + + public void visitNullOrdering(@NotNull FlexibleSearchNullOrdering o) { + visitPsiElement(o); + } + + public void visitNullPredicate(@NotNull FlexibleSearchNullPredicate o) { + visitPsiElement(o); + } + + public void visitOrderByClause(@NotNull FlexibleSearchOrderByClause o) { + visitPsiElement(o); + } + + public void visitOrderingSpecification(@NotNull FlexibleSearchOrderingSpecification o) { + visitPsiElement(o); + } + + public void visitOrdinaryGroupingSet(@NotNull FlexibleSearchOrdinaryGroupingSet o) { + visitPsiElement(o); + } + + public void visitParameterReference(@NotNull FlexibleSearchParameterReference o) { + visitPsiElement(o); + } + + public void visitPredicate(@NotNull FlexibleSearchPredicate o) { + visitPsiElement(o); + } + + public void visitQuerySpecification(@NotNull FlexibleSearchQuerySpecification o) { + visitPsiElement(o); + } + + public void visitRowValuePredicand(@NotNull FlexibleSearchRowValuePredicand o) { + visitPsiElement(o); + } + + public void visitSearchCondition(@NotNull FlexibleSearchSearchCondition o) { + visitPsiElement(o); + } + + public void visitSelectList(@NotNull FlexibleSearchSelectList o) { + visitPsiElement(o); + } + + public void visitSelectSublist(@NotNull FlexibleSearchSelectSublist o) { + visitPsiElement(o); + } + + public void visitSetFunctionType(@NotNull FlexibleSearchSetFunctionType o) { + visitPsiElement(o); + } + + public void visitSetQuantifier(@NotNull FlexibleSearchSetQuantifier o) { + visitPsiElement(o); + } + + public void visitSortKey(@NotNull FlexibleSearchSortKey o) { + visitPsiElement(o); + } + + public void visitSortSpecification(@NotNull FlexibleSearchSortSpecification o) { + visitPsiElement(o); + } + + public void visitSortSpecificationList(@NotNull FlexibleSearchSortSpecificationList o) { + visitPsiElement(o); + } + + public void visitStringValueExpression(@NotNull FlexibleSearchStringValueExpression o) { + visitPsiElement(o); + } + + public void visitStringValueFunction(@NotNull FlexibleSearchStringValueFunction o) { + visitPsiElement(o); + } + + public void visitSubquery(@NotNull FlexibleSearchSubquery o) { + visitPsiElement(o); + } + + public void visitTableExpression(@NotNull FlexibleSearchTableExpression o) { + visitPsiElement(o); + } + + public void visitTableName(@NotNull FlexibleSearchTableName o) { + visitPsiElement(o); + } + + public void visitTablePrimary(@NotNull FlexibleSearchTablePrimary o) { + visitPsiElement(o); + } + + public void visitTableReference(@NotNull FlexibleSearchTableReference o) { + visitPsiElement(o); + } + + public void visitTableReferenceList(@NotNull FlexibleSearchTableReferenceList o) { + visitPsiElement(o); + } + + public void visitTableSubquery(@NotNull FlexibleSearchTableSubquery o) { + visitPsiElement(o); + } + + public void visitTruthValue(@NotNull FlexibleSearchTruthValue o) { + visitPsiElement(o); + } + + public void visitValueExpression(@NotNull FlexibleSearchValueExpression o) { + visitPsiElement(o); + } + + public void visitWhereClause(@NotNull FlexibleSearchWhereClause o) { + visitPsiElement(o); + } + + public void visitPsiElement(@NotNull PsiElement o) { + visitElement(o); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchWhereClause.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchWhereClause.java new file mode 100644 index 000000000..c6a189b8b --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/FlexibleSearchWhereClause.java @@ -0,0 +1,13 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElement; + +public interface FlexibleSearchWhereClause extends PsiElement { + + @Nullable + FlexibleSearchSearchCondition getSearchCondition(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchAggregateFunctionImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchAggregateFunctionImpl.java new file mode 100644 index 000000000..1dc0361c9 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchAggregateFunctionImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchAggregateFunctionImpl extends ASTWrapperPsiElement implements FlexibleSearchAggregateFunction { + + public FlexibleSearchAggregateFunctionImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitAggregateFunction(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchGeneralSetFunction getGeneralSetFunction() { + return findChildByClass(FlexibleSearchGeneralSetFunction.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBetweenPredicateImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBetweenPredicateImpl.java new file mode 100644 index 000000000..b70f4f28b --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBetweenPredicateImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchBetweenPredicateImpl extends ASTWrapperPsiElement implements FlexibleSearchBetweenPredicate { + + public FlexibleSearchBetweenPredicateImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitBetweenPredicate(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public List getRowValuePredicandList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, FlexibleSearchRowValuePredicand.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBooleanFactorImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBooleanFactorImpl.java new file mode 100644 index 000000000..cb5e3969b --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBooleanFactorImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchBooleanFactorImpl extends ASTWrapperPsiElement implements FlexibleSearchBooleanFactor { + + public FlexibleSearchBooleanFactorImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitBooleanFactor(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchBooleanTest getBooleanTest() { + return findNotNullChildByClass(FlexibleSearchBooleanTest.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBooleanPredicandImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBooleanPredicandImpl.java new file mode 100644 index 000000000..f66d95bdf --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBooleanPredicandImpl.java @@ -0,0 +1,41 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchBooleanPredicandImpl extends ASTWrapperPsiElement implements FlexibleSearchBooleanPredicand { + + public FlexibleSearchBooleanPredicandImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitBooleanPredicand(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchBooleanValueExpression getBooleanValueExpression() { + return findChildByClass(FlexibleSearchBooleanValueExpression.class); + } + + @Override + @Nullable + public FlexibleSearchColumnReference getColumnReference() { + return findChildByClass(FlexibleSearchColumnReference.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBooleanPrimaryImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBooleanPrimaryImpl.java new file mode 100644 index 000000000..cd1d06756 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBooleanPrimaryImpl.java @@ -0,0 +1,41 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchBooleanPrimaryImpl extends ASTWrapperPsiElement implements FlexibleSearchBooleanPrimary { + + public FlexibleSearchBooleanPrimaryImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitBooleanPrimary(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchBooleanPredicand getBooleanPredicand() { + return findChildByClass(FlexibleSearchBooleanPredicand.class); + } + + @Override + @Nullable + public FlexibleSearchPredicate getPredicate() { + return findChildByClass(FlexibleSearchPredicate.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBooleanTermImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBooleanTermImpl.java new file mode 100644 index 000000000..ab1dcfc8a --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBooleanTermImpl.java @@ -0,0 +1,41 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchBooleanTermImpl extends ASTWrapperPsiElement implements FlexibleSearchBooleanTerm { + + public FlexibleSearchBooleanTermImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitBooleanTerm(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchBooleanFactor getBooleanFactor() { + return findNotNullChildByClass(FlexibleSearchBooleanFactor.class); + } + + @Override + @NotNull + public List getBooleanTermList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, FlexibleSearchBooleanTerm.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBooleanTestImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBooleanTestImpl.java new file mode 100644 index 000000000..b0627f1f4 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBooleanTestImpl.java @@ -0,0 +1,41 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchBooleanTestImpl extends ASTWrapperPsiElement implements FlexibleSearchBooleanTest { + + public FlexibleSearchBooleanTestImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitBooleanTest(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchBooleanPrimary getBooleanPrimary() { + return findNotNullChildByClass(FlexibleSearchBooleanPrimary.class); + } + + @Override + @Nullable + public FlexibleSearchTruthValue getTruthValue() { + return findChildByClass(FlexibleSearchTruthValue.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBooleanValueExpressionImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBooleanValueExpressionImpl.java new file mode 100644 index 000000000..7f6be033b --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchBooleanValueExpressionImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchBooleanValueExpressionImpl extends ASTWrapperPsiElement implements FlexibleSearchBooleanValueExpression { + + public FlexibleSearchBooleanValueExpressionImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitBooleanValueExpression(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchBooleanTerm getBooleanTerm() { + return findNotNullChildByClass(FlexibleSearchBooleanTerm.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCharacterLikePredicateImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCharacterLikePredicateImpl.java new file mode 100644 index 000000000..a980965ea --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCharacterLikePredicateImpl.java @@ -0,0 +1,47 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchCharacterLikePredicateImpl extends ASTWrapperPsiElement implements FlexibleSearchCharacterLikePredicate { + + public FlexibleSearchCharacterLikePredicateImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitCharacterLikePredicate(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchCharacterPattern getCharacterPattern() { + return findChildByClass(FlexibleSearchCharacterPattern.class); + } + + @Override + @NotNull + public FlexibleSearchRowValuePredicand getRowValuePredicand() { + return findNotNullChildByClass(FlexibleSearchRowValuePredicand.class); + } + + @Override + @Nullable + public FlexibleSearchValueExpression getValueExpression() { + return findChildByClass(FlexibleSearchValueExpression.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCharacterPatternImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCharacterPatternImpl.java new file mode 100644 index 000000000..9c7b757e8 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCharacterPatternImpl.java @@ -0,0 +1,41 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchCharacterPatternImpl extends ASTWrapperPsiElement implements FlexibleSearchCharacterPattern { + + public FlexibleSearchCharacterPatternImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitCharacterPattern(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchStringValueFunction getStringValueFunction() { + return findChildByClass(FlexibleSearchStringValueFunction.class); + } + + @Override + @Nullable + public PsiElement getString() { + return findChildByType(STRING); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCharacterStringLiteralImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCharacterStringLiteralImpl.java new file mode 100644 index 000000000..defddb9fa --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCharacterStringLiteralImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchCharacterStringLiteralImpl extends ASTWrapperPsiElement implements FlexibleSearchCharacterStringLiteral { + + public FlexibleSearchCharacterStringLiteralImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitCharacterStringLiteral(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public PsiElement getString() { + return findNotNullChildByType(STRING); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCharacterSubstringFunctionImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCharacterSubstringFunctionImpl.java new file mode 100644 index 000000000..418e4d29d --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCharacterSubstringFunctionImpl.java @@ -0,0 +1,41 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchCharacterSubstringFunctionImpl extends ASTWrapperPsiElement implements FlexibleSearchCharacterSubstringFunction { + + public FlexibleSearchCharacterSubstringFunctionImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitCharacterSubstringFunction(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchCharacterSubstringFunction getCharacterSubstringFunction() { + return findChildByClass(FlexibleSearchCharacterSubstringFunction.class); + } + + @Override + @NotNull + public List getStringValueExpressionList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, FlexibleSearchStringValueExpression.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCharacterValueFunctionImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCharacterValueFunctionImpl.java new file mode 100644 index 000000000..f6e3dd9bf --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCharacterValueFunctionImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchCharacterValueFunctionImpl extends ASTWrapperPsiElement implements FlexibleSearchCharacterValueFunction { + + public FlexibleSearchCharacterValueFunctionImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitCharacterValueFunction(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchCharacterSubstringFunction getCharacterSubstringFunction() { + return findNotNullChildByClass(FlexibleSearchCharacterSubstringFunction.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchColumnLocalizationImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchColumnLocalizationImpl.java new file mode 100644 index 000000000..2830c16d2 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchColumnLocalizationImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchColumnLocalizationImpl extends ASTWrapperPsiElement implements FlexibleSearchColumnLocalization { + + public FlexibleSearchColumnLocalizationImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitColumnLocalization(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public PsiElement getIdentifier() { + return findNotNullChildByType(IDENTIFIER); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchColumnReferenceImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchColumnReferenceImpl.java new file mode 100644 index 000000000..e68015bd1 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchColumnReferenceImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.idea.plugin.hybris.flexibleSearch.references.ColumnReferenceMixin; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchColumnReferenceImpl extends ColumnReferenceMixin implements FlexibleSearchColumnReference { + + public FlexibleSearchColumnReferenceImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitColumnReference(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public PsiElement getTableNameIdentifier() { + return findChildByType(TABLE_NAME_IDENTIFIER); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCommonValueExpressionImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCommonValueExpressionImpl.java new file mode 100644 index 000000000..eeb81d375 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCommonValueExpressionImpl.java @@ -0,0 +1,41 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchCommonValueExpressionImpl extends ASTWrapperPsiElement implements FlexibleSearchCommonValueExpression { + + public FlexibleSearchCommonValueExpressionImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitCommonValueExpression(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchStringValueExpression getStringValueExpression() { + return findChildByClass(FlexibleSearchStringValueExpression.class); + } + + @Override + @Nullable + public PsiElement getNumber() { + return findChildByType(NUMBER); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCompOpImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCompOpImpl.java new file mode 100644 index 000000000..b0bfdbc7d --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCompOpImpl.java @@ -0,0 +1,47 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchCompOpImpl extends ASTWrapperPsiElement implements FlexibleSearchCompOp { + + public FlexibleSearchCompOpImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitCompOp(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public PsiElement getEqualsOperator() { + return findChildByType(EQUALS_OPERATOR); + } + + @Override + @Nullable + public PsiElement getGreaterThanOrEqualsOperator() { + return findChildByType(GREATER_THAN_OR_EQUALS_OPERATOR); + } + + @Override + @Nullable + public PsiElement getLessThanOrEqualsOperator() { + return findChildByType(LESS_THAN_OR_EQUALS_OPERATOR); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCorrelationNameImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCorrelationNameImpl.java new file mode 100644 index 000000000..12aede9de --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchCorrelationNameImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchCorrelationNameImpl extends ASTWrapperPsiElement implements FlexibleSearchCorrelationName { + + public FlexibleSearchCorrelationNameImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitCorrelationName(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public PsiElement getIdentifier() { + return findNotNullChildByType(IDENTIFIER); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchDerivedColumnImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchDerivedColumnImpl.java new file mode 100644 index 000000000..fe56ed2de --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchDerivedColumnImpl.java @@ -0,0 +1,41 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchDerivedColumnImpl extends ASTWrapperPsiElement implements FlexibleSearchDerivedColumn { + + public FlexibleSearchDerivedColumnImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitDerivedColumn(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchCorrelationName getCorrelationName() { + return findChildByClass(FlexibleSearchCorrelationName.class); + } + + @Override + @NotNull + public FlexibleSearchValueExpression getValueExpression() { + return findNotNullChildByClass(FlexibleSearchValueExpression.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchExistsPredicateImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchExistsPredicateImpl.java new file mode 100644 index 000000000..0cb249d0a --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchExistsPredicateImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchExistsPredicateImpl extends ASTWrapperPsiElement implements FlexibleSearchExistsPredicate { + + public FlexibleSearchExistsPredicateImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitExistsPredicate(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchTableSubquery getTableSubquery() { + return findNotNullChildByClass(FlexibleSearchTableSubquery.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchFromClauseImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchFromClauseImpl.java new file mode 100644 index 000000000..0663c630a --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchFromClauseImpl.java @@ -0,0 +1,53 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchFromClauseImpl extends ASTWrapperPsiElement implements FlexibleSearchFromClause { + + public FlexibleSearchFromClauseImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitFromClause(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchSubquery getSubquery() { + return findChildByClass(FlexibleSearchSubquery.class); + } + + @Override + @Nullable + public FlexibleSearchTableReferenceList getTableReferenceList() { + return findChildByClass(FlexibleSearchTableReferenceList.class); + } + + @Override + @Nullable + public PsiElement getLeftBrace() { + return findChildByType(LEFT_BRACE); + } + + @Override + @Nullable + public PsiElement getRightBrace() { + return findChildByType(RIGHT_BRACE); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGeneralLiteralImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGeneralLiteralImpl.java new file mode 100644 index 000000000..2551d461d --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGeneralLiteralImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchGeneralLiteralImpl extends ASTWrapperPsiElement implements FlexibleSearchGeneralLiteral { + + public FlexibleSearchGeneralLiteralImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitGeneralLiteral(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchCharacterStringLiteral getCharacterStringLiteral() { + return findNotNullChildByClass(FlexibleSearchCharacterStringLiteral.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGeneralSetFunctionImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGeneralSetFunctionImpl.java new file mode 100644 index 000000000..678663bef --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGeneralSetFunctionImpl.java @@ -0,0 +1,53 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchGeneralSetFunctionImpl extends ASTWrapperPsiElement implements FlexibleSearchGeneralSetFunction { + + public FlexibleSearchGeneralSetFunctionImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitGeneralSetFunction(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchCorrelationName getCorrelationName() { + return findChildByClass(FlexibleSearchCorrelationName.class); + } + + @Override + @NotNull + public FlexibleSearchSetFunctionType getSetFunctionType() { + return findNotNullChildByClass(FlexibleSearchSetFunctionType.class); + } + + @Override + @Nullable + public FlexibleSearchSetQuantifier getSetQuantifier() { + return findChildByClass(FlexibleSearchSetQuantifier.class); + } + + @Override + @NotNull + public FlexibleSearchValueExpression getValueExpression() { + return findNotNullChildByClass(FlexibleSearchValueExpression.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGroupByClauseImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGroupByClauseImpl.java new file mode 100644 index 000000000..90c6c52b6 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGroupByClauseImpl.java @@ -0,0 +1,41 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchGroupByClauseImpl extends ASTWrapperPsiElement implements FlexibleSearchGroupByClause { + + public FlexibleSearchGroupByClauseImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitGroupByClause(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchGroupingElementList getGroupingElementList() { + return findNotNullChildByClass(FlexibleSearchGroupingElementList.class); + } + + @Override + @Nullable + public FlexibleSearchSetQuantifier getSetQuantifier() { + return findChildByClass(FlexibleSearchSetQuantifier.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGroupingColumnReferenceImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGroupingColumnReferenceImpl.java new file mode 100644 index 000000000..aa18147ab --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGroupingColumnReferenceImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchGroupingColumnReferenceImpl extends ASTWrapperPsiElement implements FlexibleSearchGroupingColumnReference { + + public FlexibleSearchGroupingColumnReferenceImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitGroupingColumnReference(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchValueExpression getValueExpression() { + return findNotNullChildByClass(FlexibleSearchValueExpression.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGroupingColumnReferenceListImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGroupingColumnReferenceListImpl.java new file mode 100644 index 000000000..b88d46d74 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGroupingColumnReferenceListImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchGroupingColumnReferenceListImpl extends ASTWrapperPsiElement implements FlexibleSearchGroupingColumnReferenceList { + + public FlexibleSearchGroupingColumnReferenceListImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitGroupingColumnReferenceList(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public List getGroupingColumnReferenceList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, FlexibleSearchGroupingColumnReference.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGroupingElementImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGroupingElementImpl.java new file mode 100644 index 000000000..77ed1118b --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGroupingElementImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchGroupingElementImpl extends ASTWrapperPsiElement implements FlexibleSearchGroupingElement { + + public FlexibleSearchGroupingElementImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitGroupingElement(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchOrdinaryGroupingSet getOrdinaryGroupingSet() { + return findNotNullChildByClass(FlexibleSearchOrdinaryGroupingSet.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGroupingElementListImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGroupingElementListImpl.java new file mode 100644 index 000000000..22c011cfd --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchGroupingElementListImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchGroupingElementListImpl extends ASTWrapperPsiElement implements FlexibleSearchGroupingElementList { + + public FlexibleSearchGroupingElementListImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitGroupingElementList(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public List getGroupingElementList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, FlexibleSearchGroupingElement.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchInPredicateImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchInPredicateImpl.java new file mode 100644 index 000000000..a6698ff8f --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchInPredicateImpl.java @@ -0,0 +1,41 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchInPredicateImpl extends ASTWrapperPsiElement implements FlexibleSearchInPredicate { + + public FlexibleSearchInPredicateImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitInPredicate(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public List getRowValuePredicandList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, FlexibleSearchRowValuePredicand.class); + } + + @Override + @Nullable + public FlexibleSearchTableSubquery getTableSubquery() { + return findChildByClass(FlexibleSearchTableSubquery.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchJoinConditionImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchJoinConditionImpl.java new file mode 100644 index 000000000..474de5988 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchJoinConditionImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchJoinConditionImpl extends ASTWrapperPsiElement implements FlexibleSearchJoinCondition { + + public FlexibleSearchJoinConditionImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitJoinCondition(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchSearchCondition getSearchCondition() { + return findChildByClass(FlexibleSearchSearchCondition.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchJoinSpecificationImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchJoinSpecificationImpl.java new file mode 100644 index 000000000..b30c58789 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchJoinSpecificationImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchJoinSpecificationImpl extends ASTWrapperPsiElement implements FlexibleSearchJoinSpecification { + + public FlexibleSearchJoinSpecificationImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitJoinSpecification(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchJoinCondition getJoinCondition() { + return findNotNullChildByClass(FlexibleSearchJoinCondition.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchJoinTypeImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchJoinTypeImpl.java new file mode 100644 index 000000000..ae9f5429c --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchJoinTypeImpl.java @@ -0,0 +1,29 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchJoinTypeImpl extends ASTWrapperPsiElement implements FlexibleSearchJoinType { + + public FlexibleSearchJoinTypeImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitJoinType(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchJoinedTableImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchJoinedTableImpl.java new file mode 100644 index 000000000..6e89a2271 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchJoinedTableImpl.java @@ -0,0 +1,47 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchJoinedTableImpl extends ASTWrapperPsiElement implements FlexibleSearchJoinedTable { + + public FlexibleSearchJoinedTableImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitJoinedTable(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchJoinSpecification getJoinSpecification() { + return findChildByClass(FlexibleSearchJoinSpecification.class); + } + + @Override + @Nullable + public FlexibleSearchJoinType getJoinType() { + return findChildByClass(FlexibleSearchJoinType.class); + } + + @Override + @Nullable + public FlexibleSearchTableReference getTableReference() { + return findChildByClass(FlexibleSearchTableReference.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchLikePredicateImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchLikePredicateImpl.java new file mode 100644 index 000000000..81e8db58a --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchLikePredicateImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchLikePredicateImpl extends ASTWrapperPsiElement implements FlexibleSearchLikePredicate { + + public FlexibleSearchLikePredicateImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitLikePredicate(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchCharacterLikePredicate getCharacterLikePredicate() { + return findNotNullChildByClass(FlexibleSearchCharacterLikePredicate.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchNullOrderingImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchNullOrderingImpl.java new file mode 100644 index 000000000..ab8c8f62d --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchNullOrderingImpl.java @@ -0,0 +1,29 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchNullOrderingImpl extends ASTWrapperPsiElement implements FlexibleSearchNullOrdering { + + public FlexibleSearchNullOrderingImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitNullOrdering(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchNullPredicateImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchNullPredicateImpl.java new file mode 100644 index 000000000..24c71b16a --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchNullPredicateImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchNullPredicateImpl extends ASTWrapperPsiElement implements FlexibleSearchNullPredicate { + + public FlexibleSearchNullPredicateImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitNullPredicate(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchRowValuePredicand getRowValuePredicand() { + return findNotNullChildByClass(FlexibleSearchRowValuePredicand.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchOrderByClauseImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchOrderByClauseImpl.java new file mode 100644 index 000000000..f8cec0f59 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchOrderByClauseImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchOrderByClauseImpl extends ASTWrapperPsiElement implements FlexibleSearchOrderByClause { + + public FlexibleSearchOrderByClauseImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitOrderByClause(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchSortSpecificationList getSortSpecificationList() { + return findChildByClass(FlexibleSearchSortSpecificationList.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchOrderingSpecificationImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchOrderingSpecificationImpl.java new file mode 100644 index 000000000..1fc486df2 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchOrderingSpecificationImpl.java @@ -0,0 +1,29 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchOrderingSpecificationImpl extends ASTWrapperPsiElement implements FlexibleSearchOrderingSpecification { + + public FlexibleSearchOrderingSpecificationImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitOrderingSpecification(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchOrdinaryGroupingSetImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchOrdinaryGroupingSetImpl.java new file mode 100644 index 000000000..42fc38591 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchOrdinaryGroupingSetImpl.java @@ -0,0 +1,41 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchOrdinaryGroupingSetImpl extends ASTWrapperPsiElement implements FlexibleSearchOrdinaryGroupingSet { + + public FlexibleSearchOrdinaryGroupingSetImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitOrdinaryGroupingSet(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchGroupingColumnReference getGroupingColumnReference() { + return findChildByClass(FlexibleSearchGroupingColumnReference.class); + } + + @Override + @Nullable + public FlexibleSearchGroupingColumnReferenceList getGroupingColumnReferenceList() { + return findChildByClass(FlexibleSearchGroupingColumnReferenceList.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchParameterReferenceImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchParameterReferenceImpl.java new file mode 100644 index 000000000..970efb404 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchParameterReferenceImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchParameterReferenceImpl extends ASTWrapperPsiElement implements FlexibleSearchParameterReference { + + public FlexibleSearchParameterReferenceImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitParameterReference(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public PsiElement getParameterIdentifier() { + return findChildByType(PARAMETER_IDENTIFIER); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchPredicateImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchPredicateImpl.java new file mode 100644 index 000000000..75a76a81e --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchPredicateImpl.java @@ -0,0 +1,71 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchPredicateImpl extends ASTWrapperPsiElement implements FlexibleSearchPredicate { + + public FlexibleSearchPredicateImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitPredicate(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchBetweenPredicate getBetweenPredicate() { + return findChildByClass(FlexibleSearchBetweenPredicate.class); + } + + @Override + @Nullable + public FlexibleSearchCompOp getCompOp() { + return findChildByClass(FlexibleSearchCompOp.class); + } + + @Override + @Nullable + public FlexibleSearchExistsPredicate getExistsPredicate() { + return findChildByClass(FlexibleSearchExistsPredicate.class); + } + + @Override + @Nullable + public FlexibleSearchInPredicate getInPredicate() { + return findChildByClass(FlexibleSearchInPredicate.class); + } + + @Override + @Nullable + public FlexibleSearchLikePredicate getLikePredicate() { + return findChildByClass(FlexibleSearchLikePredicate.class); + } + + @Override + @Nullable + public FlexibleSearchNullPredicate getNullPredicate() { + return findChildByClass(FlexibleSearchNullPredicate.class); + } + + @Override + @NotNull + public List getRowValuePredicandList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, FlexibleSearchRowValuePredicand.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchQuerySpecificationImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchQuerySpecificationImpl.java new file mode 100644 index 000000000..c495c7183 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchQuerySpecificationImpl.java @@ -0,0 +1,47 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchQuerySpecificationImpl extends ASTWrapperPsiElement implements FlexibleSearchQuerySpecification { + + public FlexibleSearchQuerySpecificationImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitQuerySpecification(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchSelectList getSelectList() { + return findChildByClass(FlexibleSearchSelectList.class); + } + + @Override + @Nullable + public FlexibleSearchSetQuantifier getSetQuantifier() { + return findChildByClass(FlexibleSearchSetQuantifier.class); + } + + @Override + @Nullable + public FlexibleSearchTableExpression getTableExpression() { + return findChildByClass(FlexibleSearchTableExpression.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchRowValuePredicandImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchRowValuePredicandImpl.java new file mode 100644 index 000000000..3ff240e44 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchRowValuePredicandImpl.java @@ -0,0 +1,41 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchRowValuePredicandImpl extends ASTWrapperPsiElement implements FlexibleSearchRowValuePredicand { + + public FlexibleSearchRowValuePredicandImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitRowValuePredicand(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public List getCommonValueExpressionList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, FlexibleSearchCommonValueExpression.class); + } + + @Override + @Nullable + public FlexibleSearchValueExpression getValueExpression() { + return findChildByClass(FlexibleSearchValueExpression.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSearchConditionImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSearchConditionImpl.java new file mode 100644 index 000000000..676d23e5c --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSearchConditionImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchSearchConditionImpl extends ASTWrapperPsiElement implements FlexibleSearchSearchCondition { + + public FlexibleSearchSearchConditionImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitSearchCondition(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchBooleanValueExpression getBooleanValueExpression() { + return findNotNullChildByClass(FlexibleSearchBooleanValueExpression.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSelectListImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSelectListImpl.java new file mode 100644 index 000000000..302b71230 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSelectListImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchSelectListImpl extends ASTWrapperPsiElement implements FlexibleSearchSelectList { + + public FlexibleSearchSelectListImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitSelectList(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public List getSelectSublistList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, FlexibleSearchSelectSublist.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSelectSublistImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSelectSublistImpl.java new file mode 100644 index 000000000..538086d89 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSelectSublistImpl.java @@ -0,0 +1,41 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchSelectSublistImpl extends ASTWrapperPsiElement implements FlexibleSearchSelectSublist { + + public FlexibleSearchSelectSublistImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitSelectSublist(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public List getAggregateFunctionList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, FlexibleSearchAggregateFunction.class); + } + + @Override + @Nullable + public FlexibleSearchDerivedColumn getDerivedColumn() { + return findChildByClass(FlexibleSearchDerivedColumn.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSetFunctionTypeImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSetFunctionTypeImpl.java new file mode 100644 index 000000000..f3dbb85dc --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSetFunctionTypeImpl.java @@ -0,0 +1,29 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchSetFunctionTypeImpl extends ASTWrapperPsiElement implements FlexibleSearchSetFunctionType { + + public FlexibleSearchSetFunctionTypeImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitSetFunctionType(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSetQuantifierImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSetQuantifierImpl.java new file mode 100644 index 000000000..7a23466ae --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSetQuantifierImpl.java @@ -0,0 +1,29 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchSetQuantifierImpl extends ASTWrapperPsiElement implements FlexibleSearchSetQuantifier { + + public FlexibleSearchSetQuantifierImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitSetQuantifier(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSortKeyImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSortKeyImpl.java new file mode 100644 index 000000000..e5bd2cf10 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSortKeyImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchSortKeyImpl extends ASTWrapperPsiElement implements FlexibleSearchSortKey { + + public FlexibleSearchSortKeyImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitSortKey(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchValueExpression getValueExpression() { + return findNotNullChildByClass(FlexibleSearchValueExpression.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSortSpecificationImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSortSpecificationImpl.java new file mode 100644 index 000000000..0bc30b26b --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSortSpecificationImpl.java @@ -0,0 +1,47 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchSortSpecificationImpl extends ASTWrapperPsiElement implements FlexibleSearchSortSpecification { + + public FlexibleSearchSortSpecificationImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitSortSpecification(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchNullOrdering getNullOrdering() { + return findChildByClass(FlexibleSearchNullOrdering.class); + } + + @Override + @Nullable + public FlexibleSearchOrderingSpecification getOrderingSpecification() { + return findChildByClass(FlexibleSearchOrderingSpecification.class); + } + + @Override + @NotNull + public FlexibleSearchSortKey getSortKey() { + return findNotNullChildByClass(FlexibleSearchSortKey.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSortSpecificationListImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSortSpecificationListImpl.java new file mode 100644 index 000000000..c2b466c07 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSortSpecificationListImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchSortSpecificationListImpl extends ASTWrapperPsiElement implements FlexibleSearchSortSpecificationList { + + public FlexibleSearchSortSpecificationListImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitSortSpecificationList(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public List getSortSpecificationList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, FlexibleSearchSortSpecification.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchStringValueExpressionImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchStringValueExpressionImpl.java new file mode 100644 index 000000000..00cba6703 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchStringValueExpressionImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchStringValueExpressionImpl extends ASTWrapperPsiElement implements FlexibleSearchStringValueExpression { + + public FlexibleSearchStringValueExpressionImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitStringValueExpression(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchGeneralLiteral getGeneralLiteral() { + return findNotNullChildByClass(FlexibleSearchGeneralLiteral.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchStringValueFunctionImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchStringValueFunctionImpl.java new file mode 100644 index 000000000..0a7657f6a --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchStringValueFunctionImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchStringValueFunctionImpl extends ASTWrapperPsiElement implements FlexibleSearchStringValueFunction { + + public FlexibleSearchStringValueFunctionImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitStringValueFunction(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchCharacterValueFunction getCharacterValueFunction() { + return findNotNullChildByClass(FlexibleSearchCharacterValueFunction.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSubqueryImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSubqueryImpl.java new file mode 100644 index 000000000..eaa86e4ba --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchSubqueryImpl.java @@ -0,0 +1,59 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchSubqueryImpl extends ASTWrapperPsiElement implements FlexibleSearchSubquery { + + public FlexibleSearchSubqueryImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitSubquery(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchCorrelationName getCorrelationName() { + return findChildByClass(FlexibleSearchCorrelationName.class); + } + + @Override + @Nullable + public FlexibleSearchQuerySpecification getQuerySpecification() { + return findChildByClass(FlexibleSearchQuerySpecification.class); + } + + @Override + @NotNull + public List getSubqueryList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, FlexibleSearchSubquery.class); + } + + @Override + @NotNull + public PsiElement getLeftDoubleBrace() { + return findNotNullChildByType(LEFT_DOUBLE_BRACE); + } + + @Override + @Nullable + public PsiElement getRightDoubleBrace() { + return findChildByType(RIGHT_DOUBLE_BRACE); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTableExpressionImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTableExpressionImpl.java new file mode 100644 index 000000000..300d9d5b8 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTableExpressionImpl.java @@ -0,0 +1,53 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchTableExpressionImpl extends ASTWrapperPsiElement implements FlexibleSearchTableExpression { + + public FlexibleSearchTableExpressionImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitTableExpression(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchFromClause getFromClause() { + return findNotNullChildByClass(FlexibleSearchFromClause.class); + } + + @Override + @Nullable + public FlexibleSearchGroupByClause getGroupByClause() { + return findChildByClass(FlexibleSearchGroupByClause.class); + } + + @Override + @Nullable + public FlexibleSearchOrderByClause getOrderByClause() { + return findChildByClass(FlexibleSearchOrderByClause.class); + } + + @Override + @Nullable + public FlexibleSearchWhereClause getWhereClause() { + return findChildByClass(FlexibleSearchWhereClause.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTableNameImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTableNameImpl.java new file mode 100644 index 000000000..1e4e8c1ca --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTableNameImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.idea.plugin.hybris.flexibleSearch.references.TypeNameMixin; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchTableNameImpl extends TypeNameMixin implements FlexibleSearchTableName { + + public FlexibleSearchTableNameImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitTableName(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public PsiElement getTableNameIdentifier() { + return findNotNullChildByType(TABLE_NAME_IDENTIFIER); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTablePrimaryImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTablePrimaryImpl.java new file mode 100644 index 000000000..02d2cb7f4 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTablePrimaryImpl.java @@ -0,0 +1,41 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchTablePrimaryImpl extends ASTWrapperPsiElement implements FlexibleSearchTablePrimary { + + public FlexibleSearchTablePrimaryImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitTablePrimary(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchCorrelationName getCorrelationName() { + return findChildByClass(FlexibleSearchCorrelationName.class); + } + + @Override + @NotNull + public FlexibleSearchTableName getTableName() { + return findNotNullChildByClass(FlexibleSearchTableName.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTableReferenceImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTableReferenceImpl.java new file mode 100644 index 000000000..88c955f79 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTableReferenceImpl.java @@ -0,0 +1,41 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchTableReferenceImpl extends ASTWrapperPsiElement implements FlexibleSearchTableReference { + + public FlexibleSearchTableReferenceImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitTableReference(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public List getJoinedTableList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, FlexibleSearchJoinedTable.class); + } + + @Override + @NotNull + public FlexibleSearchTablePrimary getTablePrimary() { + return findNotNullChildByClass(FlexibleSearchTablePrimary.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTableReferenceListImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTableReferenceListImpl.java new file mode 100644 index 000000000..76d527e7d --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTableReferenceListImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchTableReferenceListImpl extends ASTWrapperPsiElement implements FlexibleSearchTableReferenceList { + + public FlexibleSearchTableReferenceListImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitTableReferenceList(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public List getTableReferenceList() { + return PsiTreeUtil.getChildrenOfTypeAsList(this, FlexibleSearchTableReference.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTableSubqueryImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTableSubqueryImpl.java new file mode 100644 index 000000000..233082874 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTableSubqueryImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchTableSubqueryImpl extends ASTWrapperPsiElement implements FlexibleSearchTableSubquery { + + public FlexibleSearchTableSubqueryImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitTableSubquery(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @NotNull + public FlexibleSearchSubquery getSubquery() { + return findNotNullChildByClass(FlexibleSearchSubquery.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTruthValueImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTruthValueImpl.java new file mode 100644 index 000000000..b06fc085c --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchTruthValueImpl.java @@ -0,0 +1,29 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchTruthValueImpl extends ASTWrapperPsiElement implements FlexibleSearchTruthValue { + + public FlexibleSearchTruthValueImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitTruthValue(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchValueExpressionImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchValueExpressionImpl.java new file mode 100644 index 000000000..35e933c71 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchValueExpressionImpl.java @@ -0,0 +1,65 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchValueExpressionImpl extends ASTWrapperPsiElement implements FlexibleSearchValueExpression { + + public FlexibleSearchValueExpressionImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitValueExpression(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchColumnLocalization getColumnLocalization() { + return findChildByClass(FlexibleSearchColumnLocalization.class); + } + + @Override + @Nullable + public FlexibleSearchColumnReference getColumnReference() { + return findChildByClass(FlexibleSearchColumnReference.class); + } + + @Override + @Nullable + public FlexibleSearchParameterReference getParameterReference() { + return findChildByClass(FlexibleSearchParameterReference.class); + } + + @Override + @Nullable + public PsiElement getLeftBrace() { + return findChildByType(LEFT_BRACE); + } + + @Override + @Nullable + public PsiElement getNumber() { + return findChildByType(NUMBER); + } + + @Override + @Nullable + public PsiElement getRightBrace() { + return findChildByType(RIGHT_BRACE); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchWhereClauseImpl.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchWhereClauseImpl.java new file mode 100644 index 000000000..ad0891cd8 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/psi/impl/FlexibleSearchWhereClauseImpl.java @@ -0,0 +1,35 @@ +// This is a generated file. Not intended for manual editing. +package com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl; + +import java.util.List; +import org.jetbrains.annotations.*; +import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import com.intellij.extapi.psi.ASTWrapperPsiElement; +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.*; + +public class FlexibleSearchWhereClauseImpl extends ASTWrapperPsiElement implements FlexibleSearchWhereClause { + + public FlexibleSearchWhereClauseImpl(@NotNull ASTNode node) { + super(node); + } + + public void accept(@NotNull FlexibleSearchVisitor visitor) { + visitor.visitWhereClause(this); + } + + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor); + else super.accept(visitor); + } + + @Override + @Nullable + public FlexibleSearchSearchCondition getSearchCondition() { + return findChildByClass(FlexibleSearchSearchCondition.class); + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/references/ColumnReferenceMixin.kt b/src/com/intellij/idea/plugin/hybris/flexibleSearch/references/ColumnReferenceMixin.kt new file mode 100644 index 000000000..6017cb0d2 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/references/ColumnReferenceMixin.kt @@ -0,0 +1,124 @@ +package com.intellij.idea.plugin.hybris.flexibleSearch.references + +import com.intellij.extapi.psi.ASTWrapperPsiElement +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchColumnReference +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchFromClause +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchQuerySpecification +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTableName +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTableReference +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes +import com.intellij.idea.plugin.hybris.psi.references.TypeSystemReferenceBase +import com.intellij.idea.plugin.hybris.type.system.meta.TSMetaModel +import com.intellij.idea.plugin.hybris.type.system.model.Attribute +import com.intellij.idea.plugin.hybris.type.system.model.RelationElement +import com.intellij.lang.ASTNode +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiReference +import com.intellij.psi.ResolveResult +import com.intellij.psi.impl.source.tree.LeafPsiElement +import com.intellij.psi.util.PsiTreeUtil +import com.intellij.util.xml.DomElement +import java.util.Optional + +/** + * @author Nosov Aleksandr + */ +abstract class ColumnReferenceMixin(node: ASTNode) : ASTWrapperPsiElement(node), FlexibleSearchColumnReference { + + private var reference: TypeSystemAttributeReference? = null + + override fun getReferences(): Array { + if (reference == null) { + reference = TypeSystemAttributeReference(this) + } + return arrayOf(reference) + } + + override fun clone(): Any { + val result = super.clone() as ColumnReferenceMixin + result.reference = null + return result + } + +} + +internal class TypeSystemAttributeReference(owner: FlexibleSearchColumnReference) : TypeSystemReferenceBase(owner) { + + override fun multiResolve(incompleteCode: Boolean): Array { + val meta = typeSystemMeta + val featureName = element.text.replace("!", "") + if (hasPrefix(element)) { + return findReference(meta, deepSearchOfTypeReference(element, element.firstChild.text), element.lastChild.text) + } + return findReference(meta, findItemTypeReference(), featureName) + } + + private fun hasPrefix(element: FlexibleSearchColumnReference) = ((element.firstChild as LeafPsiElement).elementType == FlexibleSearchTypes.TABLE_NAME_IDENTIFIER) + + private fun findReference(meta: TSMetaModel, itemType: Optional, refName: String): Array { + val metaClass = itemType + .map { it.text.replace("!", "") } + .map { meta.findMetaClassByName(it) } + + if (!metaClass.isPresent) { + return ResolveResult.EMPTY_ARRAY + } + + val attributes = metaClass.get() + .findPropertiesByName(refName, true) + .mapNotNull { it.retrieveDom() } + .map { AttributeResolveResult(it) }.toList() + + val relations = metaClass.get() + .findReferenceEndsByRole(refName, true) + .mapNotNull { it.retrieveDom() } + .map { RelationElementResolveResult(it) } + + return (attributes + relations).toTypedArray() + } + + private fun findItemTypeReference(): Optional { + return Optional.ofNullable(PsiTreeUtil.getParentOfType(element, FlexibleSearchQuerySpecification::class.java)) + .map { PsiTreeUtil.findChildOfType(it, FlexibleSearchFromClause::class.java) } + .map { it!!.tableReferenceList } + .map { PsiTreeUtil.findChildOfType(it, FlexibleSearchTableName::class.java) } + } + + private fun deepSearchOfTypeReference(elem: PsiElement, prefix: String): Optional { + val parent = PsiTreeUtil.getParentOfType(elem, FlexibleSearchQuerySpecification::class.java) + val tables = PsiTreeUtil.findChildrenOfType(parent, FlexibleSearchTableReference::class.java).toList() + + val tableReference = tables.find { + val tableName = PsiTreeUtil.findChildOfAnyType(it, FlexibleSearchTableName::class.java) + val corName = findCorName(tableName) + prefix == corName + } + return if (tableReference == null && parent != null) { + deepSearchOfTypeReference(parent, prefix) + } else { + Optional.ofNullable(PsiTreeUtil.findChildOfType(tableReference, FlexibleSearchTableName::class.java)) + } + } + + private fun findCorName(tableName: FlexibleSearchTableName?) : String { + val corNameEl = PsiTreeUtil.findSiblingForward(tableName!!.originalElement, FlexibleSearchTypes.CORRELATION_NAME, null) + if (corNameEl == null) { + return tableName.text + } + return corNameEl.text + } + + + private class AttributeResolveResult(private val myDomAttribute: Attribute) : TypeSystemReferenceBase.TypeSystemResolveResult { + override fun getElement(): PsiElement? = myDomAttribute.qualifier.xmlAttributeValue + override fun isValidResult() = element != null + override fun getSemanticDomElement() = myDomAttribute + } + + private class RelationElementResolveResult(private val myDomRelationEnd: RelationElement) : TypeSystemReferenceBase.TypeSystemResolveResult { + override fun getElement(): PsiElement? = myDomRelationEnd.qualifier.xmlAttributeValue + override fun isValidResult() = element != null + override fun getSemanticDomElement(): DomElement = myDomRelationEnd + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/references/TypeSystemMixin.kt b/src/com/intellij/idea/plugin/hybris/flexibleSearch/references/TypeSystemMixin.kt new file mode 100644 index 000000000..1f7772be1 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/references/TypeSystemMixin.kt @@ -0,0 +1,78 @@ +package com.intellij.idea.plugin.hybris.flexibleSearch.references + +import com.intellij.extapi.psi.ASTWrapperPsiElement +import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTableName +import com.intellij.idea.plugin.hybris.psi.references.TypeSystemReferenceBase +import com.intellij.idea.plugin.hybris.type.system.model.ItemType +import com.intellij.idea.plugin.hybris.type.system.model.Relation +import com.intellij.lang.ASTNode +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiReference +import com.intellij.psi.ResolveResult +import java.util.Optional +import java.util.stream.Collectors +import java.util.stream.Stream + +/** + * @author Nosov Aleksandr + */ + +abstract class TypeNameMixin(astNode: ASTNode) : ASTWrapperPsiElement(astNode), FlexibleSearchTableName { + + private var myReference: TypeSystemItemRef? = null + + override fun getReferences(): Array { + if (myReference == null) { + myReference = TypeSystemItemRef(this) + } + return arrayOf(myReference!!) + } + + override fun clone(): Any { + val result = super.clone() as TypeNameMixin + result.myReference = null + return result + } +} + +class TypeSystemItemRef(owner: FlexibleSearchTableName) : TypeSystemReferenceBase(owner) { + + override fun multiResolve(incompleteCode: Boolean): Array { + val meta = typeSystemMeta + val lookingForName = element.text.replace("!", "") + val res0 = Optional.ofNullable(meta.findMetaClassByName(lookingForName)) + .map { it.retrieveAllDomsStream() } + .orElse(Stream.empty()) + .map { ItemTypeResolveResult(it) } + .collect(Collectors.toList()) + + val res1 = meta.findRelationByName(lookingForName) + .distinctBy { it.name } + .map { it.retrieveDom() } + .map { RelationResolveResult(it) } + .toList() + + return (res0 + res1).toTypedArray() + } + + private class ItemTypeResolveResult(private val myDomItemType: ItemType) : ResolveResult { + + override fun getElement(): PsiElement? { + val codeAttr = myDomItemType.code + return codeAttr.xmlAttributeValue + } + + override fun isValidResult() = element != null + } + + private class RelationResolveResult(private val myDomItemType: Relation) : ResolveResult { + + override fun getElement(): PsiElement? { + val codeAttr = myDomItemType.code + return codeAttr.xmlAttributeValue + } + + override fun isValidResult() = element != null + } + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/utils/FlexibleSearchParserUtils.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/utils/FlexibleSearchParserUtils.java new file mode 100644 index 000000000..29ec7a8f2 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/utils/FlexibleSearchParserUtils.java @@ -0,0 +1,1321 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch.utils; + +import com.intellij.codeInsight.completion.impl.CamelHumpMatcher; +import com.intellij.lang.ASTNode; +import com.intellij.lang.BracePair; +import com.intellij.lang.Language; +import com.intellij.lang.LanguageBraceMatching; +import com.intellij.lang.LighterASTNode; +import com.intellij.lang.PairedBraceMatcher; +import com.intellij.lang.PsiBuilder; +import com.intellij.lang.PsiParser; +import com.intellij.lang.WhitespacesAndCommentsBinder; +import com.intellij.lang.WhitespacesBinders; +import com.intellij.lang.impl.PsiBuilderAdapter; +import com.intellij.lang.impl.PsiBuilderImpl; +import com.intellij.lexer.Lexer; +import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.util.Comparing; +import com.intellij.openapi.util.Key; +import com.intellij.openapi.util.Pair; +import com.intellij.openapi.util.text.StringHash; +import com.intellij.psi.PsiFile; +import com.intellij.psi.PsiReference; +import com.intellij.psi.TokenType; +import com.intellij.psi.impl.source.resolve.FileContextUtil; +import com.intellij.psi.impl.source.tree.CompositePsiElement; +import com.intellij.psi.tree.ICompositeElementType; +import com.intellij.psi.tree.IElementType; +import com.intellij.psi.tree.TokenSet; +import com.intellij.util.Function; +import com.intellij.util.PairProcessor; +import com.intellij.util.containers.ContainerUtil; +import com.intellij.util.containers.LimitedPool; +import gnu.trove.THashSet; +import org.jetbrains.annotations.Contract; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.LinkedList; + +import static com.intellij.openapi.util.text.StringUtil.first; +import static com.intellij.openapi.util.text.StringUtil.isJavaIdentifierStart; +import static com.intellij.openapi.util.text.StringUtil.isNotEmpty; +import static com.intellij.openapi.util.text.StringUtil.isWhiteSpace; +import static com.intellij.openapi.util.text.StringUtil.join; +import static com.intellij.openapi.util.text.StringUtil.notNullize; +import static com.intellij.openapi.util.text.StringUtil.parseInt; +import static com.intellij.openapi.util.text.StringUtil.startsWithIgnoreCase; +/** + * Created 1:01 PM 31 May 2015 + * + * @author Alexander Bartash + * + * + * This class is just a temporary solution to disable FS error highlighting completely. + * It'll get reverted when we implement FS properly. + */ +public class FlexibleSearchParserUtils { + private static final Logger LOG = Logger.getInstance("com.intellij.idea.plugin.hybris.flexibleSearch.utils.FlexibleSearchParserUtils"); + + private static final int MAX_RECURSION_LEVEL = parseInt(System.getProperty("grammar.kit.gpub.max.level"), 1000); + private static final int MAX_VARIANTS_SIZE = 10000; + private static final int MAX_VARIANTS_TO_DISPLAY = 50; + private static final int MAX_ERROR_TOKEN_TEXT = 20; + + private static final int INITIAL_VARIANTS_SIZE = 1000; + private static final int VARIANTS_POOL_SIZE = 10000; + private static final int FRAMES_POOL_SIZE = 500; + + public static final IElementType DUMMY_BLOCK = new FlexibleSearchParserUtils.DummyBlockElementType(); + + public interface Parser { + boolean parse(PsiBuilder builder, int level); + } + + public static final FlexibleSearchParserUtils.Parser TOKEN_ADVANCER = new FlexibleSearchParserUtils.Parser() { + @Override + public boolean parse(PsiBuilder builder, int level) { + if (builder.eof()) return false; + builder.advanceLexer(); + return true; + } + }; + + public static final FlexibleSearchParserUtils.Parser TRUE_CONDITION = new FlexibleSearchParserUtils.Parser() { + @Override + public boolean parse(PsiBuilder builder, int level) { + return true; + } + }; + + public interface Hook { + + @Contract("_,null,_->null") + PsiBuilder.Marker run(PsiBuilder builder, PsiBuilder.Marker marker, T param); + + } + + public static final FlexibleSearchParserUtils.Hook LEFT_BINDER = + new FlexibleSearchParserUtils.Hook() { + @Override + public PsiBuilder.Marker run(PsiBuilder builder, + PsiBuilder.Marker marker, + WhitespacesAndCommentsBinder param) { + if (marker != null) marker.setCustomEdgeTokenBinders(param, null); + return marker; + } + }; + + public static final FlexibleSearchParserUtils.Hook RIGHT_BINDER = + new FlexibleSearchParserUtils.Hook() { + @Override + public PsiBuilder.Marker run(PsiBuilder builder, + PsiBuilder.Marker marker, + WhitespacesAndCommentsBinder param) { + if (marker != null) marker.setCustomEdgeTokenBinders(null, param); + return marker; + } + }; + + public static final FlexibleSearchParserUtils.Hook WS_BINDERS = + new FlexibleSearchParserUtils.Hook() { + @Override + public PsiBuilder.Marker run(PsiBuilder builder, + PsiBuilder.Marker marker, + WhitespacesAndCommentsBinder[] param) { + if (marker != null) marker.setCustomEdgeTokenBinders(param[0], param[1]); + return marker; + } + }; + + public static final FlexibleSearchParserUtils.Hook LOG_HOOK = new FlexibleSearchParserUtils.Hook() { + @Override + public PsiBuilder.Marker run(PsiBuilder builder, PsiBuilder.Marker marker, String param) { + PsiBuilderImpl.ProductionMarker m = (PsiBuilderImpl.ProductionMarker)marker; + int start = m == null ? builder.getCurrentOffset() : m.getStartOffset(); + int end = m == null ? start : m.getEndOffset(); + String prefix = "[" + start + ", " + end + "]" + (m == null ? "" : " " + m.getTokenType()); + builder.mark().error(prefix + ": " + param); + return marker; + } + }; + + + public static boolean eof(PsiBuilder builder, int level) { + return builder.eof(); + } + + public static int current_position_(PsiBuilder builder) { + return builder.rawTokenIndex(); + } + + public static boolean recursion_guard_(PsiBuilder builder, int level, String funcName) { + if (level > MAX_RECURSION_LEVEL) { + builder.mark().error("Maximum recursion level (" + MAX_RECURSION_LEVEL + ") reached in '" + funcName + "'"); + return false; + } + return true; + } + + public static boolean empty_element_parsed_guard_(PsiBuilder builder, String funcName, int pos) { + if (pos == current_position_(builder)) { + // sometimes this is a correct situation, therefore no explicit marker + builder.error("Empty element parsed in '" + funcName + "' at offset " + builder.getCurrentOffset()); + return false; + } + return true; + } + + public static boolean invalid_left_marker_guard_(PsiBuilder builder, PsiBuilder.Marker marker, String funcName) { + //builder.error("Invalid left marker encountered in " + funcName_ +" at offset " + builder.getCurrentOffset()); + boolean goodMarker = marker != null; // && ((LighterASTNode)marker).getTokenType() != TokenType.ERROR_ELEMENT; + if (!goodMarker) return false; + FlexibleSearchParserUtils.ErrorState state = FlexibleSearchParserUtils.ErrorState.get(builder); + + return state.currentFrame != null; + } + + public static TokenSet create_token_set_(IElementType... tokenTypes) { + return TokenSet.create(tokenTypes); + } + + public static boolean leftMarkerIs(PsiBuilder builder, IElementType type) { + LighterASTNode marker = builder.getLatestDoneMarker(); + return marker != null && marker.getTokenType() == type; + } + + private static boolean consumeTokens(PsiBuilder builder, boolean smart, int pin, IElementType... tokens) { + FlexibleSearchParserUtils.ErrorState state = FlexibleSearchParserUtils.ErrorState.get(builder); + if (state.completionState != null && state.predicateSign) { + addCompletionVariant(builder, state.completionState, tokens); + } + // suppress single token completion + FlexibleSearchParserUtils.CompletionState completionState = state.completionState; + state.completionState = null; + boolean result = true; + boolean pinned = false; + for (int i = 0, tokensLength = tokens.length; i < tokensLength; i++) { + if (pin > 0 && i == pin) pinned = result; + if (result || pinned) { + boolean fast = smart && i == 0; + if (!(fast ? consumeTokenFast(builder, tokens[i]) : consumeToken(builder, tokens[i]))) { + result = false; + if (pin < 0 || pinned) report_error_(builder, state, false); + } + } + } + state.completionState = completionState; + return pinned || result; + } + + public static boolean consumeTokens(PsiBuilder builder, int pin, IElementType... token) { + return consumeTokens(builder, false, pin, token); + } + + public static boolean consumeTokensSmart(PsiBuilder builder, int pin, IElementType... token) { + return consumeTokens(builder, true, pin, token); + } + + public static boolean parseTokens(PsiBuilder builder, int pin, IElementType... tokens) { + return parseTokens(builder, false, pin, tokens); + } + + public static boolean parseTokensSmart(PsiBuilder builder, int pin, IElementType... tokens) { + return parseTokens(builder, true, pin, tokens); + } + + public static boolean parseTokens(PsiBuilder builder, boolean smart, int pin, IElementType... tokens) { + PsiBuilder.Marker marker = builder.mark(); + boolean result = consumeTokens(builder, smart, pin, tokens); + if (!result) { + marker.rollbackTo(); + } + else { + marker.drop(); + } + return result; + } + + public static boolean consumeTokenSmart(PsiBuilder builder, IElementType token) { + addCompletionVariantSmart(builder, token); + return consumeTokenFast(builder, token); + } + + public static boolean consumeTokenSmart(PsiBuilder builder, String token) { + addCompletionVariantSmart(builder, token); + return consumeTokenFast(builder, token); + } + + public static boolean consumeToken(PsiBuilder builder, IElementType token) { + addVariantSmart(builder, token, true); + if (nextTokenIsFast(builder, token)) { + builder.advanceLexer(); + return true; + } + return false; + } + + public static boolean consumeTokenFast(PsiBuilder builder, IElementType token) { + if (nextTokenIsFast(builder, token)) { + builder.advanceLexer(); + return true; + } + return false; + } + + public static boolean consumeToken(PsiBuilder builder, String text) { + return consumeToken(builder, text, FlexibleSearchParserUtils.ErrorState.get(builder).caseSensitive); + } + + public static boolean consumeToken(PsiBuilder builder, String text, boolean caseSensitive) { + addVariantSmart(builder, text, true); + int count = nextTokenIsFast(builder, text, caseSensitive); + if (count > 0) { + while (count-- > 0) builder.advanceLexer(); + return true; + } + return false; + } + + public static boolean consumeTokenFast(PsiBuilder builder, String text) { + int count = nextTokenIsFast(builder, text, FlexibleSearchParserUtils.ErrorState.get(builder).caseSensitive); + if (count > 0) { + while (count-- > 0) builder.advanceLexer(); + return true; + } + return false; + } + + public static boolean nextTokenIsFast(PsiBuilder builder, IElementType token) { + return builder.getTokenType() == token; + } + + public static boolean nextTokenIsFast(PsiBuilder builder, IElementType... tokens) { + IElementType tokenType = builder.getTokenType(); + for (IElementType token : tokens) { + if (token == tokenType) return true; + } + return false; + } + + public static boolean nextTokenIsSmart(PsiBuilder builder, IElementType token) { + return nextTokenIsFast(builder, token) || FlexibleSearchParserUtils.ErrorState.get(builder).completionState != null; + } + + public static boolean nextTokenIsSmart(PsiBuilder builder, IElementType... tokens) { + return nextTokenIsFast(builder, tokens) || FlexibleSearchParserUtils.ErrorState.get(builder).completionState != null; + } + + public static boolean nextTokenIs(PsiBuilder builder, String frameName, IElementType... tokens) { + FlexibleSearchParserUtils.ErrorState state = FlexibleSearchParserUtils.ErrorState.get(builder); + if (state.completionState != null) return true; + boolean track = !state.suppressErrors && state.predicateCount < 2 && state.predicateSign; + return !track ? nextTokenIsFast(builder, tokens) : nextTokenIsSlow(builder, frameName, tokens); + } + + public static boolean nextTokenIsSlow(PsiBuilder builder, String frameName, IElementType... tokens) { + FlexibleSearchParserUtils.ErrorState state = FlexibleSearchParserUtils.ErrorState.get(builder); + IElementType tokenType = builder.getTokenType(); + if (isNotEmpty(frameName)) { + addVariantInner(state, builder.rawTokenIndex(), frameName); + } + else { + for (IElementType token : tokens) { + addVariant(builder, state, token); + } + } + if (tokenType == null) return false; + for (IElementType token : tokens) { + if (tokenType == token) return true; + } + return false; + } + + public static boolean nextTokenIs(PsiBuilder builder, IElementType token) { + if (!addVariantSmart(builder, token, false)) return true; + return nextTokenIsFast(builder, token); + } + + public static boolean nextTokenIs(PsiBuilder builder, String tokenText) { + if (!addVariantSmart(builder, tokenText, false)) return true; + return nextTokenIsFast(builder, tokenText, FlexibleSearchParserUtils.ErrorState.get(builder).caseSensitive) > 0; + } + + public static boolean nextTokenIsFast(PsiBuilder builder, String tokenText) { + return nextTokenIsFast(builder, tokenText, FlexibleSearchParserUtils.ErrorState.get(builder).caseSensitive) > 0; + } + + public static int nextTokenIsFast(PsiBuilder builder, String tokenText, boolean caseSensitive) { + CharSequence sequence = builder.getOriginalText(); + int offset = builder.getCurrentOffset(); + int endOffset = offset + tokenText.length(); + CharSequence subSequence = sequence.subSequence(offset, Math.min(endOffset, sequence.length())); + + if (!Comparing.equal(subSequence, tokenText, caseSensitive)) return 0; + + int count = 0; + while (true) { + int nextOffset = builder.rawTokenTypeStart(++count); + if (nextOffset > endOffset) { + return -count; + } + else if (nextOffset == endOffset) { + break; + } + } + return count; + } + + private static void addCompletionVariantSmart(PsiBuilder builder, Object token) { + FlexibleSearchParserUtils.ErrorState state = FlexibleSearchParserUtils.ErrorState.get(builder); + FlexibleSearchParserUtils.CompletionState completionState = state.completionState; + if (completionState != null && state.predicateSign) { + addCompletionVariant(builder, completionState, token); + } + } + + private static boolean addVariantSmart(PsiBuilder builder, Object token, boolean force) { + FlexibleSearchParserUtils.ErrorState state = FlexibleSearchParserUtils.ErrorState.get(builder); + // skip FIRST check in completion mode + if (state.completionState != null && !force) return false; + builder.eof(); + if (!state.suppressErrors && state.predicateCount < 2) { + addVariant(builder, state, token); + } + return true; + } + + public static void addVariant(PsiBuilder builder, String text) { + addVariant(builder, FlexibleSearchParserUtils.ErrorState.get(builder), text); + } + + private static void addVariant(PsiBuilder builder, FlexibleSearchParserUtils.ErrorState state, Object o) { + builder.eof(); // skip whitespaces + addVariantInner(state, builder.rawTokenIndex(), o); + + FlexibleSearchParserUtils.CompletionState completionState = state.completionState; + if (completionState != null && state.predicateSign) { + addCompletionVariant(builder, completionState, o); + } + } + + private static void addVariantInner(FlexibleSearchParserUtils.ErrorState state, int pos, Object o) { + FlexibleSearchParserUtils.Variant variant = state.VARIANTS.alloc().init(pos, o); + if (state.predicateSign) { + state.variants.add(variant); + if (state.lastExpectedVariantPos < variant.position) { + state.lastExpectedVariantPos = variant.position; + } + } + else { + state.unexpected.add(variant); + } + } + + private static void addCompletionVariant(@NotNull PsiBuilder builder, @NotNull FlexibleSearchParserUtils.CompletionState completionState, Object o) { + int offset = builder.getCurrentOffset(); + if (!builder.eof() && offset == builder.rawTokenTypeStart(1)) return; // suppress for zero-length tokens + String text = completionState.convertItem(o); + int length = text == null ? 0 : text.length(); + boolean add = length != 0 && completionState.prefixMatches(builder, text); + add = add && length > 1 && !(text.charAt(0) == '<' && text.charAt(length - 1) == '>') && + !(text.charAt(0) == '\'' && text.charAt(length - 1) == '\'' && length < 5); + if (add) { + completionState.addItem(builder, text); + } + } + + public static boolean isWhitespaceOrComment(@NotNull PsiBuilder builder, @Nullable IElementType type) { + return ((PsiBuilderImpl)((FlexibleSearchParserUtils.Builder)builder).getDelegate()).whitespaceOrComment(type); + } + + private static boolean wasAutoSkipped(@NotNull PsiBuilder builder, int steps) { + for (int i = -1; i >= -steps; i--) { + if (!isWhitespaceOrComment(builder, builder.rawLookup(i))) return false; + } + return true; + } + + // here's the new section API for compact parsers & less IntelliJ platform API exposure + public static final int _NONE_ = 0x0; + public static final int _COLLAPSE_ = 0x1; + public static final int _LEFT_ = 0x2; + public static final int _LEFT_INNER_ = 0x4; + public static final int _AND_ = 0x8; + public static final int _NOT_ = 0x10; + public static final int _UPPER_ = 0x20; + + // simple enter/exit methods pair that doesn't require frame object + public static PsiBuilder.Marker enter_section_(PsiBuilder builder) { + FlexibleSearchParserUtils.ErrorState.get(builder).level++; + return builder.mark(); + } + + public static void exit_section_(PsiBuilder builder, + PsiBuilder.Marker marker, + @Nullable IElementType elementType, + boolean result) { + FlexibleSearchParserUtils.ErrorState state = FlexibleSearchParserUtils.ErrorState.get(builder); + close_marker_impl_(state.currentFrame, marker, elementType, result); + run_hooks_impl_(builder, state, result ? elementType : null); + state.level--; + } + + // complex enter/exit methods pair with frame object + public static PsiBuilder.Marker enter_section_(PsiBuilder builder, int level, int modifiers, String frameName) { + return enter_section_(builder, level, modifiers, null, frameName); + } + + public static PsiBuilder.Marker enter_section_(PsiBuilder builder, int level, int modifiers) { + return enter_section_(builder, level, modifiers, null, null); + } + + public static PsiBuilder.Marker enter_section_(PsiBuilder builder, int level, int modifiers, IElementType elementType, String frameName) { + PsiBuilder.Marker marker = builder.mark(); + enter_section_impl_(builder, level, modifiers, elementType, frameName); + return marker; + } + + private static void enter_section_impl_(PsiBuilder builder, int level, int modifiers, IElementType elementType, String frameName) { + FlexibleSearchParserUtils.ErrorState state = FlexibleSearchParserUtils.ErrorState.get(builder); + state.level++; + FlexibleSearchParserUtils.Frame frame = state.FRAMES.alloc().init(builder, state, level, modifiers, elementType, frameName); + FlexibleSearchParserUtils.Frame prevFrame = state.currentFrame; + if (prevFrame != null && prevFrame.errorReportedAt > frame.position) { + // report error for previous unsuccessful frame + reportError(builder, state, frame, null, true, false); + } + if (((frame.modifiers & _LEFT_) | (frame.modifiers & _LEFT_INNER_)) != 0) { + PsiBuilder.Marker left = (PsiBuilder.Marker)builder.getLatestDoneMarker(); + if (invalid_left_marker_guard_(builder, left, frameName)) { + frame.leftMarker = left; + } + } + state.currentFrame = frame; + if ((modifiers & _AND_) != 0) { + if (state.predicateCount == 0 && !state.predicateSign) { + throw new AssertionError("Incorrect false predicate sign"); + } + state.predicateCount++; + } + else if ((modifiers & _NOT_) != 0) { + state.predicateSign = state.predicateCount != 0 && !state.predicateSign; + state.predicateCount++; + } + } + + public static void exit_section_(PsiBuilder builder, + int level, + PsiBuilder.Marker marker, + boolean result, + boolean pinned, + @Nullable FlexibleSearchParserUtils.Parser eatMore) { + exit_section_(builder, level, marker, null, result, pinned, eatMore); + } + + public static void exit_section_(PsiBuilder builder, + int level, + PsiBuilder.Marker marker, + @Nullable IElementType elementType, + boolean result, + boolean pinned, + @Nullable FlexibleSearchParserUtils.Parser eatMore) { + FlexibleSearchParserUtils.ErrorState state = FlexibleSearchParserUtils.ErrorState.get(builder); + + FlexibleSearchParserUtils.Frame frame = state.currentFrame; + state.currentFrame = frame == null ? null : frame.parentFrame; + if (frame != null && frame.elementType != null) elementType = frame.elementType; + if (frame == null || level != frame.level) { + LOG.error("Unbalanced error section: got " + frame + ", expected level " + level); + if (frame != null) state.FRAMES.recycle(frame); + close_marker_impl_(frame, marker, elementType, result); + return; + } + + if (((frame.modifiers & _AND_) | (frame.modifiers & _NOT_)) != 0) { + close_marker_impl_(frame, marker, null, false); + replace_variants_with_name_(state, frame, builder, result, pinned); + state.predicateCount--; + if ((frame.modifiers & _NOT_) != 0) state.predicateSign = !state.predicateSign; + } + else { + close_frame_impl_(state, frame, builder, marker, elementType, result, pinned); + exit_section_impl_(state, frame, builder, elementType, result, pinned, eatMore); + } + run_hooks_impl_(builder, state, pinned || result ? elementType : null); + state.FRAMES.recycle(frame); + state.level--; + } + + public static void register_hook_(PsiBuilder builder, FlexibleSearchParserUtils.Hook hook, T param) { + FlexibleSearchParserUtils.ErrorState state = FlexibleSearchParserUtils.ErrorState.get(builder); + state.hooks = FlexibleSearchParserUtils.Hooks.concat(hook, param, state.level, state.hooks); + } + + @SafeVarargs + public static void register_hook_(PsiBuilder builder, FlexibleSearchParserUtils.Hook hook, T... param) { + FlexibleSearchParserUtils.ErrorState state = FlexibleSearchParserUtils.ErrorState.get(builder); + state.hooks = FlexibleSearchParserUtils.Hooks.concat(hook, param, state.level, state.hooks); + } + + private static void run_hooks_impl_(PsiBuilder builder, FlexibleSearchParserUtils.ErrorState state, @Nullable IElementType elementType) { + if (state.hooks == null) return; + PsiBuilder.Marker marker = elementType == null ? null : (PsiBuilder.Marker)builder.getLatestDoneMarker(); + if (elementType != null && marker == null) { + builder.mark().error("No expected done marker at offset " + builder.getCurrentOffset()); + } + while (state.hooks != null && state.hooks.level >= state.level) { + if (state.hooks.level == state.level) { + marker = ((FlexibleSearchParserUtils.Hook)state.hooks.hook).run(builder, marker, state.hooks.param); + } + state.hooks = state.hooks.next; + } + } + + private static void exit_section_impl_(FlexibleSearchParserUtils.ErrorState state, + FlexibleSearchParserUtils.Frame frame, + PsiBuilder builder, + @Nullable IElementType elementType, + boolean result, + boolean pinned, + @Nullable FlexibleSearchParserUtils.Parser eatMore) { + int initialPos = builder.rawTokenIndex(); + boolean willFail = !result && !pinned; + replace_variants_with_name_(state, frame, builder, result, pinned); + int lastErrorPos = getLastVariantPos(state, initialPos); + if (!state.suppressErrors && eatMore != null) { + state.suppressErrors = true; + final boolean eatMoreFlagOnce = !builder.eof() && eatMore.parse(builder, frame.level + 1); + boolean eatMoreFlag = eatMoreFlagOnce || !result && frame.position == initialPos && lastErrorPos > frame.position; + + PsiBuilderImpl.ProductionMarker latestDoneMarker = + (pinned || result) && (state.altMode || elementType != null) && + eatMoreFlagOnce ? (PsiBuilderImpl.ProductionMarker)builder.getLatestDoneMarker() : null; + PsiBuilder.Marker extensionMarker = null; + IElementType extensionTokenType = null; + // whitespace prefix makes the very first frame offset bigger than marker start offset which is always 0 + if (latestDoneMarker != null && + frame.position >= latestDoneMarker.getStartIndex() && + frame.position <= latestDoneMarker.getEndIndex()) { + extensionMarker = ((PsiBuilder.Marker)latestDoneMarker).precede(); + extensionTokenType = latestDoneMarker.getTokenType(); + ((PsiBuilder.Marker)latestDoneMarker).drop(); + } + // advance to the last error pos + // skip tokens until lastErrorPos. parseAsTree might look better here... + int parenCount = 0; + while ((eatMoreFlag || parenCount > 0) && builder.rawTokenIndex() < lastErrorPos) { + IElementType tokenType = builder.getTokenType(); + if (state.braces != null) { + if (tokenType == state.braces[0].getLeftBraceType()) parenCount ++; + else if (tokenType == state.braces[0].getRightBraceType()) parenCount --; + } + if (!(builder.rawTokenIndex() < lastErrorPos)) break; + builder.advanceLexer(); + eatMoreFlag = eatMore.parse(builder, frame.level + 1); + } + boolean errorReported = frame.errorReportedAt == initialPos || !result && frame.errorReportedAt >= frame.position; + if (errorReported) { + if (eatMoreFlag) { + builder.advanceLexer(); + parseAsTree(state, builder, frame.level + 1, DUMMY_BLOCK, true, TOKEN_ADVANCER, eatMore); + } + } + else if (eatMoreFlag) { + errorReported = reportError(builder, state, frame, null, true, true); + parseAsTree(state, builder, frame.level + 1, DUMMY_BLOCK, true, TOKEN_ADVANCER, eatMore); + } + else if (eatMoreFlagOnce || (!result && frame.position != builder.rawTokenIndex()) || frame.errorReportedAt > initialPos) { + errorReported = reportError(builder, state, frame, null, true, false); + } + else if (!result && pinned && frame.errorReportedAt < 0) { + errorReported = reportError(builder, state, frame, elementType, false, false); + } + if (extensionMarker != null) { + extensionMarker.done(extensionTokenType); + } + state.suppressErrors = false; + if (errorReported || result) { + state.clearVariants(true, 0); + state.clearVariants(false, 0); + state.lastExpectedVariantPos = -1; + } + } + else if (!result && pinned && frame.errorReportedAt < 0) { + // do not report if there are errors beyond current position + if (lastErrorPos == initialPos) { + // do not force, inner recoverRoot might have skipped some tokens + reportError(builder, state, frame, elementType, false, false); + } + else if (lastErrorPos > initialPos) { + // set error pos here as if it is reported for future reference + frame.errorReportedAt = lastErrorPos; + } + } + // propagate errorReportedAt up the stack to avoid duplicate reporting + FlexibleSearchParserUtils.Frame prevFrame = willFail && eatMore == null ? null : state.currentFrame; + if (prevFrame != null && prevFrame.errorReportedAt < frame.errorReportedAt) { + prevFrame.errorReportedAt = frame.errorReportedAt; + } + } + + private static void close_frame_impl_(FlexibleSearchParserUtils.ErrorState state, + FlexibleSearchParserUtils.Frame frame, + PsiBuilder builder, + PsiBuilder.Marker marker, + IElementType elementType, + boolean result, + boolean pinned) { + if (elementType != null && marker != null) { + if (result || pinned) { + if ((frame.modifiers & _COLLAPSE_) != 0) { + PsiBuilderImpl.ProductionMarker last = (PsiBuilderImpl.ProductionMarker)builder.getLatestDoneMarker(); + if (last != null && + last.getStartIndex() == frame.position && + state.typeExtends(last.getTokenType(), elementType) && + wasAutoSkipped(builder, builder.rawTokenIndex() - last.getEndIndex())) { + elementType = last.getTokenType(); + ((PsiBuilder.Marker)last).drop(); + } + } + if ((frame.modifiers & _UPPER_) != 0) { + marker.drop(); + for (FlexibleSearchParserUtils.Frame f = frame.parentFrame; f != null; f = f.parentFrame) { + if (f.elementType == null) continue; + f.elementType = elementType; + break; + } + } + else if ((frame.modifiers & _LEFT_INNER_) != 0 && frame.leftMarker != null) { + marker.done(elementType); + frame.leftMarker.precede().done(((LighterASTNode)frame.leftMarker).getTokenType()); + frame.leftMarker.drop(); + } + else if ((frame.modifiers & _LEFT_) != 0 && frame.leftMarker != null) { + marker.drop(); + frame.leftMarker.precede().done(elementType); + } + else { + if (frame.level == 0) builder.eof(); // skip whitespaces + marker.done(elementType); + } + } + else { + close_marker_impl_(frame, marker, null, false); + } + } + else if (result || pinned) { + if (marker != null) marker.drop(); + if ((frame.modifiers & _LEFT_INNER_) != 0 && frame.leftMarker != null) { + frame.leftMarker.precede().done(((LighterASTNode)frame.leftMarker).getTokenType()); + frame.leftMarker.drop(); + } + } + else { + close_marker_impl_(frame, marker, null, false); + } + } + + private static void close_marker_impl_(FlexibleSearchParserUtils.Frame frame, PsiBuilder.Marker marker, IElementType elementType, boolean result) { + if (marker == null) return; + if (result) { + if (elementType != null) { + marker.done(elementType); + } + else { + marker.drop(); + } + } + else { + if (frame != null) { + int position = ((PsiBuilderImpl.ProductionMarker)marker).getStartIndex(); + if (frame.errorReportedAt > position && frame.parentFrame != null) { + frame.errorReportedAt = frame.parentFrame.errorReportedAt; + } + } + marker.rollbackTo(); + } + } + + private static void replace_variants_with_name_(FlexibleSearchParserUtils.ErrorState state, + FlexibleSearchParserUtils.Frame frame, + PsiBuilder builder, + boolean result, + boolean pinned) { + int initialPos = builder.rawTokenIndex(); + boolean willFail = !result && !pinned; + if (willFail && initialPos == frame.position && state.lastExpectedVariantPos == frame.position && + frame.name != null && state.variants.size() - frame.variantCount > 1) { + state.clearVariants(true, frame.variantCount); + addVariantInner(state, initialPos, frame.name); + } + } + + public static boolean report_error_(PsiBuilder builder, boolean result) { + if (!result) report_error_(builder, FlexibleSearchParserUtils.ErrorState.get(builder), false); + return result; + } + + public static void report_error_(PsiBuilder builder, FlexibleSearchParserUtils.ErrorState state, boolean advance) { + FlexibleSearchParserUtils.Frame frame = state.currentFrame; + if (frame == null) { + LOG.error("unbalanced enter/exit section call: got null"); + return; + } + int position = builder.rawTokenIndex(); + if (frame.errorReportedAt < position && getLastVariantPos(state, position + 1) <= position) { + reportError(builder, state, frame, null, true, advance); + } + } + + public static boolean withProtectedLastVariantPos(PsiBuilder builder, int level, FlexibleSearchParserUtils.Parser parser) { + FlexibleSearchParserUtils.ErrorState state = FlexibleSearchParserUtils.ErrorState.get(builder); + int backup = state.lastExpectedVariantPos; + boolean result = parser.parse(builder, level); + state.lastExpectedVariantPos = backup; + return result; + } + + private static int getLastVariantPos(FlexibleSearchParserUtils.ErrorState state, int defValue) { + return state.lastExpectedVariantPos < 0? defValue : state.lastExpectedVariantPos; + } + + private static boolean reportError(PsiBuilder builder, + FlexibleSearchParserUtils.ErrorState state, + FlexibleSearchParserUtils.Frame frame, + IElementType elementType, + boolean force, + boolean advance) { + String expectedText = state.getExpectedText(builder); + boolean notEmpty = isNotEmpty(expectedText); + if (!(force || notEmpty || advance)) return false; + + String actual = "'" + first(notNullize(builder.getTokenText(), "null"), MAX_ERROR_TOKEN_TEXT, true) + "'"; + String message = expectedText + (builder.eof() ? "unexpected end of file" : notEmpty ? "got " + actual : actual + " unexpected"); + if (advance) { +// PsiBuilder.Marker mark = builder.mark(); + builder.advanceLexer(); +// mark.error(message); + } + else if (!force) { + PsiBuilder.Marker extensionMarker = null; + IElementType extensionTokenType = null; + PsiBuilderImpl.ProductionMarker latestDoneMarker = elementType == null ? null : (PsiBuilderImpl.ProductionMarker)builder.getLatestDoneMarker(); + if (latestDoneMarker != null && + frame.position >= latestDoneMarker.getStartIndex() && + frame.position <= latestDoneMarker.getEndIndex()) { + extensionMarker = ((PsiBuilder.Marker)latestDoneMarker).precede(); + extensionTokenType = latestDoneMarker.getTokenType(); + ((PsiBuilder.Marker)latestDoneMarker).drop(); + } +// builder.error(message); + if (extensionMarker != null) extensionMarker.done(extensionTokenType); + } + else { + //builder.error(message); + } + builder.eof(); // skip whitespaces + frame.errorReportedAt = builder.rawTokenIndex(); + return true; + } + + + public static final Key COMPLETION_STATE_KEY = Key.create("COMPLETION_STATE_KEY"); + + public static class CompletionState implements Function { + public final int offset; + public final Collection items = new THashSet<>(); + + public CompletionState(int offset_) { + offset = offset_; + } + + @Nullable + public String convertItem(Object o) { + return o instanceof Object[] ? join((Object[]) o, this, " ") : o.toString(); + } + + @Override + public String fun(Object o) { + return convertItem(o); + } + + public void addItem(@NotNull PsiBuilder builder, @NotNull String text) { + items.add(text); + } + + public boolean prefixMatches(@NotNull PsiBuilder builder, @NotNull String text) { + int builderOffset = builder.getCurrentOffset(); + int diff = offset - builderOffset; + int length = text.length(); + if (diff == 0) { + return true; + } + else if (diff > 0 && diff <= length) { + CharSequence fragment = builder.getOriginalText().subSequence(builderOffset, offset); + return prefixMatches(fragment.toString(), text); + } + else if (diff < 0) { + for (int i=-1; ; i--) { + IElementType type = builder.rawLookup(i); + int tokenStart = builder.rawTokenTypeStart(i); + if (isWhitespaceOrComment(builder, type)) { + diff = offset - tokenStart; + } + else if (type != null && tokenStart < offset) { + CharSequence fragment = builder.getOriginalText().subSequence(tokenStart, offset); + if (prefixMatches(fragment.toString(), text)) { + diff = offset - tokenStart; + } + break; + } + else break; + } + return diff >= 0 && diff < length; + } + return false; + } + + public boolean prefixMatches(@NotNull String prefix, @NotNull String variant) { + boolean matches = new CamelHumpMatcher(prefix, false).prefixMatches(variant.replace(' ', '_')); + if (matches && isWhiteSpace(prefix.charAt(prefix.length() - 1))) { + return startsWithIgnoreCase(variant, prefix); + } + return matches; + } + } + + public static class Builder extends PsiBuilderAdapter { + public final FlexibleSearchParserUtils.ErrorState state; + public final PsiParser parser; + + public Builder(PsiBuilder builder, FlexibleSearchParserUtils.ErrorState state_, PsiParser parser_) { + super(builder); + state = state_; + parser = parser_; + } + + public Lexer getLexer() { + return ((PsiBuilderImpl)myDelegate).getLexer(); + } + } + + public static PsiBuilder adapt_builder_(IElementType root, PsiBuilder builder, PsiParser parser) { + return adapt_builder_(root, builder, parser, null); + } + + public static PsiBuilder adapt_builder_(IElementType root, PsiBuilder builder, PsiParser parser, TokenSet[] extendsSets) { + FlexibleSearchParserUtils.ErrorState state = new FlexibleSearchParserUtils.ErrorState(); + FlexibleSearchParserUtils.ErrorState.initState(state, builder, root, extendsSets); + return new FlexibleSearchParserUtils.Builder(builder, state, parser); + } + + public static class ErrorState { + TokenSet[] extendsSets; + public PairProcessor altExtendsChecker; + + int predicateCount; + int level; + boolean predicateSign = true; + boolean suppressErrors; + FlexibleSearchParserUtils.Hooks hooks; + public FlexibleSearchParserUtils.Frame currentFrame; + public FlexibleSearchParserUtils.CompletionState completionState; + + private boolean caseSensitive; + public BracePair[] braces; + public boolean altMode; + + int lastExpectedVariantPos = -1; + FlexibleSearchParserUtils.MyList variants = new FlexibleSearchParserUtils.MyList<>(INITIAL_VARIANTS_SIZE); + FlexibleSearchParserUtils.MyList unexpected = new FlexibleSearchParserUtils.MyList<>(INITIAL_VARIANTS_SIZE / 10); + + final LimitedPool VARIANTS = new LimitedPool<>(VARIANTS_POOL_SIZE, new LimitedPool.ObjectFactory() { + @NotNull + @Override + public FlexibleSearchParserUtils.Variant create() { + return new FlexibleSearchParserUtils.Variant(); + } + + @Override + public void cleanup(@NotNull FlexibleSearchParserUtils.Variant o) { + } + }); + final LimitedPool FRAMES = new LimitedPool<>(FRAMES_POOL_SIZE, new LimitedPool.ObjectFactory() { + @NotNull + @Override + public FlexibleSearchParserUtils.Frame create() { + return new FlexibleSearchParserUtils.Frame(); + } + + @Override + public void cleanup(@NotNull FlexibleSearchParserUtils.Frame o) { + } + }); + + public static FlexibleSearchParserUtils.ErrorState get(PsiBuilder builder) { + return ((FlexibleSearchParserUtils.Builder)builder).state; + } + + public static void initState(FlexibleSearchParserUtils.ErrorState state, PsiBuilder builder, IElementType root, TokenSet[] extendsSets) { + state.extendsSets = extendsSets; + PsiFile file = builder.getUserDataUnprotected(FileContextUtil.CONTAINING_FILE_KEY); + state.completionState = file == null? null: file.getUserData(COMPLETION_STATE_KEY); + Language language = file == null? root.getLanguage() : file.getLanguage(); + state.caseSensitive = language.isCaseSensitive(); + PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(language); + state.braces = matcher == null ? null : matcher.getPairs(); + if (state.braces != null && state.braces.length == 0) state.braces = null; + } + + public String getExpectedText(PsiBuilder builder) { + int position = builder.rawTokenIndex(); + StringBuilder sb = new StringBuilder(); + if (addExpected(sb, position, true)) { + sb.append(" expected, "); + } + return sb.toString(); + } + + private boolean addExpected(StringBuilder sb, int position, boolean expected) { + FlexibleSearchParserUtils.MyList list = expected ? variants : unexpected; + String[] strings = new String[list.size()]; + long[] hashes = new long[strings.length]; + Arrays.fill(strings, ""); + int count = 0; + loop: for (FlexibleSearchParserUtils.Variant variant : list) { + if (position == variant.position) { + String text = variant.object.toString(); + long hash = StringHash.calc(text); + for (int i=0; i 0) { + if (count > MAX_VARIANTS_TO_DISPLAY) { + sb.append(" and ..."); + break; + } + else { + sb.append(", "); + } + } + char c = s.charAt(0); + String displayText = c == '<' || isJavaIdentifierStart(c) ? s : '\'' + s + '\''; + sb.append(displayText); + } + if (count > 1 && count < MAX_VARIANTS_TO_DISPLAY) { + int idx = sb.lastIndexOf(", "); + sb.replace(idx, idx + 1, " or"); + } + return count > 0; + } + + public void clearVariants(FlexibleSearchParserUtils.Frame frame) { + clearVariants(true, frame == null ? 0 : frame.variantCount); + } + + void clearVariants(boolean expected, int start) { + FlexibleSearchParserUtils.MyList list = expected? variants : unexpected; + if (start < 0 || start >= list.size()) return; + for (int i = start, len = list.size(); i < len; i ++) { + VARIANTS.recycle(list.get(i)); + } + list.setSize(start); + } + + public boolean typeExtends(IElementType child, IElementType parent) { + if (child == parent) return true; + if (extendsSets != null) { + for (TokenSet set : extendsSets) { + if (set.contains(child) && set.contains(parent)) return true; + } + } + return altExtendsChecker != null && altExtendsChecker.process(child, parent); + } + } + + public static class Frame { + public FlexibleSearchParserUtils.Frame parentFrame; + public IElementType elementType; + + public int offset; + public int position; + public int level; + public int modifiers; + public String name; + public int variantCount; + public int errorReportedAt; + public PsiBuilder.Marker leftMarker; + + public Frame() { + } + + public FlexibleSearchParserUtils.Frame init(PsiBuilder builder, + FlexibleSearchParserUtils.ErrorState state, + int level_, + int modifiers_, + IElementType elementType_, + String name_) { + parentFrame = state.currentFrame; + elementType = elementType_; + + offset = builder.getCurrentOffset(); + position = builder.rawTokenIndex(); + level = level_; + modifiers = modifiers_; + name = name_; + variantCount = state.variants.size(); + errorReportedAt = -1; + + leftMarker = null; + return this; + } + + @Override + public String toString() { + String mod = modifiers == _NONE_ ? "_NONE_, " : + ((modifiers & _COLLAPSE_) != 0? "_CAN_COLLAPSE_, ": "") + + ((modifiers & _LEFT_) != 0? "_LEFT_, ": "") + + ((modifiers & _LEFT_INNER_) != 0? "_LEFT_INNER_, ": "") + + ((modifiers & _AND_) != 0? "_AND_, ": "") + + ((modifiers & _NOT_) != 0? "_NOT_, ": "") + + ((modifiers & _UPPER_) != 0 ? "_UPPER_, " : ""); + return String.format("{%s:%s:%d, %d, %s%s, %s}", offset, position, level, errorReportedAt, mod, elementType, name); + } + } + + + private static class Variant { + int position; + Object object; + + public FlexibleSearchParserUtils.Variant init(int pos, Object o) { + position = pos; + object = o; + return this; + } + + @Override + public String toString() { + return "<" + position + ", " + object + ">"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + FlexibleSearchParserUtils.Variant variant = (FlexibleSearchParserUtils.Variant)o; + + if (position != variant.position) return false; + if (!this.object.equals(variant.object)) return false; + + return true; + } + + @Override + public int hashCode() { + int result = position; + result = 31 * result + object.hashCode(); + return result; + } + } + + private static class Hooks { + final FlexibleSearchParserUtils.Hook hook; + final T param; + final int level; + final FlexibleSearchParserUtils.Hooks next; + + Hooks(FlexibleSearchParserUtils.Hook hook, T param, int level, FlexibleSearchParserUtils.Hooks next) { + this.hook = hook; + this.param = param; + this.level = level; + this.next = next; + } + + static FlexibleSearchParserUtils.Hooks concat(FlexibleSearchParserUtils.Hook hook, E param, int level, FlexibleSearchParserUtils.Hooks hooks) { + return new FlexibleSearchParserUtils.Hooks<>(hook, param, level, hooks); + } + } + + + private static final int MAX_CHILDREN_IN_TREE = 10; + public static boolean parseAsTree(FlexibleSearchParserUtils.ErrorState state, final PsiBuilder builder, int level, final IElementType chunkType, + boolean checkBraces, final FlexibleSearchParserUtils.Parser parser, final FlexibleSearchParserUtils.Parser eatMoreCondition) { + final LinkedList> parenList = new LinkedList<>(); + final LinkedList> siblingList = new LinkedList<>(); + PsiBuilder.Marker marker = null; + + final Runnable checkSiblingsRunnable = () -> { + main: + while (!siblingList.isEmpty()) { + final Pair parenPair = parenList.peek(); + final int rating = siblingList.getFirst().second; + int count = 0; + for (Pair pair : siblingList) { + if (pair.second != rating || parenPair != null && pair.first == parenPair.second) break main; + if (++count >= MAX_CHILDREN_IN_TREE) { + PsiBuilder.Marker parentMarker = pair.first.precede(); + parentMarker.setCustomEdgeTokenBinders(WhitespacesBinders.GREEDY_LEFT_BINDER, null); + while (count-- > 0) { + siblingList.removeFirst(); + } + parentMarker.done(chunkType); + siblingList.addFirst(Pair.create(parentMarker, rating + 1)); + continue main; + } + } + break; + } + }; + boolean checkParens = state.braces != null && checkBraces; + int totalCount = 0; + int tokenCount = 0; + if (checkParens) { + int tokenIdx = -1; + while (builder.rawLookup(tokenIdx) == TokenType.WHITE_SPACE) tokenIdx --; + LighterASTNode doneMarker = builder.rawLookup(tokenIdx) == state.braces[0].getLeftBraceType() ? builder.getLatestDoneMarker() : null; + if (doneMarker != null && doneMarker.getStartOffset() == builder.rawTokenTypeStart(tokenIdx) && doneMarker.getTokenType() == TokenType.ERROR_ELEMENT) { + parenList.add(Pair.create(((PsiBuilder.Marker)doneMarker).precede(), null)); + } + } + int c = current_position_(builder); + while (true) { + final IElementType tokenType = builder.getTokenType(); + if (checkParens && (tokenType == state.braces[0].getLeftBraceType() || tokenType == state.braces[0].getRightBraceType() && !parenList.isEmpty())) { + if (marker != null) { + marker.done(chunkType); + siblingList.addFirst(Pair.create(marker, 1)); + marker = null; + tokenCount = 0; + } + if (tokenType == state.braces[0].getLeftBraceType()) { + final Pair prev = siblingList.peek(); + parenList.addFirst(Pair.create(builder.mark(), prev == null ? null : prev.first)); + } + checkSiblingsRunnable.run(); + builder.advanceLexer(); + if (tokenType == state.braces[0].getRightBraceType()) { + final Pair pair = parenList.removeFirst(); + pair.first.done(chunkType); + // drop all markers inside parens + while (!siblingList.isEmpty() && siblingList.getFirst().first != pair.second) { + siblingList.removeFirst(); + } + siblingList.addFirst(Pair.create(pair.first, 1)); + checkSiblingsRunnable.run(); + } + } + else { + if (marker == null) { + marker = builder.mark(); + marker.setCustomEdgeTokenBinders(WhitespacesBinders.GREEDY_LEFT_BINDER, null); + } + boolean result = (!parenList.isEmpty() || eatMoreCondition.parse(builder, level + 1)) && parser.parse(builder, level + 1); + if (result) { + tokenCount++; + totalCount++; + } + if (!result) { + break; + } + } + + if (tokenCount >= MAX_CHILDREN_IN_TREE) { + marker.done(chunkType); + siblingList.addFirst(Pair.create(marker, 1)); + checkSiblingsRunnable.run(); + marker = null; + tokenCount = 0; + } + if (!empty_element_parsed_guard_(builder, "parseAsTree", c)) break; + c = current_position_(builder); + } + if (marker != null) marker.drop(); + for (Pair pair : parenList) { + pair.first.drop(); + } + return totalCount != 0; + } + + private static class DummyBlockElementType extends IElementType implements ICompositeElementType { + DummyBlockElementType() { + super("DUMMY_BLOCK", Language.ANY); + } + + @NotNull + @Override + public ASTNode createCompositeNode() { + return new FlexibleSearchParserUtils.DummyBlock(); + } + } + + public static class DummyBlock extends CompositePsiElement { + DummyBlock() { + super(DUMMY_BLOCK); + } + + @NotNull + @Override + public PsiReference[] getReferences() { + return PsiReference.EMPTY_ARRAY; + } + + @NotNull + @Override + public Language getLanguage() { + return getParent().getLanguage(); + } + } + + private static class MyList extends ArrayList { + MyList(int initialCapacity) { + super(initialCapacity); + } + + protected void setSize(int fromIndex) { + removeRange(fromIndex, size()); + } + + @Override + public boolean add(E e) { + int size = size(); + if (size >= MAX_VARIANTS_SIZE) { + removeRange(MAX_VARIANTS_SIZE / 4, size - MAX_VARIANTS_SIZE / 4); + } + return super.add(e); + } + } +} diff --git a/src/com/intellij/idea/plugin/hybris/impex/ImpexLexer.java b/src/com/intellij/idea/plugin/hybris/impex/ImpexLexer.java index 07f39ad99..91eb2dff1 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/ImpexLexer.java +++ b/src/com/intellij/idea/plugin/hybris/impex/ImpexLexer.java @@ -20,10 +20,11 @@ package com.intellij.idea.plugin.hybris.impex; -import com.intellij.idea.plugin.hybris.impex.psi.ImpexTypes; import com.intellij.lexer.FlexLexer; -import com.intellij.psi.TokenType; import com.intellij.psi.tree.IElementType; +import com.intellij.idea.plugin.hybris.impex.psi.ImpexTypes; +import com.intellij.psi.TokenType; +import com.intellij.psi.CustomHighlighterTokenType; /** @@ -41,19 +42,18 @@ class ImpexLexer implements FlexLexer { /** lexical states */ public static final int YYINITIAL = 0; - public static final int COMMENT = 2; - public static final int WAITING_MACRO_VALUE = 4; - public static final int MACRO_DECLARATION = 6; - public static final int HEADER_TYPE = 8; - public static final int HEADER_LINE = 10; - public static final int FIELD_VALUE = 12; - public static final int BEAN_SHELL = 14; - public static final int MODYFIERS_BLOCK = 16; - public static final int WAITING_ATTR_OR_PARAM_VALUE = 18; - public static final int HEADER_PARAMETERS = 20; - public static final int MACRO_USAGE = 22; - public static final int MACRO_CONFIG_USAGE = 24; - public static final int WAITING_MACRO_CONFIG_USAGE = 26; + public static final int WAITING_MACRO_VALUE = 2; + public static final int MACRO_DECLARATION = 4; + public static final int HEADER_TYPE = 6; + public static final int HEADER_LINE = 8; + public static final int FIELD_VALUE = 10; + public static final int BEAN_SHELL = 12; + public static final int MODYFIERS_BLOCK = 14; + public static final int WAITING_ATTR_OR_PARAM_VALUE = 16; + public static final int HEADER_PARAMETERS = 18; + public static final int MACRO_USAGE = 20; + public static final int MACRO_CONFIG_USAGE = 22; + public static final int WAITING_MACRO_CONFIG_USAGE = 24; /** * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l @@ -63,7 +63,7 @@ class ImpexLexer implements FlexLexer { */ private static final int ZZ_LEXSTATE[] = { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, - 8, 8, 9, 9, 10, 10, 11, 11, 10, 10, 12, 12 + 8, 8, 9, 9, 10, 10, 9, 9, 11, 11 }; /** @@ -98,33 +98,33 @@ public static int ZZ_CMAP(int ch) { private static final int [] ZZ_ACTION = zzUnpackAction(); private static final String ZZ_ACTION_PACKED_0 = - "\1\0\1\1\5\0\1\2\5\0\1\3\1\4\2\5"+ - "\1\6\1\7\3\3\1\4\1\10\2\4\1\1\1\6"+ - "\11\11\1\12\1\13\1\14\1\15\1\16\4\11\1\17"+ - "\2\11\1\20\1\21\1\22\1\3\1\23\1\24\1\25"+ - "\1\26\1\27\2\3\6\30\1\31\1\32\1\33\1\34"+ - "\2\30\1\17\2\30\1\2\1\6\1\2\1\35\1\3"+ - "\1\36\1\37\1\40\6\41\1\42\1\41\1\17\1\3"+ - "\2\43\1\44\1\0\1\45\3\46\1\0\3\4\1\11"+ - "\1\0\1\47\2\50\1\11\1\0\4\11\1\17\1\11"+ - "\1\51\3\0\1\52\2\46\1\53\1\30\1\54\1\30"+ - "\3\0\1\2\1\41\1\47\1\45\2\46\3\41\2\55"+ - "\2\0\1\46\1\56\1\46\1\0\3\4\1\47\1\0"+ - "\2\50\1\11\1\0\4\11\1\17\1\0\2\46\2\30"+ - "\1\17\2\0\1\2\1\47\1\41\2\46\2\41\1\17"+ - "\2\55\1\0\2\46\1\0\3\4\1\50\2\0\1\11"+ - "\1\57\2\11\1\0\1\46\1\57\1\60\1\46\1\57"+ - "\1\55\1\0\2\46\1\0\3\4\1\50\1\57\1\0"+ - "\3\11\1\0\2\46\1\55\1\0\1\46\1\0\2\61"+ - "\1\62\1\63\1\0\2\64\1\65\1\66\2\0\1\41"+ - "\4\0\1\4\2\0\1\11\2\0\1\41\4\0\1\4"+ - "\2\0\1\11\1\67\1\0\1\41\2\0\2\46\1\0"+ - "\1\4\1\0\1\11\1\0\1\46\1\0\1\4\1\0"+ - "\1\11\1\0\1\46\1\0\1\4\1\0\1\11\1\0"+ - "\1\46\1\0\1\4\1\0\1\11\1\0\2\70\2\71"; + "\6\0\1\1\5\0\1\2\1\3\2\4\1\5\1\6"+ + "\3\2\1\3\1\7\2\3\11\10\1\11\1\12\1\13"+ + "\1\14\1\15\4\10\1\16\2\10\1\17\1\20\1\21"+ + "\1\2\1\22\1\23\1\24\1\25\1\26\2\2\6\27"+ + "\1\30\1\31\1\32\1\33\2\27\1\16\2\27\1\1"+ + "\1\5\1\1\1\34\1\2\1\35\1\36\1\37\6\40"+ + "\1\41\1\40\1\16\1\2\2\42\1\6\1\43\1\0"+ + "\1\44\3\45\1\0\3\3\1\10\1\0\1\46\2\47"+ + "\1\10\1\0\4\10\1\16\1\10\1\50\3\0\1\51"+ + "\2\45\1\52\1\27\1\53\1\27\3\0\1\1\1\40"+ + "\1\46\1\44\2\45\3\40\2\54\2\0\1\45\1\55"+ + "\1\45\1\0\3\3\1\46\1\0\2\47\1\10\1\0"+ + "\4\10\1\16\1\0\2\45\2\27\1\16\2\0\1\1"+ + "\1\46\1\40\2\45\2\40\1\16\2\54\1\0\2\45"+ + "\1\0\3\3\1\47\2\0\1\10\1\56\2\10\1\0"+ + "\1\45\1\56\1\57\1\45\1\56\1\54\1\0\2\45"+ + "\1\0\3\3\1\47\1\56\1\0\3\10\1\0\2\45"+ + "\1\54\1\0\1\45\1\0\2\60\1\61\1\62\1\0"+ + "\2\63\1\64\1\65\2\0\1\40\4\0\1\3\2\0"+ + "\1\10\2\0\1\40\4\0\1\3\2\0\1\10\1\66"+ + "\1\0\1\40\2\0\2\45\1\0\1\3\1\0\1\10"+ + "\1\0\1\45\1\0\1\3\1\0\1\10\1\0\1\45"+ + "\1\0\1\3\1\0\1\10\1\0\1\45\1\0\1\3"+ + "\1\0\1\10\1\0\2\67\2\70"; private static int [] zzUnpackAction() { - int [] result = new int[287]; + int [] result = new int[285]; int offset = 0; offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); return result; @@ -150,44 +150,44 @@ private static int zzUnpackAction(String packed, int offset, int [] result) { private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\61\0\142\0\223\0\304\0\365\0\u0126\0\u0157"+ - "\0\u0188\0\u01b9\0\u01ea\0\u021b\0\u024c\0\u027d\0\u02ae\0\u027d"+ - "\0\u02df\0\u0310\0\u0341\0\u0372\0\u03a3\0\u03d4\0\u0405\0\u027d"+ - "\0\u0436\0\u0467\0\u0498\0\u04c9\0\u027d\0\u04fa\0\u052b\0\u0372"+ - "\0\u055c\0\u058d\0\u05be\0\u05ef\0\u0620\0\u027d\0\u027d\0\u027d"+ - "\0\u027d\0\u027d\0\u0651\0\u0682\0\u06b3\0\u06e4\0\u0715\0\u0746"+ - "\0\u0777\0\u027d\0\u07a8\0\u07d9\0\u080a\0\u027d\0\u027d\0\u027d"+ - "\0\u027d\0\u027d\0\u0746\0\u083b\0\u027d\0\u086c\0\u0372\0\u080a"+ - "\0\u089d\0\u08ce\0\u027d\0\u027d\0\u027d\0\u027d\0\u08ff\0\u06e4"+ - "\0\u0930\0\u0961\0\u0777\0\u0992\0\u09c3\0\u09f4\0\u0a25\0\u052b"+ - "\0\u027d\0\u027d\0\u027d\0\u0a56\0\u0a87\0\u0ab8\0\u0ae9\0\u0b1a"+ - "\0\u0b4b\0\u027d\0\u0b7c\0\u0bad\0\u0bde\0\u027d\0\u0c0f\0\u027d"+ - "\0\u0372\0\u0c40\0\u0c71\0\u0ca2\0\u0cd3\0\u0d04\0\u0d35\0\u0d66"+ + "\0\u0188\0\u01b9\0\u01ea\0\u021b\0\u024c\0\u027d\0\u024c\0\u02ae"+ + "\0\u02df\0\u0310\0\u0341\0\u0372\0\u03a3\0\u03d4\0\u024c\0\u0405"+ + "\0\u0436\0\u024c\0\u0467\0\u0498\0\u0341\0\u04c9\0\u04fa\0\u052b"+ + "\0\u055c\0\u058d\0\u024c\0\u024c\0\u024c\0\u024c\0\u024c\0\u05be"+ + "\0\u05ef\0\u0620\0\u0651\0\u0682\0\u06b3\0\u06e4\0\u024c\0\u0715"+ + "\0\u0746\0\u0777\0\u024c\0\u024c\0\u024c\0\u024c\0\u024c\0\u06b3"+ + "\0\u07a8\0\u024c\0\u07d9\0\u0341\0\u0777\0\u080a\0\u083b\0\u024c"+ + "\0\u024c\0\u024c\0\u024c\0\u086c\0\u0651\0\u089d\0\u08ce\0\u06e4"+ + "\0\u08ff\0\u0930\0\u0961\0\u0992\0\u0498\0\u024c\0\u024c\0\u024c"+ + "\0\u09c3\0\u09f4\0\u0a25\0\u0a56\0\u0a87\0\u0ab8\0\u024c\0\u0ae9"+ + "\0\u0b1a\0\u0b4b\0\u024c\0\u0b7c\0\u0bad\0\u0bad\0\u0341\0\u0bde"+ + "\0\u0c0f\0\u0c40\0\u0c71\0\u0ca2\0\u0cd3\0\u0d04\0\u0d35\0\u0d66"+ "\0\u0d97\0\u0dc8\0\u0df9\0\u0e2a\0\u0e5b\0\u0e8c\0\u0ebd\0\u0eee"+ - "\0\u0f1f\0\u0f50\0\u0f81\0\u0fb2\0\u0fe3\0\u1014\0\u0746\0\u1045"+ - "\0\u1076\0\u10a7\0\u027d\0\u10d8\0\u1109\0\u083b\0\u113a\0\u027d"+ + "\0\u0f1f\0\u0f50\0\u0f81\0\u0fb2\0\u06b3\0\u0fe3\0\u1014\0\u1045"+ + "\0\u024c\0\u1076\0\u10a7\0\u07a8\0\u10d8\0\u024c\0\u1109\0\u113a"+ "\0\u116b\0\u119c\0\u11cd\0\u11fe\0\u122f\0\u1260\0\u1291\0\u12c2"+ "\0\u12f3\0\u1324\0\u1355\0\u1386\0\u13b7\0\u13e8\0\u1419\0\u144a"+ - "\0\u147b\0\u14ac\0\u027d\0\u14dd\0\u150e\0\u153f\0\u1570\0\u15a1"+ - "\0\u027d\0\u15d2\0\u1603\0\u1634\0\u1665\0\u1696\0\u16c7\0\u16f8"+ - "\0\u1729\0\u175a\0\u178b\0\u17bc\0\u17ed\0\u181e\0\u184f\0\u1880"+ - "\0\u119c\0\u18b1\0\u0961\0\u18e2\0\u0a56\0\u1913\0\u1944\0\u1975"+ - "\0\u19a6\0\u19d7\0\u13b7\0\u1a08\0\u1a39\0\u1a6a\0\u1a9b\0\u1acc"+ - "\0\u1afd\0\u1b2e\0\u1b5f\0\u1b90\0\u1bc1\0\u1bf2\0\u1c23\0\u1c54"+ - "\0\u04fa\0\u1c85\0\u1cb6\0\u1ce7\0\u1d18\0\u086c\0\u18b1\0\u1d49"+ - "\0\u0a56\0\u1d7a\0\u1dab\0\u1ddc\0\u1e0d\0\u1e3e\0\u1e6f\0\u1ea0"+ - "\0\u1ed1\0\u1f02\0\u027d\0\u1f33\0\u1f64\0\u1f95\0\u1fc6\0\u1ff7"+ - "\0\u2028\0\u2059\0\u208a\0\u20bb\0\u20ec\0\u211d\0\u214e\0\u217f"+ - "\0\u02ae\0\u02ae\0\u21b0\0\u21e1\0\u2212\0\u04fa\0\u04fa\0\u2243"+ + "\0\u024c\0\u147b\0\u14ac\0\u14dd\0\u150e\0\u153f\0\u024c\0\u1570"+ + "\0\u15a1\0\u15d2\0\u1603\0\u1634\0\u1665\0\u1696\0\u16c7\0\u16f8"+ + "\0\u1729\0\u175a\0\u178b\0\u17bc\0\u17ed\0\u181e\0\u113a\0\u184f"+ + "\0\u08ce\0\u1880\0\u09c3\0\u18b1\0\u18e2\0\u1913\0\u1944\0\u1975"+ + "\0\u1355\0\u19a6\0\u19d7\0\u1a08\0\u1a39\0\u1a6a\0\u1a9b\0\u1acc"+ + "\0\u1afd\0\u1b2e\0\u1b5f\0\u1b90\0\u1bc1\0\u1bf2\0\u0467\0\u1c23"+ + "\0\u1c54\0\u1c85\0\u1cb6\0\u07d9\0\u184f\0\u1ce7\0\u09c3\0\u1d18"+ + "\0\u1d49\0\u1d7a\0\u1dab\0\u1ddc\0\u1e0d\0\u1e3e\0\u1e6f\0\u1ea0"+ + "\0\u024c\0\u1ed1\0\u1f02\0\u1f33\0\u1f64\0\u1f95\0\u1fc6\0\u1ff7"+ + "\0\u2028\0\u2059\0\u208a\0\u20bb\0\u20ec\0\u211d\0\u027d\0\u027d"+ + "\0\u214e\0\u217f\0\u21b0\0\u0467\0\u0467\0\u21e1\0\u2212\0\u2243"+ "\0\u2274\0\u22a5\0\u22d6\0\u2307\0\u2338\0\u2369\0\u239a\0\u23cb"+ "\0\u23fc\0\u242d\0\u245e\0\u248f\0\u24c0\0\u24f1\0\u2522\0\u2553"+ - "\0\u2584\0\u25b5\0\u1603\0\u25e6\0\u2617\0\u027d\0\u17ed\0\u1944"+ - "\0\u1a08\0\u2648\0\u2679\0\u26aa\0\u26db\0\u270c\0\u273d\0\u276e"+ + "\0\u15a1\0\u2584\0\u25b5\0\u024c\0\u178b\0\u18e2\0\u19a6\0\u25e6"+ + "\0\u2617\0\u2648\0\u2679\0\u26aa\0\u26db\0\u270c\0\u273d\0\u276e"+ "\0\u279f\0\u27d0\0\u2801\0\u2832\0\u2863\0\u2894\0\u28c5\0\u28f6"+ "\0\u2927\0\u2958\0\u2989\0\u29ba\0\u29eb\0\u2a1c\0\u2a4d\0\u2a7e"+ - "\0\u2aaf\0\u2ae0\0\u2b11\0\u027d\0\u02ae\0\u027d\0\u04fa"; + "\0\u2aaf\0\u024c\0\u027d\0\u024c\0\u0467"; private static int [] zzUnpackRowMap() { - int [] result = new int[287]; + int [] result = new int[285]; int offset = 0; offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); return result; @@ -210,350 +210,349 @@ private static int zzUnpackRowMap(String packed, int offset, int [] result) { private static final int [] ZZ_TRANS = zzUnpackTrans(); private static final String ZZ_TRANS_PACKED_0 = - "\1\16\1\17\1\20\1\21\1\22\1\23\2\16\1\24"+ - "\1\25\4\17\1\26\1\27\2\17\6\16\1\30\4\16"+ - "\1\17\1\31\1\32\3\17\1\16\1\17\1\16\1\17"+ - "\2\16\5\17\2\16\1\0\2\33\1\20\1\21\1\34"+ - "\54\33\1\35\1\36\1\20\1\21\1\22\2\35\1\37"+ - "\1\40\1\41\3\36\1\42\1\43\1\44\1\36\1\45"+ - "\2\35\1\46\1\47\1\50\1\51\1\35\1\52\3\35"+ - "\1\53\1\54\1\55\3\36\1\35\1\36\1\56\1\57"+ - "\1\60\1\35\5\36\1\35\1\61\1\35\2\16\1\20"+ - "\1\21\1\22\15\16\1\62\35\16\1\0\1\16\1\63"+ - "\1\20\1\21\1\22\5\16\4\63\1\16\3\63\13\16"+ - "\6\63\1\16\1\63\1\16\1\63\2\16\5\63\2\16"+ - "\1\0\1\16\1\64\1\20\1\21\1\22\4\16\1\65"+ - "\4\64\1\16\3\64\1\66\1\67\1\70\1\47\1\50"+ - "\1\51\1\71\1\52\2\16\1\72\6\64\1\16\1\64"+ - "\1\16\1\64\1\73\1\74\5\64\2\16\1\0\1\75"+ - "\1\76\1\20\1\21\1\22\3\75\1\77\1\100\3\76"+ - "\1\101\1\75\2\76\1\102\6\75\1\103\1\104\1\105"+ - "\1\75\1\106\1\107\5\76\1\75\1\76\1\110\1\111"+ - "\2\75\5\76\1\112\1\113\1\75\2\114\1\20\1\21"+ - "\1\115\3\114\1\116\50\114\1\16\1\117\1\20\1\21"+ - "\1\22\2\16\1\120\1\24\1\65\4\117\1\16\3\117"+ - "\1\66\1\117\1\16\1\121\3\16\1\122\2\16\1\123"+ - "\6\117\1\16\1\117\1\16\1\117\2\16\5\117\2\16"+ - "\1\0\2\124\1\20\1\21\1\22\2\124\1\125\1\126"+ - "\1\127\3\124\1\130\3\124\1\131\3\124\1\121\3\124"+ - "\1\132\3\124\1\133\7\124\1\131\1\134\12\124\2\16"+ - "\1\20\1\21\1\22\53\16\1\0\2\16\1\20\1\21"+ - "\1\22\4\16\1\135\46\16\1\0\2\136\1\20\1\21"+ - "\1\22\4\136\1\137\46\136\63\0\1\17\10\0\4\17"+ - "\1\0\3\17\13\0\6\17\1\0\1\17\1\0\1\17"+ - "\2\0\5\17\5\0\1\20\62\0\1\22\62\0\1\140"+ - "\52\0\10\141\1\142\50\141\1\0\1\143\10\0\1\144"+ - "\3\143\1\0\3\143\1\0\1\145\2\0\2\145\5\0"+ - "\6\143\1\0\1\143\1\0\1\143\2\0\5\143\17\0"+ - "\1\146\45\0\1\17\10\0\2\17\1\147\1\17\1\0"+ - "\3\17\13\0\6\17\1\0\1\17\1\0\1\17\2\0"+ - "\5\17\4\0\1\17\10\0\4\17\1\0\3\17\13\0"+ - "\3\17\1\150\2\17\1\0\1\17\1\0\1\17\2\0"+ - "\5\17\4\0\1\17\10\0\4\17\1\0\3\17\13\0"+ - "\6\17\1\0\1\17\1\0\1\17\2\0\1\151\4\17"+ - "\3\0\2\33\2\0\57\33\2\0\1\34\54\33\1\0"+ - "\1\36\10\0\4\36\1\0\3\36\1\0\1\152\11\0"+ - "\6\36\1\0\1\36\1\0\1\36\2\0\5\36\3\0"+ - "\2\153\2\0\3\153\1\154\51\153\1\0\1\155\10\0"+ - "\1\156\3\155\1\0\3\155\13\0\6\155\1\0\1\155"+ - "\1\0\1\155\2\0\5\155\4\0\1\36\10\0\4\36"+ - "\1\0\3\36\1\0\1\152\11\0\4\36\1\157\1\36"+ - "\1\0\1\36\1\0\1\36\2\0\5\36\17\0\1\160"+ - "\45\0\1\36\10\0\2\36\1\161\1\36\1\0\3\36"+ - "\1\0\1\152\11\0\6\36\1\0\1\36\1\0\1\36"+ - "\2\0\5\36\4\0\1\36\10\0\4\36\1\0\3\36"+ - "\1\0\1\152\11\0\6\36\1\0\1\36\1\0\1\57"+ - "\2\0\5\36\4\0\1\36\10\0\4\36\1\0\3\36"+ - "\1\0\1\152\11\0\1\36\1\162\4\36\1\0\1\36"+ - "\1\0\1\36\2\0\5\36\4\0\1\36\10\0\4\36"+ - "\1\0\3\36\1\0\1\152\11\0\3\36\1\163\2\36"+ - "\1\0\1\36\1\0\1\36\2\0\5\36\4\0\1\36"+ - "\10\0\4\36\1\0\3\36\1\0\1\152\11\0\6\36"+ - "\1\0\1\36\1\0\1\36\2\0\1\164\4\36\51\0"+ - "\1\165\13\0\1\36\10\0\4\36\1\0\3\36\1\0"+ - "\1\166\11\0\6\36\1\0\1\36\1\0\1\57\2\0"+ - "\5\36\4\0\1\167\10\0\4\167\1\0\3\167\13\0"+ - "\6\167\1\0\1\167\1\0\1\167\2\0\5\167\21\0"+ - "\2\170\42\0\1\63\10\0\4\63\1\0\3\63\13\0"+ - "\6\63\1\0\1\63\1\0\1\63\2\0\5\63\4\0"+ - "\1\64\2\0\1\171\5\0\4\64\1\0\3\64\1\0"+ - "\1\172\2\0\1\173\6\0\6\64\1\0\1\64\1\0"+ - "\1\64\2\0\5\64\4\0\1\174\10\0\1\175\3\174"+ - "\1\0\3\174\13\0\6\174\1\0\1\174\1\0\1\174"+ - "\2\0\5\174\4\0\1\176\10\0\4\176\1\0\3\176"+ - "\13\0\6\176\1\0\1\176\1\0\1\176\2\0\5\176"+ - "\4\0\1\76\10\0\4\76\1\0\3\76\13\0\6\76"+ - "\1\0\1\76\1\0\1\76\2\0\5\76\4\0\1\76"+ - "\10\0\4\76\1\0\3\76\13\0\4\76\1\177\1\76"+ - "\1\0\1\76\1\0\1\76\2\0\5\76\4\0\1\76"+ - "\10\0\4\76\1\0\3\76\11\0\1\200\1\0\6\76"+ - "\1\0\1\76\1\0\1\111\2\0\5\76\4\0\1\76"+ - "\10\0\4\76\1\0\3\76\13\0\1\76\1\201\4\76"+ - "\1\0\1\76\1\0\1\76\2\0\5\76\4\0\1\76"+ - "\10\0\4\76\1\0\3\76\1\0\1\202\11\0\6\76"+ - "\1\0\1\76\1\0\1\111\2\0\5\76\4\0\1\203"+ - "\10\0\4\203\1\0\3\203\13\0\6\203\1\0\1\203"+ - "\1\0\1\203\2\0\5\203\3\0\2\114\2\0\57\114"+ - "\2\0\1\115\54\114\2\116\2\204\4\116\1\205\50\116"+ - "\1\0\1\117\10\0\4\117\1\0\3\117\1\0\1\117"+ - "\11\0\6\117\1\0\1\117\1\0\1\117\2\0\5\117"+ - "\3\0\2\124\3\0\20\124\1\0\3\124\1\0\27\124"+ - "\2\206\2\0\1\153\2\206\1\207\15\206\1\153\3\206"+ - "\1\153\27\206\2\126\3\141\3\126\1\210\14\126\1\141"+ - "\3\126\1\141\27\126\1\124\1\211\3\0\5\124\1\212"+ - "\3\211\1\124\3\211\3\124\1\0\3\124\1\0\3\124"+ - "\6\211\1\124\1\211\1\124\1\211\2\124\5\211\5\124"+ - "\3\0\20\124\1\0\3\124\1\0\7\124\1\213\21\124"+ - "\3\0\20\124\1\0\3\124\1\0\14\124\1\134\14\124"+ - "\3\0\20\124\1\0\3\124\1\0\4\124\1\214\24\124"+ - "\3\0\16\124\1\215\1\124\1\0\3\124\1\0\14\124"+ - "\1\134\12\124\1\0\1\216\10\0\1\217\3\216\1\0"+ - "\3\216\13\0\6\216\1\0\1\216\1\0\1\216\2\0"+ - "\5\216\15\0\1\220\56\0\1\141\51\0\1\143\2\0"+ - "\1\221\5\0\1\222\3\143\1\0\3\143\1\223\1\145"+ - "\2\0\2\145\5\0\6\143\1\0\1\143\1\0\1\143"+ - "\2\0\5\143\4\0\1\143\2\0\1\221\5\0\1\222"+ - "\1\224\2\143\1\0\3\143\1\223\1\145\2\0\2\145"+ - "\5\0\6\143\1\0\1\143\1\0\1\143\2\0\5\143"+ - "\4\0\1\145\10\0\4\145\1\0\3\145\1\0\1\145"+ - "\2\0\2\145\5\0\6\145\1\0\1\145\1\0\1\145"+ - "\2\0\5\145\46\0\2\225\15\0\1\17\10\0\4\17"+ - "\1\0\3\17\13\0\6\17\1\225\1\226\1\0\1\17"+ - "\2\0\5\17\4\0\1\17\10\0\4\17\1\0\3\17"+ - "\13\0\6\17\1\0\1\17\1\0\1\17\2\0\3\17"+ - "\1\227\1\17\4\0\1\17\10\0\4\17\1\0\3\17"+ - "\13\0\6\17\1\0\1\17\1\0\1\17\2\0\1\17"+ - "\1\230\3\17\4\0\1\36\10\0\4\36\1\0\3\36"+ - "\13\0\6\36\1\0\1\36\1\0\1\36\2\0\5\36"+ - "\3\0\2\153\2\0\3\153\1\231\51\153\7\0\1\232"+ - "\52\0\1\155\10\0\4\155\1\0\3\155\1\0\1\233"+ - "\11\0\6\155\1\0\1\155\1\0\1\155\2\0\5\155"+ - "\4\0\1\155\10\0\1\155\1\234\2\155\1\0\3\155"+ - "\1\0\1\233\11\0\6\155\1\0\1\155\1\0\1\155"+ - "\2\0\5\155\4\0\1\36\10\0\4\36\1\0\3\36"+ - "\1\0\1\152\11\0\5\36\1\235\1\0\1\36\1\0"+ - "\1\36\2\0\5\36\46\0\2\236\15\0\1\36\10\0"+ - "\4\36\1\0\3\36\1\0\1\152\11\0\6\36\1\236"+ - "\1\237\1\0\1\36\2\0\5\36\4\0\1\36\10\0"+ - "\4\36\1\0\3\36\1\0\1\152\11\0\2\36\1\240"+ - "\3\36\1\0\1\36\1\0\1\36\2\0\5\36\4\0"+ - "\1\36\10\0\4\36\1\0\3\36\1\0\1\152\11\0"+ - "\6\36\1\0\1\36\1\0\1\36\2\0\3\36\1\241"+ - "\1\36\4\0\1\36\10\0\4\36\1\0\3\36\1\0"+ - "\1\152\11\0\6\36\1\0\1\36\1\0\1\36\2\0"+ - "\1\36\1\242\3\36\26\0\1\202\22\0\1\165\13\0"+ - "\1\36\10\0\4\36\1\0\3\36\13\0\6\36\1\0"+ - "\1\36\1\0\1\243\2\0\5\36\23\0\1\244\44\0"+ - "\1\171\21\0\1\173\33\0\1\64\10\0\4\64\1\0"+ - "\3\64\13\0\6\64\1\0\1\64\1\0\1\64\2\0"+ - "\5\64\4\0\1\174\10\0\4\174\1\0\3\174\1\0"+ - "\1\245\11\0\6\174\1\0\1\174\1\0\1\174\2\0"+ - "\5\174\4\0\1\174\10\0\1\174\1\246\2\174\1\0"+ - "\3\174\1\0\1\245\11\0\6\174\1\0\1\174\1\0"+ - "\1\174\2\0\5\174\4\0\1\76\10\0\4\76\1\0"+ - "\3\76\13\0\5\76\1\247\1\0\1\76\1\0\1\76"+ - "\2\0\5\76\4\0\1\76\10\0\4\76\1\0\3\76"+ - "\13\0\2\76\1\250\3\76\1\0\1\76\1\0\1\76"+ - "\2\0\5\76\51\0\1\251\13\0\1\203\10\0\4\203"+ - "\1\0\3\203\1\0\1\252\11\0\6\203\1\0\1\203"+ - "\1\0\1\203\2\0\5\203\1\253\2\0\10\204\1\254"+ - "\50\204\2\114\2\0\4\114\1\116\50\114\2\206\2\0"+ - "\1\153\2\206\1\255\15\206\1\153\3\206\1\153\27\206"+ - "\2\124\3\0\2\124\1\256\15\124\1\0\3\124\1\0"+ - "\31\124\3\0\3\124\1\126\14\124\1\0\3\124\1\0"+ - "\30\124\1\211\3\0\5\124\4\211\1\124\3\211\1\124"+ - "\1\257\1\124\1\0\3\124\1\0\3\124\6\211\1\124"+ - "\1\211\1\124\1\211\2\124\5\211\4\124\1\211\3\0"+ - "\5\124\1\211\1\260\2\211\1\124\3\211\1\124\1\257"+ - "\1\124\1\0\3\124\1\0\3\124\6\211\1\124\1\211"+ - "\1\124\1\211\2\124\5\211\5\124\3\0\20\124\1\0"+ - "\3\124\1\0\10\124\1\261\20\124\3\0\20\124\1\0"+ - "\3\124\1\0\5\124\1\262\23\124\3\0\20\124\1\0"+ - "\3\124\1\0\14\124\1\263\12\124\1\0\1\216\10\0"+ - "\4\216\1\0\3\216\1\0\1\264\11\0\6\216\1\0"+ - "\1\216\1\0\1\216\2\0\5\216\4\0\1\216\10\0"+ - "\1\216\1\265\2\216\1\0\3\216\1\0\1\264\11\0"+ - "\6\216\1\0\1\216\1\0\1\216\2\0\5\216\16\0"+ - "\1\266\51\0\1\221\15\0\1\223\37\0\1\143\2\0"+ - "\1\221\5\0\1\222\1\267\2\143\1\0\3\143\1\223"+ - "\1\145\2\0\2\145\5\0\6\143\1\0\1\143\1\0"+ - "\1\143\2\0\5\143\4\0\1\143\2\0\1\221\5\0"+ - "\1\222\1\143\1\270\1\143\1\0\3\143\1\223\1\145"+ - "\2\0\2\145\5\0\6\143\1\0\1\143\1\0\1\143"+ - "\2\0\5\143\43\0\1\271\21\0\1\17\10\0\4\17"+ - "\1\0\3\17\13\0\3\17\1\272\2\17\1\0\1\17"+ - "\1\0\1\17\2\0\5\17\4\0\1\17\10\0\1\17"+ - "\1\273\2\17\1\0\3\17\13\0\6\17\1\0\1\17"+ - "\1\0\1\17\2\0\5\17\4\0\1\17\10\0\4\17"+ - "\1\0\3\17\13\0\4\17\1\274\1\17\1\0\1\17"+ - "\1\0\1\17\2\0\5\17\12\0\1\231\52\0\1\155"+ - "\10\0\4\155\1\0\3\155\13\0\6\155\1\0\1\155"+ - "\1\0\1\155\2\0\5\155\4\0\1\155\10\0\2\155"+ - "\1\275\1\155\1\0\3\155\1\0\1\233\11\0\6\155"+ - "\1\0\1\155\1\0\1\155\2\0\5\155\4\0\1\36"+ - "\10\0\4\36\1\0\3\36\1\0\1\152\11\0\6\36"+ - "\1\276\1\240\1\0\1\36\2\0\5\36\43\0\1\277"+ - "\21\0\1\36\10\0\4\36\1\0\3\36\1\0\1\152"+ - "\11\0\3\36\1\300\2\36\1\0\1\36\1\0\1\36"+ - "\2\0\5\36\4\0\1\36\10\0\4\36\1\0\3\36"+ - "\1\0\1\152\11\0\3\36\1\301\2\36\1\0\1\36"+ - "\1\0\1\36\2\0\5\36\4\0\1\36\10\0\1\36"+ - "\1\302\2\36\1\0\3\36\1\0\1\152\11\0\6\36"+ - "\1\0\1\36\1\0\1\36\2\0\5\36\4\0\1\36"+ - "\10\0\4\36\1\0\3\36\1\0\1\152\11\0\4\36"+ - "\1\303\1\36\1\0\1\36\1\0\1\36\2\0\5\36"+ - "\4\0\1\36\10\0\4\36\1\0\3\36\1\0\1\152"+ - "\11\0\6\36\1\0\1\36\1\0\1\243\2\0\5\36"+ - "\17\0\1\304\45\0\1\174\10\0\4\174\1\0\3\174"+ - "\13\0\6\174\1\0\1\174\1\0\1\174\2\0\5\174"+ - "\4\0\1\174\10\0\2\174\1\305\1\174\1\0\3\174"+ - "\1\0\1\245\11\0\6\174\1\0\1\174\1\0\1\174"+ - "\2\0\5\174\4\0\1\76\10\0\4\76\1\0\3\76"+ - "\13\0\6\76\1\276\1\250\1\0\1\76\2\0\5\76"+ - "\4\0\1\76\10\0\4\76\1\0\3\76\13\0\3\76"+ - "\1\306\2\76\1\0\1\76\1\0\1\76\2\0\5\76"+ - "\4\0\1\307\10\0\4\307\1\0\3\307\13\0\6\307"+ - "\1\0\1\307\1\0\1\307\2\0\5\307\13\0\1\204"+ - "\50\0\2\124\3\0\2\124\1\255\15\124\1\0\3\124"+ - "\1\0\30\124\1\211\3\0\5\124\4\211\1\124\3\211"+ - "\3\124\1\0\3\124\1\0\3\124\6\211\1\124\1\211"+ - "\1\124\1\211\2\124\5\211\4\124\1\211\3\0\5\124"+ - "\2\211\1\310\1\211\1\124\3\211\1\124\1\257\1\124"+ - "\1\0\3\124\1\0\3\124\6\211\1\124\1\211\1\124"+ - "\1\211\2\124\5\211\5\124\3\0\20\124\1\0\3\124"+ - "\1\0\11\124\2\262\16\124\3\0\20\124\1\0\3\124"+ - "\1\0\6\124\1\311\20\124\1\0\1\216\10\0\4\216"+ - "\1\0\3\216\13\0\6\216\1\0\1\216\1\0\1\216"+ - "\2\0\5\216\4\0\1\216\10\0\2\216\1\312\1\216"+ - "\1\0\3\216\1\0\1\264\11\0\6\216\1\0\1\216"+ - "\1\0\1\216\2\0\5\216\17\0\1\313\45\0\1\143"+ - "\2\0\1\221\5\0\1\222\1\143\1\314\1\143\1\0"+ - "\3\143\1\223\1\145\2\0\2\145\5\0\6\143\1\0"+ - "\1\143\1\0\1\143\2\0\5\143\4\0\1\143\2\0"+ - "\1\221\5\0\1\222\2\143\1\315\1\0\3\143\1\223"+ - "\1\145\2\0\2\145\5\0\6\143\1\0\1\143\1\0"+ - "\1\143\2\0\5\143\41\0\1\316\23\0\1\17\10\0"+ - "\4\17\1\0\3\17\13\0\1\17\1\317\4\17\1\0"+ - "\1\17\1\0\1\17\2\0\5\17\4\0\1\17\10\0"+ - "\4\17\1\0\3\17\13\0\6\17\1\0\1\17\1\0"+ - "\1\17\2\0\4\17\1\320\4\0\1\17\10\0\4\17"+ - "\1\0\3\17\13\0\1\321\5\17\1\0\1\17\1\0"+ - "\1\17\2\0\5\17\4\0\1\155\10\0\3\155\1\322"+ - "\1\0\3\155\1\0\1\233\11\0\6\155\1\0\1\155"+ - "\1\0\1\155\2\0\5\155\43\0\1\323\56\0\1\324"+ - "\23\0\1\36\10\0\4\36\1\0\3\36\1\0\1\152"+ - "\11\0\1\36\1\325\4\36\1\0\1\36\1\0\1\36"+ - "\2\0\5\36\4\0\1\36\10\0\4\36\1\0\3\36"+ - "\1\0\1\152\11\0\6\36\1\0\1\36\1\0\1\36"+ - "\2\0\4\36\1\326\4\0\1\36\10\0\4\36\1\0"+ - "\3\36\1\0\1\152\11\0\1\327\5\36\1\0\1\36"+ - "\1\0\1\36\2\0\5\36\16\0\1\330\46\0\1\174"+ - "\10\0\3\174\1\331\1\0\3\174\1\0\1\245\11\0"+ - "\6\174\1\0\1\174\1\0\1\174\2\0\5\174\3\0"+ - "\1\124\1\211\3\0\5\124\3\211\1\332\1\124\3\211"+ - "\1\124\1\257\1\124\1\0\3\124\1\0\3\124\6\211"+ - "\1\124\1\211\1\124\1\211\2\124\5\211\3\124\1\0"+ - "\1\216\10\0\3\216\1\333\1\0\3\216\1\0\1\264"+ - "\11\0\6\216\1\0\1\216\1\0\1\216\2\0\5\216"+ - "\20\0\1\334\44\0\1\143\2\0\1\221\5\0\1\222"+ - "\2\143\1\335\1\0\3\143\1\223\1\145\2\0\2\145"+ - "\5\0\6\143\1\0\1\143\1\0\1\143\2\0\5\143"+ - "\4\0\1\143\2\0\1\221\5\0\1\222\3\143\1\336"+ - "\3\143\1\223\1\145\2\0\2\145\5\0\6\143\1\0"+ - "\1\143\1\0\1\143\2\0\5\143\40\0\1\337\24\0"+ - "\1\17\10\0\4\17\1\0\3\17\13\0\1\340\5\17"+ - "\1\0\1\17\1\0\1\17\2\0\5\17\4\0\1\17"+ - "\10\0\4\17\1\0\3\17\13\0\3\17\1\341\2\17"+ - "\1\0\1\17\1\0\1\17\2\0\5\17\4\0\1\17"+ - "\10\0\4\17\1\0\3\17\13\0\3\17\1\342\2\17"+ - "\1\0\1\17\1\0\1\17\2\0\5\17\4\0\1\155"+ - "\10\0\4\155\1\343\3\155\1\0\1\233\11\0\6\155"+ - "\1\0\1\155\1\0\1\155\2\0\5\155\40\0\1\344"+ - "\24\0\1\36\10\0\4\36\1\0\3\36\1\0\1\152"+ - "\11\0\1\345\5\36\1\0\1\36\1\0\1\36\2\0"+ - "\5\36\4\0\1\36\10\0\4\36\1\0\3\36\1\0"+ - "\1\152\11\0\3\36\1\346\2\36\1\0\1\36\1\0"+ - "\1\36\2\0\5\36\4\0\1\36\10\0\4\36\1\0"+ - "\3\36\1\0\1\152\11\0\3\36\1\347\2\36\1\0"+ - "\1\36\1\0\1\36\2\0\5\36\41\0\1\350\23\0"+ - "\1\174\10\0\4\174\1\351\3\174\1\0\1\245\11\0"+ - "\6\174\1\0\1\174\1\0\1\174\2\0\5\174\3\0"+ - "\1\124\1\211\3\0\5\124\4\211\1\352\3\211\1\124"+ - "\1\257\1\124\1\0\3\124\1\0\3\124\6\211\1\124"+ - "\1\211\1\124\1\211\2\124\5\211\3\124\1\0\1\216"+ - "\10\0\4\216\1\353\3\216\1\0\1\264\11\0\6\216"+ - "\1\0\1\216\1\0\1\216\2\0\5\216\21\0\2\353"+ - "\42\0\1\143\2\0\1\221\5\0\1\222\3\143\1\354"+ - "\3\143\1\223\1\145\2\0\2\145\5\0\6\143\1\0"+ - "\1\143\1\0\1\143\2\0\5\143\23\0\1\355\113\0"+ - "\1\356\6\0\1\17\10\0\4\17\1\0\3\17\13\0"+ - "\6\17\1\0\1\17\1\0\1\17\2\0\2\17\1\357"+ - "\2\17\23\0\1\360\113\0\1\361\6\0\1\36\10\0"+ - "\4\36\1\0\3\36\1\0\1\152\11\0\6\36\1\0"+ - "\1\36\1\0\1\36\2\0\2\36\1\362\2\36\43\0"+ - "\1\363\40\0\1\364\40\0\2\124\3\0\13\124\1\365"+ - "\4\124\1\0\3\124\1\0\27\124\20\0\1\366\60\0"+ - "\1\367\61\0\1\370\76\0\1\371\22\0\1\17\10\0"+ - "\4\17\1\0\3\17\13\0\2\17\1\372\3\17\1\0"+ - "\1\17\1\0\1\17\2\0\5\17\24\0\1\373\76\0"+ - "\1\374\22\0\1\36\10\0\4\36\1\0\3\36\1\0"+ - "\1\152\11\0\2\36\1\375\3\36\1\0\1\36\1\0"+ - "\1\36\2\0\5\36\36\0\1\376\46\0\1\377\37\0"+ - "\2\124\3\0\14\124\1\u0100\3\124\1\0\3\124\1\0"+ - "\27\124\21\0\1\u0101\60\0\1\u0102\40\0\1\u0103\2\0"+ - "\1\221\5\0\1\u0104\3\u0103\1\0\3\u0103\1\223\12\0"+ - "\6\u0103\1\0\1\u0103\1\0\1\u0103\2\0\5\u0103\54\0"+ - "\1\u0105\10\0\1\17\10\0\4\17\1\0\3\17\13\0"+ - "\6\17\1\0\1\17\1\0\1\17\2\0\1\u0106\4\17"+ - "\54\0\1\u0107\10\0\1\36\10\0\4\36\1\0\3\36"+ - "\1\0\1\152\11\0\6\36\1\0\1\36\1\0\1\36"+ - "\2\0\1\u0108\4\36\4\0\1\u0102\2\0\1\221\5\0"+ - "\1\u0109\3\u0102\1\0\3\u0102\1\223\12\0\6\u0102\1\0"+ - "\1\u0102\1\0\1\u0102\2\0\5\u0102\4\0\1\u0103\2\0"+ - "\1\221\5\0\1\u0104\3\u0103\1\0\3\u0103\1\223\1\245"+ - "\11\0\6\u0103\1\0\1\u0103\1\0\1\u0103\2\0\5\u0103"+ - "\4\0\1\u0103\2\0\1\221\5\0\1\u0104\1\u010a\2\u0103"+ - "\1\0\3\u0103\1\223\1\245\11\0\6\u0103\1\0\1\u0103"+ - "\1\0\1\u0103\2\0\5\u0103\55\0\1\u010b\7\0\1\17"+ - "\10\0\4\17\1\0\3\17\13\0\6\17\1\0\1\17"+ - "\1\0\1\17\2\0\1\17\1\u010c\3\17\55\0\1\u010d"+ - "\7\0\1\36\10\0\4\36\1\0\3\36\1\0\1\152"+ - "\11\0\6\36\1\0\1\36\1\0\1\36\2\0\1\36"+ - "\1\u010e\3\36\4\0\1\u0102\2\0\1\221\5\0\1\u0109"+ - "\1\u010f\2\u0102\1\0\3\u0102\1\223\12\0\6\u0102\1\0"+ - "\1\u0102\1\0\1\u0102\2\0\5\u0102\4\0\1\u0103\2\0"+ - "\1\221\5\0\1\u0104\1\u0103\1\u0110\1\u0103\1\0\3\u0103"+ - "\1\223\1\245\11\0\6\u0103\1\0\1\u0103\1\0\1\u0103"+ - "\2\0\5\u0103\44\0\1\u0111\20\0\1\17\10\0\4\17"+ - "\1\0\3\17\13\0\4\17\1\u0112\1\17\1\0\1\17"+ - "\1\0\1\17\2\0\5\17\44\0\1\u0113\20\0\1\36"+ - "\10\0\4\36\1\0\3\36\1\0\1\152\11\0\4\36"+ - "\1\u0114\1\36\1\0\1\36\1\0\1\36\2\0\5\36"+ - "\4\0\1\u0102\2\0\1\221\5\0\1\u0109\1\u0102\1\u0115"+ - "\1\u0102\1\0\3\u0102\1\223\12\0\6\u0102\1\0\1\u0102"+ - "\1\0\1\u0102\2\0\5\u0102\4\0\1\u0103\2\0\1\221"+ - "\5\0\1\u0104\2\u0103\1\u0116\1\0\3\u0103\1\223\1\245"+ - "\11\0\6\u0103\1\0\1\u0103\1\0\1\u0103\2\0\5\u0103"+ - "\40\0\1\u0117\24\0\1\17\10\0\4\17\1\0\3\17"+ - "\13\0\1\u0118\5\17\1\0\1\17\1\0\1\17\2\0"+ - "\5\17\40\0\1\u0119\24\0\1\36\10\0\4\36\1\0"+ - "\3\36\1\0\1\152\11\0\1\u011a\5\36\1\0\1\36"+ - "\1\0\1\36\2\0\5\36\4\0\1\u0102\2\0\1\221"+ - "\5\0\1\u0109\2\u0102\1\u011b\1\0\3\u0102\1\223\12\0"+ - "\6\u0102\1\0\1\u0102\1\0\1\u0102\2\0\5\u0102\4\0"+ - "\1\u0103\2\0\1\221\5\0\1\u0104\3\u0103\1\354\3\u0103"+ - "\1\223\1\245\11\0\6\u0103\1\0\1\u0103\1\0\1\u0103"+ - "\2\0\5\u0103\43\0\1\u011c\21\0\1\17\10\0\4\17"+ - "\1\0\3\17\13\0\3\17\1\u011d\2\17\1\0\1\17"+ - "\1\0\1\17\2\0\5\17\43\0\1\u011e\21\0\1\36"+ - "\10\0\4\36\1\0\3\36\1\0\1\152\11\0\3\36"+ - "\1\u011f\2\36\1\0\1\36\1\0\1\36\2\0\5\36"+ - "\4\0\1\u0102\2\0\1\221\5\0\1\u0109\3\u0102\1\354"+ - "\3\u0102\1\223\12\0\6\u0102\1\0\1\u0102\1\0\1\u0102"+ - "\2\0\5\u0102\3\0"; + "\1\15\1\16\1\17\1\20\1\21\1\22\2\15\1\23"+ + "\1\24\4\16\1\25\1\26\2\16\6\15\1\27\4\15"+ + "\1\16\1\30\1\31\3\16\1\15\1\16\1\15\1\16"+ + "\2\15\5\16\2\15\1\0\1\32\1\33\1\17\1\20"+ + "\1\21\2\32\1\34\1\35\1\36\3\33\1\37\1\40"+ + "\1\41\1\33\1\42\2\32\1\43\1\44\1\45\1\46"+ + "\1\32\1\47\3\32\1\50\1\51\1\52\3\33\1\32"+ + "\1\33\1\53\1\54\1\55\1\32\5\33\1\32\1\56"+ + "\1\32\2\15\1\17\1\20\1\21\15\15\1\57\35\15"+ + "\1\0\1\15\1\60\1\17\1\20\1\21\5\15\4\60"+ + "\1\15\3\60\13\15\6\60\1\15\1\60\1\15\1\60"+ + "\2\15\5\60\2\15\1\0\1\15\1\61\1\17\1\20"+ + "\1\21\4\15\1\62\4\61\1\15\3\61\1\63\1\64"+ + "\1\65\1\44\1\45\1\46\1\66\1\47\2\15\1\67"+ + "\6\61\1\15\1\61\1\15\1\61\1\70\1\71\5\61"+ + "\2\15\1\0\1\72\1\73\1\17\1\20\1\21\3\72"+ + "\1\74\1\75\3\73\1\76\1\72\2\73\1\77\6\72"+ + "\1\100\1\101\1\102\1\72\1\103\1\104\5\73\1\72"+ + "\1\73\1\105\1\106\2\72\5\73\1\107\1\110\1\72"+ + "\2\111\1\17\1\20\1\112\3\111\1\113\50\111\1\15"+ + "\1\114\1\17\1\20\1\21\2\15\1\115\1\23\1\62"+ + "\4\114\1\15\3\114\1\63\1\114\1\15\1\116\3\15"+ + "\1\117\2\15\1\120\6\114\1\15\1\114\1\15\1\114"+ + "\2\15\5\114\2\15\1\0\2\121\1\17\1\20\1\21"+ + "\2\121\1\122\1\123\1\124\3\121\1\125\3\121\1\126"+ + "\3\121\1\116\3\121\1\127\3\121\1\130\7\121\1\126"+ + "\1\131\12\121\2\15\1\17\1\20\1\21\53\15\1\0"+ + "\2\15\1\17\1\20\1\21\4\15\1\132\46\15\1\0"+ + "\2\133\1\17\1\20\1\21\4\133\1\134\46\133\63\0"+ + "\1\16\10\0\4\16\1\0\3\16\13\0\6\16\1\0"+ + "\1\16\1\0\1\16\2\0\5\16\5\0\1\17\62\0"+ + "\1\21\54\0\2\135\2\0\2\135\1\136\52\135\10\137"+ + "\1\140\50\137\1\0\1\141\10\0\1\142\3\141\1\0"+ + "\3\141\1\0\1\143\2\0\2\143\5\0\6\141\1\0"+ + "\1\141\1\0\1\141\2\0\5\141\17\0\1\144\45\0"+ + "\1\16\10\0\2\16\1\145\1\16\1\0\3\16\13\0"+ + "\6\16\1\0\1\16\1\0\1\16\2\0\5\16\4\0"+ + "\1\16\10\0\4\16\1\0\3\16\13\0\3\16\1\146"+ + "\2\16\1\0\1\16\1\0\1\16\2\0\5\16\4\0"+ + "\1\16\10\0\4\16\1\0\3\16\13\0\6\16\1\0"+ + "\1\16\1\0\1\16\2\0\1\147\4\16\4\0\1\33"+ + "\10\0\4\33\1\0\3\33\1\0\1\150\11\0\6\33"+ + "\1\0\1\33\1\0\1\33\2\0\5\33\3\0\2\151"+ + "\2\0\3\151\1\152\51\151\1\0\1\153\10\0\1\154"+ + "\3\153\1\0\3\153\13\0\6\153\1\0\1\153\1\0"+ + "\1\153\2\0\5\153\4\0\1\33\10\0\4\33\1\0"+ + "\3\33\1\0\1\150\11\0\4\33\1\155\1\33\1\0"+ + "\1\33\1\0\1\33\2\0\5\33\17\0\1\156\45\0"+ + "\1\33\10\0\2\33\1\157\1\33\1\0\3\33\1\0"+ + "\1\150\11\0\6\33\1\0\1\33\1\0\1\33\2\0"+ + "\5\33\4\0\1\33\10\0\4\33\1\0\3\33\1\0"+ + "\1\150\11\0\6\33\1\0\1\33\1\0\1\54\2\0"+ + "\5\33\4\0\1\33\10\0\4\33\1\0\3\33\1\0"+ + "\1\150\11\0\1\33\1\160\4\33\1\0\1\33\1\0"+ + "\1\33\2\0\5\33\4\0\1\33\10\0\4\33\1\0"+ + "\3\33\1\0\1\150\11\0\3\33\1\161\2\33\1\0"+ + "\1\33\1\0\1\33\2\0\5\33\4\0\1\33\10\0"+ + "\4\33\1\0\3\33\1\0\1\150\11\0\6\33\1\0"+ + "\1\33\1\0\1\33\2\0\1\162\4\33\51\0\1\163"+ + "\13\0\1\33\10\0\4\33\1\0\3\33\1\0\1\164"+ + "\11\0\6\33\1\0\1\33\1\0\1\54\2\0\5\33"+ + "\4\0\1\165\10\0\4\165\1\0\3\165\13\0\6\165"+ + "\1\0\1\165\1\0\1\165\2\0\5\165\21\0\2\166"+ + "\42\0\1\60\10\0\4\60\1\0\3\60\13\0\6\60"+ + "\1\0\1\60\1\0\1\60\2\0\5\60\4\0\1\61"+ + "\2\0\1\167\5\0\4\61\1\0\3\61\1\0\1\170"+ + "\2\0\1\171\6\0\6\61\1\0\1\61\1\0\1\61"+ + "\2\0\5\61\4\0\1\172\10\0\1\173\3\172\1\0"+ + "\3\172\13\0\6\172\1\0\1\172\1\0\1\172\2\0"+ + "\5\172\4\0\1\174\10\0\4\174\1\0\3\174\13\0"+ + "\6\174\1\0\1\174\1\0\1\174\2\0\5\174\4\0"+ + "\1\73\10\0\4\73\1\0\3\73\13\0\6\73\1\0"+ + "\1\73\1\0\1\73\2\0\5\73\4\0\1\73\10\0"+ + "\4\73\1\0\3\73\13\0\4\73\1\175\1\73\1\0"+ + "\1\73\1\0\1\73\2\0\5\73\4\0\1\73\10\0"+ + "\4\73\1\0\3\73\11\0\1\176\1\0\6\73\1\0"+ + "\1\73\1\0\1\106\2\0\5\73\4\0\1\73\10\0"+ + "\4\73\1\0\3\73\13\0\1\73\1\177\4\73\1\0"+ + "\1\73\1\0\1\73\2\0\5\73\4\0\1\73\10\0"+ + "\4\73\1\0\3\73\1\0\1\200\11\0\6\73\1\0"+ + "\1\73\1\0\1\106\2\0\5\73\4\0\1\201\10\0"+ + "\4\201\1\0\3\201\13\0\6\201\1\0\1\201\1\0"+ + "\1\201\2\0\5\201\3\0\2\111\2\0\57\111\2\0"+ + "\1\112\54\111\2\113\2\202\4\113\1\203\50\113\1\0"+ + "\1\114\10\0\4\114\1\0\3\114\1\0\1\114\11\0"+ + "\6\114\1\0\1\114\1\0\1\114\2\0\5\114\3\0"+ + "\2\121\3\0\20\121\1\0\3\121\1\0\27\121\2\204"+ + "\2\0\1\151\2\204\1\205\15\204\1\151\3\204\1\151"+ + "\27\204\2\123\3\137\3\123\1\206\14\123\1\137\3\123"+ + "\1\137\27\123\1\121\1\207\3\0\5\121\1\210\3\207"+ + "\1\121\3\207\3\121\1\0\3\121\1\0\3\121\6\207"+ + "\1\121\1\207\1\121\1\207\2\121\5\207\5\121\3\0"+ + "\20\121\1\0\3\121\1\0\7\121\1\211\21\121\3\0"+ + "\20\121\1\0\3\121\1\0\14\121\1\131\14\121\3\0"+ + "\20\121\1\0\3\121\1\0\4\121\1\212\24\121\3\0"+ + "\16\121\1\213\1\121\1\0\3\121\1\0\14\121\1\131"+ + "\12\121\1\0\1\214\10\0\1\215\3\214\1\0\3\214"+ + "\13\0\6\214\1\0\1\214\1\0\1\214\2\0\5\214"+ + "\15\0\1\216\46\0\2\135\2\0\55\135\10\0\1\137"+ + "\51\0\1\141\2\0\1\217\5\0\1\220\3\141\1\0"+ + "\3\141\1\221\1\143\2\0\2\143\5\0\6\141\1\0"+ + "\1\141\1\0\1\141\2\0\5\141\4\0\1\141\2\0"+ + "\1\217\5\0\1\220\1\222\2\141\1\0\3\141\1\221"+ + "\1\143\2\0\2\143\5\0\6\141\1\0\1\141\1\0"+ + "\1\141\2\0\5\141\4\0\1\143\10\0\4\143\1\0"+ + "\3\143\1\0\1\143\2\0\2\143\5\0\6\143\1\0"+ + "\1\143\1\0\1\143\2\0\5\143\46\0\2\223\15\0"+ + "\1\16\10\0\4\16\1\0\3\16\13\0\6\16\1\223"+ + "\1\224\1\0\1\16\2\0\5\16\4\0\1\16\10\0"+ + "\4\16\1\0\3\16\13\0\6\16\1\0\1\16\1\0"+ + "\1\16\2\0\3\16\1\225\1\16\4\0\1\16\10\0"+ + "\4\16\1\0\3\16\13\0\6\16\1\0\1\16\1\0"+ + "\1\16\2\0\1\16\1\226\3\16\4\0\1\33\10\0"+ + "\4\33\1\0\3\33\13\0\6\33\1\0\1\33\1\0"+ + "\1\33\2\0\5\33\3\0\2\151\2\0\3\151\1\227"+ + "\51\151\7\0\1\230\52\0\1\153\10\0\4\153\1\0"+ + "\3\153\1\0\1\231\11\0\6\153\1\0\1\153\1\0"+ + "\1\153\2\0\5\153\4\0\1\153\10\0\1\153\1\232"+ + "\2\153\1\0\3\153\1\0\1\231\11\0\6\153\1\0"+ + "\1\153\1\0\1\153\2\0\5\153\4\0\1\33\10\0"+ + "\4\33\1\0\3\33\1\0\1\150\11\0\5\33\1\233"+ + "\1\0\1\33\1\0\1\33\2\0\5\33\46\0\2\234"+ + "\15\0\1\33\10\0\4\33\1\0\3\33\1\0\1\150"+ + "\11\0\6\33\1\234\1\235\1\0\1\33\2\0\5\33"+ + "\4\0\1\33\10\0\4\33\1\0\3\33\1\0\1\150"+ + "\11\0\2\33\1\236\3\33\1\0\1\33\1\0\1\33"+ + "\2\0\5\33\4\0\1\33\10\0\4\33\1\0\3\33"+ + "\1\0\1\150\11\0\6\33\1\0\1\33\1\0\1\33"+ + "\2\0\3\33\1\237\1\33\4\0\1\33\10\0\4\33"+ + "\1\0\3\33\1\0\1\150\11\0\6\33\1\0\1\33"+ + "\1\0\1\33\2\0\1\33\1\240\3\33\26\0\1\200"+ + "\22\0\1\163\13\0\1\33\10\0\4\33\1\0\3\33"+ + "\13\0\6\33\1\0\1\33\1\0\1\241\2\0\5\33"+ + "\23\0\1\242\44\0\1\167\21\0\1\171\33\0\1\61"+ + "\10\0\4\61\1\0\3\61\13\0\6\61\1\0\1\61"+ + "\1\0\1\61\2\0\5\61\4\0\1\172\10\0\4\172"+ + "\1\0\3\172\1\0\1\243\11\0\6\172\1\0\1\172"+ + "\1\0\1\172\2\0\5\172\4\0\1\172\10\0\1\172"+ + "\1\244\2\172\1\0\3\172\1\0\1\243\11\0\6\172"+ + "\1\0\1\172\1\0\1\172\2\0\5\172\4\0\1\73"+ + "\10\0\4\73\1\0\3\73\13\0\5\73\1\245\1\0"+ + "\1\73\1\0\1\73\2\0\5\73\4\0\1\73\10\0"+ + "\4\73\1\0\3\73\13\0\2\73\1\246\3\73\1\0"+ + "\1\73\1\0\1\73\2\0\5\73\51\0\1\247\13\0"+ + "\1\201\10\0\4\201\1\0\3\201\1\0\1\250\11\0"+ + "\6\201\1\0\1\201\1\0\1\201\2\0\5\201\1\251"+ + "\2\0\10\202\1\252\50\202\2\111\2\0\4\111\1\113"+ + "\50\111\2\204\2\0\1\151\2\204\1\253\15\204\1\151"+ + "\3\204\1\151\27\204\2\121\3\0\2\121\1\254\15\121"+ + "\1\0\3\121\1\0\31\121\3\0\3\121\1\123\14\121"+ + "\1\0\3\121\1\0\30\121\1\207\3\0\5\121\4\207"+ + "\1\121\3\207\1\121\1\255\1\121\1\0\3\121\1\0"+ + "\3\121\6\207\1\121\1\207\1\121\1\207\2\121\5\207"+ + "\4\121\1\207\3\0\5\121\1\207\1\256\2\207\1\121"+ + "\3\207\1\121\1\255\1\121\1\0\3\121\1\0\3\121"+ + "\6\207\1\121\1\207\1\121\1\207\2\121\5\207\5\121"+ + "\3\0\20\121\1\0\3\121\1\0\10\121\1\257\20\121"+ + "\3\0\20\121\1\0\3\121\1\0\5\121\1\260\23\121"+ + "\3\0\20\121\1\0\3\121\1\0\14\121\1\261\12\121"+ + "\1\0\1\214\10\0\4\214\1\0\3\214\1\0\1\262"+ + "\11\0\6\214\1\0\1\214\1\0\1\214\2\0\5\214"+ + "\4\0\1\214\10\0\1\214\1\263\2\214\1\0\3\214"+ + "\1\0\1\262\11\0\6\214\1\0\1\214\1\0\1\214"+ + "\2\0\5\214\16\0\1\264\51\0\1\217\15\0\1\221"+ + "\37\0\1\141\2\0\1\217\5\0\1\220\1\265\2\141"+ + "\1\0\3\141\1\221\1\143\2\0\2\143\5\0\6\141"+ + "\1\0\1\141\1\0\1\141\2\0\5\141\4\0\1\141"+ + "\2\0\1\217\5\0\1\220\1\141\1\266\1\141\1\0"+ + "\3\141\1\221\1\143\2\0\2\143\5\0\6\141\1\0"+ + "\1\141\1\0\1\141\2\0\5\141\43\0\1\267\21\0"+ + "\1\16\10\0\4\16\1\0\3\16\13\0\3\16\1\270"+ + "\2\16\1\0\1\16\1\0\1\16\2\0\5\16\4\0"+ + "\1\16\10\0\1\16\1\271\2\16\1\0\3\16\13\0"+ + "\6\16\1\0\1\16\1\0\1\16\2\0\5\16\4\0"+ + "\1\16\10\0\4\16\1\0\3\16\13\0\4\16\1\272"+ + "\1\16\1\0\1\16\1\0\1\16\2\0\5\16\12\0"+ + "\1\227\52\0\1\153\10\0\4\153\1\0\3\153\13\0"+ + "\6\153\1\0\1\153\1\0\1\153\2\0\5\153\4\0"+ + "\1\153\10\0\2\153\1\273\1\153\1\0\3\153\1\0"+ + "\1\231\11\0\6\153\1\0\1\153\1\0\1\153\2\0"+ + "\5\153\4\0\1\33\10\0\4\33\1\0\3\33\1\0"+ + "\1\150\11\0\6\33\1\274\1\236\1\0\1\33\2\0"+ + "\5\33\43\0\1\275\21\0\1\33\10\0\4\33\1\0"+ + "\3\33\1\0\1\150\11\0\3\33\1\276\2\33\1\0"+ + "\1\33\1\0\1\33\2\0\5\33\4\0\1\33\10\0"+ + "\4\33\1\0\3\33\1\0\1\150\11\0\3\33\1\277"+ + "\2\33\1\0\1\33\1\0\1\33\2\0\5\33\4\0"+ + "\1\33\10\0\1\33\1\300\2\33\1\0\3\33\1\0"+ + "\1\150\11\0\6\33\1\0\1\33\1\0\1\33\2\0"+ + "\5\33\4\0\1\33\10\0\4\33\1\0\3\33\1\0"+ + "\1\150\11\0\4\33\1\301\1\33\1\0\1\33\1\0"+ + "\1\33\2\0\5\33\4\0\1\33\10\0\4\33\1\0"+ + "\3\33\1\0\1\150\11\0\6\33\1\0\1\33\1\0"+ + "\1\241\2\0\5\33\17\0\1\302\45\0\1\172\10\0"+ + "\4\172\1\0\3\172\13\0\6\172\1\0\1\172\1\0"+ + "\1\172\2\0\5\172\4\0\1\172\10\0\2\172\1\303"+ + "\1\172\1\0\3\172\1\0\1\243\11\0\6\172\1\0"+ + "\1\172\1\0\1\172\2\0\5\172\4\0\1\73\10\0"+ + "\4\73\1\0\3\73\13\0\6\73\1\274\1\246\1\0"+ + "\1\73\2\0\5\73\4\0\1\73\10\0\4\73\1\0"+ + "\3\73\13\0\3\73\1\304\2\73\1\0\1\73\1\0"+ + "\1\73\2\0\5\73\4\0\1\305\10\0\4\305\1\0"+ + "\3\305\13\0\6\305\1\0\1\305\1\0\1\305\2\0"+ + "\5\305\13\0\1\202\50\0\2\121\3\0\2\121\1\253"+ + "\15\121\1\0\3\121\1\0\30\121\1\207\3\0\5\121"+ + "\4\207\1\121\3\207\3\121\1\0\3\121\1\0\3\121"+ + "\6\207\1\121\1\207\1\121\1\207\2\121\5\207\4\121"+ + "\1\207\3\0\5\121\2\207\1\306\1\207\1\121\3\207"+ + "\1\121\1\255\1\121\1\0\3\121\1\0\3\121\6\207"+ + "\1\121\1\207\1\121\1\207\2\121\5\207\5\121\3\0"+ + "\20\121\1\0\3\121\1\0\11\121\2\260\16\121\3\0"+ + "\20\121\1\0\3\121\1\0\6\121\1\307\20\121\1\0"+ + "\1\214\10\0\4\214\1\0\3\214\13\0\6\214\1\0"+ + "\1\214\1\0\1\214\2\0\5\214\4\0\1\214\10\0"+ + "\2\214\1\310\1\214\1\0\3\214\1\0\1\262\11\0"+ + "\6\214\1\0\1\214\1\0\1\214\2\0\5\214\17\0"+ + "\1\311\45\0\1\141\2\0\1\217\5\0\1\220\1\141"+ + "\1\312\1\141\1\0\3\141\1\221\1\143\2\0\2\143"+ + "\5\0\6\141\1\0\1\141\1\0\1\141\2\0\5\141"+ + "\4\0\1\141\2\0\1\217\5\0\1\220\2\141\1\313"+ + "\1\0\3\141\1\221\1\143\2\0\2\143\5\0\6\141"+ + "\1\0\1\141\1\0\1\141\2\0\5\141\41\0\1\314"+ + "\23\0\1\16\10\0\4\16\1\0\3\16\13\0\1\16"+ + "\1\315\4\16\1\0\1\16\1\0\1\16\2\0\5\16"+ + "\4\0\1\16\10\0\4\16\1\0\3\16\13\0\6\16"+ + "\1\0\1\16\1\0\1\16\2\0\4\16\1\316\4\0"+ + "\1\16\10\0\4\16\1\0\3\16\13\0\1\317\5\16"+ + "\1\0\1\16\1\0\1\16\2\0\5\16\4\0\1\153"+ + "\10\0\3\153\1\320\1\0\3\153\1\0\1\231\11\0"+ + "\6\153\1\0\1\153\1\0\1\153\2\0\5\153\43\0"+ + "\1\321\56\0\1\322\23\0\1\33\10\0\4\33\1\0"+ + "\3\33\1\0\1\150\11\0\1\33\1\323\4\33\1\0"+ + "\1\33\1\0\1\33\2\0\5\33\4\0\1\33\10\0"+ + "\4\33\1\0\3\33\1\0\1\150\11\0\6\33\1\0"+ + "\1\33\1\0\1\33\2\0\4\33\1\324\4\0\1\33"+ + "\10\0\4\33\1\0\3\33\1\0\1\150\11\0\1\325"+ + "\5\33\1\0\1\33\1\0\1\33\2\0\5\33\16\0"+ + "\1\326\46\0\1\172\10\0\3\172\1\327\1\0\3\172"+ + "\1\0\1\243\11\0\6\172\1\0\1\172\1\0\1\172"+ + "\2\0\5\172\3\0\1\121\1\207\3\0\5\121\3\207"+ + "\1\330\1\121\3\207\1\121\1\255\1\121\1\0\3\121"+ + "\1\0\3\121\6\207\1\121\1\207\1\121\1\207\2\121"+ + "\5\207\3\121\1\0\1\214\10\0\3\214\1\331\1\0"+ + "\3\214\1\0\1\262\11\0\6\214\1\0\1\214\1\0"+ + "\1\214\2\0\5\214\20\0\1\332\44\0\1\141\2\0"+ + "\1\217\5\0\1\220\2\141\1\333\1\0\3\141\1\221"+ + "\1\143\2\0\2\143\5\0\6\141\1\0\1\141\1\0"+ + "\1\141\2\0\5\141\4\0\1\141\2\0\1\217\5\0"+ + "\1\220\3\141\1\334\3\141\1\221\1\143\2\0\2\143"+ + "\5\0\6\141\1\0\1\141\1\0\1\141\2\0\5\141"+ + "\40\0\1\335\24\0\1\16\10\0\4\16\1\0\3\16"+ + "\13\0\1\336\5\16\1\0\1\16\1\0\1\16\2\0"+ + "\5\16\4\0\1\16\10\0\4\16\1\0\3\16\13\0"+ + "\3\16\1\337\2\16\1\0\1\16\1\0\1\16\2\0"+ + "\5\16\4\0\1\16\10\0\4\16\1\0\3\16\13\0"+ + "\3\16\1\340\2\16\1\0\1\16\1\0\1\16\2\0"+ + "\5\16\4\0\1\153\10\0\4\153\1\341\3\153\1\0"+ + "\1\231\11\0\6\153\1\0\1\153\1\0\1\153\2\0"+ + "\5\153\40\0\1\342\24\0\1\33\10\0\4\33\1\0"+ + "\3\33\1\0\1\150\11\0\1\343\5\33\1\0\1\33"+ + "\1\0\1\33\2\0\5\33\4\0\1\33\10\0\4\33"+ + "\1\0\3\33\1\0\1\150\11\0\3\33\1\344\2\33"+ + "\1\0\1\33\1\0\1\33\2\0\5\33\4\0\1\33"+ + "\10\0\4\33\1\0\3\33\1\0\1\150\11\0\3\33"+ + "\1\345\2\33\1\0\1\33\1\0\1\33\2\0\5\33"+ + "\41\0\1\346\23\0\1\172\10\0\4\172\1\347\3\172"+ + "\1\0\1\243\11\0\6\172\1\0\1\172\1\0\1\172"+ + "\2\0\5\172\3\0\1\121\1\207\3\0\5\121\4\207"+ + "\1\350\3\207\1\121\1\255\1\121\1\0\3\121\1\0"+ + "\3\121\6\207\1\121\1\207\1\121\1\207\2\121\5\207"+ + "\3\121\1\0\1\214\10\0\4\214\1\351\3\214\1\0"+ + "\1\262\11\0\6\214\1\0\1\214\1\0\1\214\2\0"+ + "\5\214\21\0\2\351\42\0\1\141\2\0\1\217\5\0"+ + "\1\220\3\141\1\352\3\141\1\221\1\143\2\0\2\143"+ + "\5\0\6\141\1\0\1\141\1\0\1\141\2\0\5\141"+ + "\23\0\1\353\113\0\1\354\6\0\1\16\10\0\4\16"+ + "\1\0\3\16\13\0\6\16\1\0\1\16\1\0\1\16"+ + "\2\0\2\16\1\355\2\16\23\0\1\356\113\0\1\357"+ + "\6\0\1\33\10\0\4\33\1\0\3\33\1\0\1\150"+ + "\11\0\6\33\1\0\1\33\1\0\1\33\2\0\2\33"+ + "\1\360\2\33\43\0\1\361\40\0\1\362\40\0\2\121"+ + "\3\0\13\121\1\363\4\121\1\0\3\121\1\0\27\121"+ + "\20\0\1\364\60\0\1\365\61\0\1\366\76\0\1\367"+ + "\22\0\1\16\10\0\4\16\1\0\3\16\13\0\2\16"+ + "\1\370\3\16\1\0\1\16\1\0\1\16\2\0\5\16"+ + "\24\0\1\371\76\0\1\372\22\0\1\33\10\0\4\33"+ + "\1\0\3\33\1\0\1\150\11\0\2\33\1\373\3\33"+ + "\1\0\1\33\1\0\1\33\2\0\5\33\36\0\1\374"+ + "\46\0\1\375\37\0\2\121\3\0\14\121\1\376\3\121"+ + "\1\0\3\121\1\0\27\121\21\0\1\377\60\0\1\u0100"+ + "\40\0\1\u0101\2\0\1\217\5\0\1\u0102\3\u0101\1\0"+ + "\3\u0101\1\221\12\0\6\u0101\1\0\1\u0101\1\0\1\u0101"+ + "\2\0\5\u0101\54\0\1\u0103\10\0\1\16\10\0\4\16"+ + "\1\0\3\16\13\0\6\16\1\0\1\16\1\0\1\16"+ + "\2\0\1\u0104\4\16\54\0\1\u0105\10\0\1\33\10\0"+ + "\4\33\1\0\3\33\1\0\1\150\11\0\6\33\1\0"+ + "\1\33\1\0\1\33\2\0\1\u0106\4\33\4\0\1\u0100"+ + "\2\0\1\217\5\0\1\u0107\3\u0100\1\0\3\u0100\1\221"+ + "\12\0\6\u0100\1\0\1\u0100\1\0\1\u0100\2\0\5\u0100"+ + "\4\0\1\u0101\2\0\1\217\5\0\1\u0102\3\u0101\1\0"+ + "\3\u0101\1\221\1\243\11\0\6\u0101\1\0\1\u0101\1\0"+ + "\1\u0101\2\0\5\u0101\4\0\1\u0101\2\0\1\217\5\0"+ + "\1\u0102\1\u0108\2\u0101\1\0\3\u0101\1\221\1\243\11\0"+ + "\6\u0101\1\0\1\u0101\1\0\1\u0101\2\0\5\u0101\55\0"+ + "\1\u0109\7\0\1\16\10\0\4\16\1\0\3\16\13\0"+ + "\6\16\1\0\1\16\1\0\1\16\2\0\1\16\1\u010a"+ + "\3\16\55\0\1\u010b\7\0\1\33\10\0\4\33\1\0"+ + "\3\33\1\0\1\150\11\0\6\33\1\0\1\33\1\0"+ + "\1\33\2\0\1\33\1\u010c\3\33\4\0\1\u0100\2\0"+ + "\1\217\5\0\1\u0107\1\u010d\2\u0100\1\0\3\u0100\1\221"+ + "\12\0\6\u0100\1\0\1\u0100\1\0\1\u0100\2\0\5\u0100"+ + "\4\0\1\u0101\2\0\1\217\5\0\1\u0102\1\u0101\1\u010e"+ + "\1\u0101\1\0\3\u0101\1\221\1\243\11\0\6\u0101\1\0"+ + "\1\u0101\1\0\1\u0101\2\0\5\u0101\44\0\1\u010f\20\0"+ + "\1\16\10\0\4\16\1\0\3\16\13\0\4\16\1\u0110"+ + "\1\16\1\0\1\16\1\0\1\16\2\0\5\16\44\0"+ + "\1\u0111\20\0\1\33\10\0\4\33\1\0\3\33\1\0"+ + "\1\150\11\0\4\33\1\u0112\1\33\1\0\1\33\1\0"+ + "\1\33\2\0\5\33\4\0\1\u0100\2\0\1\217\5\0"+ + "\1\u0107\1\u0100\1\u0113\1\u0100\1\0\3\u0100\1\221\12\0"+ + "\6\u0100\1\0\1\u0100\1\0\1\u0100\2\0\5\u0100\4\0"+ + "\1\u0101\2\0\1\217\5\0\1\u0102\2\u0101\1\u0114\1\0"+ + "\3\u0101\1\221\1\243\11\0\6\u0101\1\0\1\u0101\1\0"+ + "\1\u0101\2\0\5\u0101\40\0\1\u0115\24\0\1\16\10\0"+ + "\4\16\1\0\3\16\13\0\1\u0116\5\16\1\0\1\16"+ + "\1\0\1\16\2\0\5\16\40\0\1\u0117\24\0\1\33"+ + "\10\0\4\33\1\0\3\33\1\0\1\150\11\0\1\u0118"+ + "\5\33\1\0\1\33\1\0\1\33\2\0\5\33\4\0"+ + "\1\u0100\2\0\1\217\5\0\1\u0107\2\u0100\1\u0119\1\0"+ + "\3\u0100\1\221\12\0\6\u0100\1\0\1\u0100\1\0\1\u0100"+ + "\2\0\5\u0100\4\0\1\u0101\2\0\1\217\5\0\1\u0102"+ + "\3\u0101\1\352\3\u0101\1\221\1\243\11\0\6\u0101\1\0"+ + "\1\u0101\1\0\1\u0101\2\0\5\u0101\43\0\1\u011a\21\0"+ + "\1\16\10\0\4\16\1\0\3\16\13\0\3\16\1\u011b"+ + "\2\16\1\0\1\16\1\0\1\16\2\0\5\16\43\0"+ + "\1\u011c\21\0\1\33\10\0\4\33\1\0\3\33\1\0"+ + "\1\150\11\0\3\33\1\u011d\2\33\1\0\1\33\1\0"+ + "\1\33\2\0\5\33\4\0\1\u0100\2\0\1\217\5\0"+ + "\1\u0107\3\u0100\1\352\3\u0100\1\221\12\0\6\u0100\1\0"+ + "\1\u0100\1\0\1\u0100\2\0\5\u0100\3\0"; private static int [] zzUnpackTrans() { - int [] result = new int[11074]; + int [] result = new int[10976]; int offset = 0; offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); return result; @@ -591,25 +590,25 @@ private static int zzUnpackTrans(String packed, int offset, int [] result) { private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); private static final String ZZ_ATTRIBUTE_PACKED_0 = - "\1\0\1\1\5\0\1\1\5\0\1\11\1\1\1\11"+ - "\7\1\1\11\4\1\1\11\10\1\5\11\7\1\1\11"+ - "\3\1\5\11\2\1\1\11\5\1\4\11\12\1\3\11"+ - "\6\1\1\11\3\1\1\11\1\1\1\11\1\0\4\1"+ - "\1\0\4\1\1\0\4\1\1\0\7\1\3\0\1\11"+ - "\4\1\1\11\1\1\3\0\13\1\2\0\1\1\1\11"+ - "\1\1\1\0\3\1\1\11\1\0\3\1\1\0\5\1"+ - "\1\0\5\1\2\0\12\1\1\0\2\1\1\0\4\1"+ - "\2\0\4\1\1\0\6\1\1\0\2\1\1\0\4\1"+ - "\1\11\1\0\3\1\1\0\3\1\1\0\1\1\1\0"+ - "\4\1\1\0\4\1\2\0\1\1\4\0\1\1\2\0"+ - "\1\1\2\0\1\1\4\0\1\1\2\0\1\1\1\11"+ - "\1\0\1\1\2\0\2\1\1\0\1\1\1\0\1\1"+ - "\1\0\1\1\1\0\1\1\1\0\1\1\1\0\1\1"+ - "\1\0\1\1\1\0\1\1\1\0\1\1\1\0\1\1"+ - "\1\0\1\1\1\0\1\11\1\1\1\11\1\1"; + "\6\0\1\1\5\0\1\11\1\1\1\11\7\1\1\11"+ + "\2\1\1\11\10\1\5\11\7\1\1\11\3\1\5\11"+ + "\2\1\1\11\5\1\4\11\12\1\3\11\6\1\1\11"+ + "\3\1\1\11\3\1\1\0\4\1\1\0\4\1\1\0"+ + "\4\1\1\0\7\1\3\0\1\11\4\1\1\11\1\1"+ + "\3\0\13\1\2\0\1\1\1\11\1\1\1\0\3\1"+ + "\1\11\1\0\3\1\1\0\5\1\1\0\5\1\2\0"+ + "\12\1\1\0\2\1\1\0\4\1\2\0\4\1\1\0"+ + "\6\1\1\0\2\1\1\0\4\1\1\11\1\0\3\1"+ + "\1\0\3\1\1\0\1\1\1\0\4\1\1\0\4\1"+ + "\2\0\1\1\4\0\1\1\2\0\1\1\2\0\1\1"+ + "\4\0\1\1\2\0\1\1\1\11\1\0\1\1\2\0"+ + "\2\1\1\0\1\1\1\0\1\1\1\0\1\1\1\0"+ + "\1\1\1\0\1\1\1\0\1\1\1\0\1\1\1\0"+ + "\1\1\1\0\1\1\1\0\1\1\1\0\1\1\1\0"+ + "\1\11\1\1\1\11\1\1"; private static int [] zzUnpackAttribute() { - int [] result = new int[287]; + int [] result = new int[285]; int offset = 0; offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); return result; @@ -777,7 +776,7 @@ public final int yylength() { /** - * Reports an error that occurred while scanning. + * Reports an error that occured while scanning. * * In a wellformed scanner (no or only correct usage of * yypushback(int) and a match-all fallback rule) this method @@ -924,234 +923,229 @@ else if (zzAtEOF) { else { switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { case 1: - { return ImpexTypes.COMMENT_BODY; + { return ImpexTypes.BEAN_SHELL_BODY; } // fall through - case 58: break; + case 57: break; case 2: - { return ImpexTypes.BEAN_SHELL_BODY; + { return TokenType.BAD_CHARACTER; } // fall through - case 59: break; + case 58: break; case 3: - { return TokenType.BAD_CHARACTER; + { yybegin(FIELD_VALUE); return ImpexTypes.VALUE_SUBTYPE; } // fall through - case 60: break; + case 59: break; case 4: - { yybegin(FIELD_VALUE); return ImpexTypes.VALUE_SUBTYPE; + { yybegin(YYINITIAL); return ImpexTypes.CRLF; } // fall through - case 61: break; + case 60: break; case 5: - { yybegin(YYINITIAL); return ImpexTypes.CRLF; + { return TokenType.WHITE_SPACE; } // fall through - case 62: break; + case 61: break; case 6: - { return TokenType.WHITE_SPACE; + { yybegin(YYINITIAL); return ImpexTypes.LINE_COMMENT; } // fall through - case 63: break; + case 62: break; case 7: - { yybegin(COMMENT); return ImpexTypes.COMMENT_MARKER; - } - // fall through - case 64: break; - case 8: { yybegin(FIELD_VALUE); return ImpexTypes.FIELD_VALUE_SEPARATOR; } // fall through - case 65: break; - case 9: + case 63: break; + case 8: { return ImpexTypes.MACRO_VALUE; } // fall through - case 66: break; - case 10: + case 64: break; + case 9: { return ImpexTypes.LEFT_SQUARE_BRACKET; } // fall through - case 67: break; - case 11: + case 65: break; + case 10: { return ImpexTypes.RIGHT_SQUARE_BRACKET; } // fall through - case 68: break; - case 12: + case 66: break; + case 11: { return ImpexTypes.LEFT_ROUND_BRACKET; } // fall through - case 69: break; - case 13: + case 67: break; + case 12: { return ImpexTypes.RIGHT_ROUND_BRACKET; } // fall through - case 70: break; - case 14: + case 68: break; + case 13: { return ImpexTypes.COMMA; } // fall through - case 71: break; - case 15: + case 69: break; + case 14: { return ImpexTypes.DIGIT; } // fall through - case 72: break; - case 16: + case 70: break; + case 15: { yybegin(WAITING_MACRO_VALUE); return ImpexTypes.ASSIGN_VALUE; } // fall through - case 73: break; - case 17: + case 71: break; + case 16: { yybegin(HEADER_LINE); return ImpexTypes.HEADER_TYPE; } // fall through - case 74: break; - case 18: + case 72: break; + case 17: { return ImpexTypes.HEADER_PARAMETER_NAME; } // fall through - case 75: break; - case 19: + case 73: break; + case 18: { yybegin(WAITING_ATTR_OR_PARAM_VALUE); return ImpexTypes.ASSIGN_VALUE; } // fall through - case 76: break; - case 20: + case 74: break; + case 19: { return ImpexTypes.DOT; } // fall through - case 77: break; - case 21: + case 75: break; + case 20: { yybegin(MODYFIERS_BLOCK); return ImpexTypes.LEFT_SQUARE_BRACKET; } // fall through - case 78: break; - case 22: + case 76: break; + case 21: { return ImpexTypes.PARAMETERS_SEPARATOR; } // fall through - case 79: break; - case 23: + case 77: break; + case 22: { return ImpexTypes.ALTERNATIVE_PATTERN; } // fall through - case 80: break; - case 24: + case 78: break; + case 23: { return ImpexTypes.FIELD_VALUE; } // fall through - case 81: break; - case 25: + case 79: break; + case 24: { return ImpexTypes.FIELD_VALUE_SEPARATOR; } // fall through - case 82: break; - case 26: + case 80: break; + case 25: { return ImpexTypes.FIELD_LIST_ITEM_SEPARATOR; } // fall through - case 83: break; - case 27: + case 81: break; + case 26: { return ImpexTypes.DEFAULT_PATH_DELIMITER; } // fall through - case 84: break; - case 28: + case 82: break; + case 27: { return ImpexTypes.ALTERNATIVE_MAP_DELIMITER; } // fall through - case 85: break; - case 29: + case 83: break; + case 28: { return ImpexTypes.ATTRIBUTE_NAME; } // fall through - case 86: break; - case 30: + case 84: break; + case 29: { yybegin(HEADER_LINE); return ImpexTypes.RIGHT_SQUARE_BRACKET; } // fall through - case 87: break; - case 31: + case 85: break; + case 30: { return ImpexTypes.ATTRIBUTE_SEPARATOR; } // fall through - case 88: break; - case 32: + case 86: break; + case 31: { yybegin(MODYFIERS_BLOCK); return ImpexTypes.ALTERNATIVE_MAP_DELIMITER; } // fall through - case 89: break; - case 33: + case 87: break; + case 32: { return ImpexTypes.ATTRIBUTE_VALUE; } // fall through - case 90: break; - case 34: + case 88: break; + case 33: { yybegin(MODYFIERS_BLOCK); return ImpexTypes.ATTRIBUTE_SEPARATOR; } // fall through - case 91: break; - case 35: + case 89: break; + case 34: { yypushback(yylength()); yybegin(MACRO_USAGE); } // fall through - case 92: break; - case 36: + case 90: break; + case 35: { yybegin(BEAN_SHELL); return ImpexTypes.BEAN_SHELL_MARKER; } // fall through - case 93: break; - case 37: + case 91: break; + case 36: { return ImpexTypes.DOUBLE_STRING; } // fall through - case 94: break; - case 38: + case 92: break; + case 37: { return ImpexTypes.MACRO_USAGE; } // fall through - case 95: break; - case 39: + case 93: break; + case 38: { return ImpexTypes.SINGLE_STRING; } // fall through - case 96: break; - case 40: + case 94: break; + case 39: { yypushback(yylength()); yybegin(WAITING_MACRO_CONFIG_USAGE); } // fall through - case 97: break; - case 41: + case 95: break; + case 40: { return ImpexTypes.HEADER_SPECIAL_PARAMETER_NAME; } // fall through - case 98: break; - case 42: + case 96: break; + case 41: { yybegin(HEADER_LINE); yypushback(1); return ImpexTypes.FUNCTION; } // fall through - case 99: break; - case 43: + case 97: break; + case 42: { return ImpexTypes.DOCUMENT_ID; } // fall through - case 100: break; - case 44: + case 98: break; + case 43: { return ImpexTypes.DEFAULT_KEY_VALUE_DELIMITER; } // fall through - case 101: break; - case 45: + case 99: break; + case 44: { yybegin(WAITING_MACRO_VALUE); return ImpexTypes.MACRO_USAGE; } // fall through - case 102: break; - case 46: + case 100: break; + case 45: { yybegin(MACRO_DECLARATION); /* Push back '='. */ yypushback(1); @@ -1160,62 +1154,62 @@ else if (zzAtEOF) { return ImpexTypes.MACRO_NAME_DECLARATION; } // fall through - case 103: break; - case 47: + case 101: break; + case 46: { return ImpexTypes.BOOLEAN; } // fall through - case 104: break; - case 48: + case 102: break; + case 47: { return ImpexTypes.FIELD_VALUE_URL; } // fall through - case 105: break; - case 49: + case 103: break; + case 48: { yybegin(HEADER_TYPE); return ImpexTypes.HEADER_MODE_INSERT; } // fall through - case 106: break; - case 50: + case 104: break; + case 49: { yybegin(HEADER_TYPE); return ImpexTypes.HEADER_MODE_REMOVE; } // fall through - case 107: break; - case 51: + case 105: break; + case 50: { yybegin(HEADER_TYPE); return ImpexTypes.HEADER_MODE_UPDATE; } // fall through - case 108: break; - case 52: + case 106: break; + case 51: { return ImpexTypes.HEADER_MODE_INSERT; } // fall through - case 109: break; - case 53: + case 107: break; + case 52: { return ImpexTypes.HEADER_MODE_REMOVE; } // fall through - case 110: break; - case 54: + case 108: break; + case 53: { return ImpexTypes.HEADER_MODE_UPDATE; } // fall through - case 111: break; - case 55: + case 109: break; + case 54: { return ImpexTypes.FIELD_VALUE_IGNORE; } // fall through - case 112: break; - case 56: + case 110: break; + case 55: { yybegin(HEADER_TYPE); return ImpexTypes.HEADER_MODE_INSERT_UPDATE; } // fall through - case 113: break; - case 57: + case 111: break; + case 56: { return ImpexTypes.HEADER_MODE_INSERT_UPDATE; } // fall through - case 114: break; + case 112: break; default: zzScanError(ZZ_NO_MATCH); } diff --git a/src/com/intellij/idea/plugin/hybris/impex/ImpexParserDefinition.java b/src/com/intellij/idea/plugin/hybris/impex/ImpexParserDefinition.java index 5e74fd61e..23ba4011c 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/ImpexParserDefinition.java +++ b/src/com/intellij/idea/plugin/hybris/impex/ImpexParserDefinition.java @@ -40,7 +40,7 @@ public class ImpexParserDefinition implements ParserDefinition { public static final TokenSet WHITE_SPACES = TokenSet.create(TokenType.WHITE_SPACE); - public static final TokenSet COMMENTS = TokenSet.create(ImpexTypes.COMMENT_MARKER, ImpexTypes.COMMENT_BODY); + public static final TokenSet COMMENTS = TokenSet.create(ImpexTypes.LINE_COMMENT); public static final TokenSet STRING_LITERALS = TokenSet.create( ImpexTypes.SINGLE_STRING, ImpexTypes.DOUBLE_STRING, diff --git a/src/com/intellij/idea/plugin/hybris/impex/assistance/DefaultImpexColumnHighlighterService.java b/src/com/intellij/idea/plugin/hybris/impex/assistance/DefaultImpexColumnHighlighterService.java index e8c6e3215..b814746d8 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/assistance/DefaultImpexColumnHighlighterService.java +++ b/src/com/intellij/idea/plugin/hybris/impex/assistance/DefaultImpexColumnHighlighterService.java @@ -175,9 +175,7 @@ protected void modifyHighlightedArea( HighlightUsagesHandler.highlightRanges( HighlightManager.getInstance(editor.getProject()), editor, - EditorColorsManager.getInstance() - .getGlobalScheme() - .getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES), + EditorColors.SEARCH_RESULT_ATTRIBUTES, clear, ranges ); diff --git a/src/com/intellij/idea/plugin/hybris/impex/assistance/DefaultImpexHeaderNameHighlighterService.java b/src/com/intellij/idea/plugin/hybris/impex/assistance/DefaultImpexHeaderNameHighlighterService.java index 9dc80b897..528852ee9 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/assistance/DefaultImpexHeaderNameHighlighterService.java +++ b/src/com/intellij/idea/plugin/hybris/impex/assistance/DefaultImpexHeaderNameHighlighterService.java @@ -167,9 +167,7 @@ protected void modifyHighlightedArea( HighlightUsagesHandler.highlightRanges( HighlightManager.getInstance(editor.getProject()), editor, - EditorColorsManager.getInstance() - .getGlobalScheme() - .getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES), + EditorColors.SEARCH_RESULT_ATTRIBUTES, clear, ranges ); diff --git a/src/com/intellij/idea/plugin/hybris/impex/assistance/ImpexColumnHighlighterService.java b/src/com/intellij/idea/plugin/hybris/impex/assistance/ImpexColumnHighlighterService.java index f4a53c2e5..1d7065e46 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/assistance/ImpexColumnHighlighterService.java +++ b/src/com/intellij/idea/plugin/hybris/impex/assistance/ImpexColumnHighlighterService.java @@ -18,9 +18,15 @@ package com.intellij.idea.plugin.hybris.impex.assistance; +import com.intellij.openapi.application.ApplicationManager; + /** * @author Aleksandr Nosov */ public interface ImpexColumnHighlighterService extends ImpexHighlighterService { + static ImpexColumnHighlighterService getInstance() { + return ApplicationManager.getApplication().getService(ImpexColumnHighlighterService.class); + } + } diff --git a/src/com/intellij/idea/plugin/hybris/impex/assistance/ImpexHeaderHighlighterComponent.java b/src/com/intellij/idea/plugin/hybris/impex/assistance/ImpexHeaderHighlighterComponent.java index f224d19f5..980461bb7 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/assistance/ImpexHeaderHighlighterComponent.java +++ b/src/com/intellij/idea/plugin/hybris/impex/assistance/ImpexHeaderHighlighterComponent.java @@ -19,7 +19,7 @@ package com.intellij.idea.plugin.hybris.impex.assistance; import com.intellij.idea.plugin.hybris.common.services.CommonIdeaService; -import com.intellij.openapi.components.ApplicationComponent; +import com.intellij.openapi.components.BaseComponent; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.EditorFactory; import com.intellij.openapi.editor.event.CaretEvent; @@ -28,13 +28,12 @@ import com.intellij.openapi.editor.event.EditorFactoryListener; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; -import com.intellij.openapi.project.ProjectManagerAdapter; import com.intellij.openapi.project.ProjectManagerListener; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; import com.intellij.psi.PsiTreeChangeEvent; import com.intellij.psi.PsiTreeChangeListener; -import com.intellij.psi.util.PsiUtilBase; +import com.intellij.psi.util.PsiEditorUtil; import org.apache.commons.lang3.Validate; import org.jetbrains.annotations.NotNull; @@ -44,33 +43,27 @@ * * @author Alexander Bartash */ -public class ImpexHeaderHighlighterComponent implements ApplicationComponent { +public class ImpexHeaderHighlighterComponent implements BaseComponent { - protected final CommonIdeaService commonIdeaService; + protected CommonIdeaService commonIdeaService; protected final CaretListener caretListener = new ImpexHeaderHighlightingCaretListener(); protected final CaretListener caretColumnListener = new ImpexColumnHighlightingCaretListener(); protected final ProjectManagerListener projectManagerListener = new ImpexProjectManagerListener(); protected final PsiTreeChangeListener psiTreeChangeListener = new ImpexPsiTreeChangeListener(); protected final EditorFactoryListener editorFactoryListener = new ImpexEditorFactoryListener(); - protected final ImpexHeaderNameHighlighterService impexHeaderNameHighlighterService; - protected final ImpexColumnHighlighterService impexColumnHighlighterService; - - public ImpexHeaderHighlighterComponent( - final CommonIdeaService commonIdeaService, - final ImpexHeaderNameHighlighterService impexHeaderNameHighlighterService, - final ImpexColumnHighlighterService impexColumnHighlighterService - ) { + protected ImpexHeaderNameHighlighterService impexHeaderNameHighlighterService; + protected ImpexColumnHighlighterService impexColumnHighlighterService; + + @Override + public void initComponent() { + this.commonIdeaService = CommonIdeaService.getInstance(); + this.impexColumnHighlighterService = ImpexColumnHighlighterService.getInstance(); + this.impexHeaderNameHighlighterService = ImpexHeaderNameHighlighterService.getInstance(); + Validate.notNull(commonIdeaService); Validate.notNull(impexHeaderNameHighlighterService); Validate.notNull(impexColumnHighlighterService); - this.commonIdeaService = commonIdeaService; - this.impexColumnHighlighterService = impexColumnHighlighterService; - this.impexHeaderNameHighlighterService = impexHeaderNameHighlighterService; - } - - @Override - public void initComponent() { EditorFactory.getInstance().getEventMulticaster().addCaretListener(caretListener); EditorFactory.getInstance().getEventMulticaster().addCaretListener(caretColumnListener); ProjectManager.getInstance().addProjectManagerListener(this.projectManagerListener); @@ -129,18 +122,16 @@ public void caretRemoved(final CaretEvent e) { } } - protected class ImpexProjectManagerListener extends ProjectManagerAdapter implements ProjectManagerListener { + protected class ImpexProjectManagerListener implements ProjectManagerListener { @Override public void projectOpened(final Project project) { - super.projectOpened(project); PsiManager.getInstance(project).addPsiTreeChangeListener(psiTreeChangeListener); EditorFactory.getInstance().addEditorFactoryListener(editorFactoryListener, project); } @Override public void projectClosed(final Project project) { - super.projectClosed(project); PsiManager.getInstance(project).removePsiTreeChangeListener(psiTreeChangeListener); } @@ -155,7 +146,7 @@ private void highlightHeader(final PsiTreeChangeEvent psiTreeChangeEvent) { return; } - final Editor editor = PsiUtilBase.findEditor(file); + final Editor editor = PsiEditorUtil.findEditor(file); if (null == editor) { return; diff --git a/src/com/intellij/idea/plugin/hybris/impex/assistance/ImpexHeaderNameHighlighterService.java b/src/com/intellij/idea/plugin/hybris/impex/assistance/ImpexHeaderNameHighlighterService.java index c9cecb7e8..7f8cbf05f 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/assistance/ImpexHeaderNameHighlighterService.java +++ b/src/com/intellij/idea/plugin/hybris/impex/assistance/ImpexHeaderNameHighlighterService.java @@ -18,6 +18,8 @@ package com.intellij.idea.plugin.hybris.impex.assistance; +import com.intellij.openapi.application.ApplicationManager; + /** * Created 19:46 11 January 2015 * @@ -25,4 +27,8 @@ */ public interface ImpexHeaderNameHighlighterService extends ImpexHighlighterService { + static ImpexHeaderNameHighlighterService getInstance() { + return ApplicationManager.getApplication().getService(ImpexHeaderNameHighlighterService.class); + } + } diff --git a/src/com/intellij/idea/plugin/hybris/impex/commenter/ImpexCommenter.java b/src/com/intellij/idea/plugin/hybris/impex/commenter/ImpexCommenter.java index 1f1afb3b8..556b68673 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/commenter/ImpexCommenter.java +++ b/src/com/intellij/idea/plugin/hybris/impex/commenter/ImpexCommenter.java @@ -18,38 +18,159 @@ package com.intellij.idea.plugin.hybris.impex.commenter; +import com.intellij.codeInsight.generation.CommenterDataHolder; +import com.intellij.codeInsight.generation.SelfManagingCommenter; +import com.intellij.idea.plugin.hybris.impex.psi.ImpexTokenType; +import com.intellij.idea.plugin.hybris.impex.psi.ImpexTypes; +import com.intellij.lang.CodeDocumentationAwareCommenter; import com.intellij.lang.Commenter; +import com.intellij.lang.properties.parsing.PropertiesTokenTypes; +import com.intellij.openapi.editor.Document; +import com.intellij.openapi.util.TextRange; +import com.intellij.psi.PsiComment; +import com.intellij.psi.PsiFile; +import com.intellij.psi.tree.IElementType; +import com.intellij.util.text.CharArrayUtil; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class ImpexCommenter implements Commenter { +public class ImpexCommenter implements CodeDocumentationAwareCommenter, SelfManagingCommenter { + + public static final String HASH_COMMENT_PREFIX = "#"; - @Nullable @Override public String getLineCommentPrefix() { - return "#"; + return HASH_COMMENT_PREFIX; } - @Nullable @Override public String getBlockCommentPrefix() { - return ""; + return null; } - @Nullable @Override public String getBlockCommentSuffix() { return null; } - @Nullable @Override public String getCommentedBlockCommentPrefix() { return null; } - @Nullable @Override public String getCommentedBlockCommentSuffix() { return null; } + + @Nullable + @Override + public CommenterDataHolder createLineCommentingState(final int startLine, final int endLine, @NotNull final Document document, @NotNull final PsiFile file) { + return null; + } + + @Nullable + @Override + public CommenterDataHolder createBlockCommentingState( + final int selectionStart, + final int selectionEnd, + @NotNull final Document document, + @NotNull final PsiFile file) { + return null; + } + + @Override + public void commentLine(final int line, final int offset, @NotNull final Document document, @NotNull final CommenterDataHolder data) { + document.insertString(offset, HASH_COMMENT_PREFIX); + } + + @Override + public void uncommentLine(final int line, final int offset, @NotNull final Document document, @NotNull final CommenterDataHolder data) { + document.deleteString(offset, offset + HASH_COMMENT_PREFIX.length()); + } + + @Override + public boolean isLineCommented(final int line, final int offset, @NotNull final Document document, @NotNull final CommenterDataHolder data) { + return CharArrayUtil.regionMatches(document.getCharsSequence(), offset, HASH_COMMENT_PREFIX); + } + + @Nullable + @Override + public String getCommentPrefix(final int line, @NotNull final Document document, @NotNull final CommenterDataHolder data) { + return HASH_COMMENT_PREFIX; + } + + @Nullable + @Override + public TextRange getBlockCommentRange( + final int selectionStart, + final int selectionEnd, + @NotNull final Document document, + @NotNull final CommenterDataHolder data) { + throw new UnsupportedOperationException(); + } + + @Nullable + @Override + public String getBlockCommentPrefix(final int selectionStart, @NotNull final Document document, @NotNull final CommenterDataHolder data) { + return getBlockCommentPrefix(); + } + + @Nullable + @Override + public String getBlockCommentSuffix(final int selectionEnd, @NotNull final Document document, @NotNull final CommenterDataHolder data) { + return getBlockCommentSuffix(); + } + + @Override + public void uncommentBlockComment(final int startOffset, final int endOffset, final Document document, final CommenterDataHolder data) { + throw new UnsupportedOperationException(); + } + + @NotNull + @Override + public TextRange insertBlockComment(final int startOffset, final int endOffset, final Document document, final CommenterDataHolder data) { + throw new UnsupportedOperationException(); + } + + @Nullable + @Override + public IElementType getLineCommentTokenType() { + return ImpexTypes.LINE_COMMENT; + } + + @Nullable + @Override + public IElementType getBlockCommentTokenType() { + return null; + } + + @Nullable + @Override + public IElementType getDocumentationCommentTokenType() { + return null; + } + + @Nullable + @Override + public String getDocumentationCommentPrefix() { + return null; + } + + @Nullable + @Override + public String getDocumentationCommentLinePrefix() { + return null; + } + + @Nullable + @Override + public String getDocumentationCommentSuffix() { + return null; + } + + @Override + public boolean isDocumentationComment(final PsiComment element) { + return false; + } } \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/impex/completion/provider/ImpexHeaderItemTypeParameterNameCompletionProvider.kt b/src/com/intellij/idea/plugin/hybris/impex/completion/provider/ImpexHeaderItemTypeParameterNameCompletionProvider.kt index 6c08e7403..014e4a399 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/completion/provider/ImpexHeaderItemTypeParameterNameCompletionProvider.kt +++ b/src/com/intellij/idea/plugin/hybris/impex/completion/provider/ImpexHeaderItemTypeParameterNameCompletionProvider.kt @@ -26,7 +26,7 @@ import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons import com.intellij.idea.plugin.hybris.impex.psi.ImpexAnyHeaderParameterName import com.intellij.idea.plugin.hybris.impex.psi.ImpexFullHeaderParameter import com.intellij.idea.plugin.hybris.type.system.meta.TSMetaModelAccess -import com.intellij.openapi.components.ServiceManager +import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.project.Project import com.intellij.openapi.util.text.StringUtil import com.intellij.psi.PsiElement @@ -34,7 +34,7 @@ import com.intellij.psi.util.PsiTreeUtil import com.intellij.psi.xml.XmlTag import com.intellij.util.ProcessingContext import org.apache.commons.lang3.Validate -import java.util.Objects +import java.util.* /** * @author Nosov Aleksandr @@ -123,7 +123,7 @@ class ImpexHeaderItemTypeParameterNameCompletionProvider : CompletionProvider - get() = ServiceManager.getService(ImpexHeaderItemTypeParameterNameCompletionProvider::class.java) + get() = ApplicationManager.getApplication().getService(ImpexHeaderItemTypeParameterNameCompletionProvider::class.java) private fun getTypePresentableText(type: String?): String { if (type == null) { diff --git a/src/com/intellij/idea/plugin/hybris/impex/copyright/UpdateImpexCopyrightsProvider.java b/src/com/intellij/idea/plugin/hybris/impex/copyright/UpdateImpexCopyrightsProvider.java new file mode 100644 index 000000000..c57eac354 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/impex/copyright/UpdateImpexCopyrightsProvider.java @@ -0,0 +1,90 @@ +/* + * 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.impex.copyright; + +import com.intellij.idea.plugin.hybris.impex.psi.ImpexFile; +import com.intellij.openapi.fileTypes.FileType; +import com.intellij.openapi.module.Module; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.Conditions; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiComment; +import com.intellij.psi.SyntaxTraverser; +import com.intellij.psi.impl.source.tree.LeafPsiElement; +import com.intellij.util.containers.ContainerUtil; +import com.intellij.util.containers.TreeTraversal; +import com.maddyhome.idea.copyright.CopyrightProfile; +import com.maddyhome.idea.copyright.psi.UpdateCopyright; +import com.maddyhome.idea.copyright.psi.UpdateCopyrightsProvider; +import com.maddyhome.idea.copyright.psi.UpdatePsiFileCopyright; + +import java.util.List; + +public class UpdateImpexCopyrightsProvider extends UpdateCopyrightsProvider { + + @Override + public UpdateCopyright createInstance( + final Project project, + final Module module, + final VirtualFile file, + final FileType base, + final CopyrightProfile options + ) { + return new Provider(project, module, file, options); + } + + public static class Provider extends UpdatePsiFileCopyright { + + public Provider( + final Project project, + final Module module, + final VirtualFile root, + final CopyrightProfile options + ) { + super(project, module, root, options); + } + + @Override + protected boolean accept() { + return getFile() instanceof ImpexFile; + } + + @Override + protected void scanFile() { + final List comments = SyntaxTraverser.psiTraverser(getFile()) + .withTraversal(TreeTraversal.LEAVES_DFS) + .traverse() + .takeWhile(Conditions.instanceOf( + PsiComment.class, + LeafPsiElement.class + )) + .filter(PsiComment.class) + .toList(); + checkComments(ContainerUtil.getLastItem(comments), true, comments); + } + + @Override + protected void addAction(final CommentAction action) { + if (action.getType() == CommentAction.ACTION_INSERT) { + super.addAction(new CommentAction(0, action.getPrefix(), action.getSuffix())); + } else { + super.addAction(action); + } + } + } +} diff --git a/src/com/intellij/idea/plugin/hybris/impex/file/ImpexFileType.java b/src/com/intellij/idea/plugin/hybris/impex/file/ImpexFileType.java index c480bd680..25b3aa785 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/file/ImpexFileType.java +++ b/src/com/intellij/idea/plugin/hybris/impex/file/ImpexFileType.java @@ -20,6 +20,7 @@ import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons; import com.intellij.idea.plugin.hybris.impex.ImpexLanguage; +import com.intellij.lang.Language; import com.intellij.openapi.fileTypes.LanguageFileType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -38,10 +39,18 @@ protected ImpexFileType() { super(ImpexLanguage.getInstance()); } + public ImpexFileType(@NotNull Language language) { + super(language); + } + + public ImpexFileType(@NotNull Language language, boolean secondary) { + super(language, secondary); + } + @NotNull @Override public String getName() { - return "Impex file"; + return "Impex"; } @NotNull diff --git a/src/com/intellij/idea/plugin/hybris/impex/file/actions/CopyImpexFileAction.java b/src/com/intellij/idea/plugin/hybris/impex/file/actions/CopyImpexFileAction.java new file mode 100644 index 000000000..e278ab1c2 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/impex/file/actions/CopyImpexFileAction.java @@ -0,0 +1,32 @@ +package com.intellij.idea.plugin.hybris.impex.file.actions; + +import com.intellij.idea.plugin.hybris.actions.ActionUtils; +import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; + +import static com.intellij.idea.plugin.hybris.actions.CopyFileToHybrisConsoleUtils.copySelectedFilesToHybrisConsole; +import static com.intellij.idea.plugin.hybris.actions.CopyFileToHybrisConsoleUtils.isRequiredMultipleFileExtension; +import static com.intellij.idea.plugin.hybris.common.HybrisConstants.*; + +public class CopyImpexFileAction extends AnAction { + + @Override + public void update(@NotNull final AnActionEvent event) { + Project project = event.getProject(); + if (project != null) { + event.getPresentation() + .setEnabledAndVisible(ActionUtils.isHybrisContext(project) && isRequiredMultipleFileExtension( + project, IMPEX_FILE_EXTENSION)); + } + } + + @Override + public void actionPerformed(@NotNull final AnActionEvent event) { + Project project = event.getProject(); + if (project != null) { + copySelectedFilesToHybrisConsole(project, IMPEX_CONSOLE_TITLE, IMPEX_FILE_EXTENSION); + } + } +} diff --git a/src/com/intellij/idea/plugin/hybris/impex/formatting/ImpexCodeStyleSettingsProvider.java b/src/com/intellij/idea/plugin/hybris/impex/formatting/ImpexCodeStyleSettingsProvider.java index a4817308a..134ec3507 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/formatting/ImpexCodeStyleSettingsProvider.java +++ b/src/com/intellij/idea/plugin/hybris/impex/formatting/ImpexCodeStyleSettingsProvider.java @@ -23,6 +23,7 @@ import com.intellij.application.options.TabbedLanguageCodeStylePanel; import com.intellij.idea.plugin.hybris.impex.ImpexLanguage; import com.intellij.openapi.options.Configurable; +import com.intellij.psi.codeStyle.CodeStyleConfigurable; import com.intellij.psi.codeStyle.CodeStyleSettings; import com.intellij.psi.codeStyle.CodeStyleSettingsProvider; import com.intellij.psi.codeStyle.CustomCodeStyleSettings; @@ -49,7 +50,7 @@ public String getConfigurableDisplayName() { @NotNull @Override - public Configurable createSettingsPage(final CodeStyleSettings settings, final CodeStyleSettings originalSettings) { + public CodeStyleConfigurable createConfigurable(@NotNull final CodeStyleSettings settings, @NotNull final CodeStyleSettings originalSettings) { return new CodeStyleAbstractConfigurable(settings, originalSettings, "Impex") { diff --git a/src/com/intellij/idea/plugin/hybris/impex/formatting/ImpexFormattingModelBuilder.java b/src/com/intellij/idea/plugin/hybris/impex/formatting/ImpexFormattingModelBuilder.java index ce91609ea..ca6480f4f 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/formatting/ImpexFormattingModelBuilder.java +++ b/src/com/intellij/idea/plugin/hybris/impex/formatting/ImpexFormattingModelBuilder.java @@ -18,12 +18,7 @@ package com.intellij.idea.plugin.hybris.impex.formatting; -import com.intellij.formatting.Alignment; -import com.intellij.formatting.Block; -import com.intellij.formatting.FormattingModel; -import com.intellij.formatting.FormattingModelBuilder; -import com.intellij.formatting.FormattingModelProvider; -import com.intellij.formatting.SpacingBuilder; +import com.intellij.formatting.*; import com.intellij.idea.plugin.hybris.impex.ImpexLanguage; import com.intellij.idea.plugin.hybris.impex.psi.ImpexTypes; import com.intellij.lang.ASTNode; @@ -41,10 +36,13 @@ */ public class ImpexFormattingModelBuilder implements FormattingModelBuilder { - @NotNull @Override - public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) { + public @NotNull FormattingModel createModel(@NotNull FormattingContext formattingContext) { + return createModelInternally(formattingContext.getPsiElement(), formattingContext.getCodeStyleSettings()); + } + @NotNull + private FormattingModel createModelInternally(final PsiElement element, final CodeStyleSettings settings) { final Block impexBlock = new ImpexBlock( element.getNode(), null, diff --git a/src/com/intellij/idea/plugin/hybris/impex/formatting/ImpexLanguageCodeStyleSettingsProvider.java b/src/com/intellij/idea/plugin/hybris/impex/formatting/ImpexLanguageCodeStyleSettingsProvider.java index 2a7f9340e..a1792811d 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/formatting/ImpexLanguageCodeStyleSettingsProvider.java +++ b/src/com/intellij/idea/plugin/hybris/impex/formatting/ImpexLanguageCodeStyleSettingsProvider.java @@ -21,6 +21,7 @@ import com.intellij.idea.plugin.hybris.impex.ImpexLanguage; import com.intellij.lang.Language; import com.intellij.psi.codeStyle.CodeStyleSettingsCustomizable; +import com.intellij.psi.codeStyle.CodeStyleSettingsCustomizableOptions; import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider; import org.jetbrains.annotations.NotNull; @@ -42,105 +43,104 @@ public void customizeSettings( @NotNull final CodeStyleSettingsCustomizable consumer, @NotNull final SettingsType settingsType ) { - if (SettingsType.SPACING_SETTINGS == settingsType) { - + final var styleOptions = CodeStyleSettingsCustomizableOptions.getInstance(); consumer.showCustomOption( ImpexCodeStyleSettings.class, "TABLIFY", "Formatting in table-like style", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); consumer.showCustomOption( ImpexCodeStyleSettings.class, "SPACE_AFTER_FIELD_VALUE_SEPARATOR", "After field value separator", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); consumer.showCustomOption( ImpexCodeStyleSettings.class, "SPACE_BEFORE_FIELD_VALUE_SEPARATOR", "Before field value separator", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); consumer.showCustomOption( ImpexCodeStyleSettings.class, "SPACE_AFTER_PARAMETERS_SEPARATOR", "After parameters separator", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); consumer.showCustomOption( ImpexCodeStyleSettings.class, "SPACE_BEFORE_PARAMETERS_SEPARATOR", "Before parameters separator", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); consumer.showCustomOption( ImpexCodeStyleSettings.class, "SPACE_AFTER_COMMA", "After comma", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); consumer.showCustomOption( ImpexCodeStyleSettings.class, "SPACE_BEFORE_COMMA", "Before comma", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); consumer.showCustomOption( ImpexCodeStyleSettings.class, "SPACE_AFTER_ATTRIBUTE_SEPARATOR", "After attribute separator", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); consumer.showCustomOption( ImpexCodeStyleSettings.class, "SPACE_BEFORE_ATTRIBUTE_SEPARATOR", "Before attribute separator", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); consumer.showCustomOption( ImpexCodeStyleSettings.class, "SPACE_AFTER_FIELD_LIST_ITEM_SEPARATOR", "After list item separator", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); consumer.showCustomOption( ImpexCodeStyleSettings.class, "SPACE_BEFORE_FIELD_LIST_ITEM_SEPARATOR", "Before list item separator", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); consumer.showCustomOption( ImpexCodeStyleSettings.class, "SPACE_AFTER_ASSIGN_VALUE", "After assign value", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); consumer.showCustomOption( ImpexCodeStyleSettings.class, "SPACE_BEFORE_ASSIGN_VALUE", "Before assign value", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); consumer.showCustomOption( ImpexCodeStyleSettings.class, "SPACE_AFTER_LEFT_ROUND_BRACKET", "After left round bracket", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); // consumer.showCustomOption( @@ -161,14 +161,14 @@ public void customizeSettings( ImpexCodeStyleSettings.class, "SPACE_BEFORE_RIGHT_ROUND_BRACKET", "Before right round bracket", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); consumer.showCustomOption( ImpexCodeStyleSettings.class, "SPACE_AFTER_LEFT_SQUARE_BRACKET", "After left square bracket", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); // consumer.showCustomOption( @@ -189,21 +189,21 @@ public void customizeSettings( ImpexCodeStyleSettings.class, "SPACE_BEFORE_RIGHT_SQUARE_BRACKET", "Before right square bracket", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); consumer.showCustomOption( ImpexCodeStyleSettings.class, "SPACE_AFTER_ALTERNATIVE_PATTERN", "After alternative pattern", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); consumer.showCustomOption( ImpexCodeStyleSettings.class, "SPACE_BEFORE_ALTERNATIVE_PATTERN", "Before alternative pattern", - CodeStyleSettingsCustomizable.SPACES_AROUND_OPERATORS + styleOptions.SPACES_AROUND_OPERATORS ); } else if (settingsType == SettingsType.BLANK_LINES_SETTINGS) { @@ -238,6 +238,6 @@ public String getCodeSample(@NotNull final SettingsType settingsType) { " ; Hans ; admin\n" + '\n' + "INSERT_UPDATE Media ; @media[translator = de.hybris.platform.impex.jalo.media.MediaDataTranslato r] ; mime[default = 'image/png']\n" + - " ; ; $contentResource/images/logo .png\n" ; + " ; ; $contentResource/images/logo .png\n"; } } diff --git a/src/com/intellij/idea/plugin/hybris/impex/highlighting/DefaultImpexSyntaxHighlighter.java b/src/com/intellij/idea/plugin/hybris/impex/highlighting/DefaultImpexSyntaxHighlighter.java index 48349a822..a2274f671 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/highlighting/DefaultImpexSyntaxHighlighter.java +++ b/src/com/intellij/idea/plugin/hybris/impex/highlighting/DefaultImpexSyntaxHighlighter.java @@ -37,8 +37,6 @@ import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.BEAN_SHELL_MARKER; import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.BOOLEAN; import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.COMMA; -import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.COMMENT_BODY; -import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.COMMENT_MARKER; import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.DEFAULT_KEY_VALUE_DELIMITER; import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.DEFAULT_PATH_DELIMITER; import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.DIGIT; @@ -60,6 +58,7 @@ import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.MACRO_USAGE; import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.MACRO_VALUE; import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.PARAMETERS_SEPARATOR; +import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.PROPERTY_COMMENT; import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.ROUND_BRACKETS; import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.SINGLE_STRING; import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.SQUARE_BRACKETS; @@ -67,8 +66,7 @@ public class DefaultImpexSyntaxHighlighter extends ImpexSyntaxHighlighter { - public static final TextAttributesKey[] COMMENT_MARKER_KEYS = pack(COMMENT_MARKER); - public static final TextAttributesKey[] COMMENT_BODY_KEYS = pack(COMMENT_BODY); + public static final TextAttributesKey[] PROPERTY_COMMENT_KEYS = pack(PROPERTY_COMMENT); public static final TextAttributesKey[] MACRO_NAME_DECLARATION_KEYS = pack(MACRO_NAME_DECLARATION); public static final TextAttributesKey[] MACRO_VALUE_KEYS = pack(MACRO_VALUE); public static final TextAttributesKey[] MACRO_USAGE_KEYS = pack(MACRO_USAGE); @@ -137,10 +135,8 @@ public TextAttributesKey[] getTokenHighlights(@NotNull final IElementType tokenT return BOOLEAN_KEYS; } else if (tokenType.equals(ImpexTypes.COMMA)) { return COMMA_KEYS; - } else if (tokenType.equals(ImpexTypes.COMMENT_BODY)) { - return COMMENT_BODY_KEYS; - } else if (tokenType.equals(ImpexTypes.COMMENT_MARKER)) { - return COMMENT_MARKER_KEYS; + } else if (tokenType.equals(ImpexTypes.LINE_COMMENT)) { + return PROPERTY_COMMENT_KEYS; } else if (tokenType.equals(ImpexTypes.DEFAULT_PATH_DELIMITER)) { return DEFAULT_PATH_DELIMITER_KEYS; } else if (tokenType.equals(ImpexTypes.DIGIT)) { diff --git a/src/com/intellij/idea/plugin/hybris/impex/highlighting/ImpexColorSettingsPage.java b/src/com/intellij/idea/plugin/hybris/impex/highlighting/ImpexColorSettingsPage.java index 24a2ef65f..ecceb3d7e 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/highlighting/ImpexColorSettingsPage.java +++ b/src/com/intellij/idea/plugin/hybris/impex/highlighting/ImpexColorSettingsPage.java @@ -42,8 +42,7 @@ import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.BEAN_SHELL_MARKER; import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.BOOLEAN; import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.COMMA; -import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.COMMENT_BODY; -import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.COMMENT_MARKER; +import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.PROPERTY_COMMENT; import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.DEFAULT_KEY_VALUE_DELIMITER; import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.DEFAULT_PATH_DELIMITER; import static com.intellij.idea.plugin.hybris.impex.highlighting.ImpexHighlighterColors.DIGIT; @@ -75,8 +74,7 @@ public class ImpexColorSettingsPage implements ColorSettingsPage { private static final AttributesDescriptor[] DESCRIPTORS = new AttributesDescriptor[]{ - new AttributesDescriptor("Comment marker (#)", COMMENT_MARKER), - new AttributesDescriptor("Comment body", COMMENT_BODY), + new AttributesDescriptor("Comment line", PROPERTY_COMMENT), new AttributesDescriptor("Macro name declaration", MACRO_NAME_DECLARATION), new AttributesDescriptor("Macro value", MACRO_VALUE), new AttributesDescriptor("Macro usage", MACRO_USAGE), diff --git a/src/com/intellij/idea/plugin/hybris/impex/highlighting/ImpexHighlighterColors.java b/src/com/intellij/idea/plugin/hybris/impex/highlighting/ImpexHighlighterColors.java index cc79348f9..73ffefafa 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/highlighting/ImpexHighlighterColors.java +++ b/src/com/intellij/idea/plugin/hybris/impex/highlighting/ImpexHighlighterColors.java @@ -37,13 +37,12 @@ import static com.intellij.openapi.editor.DefaultLanguageHighlighterColors.STATIC_FIELD; import static com.intellij.openapi.editor.DefaultLanguageHighlighterColors.STRING; -public class ImpexHighlighterColors { +public final class ImpexHighlighterColors { private ImpexHighlighterColors() { } - public static final TextAttributesKey COMMENT_MARKER = key("COMMENT_MARKER", LINE_COMMENT); - public static final TextAttributesKey COMMENT_BODY = key("COMMENT_BODY", LINE_COMMENT); + public static final TextAttributesKey PROPERTY_COMMENT = key("LINE_COMMENT", LINE_COMMENT); public static final TextAttributesKey MACRO_NAME_DECLARATION = key("MACRO_NAME_DECLARATION", INSTANCE_FIELD); public static final TextAttributesKey MACRO_VALUE = key("MACRO_VALUE", HighlighterColors.TEXT); public static final TextAttributesKey MACRO_USAGE = key("MACRO_USAGE", INSTANCE_FIELD); diff --git a/src/com/intellij/idea/plugin/hybris/impex/highlighting/findUsages/HighlightMacrosHandler.java b/src/com/intellij/idea/plugin/hybris/impex/highlighting/findUsages/HighlightMacrosHandler.java index da68c9aa4..2945c112a 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/highlighting/findUsages/HighlightMacrosHandler.java +++ b/src/com/intellij/idea/plugin/hybris/impex/highlighting/findUsages/HighlightMacrosHandler.java @@ -25,6 +25,7 @@ import com.intellij.psi.PsiFile; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.Consumer; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Collections; @@ -51,12 +52,12 @@ public List getTargets() { } @Override - protected void selectTargets(final List targets, final Consumer> selectionConsumer) { + protected void selectTargets(final List targets, final Consumer> selectionConsumer) { selectionConsumer.consume(targets); } @Override - public void computeUsages(final List targets) { + public void computeUsages(final List targets) { final PsiFile file = myTarget.getContainingFile(); final PsiElement[] psiElements = PsiTreeUtil.collectElements( diff --git a/src/com/intellij/idea/plugin/hybris/impex/injection/ImpexGroovyLanguageInjector.kt b/src/com/intellij/idea/plugin/hybris/impex/injection/ImpexGroovyLanguageInjector.kt index 442ae89df..4bb939ac9 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/injection/ImpexGroovyLanguageInjector.kt +++ b/src/com/intellij/idea/plugin/hybris/impex/injection/ImpexGroovyLanguageInjector.kt @@ -41,7 +41,7 @@ class ImpexGroovyLanguageInjector : LanguageInjector { injectionPlacesRegistrar: InjectedLanguagePlaces ) { if (host is ImpexStringImpl) { - val hostString = StringUtil.unquoteString(host.getText()).toLowerCase() + val hostString = StringUtil.unquoteString(host.getText()).lowercase() if (StringUtil.trim(hostString).replaceFirst("\"", "").startsWith(GROOVY_MARKER)) { val language = GroovyLanguage try { diff --git a/src/com/intellij/idea/plugin/hybris/impex/injection/ImpexXmlLanguageInjector.kt b/src/com/intellij/idea/plugin/hybris/impex/injection/ImpexXmlLanguageInjector.kt index 22ff7ef3f..eaca8bb99 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/injection/ImpexXmlLanguageInjector.kt +++ b/src/com/intellij/idea/plugin/hybris/impex/injection/ImpexXmlLanguageInjector.kt @@ -43,7 +43,7 @@ class ImpexXmlLanguageInjector : LanguageInjector { injectionPlacesRegistrar: InjectedLanguagePlaces ) { if (host is ImpexStringImpl) { - val hostString = StringUtil.unquoteString(host.getText()).toLowerCase() + val hostString = StringUtil.unquoteString(host.getText()).lowercase() if (StringUtil.trim(hostString).replaceFirst("\"", "").isXmlLike()) { val language = XMLLanguage.INSTANCE try { diff --git a/src/com/intellij/idea/plugin/hybris/impex/inspection/ConfigProcessorInspection.kt b/src/com/intellij/idea/plugin/hybris/impex/inspection/ConfigProcessorInspection.kt index 13f73910c..ada09812b 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/inspection/ConfigProcessorInspection.kt +++ b/src/com/intellij/idea/plugin/hybris/impex/inspection/ConfigProcessorInspection.kt @@ -29,7 +29,7 @@ import com.intellij.idea.plugin.hybris.impex.psi.ImpexTypes import com.intellij.idea.plugin.hybris.impex.psi.ImpexVisitor import com.intellij.psi.PsiElementVisitor import com.intellij.psi.search.GlobalSearchScope -import com.intellij.psi.search.PsiSearchHelper.SERVICE.getInstance +import com.intellij.psi.search.PsiSearchHelper import com.intellij.psi.search.UsageSearchContext import com.intellij.psi.util.PsiTreeUtil @@ -54,10 +54,10 @@ private class ConfigProcessorVisitor(private val problemsHolder: ProblemsHolder) if (prevLeaf != null && prevLeaf.text.contains("\$config")) { val file = prevLeaf.containingFile var isExist = false - getInstance(prevLeaf.project) + PsiSearchHelper.getInstance(prevLeaf.project) .processElementsWithWord({ element, _ -> if (element.node.elementType != ImpexParserDefinition.FILE && - element.node.elementType != ImpexTypes.COMMENT_BODY) { + element.node.elementType != ImpexTypes.LINE_COMMENT) { isExist = true };true }, GlobalSearchScope.fileScope(file), diff --git a/src/com/intellij/idea/plugin/hybris/impex/psi/references/TypeSystemAttributeReference.java b/src/com/intellij/idea/plugin/hybris/impex/psi/references/TypeSystemAttributeReference.java index 6198d0d1b..d02b64f49 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/psi/references/TypeSystemAttributeReference.java +++ b/src/com/intellij/idea/plugin/hybris/impex/psi/references/TypeSystemAttributeReference.java @@ -29,6 +29,8 @@ import com.intellij.idea.plugin.hybris.type.system.model.Attribute; import com.intellij.idea.plugin.hybris.type.system.model.EnumType; import com.intellij.idea.plugin.hybris.type.system.model.RelationElement; +import com.intellij.openapi.progress.ProgressIndicator; +import com.intellij.openapi.progress.ProgressManager; import com.intellij.psi.PsiElement; import com.intellij.psi.ResolveResult; import com.intellij.util.xml.DomElement; @@ -64,6 +66,10 @@ public TypeSystemAttributeReference(@NotNull final ImpexAnyHeaderParameterNameMi @NotNull @Override public ResolveResult[] multiResolve(final boolean incompleteCode) { + final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); + if (indicator.isCanceled()) { + return ResolveResult.EMPTY_ARRAY; + } final TSMetaModel meta = getTypeSystemMeta(); final String featureName = getElement().getText().trim(); diff --git a/src/com/intellij/idea/plugin/hybris/impex/rename/ImpexMacrosRenameHandler.kt b/src/com/intellij/idea/plugin/hybris/impex/rename/ImpexMacrosRenameHandler.kt index 5daaf98eb..b1269233a 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/rename/ImpexMacrosRenameHandler.kt +++ b/src/com/intellij/idea/plugin/hybris/impex/rename/ImpexMacrosRenameHandler.kt @@ -46,7 +46,7 @@ class ImpexMacrosRenameHandler : RenameHandler { return false } - override fun invoke(project: Project, editor: Editor?, file: PsiFile?, dataContext: DataContext?) = psiRenameHandler.invoke(project, editor, file, dataContext) + override fun invoke(project: Project, editor: Editor?, file: PsiFile?, dataContext: DataContext) = psiRenameHandler.invoke(project, editor, file, dataContext) - override fun invoke(project: Project, elements: Array, dataContext: DataContext?) = psiRenameHandler.invoke(project, elements, dataContext) + override fun invoke(project: Project, elements: Array, dataContext: DataContext) = psiRenameHandler.invoke(project, elements, dataContext) } \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/impex/tableFormatting/actions/handler/ImpexTableActionHandler.java b/src/com/intellij/idea/plugin/hybris/impex/tableFormatting/actions/handler/ImpexTableActionHandler.java index 9533c6c42..8c901716b 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/tableFormatting/actions/handler/ImpexTableActionHandler.java +++ b/src/com/intellij/idea/plugin/hybris/impex/tableFormatting/actions/handler/ImpexTableActionHandler.java @@ -18,7 +18,6 @@ package com.intellij.idea.plugin.hybris.impex.tableFormatting.actions.handler; -import com.intellij.idea.plugin.hybris.statistics.StatsCollector; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Caret; @@ -26,7 +25,6 @@ import com.intellij.openapi.editor.actionSystem.EditorActionHandler; import org.jetbrains.annotations.Nullable; -import static com.intellij.idea.plugin.hybris.statistics.StatsCollector.ACTIONS.IMPEX_TABLE_FORMAT; /** * @author Aleksandr Nosov @@ -35,7 +33,6 @@ public abstract class ImpexTableActionHandler extends EditorActionHandler { @Override protected void doExecute(Editor editor, @Nullable Caret caret, final DataContext dataContext) { - StatsCollector.getInstance().collectStat(IMPEX_TABLE_FORMAT); ApplicationManager.getApplication().runWriteAction(action(editor)); } diff --git a/src/com/intellij/idea/plugin/hybris/impex/utils/ProjectPropertiesUtils.kt b/src/com/intellij/idea/plugin/hybris/impex/utils/ProjectPropertiesUtils.kt index dce69ec7b..6ce41677f 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/utils/ProjectPropertiesUtils.kt +++ b/src/com/intellij/idea/plugin/hybris/impex/utils/ProjectPropertiesUtils.kt @@ -122,7 +122,7 @@ object ProjectPropertiesUtils { if (!dir.isDirectory) { return } - val matchedFiles = dir.listFiles { dir1, name -> OPTIONAL_PROPERTIES_FILE_PATTERN.matcher(name).matches() } + val matchedFiles = dir.listFiles { _, name -> OPTIONAL_PROPERTIES_FILE_PATTERN.matcher(name).matches() } ?: return val propertyFiles = TreeMap() Arrays.stream(matchedFiles).forEach { file -> propertyFiles[file.name] = file } diff --git a/src/com/intellij/idea/plugin/hybris/impex/view/ImpexStructureViewBuilder.java b/src/com/intellij/idea/plugin/hybris/impex/view/ImpexStructureViewBuilder.java index d2a8effa7..d95f275b0 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/view/ImpexStructureViewBuilder.java +++ b/src/com/intellij/idea/plugin/hybris/impex/view/ImpexStructureViewBuilder.java @@ -18,39 +18,37 @@ package com.intellij.idea.plugin.hybris.impex.view; -import com.intellij.ide.structureView.StructureView; import com.intellij.ide.structureView.StructureViewBuilder; import com.intellij.ide.structureView.StructureViewModel; +import com.intellij.ide.structureView.TreeBasedStructureViewBuilder; import com.intellij.ide.structureView.impl.TemplateLanguageStructureViewBuilder; import com.intellij.idea.plugin.hybris.impex.psi.ImpexFile; import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.fileEditor.FileEditor; -import com.intellij.openapi.fileEditor.TextEditor; import com.intellij.psi.PsiFile; - -import static com.intellij.ide.structureView.impl.StructureViewComposite.StructureViewDescriptor; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Created by Martin Zdarsky-Jones (martin.zdarsky@hybris.com) on 6/3/17. */ public class ImpexStructureViewBuilder extends TemplateLanguageStructureViewBuilder implements StructureViewBuilder { - private final ImpexFile psiFile; - public ImpexStructureViewBuilder(final ImpexFile psiFile) { super(psiFile); - this.psiFile = psiFile; } + @Nullable @Override - protected StructureViewDescriptor createMainView( - final FileEditor fileEditor, final PsiFile mainFile - ) { - final Editor editor = fileEditor instanceof TextEditor ? ((TextEditor) fileEditor).getEditor() : null; - StructureViewModel model = new ImpexStructureViewModel(editor, psiFile); - StructureView view = new ImpexStructureViewComponent(fileEditor, model, psiFile.getProject()); - StructureViewDescriptor descriptor = new StructureViewDescriptor(psiFile.getName(), view, null); - return descriptor; + protected TreeBasedStructureViewBuilder createMainBuilder(@NotNull PsiFile psi) { + return new TreeBasedStructureViewBuilder() { + + @NotNull + @Override + public StructureViewModel createStructureViewModel(@Nullable Editor editor) { + return new ImpexStructureViewModel((ImpexFile) psi); + } + }; + } diff --git a/src/com/intellij/idea/plugin/hybris/impex/view/ImpexStructureViewModel.java b/src/com/intellij/idea/plugin/hybris/impex/view/ImpexStructureViewModel.java index db10503a2..aa8c947ab 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/view/ImpexStructureViewModel.java +++ b/src/com/intellij/idea/plugin/hybris/impex/view/ImpexStructureViewModel.java @@ -35,6 +35,10 @@ protected ImpexStructureViewModel(final Editor editor, final ImpexFile file) { super(editor, file); } + protected ImpexStructureViewModel(final ImpexFile file) { + super(file); + } + @NotNull @Override public StructureViewTreeElement getRoot() { diff --git a/src/com/intellij/idea/plugin/hybris/indexing/HybrisDirectoryIndexExcludePolicy.kt b/src/com/intellij/idea/plugin/hybris/indexing/HybrisDirectoryIndexExcludePolicy.kt new file mode 100644 index 000000000..0c00e211a --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/indexing/HybrisDirectoryIndexExcludePolicy.kt @@ -0,0 +1,112 @@ +/* + * 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.indexing + +import com.intellij.idea.plugin.hybris.settings.HybrisApplicationSettingsComponent +import com.intellij.openapi.project.Project +import com.intellij.openapi.roots.ModuleRootModel +import com.intellij.openapi.roots.impl.DirectoryIndexExcludePolicy +import com.intellij.openapi.vfs.VfsUtilCore +import com.intellij.openapi.vfs.VirtualFile +import com.intellij.openapi.vfs.VirtualFileVisitor +import com.intellij.openapi.vfs.pointers.VirtualFilePointer +import com.intellij.openapi.vfs.pointers.VirtualFilePointerManager + +class HybrisDirectoryIndexExcludePolicy(val project: Project) : DirectoryIndexExcludePolicy { + + override fun getExcludeRootsForModule(rootModel: ModuleRootModel): Array { + val contentRoots = rootModel.contentRoots + val excludedFoldersFromIndex = mutableListOf() + contentRoots.forEach { contentRoot -> + excludedFoldersFromIndex.addAll(getExcludedFoldersFromIndex(contentRoot)) + } + return excludedFoldersFromIndex.toTypedArray() + } + + private fun getExcludedFoldersFromIndex(contentRoot: VirtualFile): List { + val excludedFoldersFromIndex = mutableListOf() + getExcludedFromIndexList().forEach { excludedFolderPath -> + VfsUtilCore.visitChildrenRecursively(contentRoot, HybrisExcludeFromIndexFileVisitor(project, + excludedFolderPath, excludedFoldersFromIndex, VirtualFileVisitor.SKIP_ROOT)) + } + return excludedFoldersFromIndex + } + + private fun getExcludedFromIndexList(): List { + return HybrisApplicationSettingsComponent.getInstance() + .state + .excludedFromIndexList + } + + class HybrisExcludeFromIndexFileVisitor( + private val project: Project, + excludedFolderPath: String, + private val excludedFoldersFromIndex: MutableList, + vararg options: Option?, + ) : VirtualFileVisitor(*options) { + + companion object { + private val VIRTUAL_FILE_POINTER_MANAGER = VirtualFilePointerManager.getInstance() + } + + private val pathFragments: List = excludedFolderPath.split("/") + + private var currentDepth = 0 + + override fun visitFile(file: VirtualFile): Boolean { + return file.isDirectory && pathFragments.size > currentDepth && + isFolderNameEqualToPathFragment(file, currentDepth) + } + + override fun visitFileEx(file: VirtualFile): Result { + if (visitFile(file)) { + currentDepth++ + return CONTINUE + } + if (isFolderNameUndefined(currentDepth)) { + changeContentRoot(file) + } + return SKIP_CHILDREN + } + + private fun changeContentRoot(file: VirtualFile) { + val excludedFolderPath = pathFragments.drop(pathFragments.indexOf("**") + 1).joinToString("/") + val fileVisitor = HybrisExcludeFromIndexFileVisitor(project, excludedFolderPath, excludedFoldersFromIndex, SKIP_ROOT) + VfsUtilCore.visitChildrenRecursively(file, fileVisitor) + } + + override fun afterChildrenVisited(file: VirtualFile) { + if (isFolderNameEqualToPathFragment(file, pathFragments.size - 1)) { + excludedFoldersFromIndex.add(createVirtualFilePointer(file)) + } + } + + private fun isFolderNameEqualToPathFragment(file: VirtualFile, fragmentIndex: Int): Boolean { + return file.name == pathFragments[fragmentIndex] + } + + private fun isFolderNameUndefined(fragmentIndex: Int): Boolean { + return pathFragments.size > fragmentIndex && pathFragments[fragmentIndex] == "**" + } + + private fun createVirtualFilePointer(folder: VirtualFile): VirtualFilePointer { + return VIRTUAL_FILE_POINTER_MANAGER.create(folder.url, project, null) + } + } +} diff --git a/src/com/intellij/idea/plugin/hybris/inspections/util/BeanDefinitionCountHolder.kt b/src/com/intellij/idea/plugin/hybris/inspections/util/BeanDefinitionCountHolder.kt index d6d48d955..78e5d5d97 100644 --- a/src/com/intellij/idea/plugin/hybris/inspections/util/BeanDefinitionCountHolder.kt +++ b/src/com/intellij/idea/plugin/hybris/inspections/util/BeanDefinitionCountHolder.kt @@ -15,7 +15,6 @@ import com.intellij.psi.xml.XmlFile import com.intellij.psi.xml.XmlTag import com.intellij.xml.XmlAttributeDescriptor import com.intellij.xml.util.XmlUtil -import java.io.FileWriter import java.util.* /** diff --git a/src/com/intellij/idea/plugin/hybris/linemaker/HybrisBeanLineMakerProvider.kt b/src/com/intellij/idea/plugin/hybris/linemaker/HybrisBeanLineMakerProvider.kt index 62a4e7195..b08c0e434 100644 --- a/src/com/intellij/idea/plugin/hybris/linemaker/HybrisBeanLineMakerProvider.kt +++ b/src/com/intellij/idea/plugin/hybris/linemaker/HybrisBeanLineMakerProvider.kt @@ -42,11 +42,11 @@ import com.intellij.psi.xml.XmlAttributeValue class HybrisBeanLineMakerProvider : RelatedItemLineMarkerProvider() { override fun collectNavigationMarkers(element: PsiElement, - result: MutableCollection>) { + result: MutableCollection>) { if (element is PsiClass) { val project = element.project - val searchHelper = PsiSearchHelper.SERVICE.getInstance(project) + val searchHelper = PsiSearchHelper.getInstance(project) val module = ModuleUtil.findModuleForPsiElement(element) ?: return if (getDescriptorType(module) != HybrisModuleDescriptorType.PLATFORM) { @@ -80,16 +80,14 @@ class HybrisBeanLineMakerProvider : RelatedItemLineMarkerProvider() { val builder = NavigationGutterIconBuilder.create(HybrisIcons.BEAN).setTargets(list) builder.setEmptyPopupText(HybrisI18NBundleUtils.message( - "hybris.gutter.navigate.no.matching.beans", - *arrayOfNulls(0) + "hybris.gutter.navigate.no.matching.beans" )) builder.setPopupTitle(HybrisI18NBundleUtils.message( - "hybris.gutter.bean.class.navigate.choose.class.title", - *arrayOfNulls(0) + "hybris.gutter.bean.class.navigate.choose.class.title" )) builder.setTooltipText(HybrisI18NBundleUtils.message( - "hybris.gutter.item.class.tooltip.navigate.declaration", *arrayOfNulls(0) + "hybris.gutter.item.class.tooltip.navigate.declaration" )) result.add(builder.createLineMarkerInfo(psiClass.nameIdentifier!!)) } diff --git a/src/com/intellij/idea/plugin/hybris/linemaker/HybrisItemLineMakerProvider.java b/src/com/intellij/idea/plugin/hybris/linemaker/HybrisItemLineMakerProvider.java index 662bc4f95..90c1365cc 100644 --- a/src/com/intellij/idea/plugin/hybris/linemaker/HybrisItemLineMakerProvider.java +++ b/src/com/intellij/idea/plugin/hybris/linemaker/HybrisItemLineMakerProvider.java @@ -18,15 +18,13 @@ package com.intellij.idea.plugin.hybris.linemaker; -import com.google.common.collect.Sets; import com.intellij.codeInsight.daemon.RelatedItemLineMarkerInfo; import com.intellij.codeInsight.daemon.RelatedItemLineMarkerProvider; import com.intellij.codeInsight.navigation.NavigationGutterIconBuilder; import com.intellij.idea.plugin.hybris.common.utils.HybrisI18NBundleUtils; import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons; import com.intellij.idea.plugin.hybris.common.utils.PsiItemXmlUtil; -import com.intellij.psi.PsiClass; -import com.intellij.psi.PsiElement; +import com.intellij.psi.*; import com.intellij.psi.xml.XmlElement; import org.jetbrains.annotations.NotNull; @@ -46,7 +44,7 @@ public class HybrisItemLineMakerProvider extends RelatedItemLineMarkerProvider { @Override protected void collectNavigationMarkers( @NotNull final PsiElement element, - final Collection result + @NotNull final Collection> result ) { if (element instanceof PsiClass) { final PsiClass psiClass = (PsiClass) element; @@ -77,7 +75,7 @@ protected void collectNavigationMarkers( } private void createTargetsWithGutterIcon( - final Collection result, + final Collection> result, final PsiClass psiClass, final Collection list ) { @@ -85,17 +83,17 @@ private void createTargetsWithGutterIcon( = NavigationGutterIconBuilder.create(HybrisIcons.TYPE_SYSTEM).setTargets(list); builder.setEmptyPopupText(HybrisI18NBundleUtils.message( - "hybris.gutter.navigate.no.matching.beans", - new Object[0] + "hybris.gutter.navigate.no.matching.beans" )); builder.setPopupTitle(HybrisI18NBundleUtils.message( - "hybris.gutter.bean.class.navigate.choose.class.title", - new Object[0] + "hybris.gutter.bean.class.navigate.choose.class.title" )); builder.setTooltipText(HybrisI18NBundleUtils.message( - "hybris.gutter.item.class.tooltip.navigate.declaration", new Object[0] + "hybris.gutter.item.class.tooltip.navigate.declaration" )); - result.add(builder.createLineMarkerInfo(psiClass.getNameIdentifier())); + PsiIdentifier nameIdentifier = psiClass.getNameIdentifier(); + RelatedItemLineMarkerInfo lineMarkerInfo = builder.createLineMarkerInfo(nameIdentifier); + result.add(lineMarkerInfo); } } diff --git a/src/com/intellij/idea/plugin/hybris/linemaker/HybrisPopulatorLineMakerProvider.kt b/src/com/intellij/idea/plugin/hybris/linemaker/HybrisPopulatorLineMakerProvider.kt index bb1ba5aeb..e4d8cf659 100644 --- a/src/com/intellij/idea/plugin/hybris/linemaker/HybrisPopulatorLineMakerProvider.kt +++ b/src/com/intellij/idea/plugin/hybris/linemaker/HybrisPopulatorLineMakerProvider.kt @@ -38,7 +38,7 @@ import org.apache.commons.lang3.StringUtils class HybrisPopulatorLineMakerProvider : RelatedItemLineMarkerProvider() { override fun collectNavigationMarkers(psiClass: PsiElement, - result: MutableCollection>) { + result: MutableCollection>) { if (psiClass is PsiClass) { val project = psiClass.project @@ -115,16 +115,14 @@ class HybrisPopulatorLineMakerProvider : RelatedItemLineMarkerProvider() { val builder = NavigationGutterIconBuilder.create(HybrisIcons.Gutter.POPULATOR).setTargets(list) builder.setEmptyPopupText(HybrisI18NBundleUtils.message( - "hybris.gutter.navigate.no.matching.populators", - *arrayOfNulls(0) + "hybris.gutter.navigate.no.matching.populators" )) builder.setPopupTitle(HybrisI18NBundleUtils.message( - "hybris.gutter.populator.class.navigate.choose.class.title", - *arrayOfNulls(0) + "hybris.gutter.populator.class.navigate.choose.class.title" )) builder.setTooltipText(HybrisI18NBundleUtils.message( - "hybris.gutter.populator.class.tooltip.navigate.declaration", *arrayOfNulls(0) + "hybris.gutter.populator.class.tooltip.navigate.declaration" )) result.add(builder.createLineMarkerInfo(psiElement)) } diff --git a/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramDataModel.java b/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramDataModel.java index 0696328e0..d2e73e84a 100644 --- a/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramDataModel.java +++ b/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramDataModel.java @@ -30,11 +30,11 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.util.ModificationTracker; -import com.intellij.uml.project.ModuleItem; -import com.intellij.uml.project.ModulesUmlEdge; -import com.intellij.uml.project.ModulesUmlNode; -import com.intellij.uml.project.ModulesUmlProvider; -import com.intellij.uml.project.UmlModulesRelationshipHelper; +import com.intellij.uml.java.project.ModuleItem; +import com.intellij.uml.java.project.ModulesUmlEdge; +import com.intellij.uml.java.project.ModulesUmlNode; +import com.intellij.uml.java.project.ModulesUmlProvider; +import com.intellij.uml.java.project.UmlModulesRelationshipHelper; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -204,7 +204,7 @@ private List createAdaptedEdges(@NotNull final Collection< @SuppressWarnings("unchecked") @NotNull private List createAdaptedNodes(@NotNull final Collection items) { - final DiagramProvider provider = getBuilder().getProvider(); + final DiagramProvider provider = (DiagramProvider) getBuilder().getProvider(); return items.stream() .map(moduleItem -> new ModuleDepDiagramNode( diff --git a/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramElementManager.java b/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramElementManager.java index b05b635de..b9e32ca9a 100644 --- a/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramElementManager.java +++ b/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramElementManager.java @@ -39,7 +39,7 @@ public class ModuleDepDiagramElementManager extends AbstractDiagramElementManage @Nullable @Override public ModuleDepDiagramItem findInDataContext(final DataContext dataContext) { - return null; + return new ModuleDepDiagramItem(null, false); } @NotNull diff --git a/src/com/intellij/idea/plugin/hybris/moduleDiagram/ShowModuleDependencyDiagramAction.java b/src/com/intellij/idea/plugin/hybris/moduleDiagram/ShowModuleDependencyDiagramAction.java index b1d4f4c7d..e98810884 100644 --- a/src/com/intellij/idea/plugin/hybris/moduleDiagram/ShowModuleDependencyDiagramAction.java +++ b/src/com/intellij/idea/plugin/hybris/moduleDiagram/ShowModuleDependencyDiagramAction.java @@ -20,9 +20,9 @@ import com.intellij.diagram.DiagramProvider; import com.intellij.idea.plugin.hybris.actions.ActionUtils; -import com.intellij.idea.plugin.hybris.statistics.StatsCollector; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.uml.core.actions.ShowDiagram; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -35,15 +35,13 @@ public void update(final AnActionEvent e) { e.getPresentation().setEnabledAndVisible(ActionUtils.isHybrisContext(e)); } - @Nullable @Override - public DiagramProvider getProvider(final AnActionEvent e) { + public @Nullable DiagramProvider getForcedProvider(@NotNull final AnActionEvent e) { return new ModuleDepDiagramProvider(); } @Override public void actionPerformed(AnActionEvent e) { - StatsCollector.getInstance().collectStat(StatsCollector.ACTIONS.DEPENDENCY_DIAGRAM); super.actionPerformed(e); } } diff --git a/src/com/intellij/idea/plugin/hybris/notifications/NotificationUtil.java b/src/com/intellij/idea/plugin/hybris/notifications/NotificationUtil.java index 2a78fc9d4..66f00bfd5 100644 --- a/src/com/intellij/idea/plugin/hybris/notifications/NotificationUtil.java +++ b/src/com/intellij/idea/plugin/hybris/notifications/NotificationUtil.java @@ -2,6 +2,8 @@ import com.intellij.idea.plugin.hybris.common.utils.HybrisI18NBundleUtils; import com.intellij.notification.NotificationGroup; +import com.intellij.notification.NotificationGroupManager; +import com.intellij.notification.impl.NotificationGroupEP; import com.intellij.openapi.project.Project; import com.intellij.openapi.wm.WindowManager; import com.intellij.ui.SystemNotifications; @@ -17,8 +19,9 @@ public class NotificationUtil { private NotificationUtil() { } - public static final NotificationGroup NOTIFICATION_GROUP = NotificationGroup.balloonGroup( - HybrisI18NBundleUtils.message("hybris.notification.group")); + public static final NotificationGroup NOTIFICATION_GROUP = NotificationGroupManager.getInstance() + .getNotificationGroup( + "Hybris"); public static void showSystemNotificationIfNotActive( @NotNull Project project, diff --git a/src/com/intellij/idea/plugin/hybris/project/DefaultHybrisProjectImportBuilder.java b/src/com/intellij/idea/plugin/hybris/project/DefaultHybrisProjectImportBuilder.java index 0dda247c0..a40a3402f 100644 --- a/src/com/intellij/idea/plugin/hybris/project/DefaultHybrisProjectImportBuilder.java +++ b/src/com/intellij/idea/plugin/hybris/project/DefaultHybrisProjectImportBuilder.java @@ -27,20 +27,17 @@ import com.intellij.idea.plugin.hybris.project.configurators.DataSourcesConfigurator; import com.intellij.idea.plugin.hybris.project.configurators.MavenConfigurator; import com.intellij.idea.plugin.hybris.project.configurators.impl.DefaultConfiguratorFactory; -import com.intellij.idea.plugin.hybris.project.descriptors.DefaultHybrisProjectDescriptor; -import com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptor; -import com.intellij.idea.plugin.hybris.project.descriptors.HybrisProjectDescriptor; -import com.intellij.idea.plugin.hybris.project.descriptors.MavenModuleDescriptor; -import com.intellij.idea.plugin.hybris.project.descriptors.RootModuleDescriptor; +import com.intellij.idea.plugin.hybris.project.descriptors.*; import com.intellij.idea.plugin.hybris.project.tasks.ImportProjectProgressModalWindow; import com.intellij.idea.plugin.hybris.project.tasks.SearchModulesRootsTaskModalWindow; -import com.intellij.idea.plugin.hybris.statistics.StatsCollector; import com.intellij.notification.NotificationType; +import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.extensions.ExtensionPoint; import com.intellij.openapi.extensions.Extensions; +import com.intellij.openapi.extensions.ExtensionsArea; import com.intellij.openapi.module.ModifiableModuleModel; import com.intellij.openapi.module.Module; import com.intellij.openapi.options.ConfigurationException; @@ -83,29 +80,20 @@ public class DefaultHybrisProjectImportBuilder extends AbstractHybrisProjectImpo @GuardedBy("lock") protected volatile HybrisProjectDescriptor hybrisProjectDescriptor; protected volatile boolean refresh; - protected final VirtualFileSystemService virtualFileSystemService; private List moduleList; private List hybrisModulesToImport; - public DefaultHybrisProjectImportBuilder(@NotNull final VirtualFileSystemService virtualFileSystemService) { - Validate.notNull(virtualFileSystemService); - - this.virtualFileSystemService = virtualFileSystemService; - } - public ConfiguratorFactory getConfiguratorFactory() { - if (!Extensions.getRootArea().hasExtensionPoint(HybrisConstants.CONFIGURATOR_FACTORY_ID)) { - return ServiceManager.getService(DefaultConfiguratorFactory.class); - } + final Application application = ApplicationManager.getApplication(); + final ExtensionsArea extensionsArea = application.getExtensionArea(); - final ExtensionPoint ep = Extensions.getRootArea().getExtensionPoint(HybrisConstants.CONFIGURATOR_FACTORY_ID); - final ConfiguratorFactory ultimateConfiguratorFactory = (ConfiguratorFactory) ep.getExtension(); - - if (ultimateConfiguratorFactory != null) { - return ultimateConfiguratorFactory; + if (!extensionsArea.hasExtensionPoint(HybrisConstants.CONFIGURATOR_FACTORY_ID)) { + return application.getService(DefaultConfiguratorFactory.class); } - - return ServiceManager.getService(DefaultConfiguratorFactory.class); + final ExtensionPoint ep = extensionsArea.getExtensionPoint(HybrisConstants.CONFIGURATOR_FACTORY_ID); + return (ConfiguratorFactory) ep.extensions() + .findFirst() + .orElseGet(() -> application.getService(DefaultConfiguratorFactory.class)); } @Nullable @@ -193,7 +181,6 @@ public List commit( final ConfiguratorFactory configuratorFactory = this.getConfiguratorFactory(); this.performProjectsCleanup(allModules); - this.collectStatistics(hybrisProjectDescriptor); new ImportProjectProgressModalWindow( project, model, configuratorFactory, hybrisProjectDescriptor, modules @@ -282,8 +269,7 @@ private void notifyImportNotFinishedYet(@NotNull Project project) { NotificationUtil.NOTIFICATION_GROUP.createNotification( notificationTitle, message("import.or.refresh.process.not.finished.yet"), - NotificationType.INFORMATION, - null + NotificationType.INFORMATION ).notify(project); } @@ -300,33 +286,12 @@ private void notifyImportFinished(@NotNull Project project) { NotificationUtil.NOTIFICATION_GROUP.createNotification( notificationTitle, notificationName, - NotificationType.INFORMATION, - null + NotificationType.INFORMATION ).notify(project); showSystemNotificationIfNotActive(project, notificationName, notificationTitle, notificationName); } - private void collectStatistics(final HybrisProjectDescriptor hybrisProjectDescriptor) { - try { - final StringBuilder parameters = new StringBuilder(); - parameters.append("readOnly:"); - parameters.append(hybrisProjectDescriptor.isImportOotbModulesInReadOnlyMode()); - parameters.append(",customDirectoryOverride:"); - - final boolean override = hybrisProjectDescriptor.getExternalExtensionsDirectory() != null; - parameters.append(override); - - final boolean hasSources = hybrisProjectDescriptor.getSourceCodeFile() != null; - parameters.append(",hasSources:"); - parameters.append(hasSources); - - StatsCollector.getInstance().collectStat(StatsCollector.ACTIONS.IMPORT_PROJECT, parameters.toString()); - } catch (Exception e) { - // we do not care - } - } - protected void performProjectsCleanup(@NotNull final Iterable modulesChosenForImport) { Validate.notNull(modulesChosenForImport); final List alreadyExistingModuleFiles; @@ -339,7 +304,7 @@ protected void performProjectsCleanup(@NotNull final Iterable HybrisConstants.PLUGIN_ID.equals(downloader.getPluginId())) + .filter(downloader -> HybrisConstants.PLUGIN_ID.equals(downloader.getId().getIdString())) .findAny().orElse(null); if (pluginDownloader == null) { - LOG.info("Hybris integration plugin update not found"); + LOG.info("SAP Commerce Developers Toolset plugin update not found"); return; } - LOG.info("Hybris integration plugin update available"); + LOG.info("SAP Commerce Developers Toolset plugin update available"); if (UpdateInstaller.installPluginUpdates(availableUpdates, new EmptyProgressIndicator())) { - LOG.info("Hybris integration plugin update succeeded"); + LOG.info("SAP Commerce Developers Toolset plugin update succeeded"); } else { - LOG.info("Hybris integration plugin update failed"); + LOG.info("SAP Commerce Developers Toolset plugin update failed"); } }); } - private boolean popupPermissionToSendStatistics(final Project project) { - final CommonIdeaService commonIdeaService = ServiceManager.getService(CommonIdeaService.class); - if (commonIdeaService.shouldShowPermissionToSendStatisticsDialog()) { - EventQueue.invokeLater(() -> { - if (new PermissionToSendStatisticsDialog(project).showAndGet()) { - continueOpening(project); - } - }); - return false; - } - return true; - } - private void resetSpringGeneralSettings(final Project project) { final CommonIdeaService commonIdeaService = ServiceManager.getService(CommonIdeaService.class); if (commonIdeaService.isHybrisProject(project)) { @@ -204,57 +178,13 @@ private void registerAntListener(final Project project) { private boolean isOldHybrisProject(final Project project) { final CommonIdeaService commonIdeaService = ServiceManager.getService(CommonIdeaService.class); - final StatsCollector statsCollector = StatsCollector.getInstance(); if (commonIdeaService.isHybrisProject(project)) { - statsCollector.collectStat(StatsCollector.ACTIONS.OPEN_PROJECT); return commonIdeaService.isOutDatedHybrisProject(project); } else { - final boolean potential = commonIdeaService.isPotentiallyHybrisProject(project); - if (potential) { - statsCollector.collectStat(StatsCollector.ACTIONS.OPEN_POTENTIAL_PROJECT); - } - return potential; + return commonIdeaService.isPotentiallyHybrisProject(project); } } - private void showImportantInfoNotificationWithCloseTimeoutIfItWasNotShownThisMonth( - final Project project, String titleKey, String textKey - ) { - if (this.notificationWasNotAlreadyShownThisMonth()) { - this.persistCurrentTimeForNotificationShowTime(); - - final NotificationService notificationService = new DefaultNotificationService( - Y_PROJECT_NOTIFICATION_GROUP, project - ); - - notificationService.showImportantNotificationWithCloseTimeout( - titleKey, - textKey, - NotificationType.INFORMATION, - NOTIFICATION_TIMEOUT_MILLISECONDS, - (myNotification, myHyperlinkEvent) -> goToDiscountOffer(myHyperlinkEvent) - ); - } - } - - private void persistCurrentTimeForNotificationShowTime() { - PropertiesComponent.getInstance().setValue( - LAST_BUBBLE_INFO_TIME_PROPERTY, String.valueOf(System.currentTimeMillis()) - ); - } - - private boolean notificationWasNotAlreadyShownThisMonth() { - final PropertiesComponent properties = PropertiesComponent.getInstance(); - final long lastNotificationTime = properties.getOrInitLong(LAST_BUBBLE_INFO_TIME_PROPERTY, 0); - final long currentTime = System.currentTimeMillis(); - - return currentTime - lastNotificationTime >= DateFormatUtil.MONTH; - } - - private void goToDiscountOffer(final HyperlinkEvent myHyperlinkEvent) { - BrowserUtil.browse(myHyperlinkEvent.getDescription()); - } - private void fixBackOfficeJRebelSupport(final Project project) { Validate.notNull(project); @@ -291,4 +221,11 @@ private void fixBackOfficeJRebelSupport(final Project project) { @Override public void dispose() { } -} + + @Override + public void projectClosing(@NotNull final Project project) { + ConsolePersistenceService.getInstance(project).persistQueryRegions(); + } + + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/JavadocModuleConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/JavadocModuleConfigurator.java index 88fbea81f..8912ea5ce 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/JavadocModuleConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/JavadocModuleConfigurator.java @@ -19,6 +19,7 @@ package com.intellij.idea.plugin.hybris.project.configurators; import com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptor; +import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.roots.ModifiableRootModel; import org.jetbrains.annotations.NotNull; @@ -29,6 +30,7 @@ public interface JavadocModuleConfigurator { void configure( @NotNull ModifiableRootModel modifiableRootModel, - @NotNull HybrisModuleDescriptor moduleDescriptor + @NotNull HybrisModuleDescriptor moduleDescriptor, + final @NotNull ProgressIndicator indicator ); } diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/LibRootsConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/LibRootsConfigurator.java index ec55f9e74..4b29129e4 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/LibRootsConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/LibRootsConfigurator.java @@ -20,6 +20,7 @@ import com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptor; import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; +import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.roots.ModifiableRootModel; import org.jetbrains.annotations.NotNull; @@ -34,7 +35,8 @@ public interface LibRootsConfigurator { void configure( @NotNull ModifiableRootModel modifiableRootModel, @NotNull HybrisModuleDescriptor moduleDescriptor, - @NotNull IdeModifiableModelsProvider modifiableModelsProvider + @NotNull IdeModifiableModelsProvider modifiableModelsProvider, + @NotNull ProgressIndicator indicator ); } diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultAntConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultAntConfigurator.java index 22391d48b..2a58b53ce 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultAntConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultAntConfigurator.java @@ -151,7 +151,7 @@ public void configure( private void createMetaTargets(final AntBuildFileBase buildFile) { Arrays.stream(metaTargets).forEach(meta -> { - final ExecuteCompositeTargetEvent event = new ExecuteCompositeTargetEvent(meta); + final ExecuteCompositeTargetEvent event = new ExecuteCompositeTargetEvent(Arrays.asList(meta)); if (antConfiguration.getTargetForEvent(event) == null) { antConfiguration.setTargetForEvent(buildFile, event.getMetaTargetName(), event); } diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultEclipseConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultEclipseConfigurator.java index 9ce5a0280..10cf466de 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultEclipseConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultEclipseConfigurator.java @@ -82,14 +82,7 @@ private void moveEclipseModulesToGroup( module.setOption(HybrisConstants.DESCRIPTOR_TYPE, HybrisModuleDescriptorType.ECLIPSE.name()); modifiableModuleModel.setModuleGroupPath(module, eclipseGroupMapping.get(module.getName())); } - AccessToken token = null; - try { - token = ApplicationManager.getApplication().acquireWriteActionLock(getClass()); - modifiableModuleModel.commit(); - } finally { - if (token != null) { - token.finish(); - } - } + + ApplicationManager.getApplication().runWriteAction(modifiableModuleModel::commit); } } diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultGradleConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultGradleConfigurator.java index bc7127f43..f35246243 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultGradleConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultGradleConfigurator.java @@ -80,10 +80,6 @@ public void configure( gradleModule.getGradleFile().getPath(), gradleProjectImportProvider ); - final GradleProjectSettings projectSettings = gradleProjectImportBuilder.getControl(project) - .getProjectSettings(); - projectSettings.setUseAutoImport(true); - projectSettings.setCreateEmptyContentRootDirectories(false); if (wizard.getStepCount() > 0) { final ModuleWizardStep step = wizard.getCurrentStepObject(); if (step.isStepVisible()) { diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultJavadocModuleConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultJavadocModuleConfigurator.java index 54a7b1e01..8f97f6ae7 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultJavadocModuleConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultJavadocModuleConfigurator.java @@ -20,11 +20,15 @@ import com.intellij.idea.plugin.hybris.project.configurators.JavadocModuleConfigurator; import com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptor; +import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.roots.JavaModuleExternalPaths; import com.intellij.openapi.roots.ModifiableRootModel; import org.apache.commons.lang3.Validate; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; +import java.util.List; + /** * Created by Sergey Aksenenko on 4/6/2016. */ @@ -33,19 +37,29 @@ public class DefaultJavadocModuleConfigurator implements JavadocModuleConfigurat @Override public void configure( @NotNull final ModifiableRootModel modifiableRootModel, - @NotNull final HybrisModuleDescriptor moduleDescriptor + @NotNull final HybrisModuleDescriptor moduleDescriptor, + @NotNull final ProgressIndicator progressIndicator ) { Validate.notNull(modifiableRootModel); Validate.notNull(moduleDescriptor); final String javadocUrl = moduleDescriptor.getRootProjectDescriptor().getJavadocUrl(); - if (null != javadocUrl) { - final JavaModuleExternalPaths javaModuleExternalPaths = modifiableRootModel.getModuleExtension( - JavaModuleExternalPaths.class - ); + final List javadocPathList = MavenUtils.resolveMavenJavadocs(modifiableRootModel, moduleDescriptor, progressIndicator); + final JavaModuleExternalPaths javaModuleExternalPaths = modifiableRootModel.getModuleExtension( + JavaModuleExternalPaths.class + ); + + final List javadocRefList = new ArrayList<>(); + for (final String javadocPath : javadocPathList) { + javadocRefList.add("jar://" + javadocPath + "!/"); + } + javadocRefList.sort(String::compareTo); - javaModuleExternalPaths.setJavadocUrls(new String[]{javadocUrl}); + if (null != javadocUrl) { + javadocRefList.add(javadocUrl); } + + javaModuleExternalPaths.setJavadocUrls(javadocRefList.toArray(new String[0])); } } diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultLibRootsConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultLibRootsConfigurator.java index a59290d21..2a2da2973 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultLibRootsConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultLibRootsConfigurator.java @@ -19,13 +19,18 @@ package com.intellij.idea.plugin.hybris.project.configurators.impl; import com.intellij.idea.plugin.hybris.common.HybrisConstants; +import com.intellij.idea.plugin.hybris.common.LibraryDescriptorType; import com.intellij.idea.plugin.hybris.project.configurators.LibRootsConfigurator; import com.intellij.idea.plugin.hybris.project.descriptors.CoreHybrisModuleDescriptor; +import com.intellij.idea.plugin.hybris.project.descriptors.DefaultJavaLibraryDescriptor; import com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptor; import com.intellij.idea.plugin.hybris.project.descriptors.JavaLibraryDescriptor; import com.intellij.idea.plugin.hybris.project.descriptors.OotbHybrisModuleDescriptor; import com.intellij.idea.plugin.hybris.project.descriptors.PlatformHybrisModuleDescriptor; +import com.intellij.idea.plugin.hybris.settings.HybrisApplicationSettings; +import com.intellij.idea.plugin.hybris.settings.HybrisApplicationSettingsComponent; import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider; +import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.roots.DependencyScope; import com.intellij.openapi.roots.LibraryOrderEntry; import com.intellij.openapi.roots.ModifiableRootModel; @@ -40,7 +45,11 @@ import org.jetbrains.annotations.Nullable; import java.io.File; +import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; import static com.intellij.idea.plugin.hybris.common.HybrisConstants.HYBRIS_PLATFORM_CODE_SERVER_JAR_SUFFIX; @@ -56,7 +65,8 @@ public class DefaultLibRootsConfigurator implements LibRootsConfigurator { public void configure( @NotNull final ModifiableRootModel modifiableRootModel, @NotNull final HybrisModuleDescriptor moduleDescriptor, - @NotNull IdeModifiableModelsProvider modifiableModelsProvider + @NotNull IdeModifiableModelsProvider modifiableModelsProvider, + @NotNull final ProgressIndicator indicator ) { final VirtualFile sourceCodeRoot = this.getSourceCodeRoot(moduleDescriptor); @@ -69,15 +79,20 @@ public void configure( modifiableRootModel, modifiableModelsProvider, sourceCodeRoot, - javaLibraryDescriptor + javaLibraryDescriptor, + moduleDescriptor, + indicator ); } else { this.addJarFolderToModuleLibs( modifiableRootModel, modifiableModelsProvider, sourceCodeRoot, - javaLibraryDescriptor + javaLibraryDescriptor, + moduleDescriptor, + indicator ); + } } @@ -146,7 +161,9 @@ private void addClassesToModuleLibs( @NotNull final ModifiableRootModel modifiableRootModel, @NotNull final IdeModifiableModelsProvider modifiableModelsProvider, @Nullable final VirtualFile sourceCodeRoot, - @NotNull final JavaLibraryDescriptor javaLibraryDescriptor + @NotNull final JavaLibraryDescriptor javaLibraryDescriptor, + @NotNull final HybrisModuleDescriptor moduleDescriptor, + @NotNull final ProgressIndicator progressIndicator ) { final Library library = modifiableRootModel.getModuleLibraryTable().createLibrary(); final Library.ModifiableModel libraryModifiableModel = modifiableModelsProvider @@ -164,10 +181,12 @@ private void addClassesToModuleLibs( } } - if (sourceCodeRoot != null && !sourceDirAttached && javaLibraryDescriptor.getLibraryFile().getName().endsWith(HYBRIS_PLATFORM_CODE_SERVER_JAR_SUFFIX)) { + if (sourceCodeRoot != null && !sourceDirAttached && javaLibraryDescriptor.getLibraryFile().getName().endsWith( + HYBRIS_PLATFORM_CODE_SERVER_JAR_SUFFIX)) { libraryModifiableModel.addRoot(sourceCodeRoot, OrderRootType.SOURCES); } + if (javaLibraryDescriptor.isExported()) { this.setLibraryEntryExported(modifiableRootModel, library); } @@ -178,7 +197,9 @@ private void addJarFolderToModuleLibs( @NotNull final ModifiableRootModel modifiableRootModel, @NotNull final IdeModifiableModelsProvider modifiableModelsProvider, @Nullable final VirtualFile sourceCodeRoot, - @NotNull final JavaLibraryDescriptor javaLibraryDescriptor + @NotNull final JavaLibraryDescriptor javaLibraryDescriptor, + @NotNull final HybrisModuleDescriptor moduleDescriptor, + @NotNull final ProgressIndicator progressIndicator ) { final LibraryTable projectLibraryTable = modifiableRootModel.getModuleLibraryTable(); @@ -201,6 +222,69 @@ private void addJarFolderToModuleLibs( this.setLibraryEntryExported(modifiableRootModel, library); } setLibraryEntryScope(modifiableRootModel, library, javaLibraryDescriptor.getScope()); + + final List mavenSources = resolveMavenSources( + modifiableRootModel, + javaLibraryDescriptor, + moduleDescriptor, + progressIndicator + ); + + final List standardSources = resolveStandardProvidedSources( + javaLibraryDescriptor, + moduleDescriptor + ); + + final List resultLibs = new ArrayList<>(mavenSources); + resultLibs.addAll(standardSources); + + for (String resultLib : resultLibs) { + libraryModifiableModel.addRoot("jar://" + resultLib + "!/", OrderRootType.SOURCES); + } + } + + public static List resolveMavenSources( + final @NotNull ModifiableRootModel modifiableRootModel, + final @NotNull JavaLibraryDescriptor javaLibraryDescriptor, + final @NotNull HybrisModuleDescriptor moduleDescriptor, + final @NotNull ProgressIndicator progressIndicator + ) { + if (javaLibraryDescriptor instanceof DefaultJavaLibraryDescriptor) { + final var defaultJavaLibraryDescriptor = (DefaultJavaLibraryDescriptor) javaLibraryDescriptor; + if (LibraryDescriptorType.LIB == defaultJavaLibraryDescriptor.getDescriptorType()) { + return MavenUtils.resolveMavenSources(modifiableRootModel, moduleDescriptor, progressIndicator); + } + } + return Collections.emptyList(); + } + + public static List resolveStandardProvidedSources( + final @NotNull JavaLibraryDescriptor javaLibraryDescriptor, + final @NotNull HybrisModuleDescriptor moduleDescriptor + ) { + final HybrisApplicationSettings appSettings = HybrisApplicationSettingsComponent.getInstance().getState(); + if (!appSettings.isWithStandardProvidedSources()) { + return Collections.emptyList(); + } + + if (javaLibraryDescriptor instanceof DefaultJavaLibraryDescriptor) { + final var defaultJavaLibraryDescriptor = (DefaultJavaLibraryDescriptor) javaLibraryDescriptor; + if (LibraryDescriptorType.WEB_INF_LIB == defaultJavaLibraryDescriptor.getDescriptorType()) { + var sourcesDirectory = new File( + moduleDescriptor.getRootDirectory(), + HybrisConstants.DOC_SOURCES_JAR_DIRECTORY + ); + + final String[] filesArray = sourcesDirectory.list((file, name) -> name.endsWith("-sources.jar")); + if (filesArray == null) { + return Collections.emptyList(); + } + return Arrays.stream(filesArray) + .map(fileName -> new File(sourcesDirectory,fileName).getAbsolutePath()) + .collect(Collectors.toList()); + } + } + return Collections.emptyList(); } private void addLibsToModule( diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultMavenConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultMavenConfigurator.java index f4813e6c4..850a2bb5d 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultMavenConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultMavenConfigurator.java @@ -24,30 +24,31 @@ import com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptorType; import com.intellij.idea.plugin.hybris.project.descriptors.HybrisProjectDescriptor; import com.intellij.idea.plugin.hybris.project.descriptors.MavenModuleDescriptor; -import com.intellij.openapi.application.AccessToken; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.application.WriteAction; import com.intellij.openapi.module.ModifiableModuleModel; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleManager; import com.intellij.openapi.project.Project; +import com.intellij.openapi.roots.ui.configuration.ModulesProvider; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.maven.model.MavenConstants; -import org.jetbrains.idea.maven.model.MavenExplicitProfiles; import org.jetbrains.idea.maven.project.MavenImportListener; import org.jetbrains.idea.maven.project.MavenProject; import org.jetbrains.idea.maven.project.MavenProjectsManager; import org.jetbrains.idea.maven.wizards.MavenProjectBuilder; import java.io.File; -import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.Optional; +import java.util.function.Function; +import java.util.function.Predicate; import java.util.stream.Collectors; import static com.intellij.idea.plugin.hybris.project.utils.ModuleGroupUtils.fetchGroupMapping; @@ -57,6 +58,8 @@ */ public class DefaultMavenConfigurator implements MavenConfigurator { + private HybrisMavenImportListener mavenImportListener; + @Override public void configure( @NotNull final HybrisProjectDescriptor hybrisProjectDescriptor, @@ -64,50 +67,115 @@ public void configure( @NotNull final List mavenModules, @NotNull final ConfiguratorFactory configuratorFactory ) { - final MavenProjectBuilder mavenProjectBuilder = new MavenProjectBuilder(); - final List pomList = mavenModules + final List mavenProjectFiles = mavenModules .stream() .map(e -> new File(e.getRootDirectory(), MavenConstants.POM_XML)) .map(e -> VfsUtil.findFileByIoFile(e, true)) .collect(Collectors.toList()); - mavenProjectBuilder.setFiles(pomList); - if (!mavenProjectBuilder.setSelectedProfiles(MavenExplicitProfiles.NONE)) { - return; + final var mavenProjectBuilders = mavenProjectFiles.stream() + .map(mavenProjectBuilderFunction(project)) + .filter(isProjectPathValid(mavenModules)) + .collect(Collectors.toList()); + + if (mavenImportListener == null) { + mavenImportListener = new HybrisMavenImportListener(project); + project.getMessageBus().connect().subscribe(MavenImportListener.TOPIC, mavenImportListener); } + mavenImportListener.setMavenModulesConfig(mavenProjectFiles, mavenModules, configuratorFactory); - List selectedProjects = new ArrayList<>(); - for (MavenProject mavenProject : mavenProjectBuilder.getList()) { - final Optional isPresent = mavenModules - .stream() - .filter(e -> e.getRootDirectory().getAbsolutePath().equals(mavenProject.getDirectory())) - .findAny(); - if (isPresent.isPresent()) { - selectedProjects.add(mavenProject); + mavenProjectBuilders.forEach(builder -> { + try { + builder.commit(project, null, ModulesProvider.EMPTY_MODULES_PROVIDER); + } finally { + builder.cleanup(); } + }); + + MavenProjectsManager.getInstance(project).importProjects(); + } + + @NotNull + private Function mavenProjectBuilderFunction(final @NotNull Project project) { + return mavenProjectFile -> { + final var builder = new MavenProjectBuilder(); + builder.setUpdate(MavenProjectsManager.getInstance(project).isMavenizedProject()); + builder.setFileToImport(mavenProjectFile); + return builder; + }; + } + + @NotNull + private Predicate isProjectPathValid(final @NotNull List mavenModules) { + return builder -> { + final var path = builder.getRootPath() + .toAbsolutePath() + .toString(); + return mavenModules.stream() + .anyMatch(module -> module.getRootDirectory() + .getAbsolutePath() + .equals(path)); + }; + } + + static class HybrisMavenImportListener implements MavenImportListener { + + private final Project project; + private List pomList; + private List mavenModules; + private ConfiguratorFactory configuratorFactory; + + public HybrisMavenImportListener(final Project project) { + this.project = project; } - mavenProjectBuilder.setList(selectedProjects); - project.getMessageBus().connect().subscribe( - MavenImportListener.TOPIC, - (importedProjects, newModules) -> ApplicationManager.getApplication().invokeLater(() -> { + @Override + public void importFinished( + @NotNull final Collection importedProjects, @NotNull final List newModules + ) { + ApplicationManager.getApplication().invokeLater(() -> { if (!project.isDisposed()) { moveMavenModulesToCorrectGroup( - project, - mavenModules, - configuratorFactory, - pomList, + getProject(), + getMavenModules(), + getConfiguratorFactory(), + getPomList(), importedProjects, newModules ); } - }) - ); - mavenProjectBuilder.commit(project); - MavenProjectsManager.getInstance(project).importProjects(); + }); + } + + private void setMavenModulesConfig( + final List pomList, + final List mavenModules, + final ConfiguratorFactory configuratorFactory + ) { + this.pomList = pomList; + this.configuratorFactory = configuratorFactory; + this.mavenModules = Collections.unmodifiableList(mavenModules); + } + + + private Project getProject() { + return project; + } + + private List getPomList() { + return Collections.unmodifiableList(pomList); + } + + private List getMavenModules() { + return Collections.unmodifiableList(mavenModules); + } + + private ConfiguratorFactory getConfiguratorFactory() { + return configuratorFactory; + } } - private void moveMavenModulesToCorrectGroup( + private static void moveMavenModulesToCorrectGroup( final @NotNull Project project, final @NotNull List mavenModules, final @NotNull ConfiguratorFactory configuratorFactory, @@ -137,33 +205,39 @@ private void moveMavenModulesToCorrectGroup( ) .collect(Collectors.toList()); - Map mavenGroupMapping = fetchGroupMapping(configuratorFactory.getGroupModuleConfigurator(), mavenModules); + final Map mavenGroupMapping = fetchGroupMapping( + configuratorFactory.getGroupModuleConfigurator(), + mavenModules + ); moveMavenModulesToGroup(project, newRootModules, mavenGroupMapping); } - private void moveMavenModulesToGroup( + private static void moveMavenModulesToGroup( final @NotNull Project project, final @NotNull List mavenModules, final @NotNull Map mavenGroupMapping ) { - AccessToken token = null; - final ModifiableModuleModel modifiableModuleModel; - try { - token = ApplicationManager.getApplication().acquireReadActionLock(); - modifiableModuleModel = ModuleManager.getInstance(project).getModifiableModel(); - - for (Module module : mavenModules) { - module.setOption(HybrisConstants.DESCRIPTOR_TYPE, HybrisModuleDescriptorType.MAVEN.name()); - final String[] groupPath = modifiableModuleModel.getModuleGroupPath(module); - modifiableModuleModel.setModuleGroupPath(module, ArrayUtils.addAll(mavenGroupMapping.get(module.getName()), groupPath)); - } - } finally { - if (token != null) { - token.finish(); - } - } + final ModifiableModuleModel modifiableModuleModel = ReadAction.compute( + () -> getModifiableModuleModel(project, mavenModules, mavenGroupMapping) + ); ApplicationManager.getApplication().invokeAndWait(() -> WriteAction.run(modifiableModuleModel::commit)); } + @NotNull + private static ModifiableModuleModel getModifiableModuleModel( + final Project project, + final List mavenModules, + final Map mavenGroupMapping + ) { + final ModifiableModuleModel model = ModuleManager.getInstance(project).getModifiableModel(); + + for (Module module : mavenModules) { + module.setOption(HybrisConstants.DESCRIPTOR_TYPE, HybrisModuleDescriptorType.MAVEN.name()); + final String[] groupPath = model.getModuleGroupPath(module); + model.setModuleGroupPath(module, ArrayUtils.addAll(mavenGroupMapping.get(module.getName()), groupPath)); + } + return model; + } + } diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultSearchScopeConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultSearchScopeConfigurator.java index 15cc8cfc3..3334539b7 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultSearchScopeConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultSearchScopeConfigurator.java @@ -28,6 +28,7 @@ import com.intellij.psi.search.scope.packageSet.FilePatternPackageSet; import com.intellij.psi.search.scope.packageSet.NamedScope; import com.intellij.psi.search.scope.packageSet.NamedScopeManager; +import com.intellij.psi.search.scope.packageSet.PackageSet; import com.intellij.psi.search.scope.packageSet.UnionPackageSet; import com.intellij.util.ArrayUtil; import org.jetbrains.annotations.NotNull; @@ -112,7 +113,7 @@ public static FilePatternPackageSet createCustomTSFilesPattern() { } @NotNull - public static UnionPackageSet createCustomTsImpexBeansFilesPattern() { + public static PackageSet createCustomTsImpexBeansFilesPattern() { final String customGroupName = HybrisApplicationSettingsComponent.getInstance().getState().getGroupCustom(); final FilePatternPackageSet tsFilePatternPackageSet = new FilePatternPackageSet( SEARCH_SCOPE_GROUP_PREFIX + customGroupName, @@ -126,11 +127,9 @@ public static UnionPackageSet createCustomTsImpexBeansFilesPattern() { SEARCH_SCOPE_GROUP_PREFIX + customGroupName, "*//*.impex" ); - - return new UnionPackageSet( - new UnionPackageSet(tsFilePatternPackageSet, beansFilePatternPackageSet), - impexFilePatternPackageSet - ); + return UnionPackageSet.create( + UnionPackageSet.create(tsFilePatternPackageSet, beansFilePatternPackageSet), + impexFilePatternPackageSet); } private static void addOrReplaceScopes(@NotNull Project project, @NotNull List newScopes) { @@ -179,7 +178,7 @@ private static NamedScope createScopeFor2Groups(@NotNull final String firstGroup SEARCH_SCOPE_GROUP_PREFIX + secondGroupName, "*//*" ); - final UnionPackageSet unionPackageSet = new UnionPackageSet( + final PackageSet unionPackageSet = UnionPackageSet.create( firstFilePatternPackageSet, secondFilePatternPackageSet ); diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultSpringConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultSpringConfigurator.java index 41708c79c..2199740f8 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultSpringConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultSpringConfigurator.java @@ -43,11 +43,14 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; +import java.util.ArrayList; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Properties; +import java.util.Set; import java.util.stream.Collectors; import static com.intellij.openapi.util.io.FileUtilRt.toSystemDependentName; @@ -119,7 +122,10 @@ private void configureFacetDependencies( return; } - for (HybrisModuleDescriptor dependsOnModule : moduleDescriptor.getDependenciesTree()) { + final Set dependenciesTree = moduleDescriptor.getDependenciesTree(); + final List sortedDependenciesTree = dependenciesTree.stream().sorted().collect( + Collectors.toList()); + for (HybrisModuleDescriptor dependsOnModule : sortedDependenciesTree) { final SpringFileSet parentFileSet = getSpringFileSet(modifiableFacetModelMap, dependsOnModule.getName()); if (parentFileSet == null) { continue; diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/MavenUtils.java b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/MavenUtils.java new file mode 100644 index 000000000..6dbb14c95 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/MavenUtils.java @@ -0,0 +1,183 @@ +/* + * 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.project.configurators.impl; + +import com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptor; +import com.intellij.idea.plugin.hybris.settings.HybrisApplicationSettings; +import com.intellij.idea.plugin.hybris.settings.HybrisApplicationSettingsComponent; +import com.intellij.openapi.progress.ProgressIndicator; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.roots.ModifiableRootModel; +import com.intellij.openapi.vfs.VfsUtil; +import com.intellij.openapi.vfs.VirtualFile; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.idea.maven.model.MavenArtifact; +import org.jetbrains.idea.maven.model.MavenExplicitProfiles; +import org.jetbrains.idea.maven.model.MavenId; +import org.jetbrains.idea.maven.project.MavenArtifactDownloader; +import org.jetbrains.idea.maven.project.MavenEmbeddersManager; +import org.jetbrains.idea.maven.project.MavenGeneralSettings; +import org.jetbrains.idea.maven.project.MavenProjectReader; +import org.jetbrains.idea.maven.project.MavenProjectReaderProjectLocator; +import org.jetbrains.idea.maven.project.MavenProjectReaderResult; +import org.jetbrains.idea.maven.project.MavenProjectsManager; +import org.jetbrains.idea.maven.project.MavenProjectsTree; +import org.jetbrains.idea.maven.project.MavenWorkspaceSettings; +import org.jetbrains.idea.maven.project.MavenWorkspaceSettingsComponent; +import org.jetbrains.idea.maven.server.MavenEmbedderWrapper; +import org.jetbrains.idea.maven.utils.MavenArtifactUtil; +import org.jetbrains.idea.maven.utils.MavenProcessCanceledException; +import org.jetbrains.idea.maven.utils.MavenProgressIndicator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +public interface MavenUtils { + + Logger LOG = LoggerFactory.getLogger(MavenUtils.class); + + @NotNull + static List resolveMavenJavadocs( + final @NotNull ModifiableRootModel modifiableRootModel, + final @NotNull HybrisModuleDescriptor moduleDescriptor, + final @NotNull ProgressIndicator progressIndicator + ) { + final HybrisApplicationSettings appSettings = HybrisApplicationSettingsComponent.getInstance().getState(); + if (appSettings.isWithMavenJavadocs()) { + return resolveMavenDependencies(modifiableRootModel, moduleDescriptor, progressIndicator, false, true); + } + return Collections.emptyList(); + } + + static List resolveMavenSources( + final @NotNull ModifiableRootModel modifiableRootModel, + final @NotNull HybrisModuleDescriptor moduleDescriptor, + final @NotNull ProgressIndicator progressIndicator + ) { + final HybrisApplicationSettings appSettings = HybrisApplicationSettingsComponent.getInstance().getState(); + if (appSettings.isWithMavenSources()) { + return resolveMavenDependencies(modifiableRootModel, moduleDescriptor, progressIndicator, true, false); + } + return Collections.emptyList(); + } + + @NotNull + private static List resolveMavenDependencies( + final @NotNull ModifiableRootModel modifiableRootModel, + final @NotNull HybrisModuleDescriptor moduleDescriptor, + final @NotNull ProgressIndicator progressIndicator, final boolean downloadSources, final boolean downloadDocs + ) { + final List resultPathList = new ArrayList<>(); + + final File moduleDir = moduleDescriptor.getRootDirectory(); + final File mavenDescriptorFile = new File(moduleDir, "external-dependencies.xml"); + if (mavenDescriptorFile.exists()) { + final MavenProjectReader mavenProjectReader = new MavenProjectReader(modifiableRootModel.getProject()); + final VirtualFile vfsMavenDescriptor = VfsUtil.findFileByIoFile(mavenDescriptorFile, false); + + final @NotNull Project project = modifiableRootModel.getProject(); + final MavenWorkspaceSettings settings = MavenWorkspaceSettingsComponent.getInstance(project).getSettings(); + + final String moduleDirPath = moduleDir.getAbsolutePath(); + final MavenEmbeddersManager embeddersManager = new MavenEmbeddersManager(project); + final MavenEmbedderWrapper embedder = embeddersManager.getEmbedder( + MavenEmbeddersManager.FOR_DEPENDENCIES_RESOLVE, + moduleDirPath, + moduleDirPath + ); + final MavenGeneralSettings generalSettings = settings.generalSettings; + generalSettings.setNonRecursive(true); + + final MavenProjectsTree mavenProjectsTree = new MavenProjectsTree(project); + final MavenProjectReaderProjectLocator myProjectLocator = mavenProjectsTree.getProjectLocator(); + + try { + final Collection mavenProjects = mavenProjectReader.resolveProject( + generalSettings, + embedder, + Collections.singleton(vfsMavenDescriptor), + MavenExplicitProfiles.NONE, + myProjectLocator + ); + + for (MavenProjectReaderResult mavenProjectReaderResult : mavenProjects) { + final MavenProjectsManager manager = MavenProjectsManager.getInstance(project); + + final MavenProgressIndicator indicator = new MavenProgressIndicator(project, manager::getSyncConsole); + indicator.setIndicator(progressIndicator); + final List dependencies = mavenProjectReaderResult.mavenModel.getDependencies(); + + mavenProjectsTree.resetManagedFilesAndProfiles( + Collections.singletonList(vfsMavenDescriptor), + MavenExplicitProfiles.NONE + ); + mavenProjectsTree.updateAll(false, generalSettings, indicator); + + mavenProjectsTree.getProjects().get(0).getDependencies().addAll(dependencies); + final MavenArtifactDownloader.DownloadResult downloadResult = MavenArtifactDownloader.download( + project, + mavenProjectsTree, + mavenProjectsTree.getProjects(), + dependencies, + downloadSources, + downloadDocs, + embedder, + indicator + ); + if (downloadDocs) { + for (final MavenId resolvedDoc : downloadResult.resolvedDocs) { + final File libFile = getArtifactLib(manager, resolvedDoc); + final String resultJarPath = libFile.getAbsolutePath().replace(".jar", "-javadoc.jar"); + resultPathList.add(resultJarPath); + } + } + if (downloadSources) { + for (final MavenId resolvedDoc : downloadResult.resolvedSources) { + final File libFile = getArtifactLib(manager, resolvedDoc); + final String resultJarPath = libFile.getAbsolutePath().replace(".jar", "-sources.jar"); + resultPathList.add(resultJarPath); + } + } + } + + } catch (MavenProcessCanceledException e) { + LOG.error("Unable to generate pseudo-maven dependencies", e); + } + resultPathList.sort(String::compareTo); + } + return resultPathList; + } + + @NotNull + static File getArtifactLib(final MavenProjectsManager manager, final MavenId resolvedDoc) { + return MavenArtifactUtil + .getArtifactFile( + manager.getLocalRepository(), + resolvedDoc.getGroupId(), + resolvedDoc.getArtifactId(), + resolvedDoc.getVersion(), + "jar" + ); + } +} diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/RegularContentRootConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/RegularContentRootConfigurator.java index 9f0c430ac..bb8891420 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/RegularContentRootConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/RegularContentRootConfigurator.java @@ -64,7 +64,7 @@ import static com.intellij.idea.plugin.hybris.common.HybrisConstants.PLATFORM_TOMCAT_DIRECTORY; import static com.intellij.idea.plugin.hybris.common.HybrisConstants.RESOURCES_DIRECTORY; import static com.intellij.idea.plugin.hybris.common.HybrisConstants.SETTINGS_DIRECTORY; -import static com.intellij.idea.plugin.hybris.common.HybrisConstants.SRC_DIRECTORY; +import static com.intellij.idea.plugin.hybris.common.HybrisConstants.SRC_DIR_NAMES; import static com.intellij.idea.plugin.hybris.common.HybrisConstants.TEST_CLASSES_DIRECTORY; import static com.intellij.idea.plugin.hybris.common.HybrisConstants.TEST_SRC_DIR_NAMES; import static com.intellij.idea.plugin.hybris.common.HybrisConstants.WEB_INF_CLASSES_DIRECTORY; @@ -140,12 +140,14 @@ protected void configureCommonRoots( Validate.notNull(moduleDescriptor); Validate.notNull(contentEntry); - addSourceFolderIfNotIgnored( - contentEntry, - new File(moduleDescriptor.getRootDirectory(), SRC_DIRECTORY), - JavaSourceRootType.SOURCE, - dirsToIgnore - ); + for (String srcDirName : SRC_DIR_NAMES) { + addSourceFolderIfNotIgnored( + contentEntry, + new File(moduleDescriptor.getRootDirectory(), srcDirName), + JavaSourceRootType.SOURCE, + dirsToIgnore + ); + } addSourceFolderIfNotIgnored( contentEntry, @@ -233,11 +235,13 @@ protected void configureAdditionalRoots( return; } - final File additionalSrcDirectory = new File(additionalModuleDirectory, SRC_DIRECTORY); - contentEntry.addSourceFolder( - VfsUtil.pathToUrl(additionalSrcDirectory.getAbsolutePath()), - JavaSourceRootType.SOURCE - ); + for (String srcDirName : SRC_DIR_NAMES) { + final File additionalSrcDirectory = new File(additionalModuleDirectory, srcDirName); + contentEntry.addSourceFolder( + VfsUtil.pathToUrl(additionalSrcDirectory.getAbsolutePath()), + JavaSourceRootType.SOURCE + ); + } final File additionalResourcesDirectory = new File(additionalModuleDirectory, RESOURCES_DIRECTORY); contentEntry.addSourceFolder( @@ -299,11 +303,13 @@ protected void configureBackOfficeRoots( moduleDescriptor.getRootDirectory(), BACK_OFFICE_MODULE_DIRECTORY ); - final File backOfficeSrcDirectory = new File(backOfficeModuleDirectory, SRC_DIRECTORY); - contentEntry.addSourceFolder( - VfsUtil.pathToUrl(backOfficeSrcDirectory.getAbsolutePath()), - JavaSourceRootType.SOURCE - ); + for (String srcDirName : SRC_DIR_NAMES) { + final File backOfficeSrcDirectory = new File(backOfficeModuleDirectory, srcDirName); + contentEntry.addSourceFolder( + VfsUtil.pathToUrl(backOfficeSrcDirectory.getAbsolutePath()), + JavaSourceRootType.SOURCE + ); + } if (moduleDescriptor instanceof CustomHybrisModuleDescriptor || !moduleDescriptor.getRootProjectDescriptor() .isExcludeTestSources()) { @@ -343,6 +349,8 @@ protected void configurePlatformRoots( } excludeDirectory(contentEntry, new File(platformBootstrapDirectory, PLATFORM_MODEL_CLASSES_DIRECTORY)); + excludeDirectory(contentEntry, new File(platformBootstrapDirectory, GEN_SRC_DIRECTORY)); + File tomcat6 = new File(rootDirectory, PLATFORM_TOMCAT_6_DIRECTORY); if (tomcat6.exists()) { excludeDirectory(contentEntry, tomcat6); @@ -360,11 +368,13 @@ protected void configureWebModuleRoots( ) { Validate.notNull(moduleDescriptor); - final File webSrcDirectory = new File(webModuleDirectory, SRC_DIRECTORY); - contentEntry.addSourceFolder( - VfsUtil.pathToUrl(webSrcDirectory.getAbsolutePath()), - JavaSourceRootType.SOURCE - ); + for (String srcDirName : SRC_DIR_NAMES) { + final File webSrcDirectory = new File(webModuleDirectory, srcDirName); + contentEntry.addSourceFolder( + VfsUtil.pathToUrl(webSrcDirectory.getAbsolutePath()), + JavaSourceRootType.SOURCE + ); + } final File webGenSrcDirectory = new File(webModuleDirectory, GEN_SRC_DIRECTORY); contentEntry.addSourceFolder( @@ -466,9 +476,13 @@ protected void configureWebInf( excludeDirectory(contentEntry, new File(rootDirectory, WEB_INF_CLASSES_DIRECTORY)); } else if ( !moduleDescriptor.getRootProjectDescriptor().isImportOotbModulesInReadOnlyMode() && - new File(webModuleDirectory, SRC_DIRECTORY).exists() + srcDirectoriesExists(webModuleDirectory) ) { excludeDirectory(contentEntry, new File(rootDirectory, WEB_INF_CLASSES_DIRECTORY)); } } + + private boolean srcDirectoriesExists(final File webModuleDirectory) { + return TEST_SRC_DIR_NAMES.stream().anyMatch(s -> new File(webModuleDirectory, s).exists()); + } } diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/WebFacetConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/WebFacetConfigurator.java index 76090eb7e..2897da86d 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/WebFacetConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/WebFacetConfigurator.java @@ -28,6 +28,7 @@ import com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptor; import com.intellij.javaee.DeploymentDescriptorsConstants; import com.intellij.javaee.web.facet.WebFacet; +import com.intellij.openapi.application.WriteAction; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleType; import com.intellij.openapi.roots.ModifiableRootModel; @@ -81,10 +82,15 @@ public void configure( DeploymentDescriptorsConstants.WEB_XML_META_DATA ); } + writeFacetData(moduleDescriptor, modifiableRootModel, webRoot, webFacet); + } - webFacet.setWebSourceRoots(modifiableRootModel.getSourceRootUrls(false)); - webFacet.addWebRootNoFire(VfsUtil.pathToUrl(FileUtil.toSystemIndependentName(webRoot.getAbsolutePath())), "/"); - this.setupFacetDeploymentDescriptor(webFacet, moduleDescriptor); + private void writeFacetData(HybrisModuleDescriptor moduleDescriptor, ModifiableRootModel modifiableRootModel, File webRoot, WebFacet webFacet) { + WriteAction.runAndWait(() -> { + webFacet.setWebSourceRoots(modifiableRootModel.getSourceRootUrls(false)); + webFacet.addWebRootNoFire(VfsUtil.pathToUrl(FileUtil.toSystemIndependentName(webRoot.getAbsolutePath())), "/"); + setupFacetDeploymentDescriptor(webFacet, moduleDescriptor); + }); } private void setupFacetDeploymentDescriptor( diff --git a/src/com/intellij/idea/plugin/hybris/project/descriptors/AbstractHybrisModuleDescriptor.java b/src/com/intellij/idea/plugin/hybris/project/descriptors/AbstractHybrisModuleDescriptor.java index 688e4d4de..95fc93fd8 100644 --- a/src/com/intellij/idea/plugin/hybris/project/descriptors/AbstractHybrisModuleDescriptor.java +++ b/src/com/intellij/idea/plugin/hybris/project/descriptors/AbstractHybrisModuleDescriptor.java @@ -32,6 +32,7 @@ import java.io.File; import java.util.Collections; import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.Set; import java.util.TreeSet; @@ -47,9 +48,9 @@ public abstract class AbstractHybrisModuleDescriptor implements HybrisModuleDesc @NotNull protected final HybrisProjectDescriptor rootProjectDescriptor; @NotNull - protected final Set dependenciesTree = new HashSet(0); + protected final Set dependenciesTree = new LinkedHashSet<>(0); @NotNull - protected Set springFileSet = new HashSet(); + protected Set springFileSet = new LinkedHashSet<>(); private boolean inLocalExtensions; private IMPORT_STATUS importStatus = IMPORT_STATUS.UNUSED; diff --git a/src/com/intellij/idea/plugin/hybris/project/descriptors/DefaultHybrisProjectDescriptor.java b/src/com/intellij/idea/plugin/hybris/project/descriptors/DefaultHybrisProjectDescriptor.java index c37533396..9d8307490 100644 --- a/src/com/intellij/idea/plugin/hybris/project/descriptors/DefaultHybrisProjectDescriptor.java +++ b/src/com/intellij/idea/plugin/hybris/project/descriptors/DefaultHybrisProjectDescriptor.java @@ -60,6 +60,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Properties; @@ -67,6 +68,7 @@ import java.util.TreeSet; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; +import java.util.stream.Collectors; import static com.intellij.idea.plugin.hybris.common.utils.CollectionUtils.emptyIfNull; import static com.intellij.idea.plugin.hybris.project.descriptors.DefaultHybrisProjectDescriptor.DIRECTORY_TYPE.HYBRIS; @@ -110,6 +112,9 @@ public class DefaultHybrisProjectDescriptor implements HybrisProjectDescriptor { protected File externalConfigDirectory; @Nullable protected File externalDbDriversDirectory; + private boolean withMavenSources; + private boolean withStandardProvidedSources; + private boolean withMavenJavadocs; @Nullable protected String javadocUrl; @Nullable @@ -145,7 +150,7 @@ private void preselectModules(@NotNull final ConfigHybrisModuleDescriptor config } if (hybrisModuleDescriptor instanceof PlatformHybrisModuleDescriptor) { PlatformHybrisModuleDescriptor platformDescriptor = (PlatformHybrisModuleDescriptor) hybrisModuleDescriptor; - Set dependenciesTree = Sets.newHashSet(platformDescriptor.getDependenciesTree()); + Set dependenciesTree = Sets.newLinkedHashSet(platformDescriptor.getDependenciesTree()); dependenciesTree.add(configHybrisModuleDescriptor); platformDescriptor.setDependenciesTree(dependenciesTree); } @@ -165,8 +170,8 @@ private void preselectConfigModules( foundModules .stream() .filter(e -> e instanceof ConfigHybrisModuleDescriptor) - .map(e -> (ConfigHybrisModuleDescriptor)e) - .forEach(e->{ + .map(e -> (ConfigHybrisModuleDescriptor) e) + .forEach(e -> { if (!preselectedNames.contains(e.getName())) { e.setPreselected(true); preselectedNames.add(e.getName()); @@ -371,7 +376,11 @@ protected void scanDirectoryForHybrisModules( LOG.info("Scanning for hybris modules out of the project"); this.findModuleRoots(moduleRootMap, false, hybrisDistributionDirectory, progressListenerProcessor); } - Set moduleRootDirectories = processDirectoriesByTypePriority(moduleRootMap, isScanThroughExternalModule(), progressListenerProcessor); + Set moduleRootDirectories = processDirectoriesByTypePriority( + moduleRootMap, + isScanThroughExternalModule(), + progressListenerProcessor + ); final List moduleDescriptors = new ArrayList<>(); final List pathsFailedToImport = new ArrayList<>(); @@ -416,7 +425,7 @@ private Set processDirectoriesByTypePriority( ) throws InterruptedException, IOException { final Map moduleRootDirectories = new HashMap<>(); - moduleRootMap.get(HYBRIS).forEach(file-> addIfNotExists(moduleRootDirectories, file)); + moduleRootMap.get(HYBRIS).forEach(file -> addIfNotExists(moduleRootDirectories, file)); if (scanThroughExternalModule) { LOG.info("Scanning for higher priority modules"); @@ -466,7 +475,7 @@ private void addIfNotExists(final Map moduleRootDirectories, final } } } catch (IOException e) { - LOG.error("Unable to locate "+file.getAbsolutePath()); + LOG.error("Unable to locate " + file.getAbsolutePath()); } } @@ -564,7 +573,12 @@ private void findModuleRoots( } } - scanSubrirectories(moduleRootMap, acceptOnlyHybrisModules, rootProjectDirectory.toPath(), progressListenerProcessor); + scanSubrirectories( + moduleRootMap, + acceptOnlyHybrisModules, + rootProjectDirectory.toPath(), + progressListenerProcessor + ); } @@ -630,13 +644,16 @@ protected void buildDependencies(@NotNull final Iterable for (HybrisModuleDescriptor moduleDescriptor : moduleDescriptors) { - final Set requiredExtensionNames = moduleDescriptor.getRequiredExtensionNames(); + Set requiredExtensionNames = moduleDescriptor.getRequiredExtensionNames(); if (isEmpty(requiredExtensionNames)) { continue; } + requiredExtensionNames = requiredExtensionNames.stream() + .sorted() + .collect(Collectors.toCollection(LinkedHashSet::new)); - final Set dependencies = new HashSet( + final Set dependencies = new LinkedHashSet<>( requiredExtensionNames.size() ); @@ -902,6 +919,36 @@ public void setExternalDbDriversDirectory(@Nullable final File externalDbDrivers this.externalDbDriversDirectory = externalDbDriversDirectory; } + @Override + public boolean isWithMavenSources() { + return withMavenSources; + } + + @Override + public void setWithMavenSources(final boolean withMavenSources) { + this.withMavenSources = withMavenSources; + } + + @Override + public boolean isWithStandardProvidedSources() { + return withStandardProvidedSources; + } + + @Override + public void setWithStandardProvidedSources(final boolean withStandardProvidedSources) { + this.withStandardProvidedSources = withStandardProvidedSources; + } + + @Override + public boolean isWithMavenJavadocs() { + return withMavenJavadocs; + } + + @Override + public void setWithMavenJavadocs(final boolean withMavenJavadocs) { + this.withMavenJavadocs = withMavenJavadocs; + } + @Nullable @Override public String getJavadocUrl() { diff --git a/src/com/intellij/idea/plugin/hybris/project/descriptors/DefaultJavaLibraryDescriptor.java b/src/com/intellij/idea/plugin/hybris/project/descriptors/DefaultJavaLibraryDescriptor.java index 4b8532616..c4375ceb3 100644 --- a/src/com/intellij/idea/plugin/hybris/project/descriptors/DefaultJavaLibraryDescriptor.java +++ b/src/com/intellij/idea/plugin/hybris/project/descriptors/DefaultJavaLibraryDescriptor.java @@ -18,6 +18,7 @@ package com.intellij.idea.plugin.hybris.project.descriptors; +import com.intellij.idea.plugin.hybris.common.LibraryDescriptorType; import com.intellij.openapi.roots.DependencyScope; import com.intellij.openapi.util.io.FileUtil; import org.apache.commons.lang3.Validate; @@ -40,6 +41,8 @@ public class DefaultJavaLibraryDescriptor implements JavaLibraryDescriptor { private final File sourcesFile; private final boolean isExported; private final boolean isDirectoryWithClasses; + private final LibraryDescriptorType descriptorType; + @NotNull private final DependencyScope scope; @@ -54,6 +57,22 @@ public DefaultJavaLibraryDescriptor( this.isExported = isExported; this.isDirectoryWithClasses = false; this.scope = DependencyScope.COMPILE; + this.descriptorType = LibraryDescriptorType.UNKNOWN; + } + + public DefaultJavaLibraryDescriptor( + @NotNull final File libraryFile, + final boolean isExported, + final LibraryDescriptorType descriptorType + ) { + Validate.notNull(libraryFile); + + this.libraryFile = libraryFile; + this.sourcesFile = null; + this.isExported = isExported; + this.isDirectoryWithClasses = false; + this.scope = DependencyScope.COMPILE; + this.descriptorType = descriptorType; } public DefaultJavaLibraryDescriptor( @@ -69,6 +88,7 @@ public DefaultJavaLibraryDescriptor( this.isExported = isExported; this.isDirectoryWithClasses = false; this.scope = DependencyScope.COMPILE; + descriptorType = LibraryDescriptorType.UNKNOWN; } public DefaultJavaLibraryDescriptor( @@ -83,6 +103,7 @@ public DefaultJavaLibraryDescriptor( this.isExported = isExported; this.isDirectoryWithClasses = isDirectoryWithClasses; this.scope = DependencyScope.COMPILE; + descriptorType = LibraryDescriptorType.UNKNOWN; } public DefaultJavaLibraryDescriptor( @@ -98,6 +119,7 @@ public DefaultJavaLibraryDescriptor( this.isExported = isExported; this.isDirectoryWithClasses = isDirectoryWithClasses; this.scope = DependencyScope.COMPILE; + descriptorType = LibraryDescriptorType.UNKNOWN; } @NotNull @@ -138,6 +160,10 @@ public int compareTo(@NotNull final JavaLibraryDescriptor o) { return FileUtil.compareFiles(this.libraryFile, o.getLibraryFile()); } + public LibraryDescriptorType getDescriptorType() { + return descriptorType; + } + @Override public int hashCode() { return new HashCodeBuilder(17, 37) diff --git a/common/src/com/intellij/idea/plugin/hybris/project/descriptors/HybrisModuleDescriptorType.java b/src/com/intellij/idea/plugin/hybris/project/descriptors/HybrisModuleDescriptorType.java similarity index 100% rename from common/src/com/intellij/idea/plugin/hybris/project/descriptors/HybrisModuleDescriptorType.java rename to src/com/intellij/idea/plugin/hybris/project/descriptors/HybrisModuleDescriptorType.java diff --git a/src/com/intellij/idea/plugin/hybris/project/descriptors/HybrisProjectDescriptor.java b/src/com/intellij/idea/plugin/hybris/project/descriptors/HybrisProjectDescriptor.java index e1575389a..31a457acc 100644 --- a/src/com/intellij/idea/plugin/hybris/project/descriptors/HybrisProjectDescriptor.java +++ b/src/com/intellij/idea/plugin/hybris/project/descriptors/HybrisProjectDescriptor.java @@ -135,4 +135,16 @@ void setRootDirectoryAndScanForModules( String getHybrisVersion(); Set getDetectedVcs(); + + boolean isWithMavenSources(); + + void setWithMavenSources(boolean withMavenSources); + + boolean isWithStandardProvidedSources(); + + void setWithStandardProvidedSources(boolean withStandardProvidedSources); + + boolean isWithMavenJavadocs(); + + void setWithMavenJavadocs(boolean withMavenJavadocs); } diff --git a/src/com/intellij/idea/plugin/hybris/project/descriptors/RegularHybrisModuleDescriptor.java b/src/com/intellij/idea/plugin/hybris/project/descriptors/RegularHybrisModuleDescriptor.java index f7ec5a120..57a518bc3 100644 --- a/src/com/intellij/idea/plugin/hybris/project/descriptors/RegularHybrisModuleDescriptor.java +++ b/src/com/intellij/idea/plugin/hybris/project/descriptors/RegularHybrisModuleDescriptor.java @@ -20,6 +20,7 @@ import com.google.common.collect.Sets; import com.intellij.idea.plugin.hybris.common.HybrisConstants; +import com.intellij.idea.plugin.hybris.common.LibraryDescriptorType; import com.intellij.idea.plugin.hybris.common.services.CommonIdeaService; import com.intellij.idea.plugin.hybris.project.exceptions.HybrisConfigurationException; import com.intellij.idea.plugin.hybris.project.settings.jaxb.extensioninfo.ExtensionInfo; @@ -219,11 +220,13 @@ public List getLibraryDescriptors() { false, true )); - libs.add(new DefaultJavaLibraryDescriptor( - new File(this.getRootDirectory(), HybrisConstants.JAVA_COMPILER_OUTPUT_PATH), - new File(this.getRootDirectory(), HybrisConstants.SRC_DIRECTORY), - true, true - )); + for (String srcDirName : HybrisConstants.SRC_DIR_NAMES) { + libs.add(new DefaultJavaLibraryDescriptor( + new File(this.getRootDirectory(), HybrisConstants.JAVA_COMPILER_OUTPUT_PATH), + new File(this.getRootDirectory(), srcDirName), + true, true + )); + } libs.add(new DefaultJavaLibraryDescriptor( new File(this.getRootDirectory(), HybrisConstants.RESOURCES_DIRECTORY), @@ -263,12 +266,14 @@ public List getLibraryDescriptors() { libs.add(new DefaultJavaLibraryDescriptor( new File(this.getRootDirectory(), HybrisConstants.LIB_DIRECTORY), - true + true, + LibraryDescriptorType.LIB )); libs.add(new DefaultJavaLibraryDescriptor( new File(this.getRootDirectory(), HybrisConstants.WEB_WEBINF_LIB_DIRECTORY), - false + false, + LibraryDescriptorType.WEB_INF_LIB )); libs.add(new DefaultJavaLibraryDescriptor( @@ -337,9 +342,11 @@ private void addServerJar(final List libs) { if (serverJars == null || serverJars.length == 0) { return; } - final File srcDir = new File(this.getRootDirectory(), HybrisConstants.SRC_DIRECTORY); - for (File serverJar: serverJars) { - libs.add(new DefaultJavaLibraryDescriptor(serverJar, srcDir.isDirectory() ? srcDir : null, true, true)); + for (String srcDirName : HybrisConstants.SRC_DIR_NAMES) { + final File srcDir = new File(this.getRootDirectory(), srcDirName); + for (File serverJar : serverJars) { + libs.add(new DefaultJavaLibraryDescriptor(serverJar, srcDir.isDirectory() ? srcDir : null, true, true)); + } } } diff --git a/src/com/intellij/idea/plugin/hybris/project/providers/HybrisWritingAccessProvider.java b/src/com/intellij/idea/plugin/hybris/project/providers/HybrisWritingAccessProvider.java index 042160059..3f5beb5e3 100644 --- a/src/com/intellij/idea/plugin/hybris/project/providers/HybrisWritingAccessProvider.java +++ b/src/com/intellij/idea/plugin/hybris/project/providers/HybrisWritingAccessProvider.java @@ -51,11 +51,11 @@ public class HybrisWritingAccessProvider extends WritingAccessProvider { @NotNull public static HybrisWritingAccessProvider getInstance(@NotNull final Project project) { - return Arrays.stream(Extensions.getExtensions(EP_NAME, project)) - .map(o -> ObjectUtils.tryCast(o, HybrisWritingAccessProvider.class)) - .filter(Objects::nonNull) - .findAny() - .orElseThrow(IllegalStateException::new); + return EP.getExtensions(project).stream() + .map(o -> ObjectUtils.tryCast(o, HybrisWritingAccessProvider.class)) + .filter(Objects::nonNull) + .findAny() + .orElseThrow(IllegalStateException::new); } public HybrisWritingAccessProvider(@NotNull final Project project) { diff --git a/src/com/intellij/idea/plugin/hybris/project/tasks/ImportProjectProgressModalWindow.java b/src/com/intellij/idea/plugin/hybris/project/tasks/ImportProjectProgressModalWindow.java index f3654bfa2..a430eb6e6 100644 --- a/src/com/intellij/idea/plugin/hybris/project/tasks/ImportProjectProgressModalWindow.java +++ b/src/com/intellij/idea/plugin/hybris/project/tasks/ImportProjectProgressModalWindow.java @@ -77,7 +77,6 @@ import com.intellij.openapi.progress.Task; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.JavaSdkVersion; -import com.intellij.openapi.projectRoots.JdkVersionUtil; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.roots.LanguageLevelProjectExtension; import com.intellij.openapi.roots.ModifiableRootModel; @@ -227,7 +226,7 @@ public synchronized void run(@NotNull final ProgressIndicator indicator) { modifiableRootModel.inheritSdk(); indicator.setText2(HybrisI18NBundleUtils.message("hybris.project.import.module.libs")); - libRootsConfigurator.configure(modifiableRootModel, moduleDescriptor, modifiableModelsProvider); + libRootsConfigurator.configure(modifiableRootModel, moduleDescriptor, modifiableModelsProvider, indicator); indicator.setText2(HybrisI18NBundleUtils.message("hybris.project.import.module.content")); if (shouldBeTreatedAsReadOnly(moduleDescriptor)) { @@ -238,7 +237,7 @@ public synchronized void run(@NotNull final ProgressIndicator indicator) { indicator.setText2(HybrisI18NBundleUtils.message("hybris.project.import.module.outputpath")); compilerOutputPathsConfigurator.configure(modifiableRootModel, moduleDescriptor); indicator.setText2(HybrisI18NBundleUtils.message("hybris.project.import.module.javadoc")); - javadocModuleConfigurator.configure(modifiableRootModel, moduleDescriptor); + javadocModuleConfigurator.configure(modifiableRootModel, moduleDescriptor,indicator); indicator.setText2(HybrisI18NBundleUtils.message("hybris.project.import.module.groups")); groupModuleConfigurator.configure(rootProjectModifiableModel, javaModule, moduleDescriptor); @@ -378,10 +377,10 @@ private void selectSdk(@NotNull final Project project) { } if (StringUtils.isNotBlank(projectSdk.getVersionString())) { - final JavaSdkVersion sdkVersion = JdkVersionUtil.getVersion(projectSdk.getVersionString()); + final JavaSdkVersion sdkVersion = JavaSdkVersion.fromVersionString(projectSdk.getVersionString()); final LanguageLevelProjectExtension languageLevelExt = LanguageLevelProjectExtension.getInstance(project); - if (sdkVersion.getMaxLanguageLevel() != languageLevelExt.getLanguageLevel()) { + if (sdkVersion != null && sdkVersion.getMaxLanguageLevel() != languageLevelExt.getLanguageLevel()) { languageLevelExt.setLanguageLevel(sdkVersion.getMaxLanguageLevel()); } } @@ -432,6 +431,10 @@ private void saveImportedSettings(final Project project) { appSettings.setExternalDbDriversDirectory(""); } + appSettings.setWithMavenSources(hybrisProjectDescriptor.isWithMavenSources()); + appSettings.setWithMavenJavadocs(hybrisProjectDescriptor.isWithMavenJavadocs()); + appSettings.setWithStandardProvidedSources(hybrisProjectDescriptor.isWithStandardProvidedSources()); + hybrisProjectSettings.setCreateBackwardCyclicDependenciesForAddOns(hybrisProjectDescriptor.isCreateBackwardCyclicDependenciesForAddOn()); final File sourceCodeFile = hybrisProjectDescriptor.getSourceCodeFile(); @@ -461,11 +464,8 @@ private void saveImportedSettings(final Project project) { CommonIdeaService.getInstance().fixRemoteConnectionSettings(project); StartupManager.getInstance(project).runWhenProjectIsInitialized(() -> { - final ToolWindowManager manager = ToolWindowManager.getInstance(project); - final ToolWindow window = manager.getToolWindow("Hybris"); project.getMessageBus().syncPublisher(HybrisDeveloperSpecificProjectSettingsListener.TOPIC).hacConnectionSettingsChanged(); project.getMessageBus().syncPublisher(HybrisDeveloperSpecificProjectSettingsListener.TOPIC).solrConnectionSettingsChanged(); - window.show(null); }); } diff --git a/src/com/intellij/idea/plugin/hybris/project/wizard/CheckRequiredPluginsStep.java b/src/com/intellij/idea/plugin/hybris/project/wizard/CheckRequiredPluginsStep.java index e5d3448e0..957c4b187 100644 --- a/src/com/intellij/idea/plugin/hybris/project/wizard/CheckRequiredPluginsStep.java +++ b/src/com/intellij/idea/plugin/hybris/project/wizard/CheckRequiredPluginsStep.java @@ -18,8 +18,7 @@ package com.intellij.idea.plugin.hybris.project.wizard; -import com.intellij.ide.plugins.IdeaPluginDescriptor; -import com.intellij.ide.plugins.PluginManager; +import com.intellij.ide.plugins.*; import com.intellij.ide.util.projectWizard.WizardContext; import com.intellij.idea.plugin.hybris.common.HybrisConstants; import com.intellij.openapi.application.ApplicationManager; @@ -27,6 +26,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.extensions.PluginId; import com.intellij.projectImport.ProjectImportWizardStep; +import com.intellij.ui.components.JBList; import com.intellij.util.PlatformUtils; import javax.swing.*; @@ -90,7 +90,7 @@ public boolean isStepVisible() { } private void checkDependentPlugins() { - final IdeaPluginDescriptor hybrisPlugin = PluginManager.getPlugin(PluginId.getId(HybrisConstants.PLUGIN_ID)); + final IdeaPluginDescriptor hybrisPlugin = PluginManagerCore.getPlugin(PluginId.getId(HybrisConstants.PLUGIN_ID)); final PluginId[] dependentPluginIds = hybrisPlugin.getOptionalDependentPluginIds(); Arrays.stream(dependentPluginIds).forEach(id -> { if (id.getIdString().startsWith(EXCLUDED_ID_PREFIX)) { @@ -111,10 +111,10 @@ private void checkDependentPlugins() { private void fillInGUI() { final DefaultListModel notInstalledModel = (DefaultListModel) notInstalledList.getModel(); notInstalledModel.clear(); - notInstalledPlugins.stream().forEach(id -> notInstalledModel.addElement(id)); + notInstalledPlugins.forEach(notInstalledModel::addElement); final DefaultListModel notEnabledModel = (DefaultListModel) notEnabledList.getModel(); notEnabledModel.clear(); - notEnabledPlugins.stream().forEach(id -> { + notEnabledPlugins.forEach(id -> { final IdeaPluginDescriptor plugin = PluginManager.getPlugin(id); notEnabledModel.addElement(plugin.getName()); }); @@ -136,8 +136,8 @@ public boolean isAnyMissing() { } private void createUIComponents() { - notInstalledList = new JList(new DefaultListModel()); - notEnabledList = new JList(new DefaultListModel()); + notInstalledList = new JBList(new DefaultListModel()); + notEnabledList = new JBList(new DefaultListModel()); enableButton = new JButton(); enableButton.addActionListener(e -> enablePlugins()); } diff --git a/src/com/intellij/idea/plugin/hybris/project/wizard/DiscountImportstep.form b/src/com/intellij/idea/plugin/hybris/project/wizard/DiscountImportstep.form deleted file mode 100644 index 5243201b8..000000000 --- a/src/com/intellij/idea/plugin/hybris/project/wizard/DiscountImportstep.form +++ /dev/null @@ -1,46 +0,0 @@ - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/intellij/idea/plugin/hybris/project/wizard/DiscountImportstep.java b/src/com/intellij/idea/plugin/hybris/project/wizard/DiscountImportstep.java deleted file mode 100644 index e759e2c07..000000000 --- a/src/com/intellij/idea/plugin/hybris/project/wizard/DiscountImportstep.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.intellij.idea.plugin.hybris.project.wizard; - -import com.intellij.ide.util.projectWizard.WizardContext; -import com.intellij.idea.plugin.hybris.common.utils.HybrisI18NBundleUtils; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.projectImport.ProjectImportWizardStep; -import com.intellij.ui.BrowserHyperlinkListener; - -import javax.swing.*; -import javax.swing.text.html.HTMLDocument; -import javax.swing.text.html.HTMLEditorKit; -import java.awt.*; - -public class DiscountImportstep extends ProjectImportWizardStep { - - private JPanel rootPanel; - private JEditorPane discountEditorPane; - private JLabel discountLabel; - private static final Logger LOG = Logger.getInstance(DiscountImportstep.class); - - public DiscountImportstep(final WizardContext wizardContext) { - super(wizardContext); - } - - @Override - public JComponent getComponent() { - return rootPanel; - } - - @Override - public void updateDataModel() { - } - - @Override - public void updateStep() { - discountLabel.setText(HybrisI18NBundleUtils.message("support.us.step.title")); - discountEditorPane.setText(HybrisI18NBundleUtils.message("support.us.step.text")); - } - - private void createUIComponents() { - final Font font = UIManager.getFont("Label.font"); - final String bodyRule = "body { font-family: " + font.getFamily() + "; " + "font-size: " + font.getSize() + "pt; }"; - discountEditorPane = new JEditorPane(); - discountEditorPane.setEditorKit(new HTMLEditorKit()); - ((HTMLDocument) discountEditorPane.getDocument()).getStyleSheet().addRule(bodyRule); - discountEditorPane.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE); - } -} diff --git a/src/com/intellij/idea/plugin/hybris/project/wizard/HybrisWorkspaceRootStep.form b/src/com/intellij/idea/plugin/hybris/project/wizard/HybrisWorkspaceRootStep.form index 77f023f04..0669df2a5 100644 --- a/src/com/intellij/idea/plugin/hybris/project/wizard/HybrisWorkspaceRootStep.form +++ b/src/com/intellij/idea/plugin/hybris/project/wizard/HybrisWorkspaceRootStep.form @@ -1,9 +1,9 @@
    - + - + @@ -351,7 +351,7 @@ - + @@ -418,6 +418,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/intellij/idea/plugin/hybris/project/wizard/HybrisWorkspaceRootStep.java b/src/com/intellij/idea/plugin/hybris/project/wizard/HybrisWorkspaceRootStep.java index 675fb2548..30dbe1c16 100644 --- a/src/com/intellij/idea/plugin/hybris/project/wizard/HybrisWorkspaceRootStep.java +++ b/src/com/intellij/idea/plugin/hybris/project/wizard/HybrisWorkspaceRootStep.java @@ -104,7 +104,14 @@ public class HybrisWorkspaceRootStep extends ProjectImportWizardStep implements private JCheckBox scanThroughExternalModuleCheckbox; private JCheckBox excludeTestSourcesCheckBox; private JLabel excludeTestSourcesLabel; + private JCheckBox withMavenSources; + private JCheckBox withMavenJavadocs; + private JLabel withMavenJavadocsLabel; + private JLabel withMavenSourcesLabel; + private JCheckBox withStandardProvidedSources; + private JLabel withStandardProvidedSourcesLabel; private String hybrisVersion; + public HybrisWorkspaceRootStep(final WizardContext context) { super(context); @@ -308,6 +315,10 @@ public void updateDataModel() { this.getContext().getHybrisProjectDescriptor().setCreateBackwardCyclicDependenciesForAddOns( this.circularDependencyCheckBox.isSelected() ); + this.getContext().getHybrisProjectDescriptor().setWithMavenSources(withMavenSources.isSelected()); + this.getContext().getHybrisProjectDescriptor().setWithMavenJavadocs(withMavenJavadocs.isSelected()); + this.getContext().getHybrisProjectDescriptor() + .setWithStandardProvidedSources(withStandardProvidedSources.isSelected()); this.getContext().getHybrisProjectDescriptor().setJavadocUrl( this.javadocUrlTextField.getText() @@ -315,7 +326,9 @@ public void updateDataModel() { this.getContext().getHybrisProjectDescriptor().setHybrisVersion(hybrisVersion); - LOG.info("importing a project with the following settings: "+this.getContext().getHybrisProjectDescriptor().toString()); + LOG.info("importing a project with the following settings: " + this.getContext() + .getHybrisProjectDescriptor() + .toString()); this.getContext().setRootProjectDirectory(toFile(this.getContext().getFileToImport())); } @@ -362,6 +375,9 @@ public void updateStep() { hybrisProjectDescriptor.setExcludeTestSources( appSettings.isExcludeTestSources() ); + hybrisProjectDescriptor.setWithMavenSources(appSettings.isWithMavenSources()); + hybrisProjectDescriptor.setWithMavenJavadocs(appSettings.isWithMavenJavadocs()); + hybrisProjectDescriptor.setWithStandardProvidedSources(appSettings.isWithStandardProvidedSources()); this.importOotbModulesInReadOnlyModeCheckBox.setSelected( hybrisProjectDescriptor.isImportOotbModulesInReadOnlyMode() ); @@ -601,6 +617,11 @@ public void nonGuiModeImport(final HybrisProjectSettings settings) throws Config hybrisProjectDescriptor.setExcludeTestSources(settings.isExcludeTestSources()); hybrisProjectDescriptor.setScanThroughExternalModule(settings.isScanThroughExternalModule()); + final HybrisApplicationSettings appSettings = HybrisApplicationSettingsComponent.getInstance().getState(); + hybrisProjectDescriptor.setWithMavenSources(appSettings.isWithMavenSources()); + hybrisProjectDescriptor.setWithMavenJavadocs(appSettings.isWithMavenJavadocs()); + hybrisProjectDescriptor.setWithStandardProvidedSources(appSettings.isWithStandardProvidedSources()); + final String ideModulesFilesDirectory = settings.getIdeModulesFilesDirectory(); if (ideModulesFilesDirectory != null) { hybrisProjectDescriptor.setModulesFilesDirectory( diff --git a/src/com/intellij/idea/plugin/hybris/project/wizard/PermissionToSendStatisticsDialog.form b/src/com/intellij/idea/plugin/hybris/project/wizard/PermissionToSendStatisticsDialog.form deleted file mode 100644 index 3ab619e42..000000000 --- a/src/com/intellij/idea/plugin/hybris/project/wizard/PermissionToSendStatisticsDialog.form +++ /dev/null @@ -1,37 +0,0 @@ - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/intellij/idea/plugin/hybris/project/wizard/PermissionToSendStatisticsDialog.java b/src/com/intellij/idea/plugin/hybris/project/wizard/PermissionToSendStatisticsDialog.java deleted file mode 100644 index 79737fe03..000000000 --- a/src/com/intellij/idea/plugin/hybris/project/wizard/PermissionToSendStatisticsDialog.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of "hybris integration" plugin for Intellij IDEA. - * Copyright (C) 2014-2016 Alexander Bartash - * - * 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.project.wizard; - -import com.intellij.idea.plugin.hybris.common.utils.HybrisI18NBundleUtils; -import com.intellij.idea.plugin.hybris.settings.HybrisApplicationSettingsComponent; -import com.intellij.idea.plugin.hybris.statistics.StatsCollector; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.project.ProjectManager; -import com.intellij.openapi.ui.DialogWrapper; -import org.jetbrains.annotations.Nullable; - -import javax.swing.*; -import java.awt.event.ItemEvent; - -public class PermissionToSendStatisticsDialog extends DialogWrapper { - - private JPanel rootPanel; - private JCheckBox permissionToSendStatisticsCheckBox; - private JTextPane permissionToSendStatisticsTextPane; - private Project myProject; - private static final Logger LOG = Logger.getInstance(PermissionToSendStatisticsDialog.class); - - public PermissionToSendStatisticsDialog(@Nullable final Project project) { - super(project, false, DialogWrapper.IdeModalityType.PROJECT); - myProject = project; - setTitle(HybrisI18NBundleUtils.message("hybris.stats.permission.label")); - if (StatsCollector.getInstance().isOpenCollectiveContributor()) { - setCancelButtonText(HybrisI18NBundleUtils.message("hybris.stats.permission.no")); - } else { - setCancelButtonText(HybrisI18NBundleUtils.message("hybris.stats.permission.cancel")); - } - permissionToSendStatisticsCheckBox.addItemListener(e -> setOKActionEnabled(e.getStateChange() == ItemEvent.SELECTED)); - init(); - } - - @Nullable - @Override - protected JComponent createCenterPanel() { - return rootPanel; - } - - @Override - protected void doOKAction() { - HybrisApplicationSettingsComponent.getInstance().getState().setAllowedSendingPlainStatistics(true); - super.doOKAction(); - } - - @Override - public void doCancelAction() { - super.doCancelAction(); - if (StatsCollector.getInstance().isOpenCollectiveContributor()) { - HybrisApplicationSettingsComponent.getInstance().getState().setDisallowedSendingStatistics(true); - return; - } - ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> { - LOG.error("User chose to close the project."); - ProjectManager.getInstance().closeProject(myProject); - })); - - } - -} diff --git a/src/com/intellij/idea/plugin/hybris/project/wizard/SelectHybrisModulesToImportStep.java b/src/com/intellij/idea/plugin/hybris/project/wizard/SelectHybrisModulesToImportStep.java index 680754d2d..a1438c414 100644 --- a/src/com/intellij/idea/plugin/hybris/project/wizard/SelectHybrisModulesToImportStep.java +++ b/src/com/intellij/idea/plugin/hybris/project/wizard/SelectHybrisModulesToImportStep.java @@ -35,6 +35,7 @@ import javax.swing.*; import java.util.ArrayList; +import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -157,6 +158,7 @@ public void nonGuiModeImport(final HybrisProjectSettings settings) throws Config final List filteredModuleToImport = moduleToImport .stream() .filter(e->!modulesOnBlackList.contains(e.getRelativePath())) + .sorted(Comparator.nullsLast(Comparator.comparing(HybrisModuleDescriptor::getName))) .collect(Collectors.toList()); try { this.getContext().setList(filteredModuleToImport); diff --git a/src/com/intellij/idea/plugin/hybris/project/wizard/SelectOtherModulesToImportStep.java b/src/com/intellij/idea/plugin/hybris/project/wizard/SelectOtherModulesToImportStep.java index 0f291c814..f007a957e 100644 --- a/src/com/intellij/idea/plugin/hybris/project/wizard/SelectOtherModulesToImportStep.java +++ b/src/com/intellij/idea/plugin/hybris/project/wizard/SelectOtherModulesToImportStep.java @@ -27,6 +27,7 @@ import com.intellij.openapi.options.ConfigurationException; import icons.GradleIcons; import icons.MavenIcons; +import icons.OpenapiIcons; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -58,7 +59,7 @@ protected Icon getElementIcon(final HybrisModuleDescriptor module) { return AllIcons.Actions.Cancel; } if (module instanceof MavenModuleDescriptor) { - return MavenIcons.MavenLogo; + return OpenapiIcons.RepositoryLibraryLogo; } if (module instanceof EclipseModuleDescriptor) { return AllIcons.Providers.Eclipse; diff --git a/src/com/intellij/idea/plugin/hybris/reference/provider/HybrisSpringProcessReferenceProvider.kt b/src/com/intellij/idea/plugin/hybris/reference/provider/HybrisSpringProcessReferenceProvider.kt index be37477f4..88a89e871 100644 --- a/src/com/intellij/idea/plugin/hybris/reference/provider/HybrisSpringProcessReferenceProvider.kt +++ b/src/com/intellij/idea/plugin/hybris/reference/provider/HybrisSpringProcessReferenceProvider.kt @@ -50,16 +50,11 @@ class HybrisSpringProcessReferenceProvider : PsiReferenceProvider() { val module = ModuleUtil.findModuleForPsiElement(element) ?: return ResolveResult.EMPTY_ARRAY - val result = mutableSetOf>() - val allModels = SpringManager.getInstance(project).getAllModels(module) - allModels.forEach { model -> - val pointer = SpringModelSearchers.findBean(model, name) - if (pointer != null) { - result.add(pointer) - } - } - - return createResults(result.map { it.beanClass }) + return SpringManager.getInstance(project).getAllModels(module) + .mapNotNull { SpringModelSearchers.findBean(it, name) } + .map { it.beanClass } + .toCollection(mutableSetOf()) + .let { createResults(it) } } override fun resolve(): PsiElement? { diff --git a/src/com/intellij/idea/plugin/hybris/runConfigurations/HybrisJUnitExtension.java b/src/com/intellij/idea/plugin/hybris/runConfigurations/HybrisJUnitExtension.java index 0693ddaa1..90c0d150b 100644 --- a/src/com/intellij/idea/plugin/hybris/runConfigurations/HybrisJUnitExtension.java +++ b/src/com/intellij/idea/plugin/hybris/runConfigurations/HybrisJUnitExtension.java @@ -42,7 +42,7 @@ public class HybrisJUnitExtension extends RunConfigurationExtension { @Override - public void updateJavaParameters( + public > void updateJavaParameters( final T configuration, final JavaParameters params, final RunnerSettings runnerSettings ) throws ExecutionException { if (runnerSettings != null || !isApplicableFor(configuration)) { diff --git a/src/com/intellij/idea/plugin/hybris/settings/HybrisApplicationSettings.java b/src/com/intellij/idea/plugin/hybris/settings/HybrisApplicationSettings.java index 110b3c5ca..a75a423b2 100644 --- a/src/com/intellij/idea/plugin/hybris/settings/HybrisApplicationSettings.java +++ b/src/com/intellij/idea/plugin/hybris/settings/HybrisApplicationSettings.java @@ -20,12 +20,10 @@ import com.google.common.collect.Lists; import com.intellij.ide.util.PropertyName; -import com.intellij.idea.plugin.hybris.statistics.StatsCollector; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; -import java.util.HashSet; import java.util.List; public class HybrisApplicationSettings { @@ -62,6 +60,13 @@ public class HybrisApplicationSettings { "npmancillary" ); + public static final List DEFAULT_EXCLUDED_FROM_INDEX = Lists.newArrayList( + "smartedit-custom-build", + "smartedit-build", + "apps/**/node_modules", + "common/temp/node_modules" + ); + @PropertyName("foldingEnabled") private boolean foldingEnabled = true; @@ -104,12 +109,18 @@ public class HybrisApplicationSettings { @PropertyName("defaultPlatformInReadOnly") private boolean defaultPlatformInReadOnly = true; - @PropertyName("usedActions") - private HashSet usedActions = new HashSet<>(); - @PropertyName("followSymlink") private boolean followSymlink = true; + @PropertyName("withMavenSources") + private boolean withMavenSources; + + @PropertyName("withMavenJavadocs") + private boolean withMavenJavadocs; + + @PropertyName("withStandardProvidedSources") + private boolean withStandardProvidedSources; + @PropertyName("allowedSendingPlainStatistics") private boolean allowedSendingPlainStatistics = false; @@ -137,6 +148,9 @@ public class HybrisApplicationSettings { @PropertyName("warnIfGeneratedItemsAreOutOfDate") private boolean warnIfGeneratedItemsAreOutOfDate = true; + @PropertyName("excludedFromIndexList") + private List excludedFromIndexList = DEFAULT_EXCLUDED_FROM_INDEX; + public HybrisApplicationSettings() { } @@ -165,6 +179,14 @@ public void setJunkDirectoryList(final List junkDirectoryList) { this.junkDirectoryList = junkDirectoryList; } + public List getExcludedFromIndexList() { + return excludedFromIndexList; + } + + public void setExcludedFromIndexList(final List excludedFromIndexList) { + this.excludedFromIndexList = excludedFromIndexList; + } + public boolean isGroupModules() { return groupModules; } @@ -245,14 +267,6 @@ public void setWarnIfGeneratedItemsAreOutOfDate(final boolean warnIfGeneratedIte this.warnIfGeneratedItemsAreOutOfDate = warnIfGeneratedItemsAreOutOfDate; } - public HashSet getUsedActions() { - return usedActions; - } - - public void setUsedActions(final HashSet usedActions) { - this.usedActions = usedActions; - } - public boolean isFollowSymlink() { return followSymlink; } @@ -261,6 +275,30 @@ public void setFollowSymlink(final boolean followSymlink) { this.followSymlink = followSymlink; } + public boolean isWithMavenSources() { + return withMavenSources; + } + + public void setWithMavenSources(final boolean withMavenSources) { + this.withMavenSources = withMavenSources; + } + + public boolean isWithMavenJavadocs() { + return withMavenJavadocs; + } + + public void setWithMavenJavadocs(final boolean withMavenJavadocs) { + this.withMavenJavadocs = withMavenJavadocs; + } + + public boolean isWithStandardProvidedSources() { + return withStandardProvidedSources; + } + + public void setWithStandardProvidedSources(final boolean withStandardProvidedSources) { + this.withStandardProvidedSources = withStandardProvidedSources; + } + public boolean isAllowedSendingPlainStatistics() { return allowedSendingPlainStatistics; } @@ -357,8 +395,10 @@ public int hashCode() { .append(groupPlatform) .append(hideEmptyMiddleFolders) .append(defaultPlatformInReadOnly) - .append(usedActions) .append(followSymlink) + .append(withMavenSources) + .append(withMavenJavadocs) + .append(withStandardProvidedSources) .append(scanThroughExternalModule) .append(allowedSendingPlainStatistics) .append(disallowedSendingStatistics) @@ -369,6 +409,7 @@ public int hashCode() { .append(excludeTestSources) .append(extensionsResourcesToExcludeList) .append(warnIfGeneratedItemsAreOutOfDate) + .append(excludedFromIndexList) .toHashCode(); } @@ -398,8 +439,10 @@ public boolean equals(final Object obj) { .append(groupPlatform, other.groupPlatform) .append(hideEmptyMiddleFolders, other.hideEmptyMiddleFolders) .append(defaultPlatformInReadOnly, other.defaultPlatformInReadOnly) - .append(usedActions, other.usedActions) .append(followSymlink, other.followSymlink) + .append(withMavenSources, other.withMavenSources) + .append(withMavenJavadocs, other.withMavenJavadocs) + .append(withStandardProvidedSources, other.withStandardProvidedSources) .append(scanThroughExternalModule, other.scanThroughExternalModule) .append(allowedSendingPlainStatistics, other.allowedSendingPlainStatistics) .append(disallowedSendingStatistics, other.disallowedSendingStatistics) @@ -410,6 +453,7 @@ public boolean equals(final Object obj) { .append(excludeTestSources, other.excludeTestSources) .append(extensionsResourcesToExcludeList, other.extensionsResourcesToExcludeList) .append(warnIfGeneratedItemsAreOutOfDate, other.warnIfGeneratedItemsAreOutOfDate) + .append(excludedFromIndexList, other.excludedFromIndexList) .isEquals(); } @@ -430,8 +474,10 @@ public String toString() { sb.append(", groupPlatform='").append(groupPlatform).append('\''); sb.append(", hideEmptyMiddleFolders='").append(hideEmptyMiddleFolders).append('\''); sb.append(", defaultPlatformInReadOnly='").append(defaultPlatformInReadOnly).append('\''); - sb.append(", usedActions='").append(usedActions).append('\''); sb.append(", followSymlink='").append(followSymlink).append('\''); + sb.append(", withMavenSources='").append(withMavenSources).append('\''); + sb.append(", withMavenJavadocs='").append(withMavenJavadocs).append('\''); + sb.append(", withStandardProvidedSources='").append(withStandardProvidedSources).append('\''); sb.append(", scanThroughExternalModule='").append(scanThroughExternalModule).append('\''); sb.append(", allowedSendingPlainStatistics='").append(allowedSendingPlainStatistics).append('\''); sb.append(", disallowedSendingStatistics='").append(disallowedSendingStatistics).append('\''); @@ -441,6 +487,7 @@ public String toString() { sb.append(", developmentMode='").append(developmentMode).append('\''); sb.append(", excludeTestSources='").append(excludeTestSources).append('\''); sb.append(", warnIfGeneratedItemsAreOutOfDate='").append(warnIfGeneratedItemsAreOutOfDate).append('\''); + sb.append(", excludedFromIndexList='").append(excludedFromIndexList).append('\''); sb.append('}'); return sb.toString(); } @@ -451,4 +498,4 @@ public static String[] toIdeaGroup(final String group) { } return StringUtils.split(group, " ,.;>/\\"); } -} \ No newline at end of file +} diff --git a/src/com/intellij/idea/plugin/hybris/settings/HybrisApplicationSettingsComponent.java b/src/com/intellij/idea/plugin/hybris/settings/HybrisApplicationSettingsComponent.java index cda25791d..f8617bfa9 100644 --- a/src/com/intellij/idea/plugin/hybris/settings/HybrisApplicationSettingsComponent.java +++ b/src/com/intellij/idea/plugin/hybris/settings/HybrisApplicationSettingsComponent.java @@ -18,18 +18,13 @@ package com.intellij.idea.plugin.hybris.settings; -import com.intellij.idea.plugin.hybris.common.HybrisConstants; -import com.intellij.idea.plugin.hybris.statistics.StatsCollector; import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; -import com.intellij.openapi.components.StoragePathMacros; import com.intellij.util.xmlb.XmlSerializerUtil; import org.jetbrains.annotations.NotNull; -import java.util.HashSet; - import static com.intellij.idea.plugin.hybris.common.HybrisConstants.HYBRIS_INTEGRATION_SETTINGS_FILE_NAME; @@ -58,10 +53,4 @@ public HybrisApplicationSettings getState() { public void loadState(final HybrisApplicationSettings state) { XmlSerializerUtil.copyBean(state, this.hybrisApplicationSettings); } - - public void addUsedAction(@NotNull final StatsCollector.ACTIONS action) { - final HashSet usedActions = hybrisApplicationSettings.getUsedActions(); - usedActions.add(action); - hybrisApplicationSettings.setUsedActions(usedActions); - } } diff --git a/src/com/intellij/idea/plugin/hybris/settings/HybrisApplicationSettingsForm.form b/src/com/intellij/idea/plugin/hybris/settings/HybrisApplicationSettingsForm.form index 8f2d60116..7e964ce69 100644 --- a/src/com/intellij/idea/plugin/hybris/settings/HybrisApplicationSettingsForm.form +++ b/src/com/intellij/idea/plugin/hybris/settings/HybrisApplicationSettingsForm.form @@ -3,7 +3,7 @@ - + @@ -111,7 +111,7 @@ - + @@ -123,7 +123,7 @@ - + @@ -131,7 +131,7 @@ - + @@ -139,7 +139,7 @@ - + @@ -148,7 +148,7 @@ - + @@ -157,7 +157,7 @@ - + @@ -166,7 +166,7 @@ - + @@ -175,12 +175,46 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/intellij/idea/plugin/hybris/settings/HybrisApplicationSettingsForm.java b/src/com/intellij/idea/plugin/hybris/settings/HybrisApplicationSettingsForm.java index 0cc2ad682..bf64156b2 100644 --- a/src/com/intellij/idea/plugin/hybris/settings/HybrisApplicationSettingsForm.java +++ b/src/com/intellij/idea/plugin/hybris/settings/HybrisApplicationSettingsForm.java @@ -57,15 +57,20 @@ public class HybrisApplicationSettingsForm { private JCheckBox defaultPlatformInReadOnly; private JTextField groupPlatformTextField; private JCheckBox followSymlink; + private JCheckBox withMavenSources; + private JCheckBox withMavenJavadocs; private JPanel typeSystemDiagramStopWords; private JCheckBox scanThroughExternalModule; private JCheckBox excludeTestSources; private JPanel extensionsResourcesToExclude; private JCheckBox warnIfGeneratedItemsAreOutOfDateCheckBox; + private JCheckBox withStandardProvidedSources; + private JPanel excludedFromIndexPanel; private MyListPanel junkListPanel; private MyListPanel tsdListPanel; private MyListPanel extensionsResourcesToExcludeListPanel; + private MyListPanel excludedFromIndexListPanel; public void setData(final HybrisApplicationSettings data) { enableFoldingCheckBox.setSelected(data.isFoldingEnabled()); @@ -83,9 +88,13 @@ public void setData(final HybrisApplicationSettings data) { hideEmptyMiddleFoldersCheckBox.setSelected(data.isHideEmptyMiddleFolders()); defaultPlatformInReadOnly.setSelected(data.isDefaultPlatformInReadOnly()); followSymlink.setSelected(data.isFollowSymlink()); + withMavenSources.setSelected(data.isWithMavenSources()); + withMavenJavadocs.setSelected(data.isWithMavenJavadocs()); + withStandardProvidedSources.setSelected(data.isWithStandardProvidedSources()); scanThroughExternalModule.setSelected(data.isScanThroughExternalModule()); excludeTestSources.setSelected(data.isExcludeTestSources()); warnIfGeneratedItemsAreOutOfDateCheckBox.setSelected(data.isWarnIfGeneratedItemsAreOutOfDate()); + excludedFromIndexListPanel.setMyList(data.getExcludedFromIndexList()); } public void getData(final HybrisApplicationSettings data) { @@ -104,9 +113,13 @@ public void getData(final HybrisApplicationSettings data) { data.setHideEmptyMiddleFolders(hideEmptyMiddleFoldersCheckBox.isSelected()); data.setDefaultPlatformInReadOnly(defaultPlatformInReadOnly.isSelected()); data.setFollowSymlink(followSymlink.isSelected()); + data.setWithMavenSources(withMavenSources.isSelected()); + data.setWithMavenJavadocs(withMavenJavadocs.isSelected()); + data.setWithStandardProvidedSources(withStandardProvidedSources.isSelected()); data.setScanThroughExternalModule(scanThroughExternalModule.isSelected()); data.setExcludeTestSources(excludeTestSources.isSelected()); data.setWarnIfGeneratedItemsAreOutOfDate(warnIfGeneratedItemsAreOutOfDateCheckBox.isSelected()); + data.setExcludedFromIndexList(excludedFromIndexListPanel.getMyList()); } public boolean isModified(final HybrisApplicationSettings data) { @@ -119,6 +132,9 @@ public boolean isModified(final HybrisApplicationSettings data) { if (!junkListPanel.getMyList().equals(data.getJunkDirectoryList())) { return true; } + if (!excludedFromIndexListPanel.getMyList().equals(data.getExcludedFromIndexList())) { + return true; + } if (!tsdListPanel.getMyList().equals(data.getTsdStopTypeList())) { return true; } @@ -158,6 +174,15 @@ public boolean isModified(final HybrisApplicationSettings data) { if (followSymlink.isSelected() != data.isFollowSymlink()) { return true; } + if (withMavenSources.isSelected() != data.isWithMavenSources()) { + return true; + } + if (withMavenJavadocs.isSelected() != data.isWithMavenJavadocs()) { + return true; + } + if (withStandardProvidedSources.isSelected() != data.isWithStandardProvidedSources()) { + return true; + } if (excludeTestSources.isSelected() != data.isExcludeTestSources()) { return true; } @@ -184,6 +209,8 @@ private void createUIComponents() { typeSystemDiagramStopWords = tsdListPanel; extensionsResourcesToExcludeListPanel = new MyListPanel("hybris.import.settings.exclude.resources.name", "hybris.import.settings.exclude.resources.popup.add.title", "hybris.import.settings.exclude.resources.popup.add.text", "hybris.import.settings.exclude.resources.popup.edit.title", "hybris.import.settings.exclude.resources.popup.edit.text", new ArrayList()); extensionsResourcesToExclude = extensionsResourcesToExcludeListPanel; + excludedFromIndexListPanel = new MyListPanel("hybris.import.settings.excludedFromIndex.directory.name", "hybris.import.settings.excludedFromIndex.directory.popup.add.title", "hybris.import.settings.excludedFromIndex.directory.popup.add.text", "hybris.import.settings.excludedFromIndex.directory.popup.edit.title", "hybris.import.settings.excludedFromIndex.directory.popup.edit.text", new ArrayList()); + excludedFromIndexPanel = excludedFromIndexListPanel; projectTreeViewSettingsLabel = new JBLabel(); projectTreeViewSettingsLabel.setBorder(IdeBorderFactory.createTitledBorder(HybrisI18NBundleUtils.message( diff --git a/src/com/intellij/idea/plugin/hybris/settings/HybrisDeveloperSpecificProjectSettingsComponent.java b/src/com/intellij/idea/plugin/hybris/settings/HybrisDeveloperSpecificProjectSettingsComponent.java index 7e8022eb0..403088385 100644 --- a/src/com/intellij/idea/plugin/hybris/settings/HybrisDeveloperSpecificProjectSettingsComponent.java +++ b/src/com/intellij/idea/plugin/hybris/settings/HybrisDeveloperSpecificProjectSettingsComponent.java @@ -81,6 +81,7 @@ public HybrisRemoteConnectionSettings getDefaultHybrisRemoteConnectionSettings(f item.setPort(HybrisConstants.DEFAULT_TOMCAT_SSL_PORT); item.setHacLogin("admin"); item.setHacPassword("nimda"); + item.setSsl(true); item.setGeneratedURL(CommonIdeaService.getInstance().getHostHacUrl(project, item)); return item; } @@ -95,7 +96,8 @@ public HybrisRemoteConnectionSettings getDefaultSolrRemoteConnectionSettings(fin item.setSolrWebroot("solr"); item.setAdminLogin("solradmin"); item.setAdminPassword("admin123"); - item.setGeneratedURL(CommonIdeaService.getInstance().getHostSolrUrl(project, item)); + item.setSsl(true); + item.setGeneratedURL(CommonIdeaService.getInstance().getSolrUrl(project, item)); return item; } } diff --git a/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettingsComponent.java b/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettingsComponent.java index ba49b98d2..e50c16ff4 100644 --- a/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettingsComponent.java +++ b/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettingsComponent.java @@ -40,7 +40,7 @@ public class HybrisProjectSettingsComponent implements PersistentStateComponent< private final HybrisProjectSettings hybrisProjectSettings = new HybrisProjectSettings(); public static HybrisProjectSettingsComponent getInstance(@NotNull final Project project) { - return ServiceManager.getService(project, HybrisProjectSettingsComponent.class); + return project.getService(HybrisProjectSettingsComponent.class); } @NotNull diff --git a/src/com/intellij/idea/plugin/hybris/settings/HybrisRemoteConnectionSettings.java b/src/com/intellij/idea/plugin/hybris/settings/HybrisRemoteConnectionSettings.java index fa2fc53d6..d36c19465 100644 --- a/src/com/intellij/idea/plugin/hybris/settings/HybrisRemoteConnectionSettings.java +++ b/src/com/intellij/idea/plugin/hybris/settings/HybrisRemoteConnectionSettings.java @@ -7,6 +7,7 @@ public class HybrisRemoteConnectionSettings implements Serializable { + public enum Type {Hybris, SOLR} protected String uuid; @@ -19,8 +20,18 @@ public enum Type {Hybris, SOLR} protected String hacWebroot; protected String hacLogin; protected String hacPassword; + protected String sslProtocol; protected String generatedURL; protected Type type; + protected boolean isSsl; + + public boolean isSsl() { + return isSsl; + } + + public void setSsl(final boolean ssl) { + isSsl = ssl; + } public String getUuid() { return uuid; @@ -102,6 +113,14 @@ public void setHacPassword(final String hacPassword) { this.hacPassword = hacPassword; } + public String getSslProtocol() { + return sslProtocol; + } + + public void setSslProtocol(final String sslProtocol) { + this.sslProtocol = sslProtocol; + } + public String getGeneratedURL() { return generatedURL; } diff --git a/src/com/intellij/idea/plugin/hybris/solr/SolrSearchLanguage.java b/src/com/intellij/idea/plugin/hybris/solr/SolrSearchLanguage.java new file mode 100644 index 000000000..a992ad3ac --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/solr/SolrSearchLanguage.java @@ -0,0 +1,35 @@ +/* + * 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.solr; + +import com.intellij.lang.Language; + +//TODO need to implement Solr query parser +public class SolrSearchLanguage extends Language { + + private static final SolrSearchLanguage INSTANCE = new SolrSearchLanguage(); + + protected SolrSearchLanguage() { + super("Hybris Solr", "text/plain"); + } + + public static SolrSearchLanguage getInstance() { + return INSTANCE; + } +} diff --git a/src/com/intellij/idea/plugin/hybris/statistics/StatsCollector.java b/src/com/intellij/idea/plugin/hybris/statistics/StatsCollector.java deleted file mode 100644 index 7be6f456a..000000000 --- a/src/com/intellij/idea/plugin/hybris/statistics/StatsCollector.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * This file is part of "hybris integration" plugin for Intellij IDEA. - * Copyright (C) 2014-2016 Alexander Bartash - * - * 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.statistics; - -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.components.ApplicationComponent; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Created by Martin Zdarsky-Jones (martin.zdarsky@hybris.com) on 28/2/17. - */ -public interface StatsCollector extends ApplicationComponent { - - void collectStat(@NotNull ACTIONS action, @Nullable String parameters); - - boolean isOpenCollectiveContributor(); - - void setOpenCollectiveContributor(boolean isOpenCollectiveContributor); - - enum ACTIONS { - ANT, - BUILD_PROJECT, - BUSINESS_DIAGRAM, - CLASS_CONFLICT, - DEPENDENCY_DIAGRAM, - ES_ANALYSIS, - ES_ANALYSIS_EXPORT, - FLEXIBLE_SEARCH_CONSOLE, - GROOVY_CONSOLE, - IMPEX_CONSOLE, - IMPEX_MONITOR, - IMPEX_TABLE_FORMAT, - IMPORT_PROJECT, - OPEN_POTENTIAL_PROJECT, - OPEN_PROJECT, - REFRESH_PROJECT, - RUN_TESTS, - SOLR_CONSOLE, - TS_DIAGRAM - } - - void collectStat(@NotNull ACTIONS action); - - @NotNull - static StatsCollector getInstance() { - return ApplicationManager.getApplication().getComponent(StatsCollector.class); - } - - class Entity { - - @NotNull - private final ACTIONS action; - - @Nullable - private final String parameters; - - @NotNull - private final String dateStr; - - public Entity(@NotNull ACTIONS action, @Nullable String parameters, @NotNull final String dateStr) { - this.action = action; - this.parameters = parameters; - this.dateStr = dateStr; - } - - @NotNull - public ACTIONS getAction() { - return action; - } - - @Nullable - public String getParameters() { - return parameters; - } - - @NotNull - public String getDateStr() { - return dateStr; - } - } -} diff --git a/src/com/intellij/idea/plugin/hybris/statistics/impl/DefaultStatsCollector.java b/src/com/intellij/idea/plugin/hybris/statistics/impl/DefaultStatsCollector.java deleted file mode 100644 index 52cef296c..000000000 --- a/src/com/intellij/idea/plugin/hybris/statistics/impl/DefaultStatsCollector.java +++ /dev/null @@ -1,325 +0,0 @@ -/* - * This file is part of "hybris integration" plugin for Intellij IDEA. - * Copyright (C) 2014-2016 Alexander Bartash - * - * 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.statistics.impl; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import com.intellij.ide.plugins.IdeaPluginDescriptor; -import com.intellij.ide.plugins.PluginManager; -import com.intellij.idea.plugin.hybris.common.HybrisConstants; -import com.intellij.idea.plugin.hybris.settings.HybrisApplicationSettingsComponent; -import com.intellij.idea.plugin.hybris.statistics.StatsCollector; -import com.intellij.openapi.application.ApplicationInfo; -import com.intellij.openapi.components.PersistentStateComponent; -import com.intellij.openapi.components.State; -import com.intellij.openapi.components.Storage; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.extensions.PluginId; -import com.intellij.ui.LicensingFacade; -import org.apache.commons.codec.digest.DigestUtils; -import org.apache.http.NameValuePair; -import org.apache.http.message.BasicNameValuePair; -import org.jdom.Element; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; - - -/** - * Created by Martin Zdarsky-Jones (martin.zdarsky@hybris.com) on 28/2/17. - */ -@State(name = "HybrisStatistics", storages = @Storage("hybrisStatistics.xml")) -public class DefaultStatsCollector implements StatsCollector, PersistentStateComponent { - - private static final Logger LOG = Logger.getInstance(DefaultStatsCollector.class); - private static final int MAX_QUEUE_SIZE = 1000; - private static final long DELAY_AFTER_FAILURE = TimeUnit.MINUTES.toMillis(10); - private static final String ATTR_ACTION = "action"; - private static final String ATTR_NAME = "params"; - private static final String ATTR_DATE = "date"; - private static final String TAG_ENTITY = "entity"; - - private final Map cache = new HashMap<>(); - private final List queue = new ArrayList<>(); - private final Object lock = new Object(); - - private long lastFailureTime = 0; - private volatile boolean disposed = false; - private boolean isOpenCollectiveContributor = false; - - @Override - public void initComponent() { - new Thread(this::flushingLoop).start(); - } - - @Override - public void disposeComponent() { - disposed = true; - - synchronized (lock) { - lock.notifyAll(); - } - } - - private void flushingLoop() { - while (!disposed) { - List entitiesToFlush; - - synchronized (lock) { - - while (!disposed) { - final long neededDelay = DELAY_AFTER_FAILURE - (System.currentTimeMillis() - lastFailureTime); - - if (!queue.isEmpty() && neededDelay <= 0) { - break; - } - try { - lock.wait(Math.max(0, neededDelay)); - } catch (InterruptedException e) { - LOG.error(e); - return; - } - } - entitiesToFlush = new ArrayList<>(queue); - } - if (disposed) { - return; - } - try { - final StatsResponse response = createStatsRequest(buildParameters(entitiesToFlush)).call(); - final int statusCode = response.getResponse().getStatusLine().getStatusCode(); - - if (statusCode == 200) { - synchronized (lock) { - queue.removeAll(entitiesToFlush); - } - } else { - LOG.debug("HTTP response status code: " + statusCode); - lastFailureTime = System.currentTimeMillis(); - } - } catch (Exception e) { - if (!(e instanceof IOException)) { - LOG.error(e); - } - lastFailureTime = System.currentTimeMillis(); - } - } - } - - @Override - public void collectStat(@NotNull final ACTIONS action) { - collectStat(action, null); - } - - @Override - public void collectStat(@NotNull final ACTIONS action, @Nullable final String parameters) { - collectStat(new Entity(action, parameters, getCurrentDateTimeWithTimeZone())); - } - - @Override - public boolean isOpenCollectiveContributor() { - return isOpenCollectiveContributor; - } - - @Override - public void setOpenCollectiveContributor(final boolean isOpenCollectiveContributor) { - this.isOpenCollectiveContributor = isOpenCollectiveContributor; - } - - public void collectStat(@NotNull final Entity entity) { - HybrisApplicationSettingsComponent.getInstance().addUsedAction(entity.getAction()); - - if (isOpenCollectiveContributor() && HybrisApplicationSettingsComponent.getInstance().getState().isDisallowedSendingStatistics()) { - return; - } - - if (shouldPostStat(entity.getAction())) { - cache.put(entity.getAction(), System.currentTimeMillis()); - - synchronized (lock) { - queue.add(entity); - - if (queue.size() > MAX_QUEUE_SIZE) { - queue.remove(0); - } - lock.notifyAll(); - } - } - } - - private boolean shouldPostStat(final ACTIONS action) { - Long sendTime = cache.get(action); - if (sendTime == null) { - return true; - } - long diff = System.currentTimeMillis() - sendTime; - return diff > TimeUnit.HOURS.toMillis(12); - } - - @NotNull - protected StatsRequest createStatsRequest( - @NotNull final List urlParameters - ) { - return new StatsRequest(urlParameters); - } - - protected List buildParameters(@NotNull final List entities) { - final List urlParameters = new ArrayList<>(); - urlParameters.add(new BasicNameValuePair("ide_version", getIdeVersion())); - urlParameters.add(new BasicNameValuePair("ide_type", getIdeType())); - - final String registeredTo = getRegisteredTo(); - if (null != registeredTo) { - urlParameters.add(new BasicNameValuePair("registered_to", DigestUtils.sha512Hex(registeredTo))); - } - - String loginName = getLoginName(); - if (null != loginName) { - urlParameters.add(new BasicNameValuePair("login_name", DigestUtils.sha512Hex(loginName))); - } - String osName = System.getProperty("os.name").toLowerCase(); - urlParameters.add(new BasicNameValuePair("os", osName)); - - - urlParameters.add(new BasicNameValuePair("plugin_version", getPluginVersion())); - urlParameters.add(new BasicNameValuePair("request_date", getCurrentDateTimeWithTimeZone())); - final JsonArray jsonActions = new JsonArray(); - - for (Entity entity : entities) { - final JsonObject jsonEntity = new JsonObject(); - jsonEntity.addProperty("name", entity.getAction().name()); - jsonEntity.addProperty("date", entity.getDateStr()); - final String parameters = entity.getParameters(); - - if (parameters != null) { - jsonEntity.addProperty("params", parameters); - } - jsonActions.add(jsonEntity); - } - urlParameters.add(new BasicNameValuePair("actions", jsonActions.toString())); - return urlParameters; - } - - protected String getCurrentDateTimeWithTimeZone() { - final ZonedDateTime localDateTime = ZonedDateTime.now(); - return localDateTime.toString(); - } - - protected String getPluginVersion() { - final IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId(HybrisConstants.PLUGIN_ID)); - return null == plugin ? null : plugin.getVersion(); - } - - protected String getIdeVersion() { - return ApplicationInfo.getInstance().getFullVersion(); - } - - protected String getIdeType() { - return ApplicationInfo.getInstance().getBuild().getProductCode(); - } - - @Nullable - protected String getRegisteredTo() { - final LicensingFacade instance = LicensingFacade.getInstance(); - - return null == instance ? null : instance.getLicensedToMessage(); - } - - protected String getLoginName() { - String osName = System.getProperty("os.name").toLowerCase(); - String className = null; - String methodName = "getUsername"; - - if (osName.contains("windows")) { - className = "com.sun.security.auth.module.NTSystem"; - methodName = "getName"; - } else if (osName.contains("linux")) { - className = "com.sun.security.auth.module.UnixSystem"; - } else if (osName.contains("solaris") || osName.contains("sunos")) { - className = "com.sun.security.auth.module.SolarisSystem"; - } - - if (className != null) { - try { - Class c = Class.forName(className); - Method method = c.getDeclaredMethod(methodName); - Object o = c.newInstance(); - return (String) method.invoke(o); - } catch (ClassNotFoundException | NoSuchMethodException | - IllegalAccessException | InstantiationException | - InvocationTargetException e) { - // no-op - } - } - - return System.getProperty("user.name"); - } - - @Nullable - @Override - public Element getState() { - synchronized (lock) { - final Element element = new Element("state"); - - for (Entity entity : queue) { - final Element entityElement = new Element(TAG_ENTITY); - entityElement.setAttribute(ATTR_ACTION, entity.getAction().name()); - entityElement.setAttribute(ATTR_DATE, entity.getDateStr()); - final String parameters = entity.getParameters(); - - if (parameters != null) { - entityElement.setAttribute(ATTR_NAME, parameters); - } - element.addContent(entityElement); - } - return element; - } - } - - @Override - public void loadState(final Element state) { - synchronized (lock) { - queue.clear(); - - for (Element element : state.getChildren(TAG_ENTITY)) { - final String actionName = element.getAttributeValue(ATTR_ACTION); - final String dateStr = element.getAttributeValue(ATTR_DATE); - final String parameters = element.getAttributeValue(ATTR_NAME); - - if (actionName != null && dateStr != null) { - try { - final ACTIONS action = ACTIONS.valueOf(actionName); - queue.add(new Entity(action, parameters, dateStr)); - } catch (IllegalArgumentException ignored) { - } - } - } - lock.notifyAll(); - } - } -} diff --git a/src/com/intellij/idea/plugin/hybris/statistics/impl/StatsRequest.java b/src/com/intellij/idea/plugin/hybris/statistics/impl/StatsRequest.java deleted file mode 100644 index d10f7fcb7..000000000 --- a/src/com/intellij/idea/plugin/hybris/statistics/impl/StatsRequest.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * This file is part of "hybris integration" plugin for Intellij IDEA. - * Copyright (C) 2014-2016 Alexander Bartash - * - * 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.statistics.impl; - -import com.intellij.idea.plugin.hybris.common.HybrisConstants; -import com.intellij.openapi.util.Ref; -import com.intellij.util.net.IdeHttpClientHelpers; -import org.apache.commons.codec.digest.DigestUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.http.NameValuePair; -import org.apache.http.client.HttpClient; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.message.BasicNameValuePair; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.Callable; - -import static java.nio.charset.StandardCharsets.UTF_8; - -/** - * Created by Martin Zdarsky-Jones (martin.zdarsky@hybris.com) on 28/2/17. - */ -public class StatsRequest implements Callable { - - private static final int TIMEOUT = 60000; - - private static final Object computerNameLock = new Object(); - @Nullable - private static Ref cachedComputerNameRef = null; - - @NotNull - private final List urlParameters; - - public StatsRequest(@NotNull final List urlParameters) { - this.urlParameters = new ArrayList<>(urlParameters); - } - - @Override - public StatsResponse call() throws Exception { - final RequestConfig.Builder builder = RequestConfig - .custom() - .setConnectTimeout(TIMEOUT) - .setConnectionRequestTimeout(TIMEOUT) - .setSocketTimeout(TIMEOUT); - IdeHttpClientHelpers.ApacheHttpClient4.setProxyForUrlIfEnabled(builder, HybrisConstants.STATS_COLLECTOR_URL); - final RequestConfig config = builder.build(); - final HttpClient client = HttpClientBuilder.create().setDefaultRequestConfig(config).build(); - - final List patchedUrlParameters = new ArrayList<>(urlParameters); - patchUrlParameters(patchedUrlParameters); - final HttpPost post = new HttpPost(HybrisConstants.STATS_COLLECTOR_URL); - post.setEntity(new UrlEncodedFormEntity(patchedUrlParameters, UTF_8)); - return new StatsResponse(client.execute(post)); - } - - protected void patchUrlParameters(@NotNull final List urlParameters) { - final String computerName = getComputerName(); - - if (computerName != null) { - urlParameters.add(new BasicNameValuePair("computer_name", DigestUtils.sha512Hex(computerName))); - } - } - - //the same user can have multiple computers with identical license. This would affect the user counter. - protected static String getComputerName() { - synchronized (computerNameLock) { - if (cachedComputerNameRef == null) { - cachedComputerNameRef = Ref.create(computeComputerName()); - } - return cachedComputerNameRef.get(); - } - } - - @Nullable - private static String computeComputerName() { - try { - final String result = InetAddress.getLocalHost().getHostName(); - if (StringUtils.isNotEmpty(result)) { - return result.trim(); - } - } catch (UnknownHostException e) { - // failed; try alternate means. - } - - // try environment properties. - final String envCompName = System.getenv("COMPUTERNAME"); - if (envCompName != null) { - return envCompName; - } - final String host = System.getenv("HOSTNAME"); - if (host != null) { - return host; - } - - return null; - } -} diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/action/ExecuteFlexibleSearchAction.java b/src/com/intellij/idea/plugin/hybris/tools/remote/action/ExecuteFlexibleSearchAction.java new file mode 100644 index 000000000..2ad97b69e --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/action/ExecuteFlexibleSearchAction.java @@ -0,0 +1,51 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.tools.remote.action; + +import com.intellij.idea.plugin.hybris.flexibleSearch.file.FlexibleSearchFileType; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.CommonDataKeys; +import com.intellij.openapi.vfs.VirtualFile; +import org.jetbrains.annotations.NotNull; + +import static com.intellij.idea.plugin.hybris.common.HybrisConstants.FLEXIBLE_SEARCH_CONSOLE_TITLE; + +/** + * @author Nosov Aleksandr + */ +public class ExecuteFlexibleSearchAction extends AbstractExecuteAction { + + @Override + public void update(@NotNull AnActionEvent actionEvent) { + super.update(actionEvent); + final VirtualFile file = actionEvent.getDataContext().getData(CommonDataKeys.VIRTUAL_FILE); + final boolean enabled = file != null && file.getName().endsWith(".fxs"); + actionEvent.getPresentation().setEnabledAndVisible(enabled); + } + + @Override + protected String getExtension() { + return FlexibleSearchFileType.getInstance().getDefaultExtension(); + } + + @Override + protected String getConsoleName() { + return FLEXIBLE_SEARCH_CONSOLE_TITLE; + } +} diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/HybrisConsole.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/console/HybrisConsole.kt index 63bfe1dc5..02c58bcd3 100644 --- a/src/com/intellij/idea/plugin/hybris/tools/remote/console/HybrisConsole.kt +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/HybrisConsole.kt @@ -1,46 +1,18 @@ package com.intellij.idea.plugin.hybris.tools.remote.console -import com.intellij.execution.console.ConsoleHistoryController -import com.intellij.execution.console.ConsoleRootType import com.intellij.execution.console.LanguageConsoleImpl -import com.intellij.idea.plugin.hybris.common.HybrisConstants -import com.intellij.idea.plugin.hybris.common.HybrisConstants.* -import com.intellij.idea.plugin.hybris.common.HybrisConstants.IMPEX.CATALOG_VERSION_ONLINE -import com.intellij.idea.plugin.hybris.common.HybrisConstants.IMPEX.CATALOG_VERSION_STAGED -import com.intellij.idea.plugin.hybris.impex.ImpexLanguage -import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent import com.intellij.idea.plugin.hybris.settings.HybrisRemoteConnectionSettings -import com.intellij.idea.plugin.hybris.statistics.StatsCollector import com.intellij.idea.plugin.hybris.tools.remote.console.preprocess.HybrisConsolePreProcessor -import com.intellij.idea.plugin.hybris.tools.remote.console.preprocess.HybrisConsolePreProcessorCatalogVersion -import com.intellij.idea.plugin.hybris.tools.remote.http.HybrisHacHttpClient import com.intellij.idea.plugin.hybris.tools.remote.http.impex.HybrisHttpResult -import com.intellij.idea.plugin.hybris.tools.remote.http.monitorImpexFiles import com.intellij.lang.Language -import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.project.Project -import com.intellij.openapi.ui.ComboBox -import com.intellij.openapi.util.io.FileUtil.toCanonicalPath -import com.intellij.ui.ListCellRendererWrapper -import com.intellij.ui.components.JBCheckBox -import com.intellij.ui.components.JBLabel -import org.apache.batik.ext.swing.GridBagConstants -import org.apache.commons.lang.StringUtils -import org.jetbrains.plugins.groovy.GroovyLanguage -import java.awt.BorderLayout -import java.awt.FlowLayout -import java.awt.GridBagConstraints -import java.awt.GridBagLayout -import java.io.File import java.util.concurrent.TimeUnit -import javax.swing.JList -import javax.swing.JPanel -import javax.swing.border.EmptyBorder /** * @author Nosov Aleksandr */ abstract class HybrisConsole(project: Project, title: String, language: Language) : LanguageConsoleImpl(project, title, language) { + init { this.printDefaultText() } @@ -57,174 +29,13 @@ abstract class HybrisConsole(project: Project, title: String, language: Language return HybrisRemoteConnectionSettings.Type.Hybris } - abstract fun collectStatistics() -} - -class HybrisImpexConsole(project: Project) : HybrisConsole(project, IMPEX_CONSOLE_TITLE, ImpexLanguage.getInstance()) { - override fun collectStatistics() { - StatsCollector.getInstance().collectStat(StatsCollector.ACTIONS.IMPEX_CONSOLE) - } - - object MyConsoleRootType : ConsoleRootType("hybris.impex.shell", null) - - private val panel = JPanel(FlowLayout(FlowLayout.LEFT, 0, 0)) - private val catalogVersionLabel = JBLabel("Catalog Version") - val catalogVersionComboBox = ComboBox(arrayOf( - CatalogVersionOption("doesn't change", StringUtils.EMPTY), - CatalogVersionOption("changes to $CATALOG_VERSION_STAGED", CATALOG_VERSION_STAGED), - CatalogVersionOption("changes to $CATALOG_VERSION_ONLINE", CATALOG_VERSION_ONLINE) - )) - - private val legacyModeCheckbox = JBCheckBox() - private val legacyModeLabel = JBLabel("Legacy mode: ") - - override fun preProcessors() = listOf(HybrisConsolePreProcessorCatalogVersion()) - - init { - createUI() - ConsoleHistoryController(MyConsoleRootType, "hybris.impex.shell", this).install() + open fun onSelection() { + //NOP } - private fun createUI() { - catalogVersionComboBox.renderer = object : ListCellRendererWrapper() { - override fun customize(list: JList<*>?, value: CatalogVersionOption, index: Int, selected: Boolean, hasFocus: Boolean) { - setText(value.name) - } - } - catalogVersionComboBox.addItemListener { - preProcessors().forEach { processor -> - ApplicationManager.getApplication().invokeLater { this.setInputText(processor.process(this)) } - } - } - catalogVersionLabel.border = EmptyBorder(0, 10, 0, 5) - panel.add(catalogVersionLabel) - panel.add(catalogVersionComboBox) - legacyModeLabel.border = EmptyBorder(0, 10, 0, 5) - legacyModeCheckbox.border = EmptyBorder(0, 0, 0, 5) - panel.add(legacyModeLabel) - panel.add(legacyModeCheckbox) - - add(panel, BorderLayout.NORTH) - isEditable = true - } - - override fun execute(query: String): HybrisHttpResult { - val settings = mutableMapOf( - "scriptContent" to query, - "validationEnum" to "IMPORT_STRICT", - "encoding" to "UTF-8", - "maxThreads" to "4", - "_legacyMode" to "on" - ) - if (legacyModeCheckbox.isSelected) { - settings["legacyMode"] = "true" - } - return HybrisHacHttpClient.getInstance(project).importImpex(project, settings) - } - - fun validate(text: String): HybrisHttpResult { - val settings = mutableMapOf( - "scriptContent" to text, - "validationEnum" to "IMPORT_STRICT", - "encoding" to "UTF-8", - "maxThreads" to "4", - "_legacyMode" to "on" - ) - if (legacyModeCheckbox.isSelected) { - settings["legacyMode"] = "true" - } - return HybrisHacHttpClient.getInstance(project).validateImpex(project, settings) - } } -class HybrisGroovyConsole(project: Project) : HybrisConsole(project, GROOVY_CONSOLE_TITLE, GroovyLanguage) { - override fun collectStatistics() { - StatsCollector.getInstance().collectStat(StatsCollector.ACTIONS.GROOVY_CONSOLE) - } - - object MyConsoleRootType : ConsoleRootType("hybris.groovy.shell", null) - - private val panel = JPanel(FlowLayout(FlowLayout.LEFT, 0, 0)) - private val commitCheckbox = JBCheckBox() - private val commitLabel = JBLabel("Commit mode: ") - - init { - createUI() - ConsoleHistoryController(MyConsoleRootType, "hybris.groovy.shell", this).install() - } - - private fun createUI() { - commitLabel.border = EmptyBorder(0, 10, 0, 3) - commitCheckbox.border = EmptyBorder(0, 0, 0, 5) - panel.add(commitLabel) - panel.add(commitCheckbox) - add(panel, BorderLayout.NORTH) - isEditable = true - } - - override fun execute(query: String): HybrisHttpResult { - return HybrisHacHttpClient.getInstance(project).executeGroovyScript(project, query, commitCheckbox.isSelected) - } -} - - -class HybrisImpexMonitorConsole(project: Project) : HybrisConsole(project, IMPEX_MONITOR_CONSOLE_TITLE, ImpexLanguage.getInstance()) { - override fun collectStatistics() { - StatsCollector.getInstance().collectStat(StatsCollector.ACTIONS.IMPEX_MONITOR) - } - - object MyConsoleRootType : ConsoleRootType("hybris.impex.monitor.shell", null) - - private val panel = JPanel() - private val timeComboBox = ComboBox(arrayOf( - TimeOption("in the last 5 minutes", 5, TimeUnit.MINUTES), - TimeOption("in the last 10 minutes", 10, TimeUnit.MINUTES), - TimeOption("in the last 15 minutes", 15, TimeUnit.MINUTES), - TimeOption("in the last 30 minutes", 30, TimeUnit.MINUTES), - TimeOption("in the last 1 hour", 1, TimeUnit.HOURS) - )) - private val workingDirLabel = JBLabel("Hybris Data Folder: ${obtainDataFolder(project)}") - private val timeOptionLabel = JBLabel("Imported Impex") - - init { - createUI() - ConsoleHistoryController(MyConsoleRootType, "hybris.impex.monitor.shell", this).install() - } - - private fun createUI() { - timeComboBox.renderer = object : ListCellRendererWrapper() { - override fun customize(list: JList<*>?, value: TimeOption, index: Int, selected: Boolean, hasFocus: Boolean) { - setText(value.name) - } - } - isConsoleEditorEnabled = false - panel.layout = GridBagLayout() - val constraints = GridBagConstraints() - constraints.weightx = 0.0 - timeOptionLabel.border = EmptyBorder(0, 10, 0, 5) - panel.add(timeOptionLabel) - panel.add(timeComboBox, constraints) - constraints.weightx = 1.0 - constraints.fill = GridBagConstants.HORIZONTAL - workingDirLabel.border = EmptyBorder(0, 10, 0, 10) - panel.add(workingDirLabel, constraints) - add(panel, BorderLayout.NORTH) - isEditable = true - } - - private fun obtainDataFolder(project: Project): String { - val settings = HybrisProjectSettingsComponent.getInstance(project).state - return toCanonicalPath("${project.basePath}${File.separatorChar}${settings.hybrisDirectory}${File.separatorChar}${HybrisConstants.HYBRIS_DATA_DIRECTORY}") - } - - private fun timeOption() = (timeComboBox.selectedItem as TimeOption) - - private fun workingDir() = obtainDataFolder(project) - - override fun execute(query: String): HybrisHttpResult { - return monitorImpexFiles(timeOption().value, timeOption().unit, workingDir()) - } -} data class TimeOption(val name: String, val value: Int, val unit: TimeUnit) + data class CatalogVersionOption(val name: String, val value: String) \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/HybrisConsoleToolWindowFactory.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/HybrisConsoleToolWindowFactory.java index eef36ff15..ffdb6739c 100644 --- a/src/com/intellij/idea/plugin/hybris/tools/remote/console/HybrisConsoleToolWindowFactory.java +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/HybrisConsoleToolWindowFactory.java @@ -18,6 +18,7 @@ package com.intellij.idea.plugin.hybris.tools.remote.console; +import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent; import com.intellij.idea.plugin.hybris.tools.remote.console.view.HybrisConsolePanelView; import com.intellij.openapi.project.Project; import com.intellij.openapi.wm.ToolWindow; @@ -37,7 +38,7 @@ public void createToolWindowContent( @Override public boolean shouldBeAvailable(@NotNull final Project project) { - return true; + return HybrisProjectSettingsComponent.getInstance(project).getState().isHybrisProject(); } @Override diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/HybrisChooseInstanceAction.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/HybrisChooseInstanceAction.kt index ccfc55d95..22e8286cb 100644 --- a/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/HybrisChooseInstanceAction.kt +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/HybrisChooseInstanceAction.kt @@ -10,7 +10,6 @@ import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys import com.intellij.openapi.ui.Messages -import kotlin.streams.toList class HybrisChooseInstanceAction : AnAction( @@ -23,7 +22,7 @@ class HybrisChooseInstanceAction : AnAction( val state = HybrisDeveloperSpecificProjectSettingsComponent.getInstance(project).state ?: return val list = state.remoteConnectionSettingsList val consoleType = HybrisConsolePanelView.getInstance(project).consolePanel.getActiveConsole().connectionType() - val currentList = list.stream().filter{it.type == consoleType}.toList() + val currentList = list.filter {it.type == consoleType}.toList() val options:Array = currentList.stream().map { it.toString() }.toArray { length -> arrayOfNulls(length)} val active = if (consoleType == SOLR) { HybrisDeveloperSpecificProjectSettingsComponent.getInstance(project).getActiveSolrConnectionSettings(project) diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/HybrisClearAllAction.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/HybrisClearAllAction.kt index e99b464df..46eccd492 100644 --- a/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/HybrisClearAllAction.kt +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/HybrisClearAllAction.kt @@ -36,13 +36,13 @@ class HybrisClearAllAction(val hybrisTabs: HybrisTabs) : override fun update(e: AnActionEvent) { var enabled = hybrisTabs.activeConsole().contentSize > 0 if (!enabled) { - enabled = e!!.getData(LangDataKeys.CONSOLE_VIEW) != null + enabled = e.getData(LangDataKeys.CONSOLE_VIEW) != null val editor = e.getData(CommonDataKeys.EDITOR) if (editor != null && editor.document.textLength == 0) { enabled = false } } - e!!.presentation.isEnabled = enabled + e.presentation.isEnabled = enabled } override fun actionPerformed(e: AnActionEvent) { diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/HybrisImpexValidateAction.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/HybrisImpexValidateAction.kt index f8db992b0..eba713710 100644 --- a/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/HybrisImpexValidateAction.kt +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/HybrisImpexValidateAction.kt @@ -3,8 +3,8 @@ package com.intellij.idea.plugin.hybris.tools.remote.console.actions import com.intellij.codeInsight.lookup.LookupManager import com.intellij.icons.AllIcons.Actions.Checked import com.intellij.idea.plugin.hybris.common.utils.HybrisI18NBundleUtils -import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisImpexConsole import com.intellij.idea.plugin.hybris.tools.remote.console.actions.handler.HybrisConsoleExecuteValidateActionHandler +import com.intellij.idea.plugin.hybris.tools.remote.console.impl.HybrisImpexConsole import com.intellij.idea.plugin.hybris.tools.remote.console.view.HybrisTabs import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/handler/HybrisConsoleExecuteActionHandler.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/handler/HybrisConsoleExecuteActionHandler.kt index 158365a0f..b65f3b2cf 100644 --- a/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/handler/HybrisConsoleExecuteActionHandler.kt +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/handler/HybrisConsoleExecuteActionHandler.kt @@ -6,8 +6,8 @@ import com.intellij.execution.impl.ConsoleViewUtil import com.intellij.execution.ui.ConsoleViewContentType.* import com.intellij.idea.plugin.hybris.impex.file.ImpexFileType import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisConsole -import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisImpexMonitorConsole -import com.intellij.idea.plugin.hybris.tools.remote.console.SolrConsole +import com.intellij.idea.plugin.hybris.tools.remote.console.impl.HybrisImpexMonitorConsole +import com.intellij.idea.plugin.hybris.tools.remote.console.impl.HybrisSolrSearchConsole import com.intellij.idea.plugin.hybris.tools.remote.console.view.HybrisTabs import com.intellij.idea.plugin.hybris.tools.remote.http.impex.HybrisHttpResult import com.intellij.idea.plugin.hybris.tools.remote.http.impex.HybrisHttpResult.HybrisHttpResultBuilder.createResult @@ -48,7 +48,7 @@ class HybrisConsoleExecuteActionHandler(private val project: Project, console.clear() printSyntaxText(console, httpResult.output, ImpexFileType.getInstance()) } - is SolrConsole -> { + is HybrisSolrSearchConsole -> { console.clear() if (httpResult.hasError()) { printSyntaxText(console, httpResult.errorMessage, PlainTextFileType.INSTANCE) @@ -99,13 +99,14 @@ class HybrisConsoleExecuteActionHandler(private val project: Project, val console = tabbedPane.activeConsole() val consoleHistoryModel = ConsoleHistoryController.getController(console) - execute(console, consoleHistoryModel) + if (consoleHistoryModel != null) { + execute(console, consoleHistoryModel) + } } private fun execute(console: HybrisConsole, consoleHistoryController: ConsoleHistoryController) { - console.collectStatistics(); // Process input and add to history val document = console.currentEditor.document val textForHistory = document.text diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/handler/HybrisConsoleExecuteValidateActionHandler.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/handler/HybrisConsoleExecuteValidateActionHandler.kt index 972f446ad..1c767beb8 100644 --- a/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/handler/HybrisConsoleExecuteValidateActionHandler.kt +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/actions/handler/HybrisConsoleExecuteValidateActionHandler.kt @@ -6,8 +6,8 @@ import com.intellij.execution.impl.ConsoleViewUtil import com.intellij.execution.ui.ConsoleViewContentType.* import com.intellij.idea.plugin.hybris.impex.file.ImpexFileType import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisConsole -import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisImpexConsole -import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisImpexMonitorConsole +import com.intellij.idea.plugin.hybris.tools.remote.console.impl.HybrisImpexConsole +import com.intellij.idea.plugin.hybris.tools.remote.console.impl.HybrisImpexMonitorConsole import com.intellij.idea.plugin.hybris.tools.remote.console.view.HybrisTabs import com.intellij.idea.plugin.hybris.tools.remote.http.impex.HybrisHttpResult import com.intellij.idea.plugin.hybris.tools.remote.http.impex.HybrisHttpResult.HybrisHttpResultBuilder.createResult @@ -93,13 +93,14 @@ class HybrisConsoleExecuteValidateActionHandler(private val project: Project, val console = tabbedPane.activeConsole() val consoleHistoryModel = ConsoleHistoryController.getController(console) - execute(console, consoleHistoryModel) + if (consoleHistoryModel != null) { + execute(console, consoleHistoryModel) + } } private fun execute(console: HybrisConsole, consoleHistoryController: ConsoleHistoryController) { - console.collectStatistics(); // Process input and add to history val document = console.currentEditor.document diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/impl/HybrisFlexibleSearchConsole.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/console/impl/HybrisFlexibleSearchConsole.kt new file mode 100644 index 000000000..0a879b2fb --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/impl/HybrisFlexibleSearchConsole.kt @@ -0,0 +1,102 @@ +/* + * 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.tools.remote.console.impl + +import com.intellij.execution.console.ConsoleHistoryController +import com.intellij.execution.console.ConsoleRootType +import com.intellij.idea.plugin.hybris.common.HybrisConstants +import com.intellij.idea.plugin.hybris.flexibleSearch.FlexibleSearchLanguage +import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisConsole +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.ui.HybrisConsoleQueryPanel +import com.intellij.idea.plugin.hybris.tools.remote.http.HybrisHacHttpClient +import com.intellij.idea.plugin.hybris.tools.remote.http.impex.HybrisHttpResult +import com.intellij.openapi.project.Project +import com.intellij.ui.components.JBCheckBox +import com.intellij.ui.components.JBLabel +import com.intellij.vcs.log.ui.frame.WrappedFlowLayout +import java.awt.BorderLayout +import java.awt.Insets +import javax.swing.JPanel +import javax.swing.JSpinner +import javax.swing.SpinnerNumberModel +import javax.swing.border.EmptyBorder + +class HybrisFlexibleSearchConsole(project: Project) : HybrisConsole(project, HybrisConstants.FLEXIBLE_SEARCH_CONSOLE_TITLE, FlexibleSearchLanguage.getInstance()) { + + object MyConsoleRootType : ConsoleRootType("hybris.flexible.search.shell", null) + + private val panel = JPanel(WrappedFlowLayout(0, 0)) + + private val commitCheckbox = JBCheckBox() + private val commitLabel = JBLabel("Commit mode: ") + + private val plainSqlCheckbox = JBCheckBox() + private val plainSqlLabel = JBLabel("SQL: ") + + private val maxRowsSpinner = JSpinner(SpinnerNumberModel(10, 1, 100, 1)) + private val maxRowsLabel = JBLabel("Rows (max 100): ") + + private val labelInsets = Insets(0, 10, 0, 1) + + private val queryConsolePanel = HybrisConsoleQueryPanel(project, this, "FLEXIBLE_SEARCH") + + init { + createUI() + ConsoleHistoryController(MyConsoleRootType, "hybris.flexible.search.shell", this).install() + } + + private fun createUI() { + initCommitElements() + initPlainSqlElements() + initMaxRowsElements() + + panel.add(queryConsolePanel) + add(panel, BorderLayout.NORTH) + isEditable = true + } + + private fun initCommitElements() { + commitLabel.border = EmptyBorder(labelInsets) + panel.add(commitLabel) + panel.add(commitCheckbox) + } + + private fun initPlainSqlElements() { + plainSqlLabel.border = EmptyBorder(labelInsets) + panel.add(plainSqlLabel) + panel.add(plainSqlCheckbox) + } + + private fun initMaxRowsElements() { + maxRowsLabel.border = EmptyBorder(labelInsets) + panel.add(maxRowsLabel) + panel.add(maxRowsSpinner) + } + + override fun execute(query: String): HybrisHttpResult { + return HybrisHacHttpClient.getInstance(project) + .executeFlexibleSearch( + project, + commitCheckbox.isSelected, + plainSqlCheckbox.isSelected, + maxRowsSpinner.value.toString(), + query + ) + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/impl/HybrisGroovyConsole.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/console/impl/HybrisGroovyConsole.kt new file mode 100644 index 000000000..a9a60d9cb --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/impl/HybrisGroovyConsole.kt @@ -0,0 +1,76 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.tools.remote.console.impl + +import com.intellij.execution.console.ConsoleHistoryController +import com.intellij.execution.console.ConsoleRootType +import com.intellij.idea.plugin.hybris.common.HybrisConstants +import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisConsole +import com.intellij.idea.plugin.hybris.tools.remote.http.AbstractHybrisHacHttpClient +import com.intellij.idea.plugin.hybris.tools.remote.http.HybrisHacHttpClient +import com.intellij.idea.plugin.hybris.tools.remote.http.impex.HybrisHttpResult +import com.intellij.openapi.project.Project +import com.intellij.ui.components.JBCheckBox +import com.intellij.ui.components.JBLabel +import org.jetbrains.plugins.groovy.GroovyLanguage +import java.awt.BorderLayout +import java.awt.FlowLayout +import javax.swing.JPanel +import javax.swing.JSpinner +import javax.swing.SpinnerNumberModel +import javax.swing.border.EmptyBorder + +class HybrisGroovyConsole(project: Project) : HybrisConsole(project, HybrisConstants.GROOVY_CONSOLE_TITLE, GroovyLanguage) { + + object MyConsoleRootType : ConsoleRootType("hybris.groovy.shell", null) + + private val panel = JPanel(FlowLayout(FlowLayout.LEFT, 0, 0)) + private val commitCheckbox = JBCheckBox() + private val commitLabel = JBLabel("Commit mode: ") + + private val timeoutSpinner = JSpinner(SpinnerNumberModel( + AbstractHybrisHacHttpClient.DEFAULT_HAC_TIMEOUT / 1000, 1, 3600, 10)) + private val timeoutLabel = JBLabel("Timeout (seconds): ") + + init { + createUI() + ConsoleHistoryController(MyConsoleRootType, "hybris.groovy.shell", this).install() + } + + private fun createUI() { + commitLabel.border = EmptyBorder(5, 10, 5, 3) + commitCheckbox.border = EmptyBorder(0, 0, 0, 5) + panel.add(commitLabel) + panel.add(commitCheckbox) + add(panel, BorderLayout.NORTH) + initTimeoutSpinner(); + isEditable = true + } + + private fun initTimeoutSpinner() { + commitLabel.border = EmptyBorder(5, 10, 5, 3) + panel.add(timeoutLabel) + panel.add(timeoutSpinner) + } + + override fun execute(query: String): HybrisHttpResult { + val timeout = Integer.valueOf(timeoutSpinner.value.toString()) * 1000 + return HybrisHacHttpClient.getInstance(project).executeGroovyScript(project, query, commitCheckbox.isSelected, timeout) + } +} diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/impl/HybrisImpexConsole.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/console/impl/HybrisImpexConsole.kt new file mode 100644 index 000000000..c9c23ad53 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/impl/HybrisImpexConsole.kt @@ -0,0 +1,111 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.tools.remote.console.impl + +import com.intellij.execution.console.ConsoleHistoryController +import com.intellij.execution.console.ConsoleRootType +import com.intellij.idea.plugin.hybris.common.HybrisConstants +import com.intellij.idea.plugin.hybris.impex.ImpexLanguage +import com.intellij.idea.plugin.hybris.tools.remote.console.CatalogVersionOption +import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisConsole +import com.intellij.idea.plugin.hybris.tools.remote.console.preprocess.HybrisConsolePreProcessorCatalogVersion +import com.intellij.idea.plugin.hybris.tools.remote.http.HybrisHacHttpClient +import com.intellij.idea.plugin.hybris.tools.remote.http.impex.HybrisHttpResult +import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.project.Project +import com.intellij.openapi.ui.ComboBox +import com.intellij.ui.SimpleListCellRenderer +import com.intellij.ui.components.JBCheckBox +import com.intellij.ui.components.JBLabel +import com.intellij.vcs.log.ui.frame.WrappedFlowLayout +import org.apache.commons.lang.StringUtils +import java.awt.BorderLayout +import javax.swing.JPanel +import javax.swing.border.EmptyBorder + +class HybrisImpexConsole(project: Project) : HybrisConsole(project, HybrisConstants.IMPEX_CONSOLE_TITLE, ImpexLanguage.getInstance()) { + + object MyConsoleRootType : ConsoleRootType("hybris.impex.shell", null) + + private val panel = JPanel(WrappedFlowLayout(0, 0)) + private val catalogVersionLabel = JBLabel("Catalog Version") + + val catalogVersionComboBox = ComboBox(arrayOf( + CatalogVersionOption("doesn't change", StringUtils.EMPTY), + CatalogVersionOption("changes to ${HybrisConstants.IMPEX.CATALOG_VERSION_STAGED}", HybrisConstants.IMPEX.CATALOG_VERSION_STAGED), + CatalogVersionOption("changes to ${HybrisConstants.IMPEX.CATALOG_VERSION_ONLINE}", HybrisConstants.IMPEX.CATALOG_VERSION_ONLINE) + )) + + private val legacyModeCheckbox = JBCheckBox() + private val legacyModeLabel = JBLabel("Legacy mode: ") + + override fun preProcessors() = listOf(HybrisConsolePreProcessorCatalogVersion()) + + init { + createUI() + ConsoleHistoryController(MyConsoleRootType, "hybris.impex.shell", this).install() + } + + private fun createUI() { + catalogVersionComboBox.renderer = SimpleListCellRenderer.create("...") { it.name } + catalogVersionComboBox.addItemListener { + preProcessors().forEach { processor -> + ApplicationManager.getApplication().invokeLater { this.setInputText(processor.process(this)) } + } + } + catalogVersionLabel.border = EmptyBorder(0, 10, 0, 5) + panel.add(catalogVersionLabel) + panel.add(catalogVersionComboBox) + legacyModeLabel.border = EmptyBorder(0, 10, 0, 5) + legacyModeCheckbox.border = EmptyBorder(0, 0, 0, 5) + panel.add(legacyModeLabel) + panel.add(legacyModeCheckbox) + + add(panel, BorderLayout.NORTH) + isEditable = true + } + + override fun execute(query: String): HybrisHttpResult { + val settings = mutableMapOf( + "scriptContent" to query, + "validationEnum" to "IMPORT_STRICT", + "encoding" to "UTF-8", + "maxThreads" to "4", + "_legacyMode" to "on" + ) + if (legacyModeCheckbox.isSelected) { + settings["legacyMode"] = "true" + } + return HybrisHacHttpClient.getInstance(project).importImpex(project, settings) + } + + fun validate(text: String): HybrisHttpResult { + val settings = mutableMapOf( + "scriptContent" to text, + "validationEnum" to "IMPORT_STRICT", + "encoding" to "UTF-8", + "maxThreads" to "4", + "_legacyMode" to "on" + ) + if (legacyModeCheckbox.isSelected) { + settings["legacyMode"] = "true" + } + return HybrisHacHttpClient.getInstance(project).validateImpex(project, settings) + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/impl/HybrisImpexMonitorConsole.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/console/impl/HybrisImpexMonitorConsole.kt new file mode 100644 index 000000000..fa026d389 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/impl/HybrisImpexMonitorConsole.kt @@ -0,0 +1,93 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.tools.remote.console.impl + +import com.intellij.execution.console.ConsoleHistoryController +import com.intellij.execution.console.ConsoleRootType +import com.intellij.idea.plugin.hybris.common.HybrisConstants +import com.intellij.idea.plugin.hybris.impex.ImpexLanguage +import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent +import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisConsole +import com.intellij.idea.plugin.hybris.tools.remote.console.TimeOption +import com.intellij.idea.plugin.hybris.tools.remote.http.impex.HybrisHttpResult +import com.intellij.idea.plugin.hybris.tools.remote.http.monitorImpexFiles +import com.intellij.openapi.project.Project +import com.intellij.openapi.ui.ComboBox +import com.intellij.openapi.util.io.FileUtil +import com.intellij.ui.SimpleListCellRenderer +import com.intellij.ui.components.JBLabel +import org.apache.batik.ext.swing.GridBagConstants +import java.awt.BorderLayout +import java.awt.GridBagConstraints +import java.awt.GridBagLayout +import java.io.File +import java.util.concurrent.TimeUnit +import javax.swing.JPanel +import javax.swing.border.EmptyBorder + +class HybrisImpexMonitorConsole(project: Project) : HybrisConsole(project, HybrisConstants.IMPEX_MONITOR_CONSOLE_TITLE, ImpexLanguage.getInstance()) { + + object MyConsoleRootType : ConsoleRootType("hybris.impex.monitor.shell", null) + + private val panel = JPanel() + private val timeComboBox = ComboBox(arrayOf( + TimeOption("in the last 5 minutes", 5, TimeUnit.MINUTES), + TimeOption("in the last 10 minutes", 10, TimeUnit.MINUTES), + TimeOption("in the last 15 minutes", 15, TimeUnit.MINUTES), + TimeOption("in the last 30 minutes", 30, TimeUnit.MINUTES), + TimeOption("in the last 1 hour", 1, TimeUnit.HOURS) + )) + private val workingDirLabel = JBLabel("Hybris Data Folder: ${obtainDataFolder(project)}") + private val timeOptionLabel = JBLabel("Imported Impex") + + init { + createUI() + ConsoleHistoryController(MyConsoleRootType, "hybris.impex.monitor.shell", this).install() + } + + private fun createUI() { + timeComboBox.renderer = SimpleListCellRenderer.create("...") { it.name } + isConsoleEditorEnabled = false + panel.layout = GridBagLayout() + val constraints = GridBagConstraints() + constraints.weightx = 0.0 + timeOptionLabel.border = EmptyBorder(0, 10, 0, 5) + panel.add(timeOptionLabel) + panel.add(timeComboBox, constraints) + constraints.weightx = 1.0 + constraints.fill = GridBagConstants.HORIZONTAL + workingDirLabel.border = EmptyBorder(0, 10, 0, 10) + panel.add(workingDirLabel, constraints) + add(panel, BorderLayout.NORTH) + isEditable = true + } + + private fun obtainDataFolder(project: Project): String { + val settings = HybrisProjectSettingsComponent.getInstance(project).state + return FileUtil.toCanonicalPath("${project.basePath}${File.separatorChar}${settings.hybrisDirectory}${File.separatorChar}${HybrisConstants.HYBRIS_DATA_DIRECTORY}") + } + + private fun timeOption() = (timeComboBox.selectedItem as TimeOption) + + private fun workingDir() = obtainDataFolder(project) + + override fun execute(query: String): HybrisHttpResult { + return monitorImpexFiles(timeOption().value, timeOption().unit, workingDir()) + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/impl/HybrisSolrSearchConsole.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/console/impl/HybrisSolrSearchConsole.kt new file mode 100644 index 000000000..3194257ca --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/impl/HybrisSolrSearchConsole.kt @@ -0,0 +1,174 @@ +/* + * 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.tools.remote.console.impl + +import com.intellij.execution.console.ConsoleHistoryController +import com.intellij.execution.console.ConsoleRootType +import com.intellij.idea.plugin.hybris.common.HybrisConstants +import com.intellij.idea.plugin.hybris.common.utils.HybrisI18NBundleUtils +import com.intellij.idea.plugin.hybris.notifications.NotificationUtil +import com.intellij.idea.plugin.hybris.settings.HybrisRemoteConnectionSettings +import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisConsole +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.ui.HybrisConsoleQueryPanel +import com.intellij.idea.plugin.hybris.tools.remote.http.HybrisHacHttpClient +import com.intellij.idea.plugin.hybris.tools.remote.http.impex.HybrisHttpResult +import com.intellij.idea.plugin.hybris.tools.remote.http.solr.SolrCoreData +import com.intellij.idea.plugin.hybris.tools.remote.http.solr.SolrHttpClient +import com.intellij.idea.plugin.hybris.tools.remote.http.solr.SolrQueryObject +import com.intellij.notification.NotificationType +import com.intellij.openapi.fileTypes.PlainTextLanguage +import com.intellij.openapi.project.Project +import com.intellij.openapi.ui.ComboBox +import com.intellij.ui.CollectionComboBoxModel +import com.intellij.ui.SimpleListCellRenderer +import com.intellij.ui.components.JBLabel +import com.intellij.util.castSafelyTo +import com.intellij.vcs.log.ui.frame.WrappedFlowLayout +import com.jetbrains.rd.swing.selectedItemProperty +import com.jetbrains.rd.util.reactive.adviseEternal +import org.apache.commons.collections4.CollectionUtils +import org.apache.solr.client.solrj.SolrServerException +import java.awt.BorderLayout +import java.awt.Dimension +import java.awt.Insets +import java.util.* +import javax.swing.JButton +import javax.swing.JPanel +import javax.swing.JSpinner +import javax.swing.SpinnerNumberModel +import javax.swing.border.EmptyBorder + +class HybrisSolrSearchConsole(project: Project) : HybrisConsole(project, HybrisConstants.SOLR_SEARCH_CONSOLE_TITLE, PlainTextLanguage.INSTANCE) { + + object MyConsoleRootType : ConsoleRootType("hybris.solr.search.shell", null) + + private val panel = JPanel(WrappedFlowLayout(0, 0)) + private val docs = "Docs: " + + private val coresLabel = JBLabel("Select core: ") + private val docsLabel = JBLabel(docs) + private val coresComboBox = ComboBox(CollectionComboBoxModel(retrieveListOfCores()), 270) + private val reloadCoresButton = JButton("Reload") + + private val maxRowsLabel = JBLabel("Rows (max 500): ") + private val maxRowsSpinner = JSpinner(SpinnerNumberModel(10, 1, 500, 1)) + + private val labelInsets = Insets(0, 10, 0, 1) + + private val queryConsolePanel = HybrisConsoleQueryPanel(project, this, "SOLR") + + init { + createUI() + ConsoleHistoryController(MyConsoleRootType, "hybris.solr.search.shell", this).install() + } + + override fun connectionType(): HybrisRemoteConnectionSettings.Type { + return HybrisRemoteConnectionSettings.Type.SOLR + } + + private fun createUI() { + initCoresElements() + initReloadCoresButton() + initDocsElements() + initMaxRowsElements() + + panel.add(queryConsolePanel) + add(panel, BorderLayout.NORTH) + isEditable = true + prompt = "q=" + } + + private fun initCoresElements() { + coresLabel.border = EmptyBorder(labelInsets) + coresComboBox.renderer = SimpleListCellRenderer.create("...") { it.core } + panel.add(coresLabel) + panel.add(coresComboBox) + } + + private fun initReloadCoresButton() { + reloadCoresButton.border = EmptyBorder(0, 0, 0, 0) + reloadCoresButton.toolTipText = HybrisI18NBundleUtils.message("hybris.solr.search.console.reload.cores.button.tooltip") + reloadCoresButton.preferredSize = Dimension(60, 25) + panel.add(reloadCoresButton) + reloadCoresButton.addActionListener { + coresComboBox.model = CollectionComboBoxModel(retrieveListOfCores()) + } + } + + private fun initMaxRowsElements() { + maxRowsLabel.border = EmptyBorder(labelInsets) + panel.add(maxRowsLabel) + panel.add(maxRowsSpinner) + } + + private fun initDocsElements() { + docsLabel.border = EmptyBorder(labelInsets) + panel.add(docsLabel) + coresComboBox.selectedItemProperty().adviseEternal { setDocsLabelCount(it) } + } + + override fun printDefaultText() { + this.setInputText("*:*") + } + + override fun onSelection() { + if (coresComboBox.selectedItem == null) { + val cores = retrieveListOfCores() + if (CollectionUtils.isNotEmpty(cores)) { + coresComboBox.model = CollectionComboBoxModel(cores) + setDocsLabelCount(coresComboBox.selectedItem?.castSafelyTo()) + } + } + } + + private fun setDocsLabelCount(data: SolrCoreData?) { + if (data == null) { + docsLabel.text = "$docs ..." + } else { + docsLabel.text = docs + data.docs + } + } + + private fun retrieveListOfCores() : List { + return try { + SolrHttpClient.getInstance(project).coresData(project).toList() + } catch (e : SolrServerException) { + NotificationUtil.NOTIFICATION_GROUP.createNotification( + HybrisI18NBundleUtils.message("hybris.toolwindow.hac.test.connection.title"), + HybrisI18NBundleUtils.message( + "hybris.toolwindow.solr.test.connection.fail", + e.localizedMessage + ), + NotificationType.WARNING + ).notify(project) + emptyList() + } + } + + override fun execute(query: String): HybrisHttpResult { + return HybrisHacHttpClient.getInstance(project).executeSolrSearch(project, buildSolrQueryObject(query)) + } + + private fun buildSolrQueryObject(query: String): Optional { + return Optional.ofNullable(coresComboBox.selectedItem) + .map { it as SolrCoreData } + .map { it.core } + .map { SolrQueryObject(query, it, maxRowsSpinner.value as Int) } + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/cache/HybrisConsoleRegionsCache.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/cache/HybrisConsoleRegionsCache.java new file mode 100644 index 000000000..c6c86f4fa --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/cache/HybrisConsoleRegionsCache.java @@ -0,0 +1,38 @@ +/* + * 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.tools.remote.console.persistence.cache; + +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.pojo.Region; +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; + +import java.util.Map; + +public interface HybrisConsoleRegionsCache { + + static HybrisConsoleRegionsCache getInstance(@NotNull Project project) { + return ServiceManager.getService(project, HybrisConsoleRegionsCache.class); + } + + Map getRegions(); + + Region findRegion(final String regionName); + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/cache/impl/HybrisConsoleInMemoryRegionsCache.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/cache/impl/HybrisConsoleInMemoryRegionsCache.java new file mode 100644 index 000000000..02d3c8de7 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/cache/impl/HybrisConsoleInMemoryRegionsCache.java @@ -0,0 +1,52 @@ +/* + * 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.tools.remote.console.persistence.cache.impl; + +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.cache.HybrisConsoleRegionsCache; +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.pojo.Region; + +import java.util.HashMap; +import java.util.Map; + +public class HybrisConsoleInMemoryRegionsCache implements HybrisConsoleRegionsCache { + + private static final String SOLR = "SOLR"; + private static final String FLEXIBLE_SEARCH = "FLEXIBLE_SEARCH"; + + + private Map regions; + + public HybrisConsoleInMemoryRegionsCache() { + this.regions = new HashMap<>(2); + + regions.put(SOLR, new Region(SOLR, 7)); + regions.put(FLEXIBLE_SEARCH, new Region(FLEXIBLE_SEARCH, 7)); + } + + @Override + public Map getRegions() { + return regions; + } + + @Override + public Region findRegion(final String regionName) { + return regions.get(regionName); + } + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/pojo/Region.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/pojo/Region.java new file mode 100644 index 000000000..b351b75ff --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/pojo/Region.java @@ -0,0 +1,66 @@ +/* + * 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.tools.remote.console.persistence.pojo; + +public class Region { + + private String name; + private RegionEntityFIFOCache entities; + private int maxNumberEntities; + + public Region() { + } + + public Region(String name) { + this.maxNumberEntities = -1; + this.entities = new RegionEntityFIFOCache<>(maxNumberEntities); + this.name = name; + } + + public Region(String name, int maxNumberEntities) { + this(name); + this.maxNumberEntities = maxNumberEntities; + this.entities = new RegionEntityFIFOCache<>(maxNumberEntities); + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public RegionEntityFIFOCache getEntities() { + return entities; + } + + public void setEntities(final RegionEntityFIFOCache entities) { + this.entities = entities; + } + + public int getMaxNumberEntities() { + return maxNumberEntities; + } + + public void setMaxNumberEntities(final int maxNumberEntities) { + this.maxNumberEntities = maxNumberEntities; + } + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/pojo/RegionEntity.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/pojo/RegionEntity.java new file mode 100644 index 000000000..0fad59102 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/pojo/RegionEntity.java @@ -0,0 +1,75 @@ +/* + * 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.tools.remote.console.persistence.pojo; + +import java.util.Objects; + +public class RegionEntity { + + private String id; + private String name; + private T body; + + public RegionEntity() { + } + + public RegionEntity(String id, String name, T body) { + this.id = id; + this.name = name; + this.body = body; + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public T getBody() { + return body; + } + + public void setBody(final T body) { + this.body = body; + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final RegionEntity that = (RegionEntity) o; + return id.equals(that.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/pojo/RegionEntityFIFOCache.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/pojo/RegionEntityFIFOCache.java new file mode 100644 index 000000000..0342b7ddf --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/pojo/RegionEntityFIFOCache.java @@ -0,0 +1,47 @@ +/* + * 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.tools.remote.console.persistence.pojo; + +import java.util.LinkedHashMap; +import java.util.Map; + +public class RegionEntityFIFOCache extends LinkedHashMap> { + + private static final long serialVersionUID = 2873734604163564844L; + private static final int DEFAULT_VALUE = -1; + + private int maxNumberEntities; + + public RegionEntityFIFOCache(){ + this.maxNumberEntities = DEFAULT_VALUE; + } + + public RegionEntityFIFOCache(int maxNumberEntities) { + this.maxNumberEntities = maxNumberEntities; + } + + @Override + protected boolean removeEldestEntry(final Map.Entry> eldest) { + if (maxNumberEntities < 0) { + return false; + } + return this.size() > maxNumberEntities; + } + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/ConsolePersistenceService.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/ConsolePersistenceService.java new file mode 100644 index 000000000..0f4e978c7 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/ConsolePersistenceService.java @@ -0,0 +1,35 @@ +/* + * 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.tools.remote.console.persistence.services; + +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; + +public interface ConsolePersistenceService { + + static ConsolePersistenceService getInstance(@NotNull Project project) { + return ServiceManager.getService(project, ConsolePersistenceService.class); + } + + void loadPersistedQueries(); + + void persistQueryRegions(); + +} diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/RegionEntityService.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/RegionEntityService.java new file mode 100644 index 000000000..86027a9a9 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/RegionEntityService.java @@ -0,0 +1,44 @@ +/* + * 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.tools.remote.console.persistence.services; + +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.pojo.RegionEntity; +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; + +import java.util.Map; +import java.util.Optional; + +public interface RegionEntityService { + + static RegionEntityService getInstance(@NotNull Project project) { + return ServiceManager.getService(project, RegionEntityService.class); + } + + RegionEntity save(String regionName, String entityName, T entityBody); + + Optional find(String entityId); + + void remove(String entityId); + + Map getAll(String regionName); + + void removeAll(String regionName); +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/RegionPersistenceService.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/RegionPersistenceService.java new file mode 100644 index 000000000..d2675462a --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/RegionPersistenceService.java @@ -0,0 +1,38 @@ +/* + * 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.tools.remote.console.persistence.services; + +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; + +import java.io.IOException; +import java.nio.file.Path; + +public interface RegionPersistenceService { + + static RegionPersistenceService getInstance(@NotNull Project project) { + return ServiceManager.getService(project, RegionPersistenceService.class); + } + + void writeRegionData(Path destination, String regionName); + + void loadRegionData(Path source, String regionName) throws IOException; + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/RegionService.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/RegionService.java new file mode 100644 index 000000000..81ddfe6ed --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/RegionService.java @@ -0,0 +1,43 @@ +/* + * 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.tools.remote.console.persistence.services; + +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.pojo.Region; +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; + +import java.util.Map; + +public interface RegionService { + + static RegionService getInstance(@NotNull Project project) { + return ServiceManager.getService(project, RegionService.class); + } + + Region findOrCreate(final String name); + + void save(final Region region); + + void remove(final String name); + + Map getAll(); + + void removeAll(); +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/impl/DefaultConsolePersistenceService.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/impl/DefaultConsolePersistenceService.java new file mode 100644 index 000000000..3d83ecf2f --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/impl/DefaultConsolePersistenceService.java @@ -0,0 +1,114 @@ +/* + * 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.tools.remote.console.persistence.services.impl; + +import com.intellij.idea.plugin.hybris.common.HybrisConstants; +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.cache.HybrisConsoleRegionsCache; +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.services.ConsolePersistenceService; +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.services.RegionPersistenceService; +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.ui.HybrisConsoleNotificationUtil; +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.ui.listeners.HybrisConsoleQueryPanelEventManager; +import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.project.ProjectUtil; +import com.intellij.openapi.util.io.FileUtil; +import org.jetbrains.annotations.NotNull; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +public class DefaultConsolePersistenceService implements ConsolePersistenceService { + + private static final Logger LOG = Logger.getInstance(ConsolePersistenceService.class); + + private static final String SOLR = "SOLR"; + private static final String FLEXIBLE_SEARCH = "FLEXIBLE_SEARCH"; + + private final Project project; + private final RegionPersistenceService regionPersistenceService; + private final HybrisConsoleRegionsCache hybrisConsoleRegionsCache; + + public DefaultConsolePersistenceService( + final Project project, + final RegionPersistenceService regionPersistenceService, + final HybrisConsoleRegionsCache hybrisConsoleRegionsCache + ) { + this.project = project; + this.regionPersistenceService = regionPersistenceService; + this.hybrisConsoleRegionsCache = hybrisConsoleRegionsCache; + } + + @Override + public void loadPersistedQueries() { + final Path directoryPath = Paths.get(getStoragePath()); + + if (Files.exists(directoryPath)) { + try { + loadEntitiesFromFile(regionPersistenceService, getStoragePath()); + } catch (IOException e) { + LOG.error(e); + } + HybrisConsoleQueryPanelEventManager.getInstance(project).notifyListeners(); + return; + } + FileUtil.createDirectory(new File(String.valueOf(directoryPath))); + HybrisConsoleQueryPanelEventManager.getInstance(project).notifyListeners(); + } + + @Override + public void persistQueryRegions() { + final String projectPath = getStoragePath(); + regionPersistenceService.writeRegionData(getRegionPath(projectPath, SOLR), SOLR); + regionPersistenceService.writeRegionData(getRegionPath(projectPath, FLEXIBLE_SEARCH), FLEXIBLE_SEARCH); + } + + @NotNull + private String getStoragePath() { + return ProjectUtil.guessProjectDir(project).getPath() + HybrisConstants.QUERY_STORAGE_FOLDER_PATH; + } + + private void loadEntitiesFromFile(final RegionPersistenceService loadService, final String path) throws + IOException { + loadEntityFromFile(loadService, getRegionPath(path, SOLR), SOLR); + loadEntityFromFile(loadService, getRegionPath(path, FLEXIBLE_SEARCH), FLEXIBLE_SEARCH); + } + + private void loadEntityFromFile( + final RegionPersistenceService loadService, + final Path path, + final String regionName + ) throws IOException { + try { + loadService.loadRegionData(path, regionName); + } catch (IllegalArgumentException e) { + final String notificationTitle = e.getMessage(); + final String notificationName = "Only 'FLEXIBLE_SEARCH' or 'SOLR' are allowable regions."; + HybrisConsoleNotificationUtil.displayWarningNotification(notificationTitle, notificationName, project); + } + } + + @NotNull + private Path getRegionPath(final String path, final String regionName) { + return Paths.get(path + File.separator + regionName.toLowerCase() + "_region.json"); + } + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/impl/DefaultJsonRegionPersistenceService.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/impl/DefaultJsonRegionPersistenceService.java new file mode 100644 index 000000000..ec56e378a --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/impl/DefaultJsonRegionPersistenceService.java @@ -0,0 +1,53 @@ +/* + * 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.tools.remote.console.persistence.services.impl; + +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.pojo.Region; +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.services.RegionPersistenceService; +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.services.RegionService; +import com.intellij.openapi.project.Project; + +import java.nio.file.Files; +import java.nio.file.Path; + +public class DefaultJsonRegionPersistenceService implements RegionPersistenceService { + + private Project project; + private RegionService regionService; + + public DefaultJsonRegionPersistenceService(final RegionService regionService, final Project project) { + this.project = project; + this.regionService = regionService; + } + + @Override + public void writeRegionData(final Path destination, final String regionName) { + JsonIOUtil.getInstance(project).persistData(destination, regionService.findOrCreate(regionName)); + } + + @Override + public void loadRegionData(final Path source, final String regionName) { + if (Files.exists(source) && Files.isRegularFile(source)) { + JsonIOUtil.getInstance(project) + .loadPersistedData(source, Region.class) + .ifPresent(regionService::save); + } + } + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/impl/DefaultRegionEntityService.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/impl/DefaultRegionEntityService.java new file mode 100644 index 000000000..1efb312fa --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/impl/DefaultRegionEntityService.java @@ -0,0 +1,83 @@ +/* + * 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.tools.remote.console.persistence.services.impl; + +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.cache.HybrisConsoleRegionsCache; +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.pojo.Region; +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.pojo.RegionEntity; +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.services.RegionEntityService; +import com.intellij.util.Base64; + +import java.util.Collections; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; + +public class DefaultRegionEntityService implements RegionEntityService { + + private static final String SPLIT_SIGN = "_"; + + private HybrisConsoleRegionsCache cache; + + public DefaultRegionEntityService(HybrisConsoleRegionsCache cache) { + this.cache = cache; + } + + @Override + public RegionEntity save(final String regionName, final String entityName, final T entityBody) { + String uid = Base64.encode(regionName.getBytes()) + SPLIT_SIGN + UUID.randomUUID(); + RegionEntity createdEntity = new RegionEntity<>(uid, entityName, entityBody); + + getRegionByName(regionName).getEntities().put(uid, createdEntity); + return createdEntity; + } + + @Override + public Optional find(final String entityId) { + Region region = getRegionByEntityId(entityId); + Map entities = region.getEntities(); + return Optional.ofNullable(entities.get(entityId)); + } + + @Override + public void remove(final String entityId) { + Region region = getRegionByEntityId(entityId); + region.getEntities().remove(entityId); + } + + @Override + public Map getAll(final String regionName) { + return Collections.unmodifiableMap(cache.findRegion(regionName).getEntities()); + } + + @Override + public void removeAll(final String regionName) { + cache.findRegion(regionName).getEntities().clear(); + } + + private Region getRegionByEntityId(final String entityId) { + String regionName = new String(Base64.decode(entityId.split(SPLIT_SIGN)[0])); + return getRegionByName(regionName); + } + + private Region getRegionByName(final String regionName) { + return Optional.ofNullable(cache.findRegion(regionName)) + .orElseThrow(() -> new IllegalStateException("Region with name: " + regionName + " doesn't exist.")); + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/impl/DefaultRegionService.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/impl/DefaultRegionService.java new file mode 100644 index 000000000..3036df87f --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/impl/DefaultRegionService.java @@ -0,0 +1,75 @@ +/* + * 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.tools.remote.console.persistence.services.impl; + +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.cache.HybrisConsoleRegionsCache; +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.pojo.Region; +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.services.RegionService; +import org.jetbrains.annotations.NotNull; + +import java.util.Map; +import java.util.function.BiFunction; + +public class DefaultRegionService implements RegionService { + + private HybrisConsoleRegionsCache cache; + + public DefaultRegionService(HybrisConsoleRegionsCache cache) { + this.cache = cache; + } + + @Override + public Region findOrCreate(final String regionName) { + return cache.getRegions().computeIfAbsent(regionName, Region::new); + } + + @Override + public void save(final Region regionFromFile) { + Map existingRegions = cache.getRegions(); + final String regionName = regionFromFile.getName(); + if (existingRegions.containsKey(regionName)) { + existingRegions.compute(regionName, getRegionWithEntitiesBiFunction(regionFromFile)); + } else { + throw new IllegalArgumentException("UNKNOWN REGION: " + regionFromFile.getName()); + } + } + + @NotNull + private BiFunction getRegionWithEntitiesBiFunction(final Region region) { + return (name, reg) -> { + reg.getEntities().putAll(region.getEntities()); + return reg; + }; + } + + @Override + public void remove(final String name) { + cache.getRegions().remove(name); + } + + @Override + public Map getAll() { + return cache.getRegions(); + } + + @Override + public void removeAll() { + cache.getRegions().clear(); + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/impl/JsonIOUtil.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/impl/JsonIOUtil.java new file mode 100644 index 000000000..c6483a31c --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/services/impl/JsonIOUtil.java @@ -0,0 +1,78 @@ +/* + * 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.tools.remote.console.persistence.services.impl; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.io.FileUtil; +import org.jetbrains.annotations.NotNull; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Collections; +import java.util.Optional; + +public class JsonIOUtil { + + private static final Logger LOG = Logger.getInstance(DefaultJsonRegionPersistenceService.class); + + private final ObjectMapper mapper; + + private JsonIOUtil() { + mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.INDENT_OUTPUT); + } + + static JsonIOUtil getInstance(@NotNull Project project) { + return ServiceManager.getService(project, JsonIOUtil.class); + } + + public void persistData(@NotNull final Path destination, @NotNull final T data) { + FileUtil.createIfDoesntExist(new File(String.valueOf(destination))); + try { + Files.write(destination, Collections.singleton(mapper.writeValueAsString(data))); + } catch (IOException e) { + LOG.error(e); + } + } + + public Optional loadPersistedData(@NotNull final Path source, final Class clazz) { + if (Files.exists(source)) { + try { + return Optional.of(readDataFromFile(source, clazz)); + } catch (IOException e) { + throw new IllegalStateException(String.format( + "Path [ %s ] is not valid source file path", + source + )); + } + } + return Optional.empty(); + } + + private T readDataFromFile(@NotNull final Path filePath, final Class clazz) throws IOException { + final byte[] jsonData = Files.readAllBytes(filePath); + return mapper.readValue(jsonData, clazz); + } +} diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/HybrisConsoleNotificationUtil.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/HybrisConsoleNotificationUtil.java new file mode 100644 index 000000000..d0eb8bd4b --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/HybrisConsoleNotificationUtil.java @@ -0,0 +1,38 @@ +/* + * 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.tools.remote.console.persistence.ui; + +import com.intellij.idea.plugin.hybris.notifications.NotificationUtil; +import com.intellij.notification.NotificationType; +import com.intellij.openapi.project.Project; + +public class HybrisConsoleNotificationUtil { + + public static void displayWarningNotification( + final String notificationTitle, + final String notificationName, + Project project + ) { + NotificationUtil.NOTIFICATION_GROUP.createNotification( + notificationTitle, + notificationName, + NotificationType.WARNING + ).notify(project); + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/HybrisConsoleQueryPanel.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/HybrisConsoleQueryPanel.kt new file mode 100644 index 000000000..8965668e0 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/HybrisConsoleQueryPanel.kt @@ -0,0 +1,192 @@ +/* + * 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.tools.remote.console.persistence.ui + +import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisConsole +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.pojo.RegionEntity +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.services.RegionEntityService +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.services.RegionService +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.ui.listeners.HybrisConsoleEventListener +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.ui.listeners.HybrisConsoleQueryBodyDocumentListener +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.ui.listeners.HybrisConsoleQueryPanelEventManager +import com.intellij.openapi.project.Project +import com.intellij.openapi.ui.ComboBox +import com.intellij.openapi.util.IconLoader +import com.intellij.util.ReflectionUtil +import java.awt.Dimension +import java.awt.event.KeyAdapter +import java.awt.event.KeyEvent +import javax.swing.DefaultComboBoxModel +import javax.swing.Icon +import javax.swing.JButton +import javax.swing.JPanel +import javax.swing.border.EmptyBorder + +class HybrisConsoleQueryPanel(private val project: Project, private val console: HybrisConsole, region: String) : JPanel() { + + private val saveButton = JButton(getIcon("/icons/menu-saveall.svg")) + private val loadButton = JButton(getIcon("/icons/upload.svg")) + private val removeButton = JButton(getIcon("/icons/delete.png")) + + private val regionEntityService = RegionEntityService.getInstance(project) + private val regionService = RegionService.getInstance(project) + private val region = regionService.findOrCreate(region) + + private var regionEntitiesComboBox = ComboBox>(emptyArray(), 200) + + private val queryNamePlaceholder = "Query Name (max length: 25)" + + private val queryNameTextField = HybrisConsoleQueryTextField(queryNamePlaceholder) + + private val maxPossibleItemsNumber = this.region.maxNumberEntities + private val maxQueryBodyLength = 300 + private val maxQueryNameLength = 25 + private val queryBodyNotificationTitle = "Query is too long" + private val queryNameNotificationTitle = "Query Name is too long" + private val queryBodyNotificationName = "Query can't contain more than $maxQueryBodyLength symbols" + private val queryNameNotificationName = "Query Name can't contain more than $maxQueryNameLength symbols" + + init { + addComponentsToPanel() + } + + private fun addComponentsToPanel() { + HybrisConsoleQueryPanelEventManager.getInstance(project).addListener(HybrisConsoleQueryPanelListener()) + addComboBox() + saveLastQuery() + loadQueryBodyToConsole() + removeQuery() + } + + private fun addComboBox() { + regionEntitiesComboBox = ComboBox(regionEntityService.getAll(this.region.name).values.toTypedArray(), 150) + regionEntitiesComboBox.renderer = RegionEntityCellRenderer() + add(regionEntitiesComboBox,0) + regionEntitiesComboBox.addActionListener { + run { + removeButton.isEnabled = regionEntitiesComboBox.selectedIndex != -1 + loadButton.isEnabled = regionEntitiesComboBox.selectedIndex != -1 + } + } + + addRegionEntitiesToComboBox() + } + + private fun addRegionEntitiesToComboBox() { + if (regionEntitiesComboBox.itemCount == 0) + regionEntitiesComboBox.model = DefaultComboBoxModel>(regionEntityService.getAll(this.region.name).values.toTypedArray()) + + } + + private fun saveLastQuery() { + addQueryTextFieldAndSaveButton() + console.editorDocument.addDocumentListener(HybrisConsoleQueryBodyDocumentListener(saveButton, queryNameTextField, queryNamePlaceholder)) + addListenerToSaveButton() + } + + private fun addQueryTextFieldAndSaveButton() { + queryNameTextField.border = EmptyBorder(0, 0, 0, 0) + queryNameTextField.setPlaceholder(queryNamePlaceholder, console, saveButton) + queryNameTextField.preferredSize = Dimension(170, 20) + queryNameTextField.addKeyListener(RemoveTextKeyAdapter()) + add(queryNameTextField) + saveButton.border = EmptyBorder(0, 0, 0, 0) + saveButton.toolTipText = "Save Last Query" + saveButton.preferredSize = Dimension(30, 25) + add(saveButton) + } + + private fun addListenerToSaveButton() { + saveButton.addActionListener { + run { + if (queryNameTextField.text.length <= maxQueryNameLength) { + if (console.editorDocument.text.length <= maxQueryBodyLength) { + addQueryToComboBox() + } else { + HybrisConsoleNotificationUtil + .displayWarningNotification(queryBodyNotificationTitle, queryBodyNotificationName, project) + } + } else { + HybrisConsoleNotificationUtil + .displayWarningNotification(queryNameNotificationTitle, queryNameNotificationName, project) + } + } + } + } + + private fun addQueryToComboBox() { + val savedEntity = regionEntityService.save(region.name, queryNameTextField.text, console.editorDocument.text) + regionEntitiesComboBox.addItem(savedEntity) + while (regionEntitiesComboBox.itemCount > maxPossibleItemsNumber) { + regionEntitiesComboBox.removeItemAt(0) + } + queryNameTextField.setPlaceholder(queryNamePlaceholder, console, saveButton) + saveButton.isEnabled = false + } + + private fun loadQueryBodyToConsole() { + loadButton.border = EmptyBorder(0, 0, 0, 0) + loadButton.toolTipText = "Load Selected Query" + loadButton.preferredSize = Dimension(30, 25) + loadButton.isEnabled = false + loadButton.addActionListener { + run { + val selectedEntity = this.regionEntitiesComboBox.selectedItem as RegionEntity<*> + console.setInputText(selectedEntity.body as String) + } + } + add(loadButton) + } + + private fun removeQuery() { + removeButton.border = EmptyBorder(0, 0, 0, 0) + removeButton.toolTipText = "Remove Selected Query" + removeButton.preferredSize = Dimension(30, 25) + removeButton.isEnabled = false + add(removeButton) + removeButton.addActionListener { + run { + val selectedEntity = this.regionEntitiesComboBox.selectedItem as RegionEntity<*> + regionEntityService.remove(selectedEntity.id) + regionEntitiesComboBox.removeItem(selectedEntity) + } + } + } + + private inner class RemoveTextKeyAdapter : KeyAdapter() { + override fun keyReleased(e: KeyEvent?) { + if (e != null && (e.keyCode == KeyEvent.VK_BACK_SPACE || + e.keyCode == KeyEvent.VK_DELETE) && queryNameTextField.text.isNotEmpty()) { + queryNameTextField.text = "" + } + } + } + + private inner class HybrisConsoleQueryPanelListener() : HybrisConsoleEventListener { + override fun update() { + addRegionEntitiesToComboBox() + } + } + + fun getIcon(path: String?): Icon { + val callerClass = ReflectionUtil.getGrandCallerClass() ?: error(path!!) + return IconLoader.getIcon(path!!, callerClass) + } + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/HybrisConsoleQueryTextField.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/HybrisConsoleQueryTextField.java new file mode 100644 index 000000000..30d88f16c --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/HybrisConsoleQueryTextField.java @@ -0,0 +1,138 @@ +/* + * 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.tools.remote.console.persistence.ui; + +import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisConsole; +import com.intellij.ui.Gray; +import com.intellij.ui.JBColor; + +import javax.swing.*; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import java.awt.*; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; + +public class HybrisConsoleQueryTextField extends JTextField { + + private Color placeholderForeground = Gray._160; + private boolean textWrittenIn; + private String reservedPlaceholderValue; + + public HybrisConsoleQueryTextField(final String reservedPlaceholderValue) { + this.reservedPlaceholderValue = reservedPlaceholderValue; + } + + public Color getPlaceholderForeground() { + return placeholderForeground; + } + + public boolean isTextWrittenIn() { + return textWrittenIn; + } + + public void setTextWrittenIn(final boolean textWrittenIn) { + this.textWrittenIn = textWrittenIn; + } + + public void setPlaceholder(final String placeholder, final HybrisConsole hybrisConsole, final JButton button) { + button.setEnabled(false); + this.customizeText(placeholder); + this.getDocument().addDocumentListener(new QueryTextFieldDocumentListener(hybrisConsole, button)); + this.addFocusListener(new QueryTextFieldFocusListener(placeholder, button)); + } + + private void customizeText(final String text) { + setText(text); + setFont(new Font(getFont().getFamily(), Font.ITALIC, getFont().getSize())); + setForeground(getPlaceholderForeground()); + setTextWrittenIn(false); + } + + private void setUsualTextDesign() { + setFont(new Font(getFont().getFamily(), Font.PLAIN, getFont().getSize())); + setForeground(JBColor.BLACK); + } + + private class QueryTextFieldDocumentListener implements DocumentListener { + + private HybrisConsole hybrisConsole; + private JButton button; + + public QueryTextFieldDocumentListener(HybrisConsole hybrisConsole, JButton button) { + this.hybrisConsole = hybrisConsole; + this.button = button; + } + + @Override + public void insertUpdate(final DocumentEvent e) { + disableButtonIfTextIsEmpty(); + } + + @Override + public void removeUpdate(final DocumentEvent e) { + disableButtonIfTextIsEmpty(); + } + + @Override + public void changedUpdate(final DocumentEvent e) { + disableButtonIfTextIsEmpty(); + } + + private void disableButtonIfTextIsEmpty() { + if (!getText().trim().isEmpty() && !getText().equals(reservedPlaceholderValue) + && !hybrisConsole.getEditorDocument().getText().isEmpty()) { + setUsualTextDesign(); + setTextWrittenIn(true); + button.setEnabled(true); + } else if (hybrisConsole.getEditorDocument().getText().isEmpty()) { + setUsualTextDesign(); + button.setEnabled(false); + } else { + button.setEnabled(false); + } + } + } + + private class QueryTextFieldFocusListener implements FocusListener { + + private String placeholder; + private JButton button; + + public QueryTextFieldFocusListener(String placeholder, JButton button) { + this.placeholder = placeholder; + this.button = button; + } + + @Override + public void focusGained(final FocusEvent e) { + if (!isTextWrittenIn()) { + setText(""); + } + } + + @Override + public void focusLost(final FocusEvent e) { + if (getText().trim().isEmpty()) { + customizeText(placeholder); + button.setEnabled(false); + } + } + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/RegionEntityCellRenderer.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/RegionEntityCellRenderer.java new file mode 100644 index 000000000..58ab9e771 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/RegionEntityCellRenderer.java @@ -0,0 +1,38 @@ +/* + * 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.tools.remote.console.persistence.ui; + +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.pojo.RegionEntity; + +import javax.swing.*; +import java.awt.*; + +public class RegionEntityCellRenderer extends DefaultListCellRenderer { + + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + + if (value instanceof RegionEntity) { + value = ((RegionEntity) value).getName(); + } + + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + + return this; + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/listeners/HybrisConsoleEventListener.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/listeners/HybrisConsoleEventListener.java new file mode 100644 index 000000000..9830ab6bc --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/listeners/HybrisConsoleEventListener.java @@ -0,0 +1,25 @@ +/* + * 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.tools.remote.console.persistence.ui.listeners; + +public interface HybrisConsoleEventListener { + + void update(); + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/listeners/HybrisConsoleQueryBodyDocumentListener.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/listeners/HybrisConsoleQueryBodyDocumentListener.java new file mode 100644 index 000000000..2fcb6ce53 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/listeners/HybrisConsoleQueryBodyDocumentListener.java @@ -0,0 +1,57 @@ +/* + * 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.tools.remote.console.persistence.ui.listeners; + +import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.ui.HybrisConsoleQueryTextField; +import com.intellij.openapi.editor.event.DocumentEvent; +import com.intellij.openapi.editor.event.DocumentListener; +import org.jetbrains.annotations.NotNull; + +import javax.swing.*; + +public class HybrisConsoleQueryBodyDocumentListener implements DocumentListener { + + private HybrisConsoleQueryTextField textField; + private JButton button; + private String placeholder; + + public HybrisConsoleQueryBodyDocumentListener(JButton button, HybrisConsoleQueryTextField textField, String placeholder) { + this.button = button; + this.textField = textField; + this.placeholder = placeholder; + } + + @Override + public void beforeDocumentChange(@NotNull final DocumentEvent event) { + disableButtonIfTextIsEmpty(event.getDocument().getText(), button, textField); + } + + @Override + public void documentChanged(@NotNull final DocumentEvent event) { + disableButtonIfTextIsEmpty(event.getDocument().getText(), button, textField); + } + + private void disableButtonIfTextIsEmpty(String text, JButton button, HybrisConsoleQueryTextField textField) { + if (!text.trim().isEmpty() && !textField.getText().equals(placeholder)) { + button.setEnabled(true); + } else { + button.setEnabled(false); + } + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/listeners/HybrisConsoleQueryPanelEventManager.java b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/listeners/HybrisConsoleQueryPanelEventManager.java new file mode 100644 index 000000000..dc8389b8b --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/persistence/ui/listeners/HybrisConsoleQueryPanelEventManager.java @@ -0,0 +1,48 @@ +/* + * 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.tools.remote.console.persistence.ui.listeners; + +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.List; + +public class HybrisConsoleQueryPanelEventManager { + + private List listeners = new ArrayList<>(); + + public static HybrisConsoleQueryPanelEventManager getInstance(@NotNull Project project) { + return ServiceManager.getService(project, HybrisConsoleQueryPanelEventManager.class); + } + + public void addListener(HybrisConsoleEventListener listener) { + this.listeners.add(listener); + } + + public void removeListener(HybrisConsoleEventListener listener) { + this.listeners.remove(listener); + } + + public void notifyListeners() { + listeners.forEach(HybrisConsoleEventListener::update); + } + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/preprocess/HybrisConsolePreProcessor.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/console/preprocess/HybrisConsolePreProcessor.kt index 198d051e0..e115b0c1d 100644 --- a/src/com/intellij/idea/plugin/hybris/tools/remote/console/preprocess/HybrisConsolePreProcessor.kt +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/preprocess/HybrisConsolePreProcessor.kt @@ -21,7 +21,7 @@ package com.intellij.idea.plugin.hybris.tools.remote.console.preprocess import com.intellij.idea.plugin.hybris.common.HybrisConstants import com.intellij.idea.plugin.hybris.tools.remote.console.CatalogVersionOption import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisConsole -import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisImpexConsole +import com.intellij.idea.plugin.hybris.tools.remote.console.impl.HybrisImpexConsole /** * @author Nosov Aleksandr diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/view/HybrisConsolePanel.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/console/view/HybrisConsolePanel.kt index 021ae742a..e1eebe45f 100644 --- a/src/com/intellij/idea/plugin/hybris/tools/remote/console/view/HybrisConsolePanel.kt +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/view/HybrisConsolePanel.kt @@ -1,15 +1,19 @@ package com.intellij.idea.plugin.hybris.tools.remote.console.view import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons -import com.intellij.idea.plugin.hybris.tools.remote.console.* +import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisConsole +import com.intellij.idea.plugin.hybris.tools.remote.console.HybrisConsoleProvider import com.intellij.idea.plugin.hybris.tools.remote.console.actions.* import com.intellij.idea.plugin.hybris.tools.remote.console.actions.handler.HybrisConsoleExecuteActionHandler import com.intellij.idea.plugin.hybris.tools.remote.console.actions.handler.HybrisConsoleExecuteValidateActionHandler +import com.intellij.idea.plugin.hybris.tools.remote.console.impl.* import com.intellij.openapi.Disposable import com.intellij.openapi.actionSystem.* import com.intellij.openapi.project.Project import com.intellij.openapi.ui.SimpleToolWindowPanel import com.intellij.ui.JBTabsPaneImpl +import com.intellij.ui.tabs.impl.JBEditorTabs +import com.intellij.util.castSafelyTo import icons.JetgroovyIcons.Groovy.Groovy_16x16 import java.awt.BorderLayout import javax.swing.Icon @@ -23,15 +27,18 @@ import javax.swing.SwingConstants.TOP class HybrisConsolePanel(val project: Project) : SimpleToolWindowPanel(true), Disposable { override fun dispose() { - + //NOP } private val impexConsole = HybrisImpexConsole(project) private val groovyConsole = HybrisGroovyConsole(project) private val monitorConsole = HybrisImpexMonitorConsole(project) + private val flexibleSearchConsole = HybrisFlexibleSearchConsole(project) + private val solrSearchConsole = HybrisSolrSearchConsole(project) private val actionToolbar: ActionToolbar private val hybrisTabs: HybrisTabs + init { layout = BorderLayout() @@ -44,6 +51,8 @@ class HybrisConsolePanel(val project: Project) : SimpleToolWindowPanel(true), Di hybrisTabs = HybrisTabs(impexConsole, groovyConsole, monitorConsole, + flexibleSearchConsole, + solrSearchConsole, project, TOP) panel.add(hybrisTabs.component, BorderLayout.CENTER) @@ -78,7 +87,7 @@ class HybrisConsolePanel(val project: Project) : SimpleToolWindowPanel(true), Di hybrisTabs.setActiveConsole(console) } - fun getActiveConsole() : HybrisConsole { + fun getActiveConsole(): HybrisConsole { return hybrisTabs.activeConsole() } @@ -108,6 +117,8 @@ class HybrisConsolePanel(val project: Project) : SimpleToolWindowPanel(true), Di class HybrisTabs(impexConsole: HybrisImpexConsole, groovyConsole: HybrisGroovyConsole, impexMonitorConsole: HybrisImpexMonitorConsole, + flexibleSearchConsole: HybrisFlexibleSearchConsole, + solrSearchConsole: HybrisSolrSearchConsole, project: Project, tabPlacement: Int) : JBTabsPaneImpl(project, tabPlacement, Disposable { }) { @@ -117,6 +128,8 @@ class HybrisTabs(impexConsole: HybrisImpexConsole, addConsoleTab("Impex", HybrisIcons.IMPEX_FILE, impexConsole, "Impex Console") addConsoleTab("Groovy Scripting", Groovy_16x16, groovyConsole, "Groovy Console") addConsoleTab("Impex Monitor", HybrisIcons.TYPE_SYSTEM, impexMonitorConsole, "Last imported Impex files") + addConsoleTab("Flexible Search", HybrisIcons.FS_FILE, flexibleSearchConsole, "Flexible Search Console") + addConsoleTab("Solr Search", HybrisIcons.Console.SOLR, solrSearchConsole, "Solr Search Console") for (extension in HybrisConsoleProvider.EP_NAME.extensions) { val console = extension.createConsole(project) @@ -125,6 +138,13 @@ class HybrisTabs(impexConsole: HybrisImpexConsole, addConsoleTab(extension.tabTitle, extension.icon, console, extension.tip) } } + + addChangeListener { + it.source.castSafelyTo() + ?.selectedInfo + ?.component.castSafelyTo() + ?.onSelection() + } } private fun addConsoleTab(title: String, icon: Icon?, console: HybrisConsole, tip: String) { @@ -134,6 +154,6 @@ class HybrisTabs(impexConsole: HybrisImpexConsole, fun activeConsole() = consoles[selectedIndex] fun setActiveConsole(console: HybrisConsole) { - selectedIndex=consoles.indexOf(console); + selectedIndex = consoles.indexOf(console); } } \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/console/view/HybrisConsolePanelView.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/console/view/HybrisConsolePanelView.kt index f9e8de19d..a15b06bee 100644 --- a/src/com/intellij/idea/plugin/hybris/tools/remote/console/view/HybrisConsolePanelView.kt +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/console/view/HybrisConsolePanelView.kt @@ -19,7 +19,7 @@ import javax.swing.JPanel class HybrisConsolePanelView(val project: Project) : Disposable { companion object { - fun getInstance(project: Project): HybrisConsolePanelView = ServiceManager.getService(project, HybrisConsolePanelView::class.java) + fun getInstance(project: Project): HybrisConsolePanelView = project.getService(HybrisConsolePanelView::class.java) } val consolePanel = HybrisConsolePanel(project) @@ -40,7 +40,7 @@ class HybrisConsolePanelView(val project: Project) : Disposable { val layoutComponent = layoutUi.component panel.add(layoutComponent, BorderLayout.CENTER) - val content = ContentFactory.SERVICE.getInstance().createContent(layoutComponent, null, true) + val content = ContentFactory.getInstance().createContent(layoutComponent, null, true) toolWindow.contentManager.addContent(content) } diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/http/AbstractHybrisHacHttpClient.java b/src/com/intellij/idea/plugin/hybris/tools/remote/http/AbstractHybrisHacHttpClient.java index 0a606d530..53502f5f2 100644 --- a/src/com/intellij/idea/plugin/hybris/tools/remote/http/AbstractHybrisHacHttpClient.java +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/http/AbstractHybrisHacHttpClient.java @@ -61,7 +61,9 @@ import static org.apache.http.HttpVersion.HTTP_1_1; public abstract class AbstractHybrisHacHttpClient { + private static final Logger LOG = Logger.getInstance(AbstractHybrisHacHttpClient.class); + public static final int DEFAULT_HAC_TIMEOUT = 6000; protected String sessionId; public String login(Project project) { @@ -70,18 +72,18 @@ public String login(Project project) { } public String login(@NotNull Project project, @NotNull HybrisRemoteConnectionSettings settings) { - String hostHacURL = getHostHacURL(project); - sessionId = getSessionId(hostHacURL); + String hostHacURL = getHostHacURL(project,settings); + sessionId = getSessionId(hostHacURL, project, settings); if (sessionId == null) { return "Unable to obtain sessionId for "+hostHacURL; } - final String csrfToken = getCsrfToken(hostHacURL, sessionId); + final String csrfToken = getCsrfToken(hostHacURL, sessionId, project, settings); List params = new ArrayList<>(); params.add(new BasicNameValuePair("j_username", settings.getHacLogin())); params.add(new BasicNameValuePair("j_password", settings.getHacPassword())); params.add(new BasicNameValuePair("_csrf", csrfToken)); String loginURL = hostHacURL + "/j_spring_security_check"; - HttpResponse response = post(project, loginURL, params, false); + HttpResponse response = post(project, loginURL, params, false, DEFAULT_HAC_TIMEOUT, settings); if (response.getStatusLine().getStatusCode() == SC_MOVED_TEMPORARILY) { Header location = response.getFirstHeader("Location"); if (location != null && location.getValue().contains("login_error")) { @@ -111,22 +113,50 @@ public String login(@NotNull Project project, @NotNull HybrisRemoteConnectionSet } @NotNull - public final HttpResponse post(@NotNull Project project, @NotNull String actionUrl, @NotNull List params, boolean canReLoginIfNeeded) { + public final HttpResponse post( + @NotNull Project project, + @NotNull String actionUrl, + @NotNull List params, + boolean canReLoginIfNeeded, + final long timeout + ) { + return post(project, actionUrl, params, canReLoginIfNeeded, timeout, null); + } + + @NotNull + public final HttpResponse post( + @NotNull Project project, + @NotNull String actionUrl, + @NotNull List params, + boolean canReLoginIfNeeded + ) { + return post(project, actionUrl, params, canReLoginIfNeeded, DEFAULT_HAC_TIMEOUT, null); + } + + @NotNull + public final HttpResponse post( + @NotNull Project project, + @NotNull String actionUrl, + @NotNull List params, + boolean canReLoginIfNeeded, + final long timeout, + HybrisRemoteConnectionSettings settings + ) { if (sessionId == null) { String errorMessage = login(project); if (StringUtils.isNotBlank(errorMessage)) { return createErrorResponse(errorMessage); } } - String csrfToken = getCsrfToken(getHostHacURL(project), sessionId); + String csrfToken = getCsrfToken(getHostHacURL(project), sessionId, project, settings); if (csrfToken == null) { this.sessionId = null; if (canReLoginIfNeeded) { - return post(project, actionUrl, params, false); + return post(project, actionUrl, params, false, timeout, settings); } return createErrorResponse("Unable to obtain csrfToken for sessionId="+sessionId); } - HttpClient client = createAllowAllClient(6000L); + HttpClient client = createAllowAllClient(timeout); if (client == null) { return createErrorResponse("Unable to create HttpClient"); } @@ -165,8 +195,15 @@ protected HttpResponse createErrorResponse(final String reasonPhrase) { return new BasicHttpResponse(new BasicStatusLine(HTTP_1_1, SC_SERVICE_UNAVAILABLE, reasonPhrase)); } - public String getHostHacURL(Project project) { - return CommonIdeaService.getInstance().getHostHacUrl(project); + public String getHostHacURL(final Project project) { + return CommonIdeaService.getInstance().getActiveHacUrl(project); + } + + public String getSslProtocol( + final Project project, + final @Nullable HybrisRemoteConnectionSettings settings + ) { + return CommonIdeaService.getInstance().getActiveSslProtocol(project,settings); } public String getHostHacURL(Project project, HybrisRemoteConnectionSettings settings) { @@ -177,6 +214,7 @@ protected CloseableHttpClient createAllowAllClient(long timeout) { SSLContext sslcontext = null; try { sslcontext = SSLContexts.custom().loadTrustMaterial(null, new TrustStrategy() { + @Override public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException { return true; @@ -197,25 +235,34 @@ public boolean isTrusted(X509Certificate[] chain, String authType) throws Certif HttpClientBuilder builder = HttpClients.custom(); builder.setConnectionManager(ccm); RequestConfig config = RequestConfig.custom() - .setSocketTimeout((int)timeout) - .setConnectTimeout((int)timeout) + .setSocketTimeout((int) timeout) + .setConnectTimeout((int) timeout) .build(); builder.setDefaultRequestConfig(config); return builder.build(); } - protected String getSessionId(String hacURL) { - final Response res = getResponseForUrl(hacURL); + protected String getSessionId( + final String hacURL, + final @NotNull Project project, + final @NotNull HybrisRemoteConnectionSettings settings + ) { + final Response res = getResponseForUrl(hacURL, project, settings); if (res == null) { return null; } return res.cookie("JSESSIONID"); } - protected Response getResponseForUrl(String hacURL) { + protected Response getResponseForUrl( + final String hacURL, + final @NotNull Project project, + final @NotNull HybrisRemoteConnectionSettings settings + ) { try { - return connect(hacURL).method(Method.GET).execute(); + final String sslProtocol = getSslProtocol(project, settings); + return connect(hacURL, sslProtocol).method(Method.GET).execute(); } catch (ConnectException ce) { return null; } catch (NoSuchAlgorithmException | IOException | KeyManagementException e) { @@ -224,9 +271,16 @@ protected Response getResponseForUrl(String hacURL) { } } - protected String getCsrfToken(@NotNull String hacURL, @NotNull String sessionId) { + protected String getCsrfToken( + final @NotNull String hacURL, + final @NotNull String sessionId, + final @NotNull Project project, + final @Nullable HybrisRemoteConnectionSettings settings + ) { try { - final Document doc = connect(hacURL).cookie("JSESSIONID", sessionId).get(); + final String sslProtocol = getSslProtocol(project, settings); + + final Document doc = connect(hacURL, sslProtocol).cookie("JSESSIONID", sessionId).get(); final Elements csrfMetaElt = doc.select("meta[name=_csrf]"); return csrfMetaElt.attr("content"); } catch (IOException | NoSuchAlgorithmException | KeyManagementException e) { @@ -235,21 +289,27 @@ protected String getCsrfToken(@NotNull String hacURL, @NotNull String sessionId) return null; } - private Connection connect(@NotNull String url) throws NoSuchAlgorithmException, KeyManagementException { + private Connection connect(@NotNull String url, final String sslProtocol) throws + NoSuchAlgorithmException, + KeyManagementException { TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() { + @Nullable public X509Certificate[] getAcceptedIssuers() { return null; } - public void checkClientTrusted(@NotNull X509Certificate[] certs, @NotNull String authType) { } + public void checkClientTrusted(@NotNull X509Certificate[] certs, @NotNull String authType) { + } - public void checkServerTrusted(@NotNull X509Certificate[] certs, @NotNull String authType) { } + public void checkServerTrusted(@NotNull X509Certificate[] certs, @NotNull String authType) { + } }}; - SSLContext sc = SSLContext.getInstance("TLSv1"); + + SSLContext sc = SSLContext.getInstance(sslProtocol); sc.init(null, trustAllCerts, new SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); HttpsURLConnection.setDefaultHostnameVerifier(new NoopHostnameVerifier()); - return Jsoup.connect(url).validateTLSCertificates(false); + return Jsoup.connect(url); } } diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/http/HybrisHacHttpClient.java b/src/com/intellij/idea/plugin/hybris/tools/remote/http/HybrisHacHttpClient.java index c0297e055..153bddc9a 100644 --- a/src/com/intellij/idea/plugin/hybris/tools/remote/http/HybrisHacHttpClient.java +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/http/HybrisHacHttpClient.java @@ -21,10 +21,13 @@ import com.google.gson.Gson; import com.intellij.idea.plugin.hybris.tools.remote.http.flexibleSearch.TableBuilder; import com.intellij.idea.plugin.hybris.tools.remote.http.impex.HybrisHttpResult; +import com.intellij.idea.plugin.hybris.tools.remote.http.solr.SolrHttpClient; +import com.intellij.idea.plugin.hybris.tools.remote.http.solr.SolrQueryObject; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import org.apache.commons.lang3.BooleanUtils; import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; import org.apache.http.StatusLine; import org.apache.http.message.BasicNameValuePair; import org.jetbrains.annotations.NotNull; @@ -38,6 +41,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.stream.Collectors; import static com.intellij.idea.plugin.hybris.tools.remote.http.impex.HybrisHttpResult.HybrisHttpResultBuilder.createResult; @@ -197,7 +201,7 @@ HybrisHttpResult executeFlexibleSearch( public @NotNull HybrisHttpResult executeGroovyScript( - final Project project, final String content, final boolean isCommitMode + final Project project, final String content, final boolean isCommitMode, final int timeout ) { final List params = asList( @@ -208,7 +212,7 @@ HybrisHttpResult executeGroovyScript( HybrisHttpResult.HybrisHttpResultBuilder resultBuilder = createResult(); final String actionUrl = getHostHacURL(project) + "/console/scripting/execute"; - final HttpResponse response = post(project, actionUrl, params, true); + final HttpResponse response = post(project, actionUrl, params, true, timeout); final StatusLine statusLine = response.getStatusLine(); resultBuilder = resultBuilder.httpCode(statusLine.getStatusCode()); if (statusLine.getStatusCode() != SC_OK || response.getEntity() == null) { @@ -240,4 +244,15 @@ HybrisHttpResult executeGroovyScript( return resultBuilder.build(); } } + + @NotNull + public HybrisHttpResult executeSolrSearch(final Project project, final Optional queryObject) { + return queryObject.map(query -> SolrHttpClient.getInstance(project).executeSolrQuery(project, query)) + .orElseGet(() -> + HybrisHttpResult.HybrisHttpResultBuilder + .createResult() + .httpCode(HttpStatus.SC_BAD_GATEWAY) + .errorMessage("Unable to connect to Solr server. Please, check connection configuration") + .build()); + } } diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/http/SolrHttpClient.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/http/SolrHttpClient.kt deleted file mode 100644 index 84d68ff4f..000000000 --- a/src/com/intellij/idea/plugin/hybris/tools/remote/http/SolrHttpClient.kt +++ /dev/null @@ -1,23 +0,0 @@ -package com.intellij.idea.plugin.hybris.tools.remote.http - -import com.intellij.idea.plugin.hybris.settings.HybrisRemoteConnectionSettings -import com.intellij.idea.plugin.hybris.tools.remote.http.impex.HybrisHttpResult -import com.intellij.idea.plugin.hybris.tools.remote.http.solr.SolrQueryObject -import com.intellij.openapi.project.Project - -/** - * @author Nosov Aleksandr - */ -interface SolrHttpClient { - @Throws(Exception::class) - fun listOfCores(project: Project, solrConnectionSettings: HybrisRemoteConnectionSettings): Array - fun listOfCores(project: Project): Array - fun executeSolrQuery(project: Project, queryObject: SolrQueryObject): HybrisHttpResult - - companion object { - @JvmStatic - fun getInstance(project: Project): SolrHttpClient { - return project.getComponent(SolrHttpClient::class.java) - } - } -} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/http/solr/SolrCoreData.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/http/solr/SolrCoreData.kt new file mode 100644 index 000000000..07a058bbf --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/http/solr/SolrCoreData.kt @@ -0,0 +1,27 @@ +/* + * 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.tools.remote.http.solr + +class SolrCoreData (val core: String, val docs: Int) { + + override fun toString(): String { + return core + } + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/http/solr/SolrHttpClient.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/http/solr/SolrHttpClient.kt new file mode 100644 index 000000000..25c57c045 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/http/solr/SolrHttpClient.kt @@ -0,0 +1,43 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.tools.remote.http.solr + +import com.intellij.idea.plugin.hybris.settings.HybrisRemoteConnectionSettings +import com.intellij.idea.plugin.hybris.tools.remote.http.impex.HybrisHttpResult +import com.intellij.openapi.project.Project + +/** + * @author Nosov Aleksandr + */ +interface SolrHttpClient { + @Throws(Exception::class) + fun listOfCores(project: Project, solrConnectionSettings: HybrisRemoteConnectionSettings): Array + fun listOfCores(project: Project): Array + fun coresData(project: Project): Array + fun coresData(project: Project, solrConnectionSettings: HybrisRemoteConnectionSettings): Array + fun executeSolrQuery(project: Project, queryObject: SolrQueryObject): HybrisHttpResult + fun executeSolrQuery(project: Project, solrConnectionSettings: HybrisRemoteConnectionSettings, queryObject: SolrQueryObject): HybrisHttpResult + + companion object { + @JvmStatic + fun getInstance(project: Project): SolrHttpClient { + return project.getComponent(SolrHttpClient::class.java) + } + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/tools/remote/http/solr/impl/DefaultSolrHttpClient.kt b/src/com/intellij/idea/plugin/hybris/tools/remote/http/solr/impl/DefaultSolrHttpClient.kt new file mode 100644 index 000000000..541652e00 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/tools/remote/http/solr/impl/DefaultSolrHttpClient.kt @@ -0,0 +1,127 @@ +/* + * 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.tools.remote.http.solr.impl + +import com.intellij.idea.plugin.hybris.settings.HybrisDeveloperSpecificProjectSettingsComponent +import com.intellij.idea.plugin.hybris.settings.HybrisRemoteConnectionSettings +import com.intellij.idea.plugin.hybris.tools.remote.http.impex.HybrisHttpResult +import com.intellij.idea.plugin.hybris.tools.remote.http.solr.SolrCoreData +import com.intellij.idea.plugin.hybris.tools.remote.http.solr.SolrHttpClient +import com.intellij.idea.plugin.hybris.tools.remote.http.solr.SolrQueryObject +import com.intellij.openapi.project.Project +import com.intellij.util.castSafelyTo +import com.intellij.util.containers.mapSmartNotNull +import org.apache.http.HttpStatus +import org.apache.solr.client.solrj.SolrQuery +import org.apache.solr.client.solrj.SolrRequest +import org.apache.solr.client.solrj.SolrServerException +import org.apache.solr.client.solrj.impl.HttpSolrClient +import org.apache.solr.client.solrj.impl.NoOpResponseParser +import org.apache.solr.client.solrj.request.CoreAdminRequest +import org.apache.solr.client.solrj.request.QueryRequest +import org.apache.solr.client.solrj.response.CoreAdminResponse +import org.apache.solr.common.params.CoreAdminParams +import org.apache.solr.common.util.NamedList + +class DefaultSolrHttpClient : SolrHttpClient { + + override fun coresData(project: Project): Array { + return coresData(project, solrConnectionSettings(project)) + } + + override fun coresData(project: Project, solrConnectionSettings: HybrisRemoteConnectionSettings): Array { + return CoreAdminRequest() + .apply { + setAction(CoreAdminParams.CoreAdminAction.STATUS) + setBasicAuthCredentials(solrConnectionSettings.adminLogin, solrConnectionSettings.adminPassword) + } + .runCatching { process(buildHttpSolrClient(solrConnectionSettings.generatedURL)) } + .map { parseCoreResponse(it) } + .getOrElse { + throw it + } + } + + private fun parseCoreResponse(response: CoreAdminResponse) = + response.coreStatus.asShallowMap().values.castSafelyTo>>()!!.mapSmartNotNull { buildSolrCoreData(it) }.toTypedArray() + + private fun buildSolrCoreData(it: Map) = + SolrCoreData(it["name"] as String, (it["index"] as NamedList<*>)["numDocs"] as Int) + + override fun listOfCores(project: Project): Array { + return listOfCores(project, solrConnectionSettings(project)) + } + + override fun listOfCores(project: Project, solrConnectionSettings: HybrisRemoteConnectionSettings): Array { + return coresData(project, solrConnectionSettings).map { data -> data.core }.toTypedArray() + } + + private fun buildHttpSolrClient(url: String): HttpSolrClient { + return HttpSolrClient.Builder(url).build() + } + + override fun executeSolrQuery(project: Project, + queryObject: SolrQueryObject): HybrisHttpResult { + return executeSolrQuery(project, solrConnectionSettings(project), queryObject) + } + + override fun executeSolrQuery(project: Project, + solrConnectionSettings: HybrisRemoteConnectionSettings, + queryObject: SolrQueryObject): HybrisHttpResult { + return executeSolrRequest( + solrConnectionSettings, + queryObject, + buildQueryRequest( + buildSolrQuery(queryObject), + solrConnectionSettings) + ) + } + + private fun executeSolrRequest(solrConnectionSettings: HybrisRemoteConnectionSettings, queryObject: SolrQueryObject, queryRequest: QueryRequest): HybrisHttpResult { + return buildHttpSolrClient("${solrConnectionSettings.generatedURL}/${queryObject.core}") + .runCatching { request(queryRequest) } + .map { resultBuilder().output(it["response"] as String?).build() } + .getOrElse { resultBuilder().errorMessage(it.message).httpCode(HttpStatus.SC_BAD_GATEWAY).build() } + } + + private fun resultBuilder() = HybrisHttpResult.HybrisHttpResultBuilder.createResult() + + private fun buildQueryRequest(solrQuery: SolrQuery, solrConnectionSettings: HybrisRemoteConnectionSettings): QueryRequest { + return QueryRequest(solrQuery).apply { + setBasicAuthCredentials(solrConnectionSettings.adminLogin, solrConnectionSettings.adminPassword) + method = SolrRequest.METHOD.POST + // https://issues.apache.org/jira/browse/SOLR-5530 + // https://stackoverflow.com/questions/28374428/return-solr-response-in-json-format/37212234#37212234 + responseParser = NoOpResponseParser("json") + } + } + + private fun buildSolrQuery(queryObject: SolrQueryObject): SolrQuery { + return SolrQuery().apply { + rows = queryObject.rows + query = queryObject.query + setParam("wt", "json") + } + } + + // active or default + private fun solrConnectionSettings(project: Project): HybrisRemoteConnectionSettings { + return HybrisDeveloperSpecificProjectSettingsComponent.getInstance(project).getActiveSolrConnectionSettings(project) + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/toolwindow/CopyFileToHybrisConsoleDialog.form b/src/com/intellij/idea/plugin/hybris/toolwindow/CopyFileToHybrisConsoleDialog.form new file mode 100644 index 000000000..a8085f5cc --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/toolwindow/CopyFileToHybrisConsoleDialog.form @@ -0,0 +1,26 @@ + +
    + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/intellij/idea/plugin/hybris/toolwindow/CopyFileToHybrisConsoleDialog.java b/src/com/intellij/idea/plugin/hybris/toolwindow/CopyFileToHybrisConsoleDialog.java new file mode 100644 index 000000000..d39899f7e --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/toolwindow/CopyFileToHybrisConsoleDialog.java @@ -0,0 +1,52 @@ +/* + * 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.toolwindow; + +import com.intellij.openapi.project.Project; +import com.intellij.openapi.ui.DialogWrapper; +import org.jetbrains.annotations.Nullable; + +import javax.swing.*; + +import static com.intellij.openapi.ui.DialogWrapper.IdeModalityType.PROJECT; + +public final class CopyFileToHybrisConsoleDialog extends DialogWrapper { + + private JPanel contentPane; + + public CopyFileToHybrisConsoleDialog( + @Nullable final Project project, + @Nullable final String dialogTitle + ) { + super(project, false, PROJECT); + setTitle(dialogTitle); + init(); + } + + @Override + protected @Nullable JComponent createCenterPanel() { + return contentPane; + } + + public void show(final Runnable runnable) { + if(showAndGet()) { + runnable.run(); + } + } +} diff --git a/src/com/intellij/idea/plugin/hybris/toolwindow/HybrisToolWindow.java b/src/com/intellij/idea/plugin/hybris/toolwindow/HybrisToolWindow.java index dafb0183d..be03e51f9 100644 --- a/src/com/intellij/idea/plugin/hybris/toolwindow/HybrisToolWindow.java +++ b/src/com/intellij/idea/plugin/hybris/toolwindow/HybrisToolWindow.java @@ -47,7 +47,7 @@ public void createToolWindowContent( ) { myToolWindow = toolWindow; myProject = project; - ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); + ContentFactory contentFactory = ContentFactory.getInstance(); Content content = contentFactory.createContent(myToolWindowContent, "", false); toolWindow.getContentManager().addContent(content); project.getMessageBus().connect(project).subscribe( @@ -218,4 +218,8 @@ public void saveSettings() { HybrisDeveloperSpecificProjectSettingsComponent.getInstance(myProject).getState().setRemoteConnectionSettingsList(myListPanel.getData()); } + @Override + public boolean isApplicable(@NotNull final Project project) { + return HybrisProjectSettingsComponent.getInstance(project).getState().isHybrisProject(); + } } diff --git a/src/com/intellij/idea/plugin/hybris/toolwindow/HybrisToolWindowCondition.java b/src/com/intellij/idea/plugin/hybris/toolwindow/HybrisToolWindowCondition.java deleted file mode 100644 index 5f54ae0b2..000000000 --- a/src/com/intellij/idea/plugin/hybris/toolwindow/HybrisToolWindowCondition.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.intellij.idea.plugin.hybris.toolwindow; - -import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Condition; - -public class HybrisToolWindowCondition implements Condition { - - @Override - public boolean value(final Project project) { - return HybrisProjectSettingsComponent.getInstance(project).getState().isHybrisProject(); - } -} diff --git a/src/com/intellij/idea/plugin/hybris/toolwindow/RemoteConnectionDialog.form b/src/com/intellij/idea/plugin/hybris/toolwindow/RemoteConnectionDialog.form index ca4d3791a..7bff349e1 100644 --- a/src/com/intellij/idea/plugin/hybris/toolwindow/RemoteConnectionDialog.form +++ b/src/com/intellij/idea/plugin/hybris/toolwindow/RemoteConnectionDialog.form @@ -1,16 +1,16 @@
    - + - + - + @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -44,7 +44,7 @@ - + @@ -52,7 +52,7 @@ - + @@ -60,15 +60,17 @@ - + - + + + - + @@ -76,7 +78,7 @@ - + @@ -84,7 +86,7 @@ - + @@ -92,7 +94,7 @@ - + @@ -101,7 +103,7 @@ - + @@ -109,7 +111,7 @@ - + @@ -117,7 +119,7 @@ - + @@ -125,7 +127,7 @@ - + @@ -133,12 +135,48 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/intellij/idea/plugin/hybris/toolwindow/RemoteConnectionDialog.java b/src/com/intellij/idea/plugin/hybris/toolwindow/RemoteConnectionDialog.java index a74ac03a4..b985a0b3a 100644 --- a/src/com/intellij/idea/plugin/hybris/toolwindow/RemoteConnectionDialog.java +++ b/src/com/intellij/idea/plugin/hybris/toolwindow/RemoteConnectionDialog.java @@ -10,6 +10,7 @@ import com.intellij.notification.NotificationType; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; +import com.intellij.ui.components.OnOffButton; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -17,6 +18,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.text.PlainDocument; import java.awt.*; +import java.util.Objects; import static com.intellij.openapi.ui.DialogWrapper.IdeModalityType.PROJECT; @@ -37,8 +39,14 @@ public class RemoteConnectionDialog extends DialogWrapper { private JLabel hacWebrootLabel; private JTextField hacWebrootTextField; private JTextField displayNameTextField; + private OnOffButton sslButton; + private JLabel sslLabel; + private JComboBox sslProtocol; + private JLabel sslProtocolLabel; + private Project myProject; private HybrisRemoteConnectionSettings mySettings; + private HybrisRemoteConnectionSettings setting; public RemoteConnectionDialog( @Nullable final Project project, @@ -52,39 +60,58 @@ public RemoteConnectionDialog( displayNameTextField.setText(mySettings.getDisplayName()); projectIpTextField.setText(mySettings.getHostIP()); projectPortTextField.setText(mySettings.getPort()); - ((PlainDocument)projectPortTextField.getDocument()).setDocumentFilter(new UnsignedIntegerDocumentFilter()); + ((PlainDocument) projectPortTextField.getDocument()).setDocumentFilter(new UnsignedIntegerDocumentFilter()); hacWebrootTextField.setText(mySettings.getHacWebroot()); loginTextField.setText(mySettings.getHacLogin()); passwordField.setText(mySettings.getHacPassword()); + sslButton.setSelected(mySettings.isSsl()); + if (mySettings.getSslProtocol() != null) { + sslProtocol.setSelectedItem(mySettings.getSslProtocol()); + } + setting = new HybrisRemoteConnectionSettings(); + saveSettings(settings); + + final SimpleDocumentListener validateDocumentListener = new SimpleDocumentListener() { + + @Override + public void update(final DocumentEvent e) { + validateParams(); + } + }; final SimpleDocumentListener saveSettingsDocumentListener = new SimpleDocumentListener() { @Override public void update(final DocumentEvent e) { - saveSettings(); + saveSettings(setting); } }; - saveSettings(); + validateParams(); init(); + projectPortTextField.getDocument().addDocumentListener(validateDocumentListener); + projectIpTextField.getDocument().addDocumentListener(validateDocumentListener); displayNameTextField.getDocument().addDocumentListener(saveSettingsDocumentListener); projectIpTextField.getDocument().addDocumentListener(saveSettingsDocumentListener); projectPortTextField.getDocument().addDocumentListener(saveSettingsDocumentListener); hacWebrootTextField.getDocument().addDocumentListener(saveSettingsDocumentListener); - displayNameTextField.addActionListener(action->saveSettings()); - projectIpTextField.addActionListener(action->saveSettings()); - hacWebrootTextField.addActionListener(action->saveSettings()); - loginTextField.addActionListener(action->saveSettings()); - passwordField.addActionListener(action->saveSettings()); - testConnectionButton.addActionListener(action->testConnection()); + displayNameTextField.addActionListener(action->saveSettings(setting)); + projectIpTextField.addActionListener(action->saveSettings(setting)); + hacWebrootTextField.addActionListener(action->saveSettings(setting)); + loginTextField.addActionListener(action->saveSettings(setting)); + passwordField.addActionListener(action->saveSettings(setting)); + sslButton.addActionListener(action-> toggleSslButton(setting)); + sslProtocol.addActionListener(action->saveSettings(setting)); + + Objects.requireNonNull(getButton(getOKAction())).addActionListener(action->saveSettings(mySettings)); + testConnectionButton.addActionListener(action -> testConnection()); } private void testConnection() { - saveSettings(); - + saveSettings(setting); HybrisHacHttpClient hybrisHacHttpClient = HybrisHacHttpClient.getInstance(myProject); - final String errorMessage = hybrisHacHttpClient.login(myProject, mySettings); - final String testedHacURL = hybrisHacHttpClient.getHostHacURL(myProject, mySettings); + final String errorMessage = hybrisHacHttpClient.login(myProject, setting); + final String testedHacURL = hybrisHacHttpClient.getHostHacURL(myProject, setting); final NotificationType type; final String message; @@ -97,11 +124,18 @@ private void testConnection() { } NotificationUtil.NOTIFICATION_GROUP.createNotification( - HybrisI18NBundleUtils.message("hybris.toolwindow.hac.test.connection.title"), message, type, null + HybrisI18NBundleUtils.message("hybris.toolwindow.hac.test.connection.title"), message, type ).notify(myProject); } - private void saveSettings() { + private void toggleSslButton(final HybrisRemoteConnectionSettings setting) { + sslProtocol.setEnabled(sslButton.isSelected()); + saveSettings(setting); + } + + private void saveSettings(final HybrisRemoteConnectionSettings mySettings) { + mySettings.setSsl(sslButton.isSelected()); + mySettings.setSslProtocol((String) sslProtocol.getSelectedItem()); mySettings.setDisplayName(displayNameTextField.getText()); mySettings.setHostIP(projectIpTextField.getText()); mySettings.setPort(projectPortTextField.getText()); @@ -118,4 +152,16 @@ private void saveSettings() { protected JComponent createCenterPanel() { return contentPane; } + + private void validateParams() { + testConnectionButton + .setEnabled(!projectPortTextField.getText().isEmpty() + && !projectIpTextField.getText().isEmpty()); + + getOKAction().setEnabled(!projectPortTextField.getText().isEmpty() + && !projectIpTextField.getText().isEmpty()); + } + + private void createUIComponents() { + } } diff --git a/src/com/intellij/idea/plugin/hybris/toolwindow/SolrConnectionDialog.form b/src/com/intellij/idea/plugin/hybris/toolwindow/SolrConnectionDialog.form index 76296f0f5..8abe0536f 100644 --- a/src/com/intellij/idea/plugin/hybris/toolwindow/SolrConnectionDialog.form +++ b/src/com/intellij/idea/plugin/hybris/toolwindow/SolrConnectionDialog.form @@ -1,9 +1,9 @@
    - + - + @@ -36,7 +36,7 @@ - + @@ -44,7 +44,7 @@ - + @@ -52,7 +52,7 @@ - + @@ -60,7 +60,7 @@ - + @@ -101,7 +101,7 @@ - + @@ -109,7 +109,7 @@ - + @@ -117,7 +117,7 @@ - + @@ -139,6 +139,22 @@ + + + + + + + + + + + + + + + + diff --git a/src/com/intellij/idea/plugin/hybris/toolwindow/SolrConnectionDialog.java b/src/com/intellij/idea/plugin/hybris/toolwindow/SolrConnectionDialog.java index 6886e84ab..63c88b14b 100644 --- a/src/com/intellij/idea/plugin/hybris/toolwindow/SolrConnectionDialog.java +++ b/src/com/intellij/idea/plugin/hybris/toolwindow/SolrConnectionDialog.java @@ -4,13 +4,14 @@ import com.intellij.idea.plugin.hybris.common.utils.HybrisI18NBundleUtils; import com.intellij.idea.plugin.hybris.notifications.NotificationUtil; import com.intellij.idea.plugin.hybris.settings.HybrisRemoteConnectionSettings; -import com.intellij.idea.plugin.hybris.tools.remote.http.SolrHttpClient; +import com.intellij.idea.plugin.hybris.tools.remote.http.solr.SolrHttpClient; import com.intellij.idea.plugin.hybris.toolwindow.document.filter.UnsignedIntegerDocumentFilter; import com.intellij.idea.plugin.hybris.toolwindow.document.listener.SimpleDocumentListener; import com.intellij.notification.NotificationType; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; +import com.intellij.ui.components.OnOffButton; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -18,6 +19,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.text.PlainDocument; import java.awt.*; +import java.util.Objects; import static com.intellij.openapi.ui.DialogWrapper.IdeModalityType.PROJECT; @@ -40,13 +42,16 @@ public class SolrConnectionDialog extends DialogWrapper { private JTextField loginTextField; private JTextField solrIpTextField; private JLabel projectIpLabel; + private OnOffButton sslButton; + private JLabel sslLabel; private Project myProject; private HybrisRemoteConnectionSettings mySettings; + private HybrisRemoteConnectionSettings setting; public SolrConnectionDialog( - @Nullable final Project project, - @Nullable final Component parentComponent, - @NotNull final HybrisRemoteConnectionSettings settings + @Nullable final Project project, + @Nullable final Component parentComponent, + @NotNull final HybrisRemoteConnectionSettings settings ) { super(project, parentComponent, false, PROJECT); myProject = project; @@ -60,49 +65,68 @@ public SolrConnectionDialog( solrWebrootTextField.setText(mySettings.getSolrWebroot()); loginTextField.setText(mySettings.getAdminLogin()); passwordField.setText(mySettings.getAdminPassword()); + sslButton.setSelected(mySettings.isSsl()); + setting = new HybrisRemoteConnectionSettings(); + saveSettings(settings); + + final SimpleDocumentListener validateListener = new SimpleDocumentListener() { + @Override + public void update(final DocumentEvent e) { + validateParams(); + } + }; final SimpleDocumentListener saveSettingsDocumentListener = new SimpleDocumentListener() { @Override public void update(final DocumentEvent e) { - saveSettings(); + saveSettings(setting); } }; - saveSettings(); + validateParams(); + saveSettings(setting); init(); + solrIpTextField.getDocument().addDocumentListener(validateListener); + solrPortTextField.getDocument().addDocumentListener(validateListener); + displayNameTextField.getDocument().addDocumentListener(saveSettingsDocumentListener); solrIpTextField.getDocument().addDocumentListener(saveSettingsDocumentListener); solrPortTextField.getDocument().addDocumentListener(saveSettingsDocumentListener); solrWebrootTextField.getDocument().addDocumentListener(saveSettingsDocumentListener); - displayNameTextField.addActionListener(action->saveSettings()); - solrIpTextField.addActionListener(action->saveSettings()); - solrWebrootTextField.addActionListener(action->saveSettings()); - loginTextField.addActionListener(action->saveSettings()); - passwordField.addActionListener(action->saveSettings()); - testConnectionButton.addActionListener(action->testConnection()); + displayNameTextField.addActionListener(action->saveSettings(setting)); + solrIpTextField.addActionListener(action->saveSettings(setting)); + solrWebrootTextField.addActionListener(action->saveSettings(setting)); + loginTextField.addActionListener(action->saveSettings(setting)); + passwordField.addActionListener(action->saveSettings(setting)); + sslButton.addActionListener(action->saveSettings(setting)); + + + Objects.requireNonNull(getButton(getOKAction())).addActionListener(action->saveSettings(mySettings)); + testConnectionButton.addActionListener(action -> testConnection()); } private void testConnection() { - saveSettings(); + saveSettings(setting); String message; NotificationType type; try { - SolrHttpClient.getInstance(myProject).listOfCores(myProject, mySettings); - message = HybrisI18NBundleUtils.message("hybris.toolwindow.hac.test.connection.success", "SOLR" , mySettings.getGeneratedURL()); + SolrHttpClient.getInstance(myProject).listOfCores(myProject, setting); + message = HybrisI18NBundleUtils.message("hybris.toolwindow.hac.test.connection.success", "SOLR" , setting.getGeneratedURL()); type = NotificationType.INFORMATION; } catch (Exception e) { LOG.warn(e.getMessage(), e); type = NotificationType.WARNING; - message = HybrisI18NBundleUtils.message("hybris.toolwindow.hac.test.connection.fail", mySettings.getGeneratedURL(), e.getMessage()); + message = HybrisI18NBundleUtils.message("hybris.toolwindow.hac.test.connection.fail", setting.getGeneratedURL(), e.getMessage()); } NotificationUtil.NOTIFICATION_GROUP.createNotification( - HybrisI18NBundleUtils.message("hybris.toolwindow.hac.test.connection.title"), message, type, null + HybrisI18NBundleUtils.message("hybris.toolwindow.hac.test.connection.title"), message, type ).notify(myProject); } - private void saveSettings() { + private void saveSettings(HybrisRemoteConnectionSettings mySettings) { + mySettings.setSsl(sslButton.isSelected()); mySettings.setDisplayName(displayNameTextField.getText()); mySettings.setType(HybrisRemoteConnectionSettings.Type.SOLR); mySettings.setHostIP(solrIpTextField.getText()); @@ -110,11 +134,20 @@ private void saveSettings() { mySettings.setSolrWebroot(solrWebrootTextField.getText()); mySettings.setAdminLogin(loginTextField.getText()); mySettings.setAdminPassword(new String(passwordField.getPassword())); - final String previewUrl = CommonIdeaService.getInstance().getHostSolrUrl(myProject, mySettings); + final String previewUrl = CommonIdeaService.getInstance().getSolrUrl(myProject, mySettings); projectUrlPreviewValueLabel.setText(previewUrl); mySettings.setGeneratedURL(previewUrl); } + private void validateParams() { + testConnectionButton + .setEnabled(!solrPortTextField.getText().isEmpty() + && !solrIpTextField.getText().isEmpty()); + + getOKAction().setEnabled(!solrPortTextField.getText().isEmpty() + && !solrIpTextField.getText().isEmpty()); + } + @Nullable @Override protected JComponent createCenterPanel() { diff --git a/src/com/intellij/idea/plugin/hybris/type/system/converter/AttributeHandlerReferenceConverter.kt b/src/com/intellij/idea/plugin/hybris/type/system/converter/AttributeHandlerReferenceConverter.kt index 7507ed043..e0822c8b6 100644 --- a/src/com/intellij/idea/plugin/hybris/type/system/converter/AttributeHandlerReferenceConverter.kt +++ b/src/com/intellij/idea/plugin/hybris/type/system/converter/AttributeHandlerReferenceConverter.kt @@ -46,7 +46,7 @@ class AttributeHandlerReferenceConverter : CustomReferenceConverter { override fun getRangeInElement() = TextRange.from(1, element.textLength - QUOTE_LENGTH) override fun multiResolve(incompleteCode: Boolean): Array { - val psiSearchHelper = PsiSearchHelper.SERVICE.getInstance(project) + val psiSearchHelper = PsiSearchHelper.getInstance(project) val module = ModuleUtil.findModuleForPsiElement(element) val foundEls = mutableListOf() diff --git a/src/com/intellij/idea/plugin/hybris/type/system/converter/AttributeReferenceConverter.kt b/src/com/intellij/idea/plugin/hybris/type/system/converter/AttributeReferenceConverter.kt index 930157a1e..55435af10 100644 --- a/src/com/intellij/idea/plugin/hybris/type/system/converter/AttributeReferenceConverter.kt +++ b/src/com/intellij/idea/plugin/hybris/type/system/converter/AttributeReferenceConverter.kt @@ -57,7 +57,7 @@ class AttributeReferenceConverter : CustomReferenceConverter { val project = element.project val className = findItemTag(element).getAttributeValue("code") val psiElements = mutableListOf() - val searchFieldName = (element as XmlAttributeValueImpl).value!! + val searchFieldName = (element as XmlAttributeValueImpl).value if (className != null) { arrayListOf(className, "${className}Model").forEach { name -> @@ -65,7 +65,7 @@ class AttributeReferenceConverter : CustomReferenceConverter { name, GlobalSearchScope.allScope(project) ) psiClasses.forEach { psiClass -> - val psiField = PsiClassImplUtil.findFieldByName(psiClass, searchFieldName.toUpperCase(), true) + val psiField = PsiClassImplUtil.findFieldByName(psiClass, searchFieldName.uppercase(), true) if (psiField != null) psiElements.add(psiField) val psiGetterMethod = findGetter(psiClass, searchFieldName, true) if (psiGetterMethod != null) psiElements.add(psiGetterMethod) diff --git a/src/com/intellij/idea/plugin/hybris/type/system/editor/TypeSystemGutterAnnotator.java b/src/com/intellij/idea/plugin/hybris/type/system/editor/TypeSystemGutterAnnotator.java index dead7e47d..c9dfc237f 100644 --- a/src/com/intellij/idea/plugin/hybris/type/system/editor/TypeSystemGutterAnnotator.java +++ b/src/com/intellij/idea/plugin/hybris/type/system/editor/TypeSystemGutterAnnotator.java @@ -78,7 +78,7 @@ public void annotate( final Collection alternativeDoms = findAlternativeDoms(itemType); if (!alternativeDoms.isEmpty()) { NavigationGutterIconBuilder - .create(AllIcons.Actions.Nextfile, TypeSystemGutterAnnotator::findAlternativeDoms) + .create(AllIcons.Actions.Forward, TypeSystemGutterAnnotator::findAlternativeDoms) .setTarget(itemType) .setTooltipText(alternativeDoms.size() > 1 ? "Alternative Definitions" diff --git a/src/com/intellij/idea/plugin/hybris/type/system/inspections/ItemsXmlQuickFixManager.java b/src/com/intellij/idea/plugin/hybris/type/system/inspections/ItemsXmlQuickFixManager.java new file mode 100644 index 000000000..5fefda8d2 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/type/system/inspections/ItemsXmlQuickFixManager.java @@ -0,0 +1,76 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.type.system.inspections; + +import com.intellij.codeInspection.LocalQuickFix; +import com.intellij.idea.plugin.hybris.type.system.inspections.fix.XmlAddAttributeQuickFix; +import com.intellij.idea.plugin.hybris.type.system.inspections.fix.XmlAddTagQuickFix; +import org.jetbrains.annotations.NotNull; +import org.w3c.dom.Node; + +import java.util.SortedMap; +import java.util.TreeMap; + +public final class ItemsXmlQuickFixManager { + + private static final String DEPLOYMENT_TABLE_MUST_EXIST_FOR_ITEM_EXTENDING_GENERIC_ITEM = "DeploymentTableMustExistForItemExtendingGenericItem"; + private static final String MANDATORY_FIELD_MUST_HAVE_INITIAL_VALUE = "MandatoryFieldMustHaveInitialValue"; + private static final String IMMUTABLE_FIELD_MUST_HAVE_INITIAL_VALUE = "ImmutableFieldMustHaveInitialValue"; + private static final String BOOLEAN_FIELD_CANNOT_BE_OPTIONAL = "BooleanFieldCannotBeOptional"; + + private ItemsXmlQuickFixManager() { + } + + public static LocalQuickFix[] getQuickFixes(final XmlRule rule, final Node problemNode) { + // ! No sense to generate more than 5 quick fixes + final LocalQuickFix[] fixes = new LocalQuickFix[5]; + final String ruleID = rule.getID(); + + switch (ruleID) { + case MANDATORY_FIELD_MUST_HAVE_INITIAL_VALUE: + case IMMUTABLE_FIELD_MUST_HAVE_INITIAL_VALUE: + fixes[0] = new XmlAddTagQuickFix("defaultvalue", "", null, null); + fixes[1] = new XmlAddAttributeQuickFix("modifiers", "initial", "true"); + break; + case DEPLOYMENT_TABLE_MUST_EXIST_FOR_ITEM_EXTENDING_GENERIC_ITEM: + final SortedMap attributes = getAttributesForDeploymentTableFix(problemNode); + fixes[0] = new XmlAddTagQuickFix("deployment", null, attributes, "description"); + break; + case BOOLEAN_FIELD_CANNOT_BE_OPTIONAL: + fixes[0] = new XmlAddTagQuickFix("defaultvalue", "", null, null); + fixes[1] = new XmlAddAttributeQuickFix("modifiers", "optional", "false"); + break; + } + + return fixes; + } + + @NotNull + private static SortedMap getAttributesForDeploymentTableFix(final Node problemNode) { + // @ToDo: look on max possible table name length and add truncate + // ? Maybe there is a sense to create a separate check and fix for max possible table name? + final String tableCode = problemNode.getAttributes().getNamedItem("code").getNodeValue(); + final SortedMap attributes = new TreeMap<>(); + attributes.put("table", tableCode); + // @ToDo: add autogeneration of typecode + attributes.put("typecode", ""); + return attributes; + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/type/system/inspections/XmlRuleInspection.java b/src/com/intellij/idea/plugin/hybris/type/system/inspections/XmlRuleInspection.java index 230ef421f..8acb24372 100644 --- a/src/com/intellij/idea/plugin/hybris/type/system/inspections/XmlRuleInspection.java +++ b/src/com/intellij/idea/plugin/hybris/type/system/inspections/XmlRuleInspection.java @@ -20,6 +20,7 @@ import com.intellij.codeInspection.InspectionManager; import com.intellij.codeInspection.LocalInspectionTool; +import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.ProblemDescriptor; import com.intellij.codeInspection.ProblemHighlightType; import com.intellij.idea.plugin.hybris.type.system.utils.TypeSystemUtils; @@ -143,19 +144,21 @@ private XmlRule[] loadRules() throws IOException { } protected ProblemDescriptor createProblem( - @NotNull final ValidateContext context, - @NotNull final Node problemNode, - @NotNull final XmlRule rule + @NotNull final ValidateContext context, + @NotNull final Node problemNode, + @NotNull final XmlRule rule ) { final PsiElement problemPsi = context.mapNodeToPsi(problemNode); final ProblemHighlightType highlightType = this.computePriority(rule); + final LocalQuickFix[] fixes = ItemsXmlQuickFixManager.getQuickFixes(rule, problemNode); return context.getManager().createProblemDescriptor( - problemPsi, - rule.getDescription(), - true, - highlightType, - context.isOnTheFly() + problemPsi, + rule.getDescription(), + true, + highlightType, + context.isOnTheFly(), + fixes ); } diff --git a/src/com/intellij/idea/plugin/hybris/type/system/inspections/fix/XmlAddAttributeQuickFix.java b/src/com/intellij/idea/plugin/hybris/type/system/inspections/fix/XmlAddAttributeQuickFix.java new file mode 100644 index 000000000..532f5a998 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/type/system/inspections/fix/XmlAddAttributeQuickFix.java @@ -0,0 +1,79 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.type.system.inspections.fix; + +import com.intellij.codeInspection.LocalQuickFix; +import com.intellij.codeInspection.ProblemDescriptor; +import com.intellij.openapi.project.Project; +import com.intellij.psi.PsiElement; +import com.intellij.psi.xml.XmlAttribute; +import com.intellij.psi.xml.XmlTag; +import com.intellij.util.PsiNavigateUtil; +import org.jetbrains.annotations.NotNull; + +public class XmlAddAttributeQuickFix implements LocalQuickFix { + + private final String fixName; + private final String tagName; + private final String attributeName; + private final String attributeValue; + + public XmlAddAttributeQuickFix( + final String tagName, + final String attributeName, + final String attributeValue + ) { + this.fixName = "Add/update attribute " + attributeName + "=" + attributeValue; + this.tagName = tagName; + this.attributeName = attributeName; + this.attributeValue = attributeValue; + } + + + @NotNull + @Override + public String getFamilyName() { + return fixName; + } + + @Override + public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) { + final PsiElement currentElement = descriptor.getPsiElement(); + + if (currentElement instanceof XmlTag) { + final XmlTag currentTag = (XmlTag) currentElement; + final XmlAttribute xmlAttribute; + XmlTag modifiersTag = currentTag.findFirstSubTag(tagName); + if (modifiersTag == null) { + // Create tag + final XmlTag tagToInsert = currentTag.createChildTag( + tagName, + currentTag.getNamespace(), + null, + false + ); + + // Insert tag + modifiersTag = currentTag.addSubTag(tagToInsert, true); + } + xmlAttribute = modifiersTag.setAttribute(attributeName, attributeValue); + PsiNavigateUtil.navigate(xmlAttribute); + } + } +} diff --git a/src/com/intellij/idea/plugin/hybris/type/system/inspections/fix/XmlAddTagQuickFix.java b/src/com/intellij/idea/plugin/hybris/type/system/inspections/fix/XmlAddTagQuickFix.java new file mode 100644 index 000000000..d47309348 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/type/system/inspections/fix/XmlAddTagQuickFix.java @@ -0,0 +1,109 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.type.system.inspections.fix; + +import com.intellij.codeInspection.LocalQuickFix; +import com.intellij.codeInspection.ProblemDescriptor; +import com.intellij.lang.ASTNode; +import com.intellij.openapi.project.Project; +import com.intellij.psi.PsiElement; +import com.intellij.psi.impl.source.xml.XmlTagImpl; +import com.intellij.psi.tree.TokenSet; +import com.intellij.psi.xml.XmlTag; +import com.intellij.psi.xml.XmlTokenType; +import com.intellij.util.PsiNavigateUtil; +import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.NotNull; + +import java.util.Collections; +import java.util.SortedMap; + +public class XmlAddTagQuickFix implements LocalQuickFix { + + private final String fixName; + private final String tagName; + private final String tagBody; + private SortedMap attributes; + + // ? Maybe better to have tag name and before/after boolean? + // ? Or maybe better to have different impl of XmlAddTagQuickFix and use factory? + private final String insertAfterTag; + + public XmlAddTagQuickFix( + final String tagName, + final String tagBody, + final SortedMap attributes, + final String insertAfterTag + ) { + this.fixName = "Add " + tagName + " tag"; + this.tagName = tagName; + this.tagBody = tagBody; + if (attributes != null) { + this.attributes = Collections.unmodifiableSortedMap(attributes); + } else { + this.attributes = Collections.emptySortedMap(); + } + this.insertAfterTag = insertAfterTag; + } + + + @NotNull + @Override + public String getFamilyName() { + return fixName; + } + + @Override + public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) { + final PsiElement currentElement = descriptor.getPsiElement(); + + if (currentElement instanceof XmlTag) { + final XmlTag currentTag = (XmlTag) currentElement; + + // Create tag + final XmlTag tagToInsert = currentTag.createChildTag( + tagName, + currentTag.getNamespace(), + tagBody, + false + ); + + // Insert tag + final XmlTag insertedTag; + if (StringUtils.isNotBlank(insertAfterTag)) { + XmlTag subTag = currentTag.findFirstSubTag(insertAfterTag); + insertedTag = (XmlTag) currentTag.addAfter(tagToInsert, subTag); + } else { + insertedTag = currentTag.addSubTag(tagToInsert, true); + } + + // Add attributes + attributes.forEach(insertedTag::setAttribute); + + // Change cursor position + // ? Maybe there is a better default cursor placement than before end of tag? + final ASTNode[] children = ((XmlTagImpl) insertedTag).getChildren(TokenSet.create(XmlTokenType.XML_END_TAG_START)); + if (children.length > 0) { + PsiNavigateUtil.navigate(children[0].getPsi()); + } else { + PsiNavigateUtil.navigate(insertedTag); + } + } + } +} diff --git a/src/com/intellij/idea/plugin/hybris/type/system/validation/TypeSystemValidationComponent.java b/src/com/intellij/idea/plugin/hybris/type/system/validation/TypeSystemValidationComponent.java index 79e2e7367..b1ec952ca 100644 --- a/src/com/intellij/idea/plugin/hybris/type/system/validation/TypeSystemValidationComponent.java +++ b/src/com/intellij/idea/plugin/hybris/type/system/validation/TypeSystemValidationComponent.java @@ -21,6 +21,7 @@ import com.intellij.idea.plugin.hybris.type.system.validation.impl.ProjectOpenAndItemsXmlFileOpenListener; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.ApplicationComponent; +import com.intellij.openapi.components.BaseComponent; import com.intellij.openapi.project.ProjectManager; @@ -29,7 +30,7 @@ * * @author Alexander Bartash */ -public class TypeSystemValidationComponent implements ApplicationComponent { +public class TypeSystemValidationComponent implements BaseComponent { protected final ProjectOpenAndItemsXmlFileOpenListener itemsXMLFileOpenListener = new ProjectOpenAndItemsXmlFileOpenListener(); diff --git a/src/com/intellij/idea/plugin/hybris/view/HybrisProjectView.java b/src/com/intellij/idea/plugin/hybris/view/HybrisProjectView.java index 36666a96e..828dc0fb6 100644 --- a/src/com/intellij/idea/plugin/hybris/view/HybrisProjectView.java +++ b/src/com/intellij/idea/plugin/hybris/view/HybrisProjectView.java @@ -82,9 +82,9 @@ public HybrisProjectView(@NotNull final Project project) { @Override @NotNull - public Collection modify( - @NotNull final AbstractTreeNode parent, - @NotNull final Collection children, + public Collection> modify( + @NotNull final AbstractTreeNode parent, + @NotNull final Collection> children, final ViewSettings settings ) { Validate.notNull(parent); @@ -108,7 +108,7 @@ public Collection modify( return this.modifyExternalLibrariesNodes(children); } - final Collection childrenWithProcessedJunkFiles = this.processJunkFiles(children, settings); + final Collection> childrenWithProcessedJunkFiles = this.processJunkFiles(children, settings); return this.isCompactEmptyMiddleFoldersEnabled(settings) ? this.compactEmptyMiddlePackages(parent, childrenWithProcessedJunkFiles) @@ -117,7 +117,7 @@ public Collection modify( private void modifyIcons( final ProjectViewModuleGroupNode parent, - final Collection children + final Collection> children ) { if (parent.getValue() != null) { ModuleGroup moduleGroup = parent.getValue(); @@ -164,14 +164,14 @@ protected boolean isCompactEmptyMiddleFoldersEnabled(@Nullable final NodeOptions } @NotNull - protected Collection modifyExternalLibrariesNodes( - @NotNull final Collection children + protected Collection> modifyExternalLibrariesNodes( + @NotNull final Collection> children ) { Validate.notNull(children); - final Collection treeNodes = new ArrayList(); + final Collection> treeNodes = new ArrayList<>(); - for (AbstractTreeNode child : children) { + for (AbstractTreeNode child : children) { if (child instanceof PsiDirectoryNode) { final VirtualFile virtualFile = ((PsiDirectoryNode) child).getVirtualFile(); @@ -191,8 +191,8 @@ protected Collection modifyExternalLibrariesNodes( } @NotNull - protected Collection processJunkFiles( - @NotNull final Collection children, + protected Collection> processJunkFiles( + @NotNull final Collection> children, @Nullable final ViewSettings settings ) { Validate.notNull(children); @@ -203,8 +203,8 @@ protected Collection processJunkFiles( return children; } - final List junkTreeNodes = new ArrayList(); - final Collection treeNodes = new ArrayList(); + final List> junkTreeNodes = new ArrayList<>(); + final Collection> treeNodes = new ArrayList<>(); for (AbstractTreeNode child : children) { if (child instanceof BasePsiNode) { @@ -233,9 +233,9 @@ protected Collection processJunkFiles( } @NotNull - protected Collection compactEmptyMiddlePackages( - @NotNull final AbstractTreeNode parent, - @NotNull final Collection children + protected Collection> compactEmptyMiddlePackages( + @NotNull final AbstractTreeNode parent, + @NotNull final Collection> children ) { Validate.notNull(parent); Validate.notNull(children); @@ -253,11 +253,11 @@ protected Collection compactEmptyMiddlePackages( } } - final Collection compactedChildren = new ArrayList(); + final Collection> compactedChildren = new ArrayList<>(); - for (AbstractTreeNode child : children) { + for (AbstractTreeNode child : children) { - final AbstractTreeNode compactedChild = this.recursivelyCompactEmptyMiddlePackages( + final AbstractTreeNode compactedChild = this.recursivelyCompactEmptyMiddlePackages( child, child.getChildren() ); @@ -268,9 +268,9 @@ protected Collection compactEmptyMiddlePackages( } @Nullable - protected AbstractTreeNode recursivelyCompactEmptyMiddlePackages( - @NotNull final AbstractTreeNode parent, - @Nullable final Collection children + protected AbstractTreeNode recursivelyCompactEmptyMiddlePackages( + @NotNull final AbstractTreeNode parent, + @Nullable final Collection> children ) { Validate.notNull(parent); @@ -283,7 +283,7 @@ protected AbstractTreeNode recursivelyCompactEmptyMiddlePackages( } if ((parent instanceof PsiDirectoryNode) && (children.size() == 1)) { - final AbstractTreeNode onlyChild = Iterables.getOnlyElement(children); + final AbstractTreeNode onlyChild = Iterables.getOnlyElement(children); if (onlyChild instanceof PsiDirectoryNode) { final PsiDirectoryNode parentPsiDirectoryNode = (PsiDirectoryNode) parent; @@ -384,7 +384,7 @@ protected List getJunkFileNames() { } @Override - public Object getData(final Collection selected, final String dataName) { + public Object getData(final Collection> selected, final String dataName) { return null; } } diff --git a/src/com/intellij/idea/plugin/hybris/view/JunkProjectViewNode.java b/src/com/intellij/idea/plugin/hybris/view/JunkProjectViewNode.java index 80010333f..af9d044b0 100644 --- a/src/com/intellij/idea/plugin/hybris/view/JunkProjectViewNode.java +++ b/src/com/intellij/idea/plugin/hybris/view/JunkProjectViewNode.java @@ -37,11 +37,11 @@ * * @author Alexander Bartash */ -public class JunkProjectViewNode extends ProjectViewNode> { +public class JunkProjectViewNode extends ProjectViewNode>> { public JunkProjectViewNode( final Project project, - final List children, + final List> children, final ViewSettings settings ) { super(project, children, settings); @@ -49,7 +49,7 @@ public JunkProjectViewNode( @Override @NotNull - public Collection getChildren() { + public Collection> getChildren() { return this.getValue(); } diff --git a/src/flexibleSearch.bnf b/src/flexibleSearch.bnf new file mode 100644 index 000000000..126390462 --- /dev/null +++ b/src/flexibleSearch.bnf @@ -0,0 +1,306 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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 . + */ + +// +// FlexibleSearch BNF Grammar +// +{ + parserClass="com.intellij.idea.plugin.hybris.flexibleSearch.FlexibleSearchParser" + parserUtilClass="com.intellij.idea.plugin.hybris.flexibleSearch.utils.FlexibleSearchParserUtils" + + extends="com.intellij.extapi.psi.ASTWrapperPsiElement" + + psiClassPrefix="FlexibleSearch" + psiImplClassSuffix="Impl" + psiPackage="com.intellij.idea.plugin.hybris.flexibleSearch.psi" + psiImplPackage="com.intellij.idea.plugin.hybris.flexibleSearch.psi.impl" + + elementTypeHolderClass="com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes" + elementTypeClass="com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchElementType" + tokenTypeClass="com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTokenType" + + tokens = [ + PERCENT = '%' + QUOTE = "'" + ASTERISK = "*" + PLUS_SIGN = "+" + COMMA = "," + MINUS_SIGN = "-" + DOT = "." + COLON = ":" + SEMICOLON = ';' + QUESTION_MARK = '?' + EXCLAMATION_MARK = "!" + UNDERSCORE = "_" + + LEFT_BRACKET = "[" + RIGHT_BRACKET = "]" + LEFT_PAREN = '(' + RIGHT_PAREN = ')' + LEFT_BRACE = "regexp:(\{)" + RIGHT_BRACE = "regexp:(\})" + RIGHT_DOUBLE_BRACE = "regexp:(}})" + LEFT_DOUBLE_BRACE = "regexp:(\{\{)" + + EQUALS_OPERATOR = 'regexp:(=)' + NOT_EQUALS_OPERATOR = '<>' + GREATER_THAN_OPERATOR = '>' + GREATER_THAN_OR_EQUALS_OPERATOR = "regexp:(>=)" + LESS_THAN_OPERATOR = "<" + LESS_THAN_OR_EQUALS_OPERATOR = "regexp:(<=)" + + + SPACE = 'regexp:\s+' + IDENTIFIER = 'regexp:\p{Alpha}\w*' + PARAMETER_IDENTIFIER = 'regexp:([:jletter:] [:jletterdigit:]*)' + COLUMN_REFERENCE_IDENTIFIER = 'regexp:([:jletter:] [:jletterdigit:]*)' + TABLE_NAME_IDENTIFIER = 'regexp:([:jletter:] [:jletterdigit:]*)' + STRING = "regexp:('([^'\\]|\\.)*'|\"([^\"\\]|\\\"|\\\'|\\)*\")" + NUMBER = 'regexp:[:jdigit:]*' + ] +} + +flexibleSearchFile ::= ( statement )? ( ';' ( statement )? )* + +private statement ::= !<> (query_specification empty_statement?)* empty_statement? +{recoverWhile = expressionRecoverWhile } + +private expressionRecoverWhile ::= !(SEMICOLON | <> ) + +private empty_statement ::= (SEMICOLON | <>) + +// Specify a table derived from the result of a
    . + +query_specification ::= SELECT [ set_quantifier ] select_list table_expression (SEMICOLON | <>)? +{pin = 1 recoverWhile= querySpecificationRecoverWhile} +private querySpecificationRecoverWhile ::= !( SEMICOLON | query_specification | RIGHT_DOUBLE_BRACE) + +select_list ::= ASTERISK | select_sublist [ ( COMMA select_sublist )* ] +{pin=2 recoverWhile=select_list_recover} +private select_list_recover ::= !(FROM) + +select_sublist ::= derived_column | (aggregate_function [COMMA aggregate_function*]) + +derived_column ::= value_expression [ AS correlation_name ] + +set_quantifier ::= (DISTINCT | ALL) + +aggregate_function ::= + COUNT LEFT_PAREN ASTERISK RIGHT_PAREN + | general_set_function + +general_set_function ::= set_function_type LEFT_PAREN [ set_quantifier ] value_expression RIGHT_PAREN [ [ AS ] correlation_name ] + +set_function_type ::= computational_operation + +private computational_operation ::= + AVG | MAX | MIN | SUM + | EVERY | ANY | SOME + | COUNT + +table_expression ::= from_clause + where_clause? + order_by_clause? + group_by_clause? + +order_by_clause ::= ORDER BY sort_specification_list +{pin = 1 recoverWhile = orderByClauseRecoverWhile} + +private orderByClauseRecoverWhile ::= !( SEMICOLON | query_specification | RIGHT_DOUBLE_BRACE) + +sort_specification_list ::= sort_specification [ { COMMA sort_specification }* ] + +sort_specification ::= sort_key [ ordering_specification ] [ null_ordering ] + +sort_key ::= value_expression + +ordering_specification ::= ASC | DESC + +null_ordering ::= NULLS FIRST | NULLS LAST + + +//Specify a table derived from one or more tables. + +// ::= FROM
    +from_clause ::= FROM LEFT_PAREN? (LEFT_BRACE table_reference_list RIGHT_BRACE | subquery ) RIGHT_PAREN? +{pin = 1 recoverWhile=from_clause_recover} +private from_clause_recover ::= !(WHERE | SELECT | FROM | SEMICOLON ) + +table_reference_list ::= table_reference [ ( COMMA? table_reference )* ] +{pin=1} + +table_reference ::= table_primary [joined_table*] +{pin=1} + +table_primary ::= table_name [ [ AS ] correlation_name ] +{pin=1 /*recoverWhile=table_primary_recover*/} +private table_primary_recover ::= !(JOIN) + +table_name ::= TABLE_NAME_IDENTIFIER [ EXCLAMATION_MARK ] +{ + pin=1 + mixin = "com.intellij.idea.plugin.hybris.flexibleSearch.references.TypeNameMixin" + recoverWhile = table_name_recover +} +private table_name_recover ::= !(RIGHT_BRACE | AS | JOIN | ON | SPACE | " ") + +correlation_name ::= IDENTIFIER + +// 7.7 (p312) +// Specify a table derived from a Cartesian product, inner or outer join, or union join. + +joined_table ::= [ join_type ] JOIN table_reference join_specification +{pin = 2} + +join_specification ::= join_condition +{pin = 1} + +join_condition ::= ON search_condition +{pin = 1 recoverWhile = join_condition_recover} +private join_condition_recover ::= !( RIGHT_BRACE | LEFT | JOIN ) + +join_type ::= LEFT | + + +table_subquery ::= subquery + +subquery ::= +LEFT_PAREN? LEFT_DOUBLE_BRACE query_specification RIGHT_DOUBLE_BRACE [(UNION ALL? subquery)*] RIGHT_PAREN? [ [ AS ] correlation_name ] +{pin=2} + +where_clause ::= WHERE search_condition +{pin=1 recoverWhile=where_clause_recover} +private where_clause_recover ::= !('{{' | <> | SELECT | ORDER | LEFT_PAREN | SEMICOLON | RIGHT_DOUBLE_BRACE ) + +search_condition ::= boolean_value_expression + +// boolean_value_expression +boolean_value_expression ::= boolean_term + +boolean_term ::= boolean_factor [([AND|OR] boolean_term)*] +{pin = 1/* recoverWhile= boolean_term_recover*/} +private boolean_term_recover ::= !(JOIN) + +boolean_factor ::= [ NOT ] boolean_test + +boolean_test ::= boolean_primary [ IS [ NOT ] truth_value ] + +truth_value ::= TRUE | FALSE + +boolean_primary ::= boolean_predicand | predicate + +/* +boolean_predicand ::= parenthesized_boolean_value_expression + +parenthesized_boolean_value_expression ::= LEFT_PAREN boolean_value_expression LEFT_PAREN + +nonparenthesized_value_expression_primary ::= id +*/ + +boolean_predicand ::= parenthesized_boolean_value_expression | nonparenthesized_value_expression_primary + +private parenthesized_boolean_value_expression ::= LEFT_PAREN boolean_value_expression RIGHT_PAREN +{pin = 1 } + +private nonparenthesized_value_expression_primary ::= column_reference +//Predicates +//Specify a condition that can be evaluated to give a boolean value. + +predicate ::= comparison_predicate + | between_predicate + | like_predicate + | null_predicate + | exists_predicate + | in_predicate + +null_predicate ::= row_value_predicand IS [ NOT ] NULL + +exists_predicate ::= EXISTS table_subquery + +in_predicate ::= row_value_predicand IN (table_subquery | LEFT_PAREN? row_value_predicand RIGHT_PAREN?) + +//Specify a comparison of two row values. +private comparison_predicate ::= row_value_predicand? comp_op row_value_predicand +{pin=2} +comp_op ::= + EQUALS_OPERATOR + | GREATER_THAN_OPERATOR + | NOT_EQUALS_OPERATOR + | LESS_THAN_OPERATOR + | LESS_THAN_OR_EQUALS_OPERATOR + | GREATER_THAN_OR_EQUALS_OPERATOR + + +// Specify a range comparison. +between_predicate ::= row_value_predicand [ NOT ] BETWEEN row_value_predicand AND row_value_predicand + +row_value_predicand ::= value_expression | common_value_expression (','common_value_expression)* + +common_value_expression ::= string_value_expression | NUMBER + +like_predicate ::= character_like_predicate + +character_like_predicate ::= row_value_predicand [ NOT ] LIKE (character_pattern | value_expression) + +character_pattern ::= STRING | string_value_function + +string_value_expression ::= general_literal + +general_literal ::= character_string_literal + +character_string_literal ::= STRING + +string_value_function ::= character_value_function + +character_value_function ::= character_substring_function + +character_substring_function ::= + CONCAT LEFT_PAREN string_value_expression COMMA (character_substring_function | string_value_expression) RIGHT_PAREN + +value_expression ::= NUMBER + | parameter_reference + | column_reference_value + +private column_reference_value ::= LEFT_BRACE? column_reference column_localization? RIGHT_BRACE? +{pin = 2 /*recoverWhile=column_reference_value_recover*/} + +column_localization ::= LEFT_BRACKET IDENTIFIER RIGHT_BRACKET + +private identifier_chain ::= (IDENTIFIER | TABLE_NAME_IDENTIFIER | COLUMN_REFERENCE_IDENTIFIER) [ ( (DOT|COLON) (IDENTIFIER | COLUMN_REFERENCE_IDENTIFIER) )* ] + +parameter_reference ::= QUESTION_MARK PARAMETER_IDENTIFIER +{pin = 1} +column_reference ::= identifier_chain +{ + pin = 1 + mixin = "com.intellij.idea.plugin.hybris.flexibleSearch.references.ColumnReferenceMixin" + recoverWhile = column_reference_recover +} +private column_reference_recover ::= !(<> | IDENTIFIER | LINE_TERMINATOR | RIGHT_BRACE | FROM | LEFT_BRACKET | SEMICOLON | WHITE_SPACE | AND | ORDER | IS | OR | COMMA | RIGHT_PAREN | IN | RIGHT_DOUBLE_BRACE | comp_op) + +group_by_clause ::= GROUP BY [ set_quantifier ] grouping_element_list + +grouping_element_list ::= grouping_element [ { COMMA grouping_element }* ] + +grouping_element ::= ordinary_grouping_set + +ordinary_grouping_set ::= grouping_column_reference | LEFT_PAREN grouping_column_reference_list RIGHT_PAREN + +grouping_column_reference ::= value_expression + +grouping_column_reference_list ::= grouping_column_reference [ { COMMA grouping_column_reference }* ] diff --git a/src/flexibleSearch.flex b/src/flexibleSearch.flex new file mode 100644 index 000000000..2e06b1896 --- /dev/null +++ b/src/flexibleSearch.flex @@ -0,0 +1,406 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * 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.flexibleSearch; + +import com.intellij.lexer.FlexLexer; +import com.intellij.psi.tree.IElementType; + +import com.intellij.psi.TokenType; + +import static com.intellij.psi.TokenType.WHITE_SPACE; +import static com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTypes.*; +import static com.intellij.idea.plugin.hybris.flexibleSearch.FlexibleSearchParserDefinition.COMMENT; +%% + +%public +%class FlexibleSearchLexer +%implements FlexLexer +/* We're scanning text. */ +%unicode + +%{ + private int myPrevState = YYINITIAL; + + public int yyprevstate() { + return myPrevState; + } + + private int popState() { + final int prev = myPrevState; + myPrevState = YYINITIAL; + return prev; + } + + protected void pushState(int state){ + myPrevState = state; + } + +%} + +%function advance +%type IElementType +%eof{ + return; +%eof} + + +/* Ignore case when matching keywords */ +%ignorecase + + +IDENTIFIER = [:jletter:] [:jletterdigit:]* +LINE_TERMINATOR = \r|\n|\r\n + +/* comments */ +COMMENT = "-""-"[^\r\n]* + +// Strings +ESCAPE_SEQUENCE = \\[^\r\n] +CHARACTER_LITERAL = "'" ([^\\\'\r\n] | {ESCAPE_SEQUENCE})* ("'"|\\)? +STRING_LITERAL = \" ([^\\\"\r\n] | {ESCAPE_SEQUENCE})* (\"|\\)? + +/* main character classes */ +DIGIT = [:digit:] +INTEGER = {DIGIT}+ +WHITE_SPACE = \s+ + +PERCENT = [%] +QUOTE = ['] +COMMA = "," +DOT = "." +COLON = [:] +SEMICOLON = [;] +LEFT_PAREN = [(] +RIGHT_PAREN = [)] +ASTERISK = [*] +PLUS_SIGN = [+] +MINUS_SIGN = [-] +LESS_THAN_OPERATOR = [<] +EQUALS_OPERATOR = [=] +GREATER_THAN_OPERATOR = [>] +LESS_THAN_OR_EQUALS_OPERATOR = <= +GREATER_THAN_OR_EQUALS_OPERATOR = >= +NON_EQUAL_OPERATOR = <> +QUESTION_MARK = "?" +EXCLAMATION_MARK = [!] +LEFT_BRACKET = [\[] +RIGHT_BRACKET = [\]] +UNDERSCORE = [_] +LEFT_BRACE = "{" +LEFT_DOUBLE_BRACE = "{{" +RIGHT_BRACE = "}" +RIGHT_DOUBLE_BRACE = "}}" +EOL = \n|\r\n + +%state SELECT_EXP +%state FROM_EXP +%state TABLE_IDENTIFIER +%state COLUMN_IDENTIFIER +%state PARAMETER_EXP +%state LOCALIZATION +%state WHERE_EXP +%state ON_EXP +%state CORRELATION_NAME +%state SUB_QUERY + +%% + + { + {INTEGER} { return NUMBER; } + {COMMENT} { return COMMENT; } + + /* keywords */ + "SELECT" { yybegin(SELECT_EXP); pushState(YYINITIAL); return SELECT; } + "AS" { yybegin(CORRELATION_NAME);return AS; } + "DISTINCT" { return DISTINCT; } + "ALL" { return ALL; } + "COUNT" { return COUNT; } + "CONCAT" { return CONCAT; } + "AVG" { return AVG; } + "MAX" { return MAX; } + "MIN" { return MIN; } + "SUM" { return SUM; } + "EVERY" { return EVERY; } + "ANY" { return ANY; } + "SOME" { return SOME; } + "ORDER" { return ORDER; } + "BY" { return BY; } + "ASC" { return ASC; } + "DESC" { return DESC; } + "FIRST" { return FIRST; } + "LAST" { return LAST; } + "FROM" { yybegin(FROM_EXP); return FROM; } + "ON" { yybegin(ON_EXP); pushState(FROM_EXP); return ON; } + "UNION" { return UNION; } + "WHERE" { yybegin(WHERE_EXP); return WHERE; } + "AND" { return AND; } + "OR" { return OR; } + "NOT" { return NOT; } + "IS" { return IS; } + "IN" { return IN; } + "TRUE" { return TRUE; } + "FALSE" { return FALSE; } + "NULL" { return NULL; } + "EXISTS" { return EXISTS; } + "BETWEEN" { return BETWEEN; } + "LIKE" { return LIKE; } + "CONCAT" { return CONCAT; } + "GROUP" { return GROUP; } + + + {LEFT_BRACKET} { return RIGHT_BRACKET; } + {RIGHT_BRACKET} { return RIGHT_BRACKET; } + {LEFT_BRACE} { return LEFT_BRACE; } + {RIGHT_BRACE} { return RIGHT_BRACE; } + {LEFT_DOUBLE_BRACE} { return LEFT_DOUBLE_BRACE; } + {RIGHT_DOUBLE_BRACE} { return RIGHT_DOUBLE_BRACE; } + {LEFT_PAREN} { return LEFT_PAREN; } + {RIGHT_PAREN} { return RIGHT_PAREN; } + {DOT} { return DOT; } + {COMMA} { return COMMA; } + {ASTERISK} { return ASTERISK; } + {COLON} { return COLON; } + {SEMICOLON} { return SEMICOLON; } + + + + {CHARACTER_LITERAL} { return STRING; } + {STRING_LITERAL} { return STRING; } + {IDENTIFIER} { return IDENTIFIER; } +} + + + { + {INTEGER} { return NUMBER; } + {COMMENT} { return COMMENT; } + + {LEFT_BRACE} { yybegin(COLUMN_IDENTIFIER); pushState(SELECT_EXP); return LEFT_BRACE; } + {RIGHT_BRACE} { return RIGHT_BRACE; } + + {LEFT_PAREN} { return LEFT_PAREN; } + {RIGHT_PAREN} { return RIGHT_PAREN; } + {IDENTIFIER}{DOT} { yypushback(yylength()); yybegin(COLUMN_IDENTIFIER); pushState(SELECT_EXP);} + {DOT} { return DOT; } + {COMMA} { return COMMA; } + {ASTERISK} { return ASTERISK; } + {COLON} { return COLON; } + {SEMICOLON} { return SEMICOLON; } + + /* keywords */ + "SELECT" { return SELECT; } + "AS" { yybegin(CORRELATION_NAME); pushState(SELECT_EXP); return AS; } + "DISTINCT" { return DISTINCT; } + "ALL" { return ALL; } + "COUNT" { return COUNT; } + "CONCAT" { return CONCAT; } + "AVG" { return AVG; } + "MAX" { return MAX; } + "MIN" { return MIN; } + "SUM" { return SUM; } + "EVERY" { return EVERY; } + "ANY" { return ANY; } + "SOME" { return SOME; } + "BY" { return BY; } + "FROM" { yybegin(FROM_EXP); pushState(SELECT_EXP); return FROM; } + "IS" { return IS; } + "CONCAT" { return CONCAT; } + + "LEFT" { yybegin(popState()); return LEFT; } + + {CHARACTER_LITERAL} { return STRING; } + {STRING_LITERAL} { return STRING; } + {IDENTIFIER} { return COLUMN_REFERENCE_IDENTIFIER; } +} + + { + {INTEGER} { return NUMBER; } + {COMMENT} { return COMMENT; } + + {LEFT_BRACE} { yybegin(TABLE_IDENTIFIER); pushState(FROM_EXP); return LEFT_BRACE; } + {RIGHT_BRACE} { return RIGHT_BRACE; } + {LEFT_DOUBLE_BRACE} { yybegin(SUB_QUERY); pushState(FROM_EXP); return LEFT_DOUBLE_BRACE; } + {RIGHT_DOUBLE_BRACE} { return RIGHT_DOUBLE_BRACE; } + {LEFT_PAREN} { return LEFT_PAREN; } + {RIGHT_PAREN} { return RIGHT_PAREN; } + {DOT} { return DOT; } + {COMMA} { return COMMA; } + {EXCLAMATION_MARK} { return EXCLAMATION_MARK; } + {QUESTION_MARK} { return QUESTION_MARK; } + {COLON} { return COLON; } + {SEMICOLON} { return SEMICOLON; } + {EQUALS_OPERATOR} { return EQUALS_OPERATOR; } + + /* keywords */ + "SELECT" { yybegin(SELECT_EXP); pushState(FROM_EXP); return SELECT; } + "AS" { yybegin(CORRELATION_NAME); pushState(FROM_EXP); return AS; } + "ALL" { return ALL; } + "JOIN" { yybegin(TABLE_IDENTIFIER); pushState(FROM_EXP); return JOIN; } + "ON" { yybegin(ON_EXP); pushState(FROM_EXP); return ON; } + "LEFT" { return LEFT; } + "UNION" { return UNION; } + "WHERE" { yybegin(WHERE_EXP); pushState(FROM_EXP); return WHERE; } + "AND" { return AND; } + "OR" { return OR; } + "NOT" { return NOT; } + "IS" { return IS; } + "TRUE" { return TRUE; } + "FALSE" { return FALSE; } + "NULL" { return NULL; } + "EXISTS" { return EXISTS; } + "BETWEEN" { return BETWEEN; } + "LIKE" { return LIKE; } + "CONCAT" { return CONCAT; } + "GROUP" { return GROUP; } + + {CHARACTER_LITERAL} { return STRING; } + {STRING_LITERAL} { return STRING; } + {IDENTIFIER} { return IDENTIFIER; } +} + + { + "AS" { yybegin(CORRELATION_NAME); pushState(TABLE_IDENTIFIER); return AS; } + + {RIGHT_BRACE} { yybegin(popState()); return RIGHT_BRACE; } + {COMMA} { yybegin(popState()); return COMMA; } + "LEFT" { yybegin(FROM_EXP); return LEFT; } + + {EXCLAMATION_MARK} { return EXCLAMATION_MARK; } + {QUESTION_MARK} { return QUESTION_MARK; } + + {IDENTIFIER}{DOT}|{IDENTIFIER}{COLON} { yypushback(1); yybegin(COLUMN_IDENTIFIER); return TABLE_NAME_IDENTIFIER; } + + {IDENTIFIER} { yybegin(popState()); return TABLE_NAME_IDENTIFIER; } +} + + { + {INTEGER} { return NUMBER; } + {COMMENT} { return COMMENT; } + + /* keywords */ + "SELECT" { yybegin(SELECT_EXP); pushState(WHERE_EXP); return SELECT; } + "ORDER" { return ORDER; } + "BY" { return BY; } + "ASC" { return ASC; } + "DESC" { return DESC; } + "FIRST" { return FIRST; } + "LAST" { return LAST; } + "AND" { return AND; } + "OR" { return OR; } + "NOT" { return NOT; } + "IS" { return IS; } + "IN" { return IN; } + "TRUE" { return TRUE; } + "FALSE" { return FALSE; } + "NULL" { return NULL; } + "EXISTS" { return EXISTS; } + "BETWEEN" { return BETWEEN; } + "LIKE" { return LIKE; } + "CONCAT" { return CONCAT; } + "GROUP" { return GROUP; } + + "LEFT" { yybegin(FROM_EXP); pushState(WHERE_EXP); return LEFT; } + {IDENTIFIER}{DOT} { yypushback(yylength()); yybegin(COLUMN_IDENTIFIER); pushState(WHERE_EXP);} + + {LEFT_BRACE} { yybegin(COLUMN_IDENTIFIER); pushState(WHERE_EXP); return LEFT_BRACE; } + {RIGHT_BRACE} { return RIGHT_BRACE; } + {LEFT_DOUBLE_BRACE} { return LEFT_DOUBLE_BRACE; } + {RIGHT_DOUBLE_BRACE} { yybegin(popState()); return RIGHT_DOUBLE_BRACE; } + {LEFT_PAREN} { return LEFT_PAREN; } + {RIGHT_PAREN} { return RIGHT_PAREN; } + {DOT} { return DOT; } + {COMMA} { return COMMA; } + {EXCLAMATION_MARK} { return EXCLAMATION_MARK; } + {QUESTION_MARK} { yybegin(PARAMETER_EXP); pushState(WHERE_EXP); return QUESTION_MARK; } + {COLON} { return COLON; } + {SEMICOLON} { return SEMICOLON; } + + /* operators */ + {GREATER_THAN_OR_EQUALS_OPERATOR} { return GREATER_THAN_OR_EQUALS_OPERATOR; } + {LESS_THAN_OR_EQUALS_OPERATOR} { return LESS_THAN_OR_EQUALS_OPERATOR; } + {EQUALS_OPERATOR} { return EQUALS_OPERATOR; } + {LESS_THAN_OPERATOR} { return LESS_THAN_OPERATOR; } + {GREATER_THAN_OPERATOR} { return GREATER_THAN_OPERATOR; } + {NON_EQUAL_OPERATOR} { return NOT_EQUALS_OPERATOR; } + + {CHARACTER_LITERAL} { return STRING; } + {STRING_LITERAL} { return STRING; } + {IDENTIFIER} { return COLUMN_REFERENCE_IDENTIFIER; } +} + + { + {INTEGER} { return NUMBER; } + {COMMENT} { return COMMENT; } + + {LEFT_BRACE} { yybegin(COLUMN_IDENTIFIER); return LEFT_BRACE; } + {RIGHT_BRACE} { yybegin(popState()); return RIGHT_BRACE; } + + "LEFT" { yybegin(FROM_EXP); return LEFT; } + {QUESTION_MARK} { yybegin(PARAMETER_EXP); pushState(FROM_EXP); return QUESTION_MARK; } + /* operators */ +// {EQUALS_OPERATOR} { return EQUALS_OPERATOR; } + + {IDENTIFIER} { return IDENTIFIER; } +} + + { + "AS" { yybegin(CORRELATION_NAME); pushState(COLUMN_IDENTIFIER); return AS; } + + {IDENTIFIER}{LEFT_BRACKET} { yypushback(1); yybegin(LOCALIZATION); return COLUMN_REFERENCE_IDENTIFIER;} + {IDENTIFIER}{DOT}|{IDENTIFIER}{COLON} { yypushback(yylength()); yybegin(TABLE_IDENTIFIER); } + {DOT} { return DOT; } + {COMMA} { yybegin(popState()); return COMMA; } + {ASTERISK} { return ASTERISK; } + {COLON} { return COLON; } + {SEMICOLON} { return SEMICOLON; } + + {RIGHT_PAREN} { yybegin(popState()); return RIGHT_PAREN; } + {RIGHT_BRACE} { yybegin(popState()); return RIGHT_BRACE; } + + {EQUALS_OPERATOR} { yybegin(popState()); return EQUALS_OPERATOR; } + {WHITE_SPACE} { return WHITE_SPACE; } + + {IDENTIFIER} { yybegin(popState()); return COLUMN_REFERENCE_IDENTIFIER; } +} + + { + {IDENTIFIER} { yybegin(popState()); return PARAMETER_IDENTIFIER; } +} + + { + {LEFT_BRACKET} { return LEFT_BRACKET; } + {RIGHT_BRACKET} { yybegin(COLUMN_IDENTIFIER); return RIGHT_BRACKET; } + + {IDENTIFIER} { return IDENTIFIER; } +} + + { + "SELECT" { yybegin(SELECT_EXP); pushState(SUB_QUERY); return SELECT; } + + {RIGHT_DOUBLE_BRACE} { yybegin(FROM_EXP); return RIGHT_DOUBLE_BRACE; } +} + + { + "AS" { return AS; } + + {IDENTIFIER} { yybegin(popState()); return IDENTIFIER; } +} +{COMMENT} { return COMMENT; } +{WHITE_SPACE} { return WHITE_SPACE; } + +[^] { return TokenType.BAD_CHARACTER; }