From 30cd1455d103e35c259e43f9a91508327e84fd75 Mon Sep 17 00:00:00 2001 From: Olga Bozhko Date: Wed, 25 May 2022 00:12:48 +0700 Subject: [PATCH 1/4] =?UTF-8?q?#266=20=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=BE=20=D0=BB=D0=BE=D0=B6=D0=BD=D0=BE=D0=B5?= =?UTF-8?q?=20=D1=81=D1=80=D0=B0=D0=B1=D0=B0=D1=82=D1=8B=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../META-INF/MANIFEST.MF | 1 + ...FormListRefUseAlwaysFlagDisabledCheck.java | 67 +-- ...ListRefUseAlwaysFlagDisabledCheckTest.java | 120 +++- .../TestCatalog/Forms/TestListForm/Form.form | 4 +- .../Список/ExtInfo/ListSettings.dcss | 17 + .../Forms/TestListFormRu/Form.form | 562 ++++++++++++++++++ .../src/Catalogs/TestCatalog/TestCatalog.mdo | 9 + .../src/Configuration/Configuration.mdo | 1 + .../Attributes/List/ExtInfo/ListSettings.dcss | 17 + .../Forms/TestListForm/Form.form | 334 +++++++++++ .../TestInformationRegister.mdo | 53 ++ 11 files changed, 1132 insertions(+), 53 deletions(-) create mode 100644 tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Catalogs/TestCatalog/Forms/TestListFormRu/Attributes/Список/ExtInfo/ListSettings.dcss create mode 100644 tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Catalogs/TestCatalog/Forms/TestListFormRu/Form.form create mode 100644 tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/InformationRegisters/TestInformationRegister/Forms/TestListForm/Attributes/List/ExtInfo/ListSettings.dcss create mode 100644 tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/InformationRegisters/TestInformationRegister/Forms/TestListForm/Form.form create mode 100644 tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/InformationRegisters/TestInformationRegister/TestInformationRegister.mdo diff --git a/bundles/com.e1c.v8codestyle.form/META-INF/MANIFEST.MF b/bundles/com.e1c.v8codestyle.form/META-INF/MANIFEST.MF index 397295aa..3494a3f4 100644 --- a/bundles/com.e1c.v8codestyle.form/META-INF/MANIFEST.MF +++ b/bundles/com.e1c.v8codestyle.form/META-INF/MANIFEST.MF @@ -18,6 +18,7 @@ Import-Package: com._1c.g5.v8.bm.core;version="[7.5.0,8.0.0)", com._1c.g5.v8.dt.form.model;version="[10.0.0,11.0.0)", com._1c.g5.v8.dt.form.service.datasourceinfo;version="[3.0.0,4.0.0)", com._1c.g5.v8.dt.mcore;version="[6.0.0,7.0.0)", + com._1c.g5.v8.dt.metadata.dbview;version="4.0.0", com._1c.g5.v8.dt.metadata.mdclass;version="[8.0.0,9.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)", diff --git a/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java b/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java index 63348bda..6d8a1504 100644 --- a/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java +++ b/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java @@ -25,6 +25,8 @@ import org.eclipse.emf.common.util.EList; import com._1c.g5.v8.dt.form.model.AbstractDataPath; import com._1c.g5.v8.dt.form.model.DynamicListExtInfo; import com._1c.g5.v8.dt.form.model.FormAttribute; +import com._1c.g5.v8.dt.metadata.dbview.DbViewFieldDef; +import com._1c.g5.v8.dt.metadata.dbview.DbViewTableDef; 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; @@ -46,6 +48,27 @@ public class FormListRefUseAlwaysFlagDisabledCheck private static final List REF_ABSTRACT_DATA_PATH = List.of("List", "Ref"); //$NON-NLS-1$ //$NON-NLS-2$ private static final List REF_ABSTRACT_DATA_PATH_RU = List.of("Список", "Ссылка"); //$NON-NLS-1$ //$NON-NLS-2$ + private static final Predicate nameCheck = + name -> name.getName().equals(REF_ABSTRACT_DATA_PATH.get(1)); + + private static Predicate pathCheck = path -> { + EList segments = path.getSegments(); + + if (segments.size() != 2) + { + return false; + } + + if (!segments.get(0).equals(REF_ABSTRACT_DATA_PATH.get(0)) + && !segments.get(0).equals(REF_ABSTRACT_DATA_PATH_RU.get(0))) + { + return false; + } + + return segments.get(1).equals(REF_ABSTRACT_DATA_PATH.get(1)) + || segments.get(1).equals(REF_ABSTRACT_DATA_PATH_RU.get(1)); + }; + @Override public String getCheckId() { @@ -58,7 +81,7 @@ public class FormListRefUseAlwaysFlagDisabledCheck builder.title(Messages.FormListRefUseAlwaysFlagDisabledCheck_title) .description(Messages.FormListRefUseAlwaysFlagDisabledCheck_description) .complexity(CheckComplexity.NORMAL) - .severity(IssueSeverity.MAJOR) + .severity(IssueSeverity.MINOR) .issueType(IssueType.UI_STYLE) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .topObject(FORM) @@ -70,41 +93,17 @@ public class FormListRefUseAlwaysFlagDisabledCheck protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters, IProgressMonitor monitor) { - - if (monitor.isCanceled() || !(object instanceof FormAttribute)) - { - return; - } - FormAttribute formAttribute = (FormAttribute)object; - if (formAttribute.getExtInfo() instanceof DynamicListExtInfo - && formAttribute.getNotDefaultUseAlwaysAttributes().stream().noneMatch(pathCheck)) + if (formAttribute.getExtInfo() instanceof DynamicListExtInfo) { - resultAceptor.addIssue( - Messages.FormListRefUseAlwaysFlagDisabledCheck_UseAlways_flag_is_disabled_for_the_Ref_field, - formAttribute); + DbViewTableDef tableDef = (DbViewTableDef)((DynamicListExtInfo)formAttribute.getExtInfo()).getMainTable(); + if (tableDef.getFields().stream().anyMatch(nameCheck) + && formAttribute.getNotDefaultUseAlwaysAttributes().stream().noneMatch(pathCheck)) + { + resultAceptor.addIssue( + Messages.FormListRefUseAlwaysFlagDisabledCheck_UseAlways_flag_is_disabled_for_the_Ref_field, + FORM_ATTRIBUTE__NOT_DEFAULT_USE_ALWAYS_ATTRIBUTES); + } } - } - - private Predicate pathCheck = path -> { - EList segments = path.getSegments(); - if (segments.size() != 2) - { - return false; - } - - if (!segments.get(0).equals(REF_ABSTRACT_DATA_PATH.get(0)) - && !segments.get(0).equals(REF_ABSTRACT_DATA_PATH_RU.get(0))) - { - return false; - } - if (!segments.get(1).equals(REF_ABSTRACT_DATA_PATH.get(1)) - && !segments.get(1).equals(REF_ABSTRACT_DATA_PATH_RU.get(1))) - { - return false; - } - return true; - }; - } diff --git a/tests/com.e1c.v8codestyle.form.itests/src/com/e1c/v8codestyle/form/check/itests/FormListRefUseAlwaysFlagDisabledCheckTest.java b/tests/com.e1c.v8codestyle.form.itests/src/com/e1c/v8codestyle/form/check/itests/FormListRefUseAlwaysFlagDisabledCheckTest.java index 61742b95..fac388f7 100644 --- a/tests/com.e1c.v8codestyle.form.itests/src/com/e1c/v8codestyle/form/check/itests/FormListRefUseAlwaysFlagDisabledCheckTest.java +++ b/tests/com.e1c.v8codestyle.form.itests/src/com/e1c/v8codestyle/form/check/itests/FormListRefUseAlwaysFlagDisabledCheckTest.java @@ -12,7 +12,8 @@ *******************************************************************************/ package com.e1c.v8codestyle.form.check.itests; -import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.CONFIGURATION; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; @@ -30,8 +31,6 @@ import com._1c.g5.v8.dt.form.model.DataPath; import com._1c.g5.v8.dt.form.model.Form; import com._1c.g5.v8.dt.form.model.FormItem; import com._1c.g5.v8.dt.form.model.Table; -import com._1c.g5.v8.dt.metadata.mdclass.Configuration; -import com._1c.g5.v8.dt.metadata.mdclass.ScriptVariant; import com._1c.g5.v8.dt.validation.marker.Marker; import com.e1c.g5.v8.dt.testing.check.CheckTestBase; import com.e1c.v8codestyle.form.check.FormListRefUseAlwaysFlagDisabledCheck; @@ -46,11 +45,13 @@ public class FormListRefUseAlwaysFlagDisabledCheckTest { private static final String CHECK_ID = "form-list-ref-use-always-flag-disabled"; private static final String PROJECT_NAME = "FormListRefUseAlwaysFlagDisabled"; - private static final String FQN_FORM = "Catalog.TestCatalog.Form.TestListForm.Form"; + 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 FQN_NON_OBJECT = "InformationRegister.TestInformationRegister.Form.TestListForm.Form"; /** - * Test Use Always flag is disabled for the Reference attribute in dynamic list (En Script variant). + * Test Use Always flag is disabled for the Reference attribute in dynamic list (En variant). * * @throws Exception the exception */ @@ -60,15 +61,18 @@ public class FormListRefUseAlwaysFlagDisabledCheckTest IDtProject dtProject = openProjectAndWaitForValidationFinish(PROJECT_NAME); assertNotNull(dtProject); - IBmObject object = getTopObjectByFqn(FQN_FORM, dtProject); + IBmObject object = getTopObjectByFqn(FQN_FORM_EN, dtProject); assertTrue(object instanceof Form); + Form form = (Form)object; + assertTrue(form.getAttributes().get(0).getNotDefaultUseAlwaysAttributes().isEmpty()); + Marker marker = getFirstNestedMarker(CHECK_ID, object.bmGetId(), dtProject); assertNotNull(marker); } /** - * Test Use Always flag is enabled for the Reference attribute in dynamic list (En Script variant). + * Test Use Always flag is enabled for the Reference attribute in dynamic list (En variant). * * @throws Exception the exception */ @@ -84,25 +88,27 @@ public class FormListRefUseAlwaysFlagDisabledCheckTest @Override public Void execute(IBmTransaction transaction, IProgressMonitor monitor) { - Form form = (Form)transaction.getTopObjectByFqn(FQN_FORM); + Form form = (Form)transaction.getTopObjectByFqn(FQN_FORM_EN); FormItem item = form.getItems().get(1); assertTrue(item instanceof Table); Table table = (Table)item; AbstractDataPath path = (DataPath)table.getItems().get(0).eContents().get(1); form.getAttributes().get(0).getNotDefaultUseAlwaysAttributes().add(path); + assertFalse(form.getAttributes().get(0).getNotDefaultUseAlwaysAttributes().isEmpty()); return null; } }); waitForDD(dtProject); - IBmObject object = getTopObjectByFqn(FQN_FORM, dtProject); + IBmObject object = getTopObjectByFqn(FQN_FORM_EN, dtProject); assertTrue(object instanceof Form); + Marker marker = getFirstNestedMarker(CHECK_ID, object.bmGetId(), dtProject); assertNull(marker); } /** - * Test Use Always flag is disabled for the Reference attribute in dynamic list (Ru script variant). + * Test Use Always flag is disabled for the Reference attribute in dynamic list (Ru variant). * * @throws Exception the exception */ @@ -112,23 +118,105 @@ public class FormListRefUseAlwaysFlagDisabledCheckTest IDtProject dtProject = openProjectAndWaitForValidationFinish(PROJECT_NAME); assertNotNull(dtProject); + IBmObject object = getTopObjectByFqn(FQN_FORM_RU, dtProject); + assertTrue(object instanceof Form); + + Form form = (Form)object; + assertTrue(form.getAttributes().get(0).getNotDefaultUseAlwaysAttributes().isEmpty()); + + Marker marker = getFirstNestedMarker(CHECK_ID, object.bmGetId(), dtProject); + assertNotNull(marker); + } + + /** + * Test Use Always flag is enabled for the Reference attribute in dynamic list (Ru variant). + * + * @throws Exception the exception + */ + @Test + public void testUseAlwaysEnabledForRefRu() throws Exception + { + IDtProject dtProject = openProjectAndWaitForValidationFinish(PROJECT_NAME); + assertNotNull(dtProject); + IBmModel model = bmModelManager.getModel(dtProject); model.execute(new AbstractBmTask("change mode") { @Override public Void execute(IBmTransaction transaction, IProgressMonitor monitor) { - IBmObject object = transaction.getTopObjectByFqn(CONFIGURATION.getName()); - assertTrue(object instanceof Configuration); - Configuration config = (Configuration)object; - config.setScriptVariant(ScriptVariant.RUSSIAN); - assertTrue(config.getScriptVariant() == ScriptVariant.RUSSIAN); + Form form = (Form)transaction.getTopObjectByFqn(FQN_FORM_RU); + FormItem item = form.getItems().get(1); + assertTrue(item instanceof Table); + Table table = (Table)item; + AbstractDataPath path = (DataPath)table.getItems().get(0).eContents().get(1); + form.getAttributes().get(0).getNotDefaultUseAlwaysAttributes().add(path); + assertFalse(form.getAttributes().get(0).getNotDefaultUseAlwaysAttributes().isEmpty()); return null; } }); waitForDD(dtProject); - IBmObject object = getTopObjectByFqn(FQN_FORM, dtProject); + IBmObject object = getTopObjectByFqn(FQN_FORM_RU, dtProject); + assertTrue(object instanceof Form); + + Marker marker = getFirstNestedMarker(CHECK_ID, object.bmGetId(), dtProject); + assertNull(marker); + } + + /** + * Test Use Always flag is disabled for an attribute in dynamic list of the non object table. + * + * @throws Exception the exception + */ + @Test + public void testUseAlwaysDisabledForAttributeOnNonObjectTable() throws Exception + { + IDtProject dtProject = openProjectAndWaitForValidationFinish(PROJECT_NAME); + assertNotNull(dtProject); + + IBmObject object = getTopObjectByFqn(FQN_NON_OBJECT, dtProject); + assertTrue(object instanceof Form); + + Form form = (Form)object; + assertTrue(form.getAttributes().get(0).getNotDefaultUseAlwaysAttributes().isEmpty()); + + Marker marker = getFirstNestedMarker(CHECK_ID, object.bmGetId(), dtProject); + assertNull(marker); + } + + /** + * Test Use Always flag is enabled in the dynamic list for an attribute with a nonstandard data path. + * + * @throws Exception the exception + */ + @Test + public void testUseAlwaysEnabledForAttributeWithNonStandardDataPath() throws Exception + { + IDtProject dtProject = openProjectAndWaitForValidationFinish(PROJECT_NAME); + assertNotNull(dtProject); + + IBmModel model = bmModelManager.getModel(dtProject); + model.execute(new AbstractBmTask("change mode") + { + @Override + public Void execute(IBmTransaction transaction, IProgressMonitor monitor) + { + Form form = (Form)transaction.getTopObjectByFqn(FQN_FORM_EN); + FormItem item = form.getItems().get(1); + assertTrue(item instanceof Table); + Table table = (Table)item; + AbstractDataPath path = (DataPath)table.getItems().get(0).eContents().get(1); + path.getSegments().add(0, "SomeExtraSegment"); + form.getAttributes().get(0).getNotDefaultUseAlwaysAttributes().add(path); + assertEquals("/SomeExtraSegment/List/Ref", + form.getAttributes().get(0).getNotDefaultUseAlwaysAttributes().get(0).toString()); + return null; + } + }); + waitForDD(dtProject); + + IBmObject object = getTopObjectByFqn(FQN_FORM_EN, dtProject); assertTrue(object instanceof Form); Marker marker = getFirstNestedMarker(CHECK_ID, object.bmGetId(), dtProject); diff --git a/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Catalogs/TestCatalog/Forms/TestListForm/Form.form b/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Catalogs/TestCatalog/Forms/TestListForm/Form.form index b7ebfc72..9f6a2a27 100644 --- a/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Catalogs/TestCatalog/Forms/TestListForm/Form.form +++ b/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Catalogs/TestCatalog/Forms/TestListForm/Form.form @@ -56,9 +56,7 @@ 16 true true - - true - + List.Ref diff --git a/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Catalogs/TestCatalog/Forms/TestListFormRu/Attributes/Список/ExtInfo/ListSettings.dcss b/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Catalogs/TestCatalog/Forms/TestListFormRu/Attributes/Список/ExtInfo/ListSettings.dcss new file mode 100644 index 00000000..cd0f132b --- /dev/null +++ b/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Catalogs/TestCatalog/Forms/TestListFormRu/Attributes/Список/ExtInfo/ListSettings.dcss @@ -0,0 +1,17 @@ + + + + Normal + aedbafd4-ee68-4b02-b464-c89d9e5fb5b3 + + + Normal + 88643ec8-04ad-448a-9f47-a8428df49498 + + + Normal + 4fdb9617-54d0-44cb-929a-ed78fbc204cb + + Normal + 6059f7fa-59c7-4902-83c5-d0df8017afec + diff --git a/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Catalogs/TestCatalog/Forms/TestListFormRu/Form.form b/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Catalogs/TestCatalog/Forms/TestListFormRu/Form.form new file mode 100644 index 00000000..c258f134 --- /dev/null +++ b/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Catalogs/TestCatalog/Forms/TestListFormRu/Form.form @@ -0,0 +1,562 @@ + + + + СписокКомпоновщикНастроекПользовательскиеНастройки + 1 + true + true + + true + + + <key>en</key> + <value>User settings group</value> + + false + + СписокКомпоновщикНастроекПользовательскиеНастройкиРасширеннаяПодсказка + 2 + true + true + + true + + Label + true + true + + Left + + + UsualGroup + + Vertical + WeakSeparation + true + true + Auto + Auto + + + + Список + 3 + true + true + + true + + + Список + + true + None + + Ссылка + 16 + true + true + + + Список.Ref + + true + + СсылкаРасширеннаяПодсказка + 18 + true + true + + true + + Label + true + true + + Left + + + + СсылкаКонтекстноеМеню + 17 + true + true + + true + + true + + LabelField + Enter + true + Left + true + + true + true + + + + Код + 19 + true + true + + true + + + Список.Code + + + КодРасширеннаяПодсказка + 21 + true + true + + true + + Label + true + true + + Left + + + + КодКонтекстноеМеню + 20 + true + true + + true + + true + + LabelField + Enter + true + Left + true + + true + true + + + + Наименование + 22 + true + true + + true + + + Список.Description + + + НаименованиеРасширеннаяПодсказка + 24 + true + true + + true + + Label + true + true + + Left + + + + НаименованиеКонтекстноеМеню + 23 + true + true + + true + + true + + LabelField + Enter + true + Left + true + + true + true + + + + ПометкаУдаления + 25 + true + true + + true + + + Список.DeletionMark + + + ПометкаУдаленияРасширеннаяПодсказка + 27 + true + true + + true + + Label + true + true + + Left + + + + ПометкаУдаленияКонтекстноеМеню + 26 + true + true + + true + + true + + LabelField + Enter + true + Left + true + + true + true + + + + Предопределенный + 28 + true + true + + true + + + Список.Predefined + + + ПредопределенныйРасширеннаяПодсказка + 30 + true + true + + true + + Label + true + true + + Left + + + + ПредопределенныйКонтекстноеМеню + 29 + true + true + + true + + true + + LabelField + Enter + true + Left + true + + true + true + + + + ИмяПредопределенныхДанных + 31 + true + true + + true + + + Список.PredefinedDataName + + + ИмяПредопределенныхДанныхРасширеннаяПодсказка + 33 + true + true + + true + + Label + true + true + + Left + + + + ИмяПредопределенныхДанныхКонтекстноеМеню + 32 + true + true + + true + + true + + LabelField + Enter + true + Left + true + + true + true + + + None + + СписокКоманднаяПанель + 5 + true + true + + true + + Left + + + true + true + + true + + СписокСтрокаПоиска + 7 + + СписокСтрокаПоискаРасширеннаяПодсказка + 9 + true + true + + true + + Label + true + true + + Left + + + + СписокСтрокаПоискаКонтекстноеМеню + 8 + true + true + + true + + true + + СписокСтрокаПоиска + + true + + + + true + true + + true + + СписокСостояниеПросмотра + 10 + + СписокСостояниеПросмотраРасширеннаяПодсказка + 12 + true + true + + true + + Label + true + true + + Left + + + + СписокСостояниеПросмотраКонтекстноеМеню + 11 + true + true + + true + + true + + ViewStatusAddition + СписокСостояниеПросмотра + + true + + + + true + true + + true + + СписокУправлениеПоиском + 13 + + СписокУправлениеПоискомРасширеннаяПодсказка + 15 + true + true + + true + + Label + true + true + + Left + + + + СписокУправлениеПоискомКонтекстноеМеню + 14 + true + true + + true + + true + + SearchControlAddition + Список + + true + + + + СписокРасширеннаяПодсказка + 6 + true + true + + true + + Label + true + true + + Left + + + + СписокКонтекстноеМеню + 4 + true + true + + true + + true + + true + true + true + true + true + MultiRow +
true
+ 1 + 1 + AutoUse + AutoUse + true + true + true + Auto + Auto + ExpandTopLevel + true + true + true + true + AsFileRef + + Список.DefaultPicture + + + 60 + + 0001-01-01T00:00:00 + 0001-01-01T00:00:00 + + + true + СписокКомпоновщикНастроекПользовательскиеНастройки + +
+ + ФормаКоманднаяПанель + -1 + true + true + + true + + Left + true + + true + true + Vertical + true + true + true + true + true + + Список + 1 + + DynamicList + + + true + + + true + +
true
+ + Catalog.TestCatalog + true + true + true + true + +
+ + + + + +
diff --git a/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Catalogs/TestCatalog/TestCatalog.mdo b/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Catalogs/TestCatalog/TestCatalog.mdo index f764ae75..5eaef3a1 100644 --- a/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Catalogs/TestCatalog/TestCatalog.mdo +++ b/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Catalogs/TestCatalog/TestCatalog.mdo @@ -40,4 +40,13 @@ PersonalComputer MobileDevice + + TestListFormRu + + en + Test list form ru + + PersonalComputer + MobileDevice + diff --git a/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Configuration/Configuration.mdo b/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Configuration/Configuration.mdo index d921f754..e5a158c4 100644 --- a/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Configuration/Configuration.mdo +++ b/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/Configuration/Configuration.mdo @@ -39,4 +39,5 @@ en Catalog.TestCatalog + InformationRegister.TestInformationRegister diff --git a/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/InformationRegisters/TestInformationRegister/Forms/TestListForm/Attributes/List/ExtInfo/ListSettings.dcss b/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/InformationRegisters/TestInformationRegister/Forms/TestListForm/Attributes/List/ExtInfo/ListSettings.dcss new file mode 100644 index 00000000..af0e849c --- /dev/null +++ b/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/InformationRegisters/TestInformationRegister/Forms/TestListForm/Attributes/List/ExtInfo/ListSettings.dcss @@ -0,0 +1,17 @@ + + + + Normal + 84610be0-78a9-4dbc-9c53-4be4750f99de + + + Normal + 8962d152-9b49-4e2f-ac64-4ee874692489 + + + Normal + cb6b54fc-9ade-452d-9e05-a7b1110fa0e3 + + Normal + 8547d0e4-3b72-4ee4-896c-d58d37e961f5 + diff --git a/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/InformationRegisters/TestInformationRegister/Forms/TestListForm/Form.form b/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/InformationRegisters/TestInformationRegister/Forms/TestListForm/Form.form new file mode 100644 index 00000000..5a20afbd --- /dev/null +++ b/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/InformationRegisters/TestInformationRegister/Forms/TestListForm/Form.form @@ -0,0 +1,334 @@ + + + + ListSettingsComposerUserSettings + 1 + true + true + + true + + + <key>en</key> + <value>User settings group</value> + + false + + ListSettingsComposerUserSettingsExtendedTooltip + 2 + true + true + + true + + Label + true + true + + Left + + + UsualGroup + + Vertical + WeakSeparation + true + true + Auto + Auto + + + + List + 3 + true + true + + true + + + List + + true + None + + TestDimension + 16 + true + true + + true + + + List.TestDimension + + true + + TestDimensionExtendedTooltip + 18 + true + true + + true + + Label + true + true + + Left + + + + TestDimensionContextMenu + 17 + true + true + + true + + true + + LabelField + Enter + true + Left + true + + true + true + + + None + + ListCommandBar + 5 + true + true + + true + + Left + + + true + true + + true + + ListSearchString + 7 + + ListSearchStringExtendedTooltip + 9 + true + true + + true + + Label + true + true + + Left + + + + ListSearchStringContextMenu + 8 + true + true + + true + + true + + ListSearchString + + true + + + + true + true + + true + + ListViewStatus + 10 + + ListViewStatusExtendedTooltip + 12 + true + true + + true + + Label + true + true + + Left + + + + ListViewStatusContextMenu + 11 + true + true + + true + + true + + ViewStatusAddition + ListViewStatus + + true + + + + true + true + + true + + ListSearchControl + 13 + + ListSearchControlExtendedTooltip + 15 + true + true + + true + + Label + true + true + + Left + + + + ListSearchControlContextMenu + 14 + true + true + + true + + true + + SearchControlAddition + List + + true + + + + ListExtendedTooltip + 6 + true + true + + true + + Label + true + true + + Left + + + + ListContextMenu + 4 + true + true + + true + + true + + true + true + true + true + true + MultiRow +
true
+ 1 + 1 + AutoUse + AutoUse + true + true + true + Auto + Auto + ExpandTopLevel + true + true + true + true + AsFileRef + + List.DefaultPicture + + + 60 + + 0001-01-01T00:00:00 + 0001-01-01T00:00:00 + + + true + ListSettingsComposerUserSettings + +
+ + FormCommandBar + -1 + true + true + + true + + Left + true + + true + true + Vertical + true + true + true + true + true + + List + 1 + + DynamicList + + + true + + + true + +
true
+ + InformationRegister.TestInformationRegister + true + true + true + true + +
+ + + + + +
diff --git a/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/InformationRegisters/TestInformationRegister/TestInformationRegister.mdo b/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/InformationRegisters/TestInformationRegister/TestInformationRegister.mdo new file mode 100644 index 00000000..eb97a860 --- /dev/null +++ b/tests/com.e1c.v8codestyle.form.itests/workspace/FormListRefUseAlwaysFlagDisabled/src/InformationRegisters/TestInformationRegister/TestInformationRegister.mdo @@ -0,0 +1,53 @@ + + + + + + + + + + + + TestInformationRegister + + en + Test information register + + true + InDialog + InformationRegister.TestInformationRegister.Form.TestListForm + Managed + + en + presentation + + + TestDimension + + en + Test dimension + + + String + + 10 + + + + + Use + Use + + true + + + TestListForm + + en + Test list form + + PersonalComputer + MobileDevice + + From ce0b6a7dd8eb918982384f3e67cd0a465b769856 Mon Sep 17 00:00:00 2001 From: olgabozhko Date: Wed, 25 May 2022 15:35:18 +0700 Subject: [PATCH 2/4] =?UTF-8?q?#266=20=D0=9F=D0=B5=D1=80=D0=B5=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=B0=20=D0=BA=D0=BE=D0=BD?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D0=BD=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/check/FormListRefUseAlwaysFlagDisabledCheck.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java b/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java index 6d8a1504..b06bb155 100644 --- a/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java +++ b/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java @@ -48,7 +48,7 @@ public class FormListRefUseAlwaysFlagDisabledCheck private static final List REF_ABSTRACT_DATA_PATH = List.of("List", "Ref"); //$NON-NLS-1$ //$NON-NLS-2$ private static final List REF_ABSTRACT_DATA_PATH_RU = List.of("Список", "Ссылка"); //$NON-NLS-1$ //$NON-NLS-2$ - private static final Predicate nameCheck = + private static final Predicate NAME_CHECK = name -> name.getName().equals(REF_ABSTRACT_DATA_PATH.get(1)); private static Predicate pathCheck = path -> { @@ -97,7 +97,7 @@ public class FormListRefUseAlwaysFlagDisabledCheck if (formAttribute.getExtInfo() instanceof DynamicListExtInfo) { DbViewTableDef tableDef = (DbViewTableDef)((DynamicListExtInfo)formAttribute.getExtInfo()).getMainTable(); - if (tableDef.getFields().stream().anyMatch(nameCheck) + if (tableDef.getFields().stream().anyMatch(NAME_CHECK) && formAttribute.getNotDefaultUseAlwaysAttributes().stream().noneMatch(pathCheck)) { resultAceptor.addIssue( From 8ba0a4317302b30f6441f06d43988441bc4e866e Mon Sep 17 00:00:00 2001 From: Vadim Geraskin Date: Wed, 1 Jun 2022 23:10:15 +0700 Subject: [PATCH 3/4] Fix NPE --- .../form/check/FormListRefUseAlwaysFlagDisabledCheck.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java b/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java index b06bb155..a3ee608a 100644 --- a/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java +++ b/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java @@ -97,7 +97,7 @@ public class FormListRefUseAlwaysFlagDisabledCheck if (formAttribute.getExtInfo() instanceof DynamicListExtInfo) { DbViewTableDef tableDef = (DbViewTableDef)((DynamicListExtInfo)formAttribute.getExtInfo()).getMainTable(); - if (tableDef.getFields().stream().anyMatch(NAME_CHECK) + if (tableDef != null && tableDef.getFields().stream().anyMatch(NAME_CHECK) && formAttribute.getNotDefaultUseAlwaysAttributes().stream().noneMatch(pathCheck)) { resultAceptor.addIssue( From 58c5bf8cc89a458c1b0709a85ca5a9eb3b109d76 Mon Sep 17 00:00:00 2001 From: olgabozhko Date: Wed, 15 Jun 2022 00:36:09 +0700 Subject: [PATCH 4/4] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D0=BB=D0=BE=D0=B6=D0=BD=D0=BE=D0=B5=20?= =?UTF-8?q?=D1=81=D1=80=D0=B0=D0=B1=D0=B0=D1=82=D1=8B=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B8=20=D0=BF=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B5=D1=80=D0=BA=D0=B5=20=D1=81=D0=B5=D0=B3=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=BE=D0=B2=20DataPath?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormListRefUseAlwaysFlagDisabledCheck.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java b/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java index a3ee608a..35f3acac 100644 --- a/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java +++ b/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java @@ -45,11 +45,10 @@ public class FormListRefUseAlwaysFlagDisabledCheck { private static final String CHECK_ID = "form-list-ref-use-always-flag-disabled"; //$NON-NLS-1$ - private static final List REF_ABSTRACT_DATA_PATH = List.of("List", "Ref"); //$NON-NLS-1$ //$NON-NLS-2$ - private static final List REF_ABSTRACT_DATA_PATH_RU = List.of("Список", "Ссылка"); //$NON-NLS-1$ //$NON-NLS-2$ + private static final List REF_ABSTRACT_DATA_PATH = List.of("Ref", "Список"); //$NON-NLS-1$ //$NON-NLS-2$ private static final Predicate NAME_CHECK = - name -> name.getName().equals(REF_ABSTRACT_DATA_PATH.get(1)); + name -> name.getName().equals(REF_ABSTRACT_DATA_PATH.get(0)); private static Predicate pathCheck = path -> { EList segments = path.getSegments(); @@ -59,14 +58,8 @@ public class FormListRefUseAlwaysFlagDisabledCheck return false; } - if (!segments.get(0).equals(REF_ABSTRACT_DATA_PATH.get(0)) - && !segments.get(0).equals(REF_ABSTRACT_DATA_PATH_RU.get(0))) - { - return false; - } - - return segments.get(1).equals(REF_ABSTRACT_DATA_PATH.get(1)) - || segments.get(1).equals(REF_ABSTRACT_DATA_PATH_RU.get(1)); + return segments.get(1).equals(REF_ABSTRACT_DATA_PATH.get(0)) + || segments.get(1).equals(REF_ABSTRACT_DATA_PATH.get(1)); }; @Override