1
0
mirror of https://github.com/1C-Company/v8-code-style.git synced 2024-11-24 16:53:51 +02:00

#808 Перенос панели "Bsl documentation comment" (#810)

This commit is contained in:
Dmitriy Marmyshev 2021-10-01 13:44:44 +03:00 committed by GitHub
parent 78be977f44
commit f879f7bdf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 1693 additions and 0 deletions

View File

@ -10,6 +10,7 @@
- Автосортировка метаданных, сортировка объектов верхнего уровня по умолчанию, для подчиненных настраивается
- Выбор подходящего тип общего модуля из списка при создании нового
- Панель "Bsl Документирующий комментарий"
### Новые проверки

View File

@ -15,6 +15,7 @@
- Дополнительные инструменты, улучшающие и ускоряющие работу по стандартам 1С
- [Авто-сортировка метаданных](docs/tools/autosort.md)
- [Создание общих модулей по типам](docs/tools/common-module-types.md)
- [Панель "Bsl Документирующий комментарий"](docs/tools/bsl-doc-comment-view.md)

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.e1c.v8codestyle.bsl.ui</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -0,0 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11

View File

@ -0,0 +1,28 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: com.e1c.v8codestyle.bsl.ui;singleton:=true
Bundle-Version: 0.1.0.qualifier
Bundle-Activator: com.e1c.v8codestyle.internal.bsl.ui.UiPlugin
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.ui;bundle-version="[3.119.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.20.0,4.0.0)",
org.eclipse.emf.ecore;bundle-version="[2.23.0,3.0.0)",
org.eclipse.core.resources;bundle-version="[3.14.0,4.0.0)",
org.eclipse.ui.forms;bundle-version="[3.11.100,4.0.0)",
org.eclipse.emf.databinding;bundle-version="[1.5.0,2.0.0)",
org.eclipse.xtext;bundle-version="[2.24.0,3.0.0)",
org.eclipse.xtext.ui;bundle-version="[2.24.0,3.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-11
Automatic-Module-Name: com.e1c.v8codestyle.bsl.ui
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Import-Package: com._1c.g5.v8.dt.bsl.comment;version="[3.0.0,4.0.0)",
com._1c.g5.v8.dt.bsl.common;version="[6.0.0,7.0.0)",
com._1c.g5.v8.dt.bsl.documentation.comment;version="[3.0.0,4.0.0)",
com._1c.g5.v8.dt.bsl.model;version="[4.0.0,5.0.0)",
com._1c.g5.v8.dt.common;version="[6.0.0,7.0.0)",
com._1c.g5.v8.dt.core.platform;version="[10.0.0,11.0.0)",
com._1c.g5.v8.dt.mcore;version="[6.0.0,7.0.0)",
com._1c.g5.wiring;version="[2.2.0,3.0.0)",
com._1c.g5.wiring.binder;version="[1.1.0,2.0.0)"

View File

@ -0,0 +1,20 @@
###############################################################################
# Copyright (C) 2021, 1C-Soft LLC and others.
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# 1C-Soft LLC - initial API and implementation
###############################################################################
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
icons/,\
plugin.properties,\
plugin_ru.properties

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

View File

@ -0,0 +1,21 @@
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
###############################################################################
# Copyright (C) 2021, 1C-Soft LLC and others.
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# 1C-Soft LLC - initial API and implementation
###############################################################################
#Properties file for com.e1c.v8codestyle.bsl.ui
pluginName = 1C:Code style V8 Bsl UI plugin
providerName = 1C-Soft LLC
views.BslDocCommentView.name = Bsl Documentation Comment
views.category.name = 1C:Code style V8

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<!--
Copyright (C) 2021, 1C-Soft LLC and others.
This program and the accompanying materials are made
available under the terms of the Eclipse Public License 2.0
which is available at https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
Contributors:
1C-Soft LLC - initial API and implementation
-->
<plugin>
<extension
point="org.eclipse.ui.views">
<category
id="com.e1c.v8codestyle.bsl.ui"
name="%views.category.name">
</category>
<view
category="com.e1c.v8codestyle.bsl.ui"
class="com.e1c.v8codestyle.internal.bsl.ui.views.BslDocCommentView"
icon="icons/sample.png"
id="com.e1c.v8codestyle.bsl.ui.views.BslDocCommentView"
inject="true"
name="%views.BslDocCommentView.name">
</view>
</extension>
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="com._1c.g5.v8.dt.ui2.perspective">
<view
id="com.e1c.v8codestyle.bsl.ui.views.BslDocCommentView"
ratio="0.5"
relationship="stack"
relative="org.eclipse.ui.views.PropertySheet"
visible="true">
</view>
</perspectiveExtension>
</extension>
</plugin>

View File

@ -0,0 +1,20 @@
###############################################################################
# Copyright (C) 2021, 1C-Soft LLC and others.
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# 1C-Soft LLC - initial API and implementation
###############################################################################
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
pluginName = 1С:Стандарты разработки V8 UI плагин Встроенного языка
providerName = ООО "1С-Софт"
views.BslDocCommentView.name = Bsl Документирующий комментарий
views.category.name = 1С:Стандарты разработки V8

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2021, 1C-Soft LLC and others.
This program and the accompanying materials are made
available under the terms of the Eclipse Public License 2.0
which is available at https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
Contributors:
1C-Soft LLC - initial API and implementation
-->
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.e1c.v8codestyle</groupId>
<artifactId>bundles</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>com.e1c.v8codestyle.bsl.ui</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>

View File

