Implemeted action for uploading Wikipedia articles (thanks to D.Wunsch)
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.wiki / src / net / sourceforge / phpeclipse / wiki / actions / mediawiki / DownloadWikibooksENAction.java
1 package net.sourceforge.phpeclipse.wiki.actions.mediawiki;
2 //Parts of this sources are copied and modified from the jEdit Wikipedia plugin:
3 //http://www.djini.de/software/wikipedia/index.html
4 //
5 //The modified sources are available under the "Common Public License"
6 //with permission from the original author: Daniel Wunsch
7
8 import java.util.List;
9
10 import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin;
11 import net.sourceforge.phpeclipse.wiki.internal.Configuration;
12 import net.sourceforge.phpeclipse.wiki.internal.ConfigurationWorkingCopy;
13
14 public final class DownloadWikibooksENAction extends DownloadWikipediaAction {
15   protected Configuration getConfiguration() {
16     List configs = WikiEditorPlugin.getConfigurations();
17     ConfigurationWorkingCopy configuration = null;
18     //    Wikipedia-en"" +
19     for (int i = 0; i < configs.size(); i++) {
20       configuration = (ConfigurationWorkingCopy) configs.get(i);
21       if (configuration.getName().equals("Wikibooks-en") && configuration.getType().equals("Wikipedia-Load Text")) {
22         break;
23       } else {
24         configuration = null;
25       }
26     }
27     if (configuration == null) {
28       // fall back, if user deleted configuration:
29       configuration = new ConfigurationWorkingCopy();
30       configuration.setURL("http://en.wikibooks.org/w/index.php?title=$text.wikiname&amp;action=raw");
31     }
32     return configuration;
33   }
34 }