Новые иконки панели док.комментов и тесты (#837)
@ -24,5 +24,6 @@ Import-Package: com._1c.g5.v8.dt.bsl.comment;version="[3.0.0,4.0.0)",
|
|||||||
com._1c.g5.v8.dt.common;version="[6.0.0,7.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.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.v8.dt.mcore;version="[6.0.0,7.0.0)",
|
||||||
|
com._1c.g5.v8.dt.theming.ui.util;version="[1.0.0,2.0.0)",
|
||||||
com._1c.g5.wiring;version="[2.2.0,3.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)"
|
com._1c.g5.wiring.binder;version="[1.1.0,2.0.0)"
|
||||||
|
BIN
bundles/com.e1c.v8codestyle.bsl.ui/icons/BslDocComment.png
Normal file
After Width: | Height: | Size: 203 B |
BIN
bundles/com.e1c.v8codestyle.bsl.ui/icons/BslDocComment@2x.png
Normal file
After Width: | Height: | Size: 221 B |
Before Width: | Height: | Size: 219 B After Width: | Height: | Size: 266 B |
BIN
bundles/com.e1c.v8codestyle.bsl.ui/icons/obj16/attribute@2x.png
Normal file
After Width: | Height: | Size: 459 B |
After Width: | Height: | Size: 265 B |
After Width: | Height: | Size: 454 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 398 B |
After Width: | Height: | Size: 774 B |
After Width: | Height: | Size: 403 B |
After Width: | Height: | Size: 787 B |
Before Width: | Height: | Size: 357 B After Width: | Height: | Size: 292 B |
BIN
bundles/com.e1c.v8codestyle.bsl.ui/icons/obj16/link@2x.png
Normal file
After Width: | Height: | Size: 417 B |
BIN
bundles/com.e1c.v8codestyle.bsl.ui/icons/obj16/link_dark.png
Normal file
After Width: | Height: | Size: 289 B |
BIN
bundles/com.e1c.v8codestyle.bsl.ui/icons/obj16/link_dark@2x.png
Normal file
After Width: | Height: | Size: 406 B |
After Width: | Height: | Size: 362 B |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 364 B |
After Width: | Height: | Size: 630 B |
Before Width: | Height: | Size: 488 B After Width: | Height: | Size: 215 B |
BIN
bundles/com.e1c.v8codestyle.bsl.ui/icons/obj16/text@2x.png
Normal file
After Width: | Height: | Size: 298 B |
BIN
bundles/com.e1c.v8codestyle.bsl.ui/icons/obj16/text_dark.png
Normal file
After Width: | Height: | Size: 221 B |
BIN
bundles/com.e1c.v8codestyle.bsl.ui/icons/obj16/text_dark@2x.png
Normal file
After Width: | Height: | Size: 294 B |
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 189 B |
BIN
bundles/com.e1c.v8codestyle.bsl.ui/icons/obj16/type@2x.png
Normal file
After Width: | Height: | Size: 210 B |
BIN
bundles/com.e1c.v8codestyle.bsl.ui/icons/obj16/type_dark.png
Normal file
After Width: | Height: | Size: 186 B |
BIN
bundles/com.e1c.v8codestyle.bsl.ui/icons/obj16/type_dark@2x.png
Normal file
After Width: | Height: | Size: 207 B |
BIN
bundles/com.e1c.v8codestyle.bsl.ui/icons/obj16/type_section.png
Normal file
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 424 B |
After Width: | Height: | Size: 328 B |
After Width: | Height: | Size: 446 B |
Before Width: | Height: | Size: 332 B |
Before Width: | Height: | Size: 526 B |
@ -25,7 +25,7 @@
|
|||||||
<view
|
<view
|
||||||
category="com.e1c.v8codestyle.bsl.ui"
|
category="com.e1c.v8codestyle.bsl.ui"
|
||||||
class="com.e1c.v8codestyle.internal.bsl.ui.views.BslDocCommentView"
|
class="com.e1c.v8codestyle.internal.bsl.ui.views.BslDocCommentView"
|
||||||
icon="icons/sample.png"
|
icon="icons/BslDocComment.png"
|
||||||
id="com.e1c.v8codestyle.bsl.ui.views.BslDocCommentView"
|
id="com.e1c.v8codestyle.bsl.ui.views.BslDocCommentView"
|
||||||
inject="true"
|
inject="true"
|
||||||
name="%views.BslDocCommentView.name">
|
name="%views.BslDocCommentView.name">
|
||||||
|
@ -15,6 +15,8 @@ package com.e1c.v8codestyle.internal.bsl.ui;
|
|||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.jface.resource.ImageRegistry;
|
import org.eclipse.jface.resource.ImageRegistry;
|
||||||
|
|
||||||
|
import com._1c.g5.v8.dt.theming.ui.util.DtThemeUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The common constants for plug-in images.
|
* The common constants for plug-in images.
|
||||||
*
|
*
|
||||||
@ -28,6 +30,8 @@ public final class SharedImages
|
|||||||
public static final String IMG_OBJ16_LINK = UiPlugin.PLUGIN_ID + T_OBJ16 + "link.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_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_TYPE = UiPlugin.PLUGIN_ID + T_OBJ16 + "type.png"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_OBJ16_TYPE_SECTION = UiPlugin.PLUGIN_ID + T_OBJ16 + "type_section.png"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_OBJ16_PARAMETERS_SECTION = UiPlugin.PLUGIN_ID + T_OBJ16 + "parameters_section.png"; //$NON-NLS-1$
|
||||||
public static final String IMG_OBJ16_DESCRIPTION = UiPlugin.PLUGIN_ID + T_OBJ16 + "description.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$
|
private static final String ICONS_PATH = "/icons"; //$NON-NLS-1$
|
||||||
@ -39,11 +43,14 @@ public final class SharedImages
|
|||||||
*/
|
*/
|
||||||
/* package */ static void initializeImageRegistry(ImageRegistry reg)
|
/* package */ static void initializeImageRegistry(ImageRegistry reg)
|
||||||
{
|
{
|
||||||
reg.put(IMG_OBJ16_FIELD, createImageDescriptorFromKey(IMG_OBJ16_FIELD));
|
reg.put(IMG_OBJ16_FIELD, createImageDescriptorFromKey(DtThemeUtil.getIconPath(IMG_OBJ16_FIELD)));
|
||||||
reg.put(IMG_OBJ16_LINK, createImageDescriptorFromKey(IMG_OBJ16_LINK));
|
reg.put(IMG_OBJ16_LINK, createImageDescriptorFromKey(DtThemeUtil.getIconPath(IMG_OBJ16_LINK)));
|
||||||
reg.put(IMG_OBJ16_TEXT, createImageDescriptorFromKey(IMG_OBJ16_TEXT));
|
reg.put(IMG_OBJ16_TEXT, createImageDescriptorFromKey(DtThemeUtil.getIconPath(IMG_OBJ16_TEXT)));
|
||||||
reg.put(IMG_OBJ16_TYPE, createImageDescriptorFromKey(IMG_OBJ16_TYPE));
|
reg.put(IMG_OBJ16_TYPE, createImageDescriptorFromKey(DtThemeUtil.getIconPath(IMG_OBJ16_TYPE)));
|
||||||
reg.put(IMG_OBJ16_DESCRIPTION, createImageDescriptorFromKey(IMG_OBJ16_DESCRIPTION));
|
reg.put(IMG_OBJ16_TYPE_SECTION, createImageDescriptorFromKey(DtThemeUtil.getIconPath(IMG_OBJ16_TYPE_SECTION)));
|
||||||
|
reg.put(IMG_OBJ16_PARAMETERS_SECTION,
|
||||||
|
createImageDescriptorFromKey(DtThemeUtil.getIconPath(IMG_OBJ16_PARAMETERS_SECTION)));
|
||||||
|
reg.put(IMG_OBJ16_DESCRIPTION, createImageDescriptorFromKey(DtThemeUtil.getIconPath(IMG_OBJ16_DESCRIPTION)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ImageDescriptor createImageDescriptorFromKey(String key)
|
private static ImageDescriptor createImageDescriptorFromKey(String key)
|
||||||
|
@ -306,6 +306,30 @@ public class BslDocCommentSelectionListener
|
|||||||
return selected;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (object instanceof TypeDefinition)
|
else if (object instanceof TypeDefinition)
|
||||||
{
|
{
|
||||||
TypeDefinition section = (TypeDefinition)object;
|
TypeDefinition section = (TypeDefinition)object;
|
||||||
@ -436,30 +460,6 @@ public class BslDocCommentSelectionListener
|
|||||||
return selected;
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,8 +235,15 @@ public class BslDocCommentView
|
|||||||
{
|
{
|
||||||
return UiPlugin.getDefault().getImage(SharedImages.IMG_OBJ16_DESCRIPTION);
|
return UiPlugin.getDefault().getImage(SharedImages.IMG_OBJ16_DESCRIPTION);
|
||||||
}
|
}
|
||||||
else if (obj instanceof ParametersSection || obj instanceof ReturnSection || obj instanceof Section
|
else if (obj instanceof TypeSection)
|
||||||
|| obj instanceof TypeSection)
|
{
|
||||||
|
return UiPlugin.getDefault().getImage(SharedImages.IMG_OBJ16_TYPE_SECTION);
|
||||||
|
}
|
||||||
|
else if (obj instanceof ParametersSection)
|
||||||
|
{
|
||||||
|
return UiPlugin.getDefault().getImage(SharedImages.IMG_OBJ16_PARAMETERS_SECTION);
|
||||||
|
}
|
||||||
|
else if (obj instanceof ReturnSection || obj instanceof Section)
|
||||||
{
|
{
|
||||||
imageKey = ISharedImages.IMG_OBJ_FOLDER;
|
imageKey = ISharedImages.IMG_OBJ_FOLDER;
|
||||||
}
|
}
|
||||||
|
7
tests/com.e1c.v8codestyle.bsl.ui.itests/.classpath
Normal 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>
|
28
tests/com.e1c.v8codestyle.bsl.ui.itests/.project
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>com.e1c.v8codestyle.bsl.ui.itests</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>
|
@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding/<project>=UTF-8
|
@ -0,0 +1,10 @@
|
|||||||
|
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.nonExternalizedStringLiteral=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||||
|
org.eclipse.jdt.core.compiler.release=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.source=11
|
14
tests/com.e1c.v8codestyle.bsl.ui.itests/META-INF/MANIFEST.MF
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
Bundle-ManifestVersion: 2
|
||||||
|
Bundle-Name: %pluginName
|
||||||
|
Bundle-SymbolicName: com.e1c.v8codestyle.bsl.ui.itests;singleton:=true
|
||||||
|
Bundle-Version: 0.1.0.qualifier
|
||||||
|
Bundle-Vendor: %providerName
|
||||||
|
Fragment-Host: com.e1c.v8codestyle.bsl.ui;bundle-version="[0.1.0,0.2.0)"
|
||||||
|
Automatic-Module-Name: com.e1c.v8codestyle.bsl.ui.itests
|
||||||
|
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||||
|
Bundle-Localization: fragment
|
||||||
|
Import-Package: com._1c.g5.v8.dt.bsl.ui.editor;version="[8.0.0,9.0.0)",
|
||||||
|
com._1c.g5.v8.dt.testing;version="[3.1.0,4.0.0)",
|
||||||
|
com._1c.g5.v8.dt.ui.util;version="[6.0.0,7.0.0)",
|
||||||
|
org.junit;version="[4.13.0,5.0.0)"
|
18
tests/com.e1c.v8codestyle.bsl.ui.itests/build.properties
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
###############################################################################
|
||||||
|
# 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/,\
|
||||||
|
.,\
|
||||||
|
resources/,\
|
||||||
|
workspace/
|
15
tests/com.e1c.v8codestyle.bsl.ui.itests/fragment.properties
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
###############################################################################
|
||||||
|
# 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.itests
|
||||||
|
providerName = 1C-Soft LLC
|
||||||
|
pluginName = 1C:Code style V8 Bsl Integration UI test plugin
|
27
tests/com.e1c.v8codestyle.bsl.ui.itests/pom.xml
Normal 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>tests</artifactId>
|
||||||
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>com.e1c.v8codestyle.bsl.ui.itests</artifactId>
|
||||||
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
|
<packaging>eclipse-test-plugin</packaging>
|
||||||
|
</project>
|
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
// Method description
|
||||||
|
//
|
||||||
|
// Parameters:
|
||||||
|
// Parameters - Structure:
|
||||||
|
// * Key1 - has not type for key
|
||||||
|
Procedure Test(Parameters) Export
|
||||||
|
// empty
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
// Returns:
|
||||||
|
// Array of See Test
|
||||||
|
Function Test2() Export
|
||||||
|
// empty
|
||||||
|
Return Undefined;
|
||||||
|
EndFunction
|
@ -0,0 +1,263 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* 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.bsl.ui.itests;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
import org.eclipse.jface.text.TextSelection;
|
||||||
|
import org.eclipse.jface.viewers.ITreeSelection;
|
||||||
|
import org.eclipse.jface.viewers.TreeViewer;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
import org.eclipse.ui.IEditorPart;
|
||||||
|
import org.eclipse.ui.ISelectionListener;
|
||||||
|
import org.eclipse.ui.IViewPart;
|
||||||
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
import org.eclipse.ui.intro.IIntroPart;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment;
|
||||||
|
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.LinkPart;
|
||||||
|
import com._1c.g5.v8.dt.bsl.documentation.comment.TextPart;
|
||||||
|
import com._1c.g5.v8.dt.bsl.documentation.comment.TypeSection.FieldDefinition;
|
||||||
|
import com._1c.g5.v8.dt.bsl.documentation.comment.TypeSection.TypeDefinition;
|
||||||
|
import com._1c.g5.v8.dt.bsl.ui.editor.BslXtextEditor;
|
||||||
|
import com._1c.g5.v8.dt.testing.TestingWorkspace;
|
||||||
|
import com._1c.g5.v8.dt.ui.util.OpenHelper;
|
||||||
|
import com.e1c.v8codestyle.internal.bsl.ui.views.BslDocCommentView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Integration test of the {@link BslDocCommentViewTest} that process selection in BSL editor and reacts in the view.
|
||||||
|
*
|
||||||
|
* @author Dmitriy Marmyshev
|
||||||
|
*/
|
||||||
|
public class BslDocCommentViewTest
|
||||||
|
{
|
||||||
|
private static final String PROJECT_NAME = "CommonModule";
|
||||||
|
|
||||||
|
private static final String COMMON_MODULE_FILE_NAME = "/src/CommonModules/CommonModule/Module.bsl";
|
||||||
|
|
||||||
|
@Rule
|
||||||
|
public TestingWorkspace testingWorkspace = new TestingWorkspace(true, false);
|
||||||
|
|
||||||
|
protected static final String FOLDER_RESOURCE = "/resources/";
|
||||||
|
|
||||||
|
private IProject project;
|
||||||
|
|
||||||
|
private OpenHelper openHelper = new OpenHelper();
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() throws CoreException
|
||||||
|
{
|
||||||
|
|
||||||
|
project = testingWorkspace.getProject(PROJECT_NAME);
|
||||||
|
|
||||||
|
if (!project.exists() || !project.isAccessible())
|
||||||
|
{
|
||||||
|
testingWorkspace.cleanUpWorkspace();
|
||||||
|
project = this.testingWorkspace.setUpProject(PROJECT_NAME, getClass());
|
||||||
|
}
|
||||||
|
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
|
||||||
|
|
||||||
|
IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager().getIntro();
|
||||||
|
PlatformUI.getWorkbench().getIntroManager().closeIntro(introPart);
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void shutDown()
|
||||||
|
{
|
||||||
|
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load module and open Bsl documentation comment view, select elements in doc comment test
|
||||||
|
* then check selected in view.
|
||||||
|
*
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testOpenModuleAndSelectElements() throws Exception
|
||||||
|
{
|
||||||
|
updateModule(FOLDER_RESOURCE + "doc-comment-view.bsl");
|
||||||
|
|
||||||
|
IFile file = project.getFile(COMMON_MODULE_FILE_NAME);
|
||||||
|
|
||||||
|
IViewPart view =
|
||||||
|
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(BslDocCommentView.ID);
|
||||||
|
assertTrue(view instanceof BslDocCommentView);
|
||||||
|
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().activate(view);
|
||||||
|
|
||||||
|
IEditorPart editor = openHelper.openEditor(file, new TextSelection(14, 1));
|
||||||
|
assertTrue(editor instanceof BslXtextEditor);
|
||||||
|
|
||||||
|
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().activate(editor);
|
||||||
|
|
||||||
|
BslXtextEditor bslEditor = (BslXtextEditor)editor;
|
||||||
|
|
||||||
|
selectText(bslEditor, 14, 1, view);
|
||||||
|
Object first = getViewerSelection((BslDocCommentView)view);
|
||||||
|
assertTrue(first instanceof TextPart);
|
||||||
|
TextPart textPart = (TextPart)first;
|
||||||
|
assertEquals(0, textPart.getLineNumber());
|
||||||
|
assertEquals("Method description", textPart.getText());
|
||||||
|
|
||||||
|
selectText(bslEditor, 92, 1, view);
|
||||||
|
first = getViewerSelection((BslDocCommentView)view);
|
||||||
|
assertTrue(first instanceof TextPart);
|
||||||
|
textPart = (TextPart)first;
|
||||||
|
assertEquals(4, textPart.getLineNumber());
|
||||||
|
assertEquals("- has not type for key", textPart.getText());
|
||||||
|
|
||||||
|
selectText(bslEditor, 77, 1, view);
|
||||||
|
first = getViewerSelection((BslDocCommentView)view);
|
||||||
|
assertTrue(first instanceof FieldDefinition);
|
||||||
|
FieldDefinition fieldPart = (FieldDefinition)first;
|
||||||
|
assertEquals(4, fieldPart.getLineNumber());
|
||||||
|
assertEquals("Key1", fieldPart.getName());
|
||||||
|
|
||||||
|
selectText(bslEditor, 50, 1, view);
|
||||||
|
first = getViewerSelection((BslDocCommentView)view);
|
||||||
|
assertTrue(first instanceof FieldDefinition);
|
||||||
|
fieldPart = (FieldDefinition)first;
|
||||||
|
assertEquals(3, fieldPart.getLineNumber());
|
||||||
|
assertEquals("Parameters", fieldPart.getName());
|
||||||
|
|
||||||
|
selectText(bslEditor, 33, 0, view);
|
||||||
|
first = getViewerSelection((BslDocCommentView)view);
|
||||||
|
assertTrue(first instanceof ParametersSection);
|
||||||
|
ParametersSection sectionPart = (ParametersSection)first;
|
||||||
|
assertEquals(2, sectionPart.getLineNumber());
|
||||||
|
|
||||||
|
selectText(bslEditor, 64, 0, view);
|
||||||
|
first = getViewerSelection((BslDocCommentView)view);
|
||||||
|
assertTrue(first instanceof TypeDefinition);
|
||||||
|
TypeDefinition typePart = (TypeDefinition)first;
|
||||||
|
assertEquals(3, typePart.getLineNumber());
|
||||||
|
assertEquals("Structure", typePart.getTypeName());
|
||||||
|
|
||||||
|
selectText(bslEditor, 169, 0, view);
|
||||||
|
first = getViewerSelection((BslDocCommentView)view);
|
||||||
|
assertTrue(first instanceof ReturnSection);
|
||||||
|
ReturnSection returnPart = (ReturnSection)first;
|
||||||
|
assertEquals(0, returnPart.getLineNumber());
|
||||||
|
|
||||||
|
selectText(bslEditor, 187, 1, view);
|
||||||
|
first = getViewerSelection((BslDocCommentView)view);
|
||||||
|
assertTrue(first instanceof LinkPart);
|
||||||
|
LinkPart linkPart = (LinkPart)first;
|
||||||
|
assertEquals(1, linkPart.getLineNumber());
|
||||||
|
assertEquals("Test", linkPart.getLinkText());
|
||||||
|
assertEquals("See Test", linkPart.getInitialContent());
|
||||||
|
|
||||||
|
selectText(bslEditor, 192, 1, view);
|
||||||
|
first = getViewerSelection((BslDocCommentView)view);
|
||||||
|
assertTrue(first instanceof LinkPart);
|
||||||
|
linkPart = (LinkPart)first;
|
||||||
|
assertEquals(1, linkPart.getLineNumber());
|
||||||
|
assertEquals("Test", linkPart.getLinkText());
|
||||||
|
assertEquals("See Test", linkPart.getInitialContent());
|
||||||
|
|
||||||
|
selectText(bslEditor, 243, 1, view);
|
||||||
|
TreeViewer viewer = getViewer((BslDocCommentView)view);
|
||||||
|
ITreeSelection selection = viewer.getStructuredSelection();
|
||||||
|
assertTrue(selection.isEmpty());
|
||||||
|
Object input = viewer.getInput();
|
||||||
|
assertTrue(input instanceof BslDocumentationComment);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object getViewerSelection(BslDocCommentView view) throws Exception
|
||||||
|
{
|
||||||
|
TreeViewer viewer = getViewer(view);
|
||||||
|
ITreeSelection selection = viewer.getStructuredSelection();
|
||||||
|
assertFalse(selection.isEmpty());
|
||||||
|
return selection.getFirstElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void selectText(BslXtextEditor bslEditor, int offset, int lenght, IViewPart view) throws Exception
|
||||||
|
{
|
||||||
|
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().activate(bslEditor);
|
||||||
|
|
||||||
|
boolean[] selected = new boolean[1];
|
||||||
|
ISelectionListener listener = (part, selection) -> {
|
||||||
|
if (selection instanceof TextSelection)
|
||||||
|
{
|
||||||
|
selected[0] = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().addPostSelectionListener(listener);
|
||||||
|
Display display = bslEditor.getShell().getDisplay();
|
||||||
|
display.syncExec(() -> {
|
||||||
|
bslEditor.getSelectionProvider().setSelection(new TextSelection(offset, lenght));
|
||||||
|
});
|
||||||
|
waitEventSetnd(bslEditor);
|
||||||
|
|
||||||
|
for (int i = 0; !selected[0] && i < 10; i++)
|
||||||
|
{
|
||||||
|
Thread.sleep(500);
|
||||||
|
waitEventSetnd(bslEditor);
|
||||||
|
}
|
||||||
|
|
||||||
|
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().removePostSelectionListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
private TreeViewer getViewer(BslDocCommentView view) throws Exception
|
||||||
|
{
|
||||||
|
Field field = view.getClass().getDeclaredField("viewer");
|
||||||
|
field.setAccessible(true);
|
||||||
|
return (TreeViewer)field.get(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateModule(String pathToResource) throws Exception
|
||||||
|
{
|
||||||
|
IFile file = project.getFile(COMMON_MODULE_FILE_NAME);
|
||||||
|
try (InputStream in = getClass().getResourceAsStream(pathToResource))
|
||||||
|
{
|
||||||
|
if (file.exists())
|
||||||
|
{
|
||||||
|
file.setContents(in, true, true, new NullProgressMonitor());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
file.create(in, true, new NullProgressMonitor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
testingWorkspace.waitForBuildCompletion();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void waitEventSetnd(IWorkbenchPart part)
|
||||||
|
{
|
||||||
|
Display display = part.getSite().getShell().getDisplay();
|
||||||
|
while (!display.isDisposed() && display.readAndDispatch())
|
||||||
|
{
|
||||||
|
// do it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>CommonModule</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
|
||||||
|
<nature>com._1c.g5.v8.dt.core.V8ConfigurationNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding/<project>=UTF-8
|
@ -0,0 +1,2 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
Runtime-Version: 8.3.19
|
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<mdclass:CommonModule xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="cb364877-7f3a-44d9-8bc3-70387044034b">
|
||||||
|
<name>CommonModule</name>
|
||||||
|
<synonym>
|
||||||
|
<key>en</key>
|
||||||
|
<value>Common module</value>
|
||||||
|
</synonym>
|
||||||
|
<server>true</server>
|
||||||
|
<externalConnection>true</externalConnection>
|
||||||
|
<clientOrdinaryApplication>true</clientOrdinaryApplication>
|
||||||
|
</mdclass:CommonModule>
|
@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<cmi:CommandInterface xmlns:cmi="http://g5.1c.ru/v8/dt/cmi"/>
|
@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<mdclass:Configuration xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="41e0d07d-ece6-42b2-bfbf-686d364ed4fd">
|
||||||
|
<name>CommonModule</name>
|
||||||
|
<synonym>
|
||||||
|
<key>en</key>
|
||||||
|
<value>Common module</value>
|
||||||
|
</synonym>
|
||||||
|
<containedObjects classId="9cd510cd-abfc-11d4-9434-004095e12fc7" objectId="6c1e7aa2-b0dc-40a6-9666-92dc3ee3eee8"/>
|
||||||
|
<containedObjects classId="9fcd25a0-4822-11d4-9414-008048da11f9" objectId="23a1191a-d0c7-4384-92b6-1c0af1530860"/>
|
||||||
|
<containedObjects classId="e3687481-0a87-462c-a166-9f34594f9bba" objectId="2e16e60c-a924-457f-806e-e24b71ccd04b"/>
|
||||||
|
<containedObjects classId="9de14907-ec23-4a07-96f0-85521cb6b53b" objectId="5c2b531d-3b51-4e77-99c5-1b3a36046623"/>
|
||||||
|
<containedObjects classId="51f2d5d8-ea4d-4064-8892-82951750031e" objectId="0b85a612-279e-4922-8f22-838ada8729f6"/>
|
||||||
|
<containedObjects classId="e68182ea-4237-4383-967f-90c1e3370bc7" objectId="1a856b15-b18e-43c7-8608-d37f533898a6"/>
|
||||||
|
<containedObjects classId="fb282519-d103-4dd3-bc12-cb271d631dfc" objectId="16633a11-1ecd-48ba-ab9b-fe39c9b63e9e"/>
|
||||||
|
<configurationExtensionCompatibilityMode>8.3.19</configurationExtensionCompatibilityMode>
|
||||||
|
<defaultRunMode>ManagedApplication</defaultRunMode>
|
||||||
|
<usePurposes>PersonalComputer</usePurposes>
|
||||||
|
<usedMobileApplicationFunctionalities>
|
||||||
|
<functionality>
|
||||||
|
<use>true</use>
|
||||||
|
</functionality>
|
||||||
|
<functionality>
|
||||||
|
<functionality>OSBackup</functionality>
|
||||||
|
<use>true</use>
|
||||||
|
</functionality>
|
||||||
|
</usedMobileApplicationFunctionalities>
|
||||||
|
<defaultLanguage>Language.English</defaultLanguage>
|
||||||
|
<dataLockControlMode>Managed</dataLockControlMode>
|
||||||
|
<objectAutonumerationMode>NotAutoFree</objectAutonumerationMode>
|
||||||
|
<modalityUseMode>DontUse</modalityUseMode>
|
||||||
|
<synchronousPlatformExtensionAndAddInCallUseMode>DontUse</synchronousPlatformExtensionAndAddInCallUseMode>
|
||||||
|
<compatibilityMode>8.3.19</compatibilityMode>
|
||||||
|
<languages uuid="6d6f56cc-2157-41a6-aa5c-a2ca5b24e90c">
|
||||||
|
<name>English</name>
|
||||||
|
<synonym>
|
||||||
|
<key>en</key>
|
||||||
|
<value>English</value>
|
||||||
|
</synonym>
|
||||||
|
<languageCode>en</languageCode>
|
||||||
|
</languages>
|
||||||
|
<commonModules>CommonModule.CommonModule</commonModules>
|
||||||
|
</mdclass:Configuration>
|
@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<cmi:CommandInterface xmlns:cmi="http://g5.1c.ru/v8/dt/cmi"/>
|
@ -27,6 +27,7 @@
|
|||||||
<module>com.e1c.v8codestyle.md.itests</module>
|
<module>com.e1c.v8codestyle.md.itests</module>
|
||||||
<module>com.e1c.v8codestyle.form.itests</module>
|
<module>com.e1c.v8codestyle.form.itests</module>
|
||||||
<module>com.e1c.v8codestyle.bsl.itests</module>
|
<module>com.e1c.v8codestyle.bsl.itests</module>
|
||||||
|
<module>com.e1c.v8codestyle.bsl.ui.itests</module>
|
||||||
<module>com.e1c.v8codestyle.autosort.itests</module>
|
<module>com.e1c.v8codestyle.autosort.itests</module>
|
||||||
<module>com.e1c.v8codestyle.ql.itests</module>
|
<module>com.e1c.v8codestyle.ql.itests</module>
|
||||||
<module>com.e1c.v8codestyle.right.itests</module>
|
<module>com.e1c.v8codestyle.right.itests</module>
|
||||||
|