mirror of
https://github.com/1C-Company/v8-code-style.git
synced 2024-12-01 02:32:18 +02:00
#921 Исправлено NPE при проверке, корректный учет зависимых проектов
This commit is contained in:
parent
399a5fd6a3
commit
744fa8c156
@ -27,6 +27,9 @@
|
||||
|
||||
#### Права ролей
|
||||
|
||||
### Исправленные ошибки
|
||||
|
||||
- Падение NPE в проверке ql-using-for-update, корректный учет зависимых проектов (обработки, расширения)
|
||||
|
||||
## 0.1.0
|
||||
|
||||
|
@ -7,7 +7,8 @@ Bundle-Activator: com.e1c.v8codestyle.internal.ql.CorePlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.18.0,4.0.0)",
|
||||
org.eclipse.emf.ecore;bundle-version="[2.22.0,3.0.0)",
|
||||
org.eclipse.xtext;bundle-version="[2.24.0,3.0.0)"
|
||||
org.eclipse.xtext;bundle-version="[2.24.0,3.0.0)",
|
||||
org.eclipse.core.resources;bundle-version="[3.14.0,4.0.0)"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Automatic-Module-Name: com.e1c.v8codestyle.ql
|
||||
Bundle-ActivationPolicy: lazy
|
||||
|
@ -15,6 +15,7 @@ package com.e1c.v8codestyle.internal.ql;
|
||||
import org.eclipse.core.runtime.Plugin;
|
||||
|
||||
import com._1c.g5.v8.dt.core.platform.IConfigurationProvider;
|
||||
import com._1c.g5.v8.dt.core.platform.IV8ProjectManager;
|
||||
import com._1c.g5.wiring.AbstractServiceAwareModule;
|
||||
|
||||
/**
|
||||
@ -39,6 +40,7 @@ public class ExternalDependenciesModule
|
||||
protected void doConfigure()
|
||||
{
|
||||
bind(IConfigurationProvider.class).toService();
|
||||
bind(IV8ProjectManager.class).toService();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,10 +14,14 @@ package com.e1c.v8codestyle.ql.check;
|
||||
|
||||
import static com._1c.g5.v8.dt.ql.model.QlPackage.Literals.QUERY_SCHEMA_OPERATOR__TABLES_FOR_UPDATE;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
|
||||
import com._1c.g5.v8.dt.core.platform.IConfigurationProvider;
|
||||
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.metadata.mdclass.Configuration;
|
||||
import com._1c.g5.v8.dt.metadata.mdclass.DefaultDataLockControlMode;
|
||||
import com._1c.g5.v8.dt.ql.model.QuerySchemaOperator;
|
||||
@ -40,12 +44,16 @@ public class UsingForUpdateCheck
|
||||
{
|
||||
|
||||
private static final String CHECK_ID = "ql-using-for-update"; //$NON-NLS-1$
|
||||
|
||||
private final IConfigurationProvider configurationProvider;
|
||||
|
||||
private final IV8ProjectManager v8ProjectManager;
|
||||
|
||||
@Inject
|
||||
public UsingForUpdateCheck(IConfigurationProvider provider)
|
||||
public UsingForUpdateCheck(IConfigurationProvider configurationProvider, IV8ProjectManager v8ProjectManager)
|
||||
{
|
||||
this.configurationProvider = provider;
|
||||
this.configurationProvider = configurationProvider;
|
||||
this.v8ProjectManager = v8ProjectManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -58,8 +66,20 @@ public class UsingForUpdateCheck
|
||||
protected void checkQlObject(EObject object, QueryOwner owner, IQlResultAcceptor acceptor,
|
||||
ICheckParameters parameters, IProgressMonitor monitor)
|
||||
{
|
||||
Configuration configuration = configurationProvider.getConfiguration(object);
|
||||
if (configuration.getDataLockControlMode() != DefaultDataLockControlMode.MANAGED)
|
||||
IV8Project v8Project = v8ProjectManager.getProject(object);
|
||||
IProject project = v8Project.getProject();
|
||||
if (v8Project instanceof IDependentProject)
|
||||
{
|
||||
project = ((IDependentProject)v8Project).getParentProject();
|
||||
}
|
||||
|
||||
if (project == null || monitor.isCanceled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Configuration configuration = configurationProvider.getConfiguration(project);
|
||||
if (configuration != null && configuration.getDataLockControlMode() != DefaultDataLockControlMode.MANAGED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user