You've already forked v8-code-style
mirror of
https://github.com/1C-Company/v8-code-style.git
synced 2025-07-15 12:14:21 +02:00
Ошибки checkstyle
This commit is contained in:
@ -191,14 +191,18 @@ public class AutoSortPropertyPage
|
|||||||
{
|
{
|
||||||
prefs.remove(AutoSortPreferences.KEY_TOP_NODE);
|
prefs.remove(AutoSortPreferences.KEY_TOP_NODE);
|
||||||
if (prefs.nodeExists(AutoSortPreferences.KEY_TOP_NODE))
|
if (prefs.nodeExists(AutoSortPreferences.KEY_TOP_NODE))
|
||||||
|
{
|
||||||
prefs.node(AutoSortPreferences.KEY_TOP_NODE).removeNode();
|
prefs.node(AutoSortPreferences.KEY_TOP_NODE).removeNode();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (buttons.get(AutoSortPreferences.KEY_SUBORDINATE_OBJECTS).getSelection())
|
if (buttons.get(AutoSortPreferences.KEY_SUBORDINATE_OBJECTS).getSelection())
|
||||||
{
|
{
|
||||||
prefs.remove(AutoSortPreferences.KEY_SUBORDINATE_NODE);
|
prefs.remove(AutoSortPreferences.KEY_SUBORDINATE_NODE);
|
||||||
if (prefs.nodeExists(AutoSortPreferences.KEY_SUBORDINATE_NODE))
|
if (prefs.nodeExists(AutoSortPreferences.KEY_SUBORDINATE_NODE))
|
||||||
|
{
|
||||||
prefs.node(AutoSortPreferences.KEY_SUBORDINATE_NODE).removeNode();
|
prefs.node(AutoSortPreferences.KEY_SUBORDINATE_NODE).removeNode();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
prefs.flush();
|
prefs.flush();
|
||||||
}
|
}
|
||||||
catch (BackingStoreException e)
|
catch (BackingStoreException e)
|
||||||
@ -487,7 +491,9 @@ public class AutoSortPropertyPage
|
|||||||
public boolean isChecked(Object element)
|
public boolean isChecked(Object element)
|
||||||
{
|
{
|
||||||
if (element instanceof EReference)
|
if (element instanceof EReference)
|
||||||
|
{
|
||||||
return AutoSortPropertyPage.this.topObjects.getOrDefault(((EReference)element).getName(), false);
|
return AutoSortPropertyPage.this.topObjects.getOrDefault(((EReference)element).getName(), false);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,10 +116,14 @@ public final class AutoSortPreferences
|
|||||||
public static boolean isAllowedToSort(IProject project, EReference listRef)
|
public static boolean isAllowedToSort(IProject project, EReference listRef)
|
||||||
{
|
{
|
||||||
if (ListConstants.TOP_OPBJECT_LISTS.contains(listRef))
|
if (ListConstants.TOP_OPBJECT_LISTS.contains(listRef))
|
||||||
|
{
|
||||||
return isSortAllTop(project) || isSortTopList(project, listRef);
|
return isSortAllTop(project) || isSortTopList(project, listRef);
|
||||||
|
}
|
||||||
|
|
||||||
if (ListConstants.SUBORDINATE_OBJECT_LISTS.contains(listRef))
|
if (ListConstants.SUBORDINATE_OBJECT_LISTS.contains(listRef))
|
||||||
|
{
|
||||||
return isSortSubOrdinateObjects(project) || isSortSubordinateList(project, listRef);
|
return isSortSubOrdinateObjects(project) || isSortSubordinateList(project, listRef);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -64,25 +64,35 @@ public class SortBmTask
|
|||||||
for (SortItem item : items)
|
for (SortItem item : items)
|
||||||
{
|
{
|
||||||
if (monitor.isCanceled())
|
if (monitor.isCanceled())
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!item.getListRef().isMany())
|
if (!item.getListRef().isMany())
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
EObject parent = transaction.getTopObjectByFqn(item.getFqn());
|
EObject parent = transaction.getTopObjectByFqn(item.getFqn());
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
{
|
{
|
||||||
Object value = parent.eGet(item.getListRef());
|
Object value = parent.eGet(item.getListRef());
|
||||||
if (!(value instanceof List))
|
if (!(value instanceof List))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
List<?> elements = (List<?>)value;
|
List<?> elements = (List<?>)value;
|
||||||
if (elements.size() < 2)
|
if (elements.size() < 2)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
SortCommand command = new SortCommand(parent, item.getListRef(), item.getSorter());
|
SortCommand command = new SortCommand(parent, item.getListRef(), item.getSorter());
|
||||||
if (command.canExecute())
|
if (command.canExecute())
|
||||||
|
{
|
||||||
command.execute();
|
command.execute();
|
||||||
|
}
|
||||||
command.dispose();
|
command.dispose();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,9 @@ public class SortJob
|
|||||||
protected IStatus run(IProgressMonitor monitor)
|
protected IStatus run(IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
if (dtProject.getWorkspaceProject() == null)
|
if (dtProject.getWorkspaceProject() == null)
|
||||||
|
{
|
||||||
return Status.CANCEL_STATUS;
|
return Status.CANCEL_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
Object handler = workspaceOrchestrator.beginBackgroundOperation("Sort-MD-objects", //$NON-NLS-1$
|
Object handler = workspaceOrchestrator.beginBackgroundOperation("Sort-MD-objects", //$NON-NLS-1$
|
||||||
Arrays.asList(dtProject), ProjectPipelineJob.BUILD);
|
Arrays.asList(dtProject), ProjectPipelineJob.BUILD);
|
||||||
@ -85,8 +87,10 @@ public class SortJob
|
|||||||
execute(monitor);
|
execute(monitor);
|
||||||
}
|
}
|
||||||
if (monitor.isCanceled())
|
if (monitor.isCanceled())
|
||||||
|
{
|
||||||
queue.clear();
|
queue.clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (monitor.isCanceled())
|
if (monitor.isCanceled())
|
||||||
|
@ -151,23 +151,29 @@ public class SortService
|
|||||||
{
|
{
|
||||||
IBmAsyncEventListener listener = projectListeners.get(project);
|
IBmAsyncEventListener listener = projectListeners.get(project);
|
||||||
if (listener != null)
|
if (listener != null)
|
||||||
|
{
|
||||||
model.removeAsyncEventListener(listener);
|
model.removeAsyncEventListener(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IStatus sortAllMetadata(IDtProject dtProject, IProgressMonitor monitor)
|
public IStatus sortAllMetadata(IDtProject dtProject, IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
IBmModel model = modelManager.getModel(dtProject);
|
IBmModel model = modelManager.getModel(dtProject);
|
||||||
if (model == null)
|
if (model == null)
|
||||||
|
{
|
||||||
return Status.CANCEL_STATUS;
|
return Status.CANCEL_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
IProject project = dtProject.getWorkspaceProject();
|
IProject project = dtProject.getWorkspaceProject();
|
||||||
Collection<SortItem> items = readAllObjectsToSort(model, project, monitor);
|
Collection<SortItem> items = readAllObjectsToSort(model, project, monitor);
|
||||||
|
|
||||||
if (monitor.isCanceled())
|
if (monitor.isCanceled())
|
||||||
|
{
|
||||||
return Status.CANCEL_STATUS;
|
return Status.CANCEL_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
if (project != null)
|
if (project != null)
|
||||||
{
|
{
|
||||||
@ -197,12 +203,18 @@ public class SortService
|
|||||||
{
|
{
|
||||||
IBmModel model = modelManager.getModel(dtProject);
|
IBmModel model = modelManager.getModel(dtProject);
|
||||||
if (model == null || model.isDisposed())
|
if (model == null || model.isDisposed())
|
||||||
|
{
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
if (monitor.isCanceled() || items == null)
|
if (monitor.isCanceled() || items == null)
|
||||||
|
{
|
||||||
return Status.CANCEL_STATUS;
|
return Status.CANCEL_STATUS;
|
||||||
|
}
|
||||||
if (items.isEmpty())
|
if (items.isEmpty())
|
||||||
|
{
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
model.getGlobalContext().execute(new SortBmTask(items));
|
model.getGlobalContext().execute(new SortBmTask(items));
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
@ -215,12 +227,16 @@ public class SortService
|
|||||||
|
|
||||||
IBmModel model = modelManager.getModel(project);
|
IBmModel model = modelManager.getModel(project);
|
||||||
if (model == null)
|
if (model == null)
|
||||||
|
{
|
||||||
return Status.CANCEL_STATUS;
|
return Status.CANCEL_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
Collection<SortItem> items = readAllObjectsToSort(model, project, monitor);
|
Collection<SortItem> items = readAllObjectsToSort(model, project, monitor);
|
||||||
|
|
||||||
if (monitor.isCanceled())
|
if (monitor.isCanceled())
|
||||||
|
{
|
||||||
return Status.CANCEL_STATUS;
|
return Status.CANCEL_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
startSortObject(project, items);
|
startSortObject(project, items);
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
@ -233,7 +249,9 @@ public class SortService
|
|||||||
{
|
{
|
||||||
IDtProject dtProject = dtProjectManager.getDtProject(project);
|
IDtProject dtProject = dtProjectManager.getDtProject(project);
|
||||||
if (dtProject == null || items.isEmpty())
|
if (dtProject == null || items.isEmpty())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SortJob job = jobs.computeIfAbsent(project, p -> new SortJob(dtProject, this, workspaceOrchestrator));
|
SortJob job = jobs.computeIfAbsent(project, p -> new SortJob(dtProject, this, workspaceOrchestrator));
|
||||||
job.getQueue().addAll(items);
|
job.getQueue().addAll(items);
|
||||||
@ -276,7 +294,9 @@ public class SortService
|
|||||||
{
|
{
|
||||||
IBmLongMap<BmChangeEvent> change = event.getChangeEvents();
|
IBmLongMap<BmChangeEvent> change = event.getChangeEvents();
|
||||||
if (change == null)
|
if (change == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, Set<EReference>> changedItems = new HashMap<>();
|
Map<String, Set<EReference>> changedItems = new HashMap<>();
|
||||||
|
|
||||||
@ -344,7 +364,9 @@ public class SortService
|
|||||||
}
|
}
|
||||||
if (!(parent instanceof IBmObject) || listRef == null
|
if (!(parent instanceof IBmObject) || listRef == null
|
||||||
|| !AutoSortPreferences.isAllowedToSort(project, listRef))
|
|| !AutoSortPreferences.isAllowedToSort(project, listRef))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
changedItems.computeIfAbsent(((IBmObject)parent).bmGetFqn(), k -> new HashSet<>()).add(listRef);
|
changedItems.computeIfAbsent(((IBmObject)parent).bmGetFqn(), k -> new HashSet<>()).add(listRef);
|
||||||
}
|
}
|
||||||
@ -370,9 +392,11 @@ public class SortService
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!items.isEmpty())
|
if (!items.isEmpty())
|
||||||
|
{
|
||||||
startSortObject(project, items);
|
startSortObject(project, items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private EReference getConfigurationFeature(MdObject mdObject)
|
private EReference getConfigurationFeature(MdObject mdObject)
|
||||||
{
|
{
|
||||||
@ -380,7 +404,9 @@ public class SortService
|
|||||||
{
|
{
|
||||||
if (!feature.isMany() || feature.equals(MdClassPackage.Literals.CONFIGURATION__CONTENT)
|
if (!feature.isMany() || feature.equals(MdClassPackage.Literals.CONFIGURATION__CONTENT)
|
||||||
|| !feature.getEType().isInstance(mdObject))
|
|| !feature.getEType().isInstance(mdObject))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
return feature;
|
return feature;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -417,7 +443,9 @@ public class SortService
|
|||||||
|| project == null && AutoSortPreferences.DEFAULT_SORT)
|
|| project == null && AutoSortPreferences.DEFAULT_SORT)
|
||||||
{
|
{
|
||||||
if (monitor.isCanceled() || m.isCanceled())
|
if (monitor.isCanceled() || m.isCanceled())
|
||||||
|
{
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
Iterable<EClass> eClassIterator = transaction.getTopObjectEClasses();
|
Iterable<EClass> eClassIterator = transaction.getTopObjectEClasses();
|
||||||
Map<EClass, List<EReference>> sortListRefs = getSubordinateListsToSort(eClassIterator, project);
|
Map<EClass, List<EReference>> sortListRefs = getSubordinateListsToSort(eClassIterator, project);
|
||||||
@ -436,7 +464,9 @@ public class SortService
|
|||||||
.hasNext();)
|
.hasNext();)
|
||||||
{
|
{
|
||||||
if (monitor.isCanceled() || m.isCanceled())
|
if (monitor.isCanceled() || m.isCanceled())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
IBmObject object = iterator.next();
|
IBmObject object = iterator.next();
|
||||||
String fqn = object.bmGetFqn();
|
String fqn = object.bmGetFqn();
|
||||||
@ -452,13 +482,17 @@ public class SortService
|
|||||||
for (EClass topObjectEClass : eClassIterator)
|
for (EClass topObjectEClass : eClassIterator)
|
||||||
{
|
{
|
||||||
if (topObjectEClass.equals(CONFIGURATION) || !MD_OBJECT.isSuperTypeOf(topObjectEClass))
|
if (topObjectEClass.equals(CONFIGURATION) || !MD_OBJECT.isSuperTypeOf(topObjectEClass))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (EReference feature : topObjectEClass.getEAllReferences())
|
for (EReference feature : topObjectEClass.getEAllReferences())
|
||||||
{
|
{
|
||||||
if (!feature.isMany() || project != null && !AutoSortPreferences.isAllowedToSort(project, feature)
|
if (!feature.isMany() || project != null && !AutoSortPreferences.isAllowedToSort(project, feature)
|
||||||
|| project == null && !AutoSortPreferences.DEFAULT_SORT)
|
|| project == null && !AutoSortPreferences.DEFAULT_SORT)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
sortListRefs.computeIfAbsent(topObjectEClass, e -> new ArrayList<>()).add(feature);
|
sortListRefs.computeIfAbsent(topObjectEClass, e -> new ArrayList<>()).add(feature);
|
||||||
}
|
}
|
||||||
@ -474,18 +508,24 @@ public class SortService
|
|||||||
for (EReference feature : CONFIGURATION.getEAllReferences())
|
for (EReference feature : CONFIGURATION.getEAllReferences())
|
||||||
{
|
{
|
||||||
if (monitor.isCanceled() || m.isCanceled())
|
if (monitor.isCanceled() || m.isCanceled())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!feature.isMany() || feature.equals(MdClassPackage.Literals.CONFIGURATION__CONTENT)
|
if (!feature.isMany() || feature.equals(MdClassPackage.Literals.CONFIGURATION__CONTENT)
|
||||||
|| project != null && !AutoSortPreferences.isAllowedToSort(project, feature)
|
|| project != null && !AutoSortPreferences.isAllowedToSort(project, feature)
|
||||||
|| project == null && !AutoSortPreferences.DEFAULT_SORT)
|
|| project == null && !AutoSortPreferences.DEFAULT_SORT)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
EList<?> collection = (EList<?>)top.eGet(feature, false);
|
EList<?> collection = (EList<?>)top.eGet(feature, false);
|
||||||
if (collection.size() > 1)
|
if (collection.size() > 1)
|
||||||
|
{
|
||||||
result.add(new SortItem(CONFIGURATION_FQN, feature, sorter));
|
result.add(new SortItem(CONFIGURATION_FQN, feature, sorter));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,9 @@ public class StructureCtorTooManyKeysCheck
|
|||||||
IProgressMonitor monitor)
|
IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
if (monitor.isCanceled() || !(object instanceof OperatorStyleCreator))
|
if (monitor.isCanceled() || !(object instanceof OperatorStyleCreator))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
OperatorStyleCreator osc = (OperatorStyleCreator)object;
|
OperatorStyleCreator osc = (OperatorStyleCreator)object;
|
||||||
if (IEObjectTypeNames.STRUCTURE.equals(McoreUtil.getTypeName(osc.getType())) && !osc.getParams().isEmpty()
|
if (IEObjectTypeNames.STRUCTURE.equals(McoreUtil.getTypeName(osc.getType())) && !osc.getParams().isEmpty()
|
||||||
|
@ -61,7 +61,9 @@ public class TempTableHasIndex
|
|||||||
{
|
{
|
||||||
QuerySchemaSelectQuery selectQuery = (QuerySchemaSelectQuery)object;
|
QuerySchemaSelectQuery selectQuery = (QuerySchemaSelectQuery)object;
|
||||||
if (selectQuery.getPlacementTable() == null)
|
if (selectQuery.getPlacementTable() == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (selectQuery.getIndexes() == null || selectQuery.getIndexes().isEmpty())
|
if (selectQuery.getIndexes() == null || selectQuery.getIndexes().isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -169,5 +169,13 @@
|
|||||||
<module name="SuperFinalize" />
|
<module name="SuperFinalize" />
|
||||||
<module name="FallThrough" />
|
<module name="FallThrough" />
|
||||||
<module name="MissingSwitchDefault" />
|
<module name="MissingSwitchDefault" />
|
||||||
|
<module name="NeedBraces" />
|
||||||
|
|
||||||
|
<!-- var -->
|
||||||
|
<module name="IllegalType">
|
||||||
|
<property name="illegalClassNames" value="var"/>
|
||||||
|
<property name="tokens" value="VARIABLE_DEF"/>
|
||||||
|
<property name="id" value="IllegalVar"/>
|
||||||
|
</module>
|
||||||
</module>
|
</module>
|
||||||
</module>
|
</module>
|
Reference in New Issue
Block a user