@ -0,0 +1,42 @@
/*******************************************************************************
* Copyright (C) 2021, 1C-Soft LLC and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* 1C-Soft LLC - initial API and implementation
*******************************************************************************/
package com.e1c.v8codestyle.internal.bsl.ui;
import org.osgi.framework.Bundle;
import com._1c.g5.wiring.AbstractGuiceAwareExecutableExtensionFactory;
import com.google.inject.Injector;
/**
* Guice module aware executable extension factory for plugin.
*
* @author Dmitriy Marmyshev
*
*/
public class ExecutableExtensionFactory
extends AbstractGuiceAwareExecutableExtensionFactory
{
@Override
protected Bundle getBundle()
{
return UiPlugin.getDefault().getBundle();
}
@Override
protected Injector getInjector()
{
return UiPlugin.getDefault().getInjector();
}
}

View File

@ -0,0 +1,43 @@
/*******************************************************************************
* Copyright (C) 2021, 1C-Soft LLC and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* 1C-Soft LLC - initial API and implementation
*******************************************************************************/
package com.e1c.v8codestyle.internal.bsl.ui;
import org.eclipse.core.runtime.Plugin;
import com._1c.g5.v8.dt.bsl.common.IBslPreferences;
import com._1c.g5.v8.dt.core.platform.IResourceLookup;
import com._1c.g5.wiring.AbstractServiceAwareModule;
/**
* The external dependencies for plugin
*
* @author Dmitriy Marmyshev
*
*/
class ExternalDependenciesModule
extends AbstractServiceAwareModule
{
ExternalDependenciesModule(Plugin plugin)
{
super(plugin);
}
@Override
protected void doConfigure()
{
bind(IResourceLookup.class).toService();
bind(IBslPreferences.class).toService();
}
}

View File

@ -0,0 +1,60 @@
/*******************************************************************************
* Copyright (C) 2021, 1C-Soft LLC and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* 1C-Soft LLC - initial API and implementation
*******************************************************************************/
package com.e1c.v8codestyle.internal.bsl.ui;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
/**
* The common constants for plug-in images.
*
* @author Dmitriy Marmyshev
*/
public final class SharedImages
{
private static final String T_OBJ16 = "/obj16/"; //$NON-NLS-1$
public static final String IMG_OBJ16_FIELD = UiPlugin.PLUGIN_ID + T_OBJ16 + "attribute.png"; //$NON-NLS-1$
public static final String IMG_OBJ16_LINK = UiPlugin.PLUGIN_ID + T_OBJ16 + "link.png"; //$NON-NLS-1$
public static final String IMG_OBJ16_TEXT = UiPlugin.PLUGIN_ID + T_OBJ16 + "text.png"; //$NON-NLS-1$
public static final String IMG_OBJ16_TYPE = UiPlugin.PLUGIN_ID + T_OBJ16 + "type.png"; //$NON-NLS-1$
public static final String IMG_OBJ16_DESCRIPTION = UiPlugin.PLUGIN_ID + T_OBJ16 + "description.png"; //$NON-NLS-1$
private static final String ICONS_PATH = "/icons"; //$NON-NLS-1$
/**
* Initialize image registry with given instance.
*
* @param reg the registry, cannot be {@code null}.
*/
/* package */ static void initializeImageRegistry(ImageRegistry reg)
{
reg.put(IMG_OBJ16_FIELD, createImageDescriptorFromKey(IMG_OBJ16_FIELD));
reg.put(IMG_OBJ16_LINK, createImageDescriptorFromKey(IMG_OBJ16_LINK));
reg.put(IMG_OBJ16_TEXT, createImageDescriptorFromKey(IMG_OBJ16_TEXT));
reg.put(IMG_OBJ16_TYPE, createImageDescriptorFromKey(IMG_OBJ16_TYPE));
reg.put(IMG_OBJ16_DESCRIPTION, createImageDescriptorFromKey(IMG_OBJ16_DESCRIPTION));
}
private static ImageDescriptor createImageDescriptorFromKey(String key)
{
String path = ICONS_PATH + key.substring(UiPlugin.PLUGIN_ID.length());
return UiPlugin.imageDescriptorFromPlugin(UiPlugin.PLUGIN_ID, path);
}
private SharedImages()
{
throw new IllegalAccessError("Utility class"); //$NON-NLS-1$
}
}

View File

