Package com.intellij.openapi.util

Examples of com.intellij.openapi.util.TextRange.substring()


      PsiTreeUtil.getParentOfType(position, HaxeClassBody.class, HaxeInterfaceBody.class, HaxeEnumBody.class);

    final String text;
    final int offset;
    if (pathToBlockStatement != null) {
      final Pair<String, Integer> pair = HaxeCodeGenerateUtil.wrapStatement(posRange.substring(posFile.getText()));
      text = pair.getFirst();
      offset = pair.getSecond();
    }
    else if (classInterfaceEnum != null) {
      final Pair<String, Integer> pair = HaxeCodeGenerateUtil.wrapFunction(posRange.substring(posFile.getText()));
View Full Code Here


      final Pair<String, Integer> pair = HaxeCodeGenerateUtil.wrapStatement(posRange.substring(posFile.getText()));
      text = pair.getFirst();
      offset = pair.getSecond();
    }
    else if (classInterfaceEnum != null) {
      final Pair<String, Integer> pair = HaxeCodeGenerateUtil.wrapFunction(posRange.substring(posFile.getText()));
      text = pair.getFirst();
      offset = pair.getSecond();
    }
    else {
      text = posFile.getText().substring(0, posRange.getStartOffset());
View Full Code Here

        // aufgrund selektiertem Text erstellen
        final String highlightText;
        if ((textRange.getStartOffset() != 0 || textRange.getEndOffset() != text.length()) && // fix issue 5: komplettem text ausschliessen
                BWACUtils.isStartEnd(text, textRange.getStartOffset(), textRange.getEndOffset(), false)) {
            highlightText = textRange.substring(text);
        } else {
            highlightText = null; // ansonsten löschen
        }
        SwingUtilities.invokeLater(new Runnable() {
            @Override
View Full Code Here

                                      final BnfRule currentRule,
                                      final List<BnfExpression> selectedExpression) {
    BnfExpression firstExpression = ObjectUtils.assertNotNull(ContainerUtil.getFirstItem(selectedExpression));
    BnfExpression lastExpression = ObjectUtils.assertNotNull(ContainerUtil.getLastItem(selectedExpression));
    final TextRange fixedRange = new TextRange(firstExpression.getTextRange().getStartOffset(), lastExpression.getTextRange().getEndOffset());
    final BnfRule ruleFromText = BnfElementFactory.createRuleFromText(file.getProject(), "a ::= " + fixedRange.substring(file.getText()));
    BnfExpressionOptimizer.optimize(ruleFromText.getExpression());

    final Map<OccurrencesChooser.ReplaceChoice, List<BnfExpression[]>> occurrencesMap = ContainerUtil.newLinkedHashMap();
    occurrencesMap.put(OccurrencesChooser.ReplaceChoice.NO, Collections.singletonList(selectedExpression.toArray(new BnfExpression[selectedExpression.size()])));
    occurrencesMap.put(OccurrencesChooser.ReplaceChoice.ALL, new ArrayList<BnfExpression[]>());
View Full Code Here

    final DartPsiCompositeElement classInterface = PsiTreeUtil.getParentOfType(position, DartClassMembers.class);

    final String text;
    final int offset;
    if (pathToBlockStatement != null) {
      final Pair<String, Integer> pair = DartCodeGenerateUtil.wrapStatement(posRange.substring(posFile.getText()));
      text = pair.getFirst();
      offset = pair.getSecond();
    }
    else if (classInterface != null) {
      final Pair<String, Integer> pair = DartCodeGenerateUtil.wrapFunction(posRange.substring(posFile.getText()));
View Full Code Here

      final Pair<String, Integer> pair = DartCodeGenerateUtil.wrapStatement(posRange.substring(posFile.getText()));
      text = pair.getFirst();
      offset = pair.getSecond();
    }
    else if (classInterface != null) {
      final Pair<String, Integer> pair = DartCodeGenerateUtil.wrapFunction(posRange.substring(posFile.getText()));
      text = pair.getFirst();
      offset = pair.getSecond();
    }
    else {
      DartEmbeddedContent embeddedContent = PsiTreeUtil.getParentOfType(position, DartEmbeddedContent.class);
View Full Code Here

      return false;
    }

    final TextRange rangeInElement = ElementManipulators.getManipulator(psiElement).getRangeInElement(psiElement);
    final String fullPath = psiElement.getText();
    final String trimmedPath = rangeInElement.substring(fullPath);
    final TextRange trimmedPathRange = TextRange.from(rangeInElement.getStartOffset(),
                                                      PathReference.trimPath(trimmedPath).length());

    final PsiReference actionReference = new ActionPathReference((XmlTag) psiElement,
                                                                 trimmedPathRange,
View Full Code Here

          final TemplateBuilder builder = TemplateBuilderFactory.getInstance().createTemplateBuilder(step);
          int off = context.getStartOffset() - step.getTextRange().getStartOffset();
          final String stepText = step.getText();
          for (TextRange groupRange : ranges) {
            final TextRange shiftedRange = groupRange.shiftRight(off);
            final String matchedText = shiftedRange.substring(stepText);
            builder.replaceRange(shiftedRange, matchedText);
          }
          builder.run(context.getEditor(), false);
        }
      }
View Full Code Here

    TextRange range = findTypeNameRange(text);
    if (range == null) {
      return PsiReference.EMPTY_ARRAY;
    }
    final JavaClassReferenceProvider provider = new JavaClassReferenceProvider();
    return provider.getReferencesByString(range.substring(text), element, range.getStartOffset());
  }

  @Nullable
  public static TextRange findTypeNameRange(@NotNull String text) {
    return CfmlPsiUtil.findRange(text, "type=\"", "\"");
View Full Code Here

      TextRange range = CfmlPsiUtil.findRange(text, "name=\"", "\"");
      if (range == null) {
        return PsiReference.EMPTY_ARRAY;
      }

      final String name = range.substring(text);
      final CfmlImplicitVariable variable = ((CfmlFile)element.getContainingFile()).findImplicitVariable(name);
      if (variable == null) {
        return PsiReference.EMPTY_ARRAY;
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.