1
0
mirror of https://github.com/1C-Company/v8-code-style.git synced 2025-02-21 07:56:09 +02:00

G5V8DT-24189 При добавлении обработчика события или команды автоматически размещать его в соответствующей области

Code style fixes
This commit is contained in:
Nikita Kuznetsov 2023-11-14 11:34:53 +03:00
parent d2d3adb358
commit 86b2d38d4f
2 changed files with 22 additions and 12 deletions

View File

@ -1,6 +1,15 @@
/**
* Copyright (C) 2023, 1C
*/
/*******************************************************************************
* Copyright (C) 2023, 1C-Soft LLC and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* 1C-Soft LLC - initial API and implementation
*******************************************************************************/
package com.e1c.v8codestyle.internal.bsl.ui.services;
import com._1c.g5.v8.dt.bsl.common.IBslModuleTextInsertInfo;

View File

@ -59,12 +59,12 @@ public class BslModuleRegionsInfoService
{
return () -> defaultPosition;
}
URI moduleResourceURI = module.eResource().getURI();
URI moduleResourceUri = module.eResource().getURI();
IResourceServiceProvider rsp =
IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(moduleResourceURI);
IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(moduleResourceUri);
IV8ProjectManager projectManager = rsp.get(IV8ProjectManager.class);
BslOwnerComputerService bslOwnerComputerService = rsp.get(BslOwnerComputerService.class);
IV8Project project = projectManager.getProject(moduleResourceURI);
IV8Project project = projectManager.getProject(moduleResourceUri);
EClass moduleOwner = bslOwnerComputerService.computeOwnerEClass(module);
EObject eventOwner = data.getEventOwner();
BslModuleEventData regionData = (BslModuleEventData)data;
@ -94,12 +94,12 @@ public class BslModuleRegionsInfoService
String regionName = moduleRegionInformation.getRegionName();
if (module != null && regionName != null)
{
URI moduleResourceURI = module.eResource().getURI();
URI moduleResourceUri = module.eResource().getURI();
IResourceServiceProvider rsp =
IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(moduleResourceURI);
IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(moduleResourceUri);
IV8ProjectManager projectManager = rsp.get(IV8ProjectManager.class);
BslGeneratorMultiLangProposals proposals = rsp.get(BslGeneratorMultiLangProposals.class);
IV8Project project = projectManager.getProject(moduleResourceURI);
IV8Project project = projectManager.getProject(moduleResourceUri);
String lineSeparator = PreferenceUtils.getLineSeparator(project.getProject());
proposals.setRussianLang(ScriptVariant.RUSSIAN.equals(project.getScriptVariant()));
String beginRegion = proposals.getBeginRegionPropStr();
@ -285,11 +285,12 @@ public class BslModuleRegionsInfoService
{
if (itemType.equals(EventItemType.TABLE))
{
while ((eventOwner = eventOwner.eContainer()) != null)
EObject container;
while ((container = eventOwner.eContainer()) != null)
{
if (eventOwner.eClass() == FormPackage.Literals.TABLE)
if (container.eClass() == FormPackage.Literals.TABLE)
{
return ((NamedElement)eventOwner).getName();
return ((NamedElement)container).getName();
}
}
}