public static void addChangeIdentifierCaseProposal(
      Node node, Collection<ICompletionProposal> proposals, IFile file) {
    Tree.Identifier identifier = null;

    if (node instanceof Tree.TypeDeclaration) {
      identifier = ((Tree.TypeDeclaration) node).getIdentifier();
    } else if (node instanceof Tree.TypeParameterDeclaration) {
      identifier = ((Tree.TypeParameterDeclaration) node).getIdentifier();
    } else if (node instanceof Tree.TypedDeclaration) {
      identifier = ((Tree.TypedDeclaration) node).getIdentifier();
    } else if (node instanceof Tree.ImportPath) {
      List<Identifier> importIdentifiers = ((Tree.ImportPath) node).getIdentifiers();
      for (Identifier importIdentifier : importIdentifiers) {
        if (importIdentifier.getText() != null
            && !importIdentifier.getText().isEmpty()
            && Character.isUpperCase(importIdentifier.getText().charAt(0))) {
          identifier = importIdentifier;
          break;
        }
      }
    }

    if (identifier != null && !identifier.getText().isEmpty()) {
      addProposal(identifier, proposals, file);
    }
  }
Esempio n. 2
0
  public List<int[]> findSeqeuences() {

    if (isConstantName(completion)) {
      rewriteCompletion();
    }

    int[] start = new int[0];
    curSequences.add(start);

    for (pToken = 0; pToken < token.length(); pToken++) {
      char t = token.charAt(pToken);

      for (int[] activeSequence : curSequences) {
        boolean mustmatch = false;
        int startIndex =
            activeSequence.length == 0 ? 0 : activeSequence[activeSequence.length - 1] + 1;

        for (pCompletion = startIndex; pCompletion < completion.length(); pCompletion++) {
          char c = completion.charAt(pCompletion);
          if (!Character.isLetter(c)) {
            if (c == t) {
              addNewSubsequenceForNext(activeSequence);
              continue;
            }
            mustmatch = true;
            continue;
          } else if (Character.isUpperCase(c)) {
            mustmatch = true;
          }

          if (mustmatch && !isSameIgnoreCase(c, t)) {
            jumpToEndOfWord();
          } else if (isSameIgnoreCase(c, t)) {
            addNewSubsequenceForNext(activeSequence);
          }
        }
      }
      curSequences = nextSequences;
      nextSequences = Lists.newLinkedList();
    }

    // filter
    for (Iterator<int[]> it = curSequences.iterator(); it.hasNext(); ) {
      int[] candidate = it.next();
      if (candidate.length < token.length()) {
        it.remove();
        continue;
      }
    }

    return curSequences;
  }
Esempio n. 3
0
 public void keyTyped(char ch) {
   if (this.emuSys != null) {
     if (this.emuSys.getSwapKeyCharCase()) {
       if (Character.isUpperCase(ch)) {
         ch = Character.toLowerCase(ch);
       } else if (Character.isLowerCase(ch)) {
         ch = Character.toUpperCase(ch);
       }
     }
     if (this.emuSys.getConvertKeyCharToISO646DE()) {
       this.emuSys.keyTyped(TextUtil.toISO646DE(ch));
     } else {
       this.emuSys.keyTyped(ch);
     }
   }
 }