1
0
mirror of https://github.com/1C-Company/v8-code-style.git synced 2026-05-18 18:11:05 +02:00

#1 Перенос бандла проверок по формам (#39)

This commit is contained in:
Dmitriy Marmyshev
2021-08-18 11:07:16 +03:00
committed by GitHub
parent 91f07cf802
commit 484742fd7f
41 changed files with 1093 additions and 0 deletions
@@ -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
View File
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.e1c.v8codestyle.form</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,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
@@ -0,0 +1,23 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: com.e1c.v8codestyle.form;singleton:=true
Bundle-Version: 0.1.0.qualifier
Bundle-Activator: com.e1c.v8codestyle.internal.form.CorePlugin
Bundle-Vendor: %providerName
Require-Bundle: 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)"
Bundle-RequiredExecutionEnvironment: JavaSE-11
Automatic-Module-Name: com.e1c.v8codestyle.form
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Import-Package: com._1c.g5.v8.bm.core;version="[7.5.0,8.0.0)",
com._1c.g5.v8.dt.core.platform;version="[10.4.0,11.0.0)",
com._1c.g5.v8.dt.form.model;version="[9.0.0,10.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.e1c.g5.v8.dt.check;version="[1.0.0,2.0.0)",
com.e1c.g5.v8.dt.check.components;version="[1.0.0,2.0.0)",
com.e1c.g5.v8.dt.check.settings;version="[1.0.0,2.0.0)",
com.google.inject;version="[1.3.0,2.0.0)"
@@ -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,\
plugin.properties,\
check.descriptions/,\
plugin_ru.properties
@@ -0,0 +1,3 @@
*.html
*.css
*.js
@@ -0,0 +1,10 @@
# input-field-list-choice-mode
Check input field has correct list choice mode if choice list is not empty.
## Noncompliant Code Example
## Compliant Solution
## See
@@ -0,0 +1,11 @@
# input-field-list-choice-mode
В полях форм со списками выбора следует всегда устанавливать свойство **РежимВыбораИзСписка** в значение Истина. В этом случае, в поле будет корректно выводиться локализуемое представление, а не значение из списка выбора.
## Неправильно
## Правильно
## См.
https://its.1c.ru/db/v8std#content:765:hdoc
@@ -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.form
category.form.description = Form model checks (*.form files) by standards
category.form.title = Form checks by standards
pluginName = 1C:Code style V8 Form plugin
providerName = 1C-Soft LLC
@@ -0,0 +1,31 @@
<?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="com.e1c.g5.v8.dt.check.checks">
<category
category="com.e1c.v8codestyle"
description="%category.form.description"
id="com.e1c.v8codestyle.form"
title="%category.form.title">
</category>
<check
category="com.e1c.v8codestyle.form"
class="com.e1c.v8codestyle.internal.form.ExecutableExtensionFactory:com.e1c.v8codestyle.form.check.InputFieldListChoiceMode">
</check>
</extension>
</plugin>
@@ -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/)
category.form.description = Проверки модели формы (файлы *.form) по стандартам
category.form.title = Проверки формы по стандартам
pluginName = 1С:Стандарты разработки V8 Плагин метаданных
providerName = ООО "1С-Софт"
+68
View File
@@ -0,0 +1,68 @@
<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<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.form</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
<!-- base dir of bom module: bom/parent/bundle/this-module -->
<markdown.page.generator.html.file.path>${project.parent.parent.parent.basedir}</markdown.page.generator.html.file.path>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.ruleoftech</groupId>
<artifactId>markdown-page-generator-plugin</artifactId>
<configuration>
<inputDirectory>${project.basedir}/markdown</inputDirectory>
<outputDirectory>${project.basedir}/check.descriptions</outputDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copy-resource-files</id>
<phase>generate-sources</phase>
<configuration>
<target>
<property name="source" value="${project.basedir}/../../bom"/>
<copy toDir="${project.basedir}/check.descriptions/css">
<fileset dir="${source}/html/css" />
</copy>
<copy toDir="${project.basedir}/check.descriptions/js">
<fileset dir="${source}/html/js" />
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,72 @@
/*******************************************************************************
* 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.form.check;
import static com._1c.g5.v8.dt.form.model.FormPackage.Literals.FORM;
import static com._1c.g5.v8.dt.form.model.FormPackage.Literals.INPUT_FIELD_EXT_INFO;
import static com._1c.g5.v8.dt.form.model.FormPackage.Literals.INPUT_FIELD_EXT_INFO__CHOICE_LIST;
import static com._1c.g5.v8.dt.form.model.FormPackage.Literals.INPUT_FIELD_EXT_INFO__LIST_CHOICE_MODE;
import org.eclipse.core.runtime.IProgressMonitor;
import com._1c.g5.v8.dt.form.model.InputFieldExtInfo;
import com.e1c.g5.v8.dt.check.CheckComplexity;
import com.e1c.g5.v8.dt.check.ICheckParameters;
import com.e1c.g5.v8.dt.check.components.BasicCheck;
import com.e1c.g5.v8.dt.check.settings.IssueSeverity;
import com.e1c.g5.v8.dt.check.settings.IssueType;
/**
* Check input field has correct list choice mode if choice list is not empty.
*
* @author Dmitriy Marmyshev
*/
public final class InputFieldListChoiceMode
extends BasicCheck
{
private static final String CHECK_ID = "input-field-list-choice-mode"; //$NON-NLS-1$
@Override
public String getCheckId()
{
return CHECK_ID;
}
@Override
protected void configureCheck(CheckConfigurer builder)
{
builder.title(Messages.InputFieldListChoiceMode_title)
.description(Messages.InputFieldListChoiceMode_description)
.complexity(CheckComplexity.NORMAL)
.severity(IssueSeverity.MINOR)
.issueType(IssueType.UI_STYLE)
.topObject(FORM)
.containment(INPUT_FIELD_EXT_INFO)
.features(INPUT_FIELD_EXT_INFO__LIST_CHOICE_MODE, INPUT_FIELD_EXT_INFO__CHOICE_LIST);
}
@Override
protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters,
IProgressMonitor monitor)
{
InputFieldExtInfo extInfo = (InputFieldExtInfo)object;
if (!extInfo.getChoiceList().isEmpty() && !extInfo.isListChoiceMode())
{
resultAceptor.addIssue(
Messages.InputFieldListChoiceMode_Form_input_field_the_list_choice_mode_not_set_with_filled_choice_list,
INPUT_FIELD_EXT_INFO__LIST_CHOICE_MODE);
}
}
}
@@ -0,0 +1,37 @@
/*******************************************************************************
* 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.form.check;
import org.eclipse.osgi.util.NLS;
/**
* @author Dmitriy Marmyshev
*
*/
final class Messages
extends NLS
{
private static final String BUNDLE_NAME = "com.e1c.v8codestyle.form.check.messages"; //$NON-NLS-1$
public static String InputFieldListChoiceMode_description;
public static String InputFieldListChoiceMode_Form_input_field_the_list_choice_mode_not_set_with_filled_choice_list;
public static String InputFieldListChoiceMode_title;
static
{
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
private Messages()
{
}
}
@@ -0,0 +1,19 @@
#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
###############################################################################
InputFieldListChoiceMode_Form_input_field_the_list_choice_mode_not_set_with_filled_choice_list = Form input field the "list choice mode" not set with filled choice list
InputFieldListChoiceMode_description = Check input field has correct list choice mode if choice list is not empty
InputFieldListChoiceMode_title = Form input field list choice mode
@@ -0,0 +1,20 @@
#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/)
InputFieldListChoiceMode_Form_input_field_the_list_choice_mode_not_set_with_filled_choice_list = У поля ввода формы с заполненным списком выбора отключено свойство "Режим выбора из списка"
InputFieldListChoiceMode_description = Проверяет, что поле ввода содержит корректный режим ввыбора из списка, если список выбора заполнен
InputFieldListChoiceMode_title = Режим выбора из списка поля ввода формы
@@ -0,0 +1,167 @@
/*******************************************************************************
* 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.form;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext;
import com.google.inject.Guice;
import com.google.inject.Injector;
/**
* Plugin activator. The activator class controls the plugin life cycle.
*
* @author Dmitriy Marmyshev
*/
public class CorePlugin
extends Plugin
{
public static final String PLUGIN_ID = "com.e1c.v8codestyle.form"; //$NON-NLS-1$
private static CorePlugin plugin;
private Injector injector;
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static CorePlugin 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);
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
@Override
public void start(BundleContext bundleContext) throws Exception
{
super.start(bundleContext);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
@Override
public void stop(BundleContext bundleContext) throws Exception
{
plugin = null;
injector = null;
super.stop(bundleContext);
}
/**
* Returns Guice injector for this plugin.
*
* @return Guice injector for this plugin, never <code>null</code>
*/
/* package */ Injector getInjector()
{
Injector localInstance = injector;
if (localInstance == null)
{
synchronized (CorePlugin.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);
}
}
}
@@ -0,0 +1,39 @@
/*******************************************************************************
* 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.form;
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 CorePlugin.getDefault().getBundle();
}
@Override
protected Injector getInjector()
{
return CorePlugin.getDefault().getInjector();
}
}
@@ -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.form;
import org.eclipse.core.runtime.Plugin;
import com._1c.g5.v8.dt.core.platform.IV8ProjectManager;
import com._1c.g5.wiring.AbstractServiceAwareModule;
/**
* External services bindings for plugin.
*
* @author Dmitriy Marmyshev
*
*/
public class ExternalDependenciesModule
extends AbstractServiceAwareModule
{
/**
* @param plugin
*/
public ExternalDependenciesModule(Plugin plugin)
{
super(plugin);
}
@Override
protected void doConfigure()
{
bind(IV8ProjectManager.class).toService();
}
}
+1
View File
@@ -25,6 +25,7 @@
<modules>
<module>com.e1c.v8codestyle</module>
<module>com.e1c.v8codestyle.md</module>
<module>com.e1c.v8codestyle.form</module>
<module>com.e1c.v8codestyle.bsl</module>
<module>com.e1c.v8codestyle.autosort</module>
<module>com.e1c.v8codestyle.autosort.ui</module>
@@ -46,6 +46,13 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.e1c.v8codestyle.form"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.e1c.v8codestyle.ql"
download-size="0"
@@ -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>
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.e1c.v8codestyle.form.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
@@ -0,0 +1,19 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: com.e1c.v8codestyle.form.itests;singleton:=true
Bundle-Version: 0.1.0.qualifier
Bundle-Vendor: %providerName
Fragment-Host: com.e1c.v8codestyle.form;bundle-version="[0.1.0,0.2.0)"
Automatic-Module-Name: com.e1c.v8codestyle.form.itests
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-Localization: fragment
Import-Package: com._1c.g5.v8.bm.integration;version="[9.1.0,10.0.0)",
com._1c.g5.v8.dt.core.platform;version="[10.3.0,11.0.0)",
com._1c.g5.v8.dt.mcore;version="[6.3.0,7.0.0)",
com._1c.g5.v8.dt.metadata.mdclass;version="[8.7.0,9.0.0)",
com._1c.g5.v8.dt.testing;version="[3.1.0,4.0.0)",
com._1c.g5.v8.dt.validation.marker;version="[4.0.0,5.0.0)",
com.e1c.g5.v8.dt.testing.check;version="[1.0.0,2.0.0)",
org.junit;version="[4.13.0,5.0.0)"
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.13.0,4.0.0)"
@@ -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/,\
.,\
fragment.properties,\
workspace/
@@ -0,0 +1,18 @@
#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.form.itests
pluginName = 1C:Code style V8 Form Integration test plugin
providerName = 1C-Soft LLC
@@ -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.form.itests</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
</project>
@@ -0,0 +1,116 @@
/*******************************************************************************
* 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.form.itests;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.eclipse.core.runtime.IProgressMonitor;
import org.junit.Test;
import com._1c.g5.v8.bm.core.IBmObject;
import com._1c.g5.v8.bm.core.IBmTransaction;
import com._1c.g5.v8.bm.integration.AbstractBmTask;
import com._1c.g5.v8.bm.integration.IBmModel;
import com._1c.g5.v8.dt.core.platform.IDtProject;
import com._1c.g5.v8.dt.form.model.FieldExtInfo;
import com._1c.g5.v8.dt.form.model.Form;
import com._1c.g5.v8.dt.form.model.FormField;
import com._1c.g5.v8.dt.form.model.FormItem;
import com._1c.g5.v8.dt.form.model.InputFieldExtInfo;
import com._1c.g5.v8.dt.validation.marker.Marker;
import com.e1c.g5.v8.dt.testing.check.CheckTestBase;
import com.e1c.v8codestyle.form.check.InputFieldListChoiceMode;
/**
* Tests for {@link InputFieldListChoiceMode} check.
*
* @author Dmitriy Marmyshev
*/
public class InputFieldListChoiceModeTest
extends CheckTestBase
{
private static final String CHECK_ID = "input-field-list-choice-mode";
private static final String PROJECT_NAME = "InputFieldListChoiceMode";
private static final String FQN_FORM = "CommonForm.Form.Form";
/**
* Test the form input field list choice mode not set
*
* @throws Exception the exception
*/
@Test
public void testFormInputFieldListChoiceModeNotSet() throws Exception
{
IDtProject dtProject = openProjectAndWaitForValidationFinish(PROJECT_NAME);
assertNotNull(dtProject);
IBmObject object = getTopObjectByFqn(FQN_FORM, dtProject);
assertTrue(object instanceof Form);
Form form = (Form)object;
InputFieldExtInfo extInfo = getItemExtInfo(form);
Marker marker = getFirstMarker(CHECK_ID, extInfo, dtProject);
assertNotNull(marker);
}
/**
* Test form input field list choice mode set.
*
* @throws Exception the exception
*/
@Test
public void testFormInputFieldListChoiceModeSet() throws Exception
{
IDtProject dtProject = openProjectAndWaitForValidationFinish(PROJECT_NAME);
assertNotNull(dtProject);
IBmModel model = bmModelManager.getModel(dtProject);
model.execute(new AbstractBmTask<Void>("change mode")
{
@Override
public Void execute(IBmTransaction transaction, IProgressMonitor monitor)
{
Form form = (Form)transaction.getTopObjectByFqn(FQN_FORM);
InputFieldExtInfo extInfo;
extInfo = getItemExtInfo(form);
extInfo.setListChoiceMode(true);
return null;
}
});
waitForDD(dtProject);
IBmObject object = getTopObjectByFqn(FQN_FORM, dtProject);
assertTrue(object instanceof Form);
Form form = (Form)object;
InputFieldExtInfo extInfo = getItemExtInfo(form);
Marker marker = getFirstMarker(CHECK_ID, extInfo, dtProject);
assertNull(marker);
}
private InputFieldExtInfo getItemExtInfo(Form form)
{
assertEquals(1, form.getItems().size());
FormItem item = form.getItems().get(0);
assertTrue(item instanceof FormField);
FieldExtInfo extInfo = ((FormField)item).getExtInfo();
assertTrue(extInfo instanceof InputFieldExtInfo);
return (InputFieldExtInfo)extInfo;
}
}
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>InputFieldListChoiceMode</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
topObjects=true
@@ -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,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<form:Form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:core="http://g5.1c.ru/v8/dt/mcore" xmlns:form="http://g5.1c.ru/v8/dt/form">
<items xsi:type="form:FormField">
<name>Attribute1</name>
<id>1</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<dataPath xsi:type="form:DataPath">
<segments>Attribute1</segments>
</dataPath>
<extendedTooltip>
<name>Attribute1ExtendedTooltip</name>
<id>3</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<type>Label</type>
<autoMaxWidth>true</autoMaxWidth>
<autoMaxHeight>true</autoMaxHeight>
<extInfo xsi:type="form:LabelDecorationExtInfo">
<horizontalAlign>Left</horizontalAlign>
</extInfo>
</extendedTooltip>
<contextMenu>
<name>Attribute1ContextMenu</name>
<id>2</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<autoFill>true</autoFill>
</contextMenu>
<type>InputField</type>
<editMode>Enter</editMode>
<showInHeader>true</showInHeader>
<headerHorizontalAlign>Left</headerHorizontalAlign>
<showInFooter>true</showInFooter>
<extInfo xsi:type="form:InputFieldExtInfo">
<autoMaxWidth>true</autoMaxWidth>
<autoMaxHeight>true</autoMaxHeight>
<wrap>true</wrap>
<chooseType>true</chooseType>
<typeDomainEnabled>true</typeDomainEnabled>
<textEdit>true</textEdit>
<choiceList>
<presentation>
<key>en</key>
<value>Presentation 1</value>
</presentation>
<value xsi:type="core:StringValue">
<value>Value1</value>
</value>
</choiceList>
<choiceList>
<presentation>
<key>en</key>
<value>Presentation 2</value>
</presentation>
<value xsi:type="core:StringValue">
<value>Value2</value>
</value>
</choiceList>
</extInfo>
</items>
<autoCommandBar>
<name>FormCommandBar</name>
<id>-1</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<horizontalAlign>Left</horizontalAlign>
<autoFill>true</autoFill>
</autoCommandBar>
<autoTitle>true</autoTitle>
<autoUrl>true</autoUrl>
<group>Vertical</group>
<autoFillCheck>true</autoFillCheck>
<allowFormCustomize>true</allowFormCustomize>
<enabled>true</enabled>
<showTitle>true</showTitle>
<showCloseButton>true</showCloseButton>
<attributes>
<name>Attribute1</name>
<id>1</id>
<valueType>
<types>String</types>
<stringQualifiers/>
</valueType>
<view>
<common>true</common>
</view>
<edit>
<common>true</common>
</edit>
</attributes>
<commandInterface>
<navigationPanel/>
<commandBar/>
</commandInterface>
</form:Form>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<mdclass:CommonForm xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="b668fde9-5661-49e1-8806-14c85a885dd2">
<name>Form</name>
<synonym>
<key>en</key>
<value>Form</value>
</synonym>
<usePurposes>PersonalComputer</usePurposes>
<usePurposes>MobileDevice</usePurposes>
</mdclass:CommonForm>
@@ -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="f13c79ad-d0cf-4123-87ef-9c03d286cae7">
<name>InputFieldListChoiceMode</name>
<synonym>
<key>en</key>
<value>Input field list choice mode</value>
</synonym>
<containedObjects classId="9cd510cd-abfc-11d4-9434-004095e12fc7" objectId="9bf67adc-f1d4-4270-8e82-8678710e6389"/>
<containedObjects classId="9fcd25a0-4822-11d4-9414-008048da11f9" objectId="4096e085-6238-4064-bba5-c90d7836f4e2"/>
<containedObjects classId="e3687481-0a87-462c-a166-9f34594f9bba" objectId="b591524d-a01b-4db0-975f-1e36535145a3"/>
<containedObjects classId="9de14907-ec23-4a07-96f0-85521cb6b53b" objectId="9085070a-fa92-48b0-9949-2daf15022210"/>
<containedObjects classId="51f2d5d8-ea4d-4064-8892-82951750031e" objectId="b4c85945-545f-4969-958d-2b6aae5537e4"/>
<containedObjects classId="e68182ea-4237-4383-967f-90c1e3370bc7" objectId="fe4761ea-5da1-4bfc-ba06-498276b131e6"/>
<containedObjects classId="fb282519-d103-4dd3-bc12-cb271d631dfc" objectId="c8cdb71e-9e64-483a-b320-825652d4a080"/>
<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="96daf0f5-700a-49c8-a168-677696e353d0">
<name>English</name>
<synonym>
<key>en</key>
<value>English</value>
</synonym>
<languageCode>en</languageCode>
</languages>
<commonForms>CommonForm.Form</commonForms>
</mdclass:Configuration>
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<cmi:CommandInterface xmlns:cmi="http://g5.1c.ru/v8/dt/cmi"/>
+1
View File
@@ -25,6 +25,7 @@
<modules>
<module>com.e1c.v8codestyle.md.itests</module>
<module>com.e1c.v8codestyle.form.itests</module>
<module>com.e1c.v8codestyle.bsl.itests</module>
<module>com.e1c.v8codestyle.autosort.itests</module>
<module>com.e1c.v8codestyle.ql.itests</module>