1
0
mirror of https://github.com/1C-Company/v8-code-style.git synced 2024-11-28 09:33:06 +02:00

#1127 Добавить имя элемента формы в сообщение проверки form-list-ref-user-visibility-enabled (#1140)

This commit is contained in:
olgabozhko 2022-09-07 21:30:41 +07:00 committed by GitHub
parent 72662161d4
commit 2dbb67614c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 39 additions and 291 deletions

View File

@ -28,6 +28,7 @@
- У каждого события должна быть назначена своя процедура-обработчик
- Проверка заполнения заголовка поля динамического списка
- Реквизит "Ссылка" динамического списка не выведен в таблицу на форме
- Добавлено имя элемента формы в сообщение проверки form-list-ref-user-visibility-enabled
#### Код модулей

View File

@ -16,14 +16,17 @@ import static com._1c.g5.v8.dt.form.model.FormPackage.Literals.FORM;
import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.ADJUSTABLE_BOOLEAN;
import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.ADJUSTABLE_BOOLEAN__COMMON;
import java.text.MessageFormat;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.EcoreUtil2;
import com._1c.g5.v8.dt.form.model.AbstractDataPath;
import com._1c.g5.v8.dt.form.model.FormField;
import com._1c.g5.v8.dt.form.model.Table;
import com._1c.g5.v8.dt.metadata.mdclass.AdjustableBoolean;
import com.e1c.g5.v8.dt.check.CheckComplexity;
import com.e1c.g5.v8.dt.check.ICheckParameters;
@ -77,8 +80,12 @@ public class FormListRefUserVisibilityEnabledCheck
&& adjBoolean.eContainmentFeature().getName().equals(FEATURE_NAME)
&& pathCheck(adjBoolean.eContainer().eContents()))
{
FormField formField = (FormField)(adjBoolean.eContainer());
Table table = EcoreUtil2.getContainerOfType(formField.eContainer(), Table.class);
resultAceptor.addIssue(
Messages.FormListRefUserVisibilityEnabledCheck_User_visibility_is_not_disabled_for_the_Ref_field,
MessageFormat.format(
Messages.FormListRefUserVisibilityEnabledCheck_User_visibility_is_not_disabled_for_the_Ref_field,
formField.getName(), table.getName()),
ADJUSTABLE_BOOLEAN__COMMON);
}

View File

@ -39,7 +39,7 @@ FormListRefUseAlwaysFlagDisabledCheck_description = UseAlways flag is disabled f
FormListRefUseAlwaysFlagDisabledCheck_title = UseAlways flag is disabled for the Ref field
FormListRefUserVisibilityEnabledCheck_User_visibility_is_not_disabled_for_the_Ref_field = User visibility is not disabled for the Ref field
FormListRefUserVisibilityEnabledCheck_User_visibility_is_not_disabled_for_the_Ref_field = User visibility is not disabled for the Ref field ({0}) of the {1} table
FormListRefUserVisibilityEnabledCheck_description = User visibility is not disabled for the Ref field

View File

@ -39,7 +39,7 @@ FormListRefUseAlwaysFlagDisabledCheck_description = У реквизита "Сс
FormListRefUseAlwaysFlagDisabledCheck_title = У реквизита "Ссылка" динамического списка выключен признак "Использовать всегда"
FormListRefUserVisibilityEnabledCheck_User_visibility_is_not_disabled_for_the_Ref_field = У поля "Ссылка" таблицы динамического списка не отключена пользовательская видимость
FormListRefUserVisibilityEnabledCheck_User_visibility_is_not_disabled_for_the_Ref_field = У поля "Ссылка" ({0}) таблицы динамического списка {1} не отключена пользовательская видимость
FormListRefUserVisibilityEnabledCheck_description = У поля "Ссылка" таблицы динамического списка не отключена пользовательская видимость

View File

