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