├── ru.tormozit.dt.codelinkopener.plugin.ui ├── bin │ ├── .gitignore │ └── ru │ │ └── tormozit │ │ └── dt │ │ └── codelinkopener │ │ └── plugin │ │ └── ui │ │ ├── Activator.class │ │ ├── Messages.class │ │ ├── OpenerHandler.class │ │ ├── OpenerHandlerDialog.class │ │ ├── ExecutableExtensionFactory.class │ │ ├── ExternalDependenciesModule.class │ │ └── messages.properties ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs ├── build.properties ├── .classpath ├── src │ └── ru │ │ └── tormozit │ │ └── dt │ │ └── codelinkopener │ │ └── plugin │ │ └── ui │ │ ├── ExecutableExtensionFactory.java │ │ ├── ExternalDependenciesModule.java │ │ ├── Messages.java │ │ ├── messages.properties │ │ ├── OpenerHandler.java │ │ ├── Activator.java │ │ └── OpenerHandlerDialog.java ├── pom.xml ├── .project ├── plugin.properties ├── plugin.xml ├── META-INF │ └── MANIFEST.MF └── plugin.launch ├── repository ├── .settings │ └── org.eclipse.core.resources.prefs ├── .project ├── category.xml └── pom.xml ├── ru.tormozit.dt.codelinkopener.plugin.feature ├── .settings │ └── org.eclipse.core.resources.prefs ├── SourceTemplateFeature │ ├── build.properties │ └── feature.properties ├── build.properties ├── feature.properties ├── .project ├── feature.xml └── pom.xml ├── target ├── .project ├── pom.xml └── default.target └── README.md /ru.tormozit.dt.codelinkopener.plugin.ui/bin/.gitignore: -------------------------------------------------------------------------------- 1 | /ru/ 2 | -------------------------------------------------------------------------------- /repository/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.feature/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.feature/SourceTemplateFeature/build.properties: -------------------------------------------------------------------------------- 1 | javacCustomEncodings.. = src/[UTF-8] 2 | bin.includes = feature.xml,\ 3 | feature.properties -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.feature/build.properties: -------------------------------------------------------------------------------- 1 | javacCustomEncodings.. = src/[UTF-8] 2 | bin.includes = feature.xml,\ 3 | feature.properties,\ 4 | SourceTemplateFeature/ 5 | 6 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.feature/feature.properties: -------------------------------------------------------------------------------- 1 | featureName= \u041F\u0440\u0438\u043C\u0435\u0440 \u043F\u043B\u0430\u0433\u0438\u043D\u0430 \u0434\u043B\u044F "1C: Enterprise Development Tools" 2 | providerName=1C LLC -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.feature/SourceTemplateFeature/feature.properties: -------------------------------------------------------------------------------- 1 | featureName= \u041F\u0440\u0438\u043C\u0435\u0440 \u043F\u043B\u0430\u0433\u0438\u043D\u0430 \u0434\u043B\u044F "1C: Enterprise Development Tools" 2 | providerName=1C LLC -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/bin/ru/tormozit/dt/codelinkopener/plugin/ui/Activator.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tormozit/EDT.CodeLinkOpener/HEAD/ru.tormozit.dt.codelinkopener.plugin.ui/bin/ru/tormozit/dt/codelinkopener/plugin/ui/Activator.class -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/bin/ru/tormozit/dt/codelinkopener/plugin/ui/Messages.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tormozit/EDT.CodeLinkOpener/HEAD/ru.tormozit.dt.codelinkopener.plugin.ui/bin/ru/tormozit/dt/codelinkopener/plugin/ui/Messages.class -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/bin/ru/tormozit/dt/codelinkopener/plugin/ui/OpenerHandler.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tormozit/EDT.CodeLinkOpener/HEAD/ru.tormozit.dt.codelinkopener.plugin.ui/bin/ru/tormozit/dt/codelinkopener/plugin/ui/OpenerHandler.class -------------------------------------------------------------------------------- /target/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | target 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /repository/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | repository 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/bin/ru/tormozit/dt/codelinkopener/plugin/ui/OpenerHandlerDialog.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tormozit/EDT.CodeLinkOpener/HEAD/ru.tormozit.dt.codelinkopener.plugin.ui/bin/ru/tormozit/dt/codelinkopener/plugin/ui/OpenerHandlerDialog.class -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/bin/ru/tormozit/dt/codelinkopener/plugin/ui/ExecutableExtensionFactory.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tormozit/EDT.CodeLinkOpener/HEAD/ru.tormozit.dt.codelinkopener.plugin.ui/bin/ru/tormozit/dt/codelinkopener/plugin/ui/ExecutableExtensionFactory.class -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/bin/ru/tormozit/dt/codelinkopener/plugin/ui/ExternalDependenciesModule.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tormozit/EDT.CodeLinkOpener/HEAD/ru.tormozit.dt.codelinkopener.plugin.ui/bin/ru/tormozit/dt/codelinkopener/plugin/ui/ExternalDependenciesModule.class -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/build.properties: -------------------------------------------------------------------------------- 1 | javacCustomEncodings.. = src/[UTF-8] 2 | source.. = src/,\ 3 | resources/ 4 | bin.includes = META-INF/,\ 5 | .,\ 6 | plugin.xml,\ 7 | plugin.properties,\ 8 | resources/ 9 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/.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=1.8 4 | org.eclipse.jdt.core.compiler.compliance=1.8 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=1.8 8 | -------------------------------------------------------------------------------- /repository/category.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.feature/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ru.tormozit.dt.codelinkopener.plugin.feature 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.pde.FeatureBuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.pde.FeatureNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/src/ru/tormozit/dt/codelinkopener/plugin/ui/ExecutableExtensionFactory.java: -------------------------------------------------------------------------------- 1 | package ru.tormozit.dt.codelinkopener.plugin.ui; 2 | 3 | import org.osgi.framework.Bundle; 4 | 5 | import com._1c.g5.wiring.AbstractGuiceAwareExecutableExtensionFactory; 6 | import com.google.inject.Injector; 7 | 8 | public class ExecutableExtensionFactory extends AbstractGuiceAwareExecutableExtensionFactory { 9 | 10 | @Override 11 | protected Bundle getBundle() { 12 | return Activator.getDefault().getBundle(); 13 | } 14 | 15 | @Override 16 | protected Injector getInjector() { 17 | return Activator.getDefault().getInjector(); 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /repository/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | ru.tormozit.dt.codelinkopener.plugin 9 | build 10 | 1.0.0-SNAPSHOT 11 | ../build/pom.xml 12 | 13 | 14 | repository 15 | 1.0.0-SNAPSHOT 16 | eclipse-repository 17 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.feature/feature.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | Плагин. Переход по ссылкам из буферма обмена для "1C: Enterprise Development Tools" 10 | 11 | 12 | 13 | 1C LLC 14 | 15 | 16 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com._1c.dt.example 8 | build 9 | 2.0.100-SNAPSHOT 10 | ../build/pom.xml 11 | 12 | ru.tormozit.dt.codelinkopener.plugin.ui 13 | 2.0.100-SNAPSHOT 14 | eclipse-plugin 15 | -------------------------------------------------------------------------------- /target/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | ru.tormozit.dt.codelinkopener.plugin 8 | build 9 | 1.0.0-SNAPSHOT 10 | ../build/pom.xml 11 | 12 | 13 | ru.tormozit.dt.codelinkopener.plugin.target 14 | default 15 | 1.0.0-SNAPSHOT 16 | target 17 | eclipse-target-definition 18 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ru.tormozit.dt.codelinkopener.plugin.ui 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.jdt.core.javanature 26 | org.eclipse.pde.PluginNature 27 | 28 | 29 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/src/ru/tormozit/dt/codelinkopener/plugin/ui/ExternalDependenciesModule.java: -------------------------------------------------------------------------------- 1 | package ru.tormozit.dt.codelinkopener.plugin.ui; 2 | 3 | import org.eclipse.core.runtime.Plugin; 4 | 5 | import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; 6 | import com._1c.g5.v8.dt.core.platform.IResourceLookup; 7 | import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; 8 | import com._1c.g5.wiring.AbstractServiceAwareModule; 9 | 10 | public class ExternalDependenciesModule extends AbstractServiceAwareModule { 11 | 12 | public ExternalDependenciesModule(Plugin bundle) { 13 | super(bundle); 14 | } 15 | 16 | @Override 17 | protected void doConfigure() { 18 | bind(IBmEmfIndexManager.class).toService(); 19 | // bind(IProfilingService.class).toService(); 20 | bind(IResourceLookup.class).toService(); 21 | bind(IV8ProjectManager.class).toService(); 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/plugin.properties: -------------------------------------------------------------------------------- 1 | 2 | command.name = \u041F\u0435\u0440\u0435\u0445\u043E\u0434 \u043F\u043E \u0441\u0441\u044B\u043B\u043A\u0435 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u043E\u0431\u043C\u0435\u043D\u0430 3 | command.tooltip = \u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0442\u0435\u043A\u0441\u0442 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u043E\u0431\u043C\u0435\u043D\u0430 \u0441 \u043E\u0431\u043E\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435\u043C \u0441\u0441\u044B\u043B\u043E\u043A \u043D\u0430 \u0441\u0442\u0440\u043E\u043A\u0438 \u043C\u043E\u0434\u0443\u043B\u0435\u0439 4 | 5 | pluginName = \u041F\u043B\u0430\u0433\u0438\u043D "\u041F\u0435\u0440\u0435\u0445\u043E\u0434 \u043F\u043E \u0441\u0441\u044B\u043B\u043A\u0435 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u043E\u0431\u043C\u0435\u043D\u0430" 6 | 7 | providerName = tormozit 8 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/src/ru/tormozit/dt/codelinkopener/plugin/ui/Messages.java: -------------------------------------------------------------------------------- 1 | 2 | package ru.tormozit.dt.codelinkopener.plugin.ui; 3 | 4 | import org.eclipse.osgi.util.NLS; 5 | 6 | /** 7 | * Данный класс - представитель локализации механизма строк в Eclipse. 8 | */ 9 | class Messages 10 | extends NLS 11 | { 12 | private static final String BUNDLE_NAME = "ru.tormozit.dt.codelinkopener.plugin.ui.messages"; 13 | 14 | public static String DataProcessingHandler_Error; 15 | public static String DataProcessingHandlerDialog_dialog_title; 16 | public static String DataProcessingHandlerDialog_dialog_message; 17 | public static String DataProcessingHandlerDialog_dialog_text; 18 | 19 | static 20 | { 21 | // initialize resource bundle 22 | NLS.initializeMessages(BUNDLE_NAME, Messages.class); 23 | } 24 | 25 | private Messages() 26 | { 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/bin/ru/tormozit/dt/codelinkopener/plugin/ui/messages.properties: -------------------------------------------------------------------------------- 1 | 2 | DataProcessingHandlerDialog_dialog_message = \u0411\u0435\u0440\u0435\u0442 \u0442\u0435\u043A\u0441\u0442 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u043E\u0431\u043C\u0435\u043D\u0430 \u0438 \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0435\u0433\u043E \u0441 \u043E\u0431\u043E\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435\u043C \u0441\u0441\u044B\u043B\u043E\u043A \u043D\u0430 \u0441\u0442\u0440\u043E\u043A\u0438 \u043C\u043E\u0434\u0443\u043B\u0435\u0439. CTRL+\u043A\u043B\u0438\u043A \u0432\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442 \u043F\u0435\u0440\u0435\u0445\u043E\u0434 \u043F\u043E \u0441\u0441\u044B\u043B\u043A\u0435. 3 | 4 | DataProcessingHandlerDialog_dialog_text = \u041F\u0435\u0440\u0435\u0445\u043E\u0434 \u043F\u043E \u0441\u0441\u044B\u043B\u043A\u0435 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u043E\u0431\u043C\u0435\u043D\u0430 5 | 6 | DataProcessingHandlerDialog_dialog_title = \u041F\u0435\u0440\u0435\u0445\u043E\u0434 \u043F\u043E \u0441\u0441\u044B\u043B\u043A\u0435 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u043E\u0431\u043C\u0435\u043D\u0430 7 | 8 | DataProcessingHandler_Error = \u041E\u0448\u0438\u0431\u043A\u0430! 9 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/src/ru/tormozit/dt/codelinkopener/plugin/ui/messages.properties: -------------------------------------------------------------------------------- 1 | 2 | DataProcessingHandlerDialog_dialog_message = \u0411\u0435\u0440\u0435\u0442 \u0442\u0435\u043A\u0441\u0442 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u043E\u0431\u043C\u0435\u043D\u0430 \u0438 \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0435\u0433\u043E \u0441 \u043E\u0431\u043E\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435\u043C \u0441\u0441\u044B\u043B\u043E\u043A \u043D\u0430 \u0441\u0442\u0440\u043E\u043A\u0438 \u043C\u043E\u0434\u0443\u043B\u0435\u0439. CTRL+\u043A\u043B\u0438\u043A \u0432\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442 \u043F\u0435\u0440\u0435\u0445\u043E\u0434 \u043F\u043E \u0441\u0441\u044B\u043B\u043A\u0435. 3 | 4 | DataProcessingHandlerDialog_dialog_text = \u041F\u0435\u0440\u0435\u0445\u043E\u0434 \u043F\u043E \u0441\u0441\u044B\u043B\u043A\u0435 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u043E\u0431\u043C\u0435\u043D\u0430 5 | 6 | DataProcessingHandlerDialog_dialog_title = \u041F\u0435\u0440\u0435\u0445\u043E\u0434 \u043F\u043E \u0441\u0441\u044B\u043B\u043A\u0435 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u043E\u0431\u043C\u0435\u043D\u0430 7 | 8 | DataProcessingHandler_Error = \u041E\u0448\u0438\u0431\u043A\u0430! 9 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/src/ru/tormozit/dt/codelinkopener/plugin/ui/OpenerHandler.java: -------------------------------------------------------------------------------- 1 | package ru.tormozit.dt.codelinkopener.plugin.ui; 2 | 3 | import org.eclipse.core.commands.AbstractHandler; 4 | import org.eclipse.core.commands.ExecutionEvent; 5 | import org.eclipse.core.commands.ExecutionException; 6 | import org.eclipse.jface.window.Window; 7 | import org.eclipse.swt.widgets.Display; 8 | 9 | import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; 10 | import com._1c.g5.v8.dt.core.platform.IResourceLookup; 11 | import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; 12 | 13 | import com.google.inject.Inject; 14 | 15 | public class OpenerHandler extends AbstractHandler 16 | { 17 | @Inject 18 | private IBmEmfIndexManager bmEmfIndexManager; 19 | @Inject 20 | private IResourceLookup resourceLookup; 21 | @Inject 22 | private IV8ProjectManager projectManager; 23 | 24 | @Override 25 | public Object execute(ExecutionEvent event) throws ExecutionException 26 | { 27 | // создадим диалог конструктора движения регистра 28 | OpenerHandlerDialog dialog = 29 | new OpenerHandlerDialog(Display.getCurrent().getActiveShell(), bmEmfIndexManager, resourceLookup, projectManager); 30 | // обработаем завершение работы пользователя с диалогом 31 | if (dialog.open() == Window.OK) 32 | { 33 | } 34 | return null; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.feature/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | ru.tormozit.dt.codelinkopener.plugin 7 | build 8 | 1.0.0-SNAPSHOT 9 | ../build/pom.xml 10 | 11 | ru.tormozit.dt.codelinkopener.plugin.feature 12 | ru.tormozit.dt.codelinkopener.plugin 13 | 1.0.0-SNAPSHOT 14 | eclipse-feature 15 | 16 | 17 | 18 | org.eclipse.tycho.extras 19 | tycho-source-feature-plugin 20 | 21 | 22 | package 23 | 24 | source-feature 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.tycho 31 | tycho-p2-plugin 32 | 33 | 34 | package 35 | 36 | p2-metadata 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: %pluginName 4 | Bundle-Vendor: %providerName 5 | Bundle-Version: 1.0.2.qualifier 6 | Bundle-SymbolicName: ru.tormozit.dt.codelinkopener.plugin.ui;singleton:=true 7 | Bundle-Activator: ru.tormozit.dt.codelinkopener.plugin.ui.Activator 8 | Bundle-Localization: plugin 9 | Require-Bundle: com.google.inject;bundle-version="[3.0.0,4.0.0)", 10 | org.eclipse.ui;bundle-version="[3.106.1,4.0.0)", 11 | org.eclipse.xtext.ui;bundle-version="2.12.0", 12 | org.eclipse.ui.ide;bundle-version="[3.10.2,4.0.0)", 13 | org.apache.log4j;bundle-version="[1.2.15,2.0.0)", 14 | com._1c.g5.v8.dt.metadata 15 | Import-Package: com._1c.g5.aef2.engines;version="4.0.0", 16 | com._1c.g5.v8.bm.integration.event;version="1.0.0", 17 | com._1c.g5.v8.dt.bm.index.emf;version="6.2.0", 18 | com._1c.g5.v8.dt.bsl.model;version="[3.0.0,4.0.0)", 19 | com._1c.g5.v8.dt.bsl.ui.menu;version="4.4.0", 20 | com._1c.g5.v8.dt.core.platform;version="7.1.0", 21 | com._1c.g5.v8.dt.form.ui.editor;version="3.1.0", 22 | com._1c.g5.v8.dt.lifecycle;version="2.1.0", 23 | com._1c.g5.v8.dt.mcore;version="[4.0.0,5.0.0)", 24 | com._1c.g5.v8.dt.mcore.impl;version="[5.0.0,6.0.0)", 25 | com._1c.g5.v8.dt.md.ui.editor.base;version="9.0.0", 26 | com._1c.g5.v8.dt.metadata;version="4.0.0", 27 | com._1c.g5.v8.dt.ui.util;version="5.2.0", 28 | com._1c.g5.v8.dt.validation.marker;version="3.0.0", 29 | com._1c.g5.wiring;version="2.0.0", 30 | com._1c.g5.wiring.binder;version="1.1.0", 31 | org.antlr.stringtemplate;version="[3.2.0,4.0.0)", 32 | org.eclipse.core.databinding, 33 | org.eclipse.core.runtime;version="[3.4.0,4.0.0)", 34 | org.eclipse.ui.forms.editor, 35 | org.osgi.framework;version="[1.8.0,2.0.0)" 36 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8 37 | Bundle-ActivationPolicy: lazy 38 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Данный плагин добавляет возможность переходить по тектовым ссылкам из буфера обмена к строкам модулей EDT. Такие ссылки содержатся в описании ошибок 1С (например {ОбщаяФорма.ФормаУпр.Форма(6)}: Ошибка при вызове метода контекста (Записать)). Команда "Переход из буфера обмена ALT+SHIFT+G" добавляется в подменю "Навигация" главного меню. 2 | 3 | # Установка 4 | Распаковать архив в подкаталог "plugins" внутри каталога установки EDT. Например C:\Program Files\1C\1CE\components\1c-edt-1.15.0+306-x86_64\plugins 5 | 6 | Минимальная версия EDT: 1.10.0 7 | 8 | # Для разработки плагина необходимо, чтобы были установлены: 9 | 1. 1C:Enterprise Development Tools версии 1.10.0. (https://releases.1c.ru/version_files?nick=DevelopmentTools10&ver=1.10.0.1603) 10 | 2. Eclipse Oxygen (4.7.3) for RCP and RAP Developers (http://www.eclipse.org/downloads/packages/release/oxygen/3/eclipse-rcp-and-rap-developers) 11 | 3. Java SE Development Kit 8u181 (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) 12 | 13 | # Запуск Eclipse для разработки плагина 14 | Запускаем Eclipse RCP на чистой рабочей области (workspace) 15 | ## Импортируем проект 16 | Импортировать проект можно любым удобным способом. Или, например: 17 | 1. File -> Import -> Projects from Git 18 | 2. В появившемся диалоге выбираем Clone URI, в поле URI вставляем адрес репозитория, далее следуем простым инструкциям помощника импорта проекта. 19 | 20 | ## Настраиваем Target Platform 21 | После импорта проекта необходимо настроить целевую платформу. Для этого при открытии файла target/default.target нужно ввести в появившемся окне логин и пароль от "https://partners.v8.1c.ru/". После дожидаемся установки всех компонент и устанавливаем данную целевую платформу, ПКМ на target/default.target -> Open with -> Target Editor -> Set as target platform. 22 | 23 | ## Запуск 24 | ПКМ на проекте ru.tormozit.dt.codelinkopener.plugin.ui -> Run as -> Eclipse application. 25 | После чего запустится 1C:Enterprise Development Tools с разработанным плагином. 26 | 27 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/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 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/src/ru/tormozit/dt/codelinkopener/plugin/ui/Activator.java: -------------------------------------------------------------------------------- 1 | package ru.tormozit.dt.codelinkopener.plugin.ui; 2 | 3 | import org.eclipse.core.runtime.IStatus; 4 | import org.eclipse.core.runtime.Plugin; 5 | import org.eclipse.core.runtime.Status; 6 | import org.osgi.framework.BundleContext; 7 | 8 | //import com._1c.g5.wiring.InjectorAwareServiceRegistrator; 9 | import com.google.inject.Guice; 10 | import com.google.inject.Injector; 11 | 12 | /** 13 | * Данный класс представляет собой начальную точку в работе плагина. В нем следует реализовывать логику создания плагина, 14 | * а так же необходимые действия при завершении работы плагина.
15 | * 16 | * Так же данный класс содержит в себе ряд методов для удобного логирования ошибок 17 | */ 18 | public class Activator 19 | extends Plugin 20 | { 21 | public static final String PLUGIN_ID = "ru.tormozit.dt.codelinkopener.plugin.ui"; //$NON-NLS-1$ 22 | private static Activator plugin; 23 | 24 | private BundleContext bundleContext; 25 | 26 | /** 27 | * Получить экземпляр плагина. Через экземпляр плагина можно получать доступ к разнообразным механизмам Eclipse, таким как: 28 | *
    29 | *
  • Журнал логирования ошибок плагина
  • 30 | *
  • Механизм настройки свойств плагина
  • 31 | *
  • Механизм дескрипторов
  • 32 | *
33 | * 34 | * @return экземпляр плагина, никогда не должен возвращать null 35 | */ 36 | public static Activator getDefault() 37 | { 38 | return plugin; 39 | } 40 | 41 | /** 42 | * Запись статуса события в лог журнал плагина. 43 | * 44 | * @param status статус события для логирования, не может быть null. 45 | * Данный статус содержит в себе информацию о произошедшем событии (ошибка выполнения, разнообразные предупреждения), которые были зафиксированы в логике работы плагина. 46 | */ 47 | public static void log(IStatus status) 48 | { 49 | plugin.getLog().log(status); 50 | } 51 | 52 | /** 53 | * Запись исключения в лог журнал плагина 54 | * 55 | * @param throwable выкинутое исключение, не может быть null 56 | */ 57 | public static void logError(Throwable throwable) 58 | { 59 | log(createErrorStatus(throwable.getMessage(), throwable)); 60 | } 61 | 62 | /** 63 | * Создание записи с описанием ошибки в лог журнале плагина по выкинотому исключению и сообщению, его описывающим 64 | * 65 | * @param message описание выкинутого исключения, не может быть null 66 | * @param throwable выкинутое исключение, может быть null 67 | * @return созданное статус событие, не может быть null 68 | */ 69 | public static IStatus createErrorStatus(String message, Throwable throwable) 70 | { 71 | return new Status(IStatus.ERROR, PLUGIN_ID, 0, message, throwable); 72 | } 73 | 74 | /** 75 | * Создание записи с описанием предупреждения в лог журнале плагина 76 | * 77 | * @param message описание предупреждения, не может быть null 78 | * @return созданное статус событие, не может быть null 79 | */ 80 | public static IStatus createWarningStatus(String message) 81 | { 82 | return new Status(IStatus.WARNING, PLUGIN_ID, 0, message, null); 83 | } 84 | 85 | /** 86 | * Создание записи с описанием предупреждения в лог журнале плагина по выкинотому исключению и сообщению, его описывающим 87 | * 88 | * @param message описание выкинутого исключения, не может быть null 89 | * @param throwable выкинутое исключение, может быть null 90 | * @return созданное статус событие, не может быть null 91 | */ 92 | public static IStatus createWarningStatus(final String message, 93 | Exception throwable) 94 | { 95 | return new Status(IStatus.WARNING, PLUGIN_ID, 0, message, throwable); 96 | } 97 | 98 | /** 99 | * Данный метод является начальной точкой работы плагина 100 | * 101 | * @param bundleContext объект, создаваемый OSGi Framework, для доступа к разнообразным сервисам, например, по работе с файловыми ресурсами внутри проекта 102 | */ 103 | @Override 104 | public void start(BundleContext bundleContext) throws Exception 105 | { 106 | plugin = this; 107 | super.start(bundleContext); 108 | this.bundleContext = bundleContext; 109 | // registrator = new InjectorAwareServiceRegistrator(bundleContext, this::getInjector); 110 | // ServiceInitialization.schedule(() -> registrator.activateManagedService(CodeLinkOpenerManager.class)); 111 | } 112 | 113 | /** 114 | * Данный метод вызывается при завершении работы плагина 115 | * 116 | * @param bundleContext объект, создаваемый OSGi Framework, для доступа к разнообразным сервисам, например, по работе с файловыми ресурсами внутри проекта 117 | */ 118 | @Override 119 | public void stop(BundleContext bundleContext) throws Exception 120 | { 121 | // registrator.deactivateManagedServices(this); 122 | super.stop(bundleContext); 123 | plugin = null; 124 | } 125 | 126 | /** 127 | * Получить объект, создаваемый OSGi Framework, для доступа к разнообразным сервисам, например, по работе с файловыми ресурсами внутри проекта 128 | * 129 | * @return объект, создаваемый OSGi Framework, для доступа к разнообразным сервисам, например, по работе с файловыми ресурсами внутри проекта 130 | */ 131 | protected BundleContext getContext() 132 | { 133 | return bundleContext; 134 | } 135 | 136 | // private InjectorAwareServiceRegistrator registrator; 137 | 138 | private Injector injector; 139 | 140 | public synchronized Injector getInjector() { 141 | if (injector == null) 142 | injector = createInjector(); 143 | 144 | return injector; 145 | } 146 | 147 | private Injector createInjector() { 148 | // try { 149 | return Guice.createInjector(new ExternalDependenciesModule(this)); 150 | 151 | // } catch (Exception e) { 152 | // String msg = MessageFormat.format(Messages.UnitLauncherPlugin_Failed_to_create_injector_for_0, 153 | // getBundle().getSymbolicName()); 154 | // log(createErrorStatus(msg, e)); 155 | // return null; 156 | // 157 | // } 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /target/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 | -------------------------------------------------------------------------------- /ru.tormozit.dt.codelinkopener.plugin.ui/src/ru/tormozit/dt/codelinkopener/plugin/ui/OpenerHandlerDialog.java: -------------------------------------------------------------------------------- 1 | package ru.tormozit.dt.codelinkopener.plugin.ui; 2 | 3 | import java.util.HashMap; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | import java.util.Map; 7 | import java.util.regex.Matcher; 8 | import java.util.regex.Pattern; 9 | 10 | import org.eclipse.core.resources.IProject; 11 | import org.eclipse.core.resources.IResource; 12 | import org.eclipse.emf.ecore.EClass; 13 | import org.eclipse.emf.ecore.EStructuralFeature; 14 | import org.eclipse.jface.dialogs.TitleAreaDialog; 15 | import org.eclipse.jface.text.BadLocationException; 16 | import org.eclipse.swt.SWT; 17 | import org.eclipse.swt.custom.StyleRange; 18 | import org.eclipse.swt.custom.StyledText; 19 | import org.eclipse.swt.dnd.Clipboard; 20 | import org.eclipse.swt.dnd.TextTransfer; 21 | import org.eclipse.swt.graphics.Point; 22 | import org.eclipse.swt.layout.GridData; 23 | import org.eclipse.swt.layout.GridLayout; 24 | import org.eclipse.swt.widgets.Composite; 25 | import org.eclipse.swt.widgets.Control; 26 | import org.eclipse.swt.widgets.Group; 27 | import org.eclipse.swt.widgets.Shell; 28 | import org.eclipse.ui.IEditorPart; 29 | import org.eclipse.ui.IWorkbenchPage; 30 | import org.eclipse.ui.IWorkbenchWindow; 31 | import org.eclipse.ui.PlatformUI; 32 | import org.eclipse.xtext.naming.QualifiedName; 33 | import org.eclipse.xtext.resource.IEObjectDescription; 34 | import org.eclipse.xtext.ui.editor.XtextEditor; 35 | import org.eclipse.xtext.ui.editor.model.IXtextDocument; 36 | import org.eclipse.jface.text.TextViewer; 37 | 38 | import com.google.common.collect.Lists; 39 | 40 | import com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage; 41 | import com._1c.g5.v8.dt.metadata.mdclass.MdObject; 42 | import com._1c.g5.v8.dt.ui.util.OpenHelper; 43 | import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; 44 | import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexProvider; 45 | import com._1c.g5.v8.dt.bsl.ui.menu.BslHandlerUtil; 46 | import com._1c.g5.v8.dt.core.platform.IResourceLookup; 47 | import com._1c.g5.v8.dt.core.platform.IV8Project; 48 | import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; 49 | import com._1c.g5.v8.dt.form.ui.editor.FormEditor; 50 | 51 | public class OpenerHandlerDialog extends TitleAreaDialog { 52 | static private Map typeMap1C = new HashMap(); 53 | private IBmEmfIndexManager bmEmfIndexManager; 54 | private IResourceLookup resourceLookup; 55 | private IV8ProjectManager projectManager; 56 | 57 | public OpenerHandlerDialog(Shell parentShell, IBmEmfIndexManager bmEmfIndexManager, IResourceLookup resourceLookup, IV8ProjectManager projectManager) { 58 | super(parentShell); 59 | this.bmEmfIndexManager = bmEmfIndexManager; 60 | this.resourceLookup = resourceLookup; 61 | this.projectManager = projectManager; 62 | typeMap1C.put("HTTPСервис", "HTTPService"); 63 | typeMap1C.put("WebСервис", "WebService"); 64 | typeMap1C.put("ВнешнийИсточникДанных", "ExternalDataSource"); 65 | typeMap1C.put("Документ", "Document"); 66 | typeMap1C.put("Задача", "Task"); 67 | typeMap1C.put("Команда", "Command"); 68 | typeMap1C.put("Константа", "Constant"); 69 | typeMap1C.put("Конфигурация", "Configuration"); // 70 | typeMap1C.put("МодульУправляемогоПриложения", "ManagedApplicationModule"); 71 | typeMap1C.put("МодульОбычногоПриложения", "OrdinaryApplicationModule"); 72 | typeMap1C.put("МодульВнешнегоСоединения", "ExternalConnectionModule"); 73 | typeMap1C.put("МодульОбъекта", "ObjectModule"); 74 | typeMap1C.put("МодульНабораЗаписей", "RecordsetModule"); 75 | typeMap1C.put("МодульМенеджера", "ManagerModule"); 76 | typeMap1C.put("МодульМенеджераЗначения", "ValueManagerModule"); 77 | typeMap1C.put("МодульКоманды", "CommandModule"); 78 | typeMap1C.put("МодульСеанса", "SessionModule"); 79 | typeMap1C.put("Модуль", "Module"); 80 | typeMap1C.put("ОбщаяКоманда", "CommonCommand"); 81 | typeMap1C.put("ОбщийМодуль", "CommonModule"); 82 | typeMap1C.put("ОбщаяФорма", "CommonForm"); 83 | typeMap1C.put("Обработка", "DataProcessor"); 84 | typeMap1C.put("Отчет", "Report"); 85 | typeMap1C.put("Перечисление", "Enum"); 86 | typeMap1C.put("ПланВидовРасчета", "ChartOfCalculationTypes"); 87 | typeMap1C.put("ПланВидовХарактеристик", "ChartOfCharacteristicTypes"); 88 | typeMap1C.put("ПланОбмена", "ExchangePlan"); 89 | typeMap1C.put("РегистрБухгалтерии", "AccountingRegister"); 90 | typeMap1C.put("РегистрНакопления", "AccumulationRegister"); 91 | typeMap1C.put("РегистрРасчета", "CalculationRegister"); 92 | typeMap1C.put("РегистрСведений", "InformationRegister"); 93 | typeMap1C.put("Форма", "Form"); 94 | typeMap1C.put("Справочник", "Catalog"); 95 | } 96 | 97 | private static EClass getMdLiteral(String mdClassName, Boolean isExternalDataSource, Boolean isForm, Boolean isCommand) { 98 | EClass mdLiteral = MdClassPackage.Literals.CONFIGURATION; 99 | if (mdClassName.equals("Подсистема")) 100 | mdLiteral = MdClassPackage.Literals.SUBSYSTEM; 101 | else if (mdClassName.equals("Конфигурация")) 102 | mdLiteral = MdClassPackage.Literals.CONFIGURATION; 103 | else if (mdClassName.equals("HTTPСервис")) 104 | mdLiteral = MdClassPackage.Literals.HTTP_SERVICE; 105 | else if (mdClassName.equals("WebСервис")) 106 | mdLiteral = MdClassPackage.Literals.WEB_SERVICE; 107 | else if (mdClassName.equals("ВнешнийИсточникДанных")) 108 | mdLiteral = MdClassPackage.Literals.EXTERNAL_DATA_SOURCE; 109 | else if (mdClassName.equals("Документ")) 110 | if (isForm) 111 | mdLiteral = MdClassPackage.Literals.DOCUMENT_FORM; 112 | else if (isCommand) 113 | mdLiteral = MdClassPackage.Literals.DOCUMENT_COMMAND; 114 | else 115 | mdLiteral = MdClassPackage.Literals.DOCUMENT; 116 | else if (mdClassName.equals("Задача")) 117 | if (isForm) 118 | mdLiteral = MdClassPackage.Literals.TASK_FORM; 119 | else if (isCommand) 120 | mdLiteral = MdClassPackage.Literals.TASK_COMMAND; 121 | else 122 | mdLiteral = MdClassPackage.Literals.TASK; 123 | else if (mdClassName.equals("ОбщаяКоманда")) 124 | mdLiteral = MdClassPackage.Literals.COMMON_COMMAND; 125 | else if (mdClassName.equals("ОбщийМодуль")) 126 | mdLiteral = MdClassPackage.Literals.COMMON_MODULE; 127 | else if (mdClassName.equals("ОбщаяФорма")) 128 | mdLiteral = MdClassPackage.Literals.COMMON_FORM; 129 | else if (mdClassName.equals("Обработка")) 130 | if (isForm) 131 | mdLiteral = MdClassPackage.Literals.DATA_PROCESSOR_FORM; 132 | else if (isCommand) 133 | mdLiteral = MdClassPackage.Literals.DATA_PROCESSOR_COMMAND; 134 | else 135 | mdLiteral = MdClassPackage.Literals.DATA_PROCESSOR; 136 | else if (mdClassName.equals("Отчет")) 137 | if (isForm) 138 | mdLiteral = MdClassPackage.Literals.REPORT_FORM; 139 | else if (isCommand) 140 | mdLiteral = MdClassPackage.Literals.REPORT_COMMAND; 141 | else 142 | mdLiteral = MdClassPackage.Literals.REPORT; 143 | else if (mdClassName.equals("Перечисление")) 144 | if (isForm) 145 | mdLiteral = MdClassPackage.Literals.ENUM_FORM; 146 | else if (isCommand) 147 | mdLiteral = MdClassPackage.Literals.ENUM_COMMAND; 148 | else 149 | mdLiteral = MdClassPackage.Literals.ENUM; 150 | else if (mdClassName.equals("ПланВидовХарактеристик")) 151 | if (isForm) 152 | mdLiteral = MdClassPackage.Literals.CHART_OF_CHARACTERISTIC_TYPES_FORM; 153 | else if (isCommand) 154 | mdLiteral = MdClassPackage.Literals.CHART_OF_CHARACTERISTIC_TYPES_COMMAND; 155 | else 156 | mdLiteral = MdClassPackage.Literals.CHART_OF_CHARACTERISTIC_TYPES; 157 | else if (mdClassName.equals("ПланВидовРасчета")) 158 | if (isForm) 159 | mdLiteral = MdClassPackage.Literals.CHART_OF_CALCULATION_TYPES_FORM; 160 | else if (isCommand) 161 | mdLiteral = MdClassPackage.Literals.CHART_OF_CALCULATION_TYPES_COMMAND; 162 | else 163 | mdLiteral = MdClassPackage.Literals.CHART_OF_CALCULATION_TYPES; 164 | else if (mdClassName.equals("ПланОбмена")) 165 | if (isForm) 166 | mdLiteral = MdClassPackage.Literals.EXCHANGE_PLAN_FORM; 167 | else if (isCommand) 168 | mdLiteral = MdClassPackage.Literals.EXCHANGE_PLAN_COMMAND; 169 | else 170 | mdLiteral = MdClassPackage.Literals.EXCHANGE_PLAN; 171 | else if (mdClassName.equals("РегистрБухгалтерии")) 172 | if (isForm) 173 | mdLiteral = MdClassPackage.Literals.ACCOUNTING_REGISTER_FORM; 174 | else if (isCommand) 175 | mdLiteral = MdClassPackage.Literals.ACCOUNTING_REGISTER_COMMAND; 176 | else 177 | mdLiteral = MdClassPackage.Literals.ACCOUNTING_REGISTER; 178 | else if (mdClassName.equals("РегистрНакопления")) 179 | if (isForm) 180 | mdLiteral = MdClassPackage.Literals.ACCUMULATION_REGISTER_FORM; 181 | else if (isCommand) 182 | mdLiteral = MdClassPackage.Literals.ACCUMULATION_REGISTER_COMMAND; 183 | else 184 | mdLiteral = MdClassPackage.Literals.ACCUMULATION_REGISTER; 185 | else if (mdClassName.equals("РегистрРасчета")) 186 | if (isForm) 187 | mdLiteral = MdClassPackage.Literals.CALCULATION_REGISTER_FORM; 188 | else if (isCommand) 189 | mdLiteral = MdClassPackage.Literals.CALCULATION_REGISTER_COMMAND; 190 | else 191 | mdLiteral = MdClassPackage.Literals.CALCULATION_REGISTER; 192 | else if (mdClassName.equals("РегистрСведений")) 193 | if (isForm) 194 | mdLiteral = MdClassPackage.Literals.INFORMATION_REGISTER_FORM; 195 | else if (isCommand) 196 | mdLiteral = MdClassPackage.Literals.INFORMATION_REGISTER_COMMAND; 197 | else 198 | mdLiteral = MdClassPackage.Literals.INFORMATION_REGISTER; 199 | else if (mdClassName.equals("Справочник")) 200 | if (isForm) 201 | mdLiteral = MdClassPackage.Literals.CATALOG_FORM; 202 | else if (isCommand) 203 | mdLiteral = MdClassPackage.Literals.CATALOG_COMMAND; 204 | else 205 | mdLiteral = MdClassPackage.Literals.CATALOG; 206 | else if (mdClassName.equals("Константа")) 207 | mdLiteral = MdClassPackage.Literals.CONSTANT; 208 | return mdLiteral; 209 | } 210 | 211 | @Override 212 | protected void okPressed() { 213 | super.okPressed(); 214 | } 215 | 216 | @Override 217 | protected Control createDialogArea(Composite parent) { 218 | setTitle(Messages.DataProcessingHandlerDialog_dialog_title); 219 | setMessage(Messages.DataProcessingHandlerDialog_dialog_message); 220 | getShell().setText(Messages.DataProcessingHandlerDialog_dialog_text); 221 | Composite control = (Composite) super.createDialogArea(parent); 222 | 223 | Clipboard clipboard = new Clipboard(null); 224 | TextTransfer textTransfer = TextTransfer.getInstance(); 225 | String textData = (String) clipboard.getContents(textTransfer); 226 | clipboard.dispose(); 227 | if (textData == null || textData.isEmpty()) 228 | return control; 229 | 230 | control.setLayout(new GridLayout()); 231 | Group group = new Group(control, SWT.SHADOW_ETCHED_IN); 232 | group.setLayout(new GridLayout()); 233 | group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); 234 | TextViewer viewer = new TextViewer(group, SWT.V_SCROLL | SWT.H_SCROLL | SWT.WRAP | SWT.READ_ONLY); 235 | viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); 236 | 237 | StyledText styledText = viewer.getTextWidget(); 238 | styledText.setText(textData); 239 | 240 | String letter = "a-zа-яёA-ZА-ЯЁ0-9_"; 241 | Pattern regexp = Pattern.compile("(\\{([" + letter + "]+ )?((?:[" + letter 242 | + "]+\\.)*(?:Форма|Модуль|МодульУправляемогоПриложения|МодульОбычногоПриложения|МодульСеанса|МодульВнешнегоСоединения|МодульКоманды|МодульМенеджера|МодульМенеджераЗначения|МодульОбъекта|МодульНабораЗаписей))\\((\\d+)(?:,(\\d+))?\\)\\})", 243 | Pattern.MULTILINE | Pattern.CASE_INSENSITIVE); 244 | Matcher m = regexp.matcher(textData); 245 | while (m.find()) { 246 | List list = Lists.newArrayList(); 247 | list.add(m.group(2)); 248 | list.add(m.group(3)); 249 | list.add(m.group(4)); 250 | list.add(m.group(5)); 251 | StyleRange styleRange = new StyleRange(); 252 | styleRange.start = m.start(); 253 | styleRange.length = m.end() - m.start(); 254 | styleRange.underline = true; 255 | styleRange.data = list; 256 | styleRange.underlineStyle = SWT.UNDERLINE_LINK; 257 | styledText.setStyleRange(styleRange); 258 | } 259 | 260 | styledText.addListener(SWT.MouseDown, event -> { 261 | // In this snippet links are activated on mouse down when the control key is 262 | // held down 263 | if ((event.stateMask & SWT.MOD1) != 0) { 264 | int offset = styledText.getOffsetAtLocation(new Point(event.x, event.y)); 265 | if (offset != -1) { 266 | StyleRange style1 = null; 267 | try { 268 | style1 = styledText.getStyleRangeAtOffset(offset); 269 | } catch (IllegalArgumentException e) { 270 | // no character under event.x, event.y 271 | } 272 | if (style1 != null && style1.underline && style1.underlineStyle == SWT.UNDERLINE_LINK) { 273 | List list = (List) style1.data; 274 | openLink(list); 275 | } 276 | } 277 | } 278 | }); 279 | return control; 280 | } 281 | public void openLink(List list) { 282 | String extensionName = list.get(0); 283 | String rusModuleName = list.get(1); 284 | String[] fragments = rusModuleName.split("\\."); 285 | String engModuleName = ""; 286 | String mdClassName = ""; 287 | Boolean isForm = false; 288 | Boolean isCommand = false; 289 | Boolean isExternalDataSource = false; 290 | if (fragments.length == 1) { 291 | mdClassName = "Конфигурация"; 292 | engModuleName = typeMap1C.get(mdClassName); 293 | } else { 294 | for (int counter = 0; counter < fragments.length / 2; counter++) { 295 | String rusName = fragments[counter * 2]; 296 | if (typeMap1C.get(rusName) == null) { 297 | // MessageBox.Show(this, "Unknown 1C object type " + rusName, 298 | // Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); 299 | return; 300 | } 301 | if (rusName.equals("Форма")) 302 | isForm = true; 303 | else if (rusName.equals("Команда")) 304 | isCommand = true; 305 | else if (rusName.equals("ВнешнийИсточникДанных")) 306 | isExternalDataSource = true; 307 | else { 308 | if (rusName.equals("ОбщаяФорма")) 309 | isForm = true; 310 | mdClassName = rusName; 311 | } 312 | String engName = typeMap1C.get(rusName); 313 | if (!engModuleName.isEmpty()) 314 | engModuleName += "."; 315 | engModuleName += engName; 316 | engModuleName += "."; 317 | engModuleName += fragments[counter * 2 + 1]; 318 | } 319 | } 320 | EClass mdLiteral = getMdLiteral(mdClassName, isExternalDataSource, isForm, isCommand); 321 | MdObject mdObject = (MdObject) getConfigurationObject(mdLiteral, engModuleName, bmEmfIndexManager, projectManager); 322 | if (mdObject == null) 323 | return; 324 | String modulePropertyName = typeMap1C.get(fragments[fragments.length - 1]); 325 | modulePropertyName = Character.toString(modulePropertyName.charAt(0)).toLowerCase() + modulePropertyName.substring(1); // Convert first letter to lower case 326 | EStructuralFeature moduleProperty = mdObject.eClass().getEStructuralFeature(modulePropertyName); 327 | close(); 328 | int lineNumber = Integer.parseInt(list.get(2)) - 1; 329 | OpenHelper openHelper = new OpenHelper(); 330 | IEditorPart editorPart = openHelper.openEditor(mdObject, moduleProperty); 331 | if (isForm) { 332 | FormEditor formEditor = (FormEditor) editorPart; 333 | formEditor.setActivePage("editors.form.pages.module"); 334 | } 335 | XtextEditor target = BslHandlerUtil.extractXtextEditor(editorPart); 336 | IXtextDocument document = target.getDocument(); 337 | int offset; 338 | try { 339 | offset = document.getLineOffset(lineNumber); 340 | } catch (BadLocationException e) { 341 | return; 342 | } 343 | target.selectAndReveal(offset, 0); 344 | } 345 | 346 | private static MdObject getConfigurationObject(EClass mdLiteral, String engModuleName, IBmEmfIndexManager bmEmfIndexManager, IV8ProjectManager projectManager) { 347 | IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); 348 | IWorkbenchPage activePage = window.getActivePage(); 349 | IEditorPart activeEditor = activePage.getActiveEditor(); 350 | IProject project = null; 351 | if (activeEditor != null) { 352 | project = activeEditor.getEditorInput().getAdapter(IProject.class); 353 | if (project == null) { 354 | IResource resource = activeEditor.getEditorInput().getAdapter(IResource.class); 355 | if (resource != null) { 356 | project = resource.getProject(); 357 | } 358 | } 359 | } 360 | else { 361 | project = activePage.getInput().getAdapter(IProject.class); 362 | if (project == null) { 363 | IResource resource = activePage.getInput().getAdapter(IResource.class); 364 | if (resource != null) { 365 | project = resource.getProject(); 366 | } 367 | } 368 | } 369 | IV8Project v8Project; 370 | if (project == null) { 371 | v8Project = projectManager.getProjects().iterator().next(); 372 | } 373 | else { 374 | v8Project = projectManager.getProject(project); 375 | } 376 | if (v8Project == null) 377 | return null; 378 | IBmEmfIndexProvider bmEmfIndexProvider = bmEmfIndexManager.getEmfIndexProvider(v8Project.getProject()); 379 | QualifiedName qnObjectName = getConfigurationObjectQualifiedName(engModuleName); 380 | MdObject object = null; 381 | Iterable objectIndex = bmEmfIndexProvider.getEObjectIndexByType(mdLiteral, qnObjectName, true); 382 | Iterator objectItr = objectIndex.iterator(); 383 | if (objectItr.hasNext()) 384 | object = (MdObject) objectItr.next().getEObjectOrProxy(); 385 | else // for debug 386 | { 387 | // Iterable objectIndex1 = bmEmfIndexProvider.getEObjectIndexByType(mdLiteral); 388 | // Iterator objectItr1 = objectIndex.iterator(); 389 | // if (objectItr1.hasNext()) 390 | // object = (MdObject) objectItr1.next().getEObjectOrProxy(); 391 | } 392 | return object; 393 | } 394 | 395 | private static QualifiedName getConfigurationObjectQualifiedName(String engModuleName) { 396 | String[] objectArray = engModuleName.split("[.]"); 397 | QualifiedName qnObjectName = null; 398 | for (String objectValue : objectArray) { 399 | if (qnObjectName == null) 400 | qnObjectName = QualifiedName.create(objectValue); 401 | else 402 | qnObjectName = qnObjectName.append(QualifiedName.create(objectValue)); 403 | } 404 | return qnObjectName; 405 | } 406 | } 407 | --------------------------------------------------------------------------------