Package org.wikipediacleaner.api.constants

Examples of org.wikipediacleaner.api.constants.EnumWikipedia


  /**
   * @return WPCleaner configuration.
   */
  public WPCConfiguration getWPCConfiguration() {
    EnumWikipedia wikipedia = getWikipedia();
    if (wikipedia != null) {
      return wikipedia.getConfiguration();
    }
    return null;
  }
View Full Code Here


  /**
   * Action called when Update Disambiguation Warning button is pressed.
   */
  public void actionUpdateDabWarning() {
    EnumWikipedia wiki = window.getWikipedia();
    Configuration config = Configuration.getConfiguration();
    WPCConfiguration wpcConfig = wiki.getConfiguration();
    String template = wpcConfig.getString(WPCConfigurationString.DAB_WARNING_TEMPLATE);
    if ((template == null) || (template.trim().length() == 0)) {
      Utilities.displayMessageForMissingConfiguration(
          window.getParentComponent(),
          WPCConfigurationString.DAB_WARNING_TEMPLATE.getAttributeName());
View Full Code Here

   * Analyze ISBN errors.
   *
   * @param simulation True if this is a simulation.
   */
  private void actionISBNWarning(boolean simulation) {
    EnumWikipedia wiki = window.getWikipedia();
    if (!simulation) {
      WPCConfiguration wpcConfig = wiki.getConfiguration();
      String template = wpcConfig.getString(WPCConfigurationString.ISBN_WARNING_TEMPLATE);
      if ((template == null) || (template.trim().length() == 0)) {
        Utilities.displayMessageForMissingConfiguration(
            window.getParentComponent(),
            WPCConfigurationString.ISBN_WARNING_TEMPLATE.getAttributeName());
View Full Code Here

    boolean result = false;
    List<PageElementInternalLink> links = analysis.getInternalLinks();
    if (links == null) {
      return result;
    }
    EnumWikipedia wiki = analysis.getWikipedia();
    for (PageElementInternalLink link : links) {
      String linkDest = link.getLink();
      if ((linkDest != null) &&
          (linkDest.trim().length() > 0) &&
          (linkDest.indexOf(':') >= 0)) {
View Full Code Here

  @Override
  public Object construct() {
    try {
      CheckWiki checkWiki = APIFactory.getCheckWiki();
      MediaWiki mw = MediaWiki.getMediaWikiAccess(this);
      EnumWikipedia wiki = getWikipedia();
      StringBuilder result = new StringBuilder();
      StringBuilder details = new StringBuilder();
      List<CheckErrorAlgorithm> algorithms = CheckErrorAlgorithms.getAlgorithms(wiki);
      for (CheckErrorAlgorithm algorithm : algorithms) {
        int errorNumber = algorithm.getErrorNumber();
        if (algorithm.isAvailable() &&
            CheckErrorAlgorithms.isAlgorithmActive(wiki, errorNumber)) {
          setText(GT._("Checking whitelist for error {0}", String.valueOf(errorNumber)));
          CWConfigurationError cwConfig = wiki.getCWConfiguration().getErrorConfiguration(errorNumber);
          Set<String> whiteList = cwConfig.getWhiteList();
          if (whiteList != null) {
            details.setLength(0);
            if (whiteList.size() > 0) {
              List<Page> pages = new ArrayList<Page>(whiteList.size());
              for (String pageName : whiteList) {
                Page page = DataManager.getPage(wiki, pageName, null, null, null);
                pages.add(page);
              }
              Collections.sort(pages);
              mw.retrieveContents(wiki, pages, true, false, false, false);
              for (Page page : pages) {
                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) +
                        "\">" +
                        page.getTitle() +
                        "</a>";
                    details.append(GT._("The error hasn''t been detected in page {0}.", pageLink));
                    Boolean errorDetected = checkWiki.isErrorDetected(page, errorNumber);
                    if (errorDetected != null) {
                      details.append(" ");
                      if (Boolean.TRUE.equals(errorDetected)) {
                        details.append(GT._("It's still being detected by CheckWiki."));
                      } else {
                        details.append(GT._("It's not detected either by CheckWiki."));
                      }
                    }
                    details.append("</li>");
                  }
                }
              }
            }
            if (details.length() > 0) {
              String pageLink = String.valueOf(errorNumber);
              if (cwConfig.getWhiteListPageName() != null) {
                pageLink =
                    "<a href=\"" +
                    wiki.getSettings().getURL(cwConfig.getWhiteListPageName(), false, true) +
                    "\">" +
                    String.valueOf(errorNumber) +
                    "</a>";
              }
              result.append(GT._(
View Full Code Here

    if (menuFilter == null) {
      menuFilter = Utilities.createJMenu(GT._("Filter namespaces"));
    } else {
      menuFilter.removeAll();
    }
    EnumWikipedia wiki = getWikipedia();
    if (wiki == null) {
      return menuFilter;
    }
    Configuration config = Configuration.getConfiguration();
    List<String> filtered = config.getStringList(wiki, Configuration.ARRAY_FILTER_NS);
    for (Namespace ns : wiki.getWikiConfiguration().getNamespaces()) {
      Integer id = ns.getId();
      if ((id != null) && (id.intValue() >= 0)) {
        boolean active = !filtered.contains(Integer.toString(ns.getId()));
        JMenuItem item = new JCheckBoxMenuItem(
            ns.toString(), active);
View Full Code Here

   *
   * @param namespaceId Namespace identifier.
   * @param filter True to activate the filter on the namespace.
   */
  private void actionFilterNamespace(String namespaceId, boolean filter) {
    EnumWikipedia wiki = getWikipedia();
    Configuration config = Configuration.getConfiguration();
    List<String> filtered = config.getStringList(wiki, Configuration.ARRAY_FILTER_NS);
    if (filter) {
      filtered.add(namespaceId);
    } else {
View Full Code Here

 
  /**
   * @param saveModifications True if modifications should be saved.
   */
  private void automaticFixing(boolean saveModifications) {
    EnumWikipedia wiki = window.getWikipedia();
    if (!wiki.getCWConfiguration().isProjectAvailable()) {
      Utilities.displayMissingConfiguration(
          window.getParentComponent(), null);
      return;
    }
    int[] selection = tableCWAutomaticFixing.getSelectedRows();
View Full Code Here

  @Override
  public Object construct() {
    try {
      MediaWiki mw = MediaWiki.getMediaWikiAccess(this);
      final API api = APIFactory.getAPI();
      EnumWikipedia wiki = getWikipedia();
      mw.retrieveContents(wiki, page, false, false, false, true, false);
      api.retrieveLinks(wiki, page, Namespace.MAIN, knownPages, true, true);

      // Retrieve disambiguation information if not already retrieved
      List<Page> links = new ArrayList<Page>();
View Full Code Here

    if ((reason == null) || (reason.trim().length() == 0)) {
      return;
    }
    API api = APIFactory.getAPI();
    try {
      EnumWikipedia wiki = page.getWikipedia();
      api.deletePage(
          wiki, page, wiki.formatComment(reason.trim(), false));
      if (listener != null) {
        listener.pageDeleted(page.getTitle());
      }
    } catch (APIException ex) {
      Utilities.displayError(parent, ex);
View Full Code Here

TOP

Related Classes of org.wikipediacleaner.api.constants.EnumWikipedia

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.