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

Проверка заполнения заголовка поля динамического списка #244

This commit is contained in:
Dmitriy Marmyshev 2022-02-11 00:49:20 +03:00
parent 9d23e508bd
commit e729ee4998
28 changed files with 2248 additions and 4 deletions

View File

@ -26,6 +26,7 @@
- У реквизита "Ссылка" динамического списка выключен признак "Использовать всегда"
- У поля "Ссылка" таблицы динамического списка не отключена пользовательская видимость
- У каждого события должна быть назначена своя процедура-обработчик
- Проверка заполнения заголовка поля динамического списка
#### Код модулей
@ -64,6 +65,8 @@
- 3 исправления исправления для удаления избыточного обращения внутри модуля к самому себе
- Замена в модуле формы устаревшего свойства "ЭтаФорма" на "ЭтотОбъект"
- Конвертация функции в процедуру
- Генерация заголовка элемента формы динамического списка
- Генерация заголовка поля динамического списка (8.3.19 и выше)
### Исправленные ошибки

View File

@ -8,7 +8,8 @@ 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)",
javax.inject;bundle-version="[1.0.0,2.0.0)"
javax.inject;bundle-version="[1.0.0,2.0.0)",
org.eclipse.xtext;bundle-version="[2.26.0,3.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-11
Automatic-Module-Name: com.e1c.v8codestyle.form
Bundle-ActivationPolicy: lazy
@ -17,11 +18,13 @@ Import-Package: com._1c.g5.v8.bm.core;version="[7.5.0,8.0.0)",
com._1c.g5.v8.bm.core.event;version="[2.1.0,3.0.0)",
com._1c.g5.v8.dt.common;version="[6.0.0,7.0.0)",
com._1c.g5.v8.dt.core.platform;version="[10.4.0,11.0.0)",
com._1c.g5.v8.dt.dcs.model.core;version="[2.6.0,3.0.0)",
com._1c.g5.v8.dt.dcs.model.schema;version="[2.2.0,3.0.0)",
com._1c.g5.v8.dt.form.model;version="[10.0.0,11.0.0)",
com._1c.g5.v8.dt.form.service;version="[6.1.0,7.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.dbview;version="[4.0.0,5.0.0)",
com._1c.g5.v8.dt.metadata.mdclass;version="[8.0.0,9.0.0)",
com._1c.g5.v8.dt.platform.version;version="[2.14.0,3.0.0)",
com._1c.g5.wiring;version="[2.2.0,3.0.0)",
@ -30,9 +33,10 @@ Import-Package: com._1c.g5.v8.bm.core;version="[7.5.0,8.0.0)",
com.e1c.g5.v8.dt.check.components;version="[2.0.0,3.0.0)",
com.e1c.g5.v8.dt.check.context;version="[2.0.0,3.0.0)",
com.e1c.g5.v8.dt.check.ext;version="[1.0.0,2.0.0)",
com.e1c.g5.v8.dt.check.qfix;version="[1.0.0,2.0.0)",
com.e1c.g5.v8.dt.check.qfix.components;version="[1.0.0,2.0.0)",
com.e1c.g5.v8.dt.check.settings;version="[3.0.0,4.0.0)",
com.e1c.v8codestyle.check;version="[0.3.0,0.4.0)",
com.google.common.base;version="[30.1.0,31.0.0)",
com.google.inject;version="[5.0.1,6.0.0)",
com.google.inject.binder;version="[5.0.1,6.0.0)",
org.eclipse.xtext.resource
com.google.inject.binder;version="[5.0.1,6.0.0)"

View File

