com.intellij.psi.SyntheticElement Java Examples

The following examples show how to use com.intellij.psi.SyntheticElement. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IntroduceLocalVariableIntention.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
@Override
@RequiredUIAccess
public boolean isAvailable(@Nonnull Project project, Editor editor, @Nonnull PsiElement psi)
{
	CSharpExpressionStatementImpl exprStmt = PsiTreeUtil.getParentOfType(psi, CSharpExpressionStatementImpl.class);
	if(psi instanceof SyntheticElement || exprStmt == null)
	{
		return false;
	}

	DotNetExpression expression = exprStmt.getExpression();
	if(expression instanceof CSharpAssignmentExpressionImpl)
	{
		return false;
	}

	DotNetTypeRef ref = expression.toTypeRef(true);
	return !(ref == DotNetTypeRef.ERROR_TYPE || DotNetTypeRefUtil.isVmQNameEqual(ref, expression, DotNetTypes.System.Void));
}
 
Example #2
Source File: AbstractDelombokAction.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Nullable
private PsiClass getTargetClass(Editor editor, PsiFile file) {
  int offset = editor.getCaretModel().getOffset();
  PsiElement element = file.findElementAt(offset);
  if (element == null) {
    return null;
  }
  final PsiClass target = PsiTreeUtil.getParentOfType(element, PsiClass.class);
  return target instanceof SyntheticElement ? null : target;
}
 
Example #3
Source File: RenameElementAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isEnabledOnElements(@Nonnull PsiElement[] elements) {
  if (elements.length != 1) return false;

  PsiElement element = elements[0];
  return element instanceof PsiNamedElement && !(element instanceof SyntheticElement);
}