예제 #1
0
  public PsiElement handleElementRename(String newName) throws IncorrectOperationException {
    if (!BashIdentifierUtil.isValidIdentifier(newName)) {
      throw new IncorrectOperationException("Can't have an empty name");
    }

    // if this is variable which doesn't have a $ sign prefix
    if (isSingleWord()) {
      // return BashPsiUtils.replaceElement(this, BashChangeUtil.createWord(getProject(), newName));
      return BashPsiUtils.replaceElement(
          this, BashChangeUtil.createVariable(getProject(), newName, true));
    }

    return BashPsiUtils.replaceElement(
        this, BashChangeUtil.createVariable(getProject(), newName, false));
  }
  public boolean execute(PsiElement element, ResolveState resolveState) {
    if (element instanceof BashFunctionDef) {
      final BashFunctionDef f = (BashFunctionDef) element;

      if (symboleName.equals(f.getName())) {
        storeResult(element, BashPsiUtils.blockNestingLevel(f));
        return ignoreExecuteResult ? true : false;
      }
    }

    return true;
  }
예제 #3
0
  public PsiElement resolve() {
    final String varName = getName();
    if (varName == null) {
      return null;
    }

    BashVarProcessor processor = new BashVarProcessor(this, true);
    if (!BashPsiUtils.varResolveTreeWalkUp(
        processor, this, getContainingFile(), ResolveState.initial())) {
      return processor.getBestResult(false, this);
    }

    return null;
  }
예제 #4
0
 public boolean isStatic() {
   return BashPsiUtils.isStaticWordExpr(getFirstChild());
 }