@ -0,0 +1,21 @@
# Dynamic list field title is empty
Specify headers for columns of a dynamic list that are displayed in a query as a combination of other columns or that have their own alias assigned.
Do not use headers that are automatically generated by name or alias.
Examples when you need to specify column headers explicitly:
```bsl
SELECT
Table.Field1 AS Field2
CAST(Table.Field1 AS STRING(100)) AS Field3
```
In this case, when a field is created in a query and a name is assigned to it,
the synonym is not automatically obtained from metadata as there is no attribute related to this field.
The interface text editor does not find headers for dynamic list columns, to which an alias is assigned in a query.
You need to specify headers of dynamic list columns even if field names are not displayed on the form as a user can see column headers upon setting up form fields (clicking More, Change form...).
## See
- [Form items: localization requirements](https://support.1ci.com/hc/en-us/articles/360011122779-Form-items-localization-requirements)

View File

@ -0,0 +1,24 @@
# Пустой заголовок для колонок динамического списка
Следует задавать заголовок для колонок динамического списка, получающихся в запросе комбинацией других колонок или для которых задан свой псевдоним.
Нельзя опираться на автоматически сгенерированный заголовок по имени/псевдониму.
Примеры, когда заголовок колонок следует задавать в явном виде:
```bsl
ВЫБРАТЬ
Таблица.Поле1 КАК Поле2
ВЫРАЗИТЬ(Таблица.Поле1 КАК СТРОКА(100)) КАК Поле3
```
В таком случае, когда поле создается в запросе и ему присваивается имя, то синоним не "подтягивается" автоматически из метаданных,
т.к. не существует реквизита, связанного с этим полем.
Инструментом редактирования текстов интерфейсов не находится заголовок для колонок в динамическом списке, которым задан псевдоним в запросе.
Имя колонки динамического списка должно быть задано, даже если заголовок поля не выводится на форму,
так как имена колонок выводятся пользователю при настройке полей формы (команда Еще - Изменить форму...).
## См.
- [Элементы форм: требования по локализации](https://its.1c.ru/db/v8std#content:765:hdoc:4)

View File

@ -26,6 +26,10 @@
category="com.e1c.v8codestyle.form"
class="com.e1c.v8codestyle.internal.form.ExecutableExtensionFactory:com.e1c.v8codestyle.form.check.InputFieldListChoiceMode">
</check>
<check
category="com.e1c.v8codestyle.form"
class="com.e1c.v8codestyle.internal.form.ExecutableExtensionFactory:com.e1c.v8codestyle.form.check.DynamicListItemTitleCheck">
</check>
<check
category="com.e1c.v8codestyle.form"
class="com.e1c.v8codestyle.internal.form.ExecutableExtensionFactory:com.e1c.v8codestyle.form.check.FormListRefUseAlwaysFlagDisabledCheck">
@ -39,5 +43,14 @@
class="com.e1c.v8codestyle.internal.form.ExecutableExtensionFactory:com.e1c.v8codestyle.form.check.FormItemsSingleEventHandlerCheck">
</check>
</extension>
<extension
point="com.e1c.g5.v8.dt.check.fixes">
<fix
class="com.e1c.v8codestyle.internal.form.ExecutableExtensionFactory:com.e1c.v8codestyle.form.fix.DynamicListItemTitleGenerateFix">
</fix>
<fix
class="com.e1c.v8codestyle.internal.form.ExecutableExtensionFactory:com.e1c.v8codestyle.form.fix.DynamicListFieldTitleGenerateFix">
</fix>
</extension>
</plugin>

View File

@ -0,0 +1,255 @@
/*******************************************************************************
* Copyright (C) 2022, 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.dcs.model.core.DcsPackage.Literals.LOCAL_STRING;
import static com._1c.g5.v8.dt.dcs.model.core.DcsPackage.Literals.PRESENTATION;
import static com._1c.g5.v8.dt.dcs.model.schema.DcsPackage.Literals.DATA_COMPOSITION_SCHEMA_DATA_SET_FIELD;
import static com._1c.g5.v8.dt.form.model.FormPackage.Literals.DATA_ITEM__DATA_PATH;
import static com._1c.g5.v8.dt.form.model.FormPackage.Literals.DYNAMIC_LIST_EXT_INFO;
import static com._1c.g5.v8.dt.form.model.FormPackage.Literals.FORM;
import static com._1c.g5.v8.dt.form.model.FormPackage.Literals.FORM_FIELD;
import static com._1c.g5.v8.dt.form.model.FormPackage.Literals.TITLED__TITLE;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.util.EMap;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import com._1c.g5.v8.bm.core.BmUriUtil;
import com._1c.g5.v8.bm.core.IBmObject;
import com._1c.g5.v8.dt.common.StringUtils;
import com._1c.g5.v8.dt.core.platform.IDependentProject;
import com._1c.g5.v8.dt.core.platform.IV8Project;
import com._1c.g5.v8.dt.core.platform.IV8ProjectManager;
import com._1c.g5.v8.dt.dcs.model.core.Presentation;
import com._1c.g5.v8.dt.dcs.model.schema.DataCompositionSchemaDataSetField;
import com._1c.g5.v8.dt.dcs.model.schema.DataSetField;
import com._1c.g5.v8.dt.form.model.AbstractDataPath;
import com._1c.g5.v8.dt.form.model.DataPathReferredObject;
import com._1c.g5.v8.dt.form.model.DynamicListExtInfo;
import com._1c.g5.v8.dt.form.model.Form;
import com._1c.g5.v8.dt.form.model.FormAttribute;
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.FormItemContainer;
import com._1c.g5.v8.dt.form.model.PropertyInfo;
import com._1c.g5.v8.dt.form.service.datasourceinfo.IDataSourceInfoAssociationService;
import com._1c.g5.v8.dt.mcore.NamedElement;
import com.e1c.g5.v8.dt.check.CheckComplexity;
import com.e1c.g5.v8.dt.check.ICheckDefinition;
import com.e1c.g5.v8.dt.check.ICheckParameters;
import com.e1c.g5.v8.dt.check.components.BasicCheck;
import com.e1c.g5.v8.dt.check.components.IBasicCheckExtension;
import com.e1c.g5.v8.dt.check.context.CheckContextCollectingSession;
import com.e1c.g5.v8.dt.check.context.OnModelFeatureChangeContextCollector;
import com.e1c.g5.v8.dt.check.context.OnModelObjectAssociationContextCollector;
import com.e1c.g5.v8.dt.check.context.OnModelObjectRemovalContextCollector;
import com.e1c.g5.v8.dt.check.settings.IssueSeverity;
import com.e1c.g5.v8.dt.check.settings.IssueType;
import com.e1c.v8codestyle.check.StandardCheckExtension;
import com.e1c.v8codestyle.internal.form.CorePlugin;
import com.google.inject.Inject;
/**
* The check find form items binded to dynamic list with custom field that should have set title.
* Such field cannot be mapped to some MD object (or other type with standard presentation) to get synonym
* and will show it's name to the user. So, form item or dynamic list field (since 8.3.19) must have title.
*
* @author Dmitriy Marmyshev
*/
public class DynamicListItemTitleCheck
extends BasicCheck
{
public static final String CHECK_ID = "form-dynamic-list-item-title"; //$NON-NLS-1$
private final IV8ProjectManager v8ProjectManager;
private final IDataSourceInfoAssociationService dataSourceInfoAssociationService;
@Inject
public DynamicListItemTitleCheck(IV8ProjectManager v8ProjectManager,
IDataSourceInfoAssociationService dataSourceInfoAssociationService)
{
this.v8ProjectManager = v8ProjectManager;
this.dataSourceInfoAssociationService = dataSourceInfoAssociationService;
}
@Override
public String getCheckId()
{
return CHECK_ID;
}
@Override
protected void configureCheck(CheckConfigurer builder)
{
builder.title(Messages.DynamicListItemTitleCheck_title)
.description(Messages.DynamicListItemTitleCheck_Description)
.complexity(CheckComplexity.NORMAL)
.severity(IssueSeverity.MINOR)
.issueType(IssueType.UI_STYLE)
.extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID))
.extension(new SkipBaseFormExtension())
.extension(new DynamicListChangeExtension())
.topObject(FORM)
.containment(FORM_FIELD)
.features(TITLED__TITLE, DATA_ITEM__DATA_PATH);
}
@Override
protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters,
IProgressMonitor monitor)
{
FormField field = (FormField)object;
AbstractDataPath dataPath = field.getDataPath();
if (dataPath == null || dataPath.getSegments().size() != 2 || dataPath.getObjects().size() != 2)
{
return;
}
String languageCode = getDefaultLanguageCode(field);
if (!isTitleEmpty(field.getTitle(), languageCode))
{
return;
}
Form form = (Form)((IBmObject)field).bmGetTopObject();
if (!dataSourceInfoAssociationService.isRelatedDynamicList(form, dataPath)
|| !dataSourceInfoAssociationService.isPathResolved(form, dataPath) || monitor.isCanceled())
{
return;
}
PropertyInfo attribute = dataSourceInfoAssociationService.findPropertyInfo(form, dataPath, 0);
if (!isCustomQuery(attribute.getSource()) || monitor.isCanceled())
{
return;
}
DynamicListExtInfo custormQuery = (DynamicListExtInfo)((FormAttribute)attribute.getSource()).getExtInfo();
String segment = dataPath.getSegments().get(1);
DataPathReferredObject refObject = dataPath.getObjects().get(1);
EObject source = refObject.getObject();
if (isSourceUnknownOrSegmentNotEquals(segment, source)
&& isDcsFieldTitleIsEmpty(custormQuery, segment, languageCode))
{
resultAceptor.addIssue(Messages.DynamicListItemTitleCheck_message, field, TITLED__TITLE);
}
}
private boolean isCustomQuery(Object source)
{
return source instanceof FormAttribute && ((FormAttribute)source).getExtInfo() instanceof DynamicListExtInfo
&& ((DynamicListExtInfo)((FormAttribute)source).getExtInfo()).isCustomQuery();
}
private String getDefaultLanguageCode(EObject context)
{
IV8Project project = v8ProjectManager.getProject(context);
if (project.getDefaultLanguage() == null && project instanceof IDependentProject)
{
return ((IDependentProject)project).getParent().getDefaultLanguage().getLanguageCode();
}
else if (project.getDefaultLanguage() != null)
{
return project.getDefaultLanguage().getLanguageCode();
}
return null;
}
private boolean isTitleEmpty(EMap<String, String> title, String languageCode)
{
return title == null || languageCode != null && StringUtils.isBlank(title.get(languageCode));
}
private boolean isSourceUnknownOrSegmentNotEquals(String segment, EObject source)
{
return source == null
|| source instanceof NamedElement && !segment.equalsIgnoreCase(((NamedElement)source).getName());
}
private boolean isDcsFieldTitleIsEmpty(DynamicListExtInfo custormQuery, String segment, String languageCode)
{
for (DataSetField field : custormQuery.getFields())
{
if (field instanceof DataCompositionSchemaDataSetField
&& segment.equalsIgnoreCase(((DataCompositionSchemaDataSetField)field).getDataPath()))
{
Presentation title = ((DataCompositionSchemaDataSetField)field).getTitle();
return title == null || StringUtils.isBlank(title.getValue()) && (title.getLocalValue() == null
|| isTitleEmpty(title.getLocalValue().getContent(), languageCode));
}
}
return true;
}
private static final class DynamicListChangeExtension
implements IBasicCheckExtension
{
@Override
public void configureContextCollector(ICheckDefinition definition)
{
OnModelObjectAssociationContextCollector newObjectCollector = (bmObject, bmEvent, contextSession) -> {
IBmObject top = bmObject.bmGetTopObject();
if (top instanceof Form)
{
addItems(contextSession, (FormItemContainer)top);
}
};
definition.addModelAssociationContextCollector(newObjectCollector, DYNAMIC_LIST_EXT_INFO);
definition.addModelAssociationContextCollector(newObjectCollector, DATA_COMPOSITION_SCHEMA_DATA_SET_FIELD);
definition.addModelAssociationContextCollector(newObjectCollector, PRESENTATION);
definition.addModelAssociationContextCollector(newObjectCollector, LOCAL_STRING);
OnModelFeatureChangeContextCollector changeCollector = (bmObject, feature, bmEvent, contextSession) -> {
IBmObject top = bmObject.bmGetTopObject();
if (top instanceof Form)
{
addItems(contextSession, (FormItemContainer)top);
}
};
definition.addModelFeatureChangeContextCollector(changeCollector, DYNAMIC_LIST_EXT_INFO);
definition.addModelFeatureChangeContextCollector(changeCollector, DATA_COMPOSITION_SCHEMA_DATA_SET_FIELD);
definition.addModelFeatureChangeContextCollector(changeCollector, PRESENTATION);
definition.addModelFeatureChangeContextCollector(changeCollector, LOCAL_STRING);
OnModelObjectRemovalContextCollector removeCollector =
(removedObjectUri, removedObjectEClass, bmEvent, contextSession, transaction) -> {
URI topUri = removedObjectUri.trimFragment().appendFragment(BmUriUtil.TOP_OBJECT_PATH);
IBmObject top = transaction.getObjectByUri(topUri);
if (top instanceof Form)
{
addItems(contextSession, (FormItemContainer)top);
}
};
definition.addModelRemovalContextCollector(removeCollector, DYNAMIC_LIST_EXT_INFO);
}
private void addItems(CheckContextCollectingSession contextSession, FormItemContainer container)
{
for (FormItem item : container.getItems())
{
if (item instanceof FormField)
{
contextSession.addModelCheck(item);
}
else if (item instanceof FormItemContainer)
{
addItems(contextSession, (FormItemContainer)item);
}
}
}
}
}

