mirror of
https://github.com/1C-Company/v8-code-style.git
synced 2025-02-15 01:04:04 +02:00
Найдена экспортная процедура или функция в модуле команды
This commit is contained in:
parent
c7cf065d21
commit
92fcae7f4b
@ -47,6 +47,7 @@
|
|||||||
12. Секция возвращаемого значения документирующего комментария содержит корректные типы
|
12. Секция возвращаемого значения документирующего комментария содержит корректные типы
|
||||||
13. Определение типа документирующего комментария
|
13. Определение типа документирующего комментария
|
||||||
- Исправлен идентификатор проверки тип в строгой типизации: `doc-comment-field-type` -> `doc-comment-field-type-strict`
|
- Исправлен идентификатор проверки тип в строгой типизации: `doc-comment-field-type` -> `doc-comment-field-type-strict`
|
||||||
|
- Ограничения на использование экспортных процедур и функций в модулях команд и форм
|
||||||
|
|
||||||
#### Запросы
|
#### Запросы
|
||||||
|
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
# Restrictions on the use of export procedures and functions in a command and form modules
|
||||||
|
|
||||||
|
Do not embed export procedures and functions in modules of commands and forms.
|
||||||
|
You cannot address such modules from external code, so embedded export procedures and functions become dysfunctional.
|
||||||
|
|
||||||
|
## Noncompliant Code Example
|
||||||
|
|
||||||
|
```bsl
|
||||||
|
&AtClient
|
||||||
|
Procedure CommandProcessing(CommandParameter, CommandExecuteParameters) Export
|
||||||
|
EndProcedure
|
||||||
|
```
|
||||||
|
|
||||||
|
## Compliant Solution
|
||||||
|
|
||||||
|
```bsl
|
||||||
|
&AtClient
|
||||||
|
Procedure CommandProcessing(CommandParameter, CommandExecuteParameters)
|
||||||
|
EndProcedure
|
||||||
|
```
|
||||||
|
|
||||||
|
## See
|
||||||
|
|
||||||
|
- [Restrictions on the use of export procedures and functions](https://support.1ci.com/hc/en-us/articles/360011002940-Restrictions-on-the-use-of-export-procedures-and-functions)
|
@ -0,0 +1,25 @@
|
|||||||
|
# Ограничения на использование экспортных процедур и функций в модуле команд и форм
|
||||||
|
|
||||||
|
Не следует размещать экспортные процедуры и функции в модулях команд и
|
||||||
|
форм. К этим модулям нет возможности обращаться из внешнего по
|
||||||
|
отношению к ним кода, поэтому экспортные процедуры и функции в этих
|
||||||
|
модулях не имеют смысла.
|
||||||
|
|
||||||
|
## Неправильно
|
||||||
|
|
||||||
|
```bsl
|
||||||
|
&НаКлиенте
|
||||||
|
Процедура ОбработкаКоманды(ПараметрКоманды, ПараметрыВыполненияКоманды) Экспорт
|
||||||
|
КонецПроцедуры
|
||||||
|
```
|
||||||
|
|
||||||
|
## Правильно
|
||||||
|
|
||||||
|
```bsl
|
||||||
|
Процедура ОбработкаКоманды(ПараметрКоманды, ПараметрыВыполненияКоманды)
|
||||||
|
КонецПроцедуры
|
||||||
|
```
|
||||||
|
|
||||||
|
## См.
|
||||||
|
|
||||||
|
- [Ограничения на использование экспортных процедур и функций](https://its.1c.ru/db/v8std#content:544:hdoc)
|
@ -222,6 +222,10 @@
|
|||||||
category="com.e1c.v8codestyle.bsl"
|
category="com.e1c.v8codestyle.bsl"
|
||||||
class="com.e1c.v8codestyle.bsl.check.NewColorCheck">
|
class="com.e1c.v8codestyle.bsl.check.NewColorCheck">
|
||||||
</check>
|
</check>
|
||||||
|
<check
|
||||||
|
category="com.e1c.v8codestyle.bsl"
|
||||||
|
class="com.e1c.v8codestyle.bsl.check.ExportMethodInCommandFormModuleCheck">
|
||||||
|
</check>
|
||||||
|
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
|
@ -0,0 +1,148 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* 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.bsl.check;
|
||||||
|
|
||||||
|
import static com._1c.g5.v8.dt.bsl.model.BslPackage.Literals.MODULE;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.emf.common.util.TreeIterator;
|
||||||
|
import org.eclipse.emf.ecore.EObject;
|
||||||
|
|
||||||
|
import com._1c.g5.v8.dt.bsl.model.BslPackage;
|
||||||
|
import com._1c.g5.v8.dt.bsl.model.Expression;
|
||||||
|
import com._1c.g5.v8.dt.bsl.model.Method;
|
||||||
|
import com._1c.g5.v8.dt.bsl.model.Module;
|
||||||
|
import com._1c.g5.v8.dt.bsl.model.ModuleType;
|
||||||
|
import com._1c.g5.v8.dt.bsl.model.OperatorStyleCreator;
|
||||||
|
import com._1c.g5.v8.dt.bsl.model.StringLiteral;
|
||||||
|
import com._1c.g5.v8.dt.common.StringUtils;
|
||||||
|
import com._1c.g5.v8.dt.mcore.util.McoreUtil;
|
||||||
|
import com.e1c.g5.v8.dt.check.CheckComplexity;
|
||||||
|
import com.e1c.g5.v8.dt.check.ICheckParameters;
|
||||||
|
import com.e1c.g5.v8.dt.check.components.BasicCheck;
|
||||||
|
import com.e1c.g5.v8.dt.check.settings.IssueSeverity;
|
||||||
|
import com.e1c.g5.v8.dt.check.settings.IssueType;
|
||||||
|
import com.e1c.v8codestyle.check.StandardCheckExtension;
|
||||||
|
import com.e1c.v8codestyle.internal.bsl.BslPlugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks an export procedure or function was found in the command module.
|
||||||
|
*
|
||||||
|
* @author Artem Iliukhin
|
||||||
|
*/
|
||||||
|
public final class ExportMethodInCommandFormModuleCheck
|
||||||
|
extends BasicCheck
|
||||||
|
{
|
||||||
|
|
||||||
|
private static final String TYPE_NAME = "NotifyDescription"; //$NON-NLS-1$
|
||||||
|
private static final String CHECK_ID = "export-method-in-command-form-module"; //$NON-NLS-1$
|
||||||
|
private static final String PARAMETER_NOTIFY_METHODS_EXCLUSION = "notifyDescriptionMethods"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCheckId()
|
||||||
|
{
|
||||||
|
return CHECK_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configureCheck(CheckConfigurer builder)
|
||||||
|
{
|
||||||
|
builder.title(Messages.ExportMethodInCommandModule_Do_not_use_export_method_in_commands_module)
|
||||||
|
.description(Messages.ExportMethodInCommandModule_Do_not_emded_export_method_in_modules_of_command_des)
|
||||||
|
.complexity(CheckComplexity.NORMAL)
|
||||||
|
.severity(IssueSeverity.MINOR)
|
||||||
|
.issueType(IssueType.WARNING)
|
||||||
|
.extension(new StandardCheckExtension(getCheckId(), BslPlugin.PLUGIN_ID))
|
||||||
|
.module()
|
||||||
|
.checkedObjectType(MODULE)
|
||||||
|
.parameter(PARAMETER_NOTIFY_METHODS_EXCLUSION, String.class, StringUtils.EMPTY,
|
||||||
|
Messages.ExportMethodInCommandFormModuleCheck_Notify_description_methods);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters,
|
||||||
|
IProgressMonitor monitor)
|
||||||
|
{
|
||||||
|
Module module = (Module)object;
|
||||||
|
ModuleType type = module.getModuleType();
|
||||||
|
if (type != ModuleType.COMMAND_MODULE && type != ModuleType.FORM_MODULE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Method> exportMethods = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
|
for (Method method : module.allMethods())
|
||||||
|
{
|
||||||
|
if (monitor.isCanceled())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (method.isExport())
|
||||||
|
{
|
||||||
|
exportMethods.put(method.getName(), method);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String parameterMethodNames = parameters.getString(PARAMETER_NOTIFY_METHODS_EXCLUSION);
|
||||||
|
if (!StringUtils.isEmpty(parameterMethodNames))
|
||||||
|
{
|
||||||
|
List<String> list = List.of(parameterMethodNames.split(",\\s*")); //$NON-NLS-1$
|
||||||
|
list.forEach(exportMethods::remove);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exportMethods.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (TreeIterator<EObject> iterator = module.eAllContents(); iterator.hasNext();)
|
||||||
|
{
|
||||||
|
if (monitor.isCanceled())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EObject containedObject = iterator.next();
|
||||||
|
if (containedObject instanceof OperatorStyleCreator
|
||||||
|
&& TYPE_NAME.equals(McoreUtil.getTypeName(((OperatorStyleCreator)containedObject).getType())))
|
||||||
|
{
|
||||||
|
List<Expression> params = ((OperatorStyleCreator)containedObject).getParams();
|
||||||
|
if (!params.isEmpty() && params.get(0) instanceof StringLiteral)
|
||||||
|
{
|
||||||
|
StringLiteral literal = (StringLiteral)params.get(0);
|
||||||
|
List<String> lines = literal.lines(true);
|
||||||
|
if (!lines.isEmpty())
|
||||||
|
{
|
||||||
|
exportMethods.remove(lines.get(0));
|
||||||
|
if (exportMethods.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Method method : exportMethods.values())
|
||||||
|
{
|
||||||
|
resultAceptor.addIssue(
|
||||||
|
Messages.ExportMethodInCommandModule_Do_not_emded_export_method_in_modules_of_command_result, method,
|
||||||
|
BslPackage.Literals.METHOD__EXPORT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -69,6 +69,14 @@ final class Messages
|
|||||||
|
|
||||||
public static String EventHandlerBooleanParamCheck_title;
|
public static String EventHandlerBooleanParamCheck_title;
|
||||||
|
|
||||||
|
public static String ExportMethodInCommandFormModuleCheck_Notify_description_methods;
|
||||||
|
|
||||||
|
public static String ExportMethodInCommandModule_Do_not_emded_export_method_in_modules_of_command_des;
|
||||||
|
|
||||||
|
public static String ExportMethodInCommandModule_Do_not_emded_export_method_in_modules_of_command_result;
|
||||||
|
|
||||||
|
public static String ExportMethodInCommandModule_Do_not_use_export_method_in_commands_module;
|
||||||
|
|
||||||
public static String ModuleStructureTopRegionCheck_description;
|
public static String ModuleStructureTopRegionCheck_description;
|
||||||
|
|
||||||
public static String ModuleStructureTopRegionCheck_error_message;
|
public static String ModuleStructureTopRegionCheck_error_message;
|
||||||
|
@ -70,6 +70,14 @@ EventHandlerBooleanParamCheck_description = Use event handler boolean parameter
|
|||||||
|
|
||||||
EventHandlerBooleanParamCheck_title = Use event handler boolean parameter
|
EventHandlerBooleanParamCheck_title = Use event handler boolean parameter
|
||||||
|
|
||||||
|
ExportMethodInCommandFormModuleCheck_Notify_description_methods=Comma-separated list of excluded notification method names
|
||||||
|
|
||||||
|
ExportMethodInCommandModule_Do_not_emded_export_method_in_modules_of_command_des=Do not embed export procedures and functions in modules of commands and forms. You cannot address such modules from external code, so embedded export procedures and functions become dysfunctional.
|
||||||
|
|
||||||
|
ExportMethodInCommandModule_Do_not_emded_export_method_in_modules_of_command_result=Do not embed export procedures and functions in modules of commands and forms. You cannot address such modules from external code, so embedded export procedures and functions become dysfunctional.
|
||||||
|
|
||||||
|
ExportMethodInCommandModule_Do_not_use_export_method_in_commands_module=Restrictions on the use of export procedures and functions
|
||||||
|
|
||||||
FormModuleMissingPragmaCheck_Missing_compilation_directives = Missing compilation directives
|
FormModuleMissingPragmaCheck_Missing_compilation_directives = Missing compilation directives
|
||||||
|
|
||||||
FormModuleMissingPragmaCheck_description = Always use compilation pragma in form module
|
FormModuleMissingPragmaCheck_description = Always use compilation pragma in form module
|
||||||
|
@ -70,6 +70,14 @@ EventHandlerBooleanParamCheck_description = Использование буле
|
|||||||
|
|
||||||
EventHandlerBooleanParamCheck_title = Использование булевого параметра обработчика события
|
EventHandlerBooleanParamCheck_title = Использование булевого параметра обработчика события
|
||||||
|
|
||||||
|
ExportMethodInCommandFormModuleCheck_Notify_description_methods=Список исключаемых имен методов оповещения, разделенные запятой
|
||||||
|
|
||||||
|
ExportMethodInCommandModule_Do_not_emded_export_method_in_modules_of_command_des=Не следует размещать экспортные процедуры и функции в модулях команд и форм. К этим модулям нет возможности обращаться из внешнего по отношению к ним кода, поэтому экспортные процедуры и функции в этих модулях не имеют смысла.
|
||||||
|
|
||||||
|
ExportMethodInCommandModule_Do_not_emded_export_method_in_modules_of_command_result=Не следует размещать экспортные процедуры и функции в модулях команд и форм. К этим модулям нет возможности обращаться из внешнего по отношению к ним кода, поэтому экспортные процедуры и функции в этих модулях не имеют смысла.
|
||||||
|
|
||||||
|
ExportMethodInCommandModule_Do_not_use_export_method_in_commands_module=Ограничения на использование экспортных процедур и функций
|
||||||
|
|
||||||
FormModuleMissingPragmaCheck_Missing_compilation_directives = Пропущена директива компиляции
|
FormModuleMissingPragmaCheck_Missing_compilation_directives = Пропущена директива компиляции
|
||||||
|
|
||||||
FormModuleMissingPragmaCheck_description = Всегда использовать директивы компиляции в модуле формы
|
FormModuleMissingPragmaCheck_description = Всегда использовать директивы компиляции в модуле формы
|
||||||
|
@ -0,0 +1,165 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* 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.bsl.check.itests;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.junit.Assert.assertNull;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com._1c.g5.v8.bm.core.IBmObject;
|
||||||
|
import com._1c.g5.v8.dt.bsl.model.Method;
|
||||||
|
import com._1c.g5.v8.dt.bsl.model.Module;
|
||||||
|
import com._1c.g5.v8.dt.core.platform.IDtProject;
|
||||||
|
import com._1c.g5.v8.dt.form.model.Form;
|
||||||
|
import com._1c.g5.v8.dt.metadata.mdclass.BasicCommand;
|
||||||
|
import com._1c.g5.v8.dt.metadata.mdclass.Catalog;
|
||||||
|
import com._1c.g5.v8.dt.validation.marker.Marker;
|
||||||
|
import com.e1c.g5.v8.dt.testing.check.SingleProjectReadOnlyCheckTestBase;
|
||||||
|
import com.e1c.v8codestyle.bsl.check.ExportMethodInCommandFormModuleCheck;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests for {@link ExportMethodInCommandFormModuleCheck} check.
|
||||||
|
*
|
||||||
|
* @author Artem Iliukhin
|
||||||
|
*/
|
||||||
|
public class ExportMethodInCommandFormModuleCheckTest
|
||||||
|
extends SingleProjectReadOnlyCheckTestBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private static final String CHECK_ID = "export-method-in-command-form-module";
|
||||||
|
private static final String MESSAGE =
|
||||||
|
"Do not embed export procedures and functions in modules of commands and forms. "
|
||||||
|
+ "You cannot address such modules from external code, "
|
||||||
|
+ "so embedded export procedures and functions become dysfunctional.";
|
||||||
|
private static final String PROJECT_NAME = "ExportMethodInCommandFormModuleCheck";
|
||||||
|
private static final String FQN_CATALOG = "Catalog.Products";
|
||||||
|
private static final String FQN_CATALOG_FORM = "Catalog.Products.Form.ItemForm.Form";
|
||||||
|
private static final String FQN_COMMAND = "CommonCommand.CommonCommand";
|
||||||
|
private static final String FQN_COMMAND_NOTIFY = "CommonCommand.CommonCommand1";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTestConfigurationName()
|
||||||
|
{
|
||||||
|
return PROJECT_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testForm() throws Exception
|
||||||
|
{
|
||||||
|
IDtProject dtProject = dtProjectManager.getDtProject(PROJECT_NAME);
|
||||||
|
assertNotNull(dtProject);
|
||||||
|
|
||||||
|
IBmObject mdObject = getTopObjectByFqn(FQN_CATALOG_FORM, dtProject);
|
||||||
|
assertTrue(mdObject instanceof Form);
|
||||||
|
Module module = ((Form)mdObject).getModule();
|
||||||
|
assertNotNull(module);
|
||||||
|
|
||||||
|
List<Method> methods = module.allMethods();
|
||||||
|
assertEquals(1, methods.size());
|
||||||
|
|
||||||
|
Method noncompliantMethod = methods.get(0);
|
||||||
|
Marker marker = getFirstMarker(CHECK_ID, noncompliantMethod, dtProject);
|
||||||
|
assertNotNull(marker);
|
||||||
|
assertEquals(MESSAGE, marker.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCommonCommand() throws Exception
|
||||||
|
{
|
||||||
|
IDtProject dtProject = dtProjectManager.getDtProject(PROJECT_NAME);
|
||||||
|
assertNotNull(dtProject);
|
||||||
|
|
||||||
|
IBmObject mdObject = getTopObjectByFqn(FQN_COMMAND, dtProject);
|
||||||
|
assertTrue(mdObject instanceof BasicCommand);
|
||||||
|
Module module = ((BasicCommand)mdObject).getCommandModule();
|
||||||
|
assertNotNull(module);
|
||||||
|
|
||||||
|
List<Method> methods = module.allMethods();
|
||||||
|
assertEquals(1, methods.size());
|
||||||
|
|
||||||
|
Method noncompliantMethod = methods.get(0);
|
||||||
|
Marker marker = getFirstMarker(CHECK_ID, noncompliantMethod, dtProject);
|
||||||
|
assertNotNull(marker);
|
||||||
|
assertEquals(MESSAGE, marker.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCommonCommandNotify() throws Exception
|
||||||
|
{
|
||||||
|
IDtProject dtProject = dtProjectManager.getDtProject(PROJECT_NAME);
|
||||||
|
assertNotNull(dtProject);
|
||||||
|
|
||||||
|
IBmObject mdObject = getTopObjectByFqn(FQN_COMMAND_NOTIFY, dtProject);
|
||||||
|
assertTrue(mdObject instanceof BasicCommand);
|
||||||
|
Module module = ((BasicCommand)mdObject).getCommandModule();
|
||||||
|
assertNotNull(module);
|
||||||
|
|
||||||
|
List<Method> methods = module.allMethods();
|
||||||
|
assertEquals(2, methods.size());
|
||||||
|
|
||||||
|
Method method = methods.get(1);
|
||||||
|
Marker marker = getFirstMarker(CHECK_ID, method, dtProject);
|
||||||
|
assertNull(marker);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCatalogCommand() throws Exception
|
||||||
|
{
|
||||||
|
IDtProject dtProject = dtProjectManager.getDtProject(PROJECT_NAME);
|
||||||
|
assertNotNull(dtProject);
|
||||||
|
|
||||||
|
IBmObject mdObject = getTopObjectByFqn(FQN_CATALOG, dtProject);
|
||||||
|
assertTrue(mdObject instanceof Catalog);
|
||||||
|
assertEquals(2, ((Catalog)mdObject).getCommands().size());
|
||||||
|
BasicCommand command = ((Catalog)mdObject).getCommands().get(0);
|
||||||
|
assertTrue(command instanceof BasicCommand);
|
||||||
|
Module module = command.getCommandModule();
|
||||||
|
assertNotNull(module);
|
||||||
|
|
||||||
|
List<Method> methods = module.allMethods();
|
||||||
|
assertEquals(1, methods.size());
|
||||||
|
|
||||||
|
Method noncompliantMethod = methods.get(0);
|
||||||
|
Marker marker = getFirstMarker(CHECK_ID, noncompliantMethod, dtProject);
|
||||||
|
assertNotNull(marker);
|
||||||
|
assertEquals(MESSAGE, marker.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCatalogCommandNotify() throws Exception
|
||||||
|
{
|
||||||
|
IDtProject dtProject = dtProjectManager.getDtProject(PROJECT_NAME);
|
||||||
|
assertNotNull(dtProject);
|
||||||
|
|
||||||
|
IBmObject mdObject = getTopObjectByFqn(FQN_CATALOG, dtProject);
|
||||||
|
assertTrue(mdObject instanceof Catalog);
|
||||||
|
assertEquals(2, ((Catalog)mdObject).getCommands().size());
|
||||||
|
BasicCommand command = ((Catalog)mdObject).getCommands().get(1);
|
||||||
|
assertTrue(command instanceof BasicCommand);
|
||||||
|
Module module = command.getCommandModule();
|
||||||
|
assertNotNull(module);
|
||||||
|
|
||||||
|
List<Method> methods = module.allMethods();
|
||||||
|
assertEquals(2, methods.size());
|
||||||
|
|
||||||
|
Method method = methods.get(1);
|
||||||
|
Marker marker = getFirstMarker(CHECK_ID, method, dtProject);
|
||||||
|
assertNull(marker);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>ExportMethodInCommandFormModuleCheck</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
|
||||||
|
<nature>com._1c.g5.v8.dt.core.V8ConfigurationNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding/<project>=UTF-8
|
@ -0,0 +1,2 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
Runtime-Version: 8.3.19
|
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
&AtClient
|
||||||
|
Procedure CommandProcessing(CommandParameter, CommandExecuteParameters)
|
||||||
|
ShowQueryBox(New NotifyDescription("OfferDiscussionsCompletion", ThisObject), "", QuestionDialogMode.YesNo);
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
&AtClient
|
||||||
|
Procedure OfferDiscussionsCompletion(Result, Param) Export
|
||||||
|
//...
|
||||||
|
EndProcedure
|
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
&AtClient
|
||||||
|
Procedure CommandProcessing(CommandParameter, CommandExecuteParameters) Export
|
||||||
|
EndProcedure
|
@ -0,0 +1,143 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<form:Form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:form="http://g5.1c.ru/v8/dt/form">
|
||||||
|
<items xsi:type="form:FormField">
|
||||||
|
<name>Code</name>
|
||||||
|
<id>1</id>
|
||||||
|
<visible>true</visible>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
<userVisible>
|
||||||
|
<common>true</common>
|
||||||
|
</userVisible>
|
||||||
|
<dataPath xsi:type="form:DataPath">
|
||||||
|
<segments>Object.Code</segments>
|
||||||
|
</dataPath>
|
||||||
|
<extendedTooltip>
|
||||||
|
<name>CodeExtendedTooltip</name>
|
||||||
|
<id>3</id>
|
||||||
|
<visible>true</visible>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
<userVisible>
|
||||||
|
<common>true</common>
|
||||||
|
</userVisible>
|
||||||
|
<type>Label</type>
|
||||||
|
<autoMaxWidth>true</autoMaxWidth>
|
||||||
|
<autoMaxHeight>true</autoMaxHeight>
|
||||||
|
<extInfo xsi:type="form:LabelDecorationExtInfo">
|
||||||
|
<horizontalAlign>Left</horizontalAlign>
|
||||||
|
</extInfo>
|
||||||
|
</extendedTooltip>
|
||||||
|
<contextMenu>
|
||||||
|
<name>CodeContextMenu</name>
|
||||||
|
<id>2</id>
|
||||||
|
<visible>true</visible>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
<userVisible>
|
||||||
|
<common>true</common>
|
||||||
|
</userVisible>
|
||||||
|
<autoFill>true</autoFill>
|
||||||
|
</contextMenu>
|
||||||
|
<type>InputField</type>
|
||||||
|
<editMode>EnterOnInput</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>4</id>
|
||||||
|
<visible>true</visible>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
<userVisible>
|
||||||
|
<common>true</common>
|
||||||
|
</userVisible>
|
||||||
|
<dataPath xsi:type="form:DataPath">
|
||||||
|
<segments>Object.Description</segments>
|
||||||
|
</dataPath>
|
||||||
|
<extendedTooltip>
|
||||||
|
<name>DescriptionExtendedTooltip</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>DescriptionContextMenu</name>
|
||||||
|
<id>5</id>
|
||||||
|
<visible>true</visible>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
<userVisible>
|
||||||
|
<common>true</common>
|
||||||
|
</userVisible>
|
||||||
|
<autoFill>true</autoFill>
|
||||||
|
</contextMenu>
|
||||||
|
<type>InputField</type>
|
||||||
|
<editMode>EnterOnInput</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>
|
||||||
|
<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>
|
||||||
|
<windowOpeningMode>LockOwnerWindow</windowOpeningMode>
|
||||||
|
<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>Object</name>
|
||||||
|
<id>1</id>
|
||||||
|
<valueType>
|
||||||
|
<types>CatalogObject.Products</types>
|
||||||
|
</valueType>
|
||||||
|
<view>
|
||||||
|
<common>true</common>
|
||||||
|
</view>
|
||||||
|
<edit>
|
||||||
|
<common>true</common>
|
||||||
|
</edit>
|
||||||
|
<main>true</main>
|
||||||
|
<savedData>true</savedData>
|
||||||
|
</attributes>
|
||||||
|
<commandInterface>
|
||||||
|
<navigationPanel/>
|
||||||
|
<commandBar/>
|
||||||
|
</commandInterface>
|
||||||
|
<extInfo xsi:type="form:CatalogFormExtInfo"/>
|
||||||
|
</form:Form>
|
@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
&AtClient
|
||||||
|
Procedure Test() Export
|
||||||
|
|
||||||
|
EndProcedure
|
@ -0,0 +1,61 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<mdclass:Catalog xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="a15168d1-d762-4d1f-8a95-e059744e6ece">
|
||||||
|
<producedTypes>
|
||||||
|
<objectType typeId="76c1a774-45f6-40ab-95e8-593e655651c4" valueTypeId="990181bc-4ca9-45b0-bdd5-a303c4be5fbd"/>
|
||||||
|
<refType typeId="f3051f0f-c874-46eb-8c89-da8029ec4f47" valueTypeId="3dba9d4d-758f-48c2-b86a-ddf9650c0154"/>
|
||||||
|
<selectionType typeId="afdba0a0-6eb6-4149-bae4-44aa586a897a" valueTypeId="e70aaa7b-2aa4-43cb-b310-3f5a60b6d16d"/>
|
||||||
|
<listType typeId="b3b6742c-4fdd-43dd-a448-bb12f64270fe" valueTypeId="79b51c5f-477f-4c5b-bd8d-dfb622aa6ad0"/>
|
||||||
|
<managerType typeId="363432e0-5204-43b8-8a7b-f9082b64f113" valueTypeId="df2dee50-545a-4e28-96b1-a4371fe77374"/>
|
||||||
|
</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>
|
||||||
|
<defaultObjectForm>Catalog.Products.Form.ItemForm</defaultObjectForm>
|
||||||
|
<forms uuid="eb791929-46d5-43d2-a848-66c1c341e340">
|
||||||
|
<name>ItemForm</name>
|
||||||
|
<synonym>
|
||||||
|
<key>en</key>
|
||||||
|
<value>Item form</value>
|
||||||
|
</synonym>
|
||||||
|
<usePurposes>PersonalComputer</usePurposes>
|
||||||
|
<usePurposes>MobileDevice</usePurposes>
|
||||||
|
</forms>
|
||||||
|
<commands uuid="2235596e-16e8-428e-a4ce-686a066ef341">
|
||||||
|
<name>TestCommand</name>
|
||||||
|
<synonym>
|
||||||
|
<key>en</key>
|
||||||
|
<value>Test command</value>
|
||||||
|
</synonym>
|
||||||
|
<group>ActionsPanelTools</group>
|
||||||
|
<representation>Auto</representation>
|
||||||
|
</commands>
|
||||||
|
<commands uuid="22d65d6c-92c8-47bc-8033-aa6e6456c12c">
|
||||||
|
<name>Command</name>
|
||||||
|
<synonym>
|
||||||
|
<key>en</key>
|
||||||
|
<value>Command</value>
|
||||||
|
</synonym>
|
||||||
|
<group>ActionsPanelTools</group>
|
||||||
|
<representation>Auto</representation>
|
||||||
|
</commands>
|
||||||
|
</mdclass:Catalog>
|
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
&AtClient
|
||||||
|
Procedure CommandProcessing(CommandParameter, CommandExecuteParameters) Export
|
||||||
|
EndProcedure
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<mdclass:CommonCommand xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="bf0ebfae-cd96-4b44-9406-e2350a206bb7">
|
||||||
|
<name>CommonCommand</name>
|
||||||
|
<synonym>
|
||||||
|
<key>en</key>
|
||||||
|
<value>Common command</value>
|
||||||
|
</synonym>
|
||||||
|
<group>ActionsPanelTools</group>
|
||||||
|
<representation>Auto</representation>
|
||||||
|
</mdclass:CommonCommand>
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
&AtClient
|
||||||
|
Procedure CommandProcessing(CommandParameter, CommandExecuteParameters)
|
||||||
|
NotifyDescription = New NotifyDescription("OfferDiscussionsCompletion", ThisObject);
|
||||||
|
ShowQueryBox(NotifyDescription, "", QuestionDialogMode.YesNo);
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
&AtClient
|
||||||
|
Procedure OfferDiscussionsCompletion(Result, Param) Export
|
||||||
|
//...
|
||||||
|
EndProcedure
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<mdclass:CommonCommand xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="6ca44c61-ae92-4768-8cb9-153e925a8231">
|
||||||
|
<name>CommonCommand1</name>
|
||||||
|
<synonym>
|
||||||
|
<key>en</key>
|
||||||
|
<value>Common command1</value>
|
||||||
|
</synonym>
|
||||||
|
<group>ActionsPanelTools</group>
|
||||||
|
<representation>Auto</representation>
|
||||||
|
</mdclass:CommonCommand>
|
@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<cmi:CommandInterface xmlns:cmi="http://g5.1c.ru/v8/dt/cmi"/>
|
@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<mdclass:Configuration xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="f309026c-704a-402f-8920-f09acc04117a">
|
||||||
|
<name>ExportMethodInCommandFormModuleCheck</name>
|
||||||
|
<synonym>
|
||||||
|
<key>en</key>
|
||||||
|
<value>ExportMethodInCommandFormModuleCheck</value>
|
||||||
|
</synonym>
|
||||||
|
<containedObjects classId="9cd510cd-abfc-11d4-9434-004095e12fc7" objectId="57d45cad-3375-48ff-8adc-3ebedc98d330"/>
|
||||||
|
<containedObjects classId="9fcd25a0-4822-11d4-9414-008048da11f9" objectId="61eee35b-03d6-4881-b8f7-f912dbb740f1"/>
|
||||||
|
<containedObjects classId="e3687481-0a87-462c-a166-9f34594f9bba" objectId="9726d256-1e93-443f-9687-334ac7646a8d"/>
|
||||||
|
<containedObjects classId="9de14907-ec23-4a07-96f0-85521cb6b53b" objectId="cdaa3b1e-52c0-4ef6-aab2-5e6a5ce9a5e4"/>
|
||||||
|
<containedObjects classId="51f2d5d8-ea4d-4064-8892-82951750031e" objectId="4905c102-afa3-4093-97fe-7ae1ec15727c"/>
|
||||||
|
<containedObjects classId="e68182ea-4237-4383-967f-90c1e3370bc7" objectId="569c00d8-d411-44cc-81b5-1ecabe37be53"/>
|
||||||
|
<containedObjects classId="fb282519-d103-4dd3-bc12-cb271d631dfc" objectId="602ea0cd-b31b-49f4-a401-bd8ee13f3dad"/>
|
||||||
|
<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="43d3ffa7-230c-46ae-a6b8-e2e319281389">
|
||||||
|
<name>English</name>
|
||||||
|
<synonym>
|
||||||
|
<key>en</key>
|
||||||
|
<value>English</value>
|
||||||
|
</synonym>
|
||||||
|
<languageCode>en</languageCode>
|
||||||
|
</languages>
|
||||||
|
<commonCommands>CommonCommand.CommonCommand</commonCommands>
|
||||||
|
<commonCommands>CommonCommand.CommonCommand1</commonCommands>
|
||||||
|
<catalogs>Catalog.Products</catalogs>
|
||||||
|
</mdclass:Configuration>
|
@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<cmi:CommandInterface xmlns:cmi="http://g5.1c.ru/v8/dt/cmi"/>
|
Loading…
x
Reference in New Issue
Block a user