/** * Checks if the editor is a primary editor in the main editing area. */ private boolean isPrimaryEditor(@NotNull Editor editor) { final Project project = editor.getProject(); if (project == null) return false; final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project); return StreamEx.of(fileEditorManager.getAllEditors()) .anyMatch(fileEditor -> editor.equals(EditorUtil.getEditorEx(fileEditor))); }
/** * Returns true if this stream contains the specified value. * * <p> * This is a short-circuiting <a * href="package-summary.html#StreamOps">terminal</a> operation. * * @param value the value to look for in the stream. If the value is null * then the method will return true if this stream contains at least * one null. Otherwise {@code value.equals()} will be called to * compare stream elements with the value. * @return true if this stream contains the specified value * @see Stream#anyMatch(Predicate) */ public boolean has(T value) { return anyMatch(Predicate.isEqual(value)); }
private boolean hasEStructuralFeature(final EObject eobject, final String name) { return StreamEx .of(eobject.eClass().getEAllStructuralFeatures()) .anyMatch(f -> check(f, name)); }
@Override public boolean evaluate(final EObject pObjectInstance, final EObject roleInstance, final POperation operation) { final PObject pObject = (PObject) pObjectInstance.eClass(); final Collection<EObject> permissionInstances = findPermission(pObject, roleInstance, operation); return StreamEx.of(permissionInstances).anyMatch(p -> checkPermission(pObjectInstance, p)); }
private static boolean contains(final List<POperation> operations, final POperation testOperation) { return StreamEx.of(operations).anyMatch(o -> o.getId().equals(testOperation.getId())); }