Package org.wikipediacleaner.api.constants

Examples of org.wikipediacleaner.api.constants.EnumWikipedia


      }
    }

    // Analyzing title to find special characters
    String title = analysis.getPage().getTitle();
    EnumWikipedia wiki = analysis.getWikipedia();
    boolean characterFound = false;
    boolean replaceable = true;
    int currentPos = 0;
    while ((currentPos < title.length()) && (currentPos < limit)) {
      char character = title.charAt(currentPos);
View Full Code Here


    buffer.append(defaultSort);

    // Remove special characters from title
    String title = analysis.getPage().getTitle();
    StringBuilder currentTitle = new StringBuilder();
    EnumWikipedia wiki = analysis.getWikipedia();
    for (int i = 0; i < title.length(); i++) {
      char character = title.charAt(i);
      if (!CheckErrorAlgorithms.isAlgorithmActive(wiki, 6) ||
          SpecialCharacters.isAuthorized(character, wiki)) {
        currentTitle.append(character);
View Full Code Here

    // Check selection
    if (wikiProvider == null) {
      return;
    }
    EnumWikipedia wiki = wikiProvider.getWiki();
    if (wiki == null) {
      return;
    }
    List<Page> pages = getPages();
    if ((pages == null) || (pages.isEmpty())) {
      return;
    }

    // Check configuration
    WPCConfiguration wpcConfig = wiki.getConfiguration();
    String template = wpcConfig.getString(WPCConfigurationString.DAB_WARNING_TEMPLATE);
    if ((template == null) || (template.trim().length() == 0)) {
      Utilities.displayMessageForMissingConfiguration(
          parent,
          WPCConfigurationString.DAB_WARNING_TEMPLATE.getAttributeName());
View Full Code Here

    // Check selection
    if (wikiProvider == null) {
      return;
    }
    EnumWikipedia wiki = wikiProvider.getWiki();
    if (wiki == null) {
      return;
    }
    List<Page> pages = getPages();
    if ((pages == null) || (pages.isEmpty())) {
      return;
    }

    // Check configuration
    WPCConfiguration wpcConfig = wiki.getConfiguration();
    String template = wpcConfig.getString(WPCConfigurationString.ISBN_WARNING_TEMPLATE);
    if ((template == null) || (template.trim().length() == 0)) {
      Utilities.displayMessageForMissingConfiguration(
          parent,
          WPCConfigurationString.ISBN_WARNING_TEMPLATE.getAttributeName());
View Full Code Here

        return Collections.singletonList(page);
      }
    }

    // Manage page name in a text field or combo box
    EnumWikipedia wiki = (wikiProvider != null) ? wikiProvider.getWiki() : null;
    if (((text != null) || (combo != null)) && (wiki != null)) {
      String tmp = null;
      if (text != null) {
        tmp = text.getText();
      } else {
View Full Code Here

              CURRENT_CONFIG_VERSION);
          return;
        }

        // Update from version 1 to 2 : Configuration for each wikipedia
        EnumWikipedia preferredWikipedia = null;
        boolean ok = true;
        if (version < 2) {
          preferredWikipedia = askForPreferredWikipedia(parent);
          if (preferredWikipedia == null) {
            return;
View Full Code Here

    if ((analysis == null) || (analysis.getInternalLinks() == null)) {
      return false;
    }

    // Retrieve configuration
    EnumWikipedia wiki = analysis.getWikipedia();
    CWConfigurationError error68 = wiki.getCWConfiguration().getErrorConfiguration(68);
    List<String> templatesList = null;
    if (error68 != null) {
      String templatesParam = error68.getSpecificProperty("template", true, false, false, false);
      if (templatesParam != null) {
        templatesList = WPCConfiguration.convertPropertyToStringList(templatesParam);
      }
    }
    String strOnlyLanguage = getSpecificProperty("only_language", true, false, false);
    boolean onlyLanguage = (strOnlyLanguage != null) ? Boolean.valueOf(strOnlyLanguage) : true;
    String strOnlyLocal = getSpecificProperty("only_local", true, false, false);
    boolean onlyLocal = (strOnlyLocal != null) ? Boolean.valueOf(strOnlyLocal) : true;

    // Analyze each external link
    boolean result = false;
    List<PageElementExternalLink> links = analysis.getExternalLinks();
    if (links == null) {
      return result;
    }
    List<Interwiki> interwikis = wiki.getWikiConfiguration().getInterwikis();
    String contents = analysis.getContents();
    for (PageElementExternalLink link : links) {
      if (link.hasSquare()) {

        // Check if this is a external link to an other wiki
        String article = null;
        String prefix = null;
        String language = null;
        boolean local = false;
        for (Interwiki interwiki : interwikis) {
          String tmp = interwiki.isArticleUrl(link.getLink());
          if (tmp != null) {
            if ((article == null) || (interwiki.getLanguage() != null)) {
              article = tmp;
              prefix = interwiki.getPrefix();
              language = interwiki.getLanguage();
              local = interwiki.getLocal();
            }
          }
        }
        EnumWikipedia fromWiki = null;
        if (prefix != null) {
          fromWiki = EnumWikipedia.getWikipedia(prefix);
          if (!prefix.equals(fromWiki.getSettings().getCode())) {
            fromWiki = null;
          }
        }

        // Mark error
View Full Code Here

    constraints.ipady = 0;
    constraints.weightx = 0;
    constraints.weighty = 0;

    // Wikipedia
    EnumWikipedia defaultWikipedia = configuration.getWikipedia();
    comboWikipedia = new JComboBox(EnumWikipedia.getList().toArray());
    comboWikipedia.setEditable(false);
    comboWikipedia.setSelectedItem(defaultWikipedia);
    comboWikipedia.addItemListener(EventHandler.create(
        ItemListener.class, this, "actionChangeWiki"));
View Full Code Here

  /**
   * Action called when System Options button is pressed.
   */
  public void actionOptionsSystem() {
    if (Utilities.isDesktopSupported()) {
      EnumWikipedia wikipedia = getWikipedia();
      Utilities.browseURL(wikipedia, wikipedia.getConfigurationPage(), true);
    } else {
      displayUrlMessage(
          GT._("You can learn how to configure {0} at the following URL:", Version.PROGRAM),
          URL_OTHER_WIKIPEDIA);
    }
View Full Code Here

  /**
   * Action called when Check Spelling button is pressed.
   */
  public void actionCheckSpelling() {
    EnumWikipedia wikipedia = getWikipedia();
    if (wikipedia == null) {
      return;
    }

    // Retrieve all suggestions grouped by page and chapter
    Map<String, Suggestion> suggestions = wikipedia.getConfiguration().getSuggestions();
    Map<String, List<String>> chapters = Suggestion.getChapters(suggestions.values());
    if (chapters.isEmpty()) {
      return;
    }

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.