Package org.wikipediacleaner.api.check

Examples of org.wikipediacleaner.api.check.CheckError


   */
  void actionSelectErrorType() {
    Object selection = listAllErrors.getSelectedItem();
    modelPages.clear();
    if (selection instanceof CheckError) {
      CheckError error = (CheckError) selection;

      // Button status
      buttonReloadError.setEnabled(true);
      buttonErrorDetail.setEnabled(true);
      buttonErrorList.setEnabled(true);
      buttonWhiteList.setEnabled(true);
      displayErrorDescription();

      // Pages
      int nbPages = error.getPageCount();
      for (int numPage = 0; numPage < nbPages; numPage++) {
        Page page = error.getPage(numPage);
        CheckErrorPage errorPage = new CheckErrorPage(page, error.getAlgorithm());
        if ((errorPage.isInWhiteList()) && (page.getPageId() != null)) {
          markPageAsFixed(error.getAlgorithm().getErrorNumberString(), page);
        } else {
          modelPages.addElement(errorPage);
        }
      }
      setPageLoaded(false);
      actionSelectPages();
      updateComponentState();
    } else {
      buttonReloadError.setEnabled(false);
      buttonErrorDetail.setEnabled(false);
      buttonErrorList.setEnabled(false);
      buttonWhiteList.setEnabled(false);
      displayErrorDescription();

      if (selection instanceof String) {
        List<String> listTmp = new ArrayList<String>();
        for (CheckError error : errors) {
          int nbPages = error.getPageCount();
          for (int numPage = 0; numPage < nbPages; numPage++) {
            Page page = error.getPage(numPage);
            listTmp.add(page.getTitle());
          }
        }
        Collections.sort(listTmp);
        List<String> listErrorPages = new ArrayList<String>();
View Full Code Here


    // Look in the global list of errors
    if (algorithm == null) {
      Object selection = listAllErrors.getSelectedItem();
      if (selection instanceof CheckError) {
        CheckError error = (CheckError) selection;
        algorithm = error.getAlgorithm();
      }
    }

    // Display description
    displayErrorDescription(algorithm);
View Full Code Here

  public void actionErrorDetail() {
    Object selected = listAllErrors.getSelectedItem();
    if ((selected instanceof CheckError) &&
        (Utilities.isDesktopSupported())) {
      EnumWikipedia wiki = getWikipedia();
      CheckError error = (CheckError) selected;
      if (error.getAlgorithm().getLink() != null) {
        Utilities.browseURL(wiki, error.getAlgorithm().getLink(), true);
      } else {
        DecimalFormat format = new DecimalFormat("000");
        String description =
            "error_" +
            format.format(error.getErrorNumber()) +
            "_link_" +
            wiki.getSettings().getCodeCheckWiki();
        String translationPage = wiki.getConfiguration().getString(
            WPCConfigurationString.CW_TRANSLATION_PAGE);
        Utilities.displayInformationMessage(getParentComponent(), GT._(
View Full Code Here

   */
  public void actionErrorList() {
    Object selected = listAllErrors.getSelectedItem();
    if ((selected instanceof CheckError) &&
        (Utilities.isDesktopSupported())) {
      CheckError error = (CheckError) selected;
      CheckWiki checkWiki = APIFactory.getCheckWiki();
      String url = checkWiki.getUrlDescription(getWikipedia(), error.getAlgorithm());
      Utilities.browseURL(url);
    }
  }
View Full Code Here

  public void actionErrorWhiteList() {
    Object selected = listAllErrors.getSelectedItem();
    if ((selected instanceof CheckError) &&
        (Utilities.isDesktopSupported())) {
      EnumWikipedia wiki = getWikipedia();
      CheckError error = (CheckError) selected;
      if (error.getAlgorithm().getWhiteListPageName() != null) {
        Utilities.browseURL(wiki, error.getAlgorithm().getWhiteListPageName(), true);
      } else {
        DecimalFormat format = new DecimalFormat("000");
        String parameter =
            "error_" +
            format.format(error.getErrorNumber()) +
            "_whitelistpage_" +
            wiki.getSettings().getCodeCheckWiki();
        String translationPage = wiki.getConfiguration().getString(
            WPCConfigurationString.CW_TRANSLATION_PAGE);
        Utilities.displayInformationMessage(getParentComponent(), GT._(
View Full Code Here

   * Action called when Reload Error button is pressed.
   */
  public void actionReloadError() {
    Object selected = listAllErrors.getSelectedItem();
    if (selected instanceof CheckError) {
      CheckError error = (CheckError) selected;
      List<CheckErrorAlgorithm> algorithms = Collections.singletonList(error.getAlgorithm());
      CheckWikiProjectWorker reloadWorker = new CheckWikiProjectWorker(
          getWikipedia(), this, errors, algorithms,
          true, modelMaxErrors.getNumber().intValue());
      setupReloadWorker(reloadWorker);
      reloadWorker.start();
View Full Code Here

    if ((errors == null) || (errors.isEmpty())) {
      return;
    }
    Iterator<CheckError> itError = errors.iterator();
    while (itError.hasNext()) {
      CheckError error = itError.next();
      if (error.getErrorNumber() == errorNumber) {
        error.remove(page);
      }
    }
    requestUpdate();
  }
View Full Code Here

        null,
        ConfigurationValueBoolean.CHECK_SHOW_0_ERRORS);
    if (!showAllErrors) {
      Iterator<CheckError> itError = errors.iterator();
      while (itError.hasNext()) {
        CheckError error = itError.next();
        if (error.getPageCount() == 0) {
          itError.remove();
          modelAllErrors.removeElement(error);
        }
      }
    }
View Full Code Here

      List<CheckError> errorsToBeRemoved = new ArrayList<CheckError>();
      for (CheckErrorAlgorithm algoFixed : errorsFixed) {
        for (int posError = 0; posError < window.modelAllErrors.getSize(); posError++) {
          Object element = window.modelAllErrors.getElementAt(posError);
          if (element instanceof CheckError) {
            final CheckError tmpError = (CheckError) element;
            if (tmpError.getAlgorithm().getErrorNumberString().equals(algoFixed.getErrorNumberString())) {
              tmpError.remove(page);
              if (tmpError.getPageCount() == 0) {
                errorsToBeRemoved.add(tmpError);
              }
            }
          }
        }
View Full Code Here

            GT._("Checking for errors n°{0}", Integer.toString(algorithm.getErrorNumber())) +
            " - " + algorithm.getShortDescriptionReplaced());
        errors.clear();
        checkWiki.retrievePages(algorithm, max, getWikipedia(), errors);
        while (!errors.isEmpty()) {
          CheckError error = errors.remove(0);
          int maxErrors = error.getPageCount();
          for (int numPage = 0;
              (error.getPageCount() > 0) && shouldContinue();
              numPage++) {
            try {
              Page page = error.getPage(0);
              error.remove(page);
              analyzePage(
                  page, algorithm,
                  algorithm.getErrorNumberString() + " - " + (numPage + 1) + "/" + maxErrors);
            } catch (APIException e) {
              //
View Full Code Here

TOP

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

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.