From: axelcl Date: Wed, 19 Jan 2005 22:22:22 +0000 (+0000) Subject: Upload/Download of multiple files now possible X-Git-Url: http://secure.phpeclipse.com Upload/Download of multiple files now possible --- diff --git a/archive/net.sourceforge.phpeclipse.wiki/build.properties b/archive/net.sourceforge.phpeclipse.wiki/build.properties index 85024c0..e015174 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/build.properties +++ b/archive/net.sourceforge.phpeclipse.wiki/build.properties @@ -10,7 +10,8 @@ bin.includes = plugin.xml,\ lib/,\ plugin.properties,\ cpl-v10.html,\ - about.html + about.html,\ + wikis/ src.includes = .classpath,\ .project,\ build.properties,\ diff --git a/archive/net.sourceforge.phpeclipse.wiki/build.xml b/archive/net.sourceforge.phpeclipse.wiki/build.xml index 3f6bc26..69f1ff9 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/build.xml +++ b/archive/net.sourceforge.phpeclipse.wiki/build.xml @@ -88,13 +88,13 @@ + - @@ -133,7 +133,7 @@ - + diff --git a/archive/net.sourceforge.phpeclipse.wiki/plugin.properties b/archive/net.sourceforge.phpeclipse.wiki/plugin.properties index f5552a9..ee92c69 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/plugin.properties +++ b/archive/net.sourceforge.phpeclipse.wiki/plugin.properties @@ -1,9 +1,13 @@ MediaWiki.download.label=Wikipedia Download MediaWiki.upload.label=Wikipedia Upload +MediaWiki.label=Wikipedia BlogWiki.label=Blog as Wiki Text BlogHTML.label=Blog as HTML Text HTTPQuery.label=HTTP Query +newWizardCategory.name=Wikipedia +newWizardProject.name=Wikipedia Project + # --------------- General UI --------------- preferenceDescription=Configure HTTP Actions for your Wiki texts. configurationsList=Configurations diff --git a/archive/net.sourceforge.phpeclipse.wiki/plugin.xml b/archive/net.sourceforge.phpeclipse.wiki/plugin.xml index e90fdb7..3ae3cb8 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/plugin.xml +++ b/archive/net.sourceforge.phpeclipse.wiki/plugin.xml @@ -32,6 +32,7 @@ + @@ -193,13 +194,69 @@ adaptable="false" objectClass="org.eclipse.core.resources.IProject" id="net.sourceforge.phpeclipse.wiki.addwikibuilder"> - + + + + + + + + + + + + + + + + + + + + - - - - - + --> @@ -349,6 +379,18 @@ menubarPath="mediawikiUploadMenu/additions" id="net.sourceforge.phpeclipse.wiki.actions.mediawiki.post.StoreWikipediaAction"> + + + + @@ -383,11 +425,23 @@ id="net.sourceforge.phpeclipse.wiki.actions.mediawiki.DownloadWikiLinkEditorAction"> --> + + + + + + + + + + Create a new Wikipedia project. + + + diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/CreateFilesFromLinksEditorAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/CreateFilesFromLinksEditorAction.java new file mode 100644 index 0000000..1aa69ff --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/CreateFilesFromLinksEditorAction.java @@ -0,0 +1,92 @@ +package net.sourceforge.phpeclipse.wiki.actions; + +import java.util.ArrayList; +import java.util.HashSet; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.jface.text.IDocument; +import org.eclipse.ui.IFileEditorInput; + +public final class CreateFilesFromLinksEditorAction extends OpenWikiLinkEditorAction { + + public void openWikiLinkOnSelection() { + IDocument doc = getDocument(); + // ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection(); + // int pos = selection.getOffset(); + ArrayList startPositionList = new ArrayList(); + char[] text = doc.get().toCharArray(); + try { + char ch = ' '; + int i = 0; + int startPos = -1; + while (true) { + ch = text[i++]; + switch (ch) { + case '[': + ch = text[i++]; + if (ch == '[') { + startPos = i; + } + break; + case ']': + ch = text[i++]; + if (ch == ']' && startPos != (-1)) { + startPositionList.add(new Integer(startPos)); + } + break; + case '\r': + case '\n': + startPos = -1; + break; + } + } + } catch (IndexOutOfBoundsException e) { + // ignore it + } + HashSet wikiNames = new HashSet(); + ArrayList filesList = new ArrayList(); + String str; + Integer posInteger; + IFile currentFile = ((IFileEditorInput) editor.getEditorInput()).getFile(); + for (int i = 0; i < startPositionList.size(); i++) { + posInteger = (Integer) startPositionList.get(i); + str = getWikiString(editor, doc, posInteger.intValue()); + + if (str != null && !str.equals("")) { + if (!wikiNames.contains(str)) { + IFile file = getWikiFile(currentFile, str); + filesList.add(file); + wikiNames.add(str); + } + } + } + + if (filesList.size() > 0) { + IFile[] files = new IFile[filesList.size()]; + filesList.toArray(files); + + Job job = new CreateFilesJob(files); + // job.setRule(createRule(files)); + job.setRule(null); + job.setUser(true); + job.schedule(); + } +// +// +// Iterator iter = wikiNames.iterator(); +// while (iter.hasNext()) { +// openWikiFile(file, (String) iter.next(), false); +// } + } + +// public void openWikiFile(IFile cfile, String word, boolean openEditor) { +// if (word != null && !word.equals("")) { +// IFile file = getWikiFile(cfile, word); +// try { +// createNewFileIfNeeded(file, word); +// } catch (Exception e) { +// } +// } +// } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/CreateFilesJob.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/CreateFilesJob.java new file mode 100644 index 0000000..82f7769 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/CreateFilesJob.java @@ -0,0 +1,85 @@ +package net.sourceforge.phpeclipse.wiki.actions; +import java.io.ByteArrayInputStream; + +import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin; +import net.sourceforge.phpeclipse.wiki.preferences.Util; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.WorkspaceJob; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.ui.progress.IProgressConstants; + +public class CreateFilesJob extends WorkspaceJob { + IFile[] files; + + public CreateFilesJob(IFile[] files) { + super("Create Wiki Files Job"); + this.files = files; + } + + public IStatus runInWorkspace(IProgressMonitor monitor) { + try { + monitor.beginTask("Create Wiki Files", 100); + IFile file; + int partOfWork = 100 / files.length; + int work = 0; + String newText = WikiEditorPlugin.AUTOMATICALLY_CREATED; + byte[] buffer = newText.getBytes(); + ByteArrayInputStream source = new ByteArrayInputStream(buffer); + ProblemConsole console = new ProblemConsole(); + for (int i = 0; i < files.length; i++) { + file = files[i]; + + IContainer parent = file.getParent(); + if (parent instanceof IFolder && (!((IFolder) parent).exists())) { + Util.createFolder((IFolder) parent, monitor); + } + try { + if (!file.exists()) { + file.create(source, true, monitor); + } else { + console.println("File: " + file.getLocation().toString() + "\n==>file already exists!"); + } + } catch (CoreException e) { + if (file != null) { + console.println("File: " + file.getLocation().toString() + "\n==>CoreException: "+e.getMessage()); + } + } + if (monitor.isCanceled()) { + return Status.CANCEL_STATUS; + } + work += partOfWork; + monitor.worked(work); + } + + if (isModal(this)) { + // The progress dialog is still open show the message + console.reportError(); + } else { + setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE); + // setProperty(IProgressConstants.ACTION_PROPERTY, getWikisCompletedAction()); + } + return Status.OK_STATUS; + // } catch(CoreException e) { + // return e.getStatus(); + } finally { + monitor.done(); + } + // return Status.OK_STATUS; + } + + public boolean isModal(Job job) { + Boolean isModal = (Boolean) job.getProperty(IProgressConstants.PROPERTY_IN_DIALOG); + if (isModal == null) { + return false; + } + return isModal.booleanValue(); + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/OpenWikiLinkEditorAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/OpenWikiLinkEditorAction.java index d8b4537..8f38c48 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/OpenWikiLinkEditorAction.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/OpenWikiLinkEditorAction.java @@ -32,11 +32,11 @@ import org.eclipse.ui.ide.IDE; import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; import org.eclipse.ui.texteditor.AbstractTextEditor; -public final class OpenWikiLinkEditorAction implements IEditorActionDelegate { +public class OpenWikiLinkEditorAction implements IEditorActionDelegate { - private IWorkbenchWindow window; + protected IWorkbenchWindow window; - private AbstractTextEditor editor; + protected AbstractTextEditor editor; public void dispose() { } @@ -144,10 +144,10 @@ public final class OpenWikiLinkEditorAction implements IEditorActionDelegate { String textRegion = getWikiString(editor, doc, pos); IFileEditorInput ei = (IFileEditorInput) editor.getEditorInput(); - openWikiFile(ei.getFile(), textRegion); + openWikiFile(ei.getFile(), textRegion, true); } - public static void openWikiUrl(IProject project, String word) { + public void openWikiUrl(IProject project, String word) { if (word != null && !word.equals("")) { IFile cfile = project.getFile("dummy.wp"); IFile file = getWikiFile(cfile, word); @@ -167,7 +167,7 @@ public final class OpenWikiLinkEditorAction implements IEditorActionDelegate { } } - public static void openWikiFile(IFile cfile, String word) { + protected void openWikiFile(IFile cfile, String word, boolean openEditor) { if (word != null && !word.equals("")) { IFile file = getWikiFile(cfile, word); try { @@ -186,13 +186,13 @@ public final class OpenWikiLinkEditorAction implements IEditorActionDelegate { } } - private static void createNewFileIfNeeded(IFile file, String word) throws CoreException { + protected void createNewFileIfNeeded(IFile file, String word) throws CoreException { if (!file.exists()) { - createWikiFile(file, word); + createWikiFile(file); } } - private static IFile getWikiFile(IFile file, String word) { + protected IFile getWikiFile(IFile file, String word) { String wikiFileName = Util.getWikiFileName(word, file, WikiEditorPlugin.HTML_OUTPUT_PATH); IPath path = new Path(wikiFileName); return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path); @@ -234,12 +234,12 @@ public final class OpenWikiLinkEditorAction implements IEditorActionDelegate { } } - private static void createWikiFile(IFile file, String word) throws CoreException { + private void createWikiFile(IFile file) throws CoreException { IContainer parent = file.getParent(); if (parent instanceof IFolder && (!((IFolder) parent).exists())) { createFolder((IFolder) parent, null); } - String newText = ""; + String newText = WikiEditorPlugin.AUTOMATICALLY_CREATED; byte[] buffer = newText.getBytes(); ByteArrayInputStream source = new ByteArrayInputStream(buffer); file.create(source, true, null); diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/ProblemConsole.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/ProblemConsole.java new file mode 100644 index 0000000..d258d6a --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/ProblemConsole.java @@ -0,0 +1,91 @@ +package net.sourceforge.phpeclipse.wiki.actions; + +import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.ui.console.ConsolePlugin; +import org.eclipse.ui.console.IConsole; +import org.eclipse.ui.console.MessageConsole; +import org.eclipse.ui.console.MessageConsoleStream; + +public class ProblemConsole { + private MessageConsole myConsole; + + private MessageConsoleStream stream; + + private boolean hasMessages; + + public ProblemConsole() { + hasMessages = false; + myConsole = new MessageConsole("Wikipedia Editor Problems", null); + ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { myConsole }); + ; + ConsolePlugin.getDefault().getConsoleManager().showConsoleView(myConsole); + // layout.addView(IConsoleConstants.ID_CONSOLE_VIEW, IPageLayout.BOTTOM, .5f,IPageLayout.ID_EDITOR_AREA); + stream = myConsole.newMessageStream(); + } + + /** + * @return + */ + public Color getColor() { + return stream.getColor(); + } + + /** + * @return + */ + public MessageConsole getConsole() { + return stream.getConsole(); + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#hashCode() + */ + public int hashCode() { + return stream.hashCode(); + } + + /** + * @param message + */ + public void print(String message) { + hasMessages = true; + stream.print(message); + } + + /** + * + */ + public void println() { + hasMessages = true; + stream.println(); + } + + /** + * @param message + */ + public void println(String message) { + hasMessages = true; + stream.println(message); + } + + /** + * @param color + */ + public void setColor(Color color) { + stream.setColor(color); + } + + public void reportError(String title, String message) { + if (hasMessages) { + WikiEditorPlugin.getDefault().reportError(title, message); + } + } + + public void reportError() { + reportError("Problems listed", "Open console view for problems log!"); + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/blogwiki/NewPostBlogWikiAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/blogwiki/NewPostBlogWikiAction.java index 2bf1895..154585c 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/blogwiki/NewPostBlogWikiAction.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/blogwiki/NewPostBlogWikiAction.java @@ -94,7 +94,7 @@ public final class NewPostBlogWikiAction implements IEditorActionDelegate { if (fEditor != null) { boolean cache = true; ConfigurationWorkingCopy config = getConfiguration(); //new Configuration("http://localhost:8080/snip/RPC2", "1", "admin", - // "admin"); + // "admin"); try { IFileEditorInput ei = (IFileEditorInput) fEditor.getEditorInput(); IFile file = ei.getFile(); diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadPlog4UDEAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadPlog4UDEAction.java new file mode 100644 index 0000000..46d571f --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadPlog4UDEAction.java @@ -0,0 +1,16 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki; +//Parts of this sources are copied and modified from the jEdit Wikipedia plugin: +//http://www.djini.de/software/wikipedia/index.html +// +//The modified sources are available under the "Common Public License" +//with permission from the original author: Daniel Wunsch + +import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin; +import net.sourceforge.phpeclipse.wiki.internal.Configuration; + +public final class DownloadPlog4UDEAction extends DownloadWikipediaAction { + protected Configuration getConfiguration(){ + return RefreshPlog4UDEFilesAction.getPlog4UConfiguration(super + .getConfigurationPrefix(WikiEditorPlugin.PLOG4U_DE_LOAD)); + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadPlog4UORGAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadPlog4UORGAction.java new file mode 100644 index 0000000..265c621 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadPlog4UORGAction.java @@ -0,0 +1,16 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki; +//Parts of this sources are copied and modified from the jEdit Wikipedia plugin: +//http://www.djini.de/software/wikipedia/index.html +// +//The modified sources are available under the "Common Public License" +//with permission from the original author: Daniel Wunsch + +import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin; +import net.sourceforge.phpeclipse.wiki.internal.Configuration; + +public final class DownloadPlog4UORGAction extends DownloadWikipediaAction { + protected Configuration getConfiguration(){ + return RefreshPlog4UORGFilesAction.getPlog4UConfiguration(super + .getConfigurationPrefix(WikiEditorPlugin.PLOG4U_ORG_LOAD)); + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadWikiLinkEditorAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadWikiLinkEditorAction.java index bbfd7a7..7aae7ef 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadWikiLinkEditorAction.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadWikiLinkEditorAction.java @@ -165,7 +165,8 @@ public final class DownloadWikiLinkEditorAction implements IEditorActionDelegate if (part != null && (part instanceof AbstractTextEditor)) { AbstractTextEditor newEditor = (AbstractTextEditor) part; word = Util.titleToDB(word); - String wikiText = MediaWikiConnector.getWikiRawText(word, "http://en.wikibooks.org/w/wiki.phtml"); + MediaWikiConnector mc = new MediaWikiConnector(); + String wikiText = mc.getWikiRawText(word, "http://en.wikibooks.org/w/wiki.phtml"); if (wikiText!=null) { IDocument doc = newEditor.getDocumentProvider().getDocument(newEditor.getEditorInput()); doc.set(wikiText); diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadWikibooksENAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadWikibooksENAction.java index 6d1d966..b16ef0e 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadWikibooksENAction.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadWikibooksENAction.java @@ -27,7 +27,7 @@ public final class DownloadWikibooksENAction extends DownloadWikipediaAction { if (configuration == null) { // fall back, if user deleted configuration: configuration = new ConfigurationWorkingCopy(); - configuration.setURL("http://en.wikibooks.org/w/index.php?title=$text.wikiname&action=raw"); + configuration.setURL("http://en.wikibooks.org/wiki/Special:Export"); } return configuration; } diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadWikipediaAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadWikipediaAction.java index 051cce8..26b6fcc 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadWikipediaAction.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadWikipediaAction.java @@ -25,6 +25,7 @@ import net.sourceforge.phpeclipse.wiki.velocity.EditorText; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.Velocity; import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.action.IAction; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextSelection; @@ -87,12 +88,12 @@ public class DownloadWikipediaAction implements IEditorActionDelegate { return template; } - protected Configuration getConfiguration() { + protected Configuration getConfigurationPrefix(String prefix) { List allConfigsList = ConfigurationManager.getInstance().getConfigurations(); ArrayList configsList = new ArrayList(); for (int i = 0; i < allConfigsList.size(); i++) { IConfiguration temp = (IConfiguration) allConfigsList.get(i); - if (temp.getType().startsWith(WikiEditorPlugin.PREFIX_LOAD)) { + if (temp.getType().startsWith(prefix)) { configsList.add(temp); } } @@ -113,14 +114,17 @@ public class DownloadWikipediaAction implements IEditorActionDelegate { } return configuration; } + protected Configuration getConfiguration( ) { + return getConfigurationPrefix(WikiEditorPlugin.PREFIX_LOAD); + } public IDocument getDocument() { IDocument doc = fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput()); return doc; } - private String getWikiFile(IFile file) { - return Util.getFileWikiName(file, WikiEditorPlugin.HTML_OUTPUT_PATH); + private static String getWikiFile(IFile file) { + return Util.getFileWikiName(file); } public void init(IWorkbenchWindow window) { @@ -131,7 +135,7 @@ public class DownloadWikipediaAction implements IEditorActionDelegate { String wikiName = getWikiFile(cfile); try { if (fEditor != null) { - selectWiki(wikiName); + selectWiki(cfile, wikiName); } } catch (Exception e) { } @@ -171,19 +175,28 @@ public class DownloadWikipediaAction implements IEditorActionDelegate { } } - private void selectWiki(String wikiName) { + private void selectWiki(IFile cfile, String wikiName) { Configuration configuration = getConfiguration(); if (configuration != null && !configuration.equals("")) { try { String wikiLocale = configuration.getType().substring(WikiEditorPlugin.PREFIX_LOAD.length()); IWikipedia wikipediaProperties = WikiEditorPlugin.getWikiInstance(wikiLocale); - String url = generateUrl(wikipediaProperties, configuration, configuration.getURL(), wikiName); - String wikiContent = MediaWikiConnector.getWikiRawText(wikiName, url); - if (wikiContent != null) { - IDocument doc = fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput()); - doc.set(wikiContent); - } + // String url = generateUrl(wikipediaProperties, configuration, configuration.getURL(), wikiName); + // MediaWikiConnector mc = new MediaWikiConnector(); + // String wikiContent = mc.getWikiRawText(wikiName, url); + // if (wikiContent != null) { + // IDocument doc = fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput()); + // doc.set(wikiContent); + // } + IFile[] files = new IFile[1]; + files[0] = cfile; + + Job job = new RefreshJob(wikipediaProperties, files, configuration.getURL()); + job.setRule(null); + job.setUser(true); + job.setPriority(Job.SHORT); + job.schedule(); } catch (Exception e) { e.printStackTrace(); WikiEditorPlugin.getDefault().reportError("Exception occured: ", diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadWikipediaENAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadWikipediaENAction.java index b1f7b54..f3c646c 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadWikipediaENAction.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/DownloadWikipediaENAction.java @@ -22,11 +22,11 @@ public final class DownloadWikipediaENAction extends DownloadWikipediaAction { } else { configuration = null; } - } + } if (configuration == null) { // fall back, if user deleted configuration: configuration = new ConfigurationWorkingCopy(); - configuration.setURL("http://en.wikipedia.org/w/wiki.phtml?title=$text.wikiname&action=raw"); + configuration.setURL("http://en.wikipedia.org/wiki/Special:Export"); } return configuration; } diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/LoadWikipediaSQLAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/LoadWikipediaSQLAction.java index bc499cf..1d0b92c 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/LoadWikipediaSQLAction.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/LoadWikipediaSQLAction.java @@ -136,7 +136,7 @@ public class LoadWikipediaSQLAction implements IEditorActionDelegate { } private String getWikiFile(IFile file) { - return Util.getFileWikiName(file, WikiEditorPlugin.HTML_OUTPUT_PATH); + return Util.getFileWikiName(file); } public void init(IWorkbenchWindow window) { diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/RefreshJob.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/RefreshJob.java new file mode 100644 index 0000000..49dec5b --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/RefreshJob.java @@ -0,0 +1,195 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki; + +import java.io.ByteArrayInputStream; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.HashMap; + +import net.sourceforge.phpeclipse.wiki.actions.ProblemConsole; +import net.sourceforge.phpeclipse.wiki.actions.mediawiki.config.IWikipedia; +import net.sourceforge.phpeclipse.wiki.actions.mediawiki.connect.MediaWikiConnector; +import net.sourceforge.phpeclipse.wiki.actions.mediawiki.connect.Parsed; +import net.sourceforge.phpeclipse.wiki.actions.mediawiki.exceptions.MethodException; +import net.sourceforge.phpeclipse.wiki.actions.mediawiki.exceptions.UnexpectedAnswerException; +import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin; +import net.sourceforge.phpeclipse.wiki.preferences.Util; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.resources.WorkspaceJob; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.ui.progress.IProgressConstants; + +public class RefreshJob extends WorkspaceJob { + IFile[] files; + + IWikipedia configuration; + + String actionURL; + + public RefreshJob(IWikipedia configuration, IFile[] files, String actionURL) { + super("Refresh Job"); + this.files = files; + this.configuration = configuration; + this.actionURL = actionURL; + } + + public IStatus runInWorkspace(IProgressMonitor monitor) { + ProblemConsole console = new ProblemConsole(); + IFile file = null; + try { + monitor.beginTask("Refresh Wikis", 100); + // ArrayList wikiTitles = new ArrayList(); + // for (int i = 0; i < files.length; i++) { + // wikiTitles.add( Util.getReadableWikiName(files[i]) ); + // } + StringBuffer buffer = new StringBuffer(); + HashMap map = new HashMap(); + String wikiTitle; + for (int i = 0; i < files.length; i++) { + wikiTitle = Util.getReadableWikiName(files[i]); + buffer.append(wikiTitle); + map.put(wikiTitle, files[i]); + if (i != files.length - 1) { + buffer.append("\n"); + } + } + MediaWikiConnector mwc = new MediaWikiConnector(); + String url = actionURL; + if (url == null) { + url = configuration.getActionUrl() + "/" + configuration.getSpecialNs() + ":Export"; + } + // get a list of Parsed elements + ArrayList list = mwc.loadXML(configuration, url, buffer.toString()); + String body; + + for (int i = 0; i < list.size(); i++) { + Parsed parsed = (Parsed) list.get(i); + wikiTitle = parsed.getTitle(); + if (wikiTitle != null) { + body = parsed.getBody(); + if (body != null) { + file = (IFile) map.get(wikiTitle); + if (file != null) { + updateFileContent(console, file, parsed, body, configuration, monitor); + } + } + } + if (monitor.isCanceled()) { + return Status.CANCEL_STATUS; + } + } + if (isModal(this)) { + // The progress dialog is still open show the message + console.reportError(); + } else { + // setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE); + // setProperty(IProgressConstants.ACTION_PROPERTY, getWikisCompletedAction()); + } + return Status.OK_STATUS; + // } catch(CoreException e) { + // return e.getStatus(); + } catch (UnexpectedAnswerException e) { + if (file != null) { + console.println("File: " + file.getLocation().toString() + "\n==>UnexpectedAnswerException: " + e.getMessage()); + } else { + console.println("UnexpectedAnswerException: " + e.getMessage()); + } + } catch (MethodException e) { + if (file != null) { + console.println("File: " + file.getLocation().toString() + "\n==>HTTP-MethodException: " + e.getMessage()); + } else { + console.println("HTTP-MethodException: " + e.getMessage()); + } + } finally { + monitor.done(); + } + if (isModal(this)) { + // The progress dialog is still open show the message + console.reportError(); + } + return Status.OK_STATUS; + } + + public boolean isModal(Job job) { + Boolean isModal = (Boolean) job.getProperty(IProgressConstants.PROPERTY_IN_DIALOG); + if (isModal == null) { + return false; + } + return isModal.booleanValue(); + } + + private static void updateFileContent(ProblemConsole console, IFile file, Parsed parsed, String body, IWikipedia wp, + IProgressMonitor monitor) { + try { + if (file.exists()) { + if (wp == null) { + file.setContents(new ByteArrayInputStream(body.getBytes()), true, false, null); + } else { + file.setContents(new ByteArrayInputStream(body.getBytes(wp.getCharSet())), true, false, null); + file.setCharset(wp.getCharSet(), monitor); + } + } else { + if (wp == null) { + file.create(new ByteArrayInputStream(body.getBytes()), false, null); + } else { + file.create(new ByteArrayInputStream(body.getBytes(wp.getCharSet())), false, null); + file.setCharset(wp.getCharSet(), monitor); + } + } + String srcBasePath = Util.getWikiTextsPath(file); + String binBasePath = Util.getProjectsWikiOutputPath(file.getProject(), WikiEditorPlugin.HTML_OUTPUT_PATH); + + String filename = Util.getXMLFileName(file, binBasePath, srcBasePath); + IPath path = new Path(filename); + IFile xmlFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path); + IContainer parent = xmlFile.getParent(); + if (parent instanceof IFolder && (!((IFolder) parent).exists())) { + Util.createFolder((IFolder) parent, monitor); + } + try { + String xmlData = parsed.getXmlData(); + String charSet = "UTF-8"; + StringBuffer buf = new StringBuffer(); + int index = xmlData.indexOf(""); + if (index<0) { + console.println("File: " + xmlFile.getLocation().toString() + "\n==>Couldn't create xml file - tag not found"); + return; + } + xmlData = xmlData.substring(index); +// buf.setLength(xmlData.length() + WikiEditorPlugin.XML_START_1.length() + WikiEditorPlugin.XML_START_2.length() +// + WikiEditorPlugin.XML_END.length() + charSet.length()); +// + buf.append(WikiEditorPlugin.XML_START_1); + buf.append(charSet); + buf.append(WikiEditorPlugin.XML_START_2); + buf.append(xmlData); + buf.append(WikiEditorPlugin.XML_END); + + byte[] buffer = buf.toString().getBytes(); + ByteArrayInputStream source = new ByteArrayInputStream(buffer); + if (!xmlFile.exists()) { + xmlFile.create(source, true, monitor); + } else { + xmlFile.setContents(source, true, true, monitor); + } + } catch (CoreException e) { + if (file != null) { + console.println("File: " + xmlFile.getLocation().toString() + "\n==>CoreException: " + e.getMessage()); + } + } + } catch (UnsupportedEncodingException e) { + console.println("File: " + file.getLocation().toString() + "\n==>UnsupportedEncodingException: " + e.getMessage()); + } catch (CoreException e) { + console.println("File: " + file.getLocation().toString() + "\n==>CoreException: " + e.getMessage()); + } + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/RefreshPlog4UDEFilesAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/RefreshPlog4UDEFilesAction.java new file mode 100644 index 0000000..966892f --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/RefreshPlog4UDEFilesAction.java @@ -0,0 +1,36 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki; + +import net.sourceforge.phpeclipse.wiki.internal.Configuration; +import net.sourceforge.phpeclipse.wiki.internal.ConfigurationWorkingCopy; +import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin; + +import org.eclipse.ui.IWorkbenchPart; + +public class RefreshPlog4UDEFilesAction extends RefreshWikiFilesAction { + private IWorkbenchPart workbenchPart; + + protected Configuration getConfiguration() { + return getPlog4UConfiguration(super + .getConfigurationPrefix(WikiEditorPlugin.PLOG4U_DE_LOAD)); + } + + /** + * @return + */ + public static Configuration getPlog4UConfiguration(Configuration config) { + ConfigurationWorkingCopy configuration = new ConfigurationWorkingCopy(config); + + configuration.setName("www.Plog4U.de Download"); + configuration.setURL("http://www.plog4u.de/index.php/Spezial:Export"); + configuration.setType(WikiEditorPlugin.PLOG4U_DE_LOAD); + return configuration; + } + + /** + * + */ + public RefreshPlog4UDEFilesAction() { + super(); + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/RefreshPlog4UORGFilesAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/RefreshPlog4UORGFilesAction.java new file mode 100644 index 0000000..a6bed31 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/RefreshPlog4UORGFilesAction.java @@ -0,0 +1,35 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki; + +import net.sourceforge.phpeclipse.wiki.internal.Configuration; +import net.sourceforge.phpeclipse.wiki.internal.ConfigurationWorkingCopy; +import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin; + +import org.eclipse.ui.IWorkbenchPart; + +public class RefreshPlog4UORGFilesAction extends RefreshWikiFilesAction { + private IWorkbenchPart workbenchPart; + + protected Configuration getConfiguration() { + return getPlog4UConfiguration(super.getConfigurationPrefix(WikiEditorPlugin.PLOG4U_ORG_LOAD)); + } + + /** + * @return + */ + public static Configuration getPlog4UConfiguration(Configuration config) { + ConfigurationWorkingCopy configuration = new ConfigurationWorkingCopy(config); + + configuration.setName("www.Plog4U.org Download"); + configuration.setURL("http://www.plog4u.org/index.php/Special:Export"); + configuration.setType(WikiEditorPlugin.PLOG4U_ORG_LOAD); + return configuration; + } + + /** + * + */ + public RefreshPlog4UORGFilesAction() { + super(); + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/RefreshWikiFilesAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/RefreshWikiFilesAction.java new file mode 100644 index 0000000..7b1cce9 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/RefreshWikiFilesAction.java @@ -0,0 +1,178 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; + +import net.sourceforge.phpeclipse.wiki.actions.mediawiki.config.IWikipedia; +import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin; +import net.sourceforge.phpeclipse.wiki.internal.Configuration; +import net.sourceforge.phpeclipse.wiki.internal.ConfigurationManager; +import net.sourceforge.phpeclipse.wiki.internal.IConfiguration; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceRuleFactory; +import org.eclipse.core.resources.IResourceVisitor; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.jobs.ISchedulingRule; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.core.runtime.jobs.MultiRule; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.window.Window; +import org.eclipse.ui.IActionDelegate; +import org.eclipse.ui.IObjectActionDelegate; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.dialogs.ListSelectionDialog; +import org.eclipse.ui.internal.dialogs.ListContentProvider; + +public class RefreshWikiFilesAction implements IObjectActionDelegate { + private IWorkbenchPart workbenchPart; + + protected Configuration getConfigurationPrefix(String prefix) { + List allConfigsList = ConfigurationManager.getInstance().getConfigurations(); + ArrayList configsList = new ArrayList(); + for (int i = 0; i < allConfigsList.size(); i++) { + IConfiguration temp = (IConfiguration) allConfigsList.get(i); + if (temp.getType().startsWith(prefix)) { + configsList.add(temp); + } + } + if (configsList.size() == 1) { + return (Configuration) configsList.get(0); + } + Collections.sort(configsList); + Configuration configuration = null; + ListSelectionDialog listSelectionDialog = new ListSelectionDialog(WikiEditorPlugin.getDefault().getWorkbench() + .getActiveWorkbenchWindow().getShell(), configsList, new ListContentProvider(), new LabelProvider(), + "Select the refresh URL."); + listSelectionDialog.setTitle("Multiple active configuration found"); + if (listSelectionDialog.open() == Window.OK) { + Object[] locations = listSelectionDialog.getResult(); + if (locations != null) { + for (int i = 0; i < locations.length; i++) { + configuration = (Configuration) locations[i]; + break; + } + } + } + return configuration; + } + + protected Configuration getConfiguration() { + return getConfigurationPrefix(WikiEditorPlugin.PREFIX_LOAD); + } + + /** + * + */ + public RefreshWikiFilesAction() { + super(); + } + + /** + * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart) + */ + public void setActivePart(IAction action, IWorkbenchPart targetPart) { + workbenchPart = targetPart; + } + + public void run(IAction action) { + try { + ISelectionProvider selectionProvider = null; + selectionProvider = workbenchPart.getSite().getSelectionProvider(); + + StructuredSelection selection = null; + selection = (StructuredSelection) selectionProvider.getSelection(); + + //Shell shell = null; + Iterator iterator = null; + iterator = selection.iterator(); + Configuration configuration = getConfiguration(); + String wikiLocale = configuration.getType().substring(WikiEditorPlugin.PREFIX_LOAD.length()); + IWikipedia wikipediaProperties = WikiEditorPlugin.getWikiInstance(wikiLocale); + + final HashSet set = new HashSet(); + IResourceVisitor visitor = new IResourceVisitor() { + public boolean visit(IResource resource) { + switch (resource.getType()) { + case IResource.FILE: + if (resource.getFileExtension().equalsIgnoreCase(WikiEditorPlugin.WP_EXTENSION)) { + set.add(resource); + } + break; + } + return true; + } + }; + + while (iterator.hasNext()) { + // obj => selected object in the view + Object obj = iterator.next(); + + // is it a resource + if (obj instanceof IResource) { + IResource resource = (IResource) obj; + // check if it's a file resource + switch (resource.getType()) { + case IResource.FOLDER: + case IResource.FILE: + resource.accept(visitor); + break; + } + } + } + if (set.size() > 0) { + IFile[] files = new IFile[set.size()]; + set.toArray(files); + + Job job = new RefreshJob(wikipediaProperties, files, configuration.getURL()); + // job.setRule(modifyRule(files)); + job.setRule(null); + job.setUser(true); + job.schedule(); + } + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (NoSuchMethodException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public ISchedulingRule modifyRule(IFile[] files) { + ISchedulingRule combinedRule = null; + IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory(); + ISchedulingRule rule; + for (int i = 0; i < files.length; i++) { + rule = ruleFactory.modifyRule(files[i]); + combinedRule = MultiRule.combine(rule, combinedRule); + } + return combinedRule; + } + + /** + * @see IActionDelegate#selectionChanged(IAction, ISelection) + */ + public void selectionChanged(IAction action, ISelection selection) { + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/Plog4UDE.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/Plog4UDE.java new file mode 100644 index 0000000..68625bd --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/Plog4UDE.java @@ -0,0 +1,38 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.config; +//Parts of this sources are copied and modified from the jEdit Wikipedia plugin: +//http://www.djini.de/software/wikipedia/index.html +// +//The modified sources are available under the "Common Public License" +//with permission from the original author: Daniel Wunsch + + +public class Plog4UDE extends AbstractWikipedia { + + final private static String[] nameSpaces = new String[] { "Media", "Spezial", "", "Diskussion", "Benutzer", + "Benutzer Diskussion", "Wikipedia", "Wikipedia Diskussion", "Bild", "Bild Diskussion", "MediaWiki", "MediaWiki Diskussion", + "Vorlage", "Vorlage Diskussion", "Hilfe", "Hilfe Diskussion", "Kategorie", "Kategorie Diskussion" }; + + private static Plog4UDE instance = new Plog4UDE(); + + /** + * Get the singleton instance + * + * @see net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin#getWikiInstance() + */ + public static IWikipedia getInstance() { + return instance; + } + + // private constructor + private Plog4UDE() { + super(new WikiProperties("Plog4UDE")); + } + + /** + * @return Returns the nameSpaces. + */ + public String[] getNameSpaces() { + return nameSpaces; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/Plog4UORG.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/Plog4UORG.java new file mode 100644 index 0000000..a3f4c0f --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/Plog4UORG.java @@ -0,0 +1,37 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.config; +//Parts of this sources are copied and modified from the jEdit Wikipedia plugin: +//http://www.djini.de/software/wikipedia/index.html +// +//The modified sources are available under the "Common Public License" +//with permission from the original author: Daniel Wunsch + +public class Plog4UORG extends AbstractWikipedia { + + final private static String[] nameSpaces = new String[] { "Media", "Special", "", "Talk", "User", "User talk", "Wikipedia", + "Wikipedia talk", "Image", "Image talk", "MediaWiki", "MediaWiki talk", "Template", "Template talk", "Help", "Help talk", + "Category", "Category talk" }; + + private static Plog4UORG instance = new Plog4UORG(); + + /** + * Get the singleton instance + * + * @see net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin#getWikiInstance() + */ + public static IWikipedia getInstance() { + return instance; + } + + // private constructor + private Plog4UORG() { + super(new WikiProperties("Plog4UORG")); + } + + /** + * @return Returns the nameSpaces. + */ + public String[] getNameSpaces() { + return nameSpaces; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaHE.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaHE.java new file mode 100644 index 0000000..eadcc12 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaHE.java @@ -0,0 +1,54 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.config; + +//Parts of this sources are copied and modified from the jEdit Wikipedia plugin: +//http://www.djini.de/software/wikipedia/index.html +// +//The modified sources are available under the "Common Public License" +//with permission from the original author: Daniel Wunsch + +public class WikipediaHE extends AbstractWikipedia { + + final private static String[] nameSpaces = new String[] { + "Media", + "מיוחד", + "", + "שיחה", + "משתמש", + "שיחת משתמש", + "Wikipedia", + "Wikipedia talk", + "תמונה", + "שיחת תמונה", + "MediaWiki", + "MediaWiki talk", + "Template", + "Template talk", + "Help", + "Help talk", + "Category", + "Category talk" }; + + private static WikipediaHE instance = new WikipediaHE(); + + /** + * Get the singleton instance + * + * @see net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin#getWikiInstance() + */ + public static IWikipedia getInstance() { + return instance; + } + + // private constructor + private WikipediaHE() { + super(new WikiProperties("WikipediaHE")); + } + + /** + * @return Returns the nameSpaces. + */ + public String[] getNameSpaces() { + return nameSpaces; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaIA.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaIA.java new file mode 100644 index 0000000..08a2f65 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaIA.java @@ -0,0 +1,54 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.config; + +//Parts of this sources are copied and modified from the jEdit Wikipedia plugin: +//http://www.djini.de/software/wikipedia/index.html +// +//The modified sources are available under the "Common Public License" +//with permission from the original author: Daniel Wunsch + +public class WikipediaIA extends AbstractWikipedia { + + final private static String[] nameSpaces = new String[] { + "Media", + "Special", + "", + "Discussion", + "Usator", + "Discussion Usator", + "Wikipedia", + "Discussion Wikipedia", + "Imagine", + "Discussion Imagine", + "MediaWiki", + "Discussion MediaWiki", + "Template", + "Template talk", + "Help", + "Help talk", + "Category", + "Category talk" }; + + private static WikipediaIA instance = new WikipediaIA(); + + /** + * Get the singleton instance + * + * @see net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin#getWikiInstance() + */ + public static IWikipedia getInstance() { + return instance; + } + + // private constructor + private WikipediaIA() { + super(new WikiProperties("WikipediaIA")); + } + + /** + * @return Returns the nameSpaces. + */ + public String[] getNameSpaces() { + return nameSpaces; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaIT.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaIT.java new file mode 100644 index 0000000..c743d1e --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaIT.java @@ -0,0 +1,54 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.config; + +//Parts of this sources are copied and modified from the jEdit Wikipedia plugin: +//http://www.djini.de/software/wikipedia/index.html +// +//The modified sources are available under the "Common Public License" +//with permission from the original author: Daniel Wunsch + +public class WikipediaIT extends AbstractWikipedia { + + final private static String[] nameSpaces = new String[] { + "Media", + "Speciale", + "", + "Discussione", + "Utente", + "Discussioni utente", + "Wikipedia", + "Discussioni Wikipedia", + "Immagine", + "Discussioni immagine", + "MediaWiki", + "Discussioni MediaWiki", + "Template", + "Discussioni template", + "Aiuto", + "Discussioni aiuto", + "Categoria", + "Discussioni categoria" }; + + private static WikipediaIT instance = new WikipediaIT(); + + /** + * Get the singleton instance + * + * @see net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin#getWikiInstance() + */ + public static IWikipedia getInstance() { + return instance; + } + + // private constructor + private WikipediaIT() { + super(new WikiProperties("WikipediaIT")); + } + + /** + * @return Returns the nameSpaces. + */ + public String[] getNameSpaces() { + return nameSpaces; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaJA.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaJA.java new file mode 100644 index 0000000..e2e11cc --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaJA.java @@ -0,0 +1,54 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.config; +//Parts of this sources are copied and modified from the jEdit Wikipedia plugin: +//http://www.djini.de/software/wikipedia/index.html +// +//The modified sources are available under the "Common Public License" +//with permission from the original author: Daniel Wunsch + +public class WikipediaJA extends AbstractWikipedia { + + final private static String[] nameSpaces = new String[] { + "Media", + "特別", + "", + "ノート", + "利用者", + "利用者‐会話", + "Wikipedia", + "Wikipedia‐ノート", + "画像", + "画像‐ノート", + "MediaWiki", + "MediaWiki‐ノート", + "Template", + "Template‐ノート", + "ヘルプ", + "ヘルプ‐ノート", + "Category", + "Category‐ノート" +}; + + private static WikipediaJA instance = new WikipediaJA(); + + /** + * Get the singleton instance + * + * @see net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin#getWikiInstance() + */ + public static IWikipedia getInstance() { + return instance; + } + + // private constructor + private WikipediaJA() { + super(new WikiProperties("WikipediaJA")); + } + + /** + * @return Returns the nameSpaces. + */ + public String[] getNameSpaces() { + return nameSpaces; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaNL.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaNL.java new file mode 100644 index 0000000..b0a228b --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaNL.java @@ -0,0 +1,54 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.config; + +//Parts of this sources are copied and modified from the jEdit Wikipedia plugin: +//http://www.djini.de/software/wikipedia/index.html +// +//The modified sources are available under the "Common Public License" +//with permission from the original author: Daniel Wunsch + +public class WikipediaNL extends AbstractWikipedia { + + final private static String[] nameSpaces = new String[] { + "Media", + "Speciaal", + "", + "Overleg", + "Gebruiker", + "Overleg gebruiker", + "Wikipedia", + "Overleg Wikipedia", + "Afbeelding", + "Overleg afbeelding", + "MediaWiki", + "Overleg MediaWiki", + "Sjabloon", + "Overleg sjabloon", + "Help", + "Overleg help", + "Categorie", + "Overleg categorie" }; + + private static WikipediaNL instance = new WikipediaNL(); + + /** + * Get the singleton instance + * + * @see net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin#getWikiInstance() + */ + public static IWikipedia getInstance() { + return instance; + } + + // private constructor + private WikipediaNL() { + super(new WikiProperties("WikipediaNL")); + } + + /** + * @return Returns the nameSpaces. + */ + public String[] getNameSpaces() { + return nameSpaces; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaPL.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaPL.java new file mode 100644 index 0000000..293f206 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaPL.java @@ -0,0 +1,54 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.config; + +//Parts of this sources are copied and modified from the jEdit Wikipedia plugin: +//http://www.djini.de/software/wikipedia/index.html +// +//The modified sources are available under the "Common Public License" +//with permission from the original author: Daniel Wunsch + +public class WikipediaPL extends AbstractWikipedia { + + final private static String[] nameSpaces = new String[] { + "Media", + "Specjalna", + "", + "Dyskusja", + "Wikipedysta", + "Dyskusja Wikipedysty", + "Wikipedia", + "Dyskusja Wikipedia", + "Grafika", + "Dyskusja grafiki", + "MediaWiki", + "Dyskusja MediaWiki", + "Szablon", + "Dyskusja szablonu", + "Pomoc", + "Dyskusja pomocy", + "Kategoria", + "Dyskusja kategorii" }; + + private static WikipediaPL instance = new WikipediaPL(); + + /** + * Get the singleton instance + * + * @see net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin#getWikiInstance() + */ + public static IWikipedia getInstance() { + return instance; + } + + // private constructor + private WikipediaPL() { + super(new WikiProperties("WikipediaPL")); + } + + /** + * @return Returns the nameSpaces. + */ + public String[] getNameSpaces() { + return nameSpaces; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaPT.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaPT.java new file mode 100644 index 0000000..a049b15 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaPT.java @@ -0,0 +1,54 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.config; + +//Parts of this sources are copied and modified from the jEdit Wikipedia plugin: +//http://www.djini.de/software/wikipedia/index.html +// +//The modified sources are available under the "Common Public License" +//with permission from the original author: Daniel Wunsch + +public class WikipediaPT extends AbstractWikipedia { + + final private static String[] nameSpaces = new String[] { + "Media", + "Especial", + "", + "Discussão", + "Usuário", + "Usuário Discussão", + "Wikipedia", + "Wikipedia Discussão", + "Imagem", + "Imagem Discussão", + "MediaWiki", + "MediaWiki Discussão", + "Predefinição", + "Predefinição Discussão", + "Ajuda", + "Ajuda Discussão", + "Categoria", + "Categoria Discussão" }; + + private static WikipediaPT instance = new WikipediaPT(); + + /** + * Get the singleton instance + * + * @see net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin#getWikiInstance() + */ + public static IWikipedia getInstance() { + return instance; + } + + // private constructor + private WikipediaPT() { + super(new WikiProperties("WikipediaPT")); + } + + /** + * @return Returns the nameSpaces. + */ + public String[] getNameSpaces() { + return nameSpaces; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaRO.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaRO.java new file mode 100644 index 0000000..7487c1d --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaRO.java @@ -0,0 +1,54 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.config; + +//Parts of this sources are copied and modified from the jEdit Wikipedia plugin: +//http://www.djini.de/software/wikipedia/index.html +// +//The modified sources are available under the "Common Public License" +//with permission from the original author: Daniel Wunsch + +public class WikipediaRO extends AbstractWikipedia { + + final private static String[] nameSpaces = new String[] { + "Media", + "Special", + "", + "DiscuÅ£ie", + "Utilizator", + "DiscuÅ£ie Utilizator", + "Wikipedia", + "DiscuÅ£ie Wikipedia", + "Imagine", + "DiscuÅ£ie Imagine", + "MediaWiki", + "DiscuÅ£ie MediaWiki", + "Format", + "DiscuÅ£ie Format", + "Ajutor", + "DiscuÅ£ie Ajutor", + "Categorie", + "DiscuÅ£ie Categorie" }; + + private static WikipediaRO instance = new WikipediaRO(); + + /** + * Get the singleton instance + * + * @see net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin#getWikiInstance() + */ + public static IWikipedia getInstance() { + return instance; + } + + // private constructor + private WikipediaRO() { + super(new WikiProperties("WikipediaRO")); + } + + /** + * @return Returns the nameSpaces. + */ + public String[] getNameSpaces() { + return nameSpaces; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaSL.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaSL.java new file mode 100644 index 0000000..2a48bda --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaSL.java @@ -0,0 +1,54 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.config; + +//Parts of this sources are copied and modified from the jEdit Wikipedia plugin: +//http://www.djini.de/software/wikipedia/index.html +// +//The modified sources are available under the "Common Public License" +//with permission from the original author: Daniel Wunsch + +public class WikipediaSL extends AbstractWikipedia { + + final private static String[] nameSpaces = new String[] { + "Media", + "Posebno", + "", + "Pogovor", + "Uporabnik", + "UporabniÅ¡ki pogovor", + "Wikipedija", + "Wikipedia talk", + "Slika", + "Pogovor k sliki", + "MediaWiki", + "MediaWiki talk", + "Template", + "Template talk", + "Help", + "Help talk", + "Category", + "Category talk" }; + + private static WikipediaSL instance = new WikipediaSL(); + + /** + * Get the singleton instance + * + * @see net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin#getWikiInstance() + */ + public static IWikipedia getInstance() { + return instance; + } + + // private constructor + private WikipediaSL() { + super(new WikiProperties("WikipediaSL")); + } + + /** + * @return Returns the nameSpaces. + */ + public String[] getNameSpaces() { + return nameSpaces; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaSV.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaSV.java new file mode 100644 index 0000000..9510cc0 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaSV.java @@ -0,0 +1,54 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.config; + +//Parts of this sources are copied and modified from the jEdit Wikipedia plugin: +//http://www.djini.de/software/wikipedia/index.html +// +//The modified sources are available under the "Common Public License" +//with permission from the original author: Daniel Wunsch + +public class WikipediaSV extends AbstractWikipedia { + + final private static String[] nameSpaces = new String[] { + "Media", + "Special", + "", + "Diskussion", + "Användare", + "Användardiskussion", + "Wikipedia", + "Wikipedia diskussion", + "Bild", + "Bilddiskussion", + "MediaWiki", + "MediaWiki diskussion", + "Mall", + "Malldiskussion", + "Hjälp", + "Hjälp diskussion", + "Kategori", + "Kategoridiskussion" }; + + private static WikipediaSV instance = new WikipediaSV(); + + /** + * Get the singleton instance + * + * @see net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin#getWikiInstance() + */ + public static IWikipedia getInstance() { + return instance; + } + + // private constructor + private WikipediaSV() { + super(new WikiProperties("WikipediaSV")); + } + + /** + * @return Returns the nameSpaces. + */ + public String[] getNameSpaces() { + return nameSpaces; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaZH.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaZH.java new file mode 100644 index 0000000..93dc708 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/config/WikipediaZH.java @@ -0,0 +1,54 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.config; + +//Parts of this sources are copied and modified from the jEdit Wikipedia plugin: +//http://www.djini.de/software/wikipedia/index.html +// +//The modified sources are available under the "Common Public License" +//with permission from the original author: Daniel Wunsch + +public class WikipediaZH extends AbstractWikipedia { + + final private static String[] nameSpaces = new String[] { + "Media", + "Special", + "", + "Talk", + "User", + "User talk", + "Wikipedia", + "Wikipedia talk", + "Image", + "Image talk", + "MediaWiki", + "MediaWiki talk", + "Template", + "Template talk", + "Help", + "Help talk", + "Category", + "Category talk" }; + + private static WikipediaZH instance = new WikipediaZH(); + + /** + * Get the singleton instance + * + * @see net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin#getWikiInstance() + */ + public static IWikipedia getInstance() { + return instance; + } + + // private constructor + private WikipediaZH() { + super(new WikiProperties("WikipediaZH")); + } + + /** + * @return Returns the nameSpaces. + */ + public String[] getNameSpaces() { + return nameSpaces; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/BookmarkletServer.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/BookmarkletServer.java index 6b7acff..eb350c9 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/BookmarkletServer.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/BookmarkletServer.java @@ -177,7 +177,7 @@ public class BookmarkletServer implements Runnable { return; } // TODO determine the global project and open editor for URL - OpenWikiLinkEditorAction.openWikiUrl(null, url); +// OpenWikiLinkEditorAction.openWikiUrl(null, url); // wikipedia.openURL(jEdit.getActiveView(), new URL(url), true); } diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/MediaWikiConnector.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/MediaWikiConnector.java index b963dcc..4c1abb6 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/MediaWikiConnector.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/MediaWikiConnector.java @@ -1,4 +1,5 @@ package net.sourceforge.phpeclipse.wiki.actions.mediawiki.connect; + //Parts of this sources are copied and modified from the jEdit Wikipedia plugin: //http://www.djini.de/software/wikipedia/index.html // @@ -6,13 +7,15 @@ package net.sourceforge.phpeclipse.wiki.actions.mediawiki.connect; //with permission from the original author: Daniel Wunsch import java.io.IOException; -import java.io.InputStream; +import java.io.StringReader; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; +import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.sourceforge.phpeclipse.wiki.actions.mediawiki.config.IWikipedia; +import net.sourceforge.phpeclipse.wiki.actions.mediawiki.config.WikipediaDE; import net.sourceforge.phpeclipse.wiki.actions.mediawiki.exceptions.MethodException; import net.sourceforge.phpeclipse.wiki.actions.mediawiki.exceptions.PageNotEditableException; import net.sourceforge.phpeclipse.wiki.actions.mediawiki.exceptions.UnexpectedAnswerException; @@ -33,6 +36,7 @@ import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.protocol.Protocol; import org.apache.commons.httpclient.util.EncodingUtil; +import org.eclipse.core.runtime.CoreException; /** * This class gets the wikitext from a wikipedia edit page @@ -50,7 +54,7 @@ public class MediaWikiConnector { + ".*]*\\svalue=\"(\\d*)\"[^>]*\\sname=\"wpEdittime\"[^>]*>" + ".*", Pattern.DOTALL); //setup default user agent - final static public String userAgent = "PHPeclipse.de/0.0"; + final static public String userAgent = "plog4u.org/0.0"; // create a ConnectionManager private MultiThreadedHttpConnectionManager manager; @@ -103,9 +107,13 @@ public class MediaWikiConnector { PostMethod method = new PostMethod(actionUrl); method.setFollowRedirects(false); method.addRequestHeader("User-Agent", userAgent); - NameValuePair[] params = new NameValuePair[] { new NameValuePair("title", config.getLoginTitle()), new NameValuePair("action", "submit"), - new NameValuePair("wpName", user), new NameValuePair("wpPassword", password), - new NameValuePair("wpRemember", remember ? "1" : "0"), new NameValuePair("wpLoginattempt", "submit") }; + NameValuePair[] params = new NameValuePair[] { + new NameValuePair("title", config.getLoginTitle()), + new NameValuePair("action", "submit"), + new NameValuePair("wpName", user), + new NameValuePair("wpPassword", password), + new NameValuePair("wpRemember", remember ? "1" : "0"), + new NameValuePair("wpLoginattempt", "submit") }; method.addParameters(params); boolean result; @@ -147,11 +155,12 @@ public class MediaWikiConnector { } /** log out - return success */ - public boolean logout(IWikipedia config,String actionUrl) throws UnexpectedAnswerException, MethodException { + public boolean logout(IWikipedia config, String actionUrl) throws UnexpectedAnswerException, MethodException { GetMethod method = new GetMethod(actionUrl); method.setFollowRedirects(false); method.addRequestHeader("User-Agent", userAgent); - NameValuePair[] params = new NameValuePair[] { new NameValuePair("title", config.getLogoutTitle()), + NameValuePair[] params = new NameValuePair[] { + new NameValuePair("title", config.getLogoutTitle()), new NameValuePair("action", "submit") }; method.setQueryString(EncodingUtil.formUrlEncode(params, config.getCharSet())); @@ -235,10 +244,43 @@ public class MediaWikiConnector { return result; } + public ArrayList loadXML(IWikipedia config, String actionURL, String pages) throws UnexpectedAnswerException, MethodException { + PostMethod method = new PostMethod(actionURL); + method.setFollowRedirects(false); + method.addRequestHeader("User-Agent", userAgent); + method.addRequestHeader("Content-Type", PostMethod.FORM_URL_ENCODED_CONTENT_TYPE + "; charset=" + config.getCharSet()); + + NameValuePair[] params = new NameValuePair[] { + new NameValuePair("pages", pages), + new NameValuePair("curonly", "X"), + new NameValuePair("action", "submit") }; + method.addParameters(params); + try { + int responseCode = client.executeMethod(method); + String responseBody = method.getResponseBodyAsString(); + + if (responseCode == 200) { + StringReader reader = new StringReader(responseBody); + return XMLReader.readFromStream(reader); + } else { + throw new UnexpectedAnswerException("XML load not successful: expected 200 OK, got " + method.getStatusLine()); + } + } catch(CoreException e) { + throw new UnexpectedAnswerException("XML load method failed" + e.getMessage()); + } catch (HttpException e) { + throw new MethodException("XML load method failed", e); + } catch (IOException e) { + throw new MethodException("XML load method failed", e); + } finally { + method.releaseConnection(); + } + } + /** - * store a Page Version - returns a Stored object + * store a Page Version - returns a Stored object * - * @param config - WiKipedia predefined properties + * @param config - + * WiKipedia predefined properties * @param actionURL * @param title * @param content @@ -261,12 +303,15 @@ public class MediaWikiConnector { method.addRequestHeader("User-Agent", userAgent); method.addRequestHeader("Content-Type", PostMethod.FORM_URL_ENCODED_CONTENT_TYPE + "; charset=" + config.getCharSet()); NameValuePair[] params = new NameValuePair[] { - // new NameValuePair("wpSection", ""), + // new NameValuePair("wpSection", ""), // new NameValuePair("wpPreview", "Vorschau zeigen"), // new NameValuePair("wpSave", "Artikel speichern"), - new NameValuePair("title", title), new NameValuePair("wpTextbox1", content.body), - new NameValuePair("wpEdittime", content.timestamp), new NameValuePair("wpSummary", summary), - new NameValuePair("wpSave", "yes"), new NameValuePair("action", "submit") }; + new NameValuePair("title", title), + new NameValuePair("wpTextbox1", content.body), + new NameValuePair("wpEdittime", content.timestamp), + new NameValuePair("wpSummary", summary), + new NameValuePair("wpSave", "yes"), + new NameValuePair("action", "submit") }; method.addParameters(params); if (minorEdit) method.addParameter("wpMinoredit", "1"); @@ -306,7 +351,7 @@ public class MediaWikiConnector { * Get the text of a wikimedia article * */ - public static String getWikiRawText(String wikiname, String urlStr) { + public String getWikiRawText(String wikiname, String urlStr) { // examples // http://en.wikipedia.org/w/wiki.phtml?title=Main_Page&action=raw // http://en.wikibooks.org/w/index.php?title=Programming:PHP:SQL_Injection&action=raw @@ -347,21 +392,12 @@ public class MediaWikiConnector { } method.execute(state, connection); + // client.executeMethod(method); if (method.getStatusCode() == HttpStatus.SC_OK) { // get the wiki text now: String wikiText = method.getResponseBodyAsString(); return wikiText; - // wrong text not always complete - // InputStream stream = method.getResponseBodyAsStream(); - // int byteLen = stream.available(); - // int count = 1; - // byte[] buffer = new byte[byteLen]; - // int len = 0; - // stream.read(buffer, 0, byteLen); - // String wikiText = new String(buffer); - // return wikiText; - // System.out.println(wikiText); } } catch (Throwable e) { WikiEditorPlugin.log(e); @@ -374,78 +410,95 @@ public class MediaWikiConnector { return null; // no success in getting wiki text } - public static String getWikiEditTextarea(String wikiname, String urlStr) { - // examples - // http://en.wikipedia.org/w/wiki.phtml?title=Main_Page&action=edit - // http://en.wikibooks.org/w/wiki.phtml?title=Programming:PHP:SQL_Injection&action=edit - // http://en.wikipedia.org/w/wiki.phtml?title=Talk:Division_by_zero&action=edit - HttpMethod method = null; + // public static String getWikiEditTextarea(String wikiname, String urlStr) { + // // examples + // // http://en.wikipedia.org/w/wiki.phtml?title=Main_Page&action=edit + // // http://en.wikibooks.org/w/wiki.phtml?title=Programming:PHP:SQL_Injection&action=edit + // // http://en.wikipedia.org/w/wiki.phtml?title=Talk:Division_by_zero&action=edit + // HttpMethod method = null; + // try { + // if (urlStr == null) { + // urlStr = "http://en.wikipedia.org/w/wiki.phtml?title=" + wikiname + "&action=edit"; + // } + // // else { + // // urlStr = urlStr + "?title=" + wikiname + "&action=edit"; + // // } + // URI uri = new URI(urlStr.toCharArray()); + // + // String schema = uri.getScheme(); + // if ((schema == null) || (schema.equals(""))) { + // schema = "http"; + // } + // Protocol protocol = Protocol.getProtocol(schema); + // + // HttpState state = new HttpState(); + // + // method = new GetMethod(uri.toString()); + // String host = uri.getHost(); + // int port = uri.getPort(); + // + // HttpConnection connection = new HttpConnection(host, port, protocol); + // + // connection.setProxyHost(System.getProperty("http.proxyHost")); + // connection.setProxyPort(Integer.parseInt(System.getProperty("http.proxyPort", "80"))); + // + // if (System.getProperty("http.proxyUserName") != null) { + // state.setProxyCredentials(null, null, new UsernamePasswordCredentials(System.getProperty("http.proxyUserName"), System + // .getProperty("http.proxyPassword"))); + // } + // + // if (connection.isProxied() && connection.isSecure()) { + // method = new ConnectMethod(method); + // } + // + // method.execute(state, connection); + // + // if (method.getStatusCode() == HttpStatus.SC_OK) { + // // get the textareas wiki text now: + // InputStream stream = method.getResponseBodyAsStream(); + // int byteLen = stream.available(); + // int count = 1; + // byte[] buffer = new byte[byteLen]; + // stream.read(buffer, 0, byteLen); + // String wikiText = new String(buffer); + // // String wikiText = method.getResponseBodyAsString(); + // int start = wikiText.indexOf("", start + 1); + // if (start != (-1)) { + // int end = wikiText.indexOf(""); + // wikiText = wikiText.substring(start + 1, end); + // } + // } + // return wikiText; + // // System.out.println(wikiText); + // + // } + // } catch (Exception e) { + // e.printStackTrace(); + // } finally { + // if (method != null) { + // method.releaseConnection(); + // } + // } + // return null; // no success in getting wiki text + // } + + public static void main(String[] args) { + MediaWikiConnector mwc = new MediaWikiConnector(); try { - if (urlStr == null) { - urlStr = "http://en.wikipedia.org/w/wiki.phtml?title=" + wikiname + "&action=edit"; + IWikipedia wp = null; + ArrayList list = mwc.loadXML(wp, "http://www.plog4u.de/wiki/index.php/Spezial:Export", "Mechanisches Fernsehen\nSynästhesie"); + for (int i = 0; i < list.size(); i++) { + System.out.println(list.get(i).toString()); } - // else { - // urlStr = urlStr + "?title=" + wikiname + "&action=edit"; - // } - URI uri = new URI(urlStr.toCharArray()); - - String schema = uri.getScheme(); - if ((schema == null) || (schema.equals(""))) { - schema = "http"; - } - Protocol protocol = Protocol.getProtocol(schema); - - HttpState state = new HttpState(); - - method = new GetMethod(uri.toString()); - String host = uri.getHost(); - int port = uri.getPort(); - - HttpConnection connection = new HttpConnection(host, port, protocol); - - connection.setProxyHost(System.getProperty("http.proxyHost")); - connection.setProxyPort(Integer.parseInt(System.getProperty("http.proxyPort", "80"))); - - if (System.getProperty("http.proxyUserName") != null) { - state.setProxyCredentials(null, null, new UsernamePasswordCredentials(System.getProperty("http.proxyUserName"), System - .getProperty("http.proxyPassword"))); - } - - if (connection.isProxied() && connection.isSecure()) { - method = new ConnectMethod(method); - } - - method.execute(state, connection); - - if (method.getStatusCode() == HttpStatus.SC_OK) { - // get the textareas wiki text now: - InputStream stream = method.getResponseBodyAsStream(); - int byteLen = stream.available(); - int count = 1; - byte[] buffer = new byte[byteLen]; - stream.read(buffer, 0, byteLen); - String wikiText = new String(buffer); - // String wikiText = method.getResponseBodyAsString(); - int start = wikiText.indexOf("", start + 1); - if (start != (-1)) { - int end = wikiText.indexOf(""); - wikiText = wikiText.substring(start + 1, end); - } - } - return wikiText; - // System.out.println(wikiText); - - } - } catch (Exception e) { + } catch (UnexpectedAnswerException e) { + // TODO Auto-generated catch block e.printStackTrace(); - } finally { - if (method != null) { - method.releaseConnection(); - } - } - return null; // no success in getting wiki text + } catch (MethodException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } } diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/Parsed.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/Parsed.java index d6f282c..c8bb20d 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/Parsed.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/Parsed.java @@ -1,4 +1,5 @@ package net.sourceforge.phpeclipse.wiki.actions.mediawiki.connect; + //Parts of this sources are copied and modified from the jEdit Wikipedia plugin: //http://www.djini.de/software/wikipedia/index.html // @@ -6,15 +7,71 @@ package net.sourceforge.phpeclipse.wiki.actions.mediawiki.connect; //with permission from the original author: Daniel Wunsch public class Parsed { - String timestamp; + /** + * 6lt;page6gt; XML data from Wikipedia Special:Export pages + * may be null + * + */ + /*package private*/ String xmlData=null; + /** + * timeStamp represented in XML format from Wikipedia Special:Export pages + */ + /*package private*/ String timestamp=null; + + /*package private*/ String title=null; - String title; + /*package private*/ String body=null; - String body; + /*package private*/ Parsed() { + } public Parsed(String timeStamp, String title, String body) { + this.xmlData = ""; this.timestamp = timeStamp; this.title = title; this.body = body; } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + public String toString() { + StringBuffer buffer = new StringBuffer(); + buffer.append("==>Title:\n"); + if (title!=null) { + buffer.append(title); + } + buffer.append("==>Timestamp:\n"); + if (timestamp!=null) { + buffer.append(timestamp); + } + buffer.append("==>Body:\n"); + if (body!=null) { + buffer.append(body); + } + return buffer.toString(); + } + /** + * @return Returns the body. + */ + public String getBody() { + return body; + } + /** + * @return Returns the timestamp. + */ + public String getTimestamp() { + return timestamp; + } + /** + * @return Returns the title. + */ + public String getTitle() { + return title; + } + /** + * @return Returns the xmlData. + */ + public String getXmlData() { + return xmlData; + } } \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/XMLReader.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/XMLReader.java new file mode 100644 index 0000000..8cdfc20 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/XMLReader.java @@ -0,0 +1,358 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.connect; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.StringReader; +import java.util.ArrayList; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin; + +import org.apache.crimson.tree.ElementNode; +import org.eclipse.core.runtime.CoreException; +import org.w3c.dom.Document; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +/** + * XMLReader reads Wikipedia XML export pages + */ +public class XMLReader { + private static final String TITLE_TAG = "title"; //$NON-NLS-1$ + private static final String TIMESTAMP_TAG = "timestamp"; //$NON-NLS-1$ + private static final String TEXT_TAG = "text"; //$NON-NLS-1$ + private static final String PAGE_TAG = "page"; //$NON-NLS-1$ + + public XMLReader() { + } + + // public static void readInSyntax() { + // try { + // hasXMLFileBeenRead = true; + // /* + // * Attempt to read the syntax file from the metadata if this does not work, create metadata from default + // */ + // File syntaxFile = getSyntaxFile(); + // if (syntaxFile.exists()) { + // readFromFile(syntaxFile); + // } else { + // readFromStream(PHPSyntaxRdr.class.getResourceAsStream(PHPSYNTAX_FILE)); + // saveToFile(syntaxFile); + // } + // + // } catch (CoreException ce) { + // ce.printStackTrace(); + // } + // } + + public static void readFromFile(String filename) { + try { + readFromFile(new File(filename)); + } catch (CoreException e) { + } + } + + public static void readFromFile(File file) throws CoreException { + InputStream stream = null; + + if (file.exists()) { + try { + stream = new FileInputStream(file); + readFromStream(new InputStreamReader(stream)); + } catch (IOException e) { + throwReadException(e); + } finally { + try { + if (stream != null) { + stream.close(); + } + } catch (IOException e) { + } + } + } + } + + private static void traverse(String eleName, Node cNode, Parsed parsed) { + switch (cNode.getNodeType()) { + case Node.DOCUMENT_NODE: +// System.out.println("DOCUMENT_NODE " + cNode.getNodeName()); + processChildren(eleName, cNode.getChildNodes(), parsed); + break; + + case Node.ELEMENT_NODE: + eleName = cNode.getNodeName(); +// System.out.println("ELEMENT_NODE " + eleName); +// NamedNodeMap attributeMap = cNode.getAttributes(); +// int numAttrs = attributeMap.getLength(); +// for (int i = 0; i < attributeMap.getLength(); i++) { +// Attr attribute = (Attr) attributeMap.item(i); +// String attrName = attribute.getNodeName(); +// String attrValue = attribute.getNodeValue(); +// } + processChildren(eleName, cNode.getChildNodes(), parsed); + break; + case Node.CDATA_SECTION_NODE: + case Node.TEXT_NODE: + if (eleName.equals(TITLE_TAG)) { // element name from the corresp tag + parsed.title = cNode.getNodeValue(); + } else if (eleName.equals(TIMESTAMP_TAG)) { + parsed.timestamp = cNode.getNodeValue(); + } else if (eleName.equals(TEXT_TAG)) { + parsed.body = cNode.getNodeValue(); + } + break; + } + } + + private static void processChildren(String eleName, NodeList nList, Parsed parsed) { + if (nList.getLength() != 0) { + for (int i = 0; i < nList.getLength(); i++) { + traverse(eleName, nList.item(i), parsed); + if (eleName.equals(TEXT_TAG)) { + break; + } + } + } + } + + /** + * Reads the wikipedia xml data from the given stream + * + * @param stream + * @return + * @throws CoreException + */ + public static ArrayList readFromStream(Reader stream) throws CoreException { + ArrayList list = new ArrayList(); + try { + // Create a factory object for creating DOM parsers + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + // Now use the factory to create a DOM parser (a.k.a. a DocumentBuilder) + DocumentBuilder parser = factory.newDocumentBuilder(); + // Parse the file and build a Document tree to represent its content + Document document = parser.parse(new InputSource(stream)); + // Ask the document for a list of all tags it contains + NodeList pages = document.getElementsByTagName(PAGE_TAG); + // Loop through those elements one at a time, and extract the + // content of their tags. + int numPages = pages.getLength(); + + for (int i = 0; i < numPages; i++) { + ElementNode page = (ElementNode) pages.item(i); // A + Parsed parsed = new Parsed(); + // set raw xml data: + parsed.xmlData = page.toString(); + traverse("", page, parsed); + list.add(parsed); + } + return list; + } catch (ParserConfigurationException e) { + throwReadException(e); + } catch (IOException e) { + throwReadException(e); + } catch (SAXParseException e) { +// System.out.println("SAXParseException in line:" + e.getLineNumber() + " column:" + e.getColumnNumber()); + throwReadException(e); + } catch (SAXException e) { + throwReadException(e); + } + return list; + } + + private static String getAttributeValue(NamedNodeMap attributes, String name) { + Node node = attributes.getNamedItem(name); + return node == null ? null : node.getNodeValue(); + } + + // public static void saveToFile(File file) throws CoreException { + // OutputStream stream = null; + // try { + // stream = new FileOutputStream(file); + // saveToStream(stream); + // } catch (IOException e) { + // throwWriteException(e); + // } finally { + // try { + // if (stream != null) + // stream.close(); + // } catch (IOException e) { + // } + // } + // } + + // public static void saveToStream(OutputStream stream) throws CoreException { + // try { + // DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + // DocumentBuilder builder = factory.newDocumentBuilder(); + // Document document = builder.newDocument(); + // Node root = document.createElement("PHPStandardSyntax"); // $NON-NLS-1$ //$NON-NLS-1$ + // document.appendChild(root); + // for (int i = 0; i != syntaxdata.size(); i++) { + // Object bufferobj = (Object) syntaxdata.get(i); + // Attr name = null; + // Node node = document.createElement(REVISION_TAG); // $NON-NLS-1$ //$NON-NLS-1$ + // root.appendChild(node); + // NamedNodeMap attributes = node.getAttributes(); + // // if (bufferobj instanceof PHPType) + // // name = document.createAttribute(TYPE_ATTR); + // // if (bufferobj instanceof PHPKeyword) + // // name = document.createAttribute(KEYWORD_ATTR); + // // if (bufferobj instanceof PHPFunction) + // // name = document.createAttribute(FN_ATTR); + // // if (bufferobj instanceof PHPConstant) + // // name = document.createAttribute(CONSTANT_ATTR); + // // name.setValue(((PHPElement) bufferobj).getName()); + // // attributes.setNamedItem(name); + // // Attr description = document.createAttribute(USAGE_ATTR); + // // description.setValue(((PHPElement) bufferobj).getUsage()); + // // attributes.setNamedItem(description); + // // if (bufferobj instanceof PHPKeyword) { + // // Attr tokenval = document.createAttribute(TOKENVAL_ATTR); + // // tokenval.setValue((new Integer(((PHPKeyword) bufferobj).gettokenval())).toString()); + // // attributes.setNamedItem(tokenval); + // // } + // // if (bufferobj instanceof PHPFunction) { + // // // Attr usage = document.createAttribute(USAGE_ATTR); + // // Text usage = document.createTextNode(((PHPFunction) bufferobj).getDescription()); + // // node.appendChild(usage); + // // } + // // if (bufferobj instanceof PHPConstant) { + // // // Attr usage = document.createAttribute(USAGE_ATTR); + // // Text usage = document.createTextNode(((PHPConstant) bufferobj).getDescription()); + // // node.appendChild(usage); + // // } + // } + // Transformer transformer = TransformerFactory.newInstance().newTransformer(); + // transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ + // transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$ + // DOMSource source = new DOMSource(document); + // StreamResult result = new StreamResult(stream); + // + // transformer.transform(source, result); + // + // } catch (ParserConfigurationException e) { + // throwWriteException(e); + // } catch (TransformerException e) { + // throwWriteException(e); + // } + // + // } + + private static void throwReadException(Throwable t) throws CoreException { + WikiEditorPlugin.log(t); + } + + private static void throwWriteException(Throwable t) throws CoreException { + WikiEditorPlugin.log(t); + } + + public static void main(String[] args) { + try { + String test = "\r\n" + + "\r\n" + + " \r\n" + + " Mechanisches Fernsehen\r\n" + + " \r\n" + + " 2004-11-22T12:41:10Z\r\n" + + " Electrocat\r\n" + + " Als \'\'\'mechanisches Fernsehen\'\'\' bezeichnet man [[Fernsehen]], bei dem die Bildzerlegung und -zusammensetzung im Gegensatz zum [[elektronisches Fernsehen|elektronischen Fernsehen]] mechanisch erfolgt. Die eigentliche Übertragung findet natürlich auf elektrischem Wege statt.\r\n" + + "\r\n" + + "Das mechanische Fernsehen war die erste Form des Fernsehens. Die erste brauchbare Realisierung erfolgte mit Hilfe der nach ihrem Erfinder [[Paul Nipkow]] benannten [[Nipkow-Scheibe]]. Hierbei ist insbesondere die Pionierarbeit des ungarischen Ingenieurs [[D. von Mihaly]] und des schottischen Erfinders [[John Logie Baird]] zu erwähnen. [[D. von Mihaly]] entwickelte ebenfalls ein vollkommen anderes Verfahren, bei dem ein Spiegel zwischen einem Hufeisenmagneten schnell oszillierte. In einem verbesserten Verfahren wurde ein Spiegel auf Drahtsaiten befestigt, welche nach Stromdurchleitung in eine schnelle Schwingung versetzt wurden. Ein wieder anderes Verfahren entwickelte [[Dr. Carolus]] bei [[Telefunken]], wo mit schnell rotierenden Spiegeln gearbeitet wurde. Durch Carolus wurden auch beide Systeme miteinander kombiniert (Spiegelrad für horizontale Abtastung, oszillierende Spiegel für vertikale Abtastung. \r\n" + + "\r\n" + + "Dennoch sollte beim mechanischen Fernsehen insbesondere die Nipkow-Scheibe Verwendung finden, welche auf der Senderseite bis in die 1940er Jahre zur Bildzerlegung von Filmen Verwendung fand. \r\n" + + "\r\n" + + "Auch heute ist das mechanische Fernsehen nicht vollkommen bedeutungslos. Insbesondere Spiegelsysteme finden heute wieder Verwendung beim Bau von [[Videoprojektoren]]. \r\n" + + "\r\n" + + "===Hinweis:===\r\n" + + "Die Begriffsbildung "Mechanisches Fernsehen" beruht auf der laienhaften Anschauung, die sichtbar drehende Nipkow-Lochscheibe als wesentlichstes Funktionselement oder anders ausgedrückt, den Vorgang der Bildpunkt-Zerlegung als Hauptteil des Fernseh-Gesamtsystems wahrzunehmen\r\n" + + "\r\n" + + "Demgegenüber besteht die nipkowsche Vorrichtung größtenteils aus elektrisch betriebenen Bauteilen, von denen mindestens eines - die [[Selen]]zelle - bereits ein elektronisches Bauelement darstellt. Desweiteren erfolgt die Übertragung vom Sender zum Empfänger elektrisch. <br />\r\n" + + "\r\n" + + "Auf der Empfänger-Seite wird bei der nipkowschen Ausführung raffinierterweise ein [[Polarisation|polarisierter]] Lichstrahl von dem Magnetfeld einer Spule in Abhängigkeit von dem Signal der Sender-Selenzelle soweit gedreht und durch nachfolgende Linsen gefiltert, dass für das Auge der gleiche Helligkeits-Eindruck hervorgerufen wird, wie er auf der Sender-Seite besteht.<br />\r\n" + + "Dieser polarisierte Lichtstrahl wurde mit Hilfe entweder eines speziellen optischen Glases oder einer mit Schwefelkohlenstoff gefüllten Röhre erzeugt(sog. "Glimmlampe") und ersetzte damals die noch nicht erfundene Braunsche Elektronenstrahlröhre. \r\n" + + "\r\n" + + "Damit wird sichtbar, dass der Begriff des "mechanischen Fernsehens" weitgehend irreführend ist. Nipkow selbst nannte seinen Apparat in der Patentschrift etwas treffender ein "Elektrisches Teleskop". \r\n" + + "Allenfalls korrekt wäre noch die Begriffsbildung "mechanische Bildzerlegung". \r\n" + "\r\n" + + "== Weblinks ==\r\n" + "*http://www.kefk.net/Research/Funk/HA-Funk/ha_2-3.html\r\n" + "\r\n" + + "[[Kategorie:Fernsehtechnik]]\r\n" + " \r\n" + " \r\n" + "\r\n" + ""; + String test2 = "\r\n" + + "\r\n" + + " \r\n" + + " Anrechenbare Kosten\r\n" + + " \r\n" + + " 2004-09-22T17:18:23Z\r\n" + + " Fenice\r\n" + + " cat\r\n" + + "\r\n" + + " Die \'\'\'anrechenbaren Kosten\'\'\' sind eines der Regelkriterien bei der Ermittlung des [[Honorar]]s von Architekten und Ingenieuren nach der [[HOAI]]. Sie werden aus einem fachspezifischen Kostenanteil auf Basis der Kostenermittlungen nach [[DIN 276]] errechnet und können daher innerhalb eines Projektes je nach [[Leistungsphasen|Leistungsphase]] unterschiedlich hoch sein.\r\n" + + "\r\n" + + "[[Kategorie:Rechnungswesen]]\r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " Synästhesie\r\n" + + " \r\n" + + " 2004-12-01T12:19:53Z\r\n" + + "\r\n" + + " 145.253.155.135\r\n" + + " vorübergehender statt verübergehender\r\n" + + " \'\'\'Synästhesie\'\'\' (griech. \'\'Mitempfindung\'\') ist die Kopplung zweier physikalisch getrennter Domänen der [[Wahrnehmung]] , etwa [[Farbe]] und [[Temperatur]] (\'\'"warmes Grün"\'\'), im engeren Sinne die [[Wahrnehmung]] von Sinnesreizen eines [[Sinnesorgan]]s als die eines anderen. Menschen, bei denen derart verknüpfte Wahrnehmungen auftreten, werden als [[Synästhetiker]] bezeichnet. Synästhesie kann auch als vorübergehender Effekt nach der Einnahme von [[Halluzinogen]]en auftreten.\r\n" + + "\r\n" + + "Synästhetiker haben also häufig zu einem Sinnesreiz zwei oder mehrere [[Wahrnehmung]]en. Sie können beispielsweise Geräusche nicht nur hören, sondern auch [[Form]]en und Farben dazu sehen. Das Geräusch bekommt zusätzlich zu den üblichen Eigenschaften diese weiteren Eigenschaften. Das Bild, das dabei entsteht, überlagert sich jedoch nur bei den wenigsten Synästhetikern mit dem Gesehenen, sondern wird vor einem "inneren Auge" sichtbar. Diese Synästhesie ist als \'\'Farbenhören\'\' bekannt.\r\n" + + "\r\n" + + "Viel häufiger als das Farbenhören ist jedoch das Sehen von farbigen Buchstaben, Wörtern oder Zahlen, unabhängig von der eigentlichen Schriftfarbe. \r\n" + + "\r\n" + + "Synästhesien müssen nicht notwendigerweise mit den 5 Hauptsinnen zu tun haben. Bei Gefühlssynästhetikern erzeugen beispielsweise Sinnesreize Gefühle, oder umgekehrt. Auch abstrakte Begriffe wie eine Jahreszahl oder der Charakter einer Person können bei einem Synästhetiker als Form, als Farbe oder sonstige Sinnesqualität wahrgenommen werden.\r\n" + + "\r\n" + + "Synästhesien sind z. B.\r\n" + + "*individuell verschieden\r\n" + + "*nicht umkehrbar (z. B. ruft ein bestimmtes Grün eine Fünf hervor, aber nicht umgekehrt)\r\n" + + "*identitätsstiftend\r\n" + + "*für den Betroffenen "schon immer da gewesen", d. h., so lange dieser sich erinnern kann\r\n" + + "*unwillkürlich, d. h., ohne Willensanstrengung des Betroffenen\r\n" + + "*ohne Einfluss von Alkohol, Drogen oder Medikamenten entstanden\r\n" + + "*nicht an eine bestimmte Situation, Erinnerung oder einen Eindruck gebunden\r\n" + + "\r\n" + + "Alkohol verstärkt Synästhesien, Amphetamine verringern sie.\r\n" + + "\r\n" + + "\r\n" + + "Über die Häufigkeit synästhetischer Wahrnehmung gibt es widersprüchliche Angaben. In der Fachliteratur wird eine Häufigkeit zwischen 1:2000 und 1:500 bei Erwachsenen genannt. 95% der Betroffenen sind Frauen. Viele Synästhetiker sind sich der Besonderheit ihrer Wahrnehmung selbst nicht bewusst und werden erst durch Medienberichte darauf aufmerksam.\r\n" + + "\r\n" + + "<!-- auskommentiert wegen siehe Diskussion\r\n" + + "Synästhesie tritt teilweise auch zusammen mit anderen Eigenschaften, wie beispielsweise starke Empfindsamkeit, ein überdurchschnittliches Gedächtnis und Linkshändigkeit auf.\r\n" + + "-->\r\n" + + "\r\n" + + "Synästhesie ist im deutschsprachigen Raum derzeit ein populärer Forschungsgegenstand, da sie Rückschlüsse auf die Funktionsweise der menschlichen Wahrnehmung zulässt. Auch das Medienecho hat in den letzten Jahren stark zugenommen.\r\n" + + "\r\n" + + "== Siehe auch ==\r\n" + + "* [[Synästhetiker]]\r\n" + + "* [[Musikpsychologie]]\r\n" + + "* [[Geruchsorgel]]\r\n" + + "\r\n" + + "== Weblinks ==\r\n" + + "* [http://www.mhh-synaesthesie.de/synaesthesie.htm Synästhesieforschung an der medizinischen Hochschule in Hannover]\r\n" + + "* [http://www.ch-forschung.ch/alt/fs/0110/S1-1_synest.rtf Synästhesieforschung am neuropsychologischen Institut des Unispitals Zürich]\r\n" + + "* [http://www.synaesthesieforum.de Deutschsprachiges Forum von und für Synästhetiker mit ausführlicher Linksammlung zum Thema]\r\n" + + "\r\n" + "[[Kategorie:Rhetorischer Begriff]]\r\n" + + "[[en:Synaesthesia]] [[es:Sinestesia]] [[sv:Synestesi]] [[tr:Sinestezi]]\r\n" + " \r\n" + + " \r\n" + ""; + StringReader st = new StringReader(test2); + + readFromStream(st); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/PostJob.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/PostJob.java new file mode 100644 index 0000000..5767954 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/PostJob.java @@ -0,0 +1,197 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.post; + +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.util.Date; +import java.util.HashMap; + +import net.sourceforge.phpeclipse.wiki.actions.ProblemConsole; +import net.sourceforge.phpeclipse.wiki.actions.mediawiki.config.IWikipedia; +import net.sourceforge.phpeclipse.wiki.actions.mediawiki.connect.Content; +import net.sourceforge.phpeclipse.wiki.actions.mediawiki.connect.MediaWikiConnector; +import net.sourceforge.phpeclipse.wiki.actions.mediawiki.exceptions.MethodException; +import net.sourceforge.phpeclipse.wiki.actions.mediawiki.exceptions.UnexpectedAnswerException; +import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin; +import net.sourceforge.phpeclipse.wiki.internal.Configuration; +import net.sourceforge.phpeclipse.wiki.preferences.Util; +import net.sourceforge.phpeclipse.wiki.velocity.EditorText; + +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.Velocity; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.WorkspaceJob; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.ui.progress.IProgressConstants; + +public class PostJob extends WorkspaceJob { + IFile[] files; + + IWikipedia wikipedia; + + Configuration configuration; + + String user; + + String password; + + public PostJob(Configuration configuration, IWikipedia wikipedia, String user, String password, IFile[] files) { + super("Refresh Job"); + this.files = files; + this.wikipedia = wikipedia; + this.user = user; + this.password = password; + this.configuration = configuration; + } + + public String generateUrl(String template, String wikiname) { + EditorText text = new EditorText(null); + /* first, we init the runtime engine. Defaults are fine. */ + + try { + Velocity.init(); + + /* lets make a Context and put data into it */ + + VelocityContext context = new VelocityContext(); + + context.put("config", configuration); + text.clear(); + text.setWikiname(wikiname); + context.put("text", text); + + /* lets make our own string to render */ + StringWriter w = new StringWriter(); + w = new StringWriter(); + Velocity.evaluate(context, w, "mystring", template); + return w.toString(); + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return template; + } + + private void selectWiki(String body, MediaWikiConnector connector, String actionUrl, String wikiName) { + + try { + String url = generateUrl(configuration.getURL(), wikiName); + + Date d = new Date(); + Content content = new Content(String.valueOf(d.getTime()), body); + + connector.store(wikipedia, actionUrl, wikiName, content, "", false, false); + + } catch (Exception e) { + e.printStackTrace(); + WikiEditorPlugin.getDefault() + .reportError("Exception occured: ", e.getMessage() + "\nSee stacktrace in /.metadata/.log file."); + } + } + + public IStatus runInWorkspace(IProgressMonitor monitor) { + boolean success = false; + MediaWikiConnector connector = null; + InputStream is = null; + ProblemConsole console = new ProblemConsole(); + String actionUrl = configuration.getURL(); + if (actionUrl == null || actionUrl.equals("")) { + // fall back to default settings + actionUrl = wikipedia.getActionUrl(); + } + try { + monitor.beginTask("Refresh Wikis", 100); + int partWork = 100 / files.length; + int work = 0; + int autoCreateIndex = -1; + StringBuffer buffer = new StringBuffer(); + HashMap map = new HashMap(); + String wikiTitle; + IFile file = null; + + connector = new MediaWikiConnector(); + success = connector.login(wikipedia, actionUrl, user, password, false); + if (success) { + for (int i = 0; i < files.length; i++) { + try { + file = files[i]; + is = file.getContents(); + String wikiName = Util.getFileWikiName(file); + String body = StoreWikipediaAction.getInputStreamAsString(is, wikipedia.getCharSet()); + autoCreateIndex = body.indexOf(WikiEditorPlugin.AUTOMATICALLY_CREATED); + if (autoCreateIndex < 0) { + selectWiki(body, connector, actionUrl, wikiName); + } else { + console.println("File: " + file.getLocation().toString() + "\n==>no upload allowed; Wiki text contains string: " + + WikiEditorPlugin.AUTOMATICALLY_CREATED); + } + + } catch (CoreException e1) { + if (file != null) { + console.println("File: " + file.getLocation().toString() + "\n==>CoreException: " + + e1.getMessage()); + } + } + if (monitor.isCanceled()) { + return Status.CANCEL_STATUS; + } + work += partWork; + monitor.worked(work); + } + } + + if (isModal(this)) { + // The progress dialog is still open show the message + console.reportError(); + } else { + setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE); + // setProperty(IProgressConstants.ACTION_PROPERTY, getWikisCompletedAction()); + } + return Status.OK_STATUS; + // } catch(CoreException e) { + // return e.getStatus(); + } catch (IOException e) { + console.println("==>IOException: " + e.getMessage()); + } catch (UnexpectedAnswerException e) { + console.println("==>UnexpectedAnswerException: " + e.getMessage()); + } catch (MethodException e) { + console.println("==>HTTP-MethodException: " + e.getMessage()); + } finally { + monitor.done(); + if (success && connector != null) { + try { + connector.logout(wikipedia, actionUrl); + } catch (UnexpectedAnswerException e1) { + console.println("==>UnexpectedAnswerException: " + e1.getMessage()); + } catch (MethodException e1) { + console.println("==>HTTP-MethodException: " + e1.getMessage()); + } + } + if (is != null) { + try { + is.close(); + } catch (IOException e1) { + } + } + } + if (isModal(this)) { + // The progress dialog is still open show the message + console.reportError(); + } + return Status.CANCEL_STATUS; + } + + public boolean isModal(Job job) { + Boolean isModal = (Boolean) job.getProperty(IProgressConstants.PROPERTY_IN_DIALOG); + if (isModal == null) { + return false; + } + return isModal.booleanValue(); + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/PostPlog4UDEFilesAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/PostPlog4UDEFilesAction.java new file mode 100644 index 0000000..f3bfc01 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/PostPlog4UDEFilesAction.java @@ -0,0 +1,26 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.post; + +import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin; +import net.sourceforge.phpeclipse.wiki.internal.Configuration; +import net.sourceforge.phpeclipse.wiki.internal.ConfigurationWorkingCopy; + +public class PostPlog4UDEFilesAction extends PostWikiFilesAction { + + protected Configuration getConfiguration() { + ConfigurationWorkingCopy configuration = new ConfigurationWorkingCopy(super + .getConfigurationPrefix(WikiEditorPlugin.PLOG4U_DE_STORE)); + configuration.setName("www.Plog4U.de Upload"); + configuration.setURL("http://www.plog4u.de/index.php"); + configuration.setType(WikiEditorPlugin.PLOG4U_DE_STORE); + + return configuration; + } + + /** + * + */ + public PostPlog4UDEFilesAction() { + super(); + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/PostPlog4UORGFilesAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/PostPlog4UORGFilesAction.java new file mode 100644 index 0000000..3fd0a29 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/PostPlog4UORGFilesAction.java @@ -0,0 +1,25 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.post; + +import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin; +import net.sourceforge.phpeclipse.wiki.internal.Configuration; +import net.sourceforge.phpeclipse.wiki.internal.ConfigurationWorkingCopy; + +public class PostPlog4UORGFilesAction extends PostWikiFilesAction { + + protected Configuration getConfiguration() { + ConfigurationWorkingCopy configuration = new ConfigurationWorkingCopy(super + .getConfigurationPrefix(WikiEditorPlugin.PLOG4U_ORG_STORE)); + configuration.setName("www.Plog4U.org Upload"); + configuration.setURL("http://www.plog4u.org/index.php"); + configuration.setType(WikiEditorPlugin.PLOG4U_ORG_STORE); + return configuration; + } + + /** + * + */ + public PostPlog4UORGFilesAction() { + super(); + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/PostWikiFilesAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/PostWikiFilesAction.java new file mode 100644 index 0000000..e607b18 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/PostWikiFilesAction.java @@ -0,0 +1,180 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.post; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; + +import net.sourceforge.phpeclipse.wiki.actions.mediawiki.config.IWikipedia; +import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin; +import net.sourceforge.phpeclipse.wiki.internal.Configuration; +import net.sourceforge.phpeclipse.wiki.internal.ConfigurationManager; +import net.sourceforge.phpeclipse.wiki.internal.IConfiguration; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceRuleFactory; +import org.eclipse.core.resources.IResourceVisitor; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.jobs.ISchedulingRule; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.core.runtime.jobs.MultiRule; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.window.Window; +import org.eclipse.ui.IActionDelegate; +import org.eclipse.ui.IObjectActionDelegate; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.dialogs.ListSelectionDialog; +import org.eclipse.ui.internal.dialogs.ListContentProvider; + +public class PostWikiFilesAction implements IObjectActionDelegate { + private IWorkbenchPart workbenchPart; + + protected Configuration getConfigurationPrefix(String prefix) { + List allConfigsList = ConfigurationManager.getInstance().getConfigurations(); + ArrayList configsList = new ArrayList(); + for (int i = 0; i < allConfigsList.size(); i++) { + IConfiguration temp = (IConfiguration) allConfigsList.get(i); + if (temp.getType().startsWith(prefix)) { + configsList.add(temp); + } + } + if (configsList.size() == 1) { + return (Configuration) configsList.get(0); + } + Collections.sort(configsList); + Configuration configuration = null; + ListSelectionDialog listSelectionDialog = new ListSelectionDialog(WikiEditorPlugin.getDefault().getWorkbench() + .getActiveWorkbenchWindow().getShell(), configsList, new ListContentProvider(), new LabelProvider(), + "Select the refresh URL."); + listSelectionDialog.setTitle("Multiple active configuration found"); + if (listSelectionDialog.open() == Window.OK) { + Object[] locations = listSelectionDialog.getResult(); + if (locations != null) { + for (int i = 0; i < locations.length; i++) { + configuration = (Configuration) locations[i]; + break; + } + } + } + return configuration; + } + + protected Configuration getConfiguration() { + return getConfigurationPrefix(WikiEditorPlugin.PREFIX_STORE); + } + + /** + * + */ + public PostWikiFilesAction() { + super(); + } + + /** + * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart) + */ + public void setActivePart(IAction action, IWorkbenchPart targetPart) { + workbenchPart = targetPart; + } + + public void run(IAction action) { + final HashSet set = new HashSet(); + IResourceVisitor visitor = new IResourceVisitor() { + public boolean visit(IResource resource) { + switch (resource.getType()) { + case IResource.FILE: + if (resource.getFileExtension().equalsIgnoreCase(WikiEditorPlugin.WP_EXTENSION)) { + set.add(resource); + } + break; + } + return true; + } + }; + try { + ISelectionProvider selectionProvider = null; + selectionProvider = workbenchPart.getSite().getSelectionProvider(); + + StructuredSelection selection = null; + selection = (StructuredSelection) selectionProvider.getSelection(); + + //Shell shell = null; + Iterator iterator = null; + iterator = selection.iterator(); + Configuration configuration = getConfiguration(); + String wikiLocale = configuration.getType().substring(WikiEditorPlugin.PREFIX_STORE.length()); + IWikipedia wikipediaProperties = WikiEditorPlugin.getWikiInstance(wikiLocale); +// ArrayList list = new ArrayList(); + while (iterator.hasNext()) { + // obj => selected object in the view + Object obj = iterator.next(); + // is it a resource + if (obj instanceof IResource) { + IResource resource = (IResource) obj; + // check if it's a file resource + switch (resource.getType()) { + case IResource.FOLDER: + case IResource.FILE: + resource.accept(visitor); + break; + } + } + } + if (set.size() > 0) { + IFile[] files = new IFile[set.size()]; + set.toArray(files); + + for (int i = 0; i < files.length; i++) { + System.out.println(files[i].getLocation().toString()); + } + + Job job = new PostJob(configuration, wikipediaProperties, configuration.getUser(), configuration.getPassword(), files); + // job.setRule(modifyRule(files)); + job.setRule(null); + job.setUser(true); + job.schedule(); + } + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (NoSuchMethodException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public ISchedulingRule modifyRule(IFile[] files) { + ISchedulingRule combinedRule = null; + IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory(); + ISchedulingRule rule; + for (int i = 0; i < files.length; i++) { + rule = ruleFactory.modifyRule(files[i]); + combinedRule = MultiRule.combine(rule, combinedRule); + } + return combinedRule; + } + + /** + * @see IActionDelegate#selectionChanged(IAction, ISelection) + */ + public void selectionChanged(IAction action, ISelection selection) { + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/StorePlog4UDEAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/StorePlog4UDEAction.java new file mode 100644 index 0000000..13939ee --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/StorePlog4UDEAction.java @@ -0,0 +1,18 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.post; + +import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin; +import net.sourceforge.phpeclipse.wiki.internal.Configuration; +import net.sourceforge.phpeclipse.wiki.internal.ConfigurationWorkingCopy; + +public class StorePlog4UDEAction extends StoreWikipediaAction { + + protected Configuration getConfiguration() { + ConfigurationWorkingCopy configuration = new ConfigurationWorkingCopy(super.getConfigurationPrefix(WikiEditorPlugin.PLOG4U_DE_STORE)); + configuration.setName("www.Plog4U.de Upload"); + configuration.setURL("http://www.plog4u.de/index.php"); + configuration.setType(WikiEditorPlugin.PLOG4U_DE_STORE); + + return configuration; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/StorePlog4UORGAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/StorePlog4UORGAction.java new file mode 100644 index 0000000..9b8ccb2 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/StorePlog4UORGAction.java @@ -0,0 +1,20 @@ +package net.sourceforge.phpeclipse.wiki.actions.mediawiki.post; + +import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin; +import net.sourceforge.phpeclipse.wiki.internal.Configuration; +import net.sourceforge.phpeclipse.wiki.internal.ConfigurationWorkingCopy; + +public class StorePlog4UORGAction extends StoreWikipediaAction { + /* (non-Javadoc) + * @see net.sourceforge.phpeclipse.wiki.actions.mediawiki.post.StoreWikipediaAction#getConfiguration() + */ + protected Configuration getConfiguration() { + ConfigurationWorkingCopy configuration = new ConfigurationWorkingCopy(super.getConfigurationPrefix(WikiEditorPlugin.PLOG4U_ORG_STORE)); + configuration.setName("www.Plog4U.org Upload"); + configuration.setURL("http://www.plog4u.org/index.php"); + configuration.setType(WikiEditorPlugin.PLOG4U_ORG_STORE); + return configuration; + } + + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/StoreWikipediaAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/StoreWikipediaAction.java index b796b80..d54b064 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/StoreWikipediaAction.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/post/StoreWikipediaAction.java @@ -6,15 +6,17 @@ package net.sourceforge.phpeclipse.wiki.actions.mediawiki.post; //The modified sources are available under the "Common Public License" //with permission from the original author: Daniel Wunsch +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.StringWriter; -import java.lang.reflect.Method; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; import net.sourceforge.phpeclipse.wiki.actions.mediawiki.config.IWikipedia; -import net.sourceforge.phpeclipse.wiki.actions.mediawiki.config.WikipediaDE; import net.sourceforge.phpeclipse.wiki.actions.mediawiki.connect.Content; import net.sourceforge.phpeclipse.wiki.actions.mediawiki.connect.MediaWikiConnector; import net.sourceforge.phpeclipse.wiki.editor.WikiEditor; @@ -28,6 +30,7 @@ import net.sourceforge.phpeclipse.wiki.velocity.EditorText; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.Velocity; import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.action.IAction; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextSelection; @@ -45,6 +48,13 @@ import org.eclipse.ui.texteditor.AbstractTextEditor; public class StoreWikipediaAction implements IEditorActionDelegate { + /** + * Constant for an empty char array + */ + public static final char[] NO_CHAR = new char[0]; + + private static final int DEFAULT_READING_SIZE = 8192; + private AbstractTextEditor fEditor; private EditorText text; @@ -83,15 +93,19 @@ public class StoreWikipediaAction implements IEditorActionDelegate { return template; } - protected Configuration getConfiguration() { + protected Configuration getConfigurationPrefix(String prefix) { + List allConfigsList = ConfigurationManager.getInstance().getConfigurations(); ArrayList configsList = new ArrayList(); for (int i = 0; i < allConfigsList.size(); i++) { IConfiguration temp = (IConfiguration) allConfigsList.get(i); - if (temp.getType().startsWith(WikiEditorPlugin.PREFIX_STORE)) { + if (temp.getType().startsWith(prefix)) { configsList.add(temp); } } + if (configsList.size() == 1) { + return (Configuration) configsList.get(0); + } Collections.sort(configsList); Configuration configuration = null; ListSelectionDialog listSelectionDialog = new ListSelectionDialog(WikiEditorPlugin.getDefault().getWorkbench() @@ -110,37 +124,33 @@ public class StoreWikipediaAction implements IEditorActionDelegate { return configuration; } + protected Configuration getConfiguration() { + return getConfigurationPrefix(WikiEditorPlugin.PREFIX_STORE); + } + public IDocument getDocument() { IDocument doc = fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput()); return doc; } private String getWikiFile(IFile file) { - return Util.getFileWikiName(file, WikiEditorPlugin.HTML_OUTPUT_PATH); + return Util.getFileWikiName(file); } public void init(IWorkbenchWindow window) { this.window = window; } - void openWikiFile(IFile cfile) { - String wikiName = getWikiFile(cfile); - try { - if (fEditor != null) { - selectWiki(wikiName); - } - } catch (Exception e) { - } - - } - - public void openWikiLinkOnSelection() { - IDocument doc = getDocument(); - ITextSelection selection = (ITextSelection) fEditor.getSelectionProvider().getSelection(); - int pos = selection.getOffset(); - IFileEditorInput ei = (IFileEditorInput) fEditor.getEditorInput(); - openWikiFile(ei.getFile()); - } +// void postWikiFile(IFile currentFile) { +// String wikiName = getWikiFile(currentFile); +// try { +// if (fEditor != null) { +// selectWiki(currentFile.getContents(), wikiName); +// } +// } catch (Exception e) { +// } +// +// } public void run(IAction action) { if (fEditor == null) { @@ -150,7 +160,59 @@ public class StoreWikipediaAction implements IEditorActionDelegate { } } if (fEditor != null) { - openWikiLinkOnSelection(); + Configuration configuration = getConfiguration(); + if (configuration != null && !configuration.equals("")) { + try { + String wikiLocale = configuration.getType().substring(WikiEditorPlugin.PREFIX_STORE.length()); + IWikipedia wikipediaProperties = WikiEditorPlugin.getWikiInstance(wikiLocale); + String user = configuration.getUser(); + String password = configuration.getPassword(); + if (user == null || password == null || user.equals("") || password.equals("")) { + String[] result = new String[2]; + boolean cache = configuration.promptForPassword(configuration.getUser(), "Set User/Password", true, result); + if (result[0] == null || result[1] == null) { + return; + } + if (result[0].equals("") || result[1].equals("")) { + return; + } + user = result[0]; + password = result[1]; + } +// IDocument doc = getDocument(); +// ITextSelection selection = (ITextSelection) fEditor.getSelectionProvider().getSelection(); +// int pos = selection.getOffset(); + if (fEditor.getEditorInput() instanceof IFileEditorInput) { + IFileEditorInput ei = (IFileEditorInput) fEditor.getEditorInput(); + IFile currentFile = ei.getFile(); + IFile[] files = { currentFile }; + PostJob job = new PostJob(configuration, wikipediaProperties, user, password, files); + job.setRule(null); + job.setUser(true); + job.schedule(); + + String wikiName = getWikiFile(currentFile); + if (fEditor != null) { + selectWiki(configuration, currentFile.getContents(), wikipediaProperties, user, password, wikiName); + } + } + } catch (CoreException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (NoSuchMethodException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } } } @@ -167,34 +229,31 @@ public class StoreWikipediaAction implements IEditorActionDelegate { } } - private void selectWiki(String wikiName) { - Configuration configuration = getConfiguration(); - if (configuration != null && !configuration.equals("")) { - try { - IDocument doc = fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput()); - String url = generateUrl(configuration, configuration.getURL(), wikiName); - String wikiLocale = configuration.getType().substring(WikiEditorPlugin.PREFIX_STORE.length()); - IWikipedia wikipediaProperties = WikiEditorPlugin.getWikiInstance(wikiLocale); - - MediaWikiConnector connector = new MediaWikiConnector(); - String actionUrl = configuration.getURL(); - if (actionUrl == null || actionUrl.equals("")) { - // fall back to default settings - actionUrl = wikipediaProperties.getActionUrl(); - } - Date d = new Date(); + private void selectWiki(Configuration configuration, InputStream is, IWikipedia wikipediaProperties, String user, String password, String wikiName) { - Content content = new Content(String.valueOf(d.getTime()), doc.get()); - boolean success = connector.login(wikipediaProperties, actionUrl, configuration.getUser(), configuration.getPassword(), false); - if (success) { - connector.store(wikipediaProperties, actionUrl, wikiName, content, "", false, false); - connector.logout(wikipediaProperties, actionUrl); - } - } catch (Exception e) { - e.printStackTrace(); - WikiEditorPlugin.getDefault() - .reportError("Exception occured: ", e.getMessage() + "\nSee stacktrace in /.metadata/.log file."); + try { + // IDocument doc = fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput()); + String url = generateUrl(configuration, configuration.getURL(), wikiName); + + MediaWikiConnector connector = new MediaWikiConnector(); + String actionUrl = configuration.getURL(); + if (actionUrl == null || actionUrl.equals("")) { + // fall back to default settings + actionUrl = wikipediaProperties.getActionUrl(); + } + Date d = new Date(); + + Content content = new Content(String.valueOf(d.getTime()), getInputStreamAsString(is, wikipediaProperties.getCharSet())); + + boolean success = connector.login(wikipediaProperties, actionUrl, user, password, false); + if (success) { + connector.store(wikipediaProperties, actionUrl, wikiName, content, "", false, false); + connector.logout(wikipediaProperties, actionUrl); } + } catch (Exception e) { + e.printStackTrace(); + WikiEditorPlugin.getDefault() + .reportError("Exception occured: ", e.getMessage() + "\nSee stacktrace in /.metadata/.log file."); } } @@ -204,4 +263,75 @@ public class StoreWikipediaAction implements IEditorActionDelegate { text = new EditorText(targetEditor); } } + + /** + * Returns the given input stream's contents as a character array. If a length is specified (ie. if length != -1), only length + * chars are returned. Otherwise all chars in the stream are returned. Note this doesn't close the stream. + * + * @throws IOException + * if a problem occured reading the stream. + */ + public static String getInputStreamAsString(InputStream stream, String encoding) throws IOException { + char[] array = getInputStreamAsCharArray(stream, -1, encoding); + if (array != null) { + return new String(array); + } + return null; + } + + /** + * Returns the given input stream's contents as a character array. If a length is specified (ie. if length != -1), only length + * chars are returned. Otherwise all chars in the stream are returned. Note this doesn't close the stream. + * + * @throws IOException + * if a problem occured reading the stream. + */ + public static char[] getInputStreamAsCharArray(InputStream stream, int length, String encoding) throws IOException { + InputStreamReader reader = null; + reader = encoding == null ? new InputStreamReader(stream) : new InputStreamReader(stream, encoding); + char[] contents; + if (length == -1) { + contents = NO_CHAR; + int contentsLength = 0; + int amountRead = -1; + do { + int amountRequested = Math.max(stream.available(), DEFAULT_READING_SIZE); // read at least 8K + + // resize contents if needed + if (contentsLength + amountRequested > contents.length) { + System.arraycopy(contents, 0, contents = new char[contentsLength + amountRequested], 0, contentsLength); + } + + // read as many chars as possible + amountRead = reader.read(contents, contentsLength, amountRequested); + + if (amountRead > 0) { + // remember length of contents + contentsLength += amountRead; + } + } while (amountRead != -1); + + // resize contents if necessary + if (contentsLength < contents.length) { + System.arraycopy(contents, 0, contents = new char[contentsLength], 0, contentsLength); + } + } else { + contents = new char[length]; + int len = 0; + int readSize = 0; + while ((readSize != -1) && (len != length)) { + // See PR 1FMS89U + // We record first the read size. In this case len is the actual read size. + len += readSize; + readSize = reader.read(contents, len, length - len); + } + // See PR 1FMS89U + // Now we need to resize in case the default encoding used more than one byte for each + // character + if (len != length) + System.arraycopy(contents, 0, (contents = new char[len]), 0, len); + } + + return contents; + } } \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/builder/AddBuilderAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/builder/AddBuilderAction.java index 7a3b3f2..1ebbf1b 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/builder/AddBuilderAction.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/builder/AddBuilderAction.java @@ -1,15 +1,12 @@ package net.sourceforge.phpeclipse.wiki.builder; -import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.Iterator; import net.sourceforge.phpeclipse.wiki.preferences.Util; import org.eclipse.core.resources.ICommand; -import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IResource; @@ -74,7 +71,7 @@ public class AddBuilderAction implements IObjectActionDelegate { public void selectionChanged(IAction action, ISelection selection) { } - private void addBuilder(IProject project) { + public static void addBuilder(IProject project) { IProjectDescription desc; try { desc = project.getDescription(); @@ -111,7 +108,7 @@ public class AddBuilderAction implements IObjectActionDelegate { } } - private void createVelocityFile(IProject project, String filename) throws CoreException { + private static void createVelocityFile(IProject project, String filename) throws CoreException { InputStream is = AddBuilderAction.class.getResourceAsStream(filename); final IFile file = project.getFile(new Path("wpsrc/" + filename)); if (!file.exists()) { diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WikiEditorPlugin.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WikiEditorPlugin.java index 41afec5..eebe5e1 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WikiEditorPlugin.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WikiEditorPlugin.java @@ -18,6 +18,8 @@ import net.sourceforge.phpeclipse.wiki.internal.ConfigurationManager; import net.sourceforge.phpeclipse.wiki.internal.IConfigurationWorkingCopy; import net.sourceforge.phpeclipse.wiki.sql.WikipediaDB; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IExtension; import org.eclipse.core.runtime.IPluginDescriptor; @@ -43,6 +45,17 @@ public class WikiEditorPlugin extends AbstractUIPlugin { private static WikiEditorPlugin fgPlugin; + public final static String AUTOMATICALLY_CREATED = ""; + + public final static String WP_EXTENSION = "wp"; + public final static String XML_START_1 = "\n" + + "\n"; + public final static String XML_END ="\n"; + public static final String PREFIX_LOAD = "Load "; + + public static final String PREFIX_STORE = "Store "; + public static final String HTTP_QUERY = "HTTP Query"; // public static final String WIKIPEDIA_GET_TEXT = "Load WikipediaEN"; @@ -54,7 +67,23 @@ public class WikiEditorPlugin extends AbstractUIPlugin { public static final String BLOG_A_HTML = "Blog as HTML Text"; - public static final String[] PREDEFINED_TYPES = { HTTP_QUERY, WIKIPEDIA_SQL, BLOG_A_WIKI, BLOG_A_HTML }; + public static final String PLOG4U_DE_LOAD = PREFIX_LOAD + "Plog4UDE"; + + public static final String PLOG4U_DE_STORE = PREFIX_STORE + "Plog4UDE"; + + public static final String PLOG4U_ORG_LOAD = PREFIX_LOAD + "Plog4UORG"; + + public static final String PLOG4U_ORG_STORE = PREFIX_STORE + "Plog4UORG"; + + public static final String[] PREDEFINED_TYPES = { + HTTP_QUERY, + WIKIPEDIA_SQL, + PLOG4U_DE_LOAD, + PLOG4U_DE_STORE, + PLOG4U_ORG_LOAD, + PLOG4U_ORG_STORE, + BLOG_A_WIKI, + BLOG_A_HTML }; public static final String[] PREDEFINED_WIKIS = { "WikibooksDE", @@ -69,11 +98,18 @@ public class WikiEditorPlugin extends AbstractUIPlugin { "WikipediaES", "WikipediaET", "WikipediaFI", - "WikipediaFR" }; - - public static final String PREFIX_LOAD = "Load "; - - public static final String PREFIX_STORE = "Store "; + "WikipediaFR", + "WikipediaHE", + "WikipediaIA", + "WikipediaIT", + "WikipediaJA", + "WikipediaNL", + "WikipediaPL", + "WikipediaPT", + "WikipediaRO", + "WikipediaSL", + "WikipediaSV", + "WikipediaZH" }; public static final ArrayList CONFIGURATION_TYPES = new ArrayList(); @@ -94,17 +130,25 @@ public class WikiEditorPlugin extends AbstractUIPlugin { public final static String EXPORT_CSS_URL = "__export_css_url"; - public final static String PREF_STRING_CONFIGURATIONS = "__configurations2"; + public final static String PREF_STRING_CONFIGURATIONS = "__configurations3"; - public final static String CONFIG_MEMENTO = "" - + "" + public final static String CONFIG_MEMENTO = "" + "" + "" + "" + "" - + "" - + "" - + "" - + "" + + + "" + "" + + "" + + "" + + + "" + "" + + "" + "" + "" + ""; @@ -466,6 +510,13 @@ public class WikiEditorPlugin extends AbstractUIPlugin { return (IWikipedia) method.invoke(null, new Object[0]); } + /** + * Returns the workspace instance. + */ + public static IWorkspace getWorkspace() { + return ResourcesPlugin.getWorkspace(); + } + // test code // public static void main(String[] args) { // try { diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/internal/Configuration.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/internal/Configuration.java index 1cadc30..c961a81 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/internal/Configuration.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/internal/Configuration.java @@ -4,7 +4,7 @@ * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html -  * + �* * Contributors: * IBM - Initial API and implementation **********************************************************************/ @@ -220,8 +220,10 @@ public class Configuration implements IConfiguration, Comparable { return true; } /** - * Asks the User to enter a Password. Places the results in the supplied string[]. result[0] must contain the username, result[1] - * must contain the fPassword. If the fUser canceled, both values must be zero. + * Asks the user to enter a password. Places the results in the supplied string[]. + * result[0] must contain the username, + * result[1] must contain the fPassword. + * If the user canceled, both values must be zero. * * @param location * the location to obtain the fPassword for @@ -236,10 +238,12 @@ public class Configuration implements IConfiguration, Comparable { */ public boolean promptForPassword(final String username, final String message, final boolean userMutable, final String[] result) { if (isUserComplete()) { - result[0] = fUser; + result[0] = fUser; result[1] = fPassword; return true; } + result[0] = null; + result[1] = null; Shell shell = Util.findShell(); if (shell == null) { return false; diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/preferences/Util.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/preferences/Util.java index 417165e..9508175 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/preferences/Util.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/preferences/Util.java @@ -10,6 +10,7 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.QualifiedName; @@ -24,12 +25,15 @@ public class Util { public static String titleToDB(String in) { return in.replaceAll(" ", "_"); } + public static String db2Title(String in) { return in.replaceAll("_", " "); } + public static String db2TitleLink(String in) { - return "[["+in.replaceAll("_", " ")+"]]"; + return "[[" + in.replaceAll("_", " ") + "]]"; } + public static Shell findShell() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { @@ -58,6 +62,12 @@ public class Util { } public static String getHTMLFileName(IFile file, String binBasePath, String srcBasePath) { + return getHTMLFileName(file,binBasePath,srcBasePath, ".html"); + } + public static String getXMLFileName(IFile file, String binBasePath, String srcBasePath) { + return getHTMLFileName(file,binBasePath,srcBasePath, ".xml"); + } + public static String getHTMLFileName(IFile file, String binBasePath, String srcBasePath, String fileExtension) { StringBuffer htmlBuffer = new StringBuffer(); String htmlName = null; // String srcBasePath = Util.getWikiTextsPath(file); @@ -70,7 +80,7 @@ public class Util { } int index = fileName.lastIndexOf(".wp"); if (index >= 0) { - htmlName = binBasePath + fileName.substring(0, index) + ".html"; + htmlName = binBasePath + fileName.substring(0, index) + fileExtension; } else { htmlName = binBasePath + fileName; } @@ -127,12 +137,12 @@ public class Util { store.setValue(WikiEditorPlugin.WIKI_TEXTS_BASE_PATH, value + "/wpsrc"); store.setValue(WikiEditorPlugin.LOCAL_TEMPLATE_FILE_NAME, value + "/wpsrc/main.vm"); store.setValue(WikiEditorPlugin.EXPORT_TEMPLATE_FILE_NAME, value + "/wpsrc/export.vm"); - store.setValue(WikiEditorPlugin.LOCAL_CSS_URL, "file://"+value+"/wpsrc/main.css"); - store.setValue(WikiEditorPlugin.EXPORT_CSS_URL, "file://"+value+"/wpsrc/main.css"); + store.setValue(WikiEditorPlugin.LOCAL_CSS_URL, "file://" + value + "/wpsrc/main.css"); + store.setValue(WikiEditorPlugin.EXPORT_CSS_URL, "file://" + value + "/wpsrc/main.css"); } String htmlFolder = store.getString(WikiEditorPlugin.HTML_OUTPUT_PATH); - if (htmlFolder == null || htmlFolder.equals("")) { - // set a global default + if (htmlFolder == null || htmlFolder.equals("")) { + // set a global default store.setValue(WikiEditorPlugin.HTML_OUTPUT_PATH, value + "/wpbin"); } setProperty(project, WikiProjectPreferences.PREF_ID, FieldEditorOverlayPage.USEPROJECTSETTINGS, "true"); @@ -140,8 +150,8 @@ public class Util { setProperty(project, WikiProjectPreferences.PREF_ID, WikiEditorPlugin.HTML_OUTPUT_PATH, value + "/wpbin"); setProperty(project, WikiProjectPreferences.PREF_ID, WikiEditorPlugin.LOCAL_TEMPLATE_FILE_NAME, value + "/wpsrc/main.vm"); setProperty(project, WikiProjectPreferences.PREF_ID, WikiEditorPlugin.EXPORT_TEMPLATE_FILE_NAME, value + "/wpsrc/export.vm"); - setProperty(project, WikiProjectPreferences.PREF_ID, WikiEditorPlugin.LOCAL_CSS_URL, "file://"+value+"/wpsrc/main.css"); - setProperty(project, WikiProjectPreferences.PREF_ID, WikiEditorPlugin.EXPORT_CSS_URL, "file://"+value+"/wpsrc/main.css"); + setProperty(project, WikiProjectPreferences.PREF_ID, WikiEditorPlugin.LOCAL_CSS_URL, "file://" + value + "/wpsrc/main.css"); + setProperty(project, WikiProjectPreferences.PREF_ID, WikiEditorPlugin.EXPORT_CSS_URL, "file://" + value + "/wpsrc/main.css"); // IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); // IResource resource = root.findMember(project.getLocation()); NullProgressMonitor _monitor = new NullProgressMonitor(); @@ -172,28 +182,49 @@ public class Util { public static String getLocalTemplate(IResource file) { return Util.getPreferenceValue(file.getProject(), WikiEditorPlugin.LOCAL_TEMPLATE_FILE_NAME); } + public static String getLocalCssUrl(IResource file) { return Util.getPreferenceValue(file.getProject(), WikiEditorPlugin.LOCAL_CSS_URL); } + public static String getExportTemplate(IResource file) { return Util.getPreferenceValue(file.getProject(), WikiEditorPlugin.EXPORT_TEMPLATE_FILE_NAME); } + public static String getExportCssUrl(IResource file) { return Util.getPreferenceValue(file.getProject(), WikiEditorPlugin.EXPORT_CSS_URL); } + public static String getProjectsWikiTextsPath(IProject project) { return Util.getPreferenceValue(project, WikiEditorPlugin.WIKI_TEXTS_BASE_PATH); } - + public static String getWikiFileName(String wikiLink, IFile currentFile, String key) { // String basePath = currentFile.getProject().getLocation().toString(); String basePath = getWikiTextsPath(currentFile); return basePath + "/" + FilterUtil.normalizeWikiLink(wikiLink) + ".wp"; } - public static String getFileWikiName(IFile currentFile, String key) { + /** + * Extract the wiki name from the current filename, replaces '/' with ':' characters, but doesn't replace '_' characters + * + * @param currentFile + * @return + */ + public static String getFileWikiName(IFile currentFile) { + return getFileWikiName(currentFile, false); + } + + /** + * Extract the wiki name from the current filename, replaces '/' with ':' characters, and '_' with ' ' characters if + * replaceUnderscore==true + * + * @param currentFile + * @param replaceUnderscore + * @return + */ + public static String getFileWikiName(IFile currentFile, boolean replaceUnderscore) { String filePath = currentFile.getLocation().toString(); - // String basePath = currentFile.getProject().getLocation().toString(); String basePath = getWikiTextsPath(currentFile); StringBuffer result = new StringBuffer(); int lastIndex = filePath.lastIndexOf(".wp"); @@ -208,12 +239,26 @@ public class Util { result.append(':'); break; default: - result.append(ch); + if (ch == '_' && replaceUnderscore) { + result.append(' '); + } else { + result.append(ch); + } } } return result.toString(); } + /** + * Extract the wiki name from the current filename, replaces '/' with ':' characters, and replaces all '_' with ' ' characters + * + * @param currentFile + * @return + */ + public static String getReadableWikiName(IFile currentFile) { + return getFileWikiName(currentFile, true); + } + public static String getWikiTitle(IFile currentFile) { String fileName = currentFile.getName(); String fileExt = currentFile.getFileExtension().toLowerCase(); @@ -222,4 +267,30 @@ public class Util { } return null; } + + /** + * Create the folder resource in the workspace + * Recursive to create any folders which does not exist already + * + * @param folderHandle + * @param monitor + */ + public static void createFolder(IFolder folderHandle, IProgressMonitor monitor) { + try { + // Create the folder resource in the workspace + // Recursive to create any folders which does not exist already + if (!folderHandle.exists()) { + IContainer parent = folderHandle.getParent(); + if (parent instanceof IFolder && (!((IFolder) parent).exists())) { + createFolder((IFolder) parent, monitor); + } + // if (linkTargetPath != null) + // folderHandle.createLink(linkTargetPath, IResource.ALLOW_MISSING_LOCAL, monitor); + // else + folderHandle.create(false, true, monitor); + } + } catch (CoreException e) { + + } + } } \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/wizards/NewProjectCreationWizard.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/wizards/NewProjectCreationWizard.java new file mode 100644 index 0000000..6c38892 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/wizards/NewProjectCreationWizard.java @@ -0,0 +1,115 @@ +package net.sourceforge.phpeclipse.wiki.wizards; + +import java.lang.reflect.InvocationTargetException; + +import net.sourceforge.phpeclipse.wiki.builder.AddBuilderAction; +import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExecutableExtension; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation; +import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; +import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard; +import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard; + +public class NewProjectCreationWizard extends BasicNewResourceWizard implements INewWizard, IExecutableExtension { + protected WizardNewProjectCreationPage projectPage; + + protected IConfigurationElement configurationElement; + + protected IProject newProject; + + public NewProjectCreationWizard() { + setWindowTitle(WizardMessages.getString("NewProjectCreationWizard.windowTitle")); + } + + public boolean performFinish() { + IRunnableWithProgress projectCreationOperation = new WorkspaceModifyDelegatingOperation(getProjectCreationRunnable()); + + try { + getContainer().run(false, true, projectCreationOperation); + } catch (Exception e) { + WikiEditorPlugin.log(e); + return false; + } + + BasicNewProjectResourceWizard.updatePerspective(configurationElement); + selectAndReveal(newProject); + + return true; + } + + protected IRunnableWithProgress getProjectCreationRunnable() { + return new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + int remainingWorkUnits = 10; + monitor.beginTask(WizardMessages.getString("NewProjectCreationWizard.projectCreationMessage"), remainingWorkUnits); + + IWorkspace workspace = WikiEditorPlugin.getWorkspace(); + newProject = projectPage.getProjectHandle(); + + IProjectDescription description = workspace.newProjectDescription(newProject.getName()); + IPath path = Platform.getLocation(); + IPath customPath = projectPage.getLocationPath(); + if (!path.equals(customPath)) { + path = customPath; + description.setLocation(path); + } + + try { + if (!newProject.exists()) { + newProject.create(description, new SubProgressMonitor(monitor, 1)); + remainingWorkUnits--; + } + if (!newProject.isOpen()) { + newProject.open(new SubProgressMonitor(monitor, 1)); + remainingWorkUnits--; + } +// addWikipediaNature(newProject, new SubProgressMonitor(monitor, remainingWorkUnits)); + AddBuilderAction.addBuilder(newProject); + } + catch (CoreException e) { + throw new InvocationTargetException(e); + } finally { + monitor.done(); + } + } + }; + } + +// public static void addWikipediaNature(IProject project, IProgressMonitor monitor) throws CoreException { +// if (!project.hasNature(WikiEditorPlugin.NATURE_ID)) { +// IProjectDescription description = project.getDescription(); +// String[] prevNatures = description.getNatureIds(); +// String[] newNatures = new String[prevNatures.length + 1]; +// System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length); +// newNatures[prevNatures.length] = WikiEditorPlugin.NATURE_ID; +// description.setNatureIds(newNatures); +// project.setDescription(description, monitor); +// } +// } + + public void addPages() { + super.addPages(); + + projectPage = new WizardNewProjectCreationPage(WizardMessages.getString("WizardNewProjectCreationPage.pageName")); + projectPage.setTitle(WizardMessages.getString("WizardNewProjectCreationPage.pageTitle")); + projectPage.setDescription(WizardMessages.getString("WizardNewProjectCreationPage.pageDescription")); + + addPage(projectPage); + } + + public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { + configurationElement = config; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/wizards/WizardMessages.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/wizards/WizardMessages.java new file mode 100644 index 0000000..e35b2fd --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/wizards/WizardMessages.java @@ -0,0 +1,34 @@ +package net.sourceforge.phpeclipse.wiki.wizards; + +/********************************************************************** +Copyright (c) 2000, 2002 IBM Corp. and others. +All rights reserved. This program and the accompanying materials +are made available under the terms of the Common Public License v1.0 +which accompanies this distribution, and is available at +http://www.eclipse.org/legal/cpl-v10.html + +Contributors: + IBM Corporation - Initial implementation + www.phpeclipse.de +**********************************************************************/ + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class WizardMessages { + + private static final String RESOURCE_BUNDLE= WizardMessages.class.getName();//$NON-NLS-1$ + + private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); + + private WizardMessages() { + } + + public static String getString(String key) { + try { + return fgResourceBundle.getString(key); + } catch (MissingResourceException e) { + return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ + } + } +} diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/wizards/WizardMessages.properties b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/wizards/WizardMessages.properties new file mode 100644 index 0000000..3bd2cb1 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/wizards/WizardMessages.properties @@ -0,0 +1,11 @@ +################################### +## +## Wiki wizard strings +## +################################### +NewProjectCreationWizard.windowTitle=New +NewProjectCreationWizard.projectCreationMessage=Creating new Wikipedia Project + +WizardNewProjectCreationPage.pageName=Create Wikipedia Project +WizardNewProjectCreationPage.pageTitle=Wikipedia Project +WizardNewProjectCreationPage.pageDescription=Create a new Wikipedia Project \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.wiki/wikis/Plog4UDE.properties b/archive/net.sourceforge.phpeclipse.wiki/wikis/Plog4UDE.properties new file mode 100644 index 0000000..4348c8e --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/wikis/Plog4UDE.properties @@ -0,0 +1,13 @@ +baseURL=http://www.plog4u.de +actionPath=/index.php +actionPath2=/wiki.phtml +readPath=/wiki/ +charSet=UTF-8 +specialNs=Spezial +metaNs=Wikinews +loginSuccess=(?s).*?Sie sind jetzt als ".*?" bei .*? angemeldet.* +loginWrongPw=(?s).*?Das Passwort ist falsch.*? Bitte versuchen Sie es erneut.* +loginNoUser=(?s).*?Der Benutzername ".*?" existiert nicht.*?Überprüfen Sie die Schreibweise, oder melden Sie sich als neuer Benutzer an.* +logoutSuccess=(?s).*?Sie sind nun abgemeldet.*?Sie können .*? jetzt anonym weiterbenutzen, oder sich unter dem selben oder einem anderen Benutzernamen wieder anmelden.* +uploadSuccess=(?s).*?Erfolgreich hochgeladen.* +uploadNoLogin=(?s).*?Sie müssen .*?angemeldet sein.*?um Dateien hochladen zu können.* diff --git a/archive/net.sourceforge.phpeclipse.wiki/wikis/Plog4UORG.properties b/archive/net.sourceforge.phpeclipse.wiki/wikis/Plog4UORG.properties new file mode 100644 index 0000000..e6f9396 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/wikis/Plog4UORG.properties @@ -0,0 +1,13 @@ +baseURL=http://www.plog4u.org +actionPath=/index.php +actionPath2=/wiki.phtml +readPath=/wiki/ +charSet=UTF-8 +specialNs=Special +metaNs=Wikinews +loginSuccess=(?s).*?You are now logged in to .*? as ".*?".* +loginWrongPw=(?s).*?The password you entered is incorrect.*? Please try again.* +loginNoUser=(?s).*?There is no user by the name ".*?".*?Check your spelling, or use the form below to create a new user account.* +logoutSuccess=(?s).*?You are now logged out.*?You can continue to use .*? anonymously, or you can log in.*?again as the same or as a different user.*? Note that some pages may.*?continue to be displayed as if you were still logged in, until you clear.*?your browser cache.* +uploadSuccess=(?s).*?Successful upload.* +uploadNoLogin=(?s).*?You must be .*?logged in.*?to upload files.* diff --git a/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaHE.properties b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaHE.properties new file mode 100644 index 0000000..a47346e --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaHE.properties @@ -0,0 +1,13 @@ +baseURL=http://he.wikipedia.org +actionPath=/w/index.php +actionPath2=/w/wiki.phtml +readPath=/wiki/ +charSet=UTF-8 +specialNs=%D7%9E%D7%99%D7%95%D7%97%D7%93 +metaNs=Wikipedia +loginSuccess=(?s).*?????? ????????? ??? ".*?".* +loginWrongPw=(?s).*??????? ?????? ?????.*? ??? ???/? ????.* +loginNoUser=(?s).*???? ????? ??? ".*?".*?????/? ?????? ????, ?? ?????/? ????? ????? ????? ????? ????? ???.* +logoutSuccess=(?s).*????? ??? ???????.*? ??/? ????/? ?????? ?????? ????? ????????? ????? ????????, ?? ?????/? ???? ?????? ???? ???? ?? ?? ????? ??? ?? ???.* +uploadSuccess=(?s).*?????? ????? ??????.* +uploadNoLogin=(?s).*????? ?????? ?????? ?????? ??? ?????? ????.* diff --git a/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaIA.properties b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaIA.properties new file mode 100644 index 0000000..1ea554d --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaIA.properties @@ -0,0 +1,13 @@ +baseURL=http://ia.wikipedia.org +actionPath=/w/index.php +actionPath2=/w/wiki.phtml +readPath=/wiki/ +charSet=UTF-8 +specialNs=Special +metaNs=Wikipedia +loginSuccess=(?s).*?Tu es identificate in Wikipedia como\".*?".* +loginWrongPw=(?s).*?Le contrasigno que tu scribeva es incorrecte.*? Per favor tenta de nove.* +loginNoUser=(?s).*?Non existe usator registrate con le nomine ".*?".*?Verifica le orthographia, o usa le formulario infra pro crear un nove conto de usator.* +logoutSuccess=(?s).*?Tu claudeva tu session.*?Tu pote continuar a usar Wikipedia anonymemente, o initiar un.*?nove session como le mesme o como un altere usator.* +uploadSuccess=(?s).*?Carga complete.* +uploadNoLogin=(?s).*?Tu debe .*?aperir un session.*?pro poter cargar files.* diff --git a/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaIT.properties b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaIT.properties new file mode 100644 index 0000000..eabeda1 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaIT.properties @@ -0,0 +1,13 @@ +baseURL=http://it.wikipedia.org +actionPath=/w/index.php +actionPath2=/w/wiki.phtml +readPath=/wiki/ +charSet=UTF-8 +specialNs=Speciale +metaNs=Wikipedia +loginSuccess=(?s).*?Sei stato connesso al server di Wikipedia con il nome utente di ".*?".* +loginWrongPw=(?s).*?La password immessa non è corretta.*?Riprova, per favore.* +loginNoUser=(?s).*?Attenzione.*?a seguito di verifica, non ci risulta alcun Utente con il nome di ".*?".*?Controlla per favore il nome digitato, oppure usa il modulo qui sotto per creare un nuovo user account.* +logoutSuccess=(?s).*?Logout effettuato.*?Ora puoi continuare ad usare Wikipedia come utente anonimo .*?ma il tuo indirizzo IP resterà riconoscibile.*?, oppure puoi nuovamente richiedere il login con il precedente username, oppure come uno diverso.* +uploadSuccess=(?s).*?Caricamento completato.* +uploadNoLogin=(?s).*?Devi eseguire .*?per fare l'upload dei files.* diff --git a/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaJA.properties b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaJA.properties new file mode 100644 index 0000000..e39e4df --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaJA.properties @@ -0,0 +1,13 @@ +baseURL=http://ja.wikipedia.org"; +actionPath=/w/index.php +actionPath2=/w/wiki.phtml +readPath=/wiki/ +charSet=UTF-8 +specialNs=%E7%89%B9%E5%88%A5 +metaNs=Wikipedia +loginSuccess=(?s).*?あなたは現在 .*? に ".*?" としてログインしています。.* +loginWrongPw=(?s).*?パスワードが間違っています。再度入力してください。.* +loginNoUser=(?s).*?".*?" というユーザーは見当たりません。.*?綴りが正しいか再度確認するか、下記のフォームを使ってアカウントを作成してください。.* +logoutSuccess=(?s).*?ログアウトしました。.*?このままウィキペディアを匿名で使い続けることができます。.*?もう一度ログインして元の、あるいは別のユーザーとして使うこともできます。.* +uploadSuccess=(?s).*?アップロード成功.* +uploadNoLogin=(?s).*?ファイルをアップロードするには.*?ログイン.*?する必要があります。.* diff --git a/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaNL.properties b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaNL.properties new file mode 100644 index 0000000..a06a21e --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaNL.properties @@ -0,0 +1,13 @@ +baseURL=http://nl.wikipedia.org +actionPath=/w/index.php +actionPath2=/w/wiki.phtml +readPath=/wiki +charSet=ISO-8859-1 +specialNs=Speciaal +metaNs=Wikipedia +loginSuccess=(?s).*?U bent nu aangemeld bij .*? NL als ".*?".* +loginWrongPw=(?s).*?Het ingegeven wachtwoord is niet juist.*? Probeer het opnieuw.* +loginNoUser=(?s).*?Er bestaat geen gebruiker met de naam ".*?".*? Controleer uw spelling, of gebruik onderstaand formulier om een nieuw gebruikersprofiel aan te maken.* +logoutSuccess=(?s).*?U bent nu afgemeld.*?U kunt .*? anoniem blijven gebruiken, of u opnieuw aanmelden onder dezelfde of onder een andere naam.* +uploadSuccess=(?s).*?De upload was succesvol.* +uploadNoLogin=(?s).*?U dient .*?aangemeld te zijn.*?om bestanden te uploaden.* diff --git a/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaPL.properties b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaPL.properties new file mode 100644 index 0000000..48cd207 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaPL.properties @@ -0,0 +1,13 @@ +baseURL=http://pl.wikipedia.org +actionPath=/w/index.php +actionPath2=/w/wiki.phtml +readPath=/wiki/ +charSet=UTF-8 +specialNs=Specjalna +metaNs=Wikipedia +loginSuccess=(?s).*?Zalogowano Cię do Wikipedii jako ".*?".* +loginWrongPw=(?s).*?Podane przez Ciebie hasło jest nieprawidłowe.*? Spróbuj jeszcze raz.* +loginNoUser=(?s).*?Nie ma użytkowniku nazywającego się ".*?".*?Sprawdź pisownię lub użyj poniższego formularza by utworzyć nowe konto.* +logoutSuccess=(?s).*?Wylogowano Cię.*?Możesz kontynuować pracę z Wikipedią jako niezarejestrowany użytkownik.*?albo zalogować się ponownie jako ten sam lub inny użytkownik.* +uploadSuccess=(?s).*?Przesłanie pliku powiodło się.* +uploadNoLogin=(?s).*?Musisz się .*?zalogować.*?przed przesłaniem pików.* diff --git a/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaPT.properties b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaPT.properties new file mode 100644 index 0000000..3a379b6 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaPT.properties @@ -0,0 +1,13 @@ +baseURL=http://pt.wikipedia.org +actionPath=/w/index.php +actionPath2=/w/wiki.phtml +readPath=/wiki/ +charSet =UTF-8 +specialNs=Especial +metaNs=Wikipedia +loginSuccess=(?s).*?Agora você está logado na Wikipédia como ".*?".* +loginWrongPw=(?s).*?A senha que você entrou é inválida.*? Por favor tente novamente.* +loginNoUser=(?s).*?Não há nenhum usuário com o nome ".*?".*?Verifique sua grafia, ou utilize o formulário a baixo para criar uma nova conta de usuário.* +logoutSuccess=(?s).*?Você agora não está mais autenticado.*?Você pode continuar a usar a Wikipédia anonimamente, ou pode se autenticar.*?novamente como o mesmo utilizador ou como um utilizador diferente.* +uploadSuccess=(?s).*?Carregamento efetuado com sucesso.* +uploadNoLogin=(?s).*?Você deve estar.*?autenticado.*?para carregar arquivos.* diff --git a/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaRO.properties b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaRO.properties new file mode 100644 index 0000000..6cb0a4b --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaRO.properties @@ -0,0 +1,13 @@ +baseURL=http://ro.wikipedia.org +actionPath=/w/index.php +actionPath2=/w/wiki.phtml +readPath=/wiki/ +charSet=UTF-8 +specialNs=Special +metaNs=Wikipedia +loginSuccess=(?s).*?AÅ£i fost autentificat în Wikipedia ca ".*?".* +loginWrongPw=(?s).*?Parola pe care aÅ£i introdus-o este greşită.*? Vă rugăm încercaÅ£i din nou.* +loginNoUser=(?s).*?Nu există nici un utilizator cu numele ".*?".*?VerificaÅ£i dacă aÅ£i scris corect sau folosiÅ£i această pagină pentru a crea un nou utilizator.* +logoutSuccess=(?s).*?Sesiunea Dvs.*? în Wikipedia a fost închisă.*?PuteÅ£i continua să folosiÅ£i Wikipedia anonim, sau puteÅ£i să vă reautentificaÅ£i ca acelaşi sau ca alt utilizator.* +uploadSuccess=(?s).*?Fişierul a fost trimis.* +uploadNoLogin=(?s).*?Trebuie să fi .*?autentificat.*?ca să trimiÅ£i fişiere.* diff --git a/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaSL.properties b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaSL.properties new file mode 100644 index 0000000..b7e81c7 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaSL.properties @@ -0,0 +1,13 @@ +baseURL=http://sl.wikipedia.org +actionPath=/w/index.php +actionPath2=/w/wiki.phtml +readPath=/wiki/ +charSet=UTF-8 +specialNs=Posebno +metaNs=Wikipedia +loginSuccess=(?s).*?Sedaj ste prijavljeni v Wikipediji kot ".*?".* +loginWrongPw=(?s).*?Geslo, ki ste ga vnesli je nepravilno.*? Prosimo poskusite znova.* +loginNoUser=(?s).*?Uporabnik z imenom ".*?" ne obstaja.*? Preverite vaÅ¡e črkovanje, ali uporabite spodnji obrazec za izdelavo novega uporabniÅ¡kega računa.* +logoutSuccess=(?s).*?Sedaj niste prijavljeni.*?Lahko nadaljujete z uporabo Wikipedije neprijavljeni, ali pa se lahko ponovno prijavite kot isti ali drug uporabnik.* +uploadSuccess=(?s).*?Nalaganje uspeÅ¡no.* +uploadNoLogin=(?s).*?Za nalaganje datotek morate biti .*?prijavljeni.* diff --git a/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaSV.properties b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaSV.properties new file mode 100644 index 0000000..58db432 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaSV.properties @@ -0,0 +1,13 @@ +baseURL=http://sv.wikipedia.org +actionPath=/w/index.php +actionPath2=/w/wiki.phtml +readPath=/wiki/ +charSet=ISO-8859-1 +specialNs=Special +metaNs=Wikipedia +loginSuccess=(?s).*?Du är nu inloggad pÃ¥ Wikipedia med användarnamnet ".*?".* +loginWrongPw=(?s).*?Lösenordet du skrev är felaktigt.*? Pröva igen.* +loginNoUser=(?s).*?Det finns ingen användare med namnet ".*?".*?Kontrollera stavningen, eller använd formuläret nedan för att skapa ett nytt konto.* +logoutSuccess=(?s).*?Du är nu utloggad.*?Du kan fortsätta som anonym Wikipediaanvändare, eller sÃ¥ kan du logga in.*?igen som samma eller annan användare.* +uploadSuccess=(?s).*?Uppladdningen lyckades.* +uploadNoLogin=(?s).*?Du mÃ¥ste vara .*?inloggad.*?för att kunna ladda upp filer.* diff --git a/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaZH.properties b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaZH.properties new file mode 100644 index 0000000..be9b3d3 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.wiki/wikis/WikipediaZH.properties @@ -0,0 +1,13 @@ +baseURL=http://zh.wikipedia.org +actionPath=/w/index.php +actionPath2=/w/wiki.phtml +readPath=/wiki/ +charSet=UTF-8 +specialNs=Special +metaNs=Wikipedia +loginSuccess=(?s).*?您现在以“.*?”的身份登录维基百科。.* +loginWrongPw=(?s).*?您输入的密码错误,请再试一次。.* +loginNoUser=(?s).*?找不到用户“.*?”。.*?请检查您的拼写,或者用下面的表单建立一个新帐号。.* +logoutSuccess=(?s).*?您现在已经退出。您可以继续以匿名方式使用维基百科,或再次以相同或不同用户身份登录。.*?请注意:如果您再次登陆,一些页面仍然将显示为原来的样子,直到您清空浏览器的缓存。.* +uploadSuccess=(?s).*?上载成功.* +uploadNoLogin=(?s).*?您必须先.*?登录.*?才能上载文件。.*