View File

@ -23,6 +23,9 @@ final class Messages
extends NLS
{
private static final String BUNDLE_NAME = "com.e1c.v8codestyle.form.check.messages"; //$NON-NLS-1$
public static String DynamicListItemTitleCheck_Description;
public static String DynamicListItemTitleCheck_message;
public static String DynamicListItemTitleCheck_title;
public static String FormItemsSingleEventHandlerCheck_description;
public static String FormItemsSingleEventHandlerCheck_itemName_dot_eventName;
public static String FormItemsSingleEventHandlerCheck_the_handler_is_already_assigned_to_event;

View File

@ -1,3 +1,4 @@
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
###############################################################################
# Copyright (C) 2021-2022, 1C-Soft LLC and others.
@ -12,6 +13,12 @@
# 1C-Soft LLC - initial API and implementation
# Manaev Konstantin - issue #855
###############################################################################
DynamicListItemTitleCheck_Description = Dynamic list field title is empty
DynamicListItemTitleCheck_message = Title of field of dynamic list is not filled
DynamicListItemTitleCheck_title = Dynamic list field title is empty
FormItemsSingleEventHandlerCheck_description = Each event in the form items should have a unique handler
FormItemsSingleEventHandlerCheck_itemName_dot_eventName = {0}.{1}

View File

@ -14,6 +14,12 @@
###############################################################################
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
DynamicListItemTitleCheck_Description = Заголовок поля динамического списка пустой
DynamicListItemTitleCheck_message = Не заполнен заголовок поля динамического списка
DynamicListItemTitleCheck_title = Заголовок поля динамического списка пустой
FormItemsSingleEventHandlerCheck_description = У каждого события должна быть назначена своя процедура-обработчик
FormItemsSingleEventHandlerCheck_itemName_dot_eventName = {0}.{1}

View File

@ -0,0 +1,190 @@
/*******************************************************************************
* Copyright (C) 2022, 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.fix;
import java.text.MessageFormat;
import java.util.Optional;
import org.eclipse.emf.ecore.EStructuralFeature;
import com._1c.g5.v8.bm.core.IBmObject;
import com._1c.g5.v8.dt.common.StringUtils;
import com._1c.g5.v8.dt.core.platform.IV8Project;
import com._1c.g5.v8.dt.core.platform.IV8ProjectManager;
import com._1c.g5.v8.dt.dcs.model.core.DcsFactory;
import com._1c.g5.v8.dt.dcs.model.core.LocalString;
import com._1c.g5.v8.dt.dcs.model.core.Presentation;
import com._1c.g5.v8.dt.dcs.model.schema.DataCompositionSchemaDataSetField;
import com._1c.g5.v8.dt.dcs.model.schema.DataSetField;
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.Form;
import com._1c.g5.v8.dt.form.model.FormAttribute;
import com._1c.g5.v8.dt.form.model.FormField;
import com._1c.g5.v8.dt.form.model.PropertyInfo;
import com._1c.g5.v8.dt.form.service.datasourceinfo.IDataSourceInfoAssociationService;
import com._1c.g5.v8.dt.platform.version.Version;
import com.e1c.g5.v8.dt.check.qfix.IFixSession;
import com.e1c.g5.v8.dt.check.qfix.components.BasicModelFixContext;
import com.e1c.g5.v8.dt.check.qfix.components.QuickFix;
import com.e1c.v8codestyle.form.check.DynamicListItemTitleCheck;
import com.e1c.v8codestyle.internal.form.CorePlugin;
import com.google.inject.Inject;
/**
* This fix generate title text for dynamic list field presentation from field data path CamelCase.
*
* @author Dmitriy Marmyshev
*/
@QuickFix(checkId = DynamicListItemTitleCheck.CHECK_ID, supplierId = CorePlugin.PLUGIN_ID)
public class DynamicListFieldTitleGenerateFix
extends DynamicListItemTitleGenerateFix
{
private final IV8ProjectManager v8ProjectManager;
private final IDataSourceInfoAssociationService dataSourceInfoAssociationService;
/**
* Instantiates a new dynamic list field title generate fix.
*
* @param v8ProjectManager the v8 project manager, cannot be {@code null}.
* @param dataSourceInfoAssociationService the data source info association service, cannot be {@code null}.
*/
@Inject
public DynamicListFieldTitleGenerateFix(IV8ProjectManager v8ProjectManager,
IDataSourceInfoAssociationService dataSourceInfoAssociationService)
{
super(v8ProjectManager);
this.v8ProjectManager = v8ProjectManager;
this.dataSourceInfoAssociationService = dataSourceInfoAssociationService;
}
@Override
protected void configureFix(FixConfigurer configurer)
{
configurer.description((context, session) -> {
IV8Project v8Project = v8ProjectManager.getProject(session.getDtProject());
if (Version.V8_3_19.isGreaterThan(v8Project.getVersion()))
{
return Messages.DynamicListFieldTitleGenerateFix_Default_title;
}
long id = context.getTargetObjectId();
IBmObject object = session.getModelObject(id);
if (object instanceof FormField)
{
DataCompositionSchemaDataSetField field = getDynamicListField((FormField)object);
if (field != null)
{
String name = field.getDataPath();
String title = StringUtils.nameToText(name);
return MessageFormat.format(Messages.DynamicListFieldTitleGenerateFix_title, title, name);
}
}
return Messages.DynamicListFieldTitleGenerateFix_Default_title;
});
}
@Override
protected void applyChanges(FormField object, EStructuralFeature feature, BasicModelFixContext contex,
IFixSession session)
{
String name = object.getName();
String title = StringUtils.nameToText(name);
IV8Project v8Project = v8ProjectManager.getProject(session.getDtProject());
if (Version.V8_3_19.isGreaterThan(v8Project.getVersion()))
{
return;
}
Optional<String> languageCode = getDefaultLanguageCode(v8Project);
if (languageCode.isPresent())
{
LocalString loacalString = getOrCreateLocalString(object);
loacalString.getContent().put(languageCode.get(), title);
}
}
private DataCompositionSchemaDataSetField getDynamicListField(FormField item)
{
Form form = (Form)((IBmObject)item).bmGetTopObject();
AbstractDataPath dataPath = item.getDataPath();
if (dataPath == null || dataPath.getSegments().size() != 2)
{
return null;
}
String segment = dataPath.getSegments().get(1);
PropertyInfo attribute = dataSourceInfoAssociationService.findPropertyInfo(form, dataPath, 0);
DynamicListExtInfo custormQuery = (DynamicListExtInfo)((FormAttribute)attribute.getSource()).getExtInfo();
for (DataSetField field : custormQuery.getFields())
{
if (field instanceof DataCompositionSchemaDataSetField
&& segment.equalsIgnoreCase(((DataCompositionSchemaDataSetField)field).getDataPath()))
{
return (DataCompositionSchemaDataSetField)field;
}
}
return null;
}
private DataCompositionSchemaDataSetField getOrCreateDynamicListField(FormField item)
{
Form form = (Form)((IBmObject)item).bmGetTopObject();
AbstractDataPath dataPath = item.getDataPath();
String segment = dataPath.getSegments().get(1);
PropertyInfo attribute = dataSourceInfoAssociationService.findPropertyInfo(form, dataPath, 0);
DynamicListExtInfo custormQuery = (DynamicListExtInfo)((FormAttribute)attribute.getSource()).getExtInfo();
for (DataSetField field : custormQuery.getFields())
{
if (field instanceof DataCompositionSchemaDataSetField
&& segment.equalsIgnoreCase(((DataCompositionSchemaDataSetField)field).getDataPath()))
{
return (DataCompositionSchemaDataSetField)field;
}
}
DataCompositionSchemaDataSetField field =
com._1c.g5.v8.dt.dcs.model.schema.DcsFactory.eINSTANCE.createDataCompositionSchemaDataSetField();
field.setDataPath(segment);
field.setField(segment);
custormQuery.getFields().add(field);
return field;
}
private LocalString getOrCreateLocalString(FormField object)
{
DataCompositionSchemaDataSetField field = getOrCreateDynamicListField(object);
Presentation title = field.getTitle();
if (title == null)
{
title = DcsFactory.eINSTANCE.createPresentation();
field.setTitle(title);
}
LocalString localString = title.getLocalValue();
if (localString == null)
{
localString = DcsFactory.eINSTANCE.createLocalString();
title.setLocalValue(localString);
}
return localString;
}
}

View File

@ -0,0 +1,114 @@
/*******************************************************************************
* Copyright (C) 2022, 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.fix;
import java.text.MessageFormat;
import java.util.Optional;
import org.eclipse.emf.ecore.EStructuralFeature;
import com._1c.g5.v8.bm.core.IBmObject;
import com._1c.g5.v8.dt.common.StringUtils;
import com._1c.g5.v8.dt.core.platform.IExtensionProject;
import com._1c.g5.v8.dt.core.platform.IV8Project;
import com._1c.g5.v8.dt.core.platform.IV8ProjectManager;
import com._1c.g5.v8.dt.form.model.FormField;
import com._1c.g5.v8.dt.metadata.mdclass.Language;
import com.e1c.g5.v8.dt.check.qfix.IFixSession;
import com.e1c.g5.v8.dt.check.qfix.components.BasicModelFixContext;
import com.e1c.g5.v8.dt.check.qfix.components.QuickFix;
import com.e1c.g5.v8.dt.check.qfix.components.SingleVariantModelBasicFix;
import com.e1c.v8codestyle.form.check.DynamicListItemTitleCheck;
import com.e1c.v8codestyle.internal.form.CorePlugin;
import com.google.inject.Inject;
/**
* This fix generate title text for the form table column of dynamic list its item name CamelCase.
*
* @author Dmitriy Marmyshev
*/
@QuickFix(checkId = DynamicListItemTitleCheck.CHECK_ID, supplierId = CorePlugin.PLUGIN_ID)
public class DynamicListItemTitleGenerateFix
extends SingleVariantModelBasicFix<FormField>
{
private final IV8ProjectManager v8ProjectManager;
/**
* Instantiates a new dynamic list item title generate fix.
*
* @param v8ProjectManager the v8 project manager, cannot be {@code null}.
*/
@Inject
public DynamicListItemTitleGenerateFix(IV8ProjectManager v8ProjectManager)
{
super(FormField.class);
this.v8ProjectManager = v8ProjectManager;
}
@Override
protected void configureFix(FixConfigurer configurer)
{
configurer.description((context, session) -> {
long id = context.getTargetObjectId();
IBmObject object = session.getModelObject(id);
if (object instanceof FormField)
{
FormField field = (FormField)object;
String name = field.getName();
String title = StringUtils.nameToText(name);
return MessageFormat.format(Messages.DynamicListItemTitleGenerateFix_title, title, name);
}
return Messages.DynamicListItemTitleGenerateFix_Default_title;
});
}
@Override
protected void applyChanges(FormField object, EStructuralFeature feature, BasicModelFixContext contex,
IFixSession session)
{
String name = object.getName();
String title = StringUtils.nameToText(name);
IV8Project v8Project = v8ProjectManager.getProject(session.getDtProject());
Optional<String> languageCode = getDefaultLanguageCode(v8Project);
if (languageCode.isPresent())
{
object.getTitle().put(languageCode.get(), title);
}
}
protected Optional<String> getDefaultLanguageCode(IV8Project project)
{
Language language = project.getDefaultLanguage();
if (language == null)
{
if (!project.getLanguages().isEmpty())
{
language = project.getLanguages().iterator().next();
}
else if (project instanceof IExtensionProject && ((IExtensionProject)project).getParent() != null)
{
language = ((IExtensionProject)project).getParent().getDefaultLanguage();
}
}
if (language == null)
{
return Optional.empty();
}
return Optional.ofNullable(language.getLanguageCode());
}
}

View File

@ -0,0 +1,38 @@
/*******************************************************************************
* Copyright (C) 2022, 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.fix;
import org.eclipse.osgi.util.NLS;
/**
* @author Dmitriy Marmyshev
*
*/
final class Messages
extends NLS
{
private static final String BUNDLE_NAME = Messages.class.getPackageName() + ".messages"; //$NON-NLS-1$
public static String DynamicListFieldTitleGenerateFix_Default_title;
public static String DynamicListFieldTitleGenerateFix_title;
public static String DynamicListItemTitleGenerateFix_Default_title;
public static String DynamicListItemTitleGenerateFix_title;
static
{
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
private Messages()
{
}
}

View File

@ -0,0 +1,19 @@
###############################################################################
# Copyright (C) 2022, 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
###############################################################################
DynamicListFieldTitleGenerateFix_Default_title = Generate default title for dynamic list field (8.3.19+)
DynamicListFieldTitleGenerateFix_title = Generate title "{0}" for dynamic list field "{1}"
DynamicListItemTitleGenerateFix_Default_title = Generate default title for dynamic list form item
DynamicListItemTitleGenerateFix_title = Generate title "{0}" for dynamic list form item "{1}"

View File

@ -0,0 +1,21 @@
###############################################################################
# Copyright (C) 2022, 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/)
DynamicListFieldTitleGenerateFix_Default_title = Генерировать заголовок по умолчанию для поля динамического списка (8.3.19+)
DynamicListFieldTitleGenerateFix_title = Генерировать заголовок "{0}" для поля "{1}" динамического списка
DynamicListItemTitleGenerateFix_Default_title = Генерировать заголовок по умолчанию для элемента формы динамического списка
DynamicListItemTitleGenerateFix_title = Генерировать заголовок "{0}" для элемента формы "{1}" динамического списка

View File

@ -9,10 +9,14 @@ Automatic-Module-Name: com.e1c.v8codestyle.form.itests
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-Localization: fragment
Import-Package: com._1c.g5.v8.bm.integration;version="[10.0.0,11.0.0)",
com._1c.g5.v8.dt.core.naming;version="[6.0.0,7.0.0)",
com._1c.g5.v8.dt.core.platform;version="[10.3.0,11.0.0)",
com._1c.g5.v8.dt.form.naming;version="[5.0.0,6.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.ui.util;version="[6.0.0,7.0.0)",
com._1c.g5.v8.dt.ui.validation;version="[5.0.0,6.0.0)",
com._1c.g5.v8.dt.validation.marker;version="[5.0.0,6.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)"

View File

@ -0,0 +1,253 @@
/*******************************************************************************
* Copyright (C) 2022, 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.itests;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import com._1c.g5.v8.bm.core.IBmObject;
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.Table;
import com._1c.g5.v8.dt.validation.marker.Marker;
import com.e1c.g5.v8.dt.testing.check.SingleProjectReadOnlyCheckTestBase;
import com.e1c.v8codestyle.form.check.DynamicListItemTitleCheck;
/**
* Tests for {@link DynamicListItemTitleCheck} check.
*
* @author Dmitriy Marmyshev
*/
public class DynamicListItemTitleCheckTest
extends SingleProjectReadOnlyCheckTestBase
{
private static final String CHECK_ID = "form-dynamic-list-item-title";
private static final String PROJECT_NAME = "FormDynamicListItemTitle";
private static final String FQN_FORM = "Catalog.Products.Form.ListForm.Form";
@Override
protected String getTestConfigurationName()
{
return PROJECT_NAME;
}
/**
* Test the List.Code is custom query field and has no title, that is incorrect
*
* @throws Exception the exception
*/
@Test
public void testFormListCodeIsIncorrect() throws Exception
{
IBmObject object = getTopObjectByFqn(FQN_FORM, getProject());
assertTrue(object instanceof Form);
Form form = (Form)object;
FormField item = getListItem(form, "Code");
assertNotNull(item);
Marker marker = getFirstMarker(CHECK_ID, item, getProject());
assertNotNull(marker);
}
/**
*
* Test the List.Code1 is custom query field "Code" and has no title, that is incorrect
*
* @throws Exception the exception
*/
@Test
public void testFormListCode1IsIncorrect() throws Exception
{
IBmObject object = getTopObjectByFqn(FQN_FORM, getProject());
assertTrue(object instanceof Form);
Form form = (Form)object;
FormField item = getListItem(form, "Code1");
assertNotNull(item);
Marker marker = getFirstMarker(CHECK_ID, item, getProject());
assertNotNull(marker);
}
/**
*
* Test the List.CodeCorrect is custom query field "Code" and has title, that is correct
*
* @throws Exception the exception
*/
@Test
public void testFormListCodeCorrectIsCorrect() throws Exception
{
IBmObject object = getTopObjectByFqn(FQN_FORM, getProject());
assertTrue(object instanceof Form);
Form form = (Form)object;
FormField item = getListItem(form, "CodeCorrect");
assertNotNull(item);
Marker marker = getFirstMarker(CHECK_ID, item, getProject());
assertNull(marker);
}
/**
*
* Test the List.Description is standard field "Description" and has no title, that is correct
*
* @throws Exception the exception
*/
@Test
public void testFormListDescriptionIsCorrect() throws Exception
{
IBmObject object = getTopObjectByFqn(FQN_FORM, getProject());
assertTrue(object instanceof Form);
Form form = (Form)object;
FormField item = getListItem(form, "Description");
assertNotNull(item);
Marker marker = getFirstMarker(CHECK_ID, item, getProject());
assertNull(marker);
}
/**
*
* Test the List.SKU is MD attribute "SKU" and has no title, that is correct
*
* @throws Exception the exception
*/
@Test
public void testFormListSKUIsCorrect() throws Exception
{
IBmObject object = getTopObjectByFqn(FQN_FORM, getProject());
assertTrue(object instanceof Form);
Form form = (Form)object;
FormField item = getListItem(form, "SKU");
assertNotNull(item);
Marker marker = getFirstMarker(CHECK_ID, item, getProject());
assertNull(marker);
}
/**
*
* Test the List.MyPredefined is custom query field "MyPredefined" and has no title, that is incorrect
*
* @throws Exception the exception
*/
@Test
public void testFormListMyPredefinedIsIncorrect() throws Exception
{
IBmObject object = getTopObjectByFqn(FQN_FORM, getProject());
assertTrue(object instanceof Form);
Form form = (Form)object;
FormField item = getListItem(form, "MyPredefined");
assertNotNull(item);
Marker marker = getFirstMarker(CHECK_ID, item, getProject());
assertNotNull(marker);
}
/**
*
* Test the List.MyPredefined2 is custom query field "MyPredefined2" with DCS title and has no item title,
* that is correct
*
* @throws Exception the exception
*/
@Test
public void testFormListMyPredefined2IsCorrect() throws Exception
{
IBmObject object = getTopObjectByFqn(FQN_FORM, getProject());
assertTrue(object instanceof Form);
Form form = (Form)object;
FormField item = getListItem(form, "MyPredefined2");
assertNotNull(item);
Marker marker = getFirstMarker(CHECK_ID, item, getProject());
assertNull(marker);
}
/**
*
* Test the List.CorrectField is custom query field "MyPredefined2" with DCS title and has no item title,
* that is correct
*
* @throws Exception the exception
*/
@Test
public void testFormListCorrectFieldIsCorrect() throws Exception
{
IBmObject object = getTopObjectByFqn(FQN_FORM, getProject());
assertTrue(object instanceof Form);
Form form = (Form)object;
FormField item = getListItem(form, "CorrectField");
assertNotNull(item);
Marker marker = getFirstMarker(CHECK_ID, item, getProject());
assertNull(marker);
}
/**
*
* Test the List.SkuDescription is custom query field "SkuDescription" has no item title,
* that is incorrect
*
* @throws Exception the exception
*/
@Test
public void testFormListCorrectFieldIsIncorrect() throws Exception
{
IBmObject object = getTopObjectByFqn(FQN_FORM, getProject());
assertTrue(object instanceof Form);
Form form = (Form)object;
FormField item = getListItem(form, "SkuDescription");
assertNotNull(item);
Marker marker = getFirstMarker(CHECK_ID, item, getProject());
assertNotNull(marker);
}
private FormField getListItem(Form form, String name) throws Exception
{
for (FormItem item : form.getItems())
{
if ("List".equals(item.getName()))
{
assertTrue(item instanceof Table);
Table table = (Table)item;
for (FormItem subItem : table.getItems())
{
if (name.equals(subItem.getName()))
{
assertTrue(subItem instanceof FormField);
return (FormField)subItem;
}
}
return null;
}
}
return null;
}
}

View File

@ -0,0 +1,127 @@
/*******************************************************************************
* Copyright (C) 2022, 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.fix.itests;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.Optional;
import org.junit.Test;
import com._1c.g5.v8.bm.core.IBmObject;
import com._1c.g5.v8.dt.core.platform.IDtProject;
import com._1c.g5.v8.dt.dcs.model.schema.DataCompositionSchemaDataSetField;
import com._1c.g5.v8.dt.form.model.DynamicListExtInfo;
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.Table;
import com._1c.g5.v8.dt.validation.marker.Marker;
import com.e1c.v8codestyle.form.fix.DynamicListFieldTitleGenerateFix;
/**
* Tests for {@link DynamicListFieldTitleGenerateFix} fix.
*
* @author Dmitriy Marmyshev
*/
public class DynamicListFieldTitleGenerateFixTest
extends FormFixTestBase
{
private static final String CHECK_ID = "form-dynamic-list-item-title";
private static final String FIX_DESCRIPTION_PATTERN =
"Generate default title for dynamic list field \\(8\\.3\\.19\\+\\)";
private static final String PROJECT_NAME = "FormDynamicListItemTitle";
private static final String FQN_FORM = "Catalog.Products.Form.ListForm.Form";
public DynamicListFieldTitleGenerateFixTest()
{
super(FIX_DESCRIPTION_PATTERN);
}
@Test
public void testApplyFix() throws Exception
{
IDtProject dtProject = openProjectAndWaitForValidationFinish(PROJECT_NAME);
assertNotNull(dtProject);
IBmObject object = getTopObjectByFqn(FQN_FORM, dtProject);
assertTrue(object instanceof Form);
Form form = (Form)object;
String name = "SkuDescription";
FormField item = getListItem(form, name);
assertNotNull(item);
assertNull(item.getTitle().get("en"));
Marker marker = getFirstMarker(CHECK_ID, item, dtProject);
assertNotNull(marker);
// make fix
applyFix(marker, dtProject);
waitForDD(dtProject);
object = getTopObjectByFqn(FQN_FORM, dtProject);
assertTrue(object instanceof Form);
form = (Form)object;
item = getListItem(form, name);
assertNotNull(item);
assertNull(item.getTitle().get("en"));
marker = getFirstMarker(CHECK_ID, item, dtProject);
assertNull(marker);
DynamicListExtInfo custormQuery = (DynamicListExtInfo)form.getAttributes().get(0).getExtInfo();
Optional<DataCompositionSchemaDataSetField> field = custormQuery.getFields()
.stream()
.filter(DataCompositionSchemaDataSetField.class::isInstance)
.map(DataCompositionSchemaDataSetField.class::cast)
.filter(f -> name.equals(f.getDataPath()))
.findFirst();
assertTrue(field.isPresent());
if (field.isPresent())
{
assertNotNull(field.get().getTitle().getLocalValue().getContent().get("en"));
}
}
private FormField getListItem(Form form, String name) throws Exception
{
for (FormItem item : form.getItems())
{
if ("List".equals(item.getName()))
{
assertTrue(item instanceof Table);
Table table = (Table)item;
for (FormItem subItem : table.getItems())
{
if (name.equals(subItem.getName()))
{
assertTrue(subItem instanceof FormField);
return (FormField)subItem;
}
}
return null;
}
}
return null;
}
}

View File

@ -0,0 +1,106 @@
/*******************************************************************************
* Copyright (C) 2022, 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.fix.itests;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import com._1c.g5.v8.bm.core.IBmObject;
import com._1c.g5.v8.dt.core.platform.IDtProject;
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.Table;
import com._1c.g5.v8.dt.validation.marker.Marker;
import com.e1c.v8codestyle.form.fix.DynamicListItemTitleGenerateFix;
/**
* Tests for {@link DynamicListItemTitleGenerateFix} fix.
*
* @author Dmitriy Marmyshev
*/
public class DynamicListItemTitleGenerateFixTest
extends FormFixTestBase
{
private static final String CHECK_ID = "form-dynamic-list-item-title";
private static final String FIX_DESCRIPTION_PATTERN = "Generate title \".+\" for dynamic list form item \".+\"";
private static final String PROJECT_NAME = "FormDynamicListItemTitle";
private static final String FQN_FORM = "Catalog.Products.Form.ListForm.Form";
public DynamicListItemTitleGenerateFixTest()
{
super(FIX_DESCRIPTION_PATTERN);
}
@Test
public void testApplyFix() throws Exception
{
IDtProject dtProject = openProjectAndWaitForValidationFinish(PROJECT_NAME);
assertNotNull(dtProject);
IBmObject object = getTopObjectByFqn(FQN_FORM, dtProject);
assertTrue(object instanceof Form);
Form form = (Form)object;
FormField item = getListItem(form, "Code");
assertNotNull(item);
Marker marker = getFirstMarker(CHECK_ID, item, dtProject);
assertNotNull(marker);
// make fix
applyFix(marker, dtProject);
waitForDD(dtProject);
object = getTopObjectByFqn(FQN_FORM, dtProject);
assertTrue(object instanceof Form);
form = (Form)object;
item = getListItem(form, "Code");
assertNotNull(item);
assertNotNull(item.getTitle().get("en"));
marker = getFirstMarker(CHECK_ID, item, dtProject);
assertNull(marker);
}
private FormField getListItem(Form form, String name) throws Exception
{
for (FormItem item : form.getItems())
{
if ("List".equals(item.getName()))
{
assertTrue(item instanceof Table);
Table table = (Table)item;
for (FormItem subItem : table.getItems())
{
if (name.equals(subItem.getName()))
{
assertTrue(subItem instanceof FormField);
return (FormField)subItem;
}
}
return null;
}
}
return null;
}
}

View File

@ -0,0 +1,88 @@
/*******************************************************************************
* Copyright (C) 2022, 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.fix.itests;
import java.util.Collection;
import org.eclipse.core.runtime.NullProgressMonitor;
import com._1c.g5.v8.dt.core.naming.ISymbolicLinkLocalizer;
import com._1c.g5.v8.dt.core.platform.IDtProject;
import com._1c.g5.v8.dt.core.platform.IV8ProjectManager;
import com._1c.g5.v8.dt.form.naming.FormSymbolicLinkLocalizer;
import com._1c.g5.v8.dt.ui.util.OpenHelper;
import com._1c.g5.v8.dt.ui.validation.BmMarkerWrapper;
import com._1c.g5.v8.dt.validation.marker.IMarkerWrapper;
import com._1c.g5.v8.dt.validation.marker.Marker;
import com._1c.g5.wiring.ServiceAccess;
import com.e1c.g5.v8.dt.check.qfix.FixProcessHandle;
import com.e1c.g5.v8.dt.check.qfix.FixVariantDescriptor;
import com.e1c.g5.v8.dt.check.qfix.IFixManager;
import com.e1c.g5.v8.dt.testing.check.CheckTestBase;
/**
* The abstract test base class to test fixes in forms.
*
* @author Dmitriy Marmyshev
*/
public abstract class FormFixTestBase
extends CheckTestBase
{
private final String fixDescriptionPattern;
private IFixManager fixManager = ServiceAccess.get(IFixManager.class);
private IV8ProjectManager projectManager = ServiceAccess.get(IV8ProjectManager.class);
private ISymbolicLinkLocalizer symbolicLinkLocalizer = new FormSymbolicLinkLocalizer();
private final OpenHelper openHelper = new OpenHelper();
/**
* Instantiates a new form fix test base.
*
* @param fixDescriptionPattern the fix description pattern to match string of fix description,
* cannot be {@code null}.
*/
protected FormFixTestBase(String fixDescriptionPattern)
{
this.fixDescriptionPattern = fixDescriptionPattern;
}
/**
* Apply fix for the marker.
*
* @param marker the marker
* @param dtProject the DT project of the marker
*/
protected void applyFix(Marker marker, IDtProject dtProject)
{
IMarkerWrapper markerWrapper = new BmMarkerWrapper(marker, dtProject.getWorkspaceProject(), bmModelManager,
projectManager, symbolicLinkLocalizer, openHelper);
FixProcessHandle handle = fixManager.prepareFix(markerWrapper, dtProject);
FixVariantDescriptor variantDescr = null;
Collection<FixVariantDescriptor> variants = fixManager.getApplicableFixVariants(handle);
for (FixVariantDescriptor variant : variants)
{
if (variant.getDescription().matches(fixDescriptionPattern))
{
variantDescr = variant;
}
}
fixManager.selectFixVariant(variantDescr, handle);
fixManager.executeFix(handle, new NullProgressMonitor());
fixManager.finishFix(handle);
}
}

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>FormDynamicListItemTitle</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>

View File

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

View File

@ -0,0 +1,2 @@
Manifest-Version: 1.0
Runtime-Version: 8.3.19

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>de679f95-bfa7-4926-9c9c-32b47eaed22d</userSettingID>
</filter>
<order>
<viewMode>Normal</viewMode>
<userSettingID>58d9efd3-5c0f-405f-8239-1331c34d2f5f</userSettingID>
</order>
<conditionalAppearance>
<viewMode>Normal</viewMode>
<userSettingID>db8951ae-8646-4bea-821b-89e8389a7fe8</userSettingID>
</conditionalAppearance>
<itemsViewMode>Normal</itemsViewMode>
<itemsUserSettingID>5a3237e0-6547-4c2b-8c52-b158261e6faf</itemsUserSettingID>
</Settings>

View File

@ -0,0 +1,794 @@
<?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" xmlns:schema="http://g5.1c.ru/v8/dt/data-composition-system/schema">
<items xsi:type="form:FormGroup">
<name>ListSettingsComposerUserSettings</name>
<id>1</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<title>
<key>en</key>
<value>User settings group</value>
</title>
<verticalStretch>false</verticalStretch>
<extendedTooltip>
<name>ListSettingsComposerUserSettingsExtendedTooltip</name>
<id>2</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>
<type>UsualGroup</type>
<extInfo xsi:type="form:UsualGroupExtInfo">
<group>Vertical</group>
<behavior>Auto</behavior>
<representation>WeakSeparation</representation>
<showLeftMargin>true</showLeftMargin>
<united>true</united>
<throughAlign>Auto</throughAlign>
<currentRowUse>Auto</currentRowUse>
</extInfo>
</items>
<items xsi:type="form:Table">
<name>List</name>
<id>3</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<dataPath xsi:type="form:DataPath">
<segments>List</segments>
</dataPath>
<defaultItem>true</defaultItem>
<titleLocation>None</titleLocation>
<items xsi:type="form:FormField">
<name>Code</name>
<id>16</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<dataPath xsi:type="form:DataPath">
<segments>List.Code</segments>
</dataPath>
<defaultItem>true</defaultItem>
<extendedTooltip>
<name>CodeExtendedTooltip</name>
<id>18</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>CodeContextMenu</name>
<id>17</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>Code1</name>
<id>34</id>
<title>
<key>ru</key>
<value>Код</value>
</title>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<dataPath xsi:type="form:DataPath">
<segments>List.Code</segments>
</dataPath>
<extendedTooltip>
<name>Code1ExtendedTooltip</name>
<id>36</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>Code1ContextMenu</name>
<id>35</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>
</extInfo>
</items>
<items xsi:type="form:FormField">
<name>CodeCorrect</name>
<id>37</id>
<title>
<key>en</key>
<value>Code</value>
</title>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<dataPath xsi:type="form:DataPath">
<segments>List.Code</segments>
</dataPath>
<extendedTooltip>
<name>CodeCorrectExtendedTooltip</name>
<id>39</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>CodeCorrectContextMenu</name>
<id>38</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>
</extInfo>
</items>
<items xsi:type="form:FormField">
<name>Description</name>
<id>19</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<dataPath xsi:type="form:DataPath">
<segments>List.Description</segments>
</dataPath>
<extendedTooltip>
<name>DescriptionExtendedTooltip</name>
<id>21</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>DescriptionContextMenu</name>
<id>20</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>SKU</name>
<id>28</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<dataPath xsi:type="form:DataPath">
<segments>List.SKU</segments>
</dataPath>
<extendedTooltip>
<name>SKUExtendedTooltip</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>SKUContextMenu</name>
<id>29</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>
</extInfo>
</items>
<items xsi:type="form:FormField">
<name>MyPredefined</name>
<id>22</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<dataPath xsi:type="form:DataPath">
<segments>List.MyPredefined</segments>
</dataPath>
<extendedTooltip>
<name>MyPredefinedExtendedTooltip</name>
<id>24</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>MyPredefinedContextMenu</name>
<id>23</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>
</extInfo>
</items>
<items xsi:type="form:FormField">
<name>MyPredefined2</name>
<id>40</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<dataPath xsi:type="form:DataPath">
<segments>List.MyPredefined2</segments>
</dataPath>
<extendedTooltip>
<name>MyPredefined2ExtendedTooltip</name>
<id>42</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>MyPredefined2ContextMenu</name>
<id>41</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>
</extInfo>
</items>
<items xsi:type="form:FormField">
<name>CorrectField</name>
<id>25</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<dataPath xsi:type="form:DataPath">
<segments>List.MyPredefined2</segments>
</dataPath>
<extendedTooltip>
<name>CorrectFieldExtendedTooltip</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>CorrectFieldContextMenu</name>
<id>26</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>
</extInfo>
</items>
<items xsi:type="form:FormField">
<name>SkuDescription</name>
<id>31</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<dataPath xsi:type="form:DataPath">
<segments>List.SkuDescription</segments>
</dataPath>
<extendedTooltip>
<name>SkuDescriptionExtendedTooltip</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>SkuDescriptionContextMenu</name>
<id>32</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>
</extInfo>
</items>
<commandBarLocation>None</commandBarLocation>
<autoCommandBar>
<name>ListCommandBar</name>
<id>5</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<horizontalAlign>Left</horizontalAlign>
</autoCommandBar>
<searchStringAddition>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<name>ListSearchString</name>
<id>7</id>
<extendedTooltip>
<name>ListSearchStringExtendedTooltip</name>
<id>9</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>ListSearchStringContextMenu</name>
<id>8</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<autoFill>true</autoFill>
</contextMenu>
<source>ListSearchString</source>
<extInfo xsi:type="form:SearchStringAdditionExtInfo">
<autoMaxWidth>true</autoMaxWidth>
</extInfo>
</searchStringAddition>
<viewStatusAddition>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<name>ListViewStatus</name>
<id>10</id>
<extendedTooltip>
<name>ListViewStatusExtendedTooltip</name>
<id>12</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>ListViewStatusContextMenu</name>
<id>11</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<autoFill>true</autoFill>
</contextMenu>
<type>ViewStatusAddition</type>
<source>ListViewStatus</source>
<extInfo xsi:type="form:ViewStatusAdditionExtInfo">
<autoMaxWidth>true</autoMaxWidth>
</extInfo>
</viewStatusAddition>
<searchControlAddition>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<name>ListSearchControl</name>
<id>13</id>
<extendedTooltip>
<name>ListSearchControlExtendedTooltip</name>
<id>15</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>ListSearchControlContextMenu</name>
<id>14</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<autoFill>true</autoFill>
</contextMenu>
<type>SearchControlAddition</type>
<source>List</source>
<extInfo xsi:type="form:SearchControlAdditionExtInfo">
<autoMaxWidth>true</autoMaxWidth>
</extInfo>
</searchControlAddition>
<extendedTooltip>
<name>ListExtendedTooltip</name>
<id>6</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>ListContextMenu</name>
<id>4</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<autoFill>true</autoFill>
</contextMenu>
<changeRowSet>true</changeRowSet>
<changeRowOrder>true</changeRowOrder>
<autoMaxWidth>true</autoMaxWidth>
<autoMaxHeight>true</autoMaxHeight>
<autoMaxRowsCount>true</autoMaxRowsCount>
<selectionMode>MultiRow</selectionMode>
<header>true</header>
<headerHeight>1</headerHeight>
<footerHeight>1</footerHeight>
<horizontalScrollBar>AutoUse</horizontalScrollBar>
<verticalScrollBar>AutoUse</verticalScrollBar>
<horizontalLines>true</horizontalLines>
<verticalLines>true</verticalLines>
<useAlternationRowColor>true</useAlternationRowColor>
<searchOnInput>Auto</searchOnInput>
<initialListView>Auto</initialListView>
<initialTreeView>ExpandTopLevel</initialTreeView>
<horizontalStretch>true</horizontalStretch>
<verticalStretch>true</verticalStretch>
<enableStartDrag>true</enableStartDrag>
<enableDrag>true</enableDrag>
<fileDragMode>AsFileRef</fileDragMode>
<rowPictureDataPath xsi:type="form:DataPath">
<segments>List.DefaultPicture</segments>
</rowPictureDataPath>
<extInfo xsi:type="form:DynamicListTableExtInfo">
<autoRefreshPeriod>60</autoRefreshPeriod>
<period>
<startDate>0001-01-01T00:00:00</startDate>
<endDate>0001-01-01T00:00:00</endDate>
</period>
<topLevelParent xsi:type="core:UndefinedValue"/>
<showRoot>true</showRoot>
<allowGettingCurrentRowURL>true</allowGettingCurrentRowURL>
<userSettingsGroup>ListSettingsComposerUserSettings</userSettingsGroup>
</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>List</name>
<id>1</id>
<valueType>
<types>DynamicList</types>
</valueType>
<view>
<common>true</common>
</view>
<edit>
<common>true</common>
</edit>
<main>true</main>
<extInfo xsi:type="form:DynamicListExtInfo">
<queryText>SELECT
Products.Ref,
Products.DeletionMark,
&quot;&quot; AS Code,
Products.SKU,
Products.Description,
Products.Description + &quot;&quot; + Products.SKU AS SkuDescription,
Products.Predefined AS MyPredefined,
Products.PredefinedDataName AS MyPredefined2
FROM
Catalog.Products
AS
Products</queryText>
<mainTable>Catalog.Products</mainTable>
<dynamicDataRead>true</dynamicDataRead>
<autoFillAvailableFields>true</autoFillAvailableFields>
<customQuery>true</customQuery>
<autoSaveUserSettings>true</autoSaveUserSettings>
<getInvisibleFieldPresentations>true</getInvisibleFieldPresentations>
<fields xsi:type="schema:DataCompositionSchemaDataSetField">
<dataPath>Ref</dataPath>
<field>Ref</field>
</fields>
<fields xsi:type="schema:DataCompositionSchemaDataSetField">
<dataPath>DeletionMark</dataPath>
<field>DeletionMark</field>
</fields>
<fields xsi:type="schema:DataCompositionSchemaDataSetField">
<dataPath>Code</dataPath>
<field>Code</field>
</fields>
<fields xsi:type="schema:DataCompositionSchemaDataSetField">
<dataPath>Description</dataPath>
<field>Description</field>
</fields>
<fields xsi:type="schema:DataCompositionSchemaDataSetField">
<dataPath>MyPredefined2</dataPath>
<field>MyPredefined2</field>
<title>
<localValue>
<content>
<key>en</key>
<value>My predefined2</value>
</content>
<content>
<key>ru</key>
<value>Мой предопределенный2</value>
</content>
</localValue>
</title>
</fields>
<fields xsi:type="schema:DataCompositionSchemaDataSetField">
<dataPath>SKU</dataPath>
<field>SKU</field>
</fields>
<fields xsi:type="schema:DataCompositionSchemaDataSetField">
<dataPath>MyPredefined</dataPath>
<field>MyPredefined</field>
</fields>
</extInfo>
</attributes>
<commandInterface>
<navigationPanel/>
<commandBar/>
</commandInterface>
<extInfo xsi:type="form:DynamicListFormExtInfo"/>
</form:Form>

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<mdclass:Catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:core="http://g5.1c.ru/v8/dt/mcore" xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="19f24be2-79db-40c6-b783-c0d0baee9af8">
<producedTypes>
<objectType typeId="f1bb1d69-b4c2-4880-9b26-f95f5ae53aab" valueTypeId="c146fa48-5e89-4430-b513-29fee7902e86"/>
<refType typeId="8dc93786-51f1-4e84-95cb-cac8453dd08b" valueTypeId="6eb6c026-7bb1-4e1b-83c7-91019d1f6925"/>
<selectionType typeId="c5d07061-3624-49df-b3a5-ed7fd12be736" valueTypeId="df720f83-bdea-4991-9ad5-d54782b3beb2"/>
<listType typeId="57aca274-20aa-4e12-bd92-87bb4907e53b" valueTypeId="cb372a2a-a0de-4e67-a51c-3100dc3085f4"/>
<managerType typeId="62eaed15-64de-428a-95c0-85ce02d55b1a" valueTypeId="bcd436b6-e7f0-47de-8016-8f6a790182af"/>
</producedTypes>
<name>Products</name>
<synonym>
<key>en</key>
<value>Products</value>
</synonym>
<useStandardCommands>true</useStandardCommands>
<inputByString>Catalog.Products.StandardAttribute.Code</inputByString>
<inputByString>Catalog.Products.StandardAttribute.Description</inputByString>
<fullTextSearchOnInputByString>DontUse</fullTextSearchOnInputByString>
<createOnInput>Use</createOnInput>
<dataLockControlMode>Managed</dataLockControlMode>
<fullTextSearch>Use</fullTextSearch>
<levelCount>2</levelCount>
<foldersOnTop>true</foldersOnTop>
<codeLength>9</codeLength>
<descriptionLength>25</descriptionLength>
<codeType>String</codeType>
<codeAllowedLength>Variable</codeAllowedLength>
<checkUnique>true</checkUnique>
<autonumbering>true</autonumbering>
<defaultPresentation>AsDescription</defaultPresentation>
<editType>InDialog</editType>
<choiceMode>BothWays</choiceMode>
<defaultListForm>Catalog.Products.Form.ListForm</defaultListForm>
<attributes uuid="05d277fb-ce38-4682-b29f-deaeed91e54d">
<name>SKU</name>
<synonym>
<key>en</key>
<value>SKU</value>
</synonym>
<type>
<types>String</types>
<stringQualifiers>
<length>10</length>
</stringQualifiers>
</type>
<minValue xsi:type="core:UndefinedValue"/>
<maxValue xsi:type="core:UndefinedValue"/>
<fillValue xsi:type="core:UndefinedValue"/>
<fullTextSearch>Use</fullTextSearch>
<dataHistory>Use</dataHistory>
</attributes>
<forms uuid="560f21bb-d3d2-48f9-a71a-1be509d4f55a">
<name>ListForm</name>
<synonym>
<key>en</key>
<value>List form</value>
</synonym>
<usePurposes>PersonalComputer</usePurposes>
<usePurposes>MobileDevice</usePurposes>
</forms>
</mdclass:Catalog>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<cmi:CommandInterface xmlns:cmi="http://g5.1c.ru/v8/dt/cmi"/>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<mdclass:Configuration xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="3c7ccc61-9e61-4835-bc36-475e58b07634">
<name>FormDynamicListItemTitle</name>
<synonym>
<key>en</key>
<value>Form dynamic list item title</value>
</synonym>
<containedObjects classId="9cd510cd-abfc-11d4-9434-004095e12fc7" objectId="7173d032-0c69-4898-b246-1b371235ccfe"/>
<containedObjects classId="9fcd25a0-4822-11d4-9414-008048da11f9" objectId="ce719401-a788-4561-ad56-5952f691e257"/>
<containedObjects classId="e3687481-0a87-462c-a166-9f34594f9bba" objectId="ceb5d60b-11b4-47e8-a10c-4c8018c2cd00"/>
<containedObjects classId="9de14907-ec23-4a07-96f0-85521cb6b53b" objectId="d13d7768-f235-42f3-95d4-474bc387c221"/>
<containedObjects classId="51f2d5d8-ea4d-4064-8892-82951750031e" objectId="74ab39b4-caa5-40ec-aed0-b1535bdd98dc"/>
<containedObjects classId="e68182ea-4237-4383-967f-90c1e3370bc7" objectId="3abdb344-e60c-4eae-9be3-6fdd82783186"/>
<containedObjects classId="fb282519-d103-4dd3-bc12-cb271d631dfc" objectId="5146c517-382b-408d-8213-134cec1b83f9"/>
<configurationExtensionCompatibilityMode>8.3.21</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.21</compatibilityMode>
<languages uuid="712603c1-042e-431e-8a35-531286205955">
<name>English</name>
<synonym>
<key>en</key>
<value>English</value>
</synonym>
<languageCode>en</languageCode>
</languages>
<languages uuid="4401d1ea-39b0-47a7-9c64-72dcd47c8815">
<name>Russian</name>
<synonym>
<key>en</key>
<value>Russian</value>
</synonym>
<languageCode>ru</languageCode>
</languages>
<catalogs>Catalog.Products</catalogs>
</mdclass:Configuration>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<cmi:CommandInterface xmlns:cmi="http://g5.1c.ru/v8/dt/cmi"/>