From 3ac00d9beb596965e3091fc1e4ea828574414135 Mon Sep 17 00:00:00 2001 From: axelcl Date: Sun, 30 Jan 2005 21:47:47 +0000 Subject: [PATCH] ''Open Wiki link'' and ''Create Files for Wiki link'' every new created file creates an XML file with the correct extracted title. '/' in wiki names are not converted back to ':' anymore (but ':' are converted to '/', if there's no corresonding *.xml file) --- .../wiki/actions/mediawiki/RefreshJob.java | 43 +++++++++++-------- 1 files changed, 25 insertions(+), 18 deletions(-) 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 index b3665a5..a50202d 100644 --- 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 @@ -42,7 +42,7 @@ public class RefreshJob extends WorkspaceJob { this.files = files; this.configuration = configuration; this.actionURL = actionURL; - } + } public IStatus runInWorkspace(IProgressMonitor monitor) { ProblemConsole console = new ProblemConsole(); @@ -75,23 +75,30 @@ public class RefreshJob extends WorkspaceJob { ArrayList list = mwConnector.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) { - // rearrange parsed data into a page for XStream hamdling: - Page page = new Page(parsed.getDateTimestamp(), wikiTitle, body); - monitor.subTask("Modify file: " + file.getLocation().toString()); - updateFileContent(console, file, page, body, configuration, monitor); + if (list.size() == 0&&files.length>0) { + console.println("File: " + file.getLocation().toString() + " not available on the server."); + } else { + if (list.size() < files.length) { + console.println("Not all requested files are available on the server."); + } + 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) { + // rearrange parsed data into a page for XStream hamdling: + Page page = new Page(parsed.getDateTimestamp(), wikiTitle, body); + monitor.subTask("Modify file: " + file.getLocation().toString()); + updateFileContent(console, file, page, body, configuration, monitor); + } } } - } - if (monitor.isCanceled()) { - return Status.CANCEL_STATUS; + if (monitor.isCanceled()) { + return Status.CANCEL_STATUS; + } } } if (isModal(this)) { @@ -132,7 +139,7 @@ public class RefreshJob extends WorkspaceJob { * @param i * @return */ - private String createWikiTitle(IFile file, int i) { + private String createWikiTitle(IFile file, int i) { String wikiTitle = null; String srcBasePath = Util.getWikiTextsPath(file); String binBasePath = Util.getProjectsWikiOutputPath(file.getProject(), WikiEditorPlugin.HTML_OUTPUT_PATH); @@ -150,7 +157,7 @@ public class RefreshJob extends WorkspaceJob { } catch (Exception e2) { } } - if (wikiTitle==null) { + if (wikiTitle == null) { // if no XML file exists we create the name from the filename wikiTitle = Util.getReadableWikiName(files[i]); } -- 1.7.1