├── java.header ├── bom ├── .settings │ └── org.eclipse.core.resources.prefs ├── settings.xml ├── .project ├── clean.launch ├── build.launch ├── plugin.launch └── pom.xml ├── targets ├── .settings │ └── org.eclipse.core.resources.prefs ├── .project ├── default │ ├── pom.xml │ └── default.target └── pom.xml ├── tests ├── ru.capralow.dt.adaptation.tests │ ├── workspace │ │ └── TestConfiguration │ │ │ ├── src │ │ │ ├── CommonModules │ │ │ │ ├── ОбщийМодуль │ │ │ │ │ ├── Module.bsl │ │ │ │ │ └── ОбщийМодуль.mdo │ │ │ │ ├── ОбщийМодульНетПрефикса │ │ │ │ │ ├── Module.bsl │ │ │ │ │ └── ОбщийМодульНетПрефикса.mdo │ │ │ │ ├── Префикс_ОбщийМодуль │ │ │ │ │ ├── Module.bsl │ │ │ │ │ └── Префикс_ОбщийМодуль.mdo │ │ │ │ └── Префикс_ОбщийМодульЛишнийПрефикс │ │ │ │ │ ├── Module.bsl │ │ │ │ │ └── Префикс_ОбщийМодульЛишнийПрефикс.mdo │ │ │ ├── Configuration │ │ │ │ ├── CommandInterface.cmi │ │ │ │ ├── MainSectionCommandInterface.cmi │ │ │ │ └── Configuration.mdo │ │ │ └── Subsystems │ │ │ │ ├── Подсистема │ │ │ │ ├── CommandInterface.cmi │ │ │ │ └── Подсистема.mdo │ │ │ │ ├── ВложеннаяПодсистема │ │ │ │ ├── CommandInterface.cmi │ │ │ │ ├── Subsystems │ │ │ │ │ └── Подсистема2 │ │ │ │ │ │ ├── CommandInterface.cmi │ │ │ │ │ │ └── Подсистема2.mdo │ │ │ │ └── ВложеннаяПодсистема.mdo │ │ │ │ ├── ИнтерфейснаяПодсистема │ │ │ │ ├── CommandInterface.cmi │ │ │ │ └── ИнтерфейснаяПодсистема.mdo │ │ │ │ ├── Префикс_Подсистема │ │ │ │ ├── CommandInterface.cmi │ │ │ │ └── Префикс_Подсистема.mdo │ │ │ │ ├── ПсевдоПрефикс_Подсистема │ │ │ │ ├── CommandInterface.cmi │ │ │ │ └── ПсевдоПрефикс_Подсистема.mdo │ │ │ │ └── ВложеннаяИнтерфейснаяПодсистема │ │ │ │ ├── CommandInterface.cmi │ │ │ │ ├── Subsystems │ │ │ │ └── ИнтерфейснаяПодсистема2 │ │ │ │ │ ├── CommandInterface.cmi │ │ │ │ │ └── ИнтерфейснаяПодсистема2.mdo │ │ │ │ └── ВложеннаяИнтерфейснаяПодсистема.mdo │ │ │ ├── DT-INF │ │ │ └── PROJECT.PMF │ │ │ ├── .settings │ │ │ ├── com._1c.g5.v8.dt.check.prefs │ │ │ ├── org.eclipse.core.resources.prefs │ │ │ └── Default.cset │ │ │ └── .project │ ├── .settings │ │ ├── org.eclipse.core.resources.prefs │ │ └── org.eclipse.jdt.core.prefs │ ├── build.properties │ ├── .classpath │ ├── pom.xml │ ├── .project │ ├── META-INF │ │ └── MANIFEST.MF │ ├── src │ │ └── ru │ │ │ └── capralow │ │ │ └── dt │ │ │ └── adaptation │ │ │ ├── prefix │ │ │ └── tests │ │ │ │ └── ObjectHasNoPrefixCheckTest.java │ │ │ └── internal │ │ │ └── tests │ │ │ └── TestingWorkspaceUtils.java │ └── tests.launch └── pom.xml ├── bundles ├── ru.capralow.dt.adaptation │ ├── src │ │ └── ru │ │ │ └── capralow │ │ │ └── dt │ │ │ └── adaptation │ │ │ ├── messages.properties │ │ │ ├── internal │ │ │ ├── messages.properties │ │ │ ├── messages_ru.properties │ │ │ ├── Messages.java │ │ │ ├── ExecutableExtensionFactory.java │ │ │ ├── ExternalDependenciesModule.java │ │ │ └── AdaptationPlugin.java │ │ │ ├── messages_ru.properties │ │ │ ├── Messages.java │ │ │ ├── PrefixUtils.java │ │ │ ├── prefix │ │ │ ├── messages.properties │ │ │ ├── Messages.java │ │ │ ├── messages_ru.properties │ │ │ └── PrefixCheck.java │ │ │ ├── MdUtils.java │ │ │ └── BslModelUtils.java │ ├── .settings │ │ ├── org.eclipse.core.resources.prefs │ │ └── org.eclipse.jdt.core.prefs │ ├── plugin.properties │ ├── build.properties │ ├── .classpath │ ├── plugin_ru.properties │ ├── plugin.xml │ ├── pom.xml │ ├── .project │ └── META-INF │ │ └── MANIFEST.MF └── pom.xml ├── features ├── ru.capralow.dt.adaptation.feature │ ├── .settings │ │ └── org.eclipse.core.resources.prefs │ ├── feature.properties │ ├── build.properties │ ├── feature_ru.properties │ ├── .project │ ├── pom.xml │ └── feature.xml └── pom.xml ├── repositories ├── ru.capralow.dt.adaptation.repository │ ├── .settings │ │ └── org.eclipse.core.resources.prefs │ ├── .project │ ├── category.xml │ ├── pom.xml │ └── index.html └── pom.xml ├── .gitignore ├── pom.xml ├── LICENSE ├── README.md └── checkstyle.xml /java.header: -------------------------------------------------------------------------------- 1 | ^/\**$ 2 | ^ \* Copyright \(c\) (\d\d\d\d), Alexander Kapralov$ 3 | ^ \*/$ -------------------------------------------------------------------------------- /bom/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 -------------------------------------------------------------------------------- /targets/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/CommonModules/ОбщийМодуль/Module.bsl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/CommonModules/ОбщийМодульНетПрефикса/Module.bsl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/CommonModules/Префикс_ОбщийМодуль/Module.bsl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/src/ru/capralow/dt/adaptation/messages.properties: -------------------------------------------------------------------------------- 1 | 2 | Internal_class = Internal class. 3 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/CommonModules/Префикс_ОбщийМодульЛишнийПрефикс/Module.bsl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/DT-INF/PROJECT.PMF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Runtime-Version: 8.3.16 3 | -------------------------------------------------------------------------------- /features/ru.capralow.dt.adaptation.feature/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /repositories/ru.capralow.dt.adaptation.repository/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/plugin.properties: -------------------------------------------------------------------------------- 1 | 2 | pluginName = Adaptation 3 | 4 | prefixChecks = Prefix Checks 5 | 6 | providerName = Alexander Kapralov 7 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/.settings/com._1c.g5.v8.dt.check.prefs: -------------------------------------------------------------------------------- 1 | activeProfile=Default 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/src/ru/capralow/dt/adaptation/internal/messages.properties: -------------------------------------------------------------------------------- 1 | 2 | Failed_to_create_injector_for_0 = Failed to create injector for "{0}". 3 | -------------------------------------------------------------------------------- /features/ru.capralow.dt.adaptation.feature/feature.properties: -------------------------------------------------------------------------------- 1 | 2 | featureName = SSL Checks Attacheable Commands EDT Plugin 3 | 4 | providerName = Alexander Kapralov 5 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/ 2 | output.. = bin/ 3 | bin.includes = META-INF/,\ 4 | .,\ 5 | workspace/ 6 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/src/ru/capralow/dt/adaptation/messages_ru.properties: -------------------------------------------------------------------------------- 1 | 2 | Internal_class = \u0412\u043D\u0443\u0442\u0440\u0435\u043D\u043D\u0438\u0439 \u043A\u043B\u0430\u0441\u0441. 3 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Configuration/CommandInterface.cmi: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /features/ru.capralow.dt.adaptation.feature/build.properties: -------------------------------------------------------------------------------- 1 | javacCustomEncodings.. = src/[UTF-8] 2 | bin.includes = feature.xml,\ 3 | feature.properties,\ 4 | feature_ru.properties 5 | 6 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Subsystems/Подсистема/CommandInterface.cmi: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Configuration/MainSectionCommandInterface.cmi: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Subsystems/ВложеннаяПодсистема/CommandInterface.cmi: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Subsystems/ИнтерфейснаяПодсистема/CommandInterface.cmi: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Subsystems/Префикс_Подсистема/CommandInterface.cmi: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Subsystems/ПсевдоПрефикс_Подсистема/CommandInterface.cmi: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Subsystems/ВложеннаяИнтерфейснаяПодсистема/CommandInterface.cmi: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Subsystems/ВложеннаяПодсистема/Subsystems/Подсистема2/CommandInterface.cmi: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/ 2 | output.. = bin/ 3 | bin.includes = META-INF/,\ 4 | .,\ 5 | plugin.properties,\ 6 | plugin_ru.properties,\ 7 | plugin.xml 8 | -------------------------------------------------------------------------------- /targets/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | targets 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Subsystems/ВложеннаяИнтерфейснаяПодсистема/Subsystems/ИнтерфейснаяПодсистема2/CommandInterface.cmi: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #Eclipse project files 2 | .metadata/ 3 | .metricsapp/ 4 | .metricsapp-tests/ 5 | .JETEmitters/ 6 | #Build targets 7 | bin/ 8 | target/ 9 | #Report directories 10 | /reports 11 | */reports 12 | #Mac-specific directory that no other operating system needs. 13 | .DS_Store -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/src/ru/capralow/dt/adaptation/internal/messages_ru.properties: -------------------------------------------------------------------------------- 1 | 2 | Failed_to_create_injector_for_0 = \u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043E\u0437\u0434\u0430\u0442\u044C \u0438\u043D\u0436\u0435\u043A\u0442\u043E\u0440 \u0434\u043B\u044F "{0}". 3 | -------------------------------------------------------------------------------- /repositories/ru.capralow.dt.adaptation.repository/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ru.capralow.dt.adaptation.repository 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /bom/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | dt_repository 5 | ${env.partners_v8_1c_ru_username} 6 | ${env.partners_v8_1c_ru_password} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /repositories/ru.capralow.dt.adaptation.repository/category.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/.settings/Default.cset: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "settings": { 4 | "documentation-comment-hub": { 5 | "enabled": false 6 | }, 7 | "module-unused-method-check": { 8 | "enabled": false 9 | }, 10 | "PrefixCheck": { 11 | "properties": { 12 | "prefixNamePattern": "Префикс_" 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 4 | org.eclipse.jdt.core.compiler.compliance=11 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=11 -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/plugin_ru.properties: -------------------------------------------------------------------------------- 1 | 2 | pluginName = \u041F\u0440\u0435\u0444\u0438\u043A\u0441\u044B 3 | 4 | prefixChecks = \u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u043F\u0440\u0435\u0444\u0438\u043A\u0441\u0430 5 | 6 | providerName = \u041A\u0430\u043F\u0440\u0430\u043B\u043E\u0432 \u0410\u043B\u0435\u043A\u0441\u0430\u043D\u0434\u0440 \u0410\u043B\u0435\u043A\u0441\u0430\u043D\u0434\u0440\u043E\u0432\u0438\u0447 7 | -------------------------------------------------------------------------------- /bom/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | bom 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.m2e.core.maven2Builder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.m2e.core.maven2Nature 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/CommonModules/ОбщийМодуль/ОбщийМодуль.mdo: -------------------------------------------------------------------------------- 1 | 2 | 3 | ОбщийМодуль 4 | 5 | ru 6 | Общий модуль 7 | 8 | true 9 | 10 | -------------------------------------------------------------------------------- /features/ru.capralow.dt.adaptation.feature/feature_ru.properties: -------------------------------------------------------------------------------- 1 | 2 | featureName = \u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u0411\u0421\u041F \u041F\u043E\u0434\u043A\u043B\u044E\u0447\u0430\u0435\u043C\u044B\u0435 \u041A\u043E\u043C\u0430\u043D\u0434\u044B EDT Plugin 3 | 4 | providerName = \u041A\u0430\u043F\u0440\u0430\u043B\u043E\u0432 \u0410\u043B\u0435\u043A\u0441\u0430\u043D\u0434\u0440 \u0410\u043B\u0435\u043A\u0441\u0430\u043D\u0434\u0440\u043E\u0432\u0438\u0447 5 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/CommonModules/Префикс_ОбщийМодуль/Префикс_ОбщийМодуль.mdo: -------------------------------------------------------------------------------- 1 | 2 | 3 | Префикс_ОбщийМодуль 4 | 5 | ru 6 | Префикс общий модуль 7 | 8 | true 9 | 10 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/CommonModules/ОбщийМодульНетПрефикса/ОбщийМодульНетПрефикса.mdo: -------------------------------------------------------------------------------- 1 | 2 | 3 | ОбщийМодульНетПрефикса 4 | 5 | ru 6 | Общий модуль нет префикса 7 | 8 | true 9 | 10 | -------------------------------------------------------------------------------- /features/ru.capralow.dt.adaptation.feature/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ru.capralow.dt.adaptation.feature 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.pde.FeatureBuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.pde.FeatureNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/CommonModules/Префикс_ОбщийМодульЛишнийПрефикс/Префикс_ОбщийМодульЛишнийПрефикс.mdo: -------------------------------------------------------------------------------- 1 | 2 | 3 | Префикс_ОбщийМодульЛишнийПрефикс 4 | 5 | ru 6 | Префикс общий модуль лишний префикс 7 | 8 | true 9 | 10 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/src/ru/capralow/dt/adaptation/Messages.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, Alexander Kapralov 3 | */ 4 | package ru.capralow.dt.adaptation; 5 | 6 | import org.eclipse.osgi.util.NLS; 7 | 8 | public class Messages 9 | extends NLS 10 | { 11 | 12 | private static final String BUNDLE_NAME = "ru.capralow.dt.adaptation.messages"; //$NON-NLS-1$ 13 | 14 | public static String Internal_class; 15 | 16 | static 17 | { 18 | NLS.initializeMessages(BUNDLE_NAME, Messages.class); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 10 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 3 | org.eclipse.jdt.core.compiler.compliance=11 4 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 5 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 8 | org.eclipse.jdt.core.compiler.release=enabled 9 | org.eclipse.jdt.core.compiler.source=11 10 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Subsystems/ИнтерфейснаяПодсистема/ИнтерфейснаяПодсистема.mdo: -------------------------------------------------------------------------------- 1 | 2 | 3 | ИнтерфейснаяПодсистема 4 | 5 | ru 6 | Интерфейсная подсистема 7 | 8 | true 9 | true 10 | 11 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Subsystems/Подсистема/Подсистема.mdo: -------------------------------------------------------------------------------- 1 | 2 | 3 | Подсистема 4 | 5 | ru 6 | Подсистема 7 | 8 | true 9 | true 10 | CommonModule.ОбщийМодуль 11 | 12 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/src/ru/capralow/dt/adaptation/internal/Messages.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, Alexander Kapralov 3 | */ 4 | package ru.capralow.dt.adaptation.internal; 5 | 6 | import org.eclipse.osgi.util.NLS; 7 | 8 | public class Messages 9 | extends NLS 10 | { 11 | 12 | private static final String BUNDLE_NAME = "ru.capralow.dt.adaptation.internal.messages"; //$NON-NLS-1$ 13 | 14 | public static String Failed_to_create_injector_for_0; 15 | 16 | static 17 | { 18 | NLS.initializeMessages(BUNDLE_NAME, Messages.class); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestConfiguration 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.xtext.ui.shared.xtextBuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.xtext.ui.shared.xtextNature 16 | com._1c.g5.v8.dt.core.V8ConfigurationNature 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Subsystems/ВложеннаяИнтерфейснаяПодсистема/ВложеннаяИнтерфейснаяПодсистема.mdo: -------------------------------------------------------------------------------- 1 | 2 | 3 | ВложеннаяИнтерфейснаяПодсистема 4 | 5 | ru 6 | Вложенная интерфейсная подсистема 7 | 8 | true 9 | ИнтерфейснаяПодсистема2 10 | 11 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Subsystems/ВложеннаяПодсистема/ВложеннаяПодсистема.mdo: -------------------------------------------------------------------------------- 1 | 2 | 3 | ВложеннаяПодсистема 4 | 5 | ru 6 | Вложенная подсистема 7 | 8 | true 9 | true 10 | Подсистема2 11 | 12 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/src/ru/capralow/dt/adaptation/PrefixUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, Alexander Kapralov 3 | */ 4 | package ru.capralow.dt.adaptation; 5 | 6 | public final class PrefixUtils 7 | { 8 | 9 | public static boolean nameHasPrefix(String name, String[] prefixes) 10 | { 11 | for (String prefix : prefixes) 12 | if (name.startsWith(prefix)) 13 | return true; 14 | 15 | return false; 16 | } 17 | 18 | private PrefixUtils() 19 | { 20 | throw new IllegalStateException(Messages.Internal_class); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | 9 | ru.capralow.dt.adaptation 10 | bundles 11 | 1.0.0-SNAPSHOT 12 | 13 | 14 | ru.capralow.dt.adaptation 15 | eclipse-plugin 16 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | 9 | ru.capralow.dt.adaptation 10 | tests 11 | 1.0.0-SNAPSHOT 12 | 13 | 14 | ru.capralow.dt.adaptation.tests 15 | eclipse-test-plugin 16 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Subsystems/ВложеннаяПодсистема/Subsystems/Подсистема2/Подсистема2.mdo: -------------------------------------------------------------------------------- 1 | 2 | 3 | Подсистема2 4 | 5 | ru 6 | Подсистема2 7 | 8 | true 9 | true 10 | Subsystem.ВложеннаяПодсистема 11 | 12 | -------------------------------------------------------------------------------- /repositories/ru.capralow.dt.adaptation.repository/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | 9 | ru.capralow.dt.adaptation 10 | repositories 11 | 1.0.0-SNAPSHOT 12 | 13 | 14 | ru.capralow.dt.adaptation.repository 15 | eclipse-repository 16 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Subsystems/ПсевдоПрефикс_Подсистема/ПсевдоПрефикс_Подсистема.mdo: -------------------------------------------------------------------------------- 1 | 2 | 3 | ПсевдоПрефикс_Подсистема 4 | 5 | ru 6 | Псевдо префикс подсистема 7 | 8 | true 9 | true 10 | CommonModule.Префикс_ОбщийМодульЛишнийПрефикс 11 | 12 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Subsystems/Префикс_Подсистема/Префикс_Подсистема.mdo: -------------------------------------------------------------------------------- 1 | 2 | 3 | Префикс_Подсистема 4 | 5 | ru 6 | Префикс подсистема 7 | 8 | true 9 | true 10 | CommonModule.Префикс_ОбщийМодуль 11 | CommonModule.ОбщийМодульНетПрефикса 12 | 13 | -------------------------------------------------------------------------------- /targets/default/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | 9 | ru.capralow.dt.adaptation 10 | targets 11 | 1.0.0-SNAPSHOT 12 | 13 | 14 | ru.capralow.dt.adaptation 15 | default 16 | eclipse-target-definition 17 | 18 | Target Platform 19 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Subsystems/ВложеннаяИнтерфейснаяПодсистема/Subsystems/ИнтерфейснаяПодсистема2/ИнтерфейснаяПодсистема2.mdo: -------------------------------------------------------------------------------- 1 | 2 | 3 | ИнтерфейснаяПодсистема2 4 | 5 | ru 6 | Интерфейсная подсистема2 7 | 8 | true 9 | true 10 | Subsystem.ВложеннаяИнтерфейснаяПодсистема 11 | 12 | -------------------------------------------------------------------------------- /targets/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | 9 | ru.capralow.dt.adaptation 10 | parent 11 | 1.0.0-SNAPSHOT 12 | 13 | 14 | targets 15 | pom 16 | 17 | Targets Definitions 18 | 19 | 20 | true 21 | 22 | 23 | 24 | default 25 | 26 | -------------------------------------------------------------------------------- /features/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | 9 | ru.capralow.dt.adaptation 10 | parent 11 | 1.0.0-SNAPSHOT 12 | 13 | 14 | features 15 | pom 16 | 17 | Features 18 | 19 | 20 | true 21 | 22 | 23 | 24 | ru.capralow.dt.adaptation.feature 25 | 26 | 27 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/src/ru/capralow/dt/adaptation/internal/ExecutableExtensionFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, Alexander Kapralov 3 | */ 4 | package ru.capralow.dt.adaptation.internal; 5 | 6 | import org.osgi.framework.Bundle; 7 | 8 | import com._1c.g5.wiring.AbstractGuiceAwareExecutableExtensionFactory; 9 | import com.google.inject.Injector; 10 | 11 | public class ExecutableExtensionFactory 12 | extends AbstractGuiceAwareExecutableExtensionFactory 13 | { 14 | 15 | @Override 16 | protected Bundle getBundle() 17 | { 18 | return AdaptationPlugin.getInstance().getBundle(); 19 | } 20 | 21 | @Override 22 | protected Injector getInjector() 23 | { 24 | return AdaptationPlugin.getInstance().getInjector(); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ru.capralow.dt.adaptation 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.pde.ManifestBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.SchemaBuilder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.pde.PluginNature 26 | org.eclipse.jdt.core.javanature 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ru.capralow.dt.adaptation.tests 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.pde.ManifestBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.SchemaBuilder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.pde.PluginNature 26 | org.eclipse.jdt.core.javanature 27 | 28 | 29 | -------------------------------------------------------------------------------- /repositories/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | 9 | ru.capralow.dt.adaptation 10 | parent 11 | 1.0.0-SNAPSHOT 12 | 13 | 14 | repositories 15 | pom 16 | 17 | Update Sites 18 | 19 | 20 | ru.capralow.dt.adaptation.repository 21 | 22 | 23 | 24 | ${eclipse.p2.latest} 25 | true 26 | 27 | 28 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/src/ru/capralow/dt/adaptation/internal/ExternalDependenciesModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, Alexander Kapralov 3 | */ 4 | package ru.capralow.dt.adaptation.internal; 5 | 6 | import org.eclipse.core.runtime.Plugin; 7 | 8 | import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; 9 | import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; 10 | import com._1c.g5.v8.dt.md.distribution.support.IDistributionSupportTypeProvider; 11 | import com._1c.g5.wiring.AbstractServiceAwareModule; 12 | 13 | public class ExternalDependenciesModule 14 | extends AbstractServiceAwareModule 15 | { 16 | 17 | public ExternalDependenciesModule(Plugin bundle) 18 | { 19 | super(bundle); 20 | } 21 | 22 | @Override 23 | protected void doConfigure() 24 | { 25 | bind(IBmEmfIndexManager.class).toService(); 26 | bind(IDistributionSupportTypeProvider.class).toService(); 27 | bind(IV8ProjectManager.class).toService(); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/src/ru/capralow/dt/adaptation/prefix/messages.properties: -------------------------------------------------------------------------------- 1 | 2 | Error_Attribute0HasNoPrefix = [Prefixes] Attribute {0} has no prefix 3 | 4 | Error_Attribute0HasUnnecessaryPrefix = [Prefixes] Attribute {0} has unnecessary prefix 5 | 6 | Error_Method0HasNoPrefix = [Prefixes] Method {0} has no prefix 7 | 8 | Error_Method0HasUnnecessaryPrefix = [Prefixes] Method {0} has unnecessary prefix 9 | 10 | Error_MethodPrefix_Description = \u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u0442 \u0447\u0442\u043E \u0443 \u043E\u0431\u044A\u0435\u043A\u0442\u0430 \u0435\u0441\u0442\u044C \u043F\u0440\u0435\u0444\u0438\u043A\u0441 \u0438\u043B\u0438 \u043D\u0435\u0442 \u043D\u0435\u043D\u0443\u0436\u043D\u043E\u0433\u043E \u043F\u0440\u0435\u0444\u0438\u043A\u0441\u0430. 11 | 12 | Error_MethodPrefix_Title = Prefix check 13 | 14 | Error_ObjectHasNoPrefix = [Prefixes] Object has no prefix 15 | 16 | Error_ObjectHasUnnecessaryPrefix = [Prefixes] Object has unnecessary prefix 17 | 18 | Parameter_PrefixName = Prefix names (space separated): 19 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: Tests 4 | Bundle-SymbolicName: ru.capralow.dt.adaptation.tests 5 | Bundle-Version: 1.0.0.qualifier 6 | Fragment-Host: ru.capralow.dt.adaptation;bundle-version="1.0.0.qualifier" 7 | Automatic-Module-Name: ru.capralow.dt.adaptation.tests 8 | Bundle-RequiredExecutionEnvironment: JavaSE-11 9 | Export-Package: ru.capralow.dt.adaptation.internal.tests;x-internal:=true 10 | Require-Bundle: org.junit;bundle-version="[4.12.0,5.0.0)", 11 | org.eclipse.core.resources;bundle-version="[3.13.0,4.0.0)" 12 | Import-Package: com._1c.g5.ides.core.handle.impl.xtext;version="[6.0.0,7.0.0)", 13 | com._1c.g5.v8.dt.bsl.resource;version="[13.0.0,14.0.0)", 14 | com._1c.g5.v8.dt.core.handle;version="[3.2.0,4.0.0)", 15 | com._1c.g5.v8.dt.core.handle.impl;version="[4.2.0,5.0.0)", 16 | com._1c.g5.v8.dt.testing;version="[3.1.0,4.0.0)", 17 | com._1c.g5.v8.dt.testing.check;version="[1.0.0,2.0.0)", 18 | com._1c.g5.v8.dt.validation.marker;version="[4.0.0,5.0.0)" 19 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/src/ru/capralow/dt/adaptation/prefix/Messages.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, Alexander Kapralov 3 | */ 4 | package ru.capralow.dt.adaptation.prefix; 5 | 6 | import org.eclipse.osgi.util.NLS; 7 | 8 | public class Messages 9 | extends NLS 10 | { 11 | 12 | private static final String BUNDLE_NAME = "ru.capralow.dt.adaptation.prefix.messages"; //$NON-NLS-1$ 13 | 14 | public static String Error_ObjectHasNoPrefix; 15 | public static String Error_ObjectHasUnnecessaryPrefix; 16 | 17 | public static String Error_Attribute0HasNoPrefix; 18 | public static String Error_Attribute0HasUnnecessaryPrefix; 19 | 20 | public static String Error_Method0HasNoPrefix; 21 | public static String Error_Method0HasUnnecessaryPrefix; 22 | 23 | public static String Error_MethodPrefix_Title; 24 | public static String Error_MethodPrefix_Description; 25 | 26 | public static String Parameter_PrefixName; 27 | 28 | static 29 | { 30 | NLS.initializeMessages(BUNDLE_NAME, Messages.class); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | 9 | ru.capralow.dt.adaptation 10 | bom 11 | 1.0.0-SNAPSHOT 12 | ./bom/pom.xml 13 | 14 | 15 | ru.capralow.dt.adaptation 16 | parent 17 | 1.0.0-SNAPSHOT 18 | pom 19 | 20 | Adaptation EDT Plugin 21 | 22 | 23 | targets 24 | bundles 25 | features 26 | repositories 27 | 28 | 29 | 30 | 31 | 32 | 33 | org.eclipse.tycho 34 | tycho-p2-repository-plugin 35 | 36 | ${project.name} 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /bundles/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | 9 | ru.capralow.dt.adaptation 10 | parent 11 | 1.0.0-SNAPSHOT 12 | 13 | 14 | ru.capralow.dt.adaptation 15 | bundles 16 | pom 17 | Bundles 18 | 19 | 20 | ru.capralow.dt.adaptation 21 | 22 | 23 | 24 | 25 | 26 | org.eclipse.tycho 27 | tycho-source-plugin 28 | 29 | 30 | 31 | org.apache.maven.plugins 32 | maven-checkstyle-plugin 33 | 34 | 35 | run-checkstyle 36 | validate 37 | 38 | check 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /features/ru.capralow.dt.adaptation.feature/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | 9 | ru.capralow.dt.adaptation 10 | features 11 | 1.0.0-SNAPSHOT 12 | 13 | 14 | ru.capralow.dt.adaptation.feature 15 | eclipse-feature 16 | 17 | 18 | 19 | 20 | org.eclipse.tycho.extras 21 | tycho-source-feature-plugin 22 | 23 | 24 | source-feature 25 | package 26 | 27 | source-feature 28 | 29 | 30 | 31 | 32 | 33 | 34 | org.eclipse.tycho 35 | tycho-p2-plugin 36 | 37 | 38 | package 39 | 40 | p2-metadata 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2020, Alexander Kapralov 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /bom/clean.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /bom/build.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: %pluginName 4 | Bundle-SymbolicName: ru.capralow.dt.adaptation;singleton:=true 5 | Bundle-Version: 1.0.0.qualifier 6 | Bundle-Activator: ru.capralow.dt.adaptation.internal.AdaptationPlugin 7 | Bundle-Localization: plugin 8 | Bundle-RequiredExecutionEnvironment: JavaSE-11 9 | Automatic-Module-Name: ru.capralow.dt.adaptation 10 | Bundle-ActivationPolicy: lazy 11 | Bundle-Vendor: %providerName 12 | Export-Package: ru.capralow.dt.adaptation, 13 | ru.capralow.dt.adaptation.internal;x-internal:=true, 14 | ru.capralow.dt.adaptation.prefix 15 | Import-Package: com._1c.g5.v8.bm.core;version="[7.0.0,8.0.0)", 16 | com._1c.g5.v8.dt.bm.index.emf;version="[7.0.0,8.0.0)", 17 | com._1c.g5.v8.dt.bsl.documentation.comment;version="[2.0.0,3.0.0)", 18 | com._1c.g5.v8.dt.bsl.model;version="[3.0.0,5.0.0)", 19 | com._1c.g5.v8.dt.bsl.resource;version="[13.0.0,14.0.0)", 20 | com._1c.g5.v8.dt.bsl.validation;version="[15.0.0,16.0.0)", 21 | com._1c.g5.v8.dt.check;version="[1.0.0,2.0.0)", 22 | com._1c.g5.v8.dt.check.components;version="[1.0.0,2.0.0)", 23 | com._1c.g5.v8.dt.check.settings;version="[1.0.0,2.0.0)", 24 | com._1c.g5.v8.dt.common;version="[6.3.0,7.0.0)", 25 | com._1c.g5.v8.dt.core.platform;version="[10.0.0,11.0.0)", 26 | com._1c.g5.v8.dt.lcore.nodemodel.util;version="[1.1.0,2.0.0)", 27 | com._1c.g5.v8.dt.mcore;version="[6.0.0,7.0.0)", 28 | com._1c.g5.v8.dt.md.distribution.support;version="[2.0.0,3.0.0)", 29 | com._1c.g5.v8.dt.md.resource;version="[10.0.0,11.0.0)", 30 | com._1c.g5.v8.dt.metadata.mdclass;version="[8.0.0,9.0.0)", 31 | com._1c.g5.wiring;version="[2.0.0,3.0.0)", 32 | com._1c.g5.wiring.binder;version="[1.1.0,2.0.0)" 33 | Require-Bundle: org.eclipse.xtext;bundle-version="[2.0.0,3.0.0)", 34 | org.eclipse.core.resources;bundle-version="[3.13.0,4.0.0)", 35 | org.eclipse.core.runtime;bundle-version="[3.15.0,4.0.0)" 36 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/src/ru/capralow/dt/adaptation/prefix/tests/ObjectHasNoPrefixCheckTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021, Alexander Kapralov 3 | */ 4 | package ru.capralow.dt.adaptation.prefix.tests; 5 | 6 | import static org.junit.Assert.assertEquals; 7 | import static org.junit.Assert.assertNotNull; 8 | 9 | import org.junit.Test; 10 | 11 | import com._1c.g5.v8.bm.core.IBmObject; 12 | import com._1c.g5.v8.dt.core.platform.IDtProject; 13 | import com._1c.g5.v8.dt.metadata.mdclass.CommonModule; 14 | import com._1c.g5.v8.dt.testing.check.CheckTestBase; 15 | import com._1c.g5.v8.dt.validation.marker.Marker; 16 | 17 | import ru.capralow.dt.adaptation.prefix.PrefixCheck; 18 | 19 | public class ObjectHasNoPrefixCheckTest 20 | extends CheckTestBase 21 | { 22 | 23 | @Test 24 | public void testModule() throws Exception 25 | { 26 | IDtProject dtProject = openProjectAndWaitForValidationFinish("TestConfiguration"); //$NON-NLS-1$ 27 | 28 | String moduleId = "platform:/resource/TestConfiguration/src/CommonModules/ОбщийМодуль/Module.bsl"; //$NON-NLS-1$ 29 | 30 | Marker targetMarker = getFirstMarker(PrefixCheck.CHECK_ID, moduleId, dtProject); 31 | assertNotNull(targetMarker); 32 | assertEquals(PrefixCheck.CHECK_ID, targetMarker.getMessage()); 33 | 34 | } 35 | 36 | @Test 37 | public void testObject() throws Exception 38 | { 39 | IDtProject dtProject = openProjectAndWaitForValidationFinish("TestConfiguration"); //$NON-NLS-1$ 40 | 41 | CommonModule testObject = (CommonModule)getTopObjectByFqn("CommonModule.ОбщийМодуль", dtProject); //$NON-NLS-1$ 42 | assertNotNull(testObject); 43 | 44 | Marker targetMarker = getFirstMarker(PrefixCheck.CHECK_ID, ((IBmObject)testObject).bmGetId(), dtProject); 45 | assertNotNull(targetMarker); 46 | 47 | assertEquals(PrefixCheck.CHECK_ID, targetMarker.getMessage()); 48 | 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Поддержка префиксов [![Build Status](https://travis-ci.com/DoublesunRUS/ru.capralow.dt.adaptation.svg)](https://travis-ci.com/DoublesunRUS/ru.capralow.dt.adaptation) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=DoublesunRUS_ru.capralow.dt.adaptation&metric=alert_status)](https://sonarcloud.io/dashboard?id=DoublesunRUS_ru.capralow.dt.adaptation) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=DoublesunRUS_ru.capralow.dt.adaptation&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=DoublesunRUS_ru.capralow.dt.adaptation) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=DoublesunRUS_ru.capralow.dt.adaptation&metric=coverage)](https://sonarcloud.io/dashboard?id=DoublesunRUS_ru.capralow.dt.adaptation) 2 | 3 | 4 | ## Поддержка префиксов для [1C:Enterprise Development Tools](http://v8.1c.ru/overview/IDE/) 2021.2 5 | 6 | Минимальная версия EDT: 2021.2 7 | 8 | Текущий релиз в ветке [master: 1.0.0](https://github.com/DoublesunRUS/ru.capralow.dt.adaptation/tree/master).
9 | 10 | В данном репозитории хранятся только исходники.
11 | 12 | **ВНИМАНИЕ** Плагин использует новый тестовый API механизма проверок. Данный API пока не вошел в релиз EDT, поэтому плагин работоспособен только в режиме разработки плагинов! Установить его в EDT 2021.1 и ниже нельзя! 13 | 14 | Плагин можно установить в EDT через пункт "Установить новое ПО" указав сайт обновления http://capralow.ru/edt/adaptation/latest/ . Для установки может потребоваться запуск EDT под правами администратора.
15 | Для самостоятельной сборки плагина необходимо иметь доступ к сайту https://releases.1c.ru и настроить соответствующим образом Maven. Подробности настройки написаны [здесь](https://github.com/1C-Company/dt-example-plugins/blob/master/simple-plugin/README.md). 16 | 17 | ### Возможности 18 | Плагин добавляет поддержку префиксов (пока только намерения): 19 | * Сортировка метаданных с учетом префиксов 20 | * Проверка что нетиповые объекты и реквизиты в типовых объектах имеют префиксы 21 | * Проверка что код с комментарием о доработке содержит префиксы -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/src/ru/capralow/dt/adaptation/prefix/messages_ru.properties: -------------------------------------------------------------------------------- 1 | 2 | Error_Attribute0HasNoPrefix = [\u041F\u0440\u0435\u0444\u0438\u043A\u0441\u044B] \u0423 \u0440\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u0430 {0} \u043D\u0435\u0442 \u043F\u0440\u0435\u0444\u0438\u043A\u0441\u0430 3 | 4 | Error_Attribute0HasUnnecessaryPrefix = [\u041F\u0440\u0435\u0444\u0438\u043A\u0441\u044B] \u0423 \u0440\u0435\u043A\u0432\u0438\u0437\u0438\u0442\u0430 {0} \u0443\u043A\u0430\u0437\u0430\u043D \u043D\u0435\u043D\u0443\u0436\u043D\u044B\u0439 \u043F\u0440\u0435\u0444\u0438\u043A\u0441 5 | 6 | Error_Method0HasNoPrefix = [\u041F\u0440\u0435\u0444\u0438\u043A\u0441\u044B] \u0423 \u043C\u0435\u0442\u043E\u0434\u0430 {0} \u043D\u0435\u0442 \u043F\u0440\u0435\u0444\u0438\u043A\u0441\u0430 7 | 8 | Error_Method0HasUnnecessaryPrefix = [\u041F\u0440\u0435\u0444\u0438\u043A\u0441\u044B] \u0423 \u043C\u0435\u0442\u043E\u0434\u0430 {0} \u0443\u043A\u0430\u0437\u0430\u043D \u043D\u0435\u043D\u0443\u0436\u043D\u044B\u0439 \u043F\u0440\u0435\u0444\u0438\u043A\u0441 9 | 10 | Error_MethodPrefix_Description = \u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u0442 \u0447\u0442\u043E \u0443 \u043E\u0431\u044A\u0435\u043A\u0442\u0430 \u0435\u0441\u0442\u044C \u043F\u0440\u0435\u0444\u0438\u043A\u0441 \u0438\u043B\u0438 \u043D\u0435\u0442 \u043D\u0435\u043D\u0443\u0436\u043D\u043E\u0433\u043E \u043F\u0440\u0435\u0444\u0438\u043A\u0441\u0430. 11 | 12 | Error_MethodPrefix_Title = \u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u043F\u0440\u0435\u0444\u0438\u043A\u0441\u043E\u0432 13 | 14 | Error_ObjectHasNoPrefix = [\u041F\u0440\u0435\u0444\u0438\u043A\u0441\u044B] \u0423 \u043E\u0431\u044A\u0435\u043A\u0442\u0430 \u043D\u0435\u0442 \u043F\u0440\u0435\u0444\u0438\u043A\u0441\u0430 15 | 16 | Error_ObjectHasUnnecessaryPrefix = [\u041F\u0440\u0435\u0444\u0438\u043A\u0441\u044B] \u0423 \u043E\u0431\u044A\u0435\u043A\u0442\u0430 \u0443\u043A\u0430\u0437\u0430\u043D \u043D\u0435\u043D\u0443\u0436\u043D\u044B\u0439 \u043F\u0440\u0435\u0444\u0438\u043A\u0441 17 | 18 | Parameter_PrefixName = \u0418\u043C\u0435\u043D\u0430 \u043F\u0440\u0435\u0444\u0438\u043A\u0441\u043E\u0432 (\u0440\u0430\u0437\u0434\u0435\u043B\u0435\u043D\u043D\u044B\u0435 \u043F\u0440\u043E\u0431\u0435\u043B\u043E\u043C): 19 | -------------------------------------------------------------------------------- /features/ru.capralow.dt.adaptation.feature/feature.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | Adaptation 10 | 11 | 12 | 13 | Капралов Александр Александрович 14 | 15 | 16 | 17 | BSD 3-Clause License 18 | 19 | Copyright (c) 2019-2020, Alexander Kapralov 20 | All rights reserved. 21 | 22 | Redistribution and use in source and binary forms, with or without 23 | modification, are permitted provided that the following conditions are met: 24 | 25 | * Redistributions of source code must retain the above copyright notice, this 26 | list of conditions and the following disclaimer. 27 | 28 | * Redistributions in binary form must reproduce the above copyright notice, 29 | this list of conditions and the following disclaimer in the documentation 30 | and/or other materials provided with the distribution. 31 | 32 | * Neither the name of the copyright holder nor the names of its 33 | contributors may be used to endorse or promote products derived from 34 | this software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 37 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 39 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 40 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 41 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 42 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 43 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 44 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | 47 | 48 | 49 | 50 | 51 | 52 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /bom/plugin.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/src/ru/capralow/dt/adaptation/internal/AdaptationPlugin.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, Alexander Kapralov 3 | */ 4 | package ru.capralow.dt.adaptation.internal; 5 | 6 | import java.text.MessageFormat; 7 | 8 | import org.eclipse.core.runtime.IStatus; 9 | import org.eclipse.core.runtime.Plugin; 10 | import org.eclipse.core.runtime.Status; 11 | import org.osgi.framework.BundleContext; 12 | 13 | import com.google.inject.Guice; 14 | import com.google.inject.Injector; 15 | 16 | public class AdaptationPlugin 17 | extends Plugin 18 | { 19 | public static final String ID = "ru.capralow.dt.adaptation"; //$NON-NLS-1$ 20 | 21 | private static AdaptationPlugin instance; 22 | 23 | public static IStatus createErrorStatus(String message) 24 | { 25 | return new Status(IStatus.ERROR, ID, 0, message, (Throwable)null); 26 | } 27 | 28 | public static IStatus createErrorStatus(String message, int code) 29 | { 30 | return new Status(IStatus.ERROR, ID, code, message, (Throwable)null); 31 | } 32 | 33 | public static IStatus createErrorStatus(String message, int code, Throwable throwable) 34 | { 35 | return new Status(IStatus.ERROR, ID, code, message, throwable); 36 | } 37 | 38 | public static IStatus createErrorStatus(String message, Throwable throwable) 39 | { 40 | return new Status(IStatus.ERROR, ID, 0, message, throwable); 41 | } 42 | 43 | public static AdaptationPlugin getInstance() 44 | { 45 | return instance; 46 | } 47 | 48 | public static void log(IStatus status) 49 | { 50 | getInstance().getLog().log(status); 51 | } 52 | 53 | private Injector injector; 54 | 55 | private Injector createInjector() 56 | { 57 | try 58 | { 59 | return Guice.createInjector(new ExternalDependenciesModule(getInstance())); 60 | 61 | } 62 | catch (Exception e) 63 | { 64 | String msg = MessageFormat.format(Messages.Failed_to_create_injector_for_0, 65 | getInstance().getBundle().getSymbolicName()); 66 | log(createErrorStatus(msg, e)); 67 | return injector; 68 | 69 | } 70 | } 71 | 72 | public synchronized Injector getInjector() 73 | { 74 | if (injector == null) 75 | injector = createInjector(); 76 | 77 | return injector; 78 | } 79 | 80 | @Override 81 | public void start(BundleContext context) throws Exception 82 | { 83 | super.start(context); 84 | instance = this; 85 | } 86 | 87 | @Override 88 | public void stop(BundleContext context) throws Exception 89 | { 90 | instance = null; 91 | super.stop(context); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/workspace/TestConfiguration/src/Configuration/Configuration.mdo: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestConfiguration 4 | 5 | ru 6 | Test configuration 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 8.3.16 15 | ManagedApplication 16 | PersonalComputer 17 | Russian 18 | 19 | AllowOSBackup 20 | true 21 | 22 | Language.Русский 23 | Managed 24 | NotAutoFree 25 | DontUse 26 | DontUse 27 | 8.3.16 28 | 29 | Русский 30 | 31 | ru 32 | Русский 33 | 34 | ru 35 | 36 | Subsystem.ИнтерфейснаяПодсистема 37 | Subsystem.ВложеннаяИнтерфейснаяПодсистема 38 | Subsystem.ВложеннаяПодсистема 39 | Subsystem.Подсистема 40 | Subsystem.Префикс_Подсистема 41 | Subsystem.ПсевдоПрефикс_Подсистема 42 | CommonModule.ОбщийМодуль 43 | CommonModule.Префикс_ОбщийМодуль 44 | CommonModule.ОбщийМодульНетПрефикса 45 | CommonModule.Префикс_ОбщийМодульЛишнийПрефикс 46 | 47 | -------------------------------------------------------------------------------- /tests/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | 9 | ru.capralow.dt.adaptation 10 | parent 11 | 1.0.0-SNAPSHOT 12 | 13 | 14 | tests 15 | pom 16 | Tests 17 | 18 | 19 | ru.capralow.dt.adaptation.tests 20 | 21 | 22 | 23 | 24 | macosx 25 | 26 | 27 | mac os x 28 | mac 29 | 30 | 31 | 32 | -XstartOnFirstThread 33 | 34 | 35 | 36 | other-os 37 | 38 | 39 | !mac 40 | !mac 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | debug 49 | 50 | -agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=y 51 | 52 | 53 | 54 | 55 | 56 | -Xms80m -Xmx4g -Dosgi.module.lock.timeout=240 --add-modules=ALL-SYSTEM 57 | 58 | 59 | 60 | 61 | 62 | 63 | org.eclipse.tycho 64 | target-platform-configuration 65 | 66 | 67 | 68 | ru.capralow.dt.adaptation 69 | default 70 | 1.0.0-SNAPSHOT 71 | 72 | 73 | 74 | 75 | 76 | p2-installable-unit 77 | com._1c.g5.v8.dt.rcp 78 | 0.0.0 79 | 80 | 81 | 82 | p2 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | org.eclipse.tycho 91 | tycho-surefire-plugin 92 | 93 | true 94 | true 95 | ${ui.test.vmargs} ${tycho-surefire-plugin.vmargs} ${debug.vmargs} 96 | ${project.build.directory}/work 97 | p2Installed 98 | 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/src/ru/capralow/dt/adaptation/internal/tests/TestingWorkspaceUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package ru.capralow.dt.adaptation.internal.tests; 5 | 6 | import java.util.Collection; 7 | import java.util.List; 8 | 9 | import org.eclipse.xtext.diagnostics.Severity; 10 | import org.eclipse.xtext.resource.IResourceServiceProvider; 11 | import org.eclipse.xtext.resource.XtextResource; 12 | import org.eclipse.xtext.util.concurrent.IUnitOfWork; 13 | import org.eclipse.xtext.validation.CheckMode; 14 | import org.eclipse.xtext.validation.IResourceValidator; 15 | import org.eclipse.xtext.validation.Issue; 16 | import org.junit.Assert; 17 | 18 | import com._1c.g5.v8.dt.bsl.resource.BslResource; 19 | import com._1c.g5.v8.dt.core.handle.IV8File; 20 | import com._1c.g5.v8.dt.core.handle.impl.V8ModelManager; 21 | import com._1c.g5.v8.dt.core.handle.impl.V8XtextFile; 22 | import com.google.common.base.Predicate; 23 | import com.google.common.collect.Collections2; 24 | 25 | import ru.capralow.dt.adaptation.BslModelUtils; 26 | 27 | public class TestingWorkspaceUtils { 28 | 29 | public static void checkIssue(String projectName, String fileName, final String issueCode, Severity severity, 30 | int lineNumber) throws Exception { 31 | Collection issues = validate(projectName, fileName); 32 | 33 | issues = Collections2.filter(issues, new Predicate() { 34 | @Override 35 | public boolean apply(Issue input) { 36 | return issueCode.equals(input.getCode()); 37 | } 38 | }); 39 | Assert.assertEquals("Количество проблем не совпадает", 1, issues.size()); 40 | Issue issue = issues.iterator().next(); 41 | Assert.assertEquals("Серьезность проблемы не совпадает", severity, issue.getSeverity()); 42 | Assert.assertEquals("Номер строки с проблемой не совпадает", lineNumber, (int) issue.getLineNumber()); 43 | } 44 | 45 | public static void checkNoIssue(String projectName, String fileName, final String issueCode) throws Exception { 46 | Collection issues = validate(projectName, fileName); 47 | 48 | issues = Collections2.filter(issues, new Predicate() { 49 | @Override 50 | public boolean apply(Issue input) { 51 | return issueCode.equals(input.getCode()); 52 | } 53 | }); 54 | Assert.assertEquals("Количество проблем не совпадает", 0, issues.size()); 55 | } 56 | 57 | private static List validate(String projectName, String fileName) throws Exception { 58 | IV8File file = V8ModelManager.INSTANCE.getV8Model().getV8Project(projectName).getV8File(fileName); 59 | Assert.assertTrue(file instanceof V8XtextFile); 60 | V8XtextFile xtextFile = (V8XtextFile) file; 61 | List issues = xtextFile.readOnly(new IUnitOfWork, XtextResource>() { 62 | @Override 63 | public List exec(XtextResource state) throws Exception { 64 | 65 | Assert.assertTrue(state instanceof BslResource); 66 | BslResource resource = (BslResource) state; 67 | resource.setDeepAnalysis(true); 68 | 69 | IResourceServiceProvider provider = resource.getResourceServiceProvider(); 70 | IResourceValidator validator = provider.get(IResourceValidator.class); 71 | Assert.assertNotNull(validator); 72 | 73 | BslModelUtils.customResolveLazyCrossReferences(resource); 74 | 75 | return validator.validate(resource, CheckMode.ALL, null); 76 | } 77 | }); 78 | 79 | return issues; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /tests/ru.capralow.dt.adaptation.tests/tests.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/src/ru/capralow/dt/adaptation/MdUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, Alexander Kapralov 3 | */ 4 | package ru.capralow.dt.adaptation; 5 | 6 | import java.util.Iterator; 7 | 8 | import org.eclipse.emf.common.util.BasicEList; 9 | import org.eclipse.emf.common.util.EList; 10 | import org.eclipse.emf.ecore.EClass; 11 | import org.eclipse.xtext.naming.QualifiedName; 12 | import org.eclipse.xtext.resource.IEObjectDescription; 13 | 14 | import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; 15 | import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexProvider; 16 | import com._1c.g5.v8.dt.bsl.model.Method; 17 | import com._1c.g5.v8.dt.bsl.model.Module; 18 | import com._1c.g5.v8.dt.core.platform.IConfigurationProject; 19 | import com._1c.g5.v8.dt.core.platform.IExtensionProject; 20 | import com._1c.g5.v8.dt.core.platform.IExternalObjectProject; 21 | import com._1c.g5.v8.dt.core.platform.IV8Project; 22 | import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; 23 | import com._1c.g5.v8.dt.metadata.mdclass.Configuration; 24 | import com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage; 25 | import com._1c.g5.v8.dt.metadata.mdclass.MdObject; 26 | import com._1c.g5.v8.dt.metadata.mdclass.Subsystem; 27 | 28 | import ru.capralow.dt.adaptation.internal.AdaptationPlugin; 29 | 30 | public final class MdUtils 31 | { 32 | 33 | public static final String MD_OBJECT = "{0}.{1}"; //$NON-NLS-1$ 34 | 35 | private static void addSubsystemsToListForObject(EList subsystemsSource, 36 | EList subsystemsDestination, MdObject mdObject) 37 | { 38 | for (Subsystem subsystem : subsystemsSource) 39 | { 40 | if (subsystem.getContent().contains(mdObject)) 41 | subsystemsDestination.add(subsystem); 42 | addSubsystemsToListForObject(subsystem.getSubsystems(), subsystemsDestination, mdObject); 43 | } 44 | } 45 | 46 | public static Configuration getConfigurationForProject(IV8Project v8Project) 47 | { 48 | if (v8Project instanceof IConfigurationProject) 49 | return ((IConfigurationProject)v8Project).getConfiguration(); 50 | else if (v8Project instanceof IExtensionProject) 51 | return ((IExtensionProject)v8Project).getConfiguration(); 52 | else if (v8Project instanceof IExternalObjectProject) 53 | return ((IExternalObjectProject)v8Project).getParent().getConfiguration(); 54 | 55 | return null; 56 | } 57 | 58 | private static QualifiedName getConfigurationObjectQualifiedName(String objectFullName, EClass mdLiteral) 59 | { 60 | String[] objectArray = objectFullName.substring(objectFullName.indexOf('.') + 1).split("[.]"); //$NON-NLS-1$ 61 | 62 | QualifiedName qnObjectName = null; 63 | for (String objectValue : objectArray) 64 | { 65 | if (qnObjectName == null) 66 | qnObjectName = QualifiedName.create(mdLiteral.getName(), objectValue); 67 | 68 | else 69 | { 70 | if (mdLiteral.equals(MdClassPackage.Literals.SUBSYSTEM)) 71 | qnObjectName = qnObjectName.append(QualifiedName.create(mdLiteral.getName(), objectValue)); 72 | 73 | else 74 | qnObjectName = qnObjectName.append(QualifiedName.create(objectValue)); 75 | 76 | } 77 | 78 | } 79 | 80 | return qnObjectName; 81 | } 82 | 83 | private static EClass getMdLiteral(String objectFullName) 84 | { 85 | EClass mdLiteral = MdClassPackage.Literals.CONFIGURATION; 86 | 87 | String objectType = objectFullName.substring(0, objectFullName.indexOf('.')); 88 | 89 | if (objectType.equals("Подсистема")) //$NON-NLS-1$ 90 | mdLiteral = MdClassPackage.Literals.SUBSYSTEM; 91 | 92 | else if (objectType.equals("ОбщийМодуль")) //$NON-NLS-1$ 93 | mdLiteral = MdClassPackage.Literals.COMMON_MODULE; 94 | 95 | else if (objectType.equals("ОпределяемыйТип")) //$NON-NLS-1$ 96 | mdLiteral = MdClassPackage.Literals.DEFINED_TYPE; 97 | 98 | else if (objectType.equals("Справочник")) //$NON-NLS-1$ 99 | mdLiteral = MdClassPackage.Literals.CATALOG; 100 | 101 | else if (objectType.equals("Документ")) //$NON-NLS-1$ 102 | mdLiteral = MdClassPackage.Literals.DOCUMENT; 103 | 104 | else if (objectType.equals("Перечисление")) //$NON-NLS-1$ 105 | mdLiteral = MdClassPackage.Literals.ENUM; 106 | 107 | else if (objectType.equals("ПланВидовХарактеристик")) //$NON-NLS-1$ 108 | mdLiteral = MdClassPackage.Literals.CHART_OF_CHARACTERISTIC_TYPES; 109 | 110 | else if (objectType.equals("ПланВидовРасчета")) //$NON-NLS-1$ 111 | mdLiteral = MdClassPackage.Literals.CHART_OF_CALCULATION_TYPES; 112 | 113 | else if (objectType.equals("РегистрСведений")) //$NON-NLS-1$ 114 | mdLiteral = MdClassPackage.Literals.INFORMATION_REGISTER; 115 | 116 | return mdLiteral; 117 | } 118 | 119 | public static MdObject getMdObject(String objectFullName, IV8Project v8Project) 120 | { 121 | IBmEmfIndexManager bmEmfIndexManager = 122 | AdaptationPlugin.getInstance().getInjector().getInstance(IBmEmfIndexManager.class); 123 | IBmEmfIndexProvider bmEmfIndexProvider = bmEmfIndexManager.getEmfIndexProvider(v8Project.getProject()); 124 | 125 | EClass mdLiteral = getMdLiteral(objectFullName); 126 | QualifiedName qnObjectName = getConfigurationObjectQualifiedName(objectFullName, mdLiteral); 127 | 128 | MdObject object = null; 129 | 130 | Iterable objectIndex = 131 | bmEmfIndexProvider.getEObjectIndexByType(mdLiteral, qnObjectName, true); 132 | Iterator objectItr = objectIndex.iterator(); 133 | if (objectItr.hasNext()) 134 | object = (MdObject)objectItr.next().getEObjectOrProxy(); 135 | 136 | if (object == null) 137 | return null; 138 | 139 | return object; 140 | } 141 | 142 | public static Method getMethod(Module mdModule, String methodName) 143 | { 144 | for (Method mdMethod : mdModule.allMethods()) 145 | { 146 | if (mdMethod.getName().equals(methodName)) 147 | return mdMethod; 148 | } 149 | 150 | return null; 151 | } 152 | 153 | public static EList getSubsystemsForObject(MdObject mdObject) 154 | { 155 | EList subsystems = new BasicEList<>(); 156 | 157 | IV8ProjectManager v8ProjectManager = 158 | AdaptationPlugin.getInstance().getInjector().getInstance(IV8ProjectManager.class); 159 | 160 | Configuration configuration = MdUtils.getConfigurationForProject(v8ProjectManager.getProject(mdObject)); 161 | if (configuration == null) 162 | return subsystems; 163 | 164 | addSubsystemsToListForObject(configuration.getSubsystems(), subsystems, mdObject); 165 | 166 | return subsystems; 167 | } 168 | 169 | private MdUtils() 170 | { 171 | throw new IllegalStateException(Messages.Internal_class); 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /checkstyle.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 76 | 78 | 80 | 81 | 82 | 83 | 85 | 87 | 89 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | -------------------------------------------------------------------------------- /repositories/ru.capralow.dt.adaptation.repository/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 |