@ -18,6 +18,8 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.text.MessageFormat;
import org.eclipse.core.runtime.IProgressMonitor;
import org.junit.Test;
@ -48,6 +50,7 @@ public class FormListRefUserVisibilityEnabledCheckTest
private static final String PROJECT_NAME = "FormListRefUserVisibilityEnabled";
private static final String FQN_FORM_EN = "Catalog.TestCatalog.Form.TestListForm.Form";
private static final String FQN_FORM_RU = "Catalog.TestCatalog.Form.TestListFormRu.Form";
private static final String MESSAGE = "User visibility is not disabled for the Ref field ({0}) of the {1} table";
/**
* Test User Visibility is enabled for the Ref field in dynamic list (En Script variant).
@ -63,8 +66,17 @@ public class FormListRefUserVisibilityEnabledCheckTest
IBmObject object = getTopObjectByFqn(FQN_FORM_EN, dtProject);
assertTrue(object instanceof Form);
Form form = (Form)object;
FormItem item = form.getItems().get(1);
assertTrue(item instanceof Table);
Table table = (Table)item;
assertEquals("Ref", table.getItems().get(0).getName());
FormField fieldRef = (FormField)table.getItems().get(0);
Marker marker = getFirstNestedMarker(CHECK_ID, object.bmGetId(), dtProject);
assertNotNull(marker);
assertEquals(MessageFormat.format(MESSAGE, fieldRef.getName(), table.getName()), marker.getMessage());
}
/**

View File

@ -2,16 +2,16 @@
<Settings xmlns="http://v8.1c.ru/8.1/data-composition-system/settings" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:dcscor="http://v8.1c.ru/8.1/data-composition-system/core">
<filter>
<viewMode>Normal</viewMode>
<userSettingID>bd71abe7-6580-4c97-9411-e8ac65bf019a</userSettingID>
<userSettingID>7976e200-c9f1-4391-acc1-e0152e3e4671</userSettingID>
</filter>
<order>
<viewMode>Normal</viewMode>
<userSettingID>2fd2f731-62df-472a-826b-d5360bb235fd</userSettingID>
<userSettingID>52315527-1d82-40a3-ab2c-20d5d098e330</userSettingID>
</order>
<conditionalAppearance>
<viewMode>Normal</viewMode>
<userSettingID>d97169f7-9014-4ac5-a354-3e11dad469d5</userSettingID>
<userSettingID>fab88dcf-9198-4bc9-8847-6d1b8a753384</userSettingID>
</conditionalAppearance>
<itemsViewMode>Normal</itemsViewMode>
<itemsUserSettingID>c0d1a3e5-da13-401f-83fd-472b9f44cfd4</itemsUserSettingID>
<itemsUserSettingID>b1427821-eaf8-41d3-8287-6303aec6b682</itemsUserSettingID>
</Settings>

View File

@ -190,144 +190,6 @@
<autoMaxHeight>true</autoMaxHeight>
</extInfo>
</items>
<items xsi:type="form:FormField">
<name>DeletionMark</name>
<id>25</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<dataPath xsi:type="form:DataPath">
<segments>List.DeletionMark</segments>
</dataPath>
<extendedTooltip>
<name>DeletionMarkExtendedTooltip</name>
<id>27</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>DeletionMarkContextMenu</name>
<id>26</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<autoFill>true</autoFill>
</contextMenu>
<type>LabelField</type>
<editMode>Enter</editMode>
<showInHeader>true</showInHeader>
<headerHorizontalAlign>Left</headerHorizontalAlign>
<showInFooter>true</showInFooter>
<extInfo xsi:type="form:LabelFieldExtInfo">
<autoMaxWidth>true</autoMaxWidth>
<autoMaxHeight>true</autoMaxHeight>
</extInfo>
</items>
<items xsi:type="form:FormField">
<name>Predefined</name>
<id>28</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<dataPath xsi:type="form:DataPath">
<segments>List.Predefined</segments>
</dataPath>
<extendedTooltip>
<name>PredefinedExtendedTooltip</name>
<id>30</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>PredefinedContextMenu</name>
<id>29</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<autoFill>true</autoFill>
</contextMenu>
<type>LabelField</type>
<editMode>Enter</editMode>
<showInHeader>true</showInHeader>
<headerHorizontalAlign>Left</headerHorizontalAlign>
<showInFooter>true</showInFooter>
<extInfo xsi:type="form:LabelFieldExtInfo">
<autoMaxWidth>true</autoMaxWidth>
<autoMaxHeight>true</autoMaxHeight>
</extInfo>
</items>
<items xsi:type="form:FormField">
<name>PredefinedDataName</name>
<id>31</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<dataPath xsi:type="form:DataPath">
<segments>List.PredefinedDataName</segments>
</dataPath>
<extendedTooltip>
<name>PredefinedDataNameExtendedTooltip</name>
<id>33</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>PredefinedDataNameContextMenu</name>
<id>32</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<autoFill>true</autoFill>
</contextMenu>
<type>LabelField</type>
<editMode>Enter</editMode>
<showInHeader>true</showInHeader>
<headerHorizontalAlign>Left</headerHorizontalAlign>
<showInFooter>true</showInFooter>
<extInfo xsi:type="form:LabelFieldExtInfo">
<autoMaxWidth>true</autoMaxWidth>
<autoMaxHeight>true</autoMaxHeight>
</extInfo>
</items>
<commandBarLocation>None</commandBarLocation>
<autoCommandBar>
<name>ListCommandBar</name>
@ -450,7 +312,7 @@
<autoFill>true</autoFill>
</contextMenu>
<type>SearchControlAddition</type>
<source>List</source>
<source>ListSearchControl</source>
<extInfo xsi:type="form:SearchControlAdditionExtInfo">
<autoMaxWidth>true</autoMaxWidth>
</extInfo>

View File

@ -2,16 +2,16 @@
<Settings xmlns="http://v8.1c.ru/8.1/data-composition-system/settings" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:dcscor="http://v8.1c.ru/8.1/data-composition-system/core">
<filter>
<viewMode>Normal</viewMode>
<userSettingID>97952f95-4dbc-4780-94aa-ed36180dfe75</userSettingID>
<userSettingID>df84275e-2c13-4e49-ade8-34d180ac0412</userSettingID>
</filter>
<order>
<viewMode>Normal</viewMode>
<userSettingID>6fc772b9-08af-440c-9357-edc78ae0c9de</userSettingID>
<userSettingID>1003e849-7cca-46bd-8c4d-09ee76d6f460</userSettingID>
</order>
<conditionalAppearance>
<viewMode>Normal</viewMode>
<userSettingID>49c1de45-d0bf-4b19-ba58-550b7aa246fd</userSettingID>
<userSettingID>10325e8e-e236-498c-a589-2e6506b2fd05</userSettingID>
</conditionalAppearance>
<itemsViewMode>Normal</itemsViewMode>
<itemsUserSettingID>a7d0faf2-bbb5-4d74-9eef-db02b3771a67</itemsUserSettingID>
<itemsUserSettingID>d1b046cf-8120-4733-a4b4-774f064f927d</itemsUserSettingID>
</Settings>

View File

@ -190,144 +190,6 @@
<autoMaxHeight>true</autoMaxHeight>
</extInfo>
</items>
<items xsi:type="form:FormField">
<name>ПометкаУдаления</name>
<id>25</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<dataPath xsi:type="form:DataPath">
<segments>Список.DeletionMark</segments>
</dataPath>
<extendedTooltip>
<name>ПометкаУдаленияРасширеннаяПодсказка</name>
<id>27</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>ПометкаУдаленияКонтекстноеМеню</name>
<id>26</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<autoFill>true</autoFill>
</contextMenu>
<type>LabelField</type>
<editMode>Enter</editMode>
<showInHeader>true</showInHeader>
<headerHorizontalAlign>Left</headerHorizontalAlign>
<showInFooter>true</showInFooter>
<extInfo xsi:type="form:LabelFieldExtInfo">
<autoMaxWidth>true</autoMaxWidth>
<autoMaxHeight>true</autoMaxHeight>
</extInfo>
</items>
<items xsi:type="form:FormField">
<name>Предопределенный</name>
<id>28</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<dataPath xsi:type="form:DataPath">
<segments>Список.Predefined</segments>
</dataPath>
<extendedTooltip>
<name>ПредопределенныйРасширеннаяПодсказка</name>
<id>30</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>ПредопределенныйКонтекстноеМеню</name>
<id>29</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<autoFill>true</autoFill>
</contextMenu>
<type>LabelField</type>
<editMode>Enter</editMode>
<showInHeader>true</showInHeader>
<headerHorizontalAlign>Left</headerHorizontalAlign>
<showInFooter>true</showInFooter>
<extInfo xsi:type="form:LabelFieldExtInfo">
<autoMaxWidth>true</autoMaxWidth>
<autoMaxHeight>true</autoMaxHeight>
</extInfo>
</items>
<items xsi:type="form:FormField">
<name>ИмяПредопределенныхДанных</name>
<id>31</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<dataPath xsi:type="form:DataPath">
<segments>Список.PredefinedDataName</segments>
</dataPath>
<extendedTooltip>
<name>ИмяПредопределенныхДанныхРасширеннаяПодсказка</name>
<id>33</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>ИмяПредопределенныхДанныхКонтекстноеМеню</name>
<id>32</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<autoFill>true</autoFill>
</contextMenu>
<type>LabelField</type>
<editMode>Enter</editMode>
<showInHeader>true</showInHeader>
<headerHorizontalAlign>Left</headerHorizontalAlign>
<showInFooter>true</showInFooter>
<extInfo xsi:type="form:LabelFieldExtInfo">
<autoMaxWidth>true</autoMaxWidth>
<autoMaxHeight>true</autoMaxHeight>
</extInfo>
</items>
<commandBarLocation>None</commandBarLocation>
<autoCommandBar>
<name>СписокКоманднаяПанель</name>
@ -450,7 +312,7 @@
<autoFill>true</autoFill>
</contextMenu>
<type>SearchControlAddition</type>
<source>Список</source>
<source>СписокУправлениеПоиском</source>
<extInfo xsi:type="form:SearchControlAdditionExtInfo">
<autoMaxWidth>true</autoMaxWidth>
</extInfo>

View File

@ -19,6 +19,10 @@
<createOnInput>Use</createOnInput>
<dataLockControlMode>Managed</dataLockControlMode>
<fullTextSearch>Use</fullTextSearch>
<objectPresentation>
<key>en</key>
<value>1</value>
</objectPresentation>
<levelCount>2</levelCount>
<foldersOnTop>true</foldersOnTop>
<codeLength>9</codeLength>
@ -31,7 +35,7 @@
<editType>InDialog</editType>
<choiceMode>BothWays</choiceMode>
<defaultListForm>Catalog.TestCatalog.Form.TestListForm</defaultListForm>
<forms uuid="062f3d00-5d12-48bc-90ca-dd71e88247ed">
<forms uuid="682d0d68-35de-4f17-a022-eba051f730de">
<name>TestListForm</name>
<synonym>
<key>en</key>
@ -40,7 +44,7 @@
<usePurposes>PersonalComputer</usePurposes>
<usePurposes>MobileDevice</usePurposes>
</forms>
<forms uuid="44347602-480a-4345-9bfd-31c6eda4ac64">
<forms uuid="cb9b45f8-7cf0-4bc0-96fa-c4aa3fddf7e2">
<name>TestListFormRu</name>
<synonym>
<key>en</key>