Package org.wikipediacleaner.api.check

Examples of org.wikipediacleaner.api.check.CheckErrorPage


            getWikipedia(), page, newContents,
            getWikipedia().createUpdatePageComment(comment.toString(), null, true),
            false);
        countModified++;
        for (CheckErrorAlgorithm usedAlgorithm : usedAlgorithms) {
          CheckErrorPage errorPage = CheckError.analyzeError(usedAlgorithm, page.getAnalysis(newContents, true));
          if ((errorPage != null) && (!errorPage.getErrorFound())) {
            checkWiki.markAsFixed(page, usedAlgorithm.getErrorNumberString());
            if (selectedAlgorithms.contains(usedAlgorithm)) {
              countMarked++;
            } else {
              countMarkedOther++;
View Full Code Here


                if (Boolean.FALSE.equals(page.isExisting())) {
                  details.append("<li>");
                  details.append(GT._("The page {0} doesn''t exist on Wikipedia", page.getTitle()));
                  details.append("</li>");
                } else {
                  CheckErrorPage errorPage = CheckError.analyzeError(
                      algorithm, page.getAnalysis(page.getContents(), true));
                  if ((errorPage == null) || (!errorPage.getErrorFound())) {
                    details.append("<li>");
                    String pageLink =
                        "<a href=\"" +
                        wiki.getSettings().getURL(page.getTitle(), false, true) +
                        "\">" +
View Full Code Here

    }
    Object object = list.getModel().getElementAt(position);
    if (!(object instanceof CheckErrorPage)) {
      return;
    }
    CheckErrorPage error = (CheckErrorPage) object;
    CheckErrorAlgorithm algorithm = error.getAlgorithm();

    // Menu name
    BasicMenuCreator menu = new BasicMenuCreator();
    JPopupMenu popup = menu.createPopupMenu(GT._("Error n°{0}", algorithm.getErrorNumberString()));

    // Global fixes
    JMenuItem menuItem = null;
    String[] fixes = algorithm.getGlobalFixes();
    if ((fixes != null) && (fixes.length > 0)) {
      menu.addSeparator(popup);
      for (int i = 0; i < fixes.length; i++) {
        menuItem = new JMenuItem(fixes[i]);
        ActionListener action = new CheckErrorGlobalFixAction(
            algorithm, fixes[i], error.getPage(), textComponent, button);
        menuItem.addActionListener(action);
        popup.add(menuItem);
      }
    }
View Full Code Here

    // Retrieve list of errors
    List<CheckErrorResult> errorResults = new ArrayList<CheckErrorResult>();
    for (CheckErrorAlgorithm algorithm : algorithms) {
      int errorNumber = algorithm.getErrorNumber();
      if (CheckErrorAlgorithms.isAlgorithmActive(wiki, errorNumber)) {
        CheckErrorPage errorPage = CheckError.analyzeError(algorithm, analysis);
        List<CheckErrorResult> results = errorPage.getResults();
        if (results != null) {
          errorResults.addAll(results);
        }
      }
    }
View Full Code Here

    } else if (list == listErrors) {
      // List of errors
      Object selection = listErrors.getSelectedValue();
      if ((selection != null) && (selection instanceof CheckErrorPage)) {
        listLinks.clearSelection();
        CheckErrorPage errorSelected = (CheckErrorPage) selection;
        MWPaneFormatter formatter = getTextContents().getFormatter();
        if (formatter instanceof MWPaneCheckWikiFormatter) {
          MWPaneCheckWikiFormatter cwFormatter =
            (MWPaneCheckWikiFormatter) formatter;
          if (!cwFormatter.isSameAlgorithm(errorSelected.getAlgorithm())) {
            formatter = new MWPaneCheckWikiFormatter(errorSelected.getAlgorithm());
            getTextContents().setFormatter(formatter);
          }
        } else {
          formatter = new MWPaneCheckWikiFormatter(errorSelected.getAlgorithm());
          getTextContents().setFormatter(formatter);
        }
        MWPanePopupListener listener = new MWPaneCheckWikiPopupListener(
            getWikipedia(), OnePageAnalysisWindow.this);
        getTextContents().setPopupListener(listener);
View Full Code Here

        allAlgorithms, analysis, false);
    if (errorsFound != null) {
      for (CheckErrorPage tmpError : errorsFound) {
        boolean errorFound = false;
        for (int index = 0; index < modelErrors.getSize(); index++) {
          CheckErrorPage errorModel = (CheckErrorPage) modelErrors.get(index);
          if ((errorModel != null) &&
              (errorModel.getAlgorithm() != null) &&
              (errorModel.getAlgorithm().equals(tmpError.getAlgorithm()))) {
            errorFound = true;
            modelErrors.set(index, tmpError);
          }
        }
        if (!errorFound) {
          modelErrors.addElement(tmpError);
        }
      }
    }
    for (int index = 0; index < modelErrors.getSize(); index++) {
      CheckErrorPage errorModel = (CheckErrorPage) modelErrors.get(index);
      if ((errorsFound == null) || (!errorsFound.contains(errorModel))) {
        CheckErrorPage newError = new CheckErrorPage(getPage(), errorModel.getAlgorithm());
        modelErrors.set(index, newError);
      }
    }
    listErrors.repaint();

    // Update comment
    setComment(getAutomaticComment(analysis));

    // Update selection
    if (fullValidate) {
      int currentCount = countSelectedErrors(analysis);

      if (listErrors.getSelectedValue() != null) {
        // The previous selection was in the check wiki errors
        CheckErrorPage errorPage = (CheckErrorPage) listErrors.getSelectedValue();
        if (!errorPage.getErrorFound() || (currentCount == previousCount)) {
          int selected = listErrors.getSelectedIndex();
          selected++;
          if (selected < modelErrors.getSize()) {
            listErrors.setSelectedIndex(selected);
          } else {
View Full Code Here

   * @return Number of errors in the selection.
   */
  private int countSelectedErrors(PageAnalysis analysis) {
    // Count check wiki errors
    if (listErrors.getSelectedValue() != null) {
      CheckErrorPage errorPage = (CheckErrorPage) listErrors.getSelectedValue();
      return errorPage.getResultsCount();
    }

    // Count disambiguation links
    if (listLinks.getSelectedValue() != null) {
      Object[] values = listLinks.getSelectedValues();
View Full Code Here

TOP

Related Classes of org.wikipediacleaner.api.check.CheckErrorPage

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.