У тебя почти получилось!

33 | 34 |

Этот 37 | URL является репозиторием EDT;  ты должен использовать 53 | его в EDT (смотри как).
59 |
60 |

61 | 62 |

https://download.eclipse.org/errors/content/eclipse-software-install-win10-v1.png

95 | 96 |
97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /targets/default/default.target: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /bom/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | ru.capralow.dt.adaptation 8 | bom 9 | 1.0.0-SNAPSHOT 10 | pom 11 | 12 | BOM 13 | 14 | 15 | 3.6.0 16 | 17 | 18 | 19 | Adaptation EDT Plugin 20 | 21 | 1.7.0 22 | 1.7.0 23 | 24 | 3.1.12.2 25 | 3.1.1 26 | [8.29,) 27 | 28 | UTF-8 29 | UTF-8 30 | 11 31 | 11 32 | 11 33 | 34 | yyyyMMdd-HHmm 35 | ${maven.build.timestamp} 36 | 37 | false 38 | 39 | 40 | 41 | 42 | 43 | 44 | org.eclipse.tycho 45 | target-platform-configuration 46 | ${tycho.version} 47 | 48 | p2 49 | JavaSE-11 50 | false 51 | 52 | 53 | ru.capralow.dt.adaptation 54 | default 55 | 1.0.0-SNAPSHOT 56 | 57 | 58 | 59 | 60 | 61 | eclipse-plugin 62 | javax.annotation 63 | 0.0.0 64 | 65 | 66 | 67 | 68 | 69 | win32 70 | win32 71 | x86_64 72 | 73 | 74 | linux 75 | gtk 76 | x86_64 77 | 78 | 79 | macosx 80 | cocoa 81 | x86_64 82 | 83 | 84 | 85 | 86 | 87 | 88 | org.eclipse.tycho 89 | tycho-maven-plugin 90 | ${tycho.version} 91 | true 92 | 93 | 94 | 95 | org.eclipse.tycho 96 | tycho-compiler-plugin 97 | ${tycho.version} 98 | 99 | UTF-8 100 | true 101 | true 102 | true 103 | true 104 | true 105 | true 106 | 107 | 108 | -Xlint:all 109 | -Xlint:serial 110 | -Xlint:serial 111 | 112 | 113 | 114 | 115 | 116 | org.eclipse.tycho 117 | tycho-source-plugin 118 | ${tycho.version} 119 | 120 | 121 | false 122 | 123 | 124 | 125 | 126 | 127 | plugin-source 128 | 129 | 130 | 131 | 132 | 133 | 134 | org.eclipse.tycho 135 | tycho-surefire-plugin 136 | ${tycho.version} 137 | 138 | ${tycho.surefire.skipPluginTest} 139 | 140 | UTF-8 141 | UTF-8 142 | 143 | 144 | 145 | 146 | 147 | org.eclipse.tycho 148 | tycho-packaging-plugin 149 | ${tycho.version} 150 | 151 | 'v'yyyyMMddHHmm 152 | 153 | 154 | 155 | 156 | org.eclipse.tycho 157 | tycho-p2-plugin 158 | ${tycho.version} 159 | 160 | 161 | 162 | org.eclipse.tycho 163 | tycho-p2-repository-plugin 164 | ${tycho.version} 165 | 166 | Repository 167 | ${project.artifactId} 168 | {p2repo.archive.skip} 169 | 170 | 171 | 172 | 173 | org.eclipse.tycho.extras 174 | tycho-source-feature-plugin 175 | ${tycho.extras.version} 176 | 177 | false 178 | 179 | false 180 | 181 | 182 | 183 | 184 | 185 | org.eclipse.tycho.extras 186 | tycho-eclipserun-plugin 187 | ${tycho.extras.version} 188 | 189 | 190 | 191 | org.apache.maven.plugins 192 | maven-resources-plugin 193 | 2.7 194 | 195 | 196 | 197 | org.apache.maven.plugins 198 | maven-checkstyle-plugin 199 | ${maven.checkstyle.plugin.version} 200 | 201 | 202 | com.puppycrawl.tools 203 | checkstyle 204 | ${checkstyle.version} 205 | 206 | 207 | 208 | checkstyle.xml 209 | true 210 | true 211 | true 212 | true 213 | warning 214 | 215 | 216 | 217 | 218 | maven-antrun-plugin 219 | 1.8 220 | 221 | 222 | 223 | 224 | 225 | 226 | org.eclipse.tycho 227 | tycho-maven-plugin 228 | true 229 | 230 | 231 | 232 | maven-antrun-plugin 233 | 234 | 235 | export-properties 236 | package 237 | 238 | run 239 | 240 | 241 | 242 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | find-bugs 255 | 256 | 257 | 258 | com.github.spotbugs 259 | spotbugs-maven-plugin 260 | ${spotbugs.maven.plugin.version} 261 | 262 | Max 263 | Low 264 | true 265 | 9 266 | true 267 | -Xmx1536m 268 | 1536 269 | ${project.build.directory}/findbugs 270 | 271 | 272 | 273 | analyze-compile 274 | compile 275 | 276 | check 277 | 278 | 279 | 280 | 281 | 283 | 284 | com.github.spotbugs 285 | spotbugs 286 | 4.0.0-beta2 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/src/ru/capralow/dt/adaptation/prefix/PrefixCheck.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021, Alexander Kapralov 3 | */ 4 | package ru.capralow.dt.adaptation.prefix; 5 | 6 | import static com._1c.g5.v8.dt.bsl.model.BslPackage.Literals.METHOD; 7 | import static com._1c.g5.v8.dt.mcore.McorePackage.Literals.NAMED_ELEMENT__NAME; 8 | import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.MD_OBJECT; 9 | import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.MD_OBJECT__NAME; 10 | 11 | import java.text.MessageFormat; 12 | 13 | import org.eclipse.core.runtime.IProgressMonitor; 14 | import org.eclipse.emf.common.util.EList; 15 | import org.eclipse.emf.common.util.URI; 16 | import org.eclipse.emf.ecore.EObject; 17 | import org.eclipse.xtext.resource.IResourceServiceProvider; 18 | 19 | import com._1c.g5.v8.bm.core.IBmObject; 20 | import com._1c.g5.v8.dt.bsl.documentation.comment.BslCommentUtils; 21 | import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment; 22 | import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment.Description; 23 | import com._1c.g5.v8.dt.bsl.documentation.comment.BslMultiLineCommentDocumentationProvider; 24 | import com._1c.g5.v8.dt.bsl.documentation.comment.IDescriptionPart; 25 | import com._1c.g5.v8.dt.bsl.documentation.comment.TextPart; 26 | import com._1c.g5.v8.dt.bsl.model.Method; 27 | import com._1c.g5.v8.dt.bsl.model.Module; 28 | import com._1c.g5.v8.dt.bsl.model.ModuleType; 29 | import com._1c.g5.v8.dt.check.ICheckParameters; 30 | import com._1c.g5.v8.dt.check.components.BasicCheck; 31 | import com._1c.g5.v8.dt.check.settings.IssueType; 32 | import com._1c.g5.v8.dt.common.StringUtils; 33 | import com._1c.g5.v8.dt.md.distribution.support.IDistributionSupportTypeProvider; 34 | import com._1c.g5.v8.dt.md.distribution.support.UserSupportMode; 35 | import com._1c.g5.v8.dt.metadata.mdclass.Catalog; 36 | import com._1c.g5.v8.dt.metadata.mdclass.CatalogAttribute; 37 | import com._1c.g5.v8.dt.metadata.mdclass.Document; 38 | import com._1c.g5.v8.dt.metadata.mdclass.DocumentAttribute; 39 | import com._1c.g5.v8.dt.metadata.mdclass.MdObject; 40 | import com._1c.g5.v8.dt.metadata.mdclass.Subsystem; 41 | import com.google.inject.Inject; 42 | 43 | import ru.capralow.dt.adaptation.MdUtils; 44 | import ru.capralow.dt.adaptation.PrefixUtils; 45 | 46 | public class PrefixCheck 47 | extends BasicCheck 48 | { 49 | 50 | public static final String CHECK_ID = "PrefixCheck"; //$NON-NLS-1$ 51 | 52 | private static final String PREFIX_NAME_PATTERN_PARAMETER_NAME = "prefixNamePattern"; //$NON-NLS-1$ 53 | 54 | private static BslMultiLineCommentDocumentationProvider commentProvider = 55 | IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(URI.createURI("foo.bsl")).get( //$NON-NLS-1$ 56 | BslMultiLineCommentDocumentationProvider.class); 57 | 58 | @Inject 59 | IDistributionSupportTypeProvider distributionSupportTypeProvider; 60 | 61 | @Override 62 | public String getCheckId() 63 | { 64 | return CHECK_ID; 65 | } 66 | 67 | private void checkAttribute(String attributeName, boolean objectHasSupport, MdObject attribute, EObject object, 68 | ResultAcceptor resultAcceptor, ICheckParameters parameters) 69 | { 70 | String[] prefixNamePattern = parameters.getString(PREFIX_NAME_PATTERN_PARAMETER_NAME).split("[ ]"); //$NON-NLS-1$ 71 | 72 | UserSupportMode attributeSupportMode = distributionSupportTypeProvider.getUserSupportMode(attribute); 73 | boolean attributeHasSupport = attributeSupportMode != null; 74 | 75 | boolean attributeHasPrefix = !PrefixUtils.nameHasPrefix(attributeName, prefixNamePattern); 76 | 77 | boolean attributeNeedPrefix = true; 78 | if (!objectHasSupport || attributeHasSupport) 79 | attributeNeedPrefix = false; 80 | 81 | if (!attributeNeedPrefix && attributeHasPrefix) 82 | resultAcceptor.addIssue(MessageFormat.format(Messages.Error_Attribute0HasUnnecessaryPrefix, attributeName), 83 | MD_OBJECT__NAME); 84 | 85 | if (attributeNeedPrefix && !attributeHasPrefix) 86 | resultAcceptor.addIssue(MessageFormat.format(Messages.Error_Attribute0HasNoPrefix, attributeName), 87 | MD_OBJECT__NAME); 88 | } 89 | 90 | private void checkContainmentMdObject(Object object, ResultAcceptor resultAcceptor, ICheckParameters parameters, 91 | IProgressMonitor progressMonitor) 92 | { 93 | if (progressMonitor.isCanceled()) 94 | return; 95 | 96 | IBmObject moduleObject = ((IBmObject)object).bmGetTopObject(); 97 | MdObject moduleMdObject = (MdObject)moduleObject; 98 | 99 | UserSupportMode objectSupportMode = distributionSupportTypeProvider.getUserSupportMode(moduleMdObject); 100 | boolean objectHasSupport = objectSupportMode != null; 101 | 102 | if (moduleMdObject instanceof Catalog) 103 | { 104 | if (!((Module)object).getModuleType().equals(ModuleType.OBJECT_MODULE)) 105 | return; 106 | 107 | for (CatalogAttribute attribute : ((Catalog)moduleMdObject).getAttributes()) 108 | { 109 | checkAttribute(attribute.getName(), objectHasSupport, attribute, (MdObject)object, resultAcceptor, 110 | parameters); 111 | } 112 | 113 | } 114 | else if (moduleMdObject instanceof Document) 115 | { 116 | if (!((Module)object).getModuleType().equals(ModuleType.OBJECT_MODULE)) 117 | return; 118 | 119 | for (DocumentAttribute attribute : ((Document)moduleMdObject).getAttributes()) 120 | { 121 | checkAttribute(attribute.getName(), objectHasSupport, attribute, (MdObject)object, resultAcceptor, 122 | parameters); 123 | } 124 | 125 | } 126 | else 127 | { 128 | // MdObject не имеет реквизитов для проверки 129 | 130 | } 131 | 132 | } 133 | 134 | private void checkModule(Object object, ResultAcceptor resultAcceptor, ICheckParameters parameters, 135 | IProgressMonitor progressMonitor) 136 | { 137 | if (progressMonitor.isCanceled()) 138 | return; 139 | 140 | IBmObject moduleOwner = (IBmObject)((Module)object).getOwner(); 141 | 142 | IBmObject moduleObject = moduleOwner.bmGetTopObject(); 143 | 144 | MdObject moduleMdObject = (MdObject)moduleObject; 145 | 146 | UserSupportMode objectSupportMode = distributionSupportTypeProvider.getUserSupportMode(moduleMdObject); 147 | boolean objectHasSupport = objectSupportMode != null; 148 | boolean methodHasSupport = objectHasSupport; 149 | 150 | BslDocumentationComment comment = BslCommentUtils.parseTemplateComment((Method)object, true, commentProvider); 151 | Description description = comment.getDescription(); 152 | for (IDescriptionPart part : description.getParts()) 153 | { 154 | if (part instanceof TextPart) 155 | { 156 | String partText = ((TextPart)part).getText(); 157 | if (partText.toLowerCase().indexOf("рарус") != -1) //$NON-NLS-1$ 158 | { 159 | methodHasSupport = false; 160 | break; 161 | } 162 | } 163 | } 164 | 165 | String[] prefixNamePattern = new String[1]; 166 | 167 | String methodName = ((Method)object).getName(); 168 | boolean methodHasPrefix = !PrefixUtils.nameHasPrefix(methodName, prefixNamePattern); 169 | 170 | if (methodHasSupport && methodHasPrefix) 171 | resultAcceptor.addIssue(MessageFormat.format(Messages.Error_Method0HasUnnecessaryPrefix, methodName), 172 | NAMED_ELEMENT__NAME); 173 | 174 | if (!methodHasSupport && !methodHasPrefix) 175 | resultAcceptor.addIssue(MessageFormat.format(Messages.Error_Method0HasNoPrefix, methodName), 176 | NAMED_ELEMENT__NAME); 177 | } 178 | 179 | private void checkTopMdObject(Object object, ResultAcceptor resultAcceptor, ICheckParameters parameters, 180 | IProgressMonitor progressMonitor) 181 | { 182 | if (progressMonitor.isCanceled()) 183 | return; 184 | 185 | String[] prefixNamePattern = parameters.getString(PREFIX_NAME_PATTERN_PARAMETER_NAME).split("[ ]"); //$NON-NLS-1$ 186 | 187 | boolean hasStandartSubsystem = false; 188 | EList objectSubsystems = MdUtils.getSubsystemsForObject((MdObject)object); 189 | for (Subsystem subsystem : objectSubsystems) 190 | if (!subsystem.isIncludeInCommandInterface() 191 | && !PrefixUtils.nameHasPrefix(subsystem.getName(), prefixNamePattern)) 192 | { 193 | hasStandartSubsystem = true; 194 | break; 195 | } 196 | 197 | String objectName = ((MdObject)object).getName(); 198 | boolean objectHasPrefix = PrefixUtils.nameHasPrefix(objectName, prefixNamePattern); 199 | 200 | if (!hasStandartSubsystem && !objectHasPrefix) 201 | resultAcceptor.addIssue(Messages.Error_ObjectHasNoPrefix, MD_OBJECT__NAME); 202 | 203 | if (hasStandartSubsystem && objectHasPrefix) 204 | resultAcceptor.addIssue(Messages.Error_ObjectHasUnnecessaryPrefix, MD_OBJECT__NAME); 205 | } 206 | 207 | @Override 208 | protected void check(Object object, ResultAcceptor resultAcceptor, ICheckParameters parameters, 209 | IProgressMonitor progressMonitor) 210 | { 211 | if (object instanceof MdObject) 212 | { 213 | if (!((IBmObject)object).bmIsTop()) 214 | checkTopMdObject(object, resultAcceptor, parameters, progressMonitor); 215 | else 216 | checkContainmentMdObject(object, resultAcceptor, parameters, progressMonitor); 217 | } 218 | else 219 | { 220 | checkModule(object, resultAcceptor, parameters, progressMonitor); 221 | } 222 | } 223 | 224 | @Override 225 | protected void configureCheck(CheckConfigurer configurer) 226 | { 227 | configurer.title(Messages.Error_MethodPrefix_Title).description(Messages.Error_MethodPrefix_Description); 228 | configurer.issueType(IssueType.WARNING); 229 | 230 | configurer.parameter(PREFIX_NAME_PATTERN_PARAMETER_NAME, String.class, StringUtils.EMPTY, 231 | Messages.Parameter_PrefixName); 232 | 233 | configurer.topObject(MD_OBJECT).features(MD_OBJECT__NAME); 234 | configurer.topObject(MD_OBJECT).containment(MD_OBJECT).features(MD_OBJECT__NAME); 235 | configurer.module().checkedObjectType(METHOD); 236 | } 237 | 238 | } 239 | -------------------------------------------------------------------------------- /bundles/ru.capralow.dt.adaptation/src/ru/capralow/dt/adaptation/BslModelUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, Alexander Kapralov 3 | */ 4 | package ru.capralow.dt.adaptation; 5 | 6 | import java.text.MessageFormat; 7 | import java.util.Collection; 8 | import java.util.HashMap; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | import org.eclipse.emf.common.util.EList; 13 | import org.eclipse.emf.common.util.URI; 14 | import org.eclipse.emf.ecore.EObject; 15 | import org.eclipse.emf.ecore.EcoreFactory; 16 | import org.eclipse.emf.ecore.InternalEObject; 17 | import org.eclipse.emf.ecore.resource.Resource; 18 | import org.eclipse.emf.ecore.util.EcoreUtil; 19 | import org.eclipse.xtext.EcoreUtil2; 20 | import org.eclipse.xtext.nodemodel.ICompositeNode; 21 | import org.eclipse.xtext.nodemodel.ILeafNode; 22 | import org.eclipse.xtext.nodemodel.INode; 23 | import org.eclipse.xtext.nodemodel.util.NodeModelUtils; 24 | import org.eclipse.xtext.resource.DerivedStateAwareResource; 25 | import org.eclipse.xtext.resource.IResourceServiceProvider; 26 | 27 | import com._1c.g5.v8.dt.bsl.model.BslPackage; 28 | import com._1c.g5.v8.dt.bsl.model.Conditional; 29 | import com._1c.g5.v8.dt.bsl.model.DynamicFeatureAccess; 30 | import com._1c.g5.v8.dt.bsl.model.EmptyStatement; 31 | import com._1c.g5.v8.dt.bsl.model.Expression; 32 | import com._1c.g5.v8.dt.bsl.model.FeatureAccess; 33 | import com._1c.g5.v8.dt.bsl.model.FeatureEntry; 34 | import com._1c.g5.v8.dt.bsl.model.FormalParam; 35 | import com._1c.g5.v8.dt.bsl.model.IfStatement; 36 | import com._1c.g5.v8.dt.bsl.model.Invocation; 37 | import com._1c.g5.v8.dt.bsl.model.Method; 38 | import com._1c.g5.v8.dt.bsl.model.Module; 39 | import com._1c.g5.v8.dt.bsl.model.SimpleStatement; 40 | import com._1c.g5.v8.dt.bsl.model.SourceObjectLinkProvider; 41 | import com._1c.g5.v8.dt.bsl.model.Statement; 42 | import com._1c.g5.v8.dt.bsl.model.StaticFeatureAccess; 43 | import com._1c.g5.v8.dt.bsl.model.StringLiteral; 44 | import com._1c.g5.v8.dt.bsl.resource.BslResolveCrossReferencesJob; 45 | import com._1c.g5.v8.dt.bsl.resource.BslResource; 46 | import com._1c.g5.v8.dt.bsl.resource.DynamicFeatureAccessComputer; 47 | import com._1c.g5.v8.dt.core.platform.IV8Project; 48 | import com._1c.g5.v8.dt.lcore.nodemodel.util.CustomNodeModelUtils; 49 | import com._1c.g5.v8.dt.mcore.DerivedProperty; 50 | import com._1c.g5.v8.dt.mcore.Environmental; 51 | import com._1c.g5.v8.dt.mcore.McorePackage; 52 | import com._1c.g5.v8.dt.md.resource.MdTypeUtil; 53 | import com._1c.g5.v8.dt.metadata.mdclass.BasicDbObject; 54 | import com._1c.g5.v8.dt.metadata.mdclass.CommonModule; 55 | import com._1c.g5.v8.dt.metadata.mdclass.Subsystem; 56 | 57 | import ru.capralow.dt.adaptation.internal.AdaptationPlugin; 58 | 59 | public final class BslModelUtils 60 | { 61 | 62 | private static DynamicFeatureAccessComputer dynamicFeatureAccessComputer = 63 | IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(URI.createURI("foo.bsl")).get( //$NON-NLS-1$ 64 | DynamicFeatureAccessComputer.class); 65 | 66 | public static void customResolveLazyCrossReferences(Resource resource) 67 | { 68 | BslResource bslResource = (BslResource)resource; 69 | 70 | EcoreUtil2.resolveLazyCrossReferences(bslResource, null); 71 | Collection jobs = BslResolveCrossReferencesJob.findJobsByResource(bslResource); 72 | for (BslResolveCrossReferencesJob job : jobs) 73 | try 74 | { 75 | job.join(); 76 | } 77 | catch (InterruptedException e) 78 | { 79 | AdaptationPlugin.log(AdaptationPlugin.createErrorStatus(e.getMessage(), e)); 80 | } 81 | } 82 | 83 | public static INode getEndBracketParamsNode(Method method) 84 | { 85 | List nodesBefore = null; 86 | if (!method.getFormalParams().isEmpty()) 87 | nodesBefore = NodeModelUtils.findNodesForFeature(method, BslPackage.Literals.METHOD__FORMAL_PARAMS); 88 | else 89 | nodesBefore = NodeModelUtils.findNodesForFeature(method, McorePackage.Literals.NAMED_ELEMENT__NAME); 90 | 91 | if (nodesBefore.isEmpty()) 92 | return null; 93 | 94 | int searchFrom = nodesBefore.get(nodesBefore.size() - 1).getTotalEndOffset(); 95 | INode methodNode = NodeModelUtils.findActualNodeFor(method); 96 | INode bracketNode = null; 97 | for (ILeafNode leafNode : methodNode.getLeafNodes()) 98 | { 99 | if (leafNode.getOffset() < searchFrom || leafNode.isHidden() || leafNode.getLength() > 1) 100 | continue; 101 | if (")".equals(leafNode.getText())) //$NON-NLS-1$ 102 | { 103 | bracketNode = leafNode; 104 | break; 105 | } 106 | } 107 | return bracketNode; 108 | } 109 | 110 | public static Statement getNearestStatement(Method method, int offset) 111 | { 112 | ICompositeNode methodNode = NodeModelUtils.findActualNodeFor(method); 113 | ILeafNode node = CustomNodeModelUtils.findLeafNodeAtOffset(methodNode, offset); 114 | EObject actualObject = NodeModelUtils.findActualSemanticObjectFor(node); 115 | if (actualObject instanceof Method) 116 | { 117 | EList allStatements = method.allStatements(); 118 | if (!allStatements.isEmpty()) 119 | actualObject = allStatements.get(allStatements.size() - 1); 120 | } 121 | if (actualObject instanceof Statement) 122 | return (Statement)actualObject; 123 | 124 | return EcoreUtil2.getContainerOfType(actualObject, Statement.class); 125 | } 126 | 127 | public static StringLiteral getNearestStringLiteral(Method method, int offset) 128 | { 129 | ICompositeNode methodNode = NodeModelUtils.findActualNodeFor(method); 130 | ILeafNode node = CustomNodeModelUtils.findLeafNodeAtOffset(methodNode, offset); 131 | EObject actualObject = NodeModelUtils.findActualSemanticObjectFor(node); 132 | if (actualObject instanceof StringLiteral) 133 | return (StringLiteral)actualObject; 134 | 135 | return EcoreUtil2.getContainerOfType(actualObject, StringLiteral.class); 136 | } 137 | 138 | public static void parseStatements(Method method, List objectsList, IV8Project v8Project) 139 | { 140 | EList methodParams = method.getFormalParams(); 141 | if (methodParams.isEmpty()) 142 | return; 143 | 144 | Map modulesAliases = new HashMap<>(); // Поддержка ОбщегоНазначения.ОбщийМодуль() 145 | 146 | String variableName = methodParams.get(0).getName(); 147 | 148 | for (Statement statement : method.getStatements()) 149 | if (statement instanceof IfStatement) 150 | parseIfStatement(statement, variableName, objectsList, modulesAliases, v8Project); 151 | else 152 | parseSimpleStatement(statement, variableName, objectsList, modulesAliases, v8Project); 153 | } 154 | 155 | private static void parseIfStatement(Statement statement, String variableName, List objectsList, 156 | Map modulesAliases, IV8Project v8Project) 157 | { 158 | IfStatement ifStatement = (IfStatement)statement; 159 | 160 | boolean trueStatement = parseSubsystemExistsStatement(ifStatement, v8Project); 161 | 162 | if (!trueStatement) 163 | return; 164 | 165 | Conditional ifPart = ifStatement.getIfPart(); 166 | for (Statement ifPartStatement : ifPart.getStatements()) 167 | parseSimpleStatement(ifPartStatement, variableName, objectsList, modulesAliases, v8Project); 168 | } 169 | 170 | private static void parseMethodInAnotherModule(DynamicFeatureAccess dynamicMethodAccess, List objectsList, 171 | Map modulesAliases, IV8Project v8Project) 172 | { 173 | Method method = null; 174 | 175 | List featureEntries = dynamicFeatureAccessComputer.resolveObject(dynamicMethodAccess, 176 | EcoreUtil2.getContainerOfType(dynamicMethodAccess, Environmental.class).environments()); 177 | if (featureEntries.isEmpty()) 178 | { 179 | // "Не установлен плагин SSL Support." 180 | CommonModule commonModule = 181 | (CommonModule)MdUtils.getMdObject(MessageFormat.format(MdUtils.MD_OBJECT, "ОбщийМодуль", //$NON-NLS-1$ 182 | modulesAliases.get(((FeatureAccess)dynamicMethodAccess.getSource()).getName())), v8Project); 183 | 184 | if (commonModule == null) 185 | return; 186 | 187 | Module module = commonModule.getModule(); 188 | customResolveLazyCrossReferences(module.eResource()); 189 | 190 | method = MdUtils.getMethod(module, dynamicMethodAccess.getName()); 191 | if (method == null) 192 | return; 193 | 194 | } 195 | else 196 | { 197 | FeatureEntry featureEntry = featureEntries.get(0); 198 | EObject feature = featureEntry.getFeature(); 199 | 200 | EObject newObject = EcoreFactory.eINSTANCE.createEObject(); 201 | ((InternalEObject)newObject).eSetProxyURI(((SourceObjectLinkProvider)feature).getSourceUri()); 202 | method = (Method)EcoreUtil.resolve(newObject, MdUtils.getConfigurationForProject(v8Project)); 203 | if (method.eResource() instanceof DerivedStateAwareResource) 204 | ((DerivedStateAwareResource)method.eResource()).installDerivedState(false); 205 | 206 | } 207 | 208 | parseStatements(method, objectsList, v8Project); 209 | } 210 | 211 | private static void parseMethodInSameModule(StaticFeatureAccess staticMethodAccess, List objectsList, 212 | IV8Project v8Project) 213 | { 214 | List featureEntries = dynamicFeatureAccessComputer.resolveObject(staticMethodAccess, 215 | EcoreUtil2.getContainerOfType(staticMethodAccess, Environmental.class).environments()); 216 | if (featureEntries.isEmpty()) 217 | { 218 | String errorMessage = "DynamicFeatureAccessComputer не смог получить FeatureEntries"; 219 | IllegalStateException exception = new IllegalStateException(); 220 | AdaptationPlugin.log(AdaptationPlugin.createErrorStatus(errorMessage, exception)); 221 | throw exception; 222 | } 223 | 224 | FeatureEntry featureEntry = featureEntries.get(0); 225 | EObject feature = featureEntry.getFeature(); 226 | 227 | Method method = (Method)feature; 228 | 229 | parseStatements(method, objectsList, v8Project); 230 | } 231 | 232 | private static void parseSimpleStatement(Statement statement, String variableName, List objectsList, 233 | Map modulesAliases, IV8Project v8Project) 234 | { 235 | if (statement instanceof EmptyStatement) 236 | return; 237 | 238 | SimpleStatement simpleStatement = (SimpleStatement)statement; 239 | Expression leftStatement = simpleStatement.getLeft(); 240 | 241 | if (leftStatement instanceof StaticFeatureAccess) 242 | { 243 | String moduleAlias = ((StaticFeatureAccess)leftStatement).getName(); 244 | 245 | String moduleName = 246 | ((StringLiteral)((Invocation)simpleStatement.getRight()).getParams().get(0)).getLines().get(0).replace( 247 | "\"", ""); //$NON-NLS-1$ //$NON-NLS-2$ 248 | 249 | modulesAliases.put(moduleAlias, moduleName); 250 | 251 | } 252 | else 253 | { 254 | Invocation leftInvocation = (Invocation)leftStatement; 255 | 256 | FeatureAccess methodAccess = leftInvocation.getMethodAccess(); 257 | 258 | if (methodAccess instanceof DynamicFeatureAccess) 259 | { 260 | 261 | DynamicFeatureAccess dynamicMethodAccess = (DynamicFeatureAccess)methodAccess; 262 | StaticFeatureAccess source = (StaticFeatureAccess)dynamicMethodAccess.getSource(); 263 | 264 | if (source.getName().equalsIgnoreCase(variableName)) 265 | { 266 | EList params = leftInvocation.getParams(); 267 | DynamicFeatureAccess firstParam = (DynamicFeatureAccess)params.get(0); 268 | 269 | List featureEntries = dynamicFeatureAccessComputer.resolveObject(firstParam, 270 | EcoreUtil2.getContainerOfType(firstParam, Environmental.class).environments()); 271 | if (featureEntries.isEmpty()) 272 | { 273 | String errorMessage = "DynamicFeatureAccessComputer не смог получить FeatureEntries"; 274 | IllegalStateException exception = new IllegalStateException(); 275 | AdaptationPlugin.log(AdaptationPlugin.createErrorStatus(errorMessage, exception)); 276 | throw exception; 277 | } 278 | 279 | FeatureEntry featureEntry = featureEntries.get(0); 280 | DerivedProperty deriveredProperty = (DerivedProperty)featureEntry.getFeature(); 281 | BasicDbObject objectOwner = 282 | EcoreUtil2.getContainerOfType(deriveredProperty.getSource(), BasicDbObject.class); 283 | if (objectOwner == null) 284 | return; 285 | 286 | objectsList.add(MdTypeUtil.getRefType(objectOwner).getName()); 287 | } 288 | else 289 | parseMethodInAnotherModule(dynamicMethodAccess, objectsList, modulesAliases, v8Project); 290 | } 291 | else 292 | { 293 | parseMethodInSameModule((StaticFeatureAccess)methodAccess, objectsList, v8Project); 294 | 295 | } 296 | 297 | } 298 | } 299 | 300 | private static boolean parseSubsystemExistsStatement(IfStatement ifStatement, IV8Project v8Project) 301 | { 302 | boolean trueStatement = true; 303 | 304 | Conditional ifPart = ifStatement.getIfPart(); 305 | Invocation predicate = (Invocation)ifPart.getPredicate(); 306 | 307 | FeatureAccess methodAccess = predicate.getMethodAccess(); 308 | DynamicFeatureAccess dynamicMethodAccess = (DynamicFeatureAccess)methodAccess; 309 | 310 | if (dynamicMethodAccess.getName().equals("ПодсистемаСуществует")) //$NON-NLS-1$ 311 | { 312 | StringLiteral subsystemLiteral = (StringLiteral)predicate.getParams().get(0); 313 | 314 | StringBuilder subsystemName = new StringBuilder(); 315 | subsystemName.append("Подсистема"); //$NON-NLS-1$ 316 | 317 | for (String stringPart : subsystemLiteral.getLines().get(0).replace("\"", "").split("[.]")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 318 | subsystemName.append(".").append(stringPart); //$NON-NLS-1$ 319 | 320 | Subsystem subsystem = (Subsystem)MdUtils.getMdObject(subsystemName.toString(), v8Project); 321 | 322 | trueStatement = subsystem != null; 323 | } 324 | 325 | return trueStatement; 326 | } 327 | 328 | private BslModelUtils() 329 | { 330 | throw new IllegalStateException(Messages.Internal_class); 331 | } 332 | } 333 | --------------------------------------------------------------------------------