Package org.wikipediacleaner.api.data

Examples of org.wikipediacleaner.api.data.PageElementCategory


    // Reporting error
    if (errors == null) {
      return true;
    }
    PageElementCategory category = categories.get(0);
    CheckErrorResult errorResult = createCheckErrorResult(
        analysis, category.getBeginIndex(), category.getEndIndex());
    String replacement =
        createDefaultSort(analysis) + "\n" +
    analysis.getContents().substring(category.getBeginIndex(), category.getEndIndex());
    errorResult.addReplacement(replacement, GT._("Add DEFAULTSORT"));
    errors.add(errorResult);
    return true;
  }
View Full Code Here


    // Reporting error
    if (errors == null) {
      return true;
    }
    PageElementCategory category = categories.get(0);
    int beginIndex = category.getBeginIndex();
    int endIndex = category.getEndIndex();
    String contents = analysis.getContents();
    String replacement =
        createDefaultSort(analysis) + "\n" +
        contents.substring(beginIndex, endIndex);
    boolean automatic = replaceable;
View Full Code Here

      if ((groupCategory != null) && (groupCategory.size() > 1)) {
        if (errors == null) {
          return true;
        }
        result = true;
        PageElementCategory keepCategory = keepCategory(groupCategory, lastTitle);
        if (keepCategory == category) {
          CheckErrorResult errorResult = createCheckErrorResult(
              analysis,
              category.getBeginIndex(),
              category.getEndIndex(),
              CheckErrorResult.ErrorLevel.CORRECT);
          errors.add(errorResult);
        } else {
          int beginIndex = category.getBeginIndex();
          while ((beginIndex > 0) && (contents.charAt(beginIndex - 1) == ' ')) {
            beginIndex--;
          }
          boolean beginLine = (beginIndex == 0) || (contents.charAt(beginIndex - 1) == '\n');
          int endIndex = category.getEndIndex();
          while ((endIndex < contents.length()) && (contents.charAt(endIndex) == ' ')) {
            endIndex++;
          }
          boolean endLine = (endIndex >= contents.length()) || (contents.charAt(endIndex) == '\n');
          if (beginLine && endLine) {
            endIndex = Math.min(endIndex + 1, contents.length());
          }
          if (!beginLine) {
            beginIndex = category.getBeginIndex();
          }
          if (!endLine) {
            endIndex = category.getEndIndex();
          }

          // Decide in the fix can be automatic
          boolean automatic = false;
          if (category.getBeginIndex() > keepCategory.getBeginIndex()) {
            int currentIndex = keepCategory.getEndIndex();
            boolean finished = false;
            while (!finished && (currentIndex < category.getBeginIndex())) {
              char currentChar = contents.charAt(currentIndex);
              if ((currentChar == ' ') || (currentChar == '\n')) {
                currentIndex++;
              } else {
                PageElementCategory nextCategory = analysis.isInCategory(currentIndex);
                if (nextCategory != null) {
                  currentIndex = nextCategory.getEndIndex();
                } else {
                  finished = true;
                }
              }
            }
View Full Code Here

        if ((image != null) && (image.getBeginIndex() == currentIndex)) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        PageElementCategory category = analysis.isInCategory(currentIndex);
        if ((category != null) && (category.getBeginIndex() == currentIndex)) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        PageElementLanguageLink link = analysis.isInLanguageLink(currentIndex);
View Full Code Here

      return createDefaultPopupTemplate(pageAnalysis, position, template);
    }

    // Menu for category
    if (element instanceof PageElementCategory) {
      PageElementCategory category = (PageElementCategory) element;
      return createDefaultPopupCategory(textPane, position, pageAnalysis, category);
    }

    // Menu for interwiki
    if (element instanceof PageElementInterwikiLink) {
View Full Code Here

        if ((image != null) && (image.getEndIndex() == currentIndex + 2)) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        PageElementCategory category = analysis.isInCategory(currentIndex);
        if ((category != null) && (category.getEndIndex() == currentIndex + 2)) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        PageElementLanguageLink link = analysis.isInLanguageLink(currentIndex);
View Full Code Here

TOP

Related Classes of org.wikipediacleaner.api.data.PageElementCategory

Copyright © 2018 www.massapicom. 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.