DartResolveUtil.getLeftReference(PsiTreeUtil.getParentOfType(file.findElementAt(startOffset), DartReference.class));
return leftReference != null && DartComponentType.typeOf(leftReference.resolve()) == DartComponentType.CLASS;
}
public static List<BaseCreateFix> findFixesForUnresolved(PsiFile file, int startOffset) {
final DartReference reference = PsiTreeUtil.getParentOfType(file.findElementAt(startOffset), DartReference.class);
final String name = reference != null ? reference.getText() : null;
if (reference == null || name == null) {
return Collections.emptyList();
}
final boolean isLValue = DartResolveUtil.isLValue(reference);
final DartReference leftReference = DartResolveUtil.getLeftReference(reference);
final List<BaseCreateFix> result = new ArrayList<BaseCreateFix>();
// chain
if (leftReference != null) {
final PsiElement leftTarget = leftReference.resolve();
final DartComponentType leftTargetType = DartComponentType.typeOf(leftTarget != null ? leftTarget.getParent() : null);
result.add(new CreateDartGetterSetterAction(name, !isLValue, leftTargetType == DartComponentType.CLASS));
result.add(new CreateFieldAction(name, leftTargetType == DartComponentType.CLASS));
if (DartResolveUtil.aloneOrFirstInChain(reference)) {
result.add(new CreateGlobalDartGetterSetterAction(name, false));