@ -0,0 +1,220 @@
/*******************************************************************************
* Copyright (C) 2021, 1C-Soft LLC and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* 1C-Soft LLC - initial API and implementation
*******************************************************************************/
package com.e1c.v8codestyle.internal.bsl.ui;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import com._1c.g5.v8.dt.bsl.model.BslPackage;
import com.google.inject.Guice;
import com.google.inject.Injector;
/**
* The activator class controls the plug-in life cycle
*
* @author Dmitriy Marmyshev
*/
public class UiPlugin
extends AbstractUIPlugin
implements ISharedImages
{
// The plug-in ID
public static final String PLUGIN_ID = "com.e1c.v8codestyle.bsl.ui"; //$NON-NLS-1$
// The shared instance
private static UiPlugin plugin;
private volatile Injector injector;
private static BundleContext context;
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static UiPlugin getDefault()
{
return plugin;
}
/**
* Writes a status to the plugin log.
*
* @param status status to log, cannot be <code>null</code>
*/
public static void log(IStatus status)
{
plugin.getLog().log(status);
}
/**
* Writes a throwable to the plugin log as error status.
*
* @param throwable throwable, cannot be <code>null</code>
*/
public static void logError(Throwable throwable)
{
log(createErrorStatus(throwable.getMessage(), throwable));
}
/**
* Creates error status by a given message and cause throwable.
*
* @param message status message, cannot be <code>null</code>
* @param throwable throwable, can be <code>null</code> if not applicable
* @return status created error status, never <code>null</code>
*/
public static IStatus createErrorStatus(String message, Throwable throwable)
{
return new Status(IStatus.ERROR, PLUGIN_ID, 0, message, throwable);
}
/**
* Creates warning status by a given message.
*
* @param message status message, cannot be <code>null</code>
* @return status created warning status, never <code>null</code>
*/
public static IStatus createWarningStatus(String message)
{
return new Status(IStatus.WARNING, PLUGIN_ID, 0, message, null);
}
/**
* Creates warning status by a given message and cause throwable.
*
* @param message status message, cannot be <code>null</code>
* @param throwable throwable, can be <code>null</code> if not applicable
* @return status created warning status, never <code>null</code>
*/
public static IStatus createWarningStatus(final String message, Exception throwable)
{
return new Status(IStatus.WARNING, PLUGIN_ID, 0, message, throwable);
}
static BundleContext getContext()
{
return context;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
@Override
public void start(BundleContext bundleContext) throws Exception
{
super.start(bundleContext);
UiPlugin.context = bundleContext;
plugin = this;
BslPackage.eINSTANCE.eClass();
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
@Override
public void stop(BundleContext bundleContext) throws Exception
{
injector = null;
plugin = null;
super.stop(bundleContext);
UiPlugin.context = null;
}
/**
* Returns Guice injector of the plugin
*
* @return Guice injector of the plugin, never <code>null</code> if plugin is started
*/
public Injector getInjector()
{
Injector localInstance = injector;
if (localInstance == null)
{
synchronized (UiPlugin.class)
{
localInstance = injector;
if (localInstance == null)
{
localInstance = createInjector();
injector = localInstance;
}
}
}
return localInstance;
}
private Injector createInjector()
{
try
{
return Guice.createInjector(new ExternalDependenciesModule(this));
}
catch (Exception e)
{
log(createErrorStatus("Failed to create injector for " //$NON-NLS-1$
+ getBundle().getSymbolicName(), e));
throw new RuntimeException("Failed to create injector for " //$NON-NLS-1$
+ getBundle().getSymbolicName(), e);
}
}
@Override
protected void initializeImageRegistry(ImageRegistry reg)
{
super.initializeImageRegistry(reg);
SharedImages.initializeImageRegistry(reg);
}
@Override
public Image getImage(String symbolicName)
{
Image image = getImageRegistry().get(symbolicName);
if (image != null)
{
return image;
}
// if there is a descriptor for it, add the image to the registry.
ImageDescriptor desc = getImageRegistry().getDescriptor(symbolicName);
if (desc != null)
{
getImageRegistry().put(symbolicName, desc);
return getImageRegistry().get(symbolicName);
}
return null;
}
@Override
public ImageDescriptor getImageDescriptor(String symbolicName)
{
return getImageRegistry().getDescriptor(symbolicName);
}
}

View File

@ -0,0 +1,465 @@
/*******************************************************************************
* Copyright (C) 2021, 1C-Soft LLC and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* 1C-Soft LLC - initial API and implementation
*******************************************************************************/
package com.e1c.v8codestyle.internal.bsl.ui.views;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.text.IMarkSelection;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.xtext.nodemodel.INode;
import org.eclipse.xtext.resource.EObjectAtOffsetHelper;
import org.eclipse.xtext.resource.IResourceServiceProvider;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.ui.editor.XtextEditor;
import org.eclipse.xtext.ui.editor.model.IXtextDocument;
import org.eclipse.xtext.util.CancelIndicator;
import org.eclipse.xtext.util.concurrent.CancelableUnitOfWork;
import com._1c.g5.v8.dt.bsl.comment.DocumentationCommentProperties;
import com._1c.g5.v8.dt.bsl.common.IBslPreferences;
import com._1c.g5.v8.dt.bsl.documentation.comment.BslCommentUtils;
import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment;
import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment.Description;
import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment.ParametersSection;
import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment.ReturnSection;
import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment.Section;
import com._1c.g5.v8.dt.bsl.documentation.comment.BslMultiLineCommentDocumentationProvider;
import com._1c.g5.v8.dt.bsl.documentation.comment.LinkPart;
import com._1c.g5.v8.dt.bsl.documentation.comment.TextPart;
import com._1c.g5.v8.dt.bsl.documentation.comment.TypeSection;
import com._1c.g5.v8.dt.bsl.documentation.comment.TypeSection.FieldDefinition;
import com._1c.g5.v8.dt.bsl.documentation.comment.TypeSection.LinkContainsTypeDefinition;
import com._1c.g5.v8.dt.bsl.documentation.comment.TypeSection.TypeDefinition;
import com._1c.g5.v8.dt.bsl.model.Method;
import com._1c.g5.v8.dt.bsl.model.Module;
import com._1c.g5.v8.dt.common.Pair;
import com._1c.g5.v8.dt.core.platform.IResourceLookup;
/**
* The listener interface for receiving {@link ISelection} events.
* The class that is interested in processing a {@link ISelection}
* event implements this interface, and the object created
* with that class is registered with a component using the
* SelectionService <code>addPostSelectionListener</code> method. When
* the ISelection event occurs, that object's appropriate
* method is invoked.
*
* @author Dmitriy Marmyshev
*/
public class BslDocCommentSelectionListener
implements ISelectionListener
{
private final TreeViewer viewer;
private final IResourceLookup resourceLookup;
private final IBslPreferences bslPreferences;
private final BslMultiLineCommentDocumentationProvider commentProvider;
private final EObjectAtOffsetHelper bslObjectAtOffsetHelper;
/**
* Instantiates a new bsl doc comment selection listener.
*
* @param viewer the viewer, cannot be {@code null}.
* @param resourceLookup the resource lookup service, cannot be {@code null}.
* @param bslPreferences the bsl preferences, cannot be {@code null}.
*/
public BslDocCommentSelectionListener(TreeViewer viewer, IResourceLookup resourceLookup,
IBslPreferences bslPreferences)
{
this.viewer = viewer;
this.resourceLookup = resourceLookup;
this.bslPreferences = bslPreferences;
IResourceServiceProvider rsp =
IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(URI.createURI("*.bsl")); //$NON-NLS-1$
this.commentProvider = rsp.get(BslMultiLineCommentDocumentationProvider.class);
this.bslObjectAtOffsetHelper = rsp.get(EObjectAtOffsetHelper.class);
}
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection)
{
BslDocumentationComment doc = null;
if (selection instanceof IStructuredSelection
&& ((IStructuredSelection)selection).getFirstElement() instanceof Method)
{
doc = getDocComment((Method)((IStructuredSelection)selection).getFirstElement());
viewer.setInput(doc);
}
else if (selection instanceof ITextSelection || selection instanceof IMarkSelection)
{
int offset = 0;
if (selection instanceof ITextSelection)
{
ITextSelection ts = (ITextSelection)selection;
offset = ts.getOffset();
}
else if (selection instanceof IMarkSelection)
{
IMarkSelection ts = (IMarkSelection)selection;
offset = ts.getOffset();
}
Pair<BslDocumentationComment, Object> result = getSelectedDocModel(part, offset);
if (result != null)
{
doc = result.first;
}
viewer.setInput(doc);
if (result != null && result.second != null)
{
viewer.setSelection(new StructuredSelection(result.second));
}
else
{
viewer.setSelection(new StructuredSelection());
}
}
}
private Pair<BslDocumentationComment, Object> getSelectedDocModel(IWorkbenchPart part, final int offset)
{
XtextEditor target = part.getAdapter(XtextEditor.class);
if (target == null)
{
return null;
}
IXtextDocument xtextDoc = target.getDocument();
return xtextDoc.readOnly(new CancelableUnitOfWork<Pair<BslDocumentationComment, Object>, XtextResource>()
{
@Override
public Pair<BslDocumentationComment, Object> exec(XtextResource res, CancelIndicator monitor)
throws Exception
{
if (monitor.isCanceled())
{
return null;
}
if (res.getContents() != null && !res.getContents().isEmpty())
{
EObject obj = res.getContents().get(0);
// do only for bsl module
if (obj instanceof Module)
{
EObject subObject = bslObjectAtOffsetHelper.resolveElementAt(res, offset);
if (subObject instanceof Method)
{
if (monitor.isCanceled())
{
return null;
}
BslDocumentationComment docComment = getDocComment((Method)subObject);
Object selected = getSelected(docComment, subObject, offset);
return Pair.newPair(docComment, selected);
}
else if (subObject != null)
{
for (EObject e = subObject; e != null; e = e.eContainer())
{
if (monitor.isCanceled())
{
return null;
}
if (e instanceof Method)
{
return Pair.newPair(getDocComment((Method)e), null);
}
}
}
}
}
return null;
}
});
}
private BslDocumentationComment getDocComment(Method method)
{
IProject project = resourceLookup.getProject(method);
DocumentationCommentProperties props = bslPreferences.getDocumentCommentProperties(project);
return BslCommentUtils.parseTemplateComment(method, props.oldCommentFormat(), commentProvider);
}
private Object getSelected(BslDocumentationComment docComment, EObject method, int offset)
{
if (docComment == null)
{
return null;
}
List<INode> nodes = commentProvider.getDocumentationNodes(method);
if (nodes.isEmpty())
{
return null;
}
INode actual = null;
for (INode node : nodes)
{
if (node.getOffset() > offset)
{
break;
}
actual = node;
}
if (actual != null && actual.getEndOffset() > offset)
{
int actualOffset = offset - actual.getOffset();
int line = nodes.indexOf(actual);
if (line > -1 && actualOffset > 0)
{
return getSelected(docComment, line, actualOffset);
}
}
return null;
}
private Object getListSelected(List<?> objects, int line, int offset)
{
if (objects == null)
{
return null;
}
for (Object object : objects)
{
Object selected = getSelected(object, line, offset);
if (selected != null)
{
return selected;
}
}
return null;
}
private Object getSelected(Object object, int line, int offset)
{
if (object instanceof TextPart)
{
TextPart section = (TextPart)object;
if (section.getLineNumber() == line && section.getOffset() < offset
&& section.getOffset() + section.getText().length() > offset)
{
return section;
}
}
else if (object instanceof LinkPart)
{
LinkPart section = (LinkPart)object;
if (section.getLineNumber() == line && section.getOffset() < offset
&& section.getLinkTextOffset() + section.getLinkText().length() > offset)
{
return section;
}
}
else if (object instanceof FieldDefinition)
{
FieldDefinition section = (FieldDefinition)object;
if (section.getLineNumber() == line && section.getNameOffset() < offset
&& section.getNameOffset() + section.getName().length() > offset)
{
return section;
}
Object selected = getSelected(section.getDescription(), line, offset);
if (selected != null)
{
return selected;
}
selected = getListSelected(section.getTypeSections(), line, offset);
if (selected != null)
{
return selected;
}
}
else if (object instanceof TypeDefinition)
{
TypeDefinition section = (TypeDefinition)object;
if (section.getLineNumber() == line && section.getNameOffset() < offset
&& section.getNameOffset() + section.getTypeName().length() > offset)
{
return section;
}
Object selected = getListSelected(section.getContainTypes(), line, offset);
if (selected != null)
{
return selected;
}
selected = getListSelected(section.getFieldDefinitionExtension(), line, offset);
if (selected != null)
{
return selected;
}
selected = getSelected(section.getLinkToExtensionFields(), line, offset);
if (selected != null)
{
return selected;
}
}
else if (object instanceof BslDocumentationComment)
{
BslDocumentationComment root = (BslDocumentationComment)object;
Object selected = getSelected(root.getDescription(), line, offset);
if (selected != null)
{
return selected;
}
selected = getSelected(root.getParametersSection(), line, offset);
if (selected != null)
{
return selected;
}
selected = getSelected(root.getCallOptionsSection(), line, offset);
if (selected != null)
{
return selected;
}
selected = getSelected(root.getExampleSection(), line, offset);
if (selected != null)
{
return selected;
}
selected = getSelected(root.getReturnSection(), line, offset);
if (selected != null)
{
return selected;
}
}
else if (object instanceof Description)
{
return getListSelected(((Description)object).getParts(), line, offset);
}
else if (object instanceof ParametersSection)
{
ParametersSection section = (ParametersSection)object;
if (section.getLineNumber() == line && section.getOffset() < offset
&& section.getOffset() + section.getHeaderKeywordLength() > offset)
{
return section;
}
Object selected = getSelected(section.getDescription(), line, offset);
if (selected != null)
{
return selected;
}
selected = getListSelected(section.getParameterDefinitions(), line, offset);
if (selected != null)
{
return selected;
}
}
else if (object instanceof ReturnSection)
{
ReturnSection section = (ReturnSection)object;
if (section.getLineNumber() == line && section.getOffset() < offset
&& section.getOffset() + section.getHeaderKeywordLength() > offset)
{
return section;
}
Object selected = getSelected(section.getDescription(), line, offset);
if (selected != null)
{
return selected;
}
selected = getListSelected(section.getReturnTypes(), line, offset);
if (selected != null)
{
return selected;
}
}
else if (object instanceof TypeSection)
{
TypeSection section = (TypeSection)object;
if (section.getLineNumber() == line && section.getOffset() < offset
&& section.getOffset() + section.getHeaderKeywordLength() > offset)
{
return section;
}
Object selected = getSelected(section.getDescription(), line, offset);
if (selected != null)
{
return selected;
}
selected = getListSelected(section.getTypeDefinitions(), line, offset);
if (selected != null)
{
return selected;
}
}
else if (object instanceof Section)
{
Section section = (Section)object;
if (section.getLineNumber() == line && section.getOffset() < offset
&& section.getOffset() + section.getHeaderKeywordLength() > offset)
{
return section;
}
Object selected = getSelected(section.getDescription(), line, offset);
if (selected != null)
{
return selected;
}
}
else if (object instanceof LinkContainsTypeDefinition)
{
LinkContainsTypeDefinition section = (LinkContainsTypeDefinition)object;
Object selected = getSelected(section.getLink(), line, offset);
if (selected != null)
{
return selected;
}
selected = getListSelected(section.getContainTypes(), line, offset);
if (selected != null)
{
return selected;
}
selected = getListSelected(section.getFieldDefinitionExtension(), line, offset);
if (selected != null)
{
return selected;
}
selected = getSelected(section.getLinkToExtensionFields(), line, offset);
if (selected != null)
{
return selected;
}
}
return null;
}
}

View File

@ -0,0 +1,247 @@
/*******************************************************************************
* Copyright (C) 2021, 1C-Soft LLC and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* 1C-Soft LLC - initial API and implementation
*******************************************************************************/
package com.e1c.v8codestyle.internal.bsl.ui.views;
import java.text.MessageFormat;
import javax.inject.Inject;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.part.ViewPart;
import com._1c.g5.v8.dt.bsl.common.IBslPreferences;
import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment;
import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment.Description;
import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment.ParametersSection;
import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment.ReturnSection;
import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment.Section;
import com._1c.g5.v8.dt.bsl.documentation.comment.LinkPart;
import com._1c.g5.v8.dt.bsl.documentation.comment.TextPart;
import com._1c.g5.v8.dt.bsl.documentation.comment.TypeSection;
import com._1c.g5.v8.dt.bsl.documentation.comment.TypeSection.FieldDefinition;
import com._1c.g5.v8.dt.bsl.documentation.comment.TypeSection.LinkContainsTypeDefinition;
import com._1c.g5.v8.dt.bsl.documentation.comment.TypeSection.TypeDefinition;
import com._1c.g5.v8.dt.core.platform.IResourceLookup;
import com.e1c.v8codestyle.internal.bsl.ui.SharedImages;
import com.e1c.v8codestyle.internal.bsl.ui.UiPlugin;
/**
* The View to show {@link BslDocumentationComment} model that selected in bsl-module editor.
*
* @author Dmitriy Marmyshev
*/
public class BslDocCommentView
extends ViewPart
{
/**
* The ID of the view as specified by the extension.
*/
public static final String ID = "com.e1c.v8codestyle.bsl.ui.views.BslDocCommentView"; //$NON-NLS-1$
@Inject
private IWorkbench workbench;
private TreeViewer viewer;
private ISelectionListener listener;
@Override
public void createPartControl(Composite parent)
{
viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getControl());
viewer.setContentProvider(new BslDocumentationCommentContentProvider());
viewer.setLabelProvider(new ViewLabelProvider());
viewer.setAutoExpandLevel(TreeViewer.ALL_LEVELS);
getSite().setSelectionProvider(viewer);
makeActions();
hookContextMenu();
hookDoubleClickAction();
contributeToActionBars();
IResourceLookup resourceLookup = UiPlugin.getDefault().getInjector().getInstance(IResourceLookup.class);
IBslPreferences bslPreferences = UiPlugin.getDefault().getInjector().getInstance(IBslPreferences.class);
listener = new BslDocCommentSelectionListener(viewer, resourceLookup, bslPreferences);
getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener(listener);
}
@Override
public void dispose()
{
getSite().getWorkbenchWindow().getSelectionService().removePostSelectionListener(listener);
super.dispose();
}
private void hookContextMenu()
{
MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(this::fillContextMenu);
Menu menu = menuMgr.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
getSite().registerContextMenu(menuMgr, viewer);
}
private void contributeToActionBars()
{
IActionBars bars = getViewSite().getActionBars();
fillLocalPullDown(bars.getMenuManager());
fillLocalToolBar(bars.getToolBarManager());
}
private void fillLocalPullDown(IMenuManager manager)
{
manager.add(new Separator());
}
private void fillContextMenu(IMenuManager manager)
{
manager.add(new Separator());
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
private void fillLocalToolBar(IToolBarManager manager)
{
manager.add(new Separator());
}
private void makeActions()
{
// TODO add actions
}
private void hookDoubleClickAction()
{
viewer.addDoubleClickListener(new IDoubleClickListener()
{
@Override
public void doubleClick(DoubleClickEvent event)
{
// TODO add action
}
});
}
@Override
public void setFocus()
{
viewer.getControl().setFocus();
}
class ViewLabelProvider
extends LabelProvider
{
@Override
public String getText(Object obj)
{
if (obj instanceof Description)
{
return Messages.BslDocCommentView_Description;
}
else if (obj instanceof TextPart)
{
return MessageFormat.format(Messages.BslDocCommentView_Text, ((TextPart)obj).getText());
}
else if (obj instanceof LinkPart)
{
return MessageFormat.format(Messages.BslDocCommentView_Link, ((LinkPart)obj).getLinkText());
}
else if (obj instanceof ParametersSection)
{
return Messages.BslDocCommentView_Parameters;
}
else if (obj instanceof TypeSection)
{
return Messages.BslDocCommentView_Types;
}
else if (obj instanceof FieldDefinition)
{
return MessageFormat.format(Messages.BslDocCommentView_Field, ((FieldDefinition)obj).getName());
}
else if (obj instanceof ReturnSection)
{
return Messages.BslDocCommentView_Returns;
}
else if (obj instanceof Section)
{
return Messages.BslDocCommentView_Section;
}
else if (obj instanceof LinkContainsTypeDefinition)
{
return MessageFormat.format(Messages.BslDocCommentView_Link_type,
((LinkContainsTypeDefinition)obj).getTypeName());
}
else if (obj instanceof TypeDefinition)
{
return MessageFormat.format(Messages.BslDocCommentView_Type, ((TypeDefinition)obj).getTypeName());
}
return obj.toString();
}
@Override
public Image getImage(Object obj)
{
String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
if (obj instanceof LinkPart)
{
return UiPlugin.getDefault().getImage(SharedImages.IMG_OBJ16_LINK);
}
else if (obj instanceof TextPart)
{
return UiPlugin.getDefault().getImage(SharedImages.IMG_OBJ16_TEXT);
}
else if (obj instanceof FieldDefinition)
{
return UiPlugin.getDefault().getImage(SharedImages.IMG_OBJ16_FIELD);
}
else if (obj instanceof TypeDefinition)
{
return UiPlugin.getDefault().getImage(SharedImages.IMG_OBJ16_TYPE);
}
else if (obj instanceof Description)
{
return UiPlugin.getDefault().getImage(SharedImages.IMG_OBJ16_DESCRIPTION);
}
else if (obj instanceof ParametersSection || obj instanceof ReturnSection || obj instanceof Section
|| obj instanceof TypeSection)
{
imageKey = ISharedImages.IMG_OBJ_FOLDER;
}
return workbench.getSharedImages().getImage(imageKey);
}
}
}

View File

@ -0,0 +1,252 @@
/*******************************************************************************
* Copyright (C) 2021, 1C-Soft LLC and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* 1C-Soft LLC - initial API and implementation
*******************************************************************************/
package com.e1c.v8codestyle.internal.bsl.ui.views;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.TreeViewer;
import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment;
import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment.Description;
import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment.ParametersSection;
import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment.ReturnSection;
import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment.Section;
import com._1c.g5.v8.dt.bsl.documentation.comment.TypeSection;
import com._1c.g5.v8.dt.bsl.documentation.comment.TypeSection.FieldDefinition;
import com._1c.g5.v8.dt.bsl.documentation.comment.TypeSection.LinkContainsTypeDefinition;
import com._1c.g5.v8.dt.bsl.documentation.comment.TypeSection.TypeDefinition;
/**
* The content provider for {@link TreeViewer} bases on root {@link BslDocumentationComment doc comment model}.
*
* @author Dmitriy Marmyshev
*/
public class BslDocumentationCommentContentProvider
implements ITreeContentProvider
{
private BslDocumentationComment internalRoot;
@Override
public Object[] getElements(Object parent)
{
if (parent instanceof BslDocumentationComment)
{
internalRoot = (BslDocumentationComment)parent;
}
return getChildren(parent);
}
@Override
public Object getParent(Object child)
{
if (child instanceof BslDocumentationComment)
{
return null;
}
else if (child instanceof ParametersSection || child instanceof ReturnSection || child instanceof Section)
{
return internalRoot;
}
return null;
}
@Override
public Object[] getChildren(Object parent)
{
List<Object> children = new ArrayList<>();
if (parent instanceof BslDocumentationComment)
{
BslDocumentationComment root = (BslDocumentationComment)parent;
internalRoot = root;
if (root.getDescription() != null && !root.getDescription().getParts().isEmpty())
{
children.add(root.getDescription());
}
if (root.getParametersSection() != null)
{
children.add(root.getParametersSection());
}
if (root.getCallOptionsSection() != null)
{
children.add(root.getCallOptionsSection());
}
if (root.getExampleSection() != null)
{
children.add(root.getExampleSection());
}
if (root.getReturnSection() != null)
{
children.add(root.getReturnSection());
}
}
else if (parent instanceof Description)
{
children.addAll(((Description)parent).getParts());
}
else if (parent instanceof ParametersSection)
{
ParametersSection section = (ParametersSection)parent;
if (section.getDescription() != null && !section.getDescription().getParts().isEmpty())
{
children.add(section.getDescription());
}
if (!section.getParameterDefinitions().isEmpty())
{
children.addAll(section.getParameterDefinitions());
}
}
else if (parent instanceof ReturnSection)
{
ReturnSection section = (ReturnSection)parent;
if (section.getDescription() != null && !section.getDescription().getParts().isEmpty())
{
children.add(section.getDescription());
}
if (!section.getReturnTypes().isEmpty())
{
children.addAll(section.getReturnTypes());
}
}
else if (parent instanceof TypeSection)
{
TypeSection section = (TypeSection)parent;
if (section.getDescription() != null && !section.getDescription().getParts().isEmpty())
{
children.add(section.getDescription());
}
if (!section.getTypeDefinitions().isEmpty())
{
children.addAll(section.getTypeDefinitions());
}
}
else if (parent instanceof Section)
{
Section section = (Section)parent;
if (section.getDescription() != null && !section.getDescription().getParts().isEmpty())
{
children.add(section.getDescription());
}
}
else if (parent instanceof FieldDefinition)
{
FieldDefinition section = (FieldDefinition)parent;
if (section.getDescription() != null && !section.getDescription().getParts().isEmpty())
{
children.add(section.getDescription());
}
if (!section.getTypeSections().isEmpty())
{
children.addAll(section.getTypeSections());
}
}
else if (parent instanceof LinkContainsTypeDefinition)
{
LinkContainsTypeDefinition section = (LinkContainsTypeDefinition)parent;
if (section.getLink() != null)
{
children.add(section.getLink());
}
if (!section.getContainTypes().isEmpty())
{
children.addAll(section.getContainTypes());
}
if (!section.getFieldDefinitionExtension().isEmpty())
{
children.addAll(section.getFieldDefinitionExtension());
}
if (section.getLinkToExtensionFields() != null)
{
children.add(section.getLinkToExtensionFields());
}
}
else if (parent instanceof TypeDefinition)
{
TypeDefinition section = (TypeDefinition)parent;
if (!section.getContainTypes().isEmpty())
{
children.addAll(section.getContainTypes());
}
if (!section.getFieldDefinitionExtension().isEmpty())
{
children.addAll(section.getFieldDefinitionExtension());
}
if (section.getLinkToExtensionFields() != null)
{
children.add(section.getLinkToExtensionFields());
}
}
return children.toArray();
}
@Override
public boolean hasChildren(Object parent)
{
if (parent instanceof BslDocumentationComment)
{
BslDocumentationComment root = (BslDocumentationComment)parent;
return root.getDescription() != null && !root.getDescription().getParts().isEmpty()
|| root.getParametersSection() != null || root.getCallOptionsSection() != null
|| root.getExampleSection() != null || root.getReturnSection() != null;
}
else if (parent instanceof Description)
{
return !((Description)parent).getParts().isEmpty();
}
else if (parent instanceof ParametersSection)
{
ParametersSection section = (ParametersSection)parent;
return section.getDescription() != null && !section.getDescription().getParts().isEmpty()
|| !section.getParameterDefinitions().isEmpty();
}
else if (parent instanceof ReturnSection)
{
ReturnSection section = (ReturnSection)parent;
return section.getDescription() != null || !section.getReturnTypes().isEmpty();
}
else if (parent instanceof TypeSection)
{
TypeSection section = (TypeSection)parent;
return section.getDescription() != null && !section.getDescription().getParts().isEmpty()
|| !section.getTypeDefinitions().isEmpty();
}
else if (parent instanceof Section)
{
Section section = (Section)parent;
return section.getDescription() != null && !section.getDescription().getParts().isEmpty();
}
else if (parent instanceof FieldDefinition)
{
FieldDefinition section = (FieldDefinition)parent;
return section.getDescription() != null && !section.getDescription().getParts().isEmpty()
|| !section.getTypeSections().isEmpty();
}
else if (parent instanceof LinkContainsTypeDefinition)
{
LinkContainsTypeDefinition section = (LinkContainsTypeDefinition)parent;
return section.getLink() != null || !section.getContainTypes().isEmpty()
|| !section.getFieldDefinitionExtension().isEmpty() || section.getLinkToExtensionFields() != null;
}
else if (parent instanceof TypeDefinition)
{
TypeDefinition section = (TypeDefinition)parent;
return !section.getContainTypes().isEmpty() || !section.getFieldDefinitionExtension().isEmpty()
|| section.getLinkToExtensionFields() != null;
}
return false;
}
}

View File

@ -0,0 +1,44 @@
/*******************************************************************************
* Copyright (C) 2021, 1C-Soft LLC and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* 1C-Soft LLC - initial API and implementation
*******************************************************************************/
package com.e1c.v8codestyle.internal.bsl.ui.views;
import org.eclipse.osgi.util.NLS;
/**
* @author Dmitriy Marmyshev
*
*/
final class Messages
extends NLS
{
private static final String BUNDLE_NAME = "com.e1c.v8codestyle.internal.bsl.ui.views.messages"; //$NON-NLS-1$
public static String BslDocCommentView_Description;
public static String BslDocCommentView_Field;
public static String BslDocCommentView_Link;
public static String BslDocCommentView_Link_type;
public static String BslDocCommentView_Parameters;
public static String BslDocCommentView_Returns;
public static String BslDocCommentView_Section;
public static String BslDocCommentView_Text;
public static String BslDocCommentView_Type;
public static String BslDocCommentView_Types;
static
{
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
private Messages()
{
}
}

View File

@ -0,0 +1,33 @@
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
###############################################################################
# Copyright (C) 2021, 1C-Soft LLC and others.
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# 1C-Soft LLC - initial API and implementation
###############################################################################
BslDocCommentView_Description = Description:
BslDocCommentView_Field = Field: {0}
BslDocCommentView_Link = Link: {0}
BslDocCommentView_Link_type = Link type: {0}
BslDocCommentView_Parameters = Parameters:
BslDocCommentView_Returns = Returns:
BslDocCommentView_Section = Section:
BslDocCommentView_Text = Text: {0}
BslDocCommentView_Type = Type: {0}
BslDocCommentView_Types = Types:

View File

@ -0,0 +1,34 @@
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
###############################################################################
# Copyright (C) 2021, 1C-Soft LLC and others.
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# 1C-Soft LLC - initial API and implementation
###############################################################################
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
BslDocCommentView_Description = Описание:
BslDocCommentView_Field = Поле: {0}
BslDocCommentView_Link = Ссылка: {0}
BslDocCommentView_Link_type = Ссылка типа: {0}
BslDocCommentView_Parameters = Параметры:
BslDocCommentView_Returns = Возврат:
BslDocCommentView_Section = Секция:
BslDocCommentView_Text = Текст: {0}
BslDocCommentView_Type = Тип: {0}
BslDocCommentView_Types = Типы:

View File

@ -18,6 +18,8 @@ import com._1c.g5.wiring.AbstractGuiceAwareExecutableExtensionFactory;
import com.google.inject.Injector;
/**
* Guice module aware executable extension factory for plugin.
*
* @author Dmitriy Marmyshev
*
*/

View File

@ -24,6 +24,8 @@ import com._1c.g5.v8.dt.platform.version.IRuntimeVersionSupport;
import com._1c.g5.wiring.AbstractServiceAwareModule;
/**
* The external dependencies for plugin
*
* @author Dmitriy Marmyshev
*
*/

View File

@ -28,6 +28,7 @@
<module>com.e1c.v8codestyle.md.ui</module>
<module>com.e1c.v8codestyle.form</module>
<module>com.e1c.v8codestyle.bsl</module>
<module>com.e1c.v8codestyle.bsl.ui</module>
<module>com.e1c.v8codestyle.autosort</module>
<module>com.e1c.v8codestyle.autosort.ui</module>
<module>com.e1c.v8codestyle.ql</module>

View File

@ -0,0 +1,28 @@
# Панель "Bsl Документирующий комментарий"
Контекстная панель показывает структуру документирующего комментария в иерархическом виде при выборе метода.
Панель позволяет выделять элемент модели и текст в редакторе.
## Открыть панель
Эта панель входит в стандартный состав перспективы 1С:Enterprise. Если вы закрыли эту панель или находитесь в другой перспективе, вы можете открыть эту панель из главного меню основного окна, нажав `Окно > Показать панель > Прочие… > 1С:Стандарты разработки V8 > Bsl Документирующий комментарий`.
### Проблема
Примеры проблемных ситуаций в языке документирующего комментария:
- Описание параметров - забывают поставить двоеточие после ключевого слова
- Описание полей структур, таблиц значений - забывают ставить звездочки, тире, двоеточие
- Описание списка типов с пояснениями типов - пишутся неправильно (запятые, тире и так далее)
- Описываются значения полей через звездочку как новое подчиненное поле - что в корне не верно.
- Многострочные комментарии при описании параметра с типом, содержащим расширение полей (что не поддерживается форматом)
- и др. ошибки.
Структурированные данные документирующего комментария позволяют разработчику видеть тот объект, который разбирает 1C:EDT.
## Дополнительно
- Стандарт [Описание процедур и функций](https://its.1c.ru/db/v8std#content:453:hdoc)
- Документация 1C:EDT [Комментирование процедур и функций](https://its.1c.ru/db/edtdoc#content:330:hdoc)

View File

@ -4,3 +4,4 @@
- [Авто-сортировка метаданных](autosort.md)
- [Создание общих модулей по типам](common-module-types.md)
- [Панель "Bsl Документирующий комментарий"](bsl-doc-comment-view.md)

View File

@ -88,6 +88,13 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.e1c.v8codestyle.bsl.ui"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.e1c.v8codestyle.right"
download-size="0"