From 50d203171eb89877b69dbc73ece528caad15fbb3 Mon Sep 17 00:00:00 2001 From: axelcl Date: Sun, 30 Jan 2005 21:29:46 +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 | 53 ++++++++++++-------- 1 files changed, 32 insertions(+), 21 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 e3e72e8..b3665a5 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 @@ -57,28 +57,8 @@ public class RefreshJob extends WorkspaceJob { HashMap map = new HashMap(); String wikiTitle; for (int i = 0; i < files.length; i++) { - wikiTitle = null; file = files[i]; - String srcBasePath = Util.getWikiTextsPath(file); - String binBasePath = Util.getProjectsWikiOutputPath(file.getProject(), WikiEditorPlugin.HTML_OUTPUT_PATH); - - String fileXMLName = Util.getXMLFileName(file, binBasePath, srcBasePath); - IPath path = new Path(fileXMLName); - IFile xmlFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path); - if (xmlFile.exists()) { - try { - Page page = XStreamManager.fromXML(xmlFile.getContents()); - if (page != null) { - wikiTitle = page.getTitle(); - } - // timestamp = XMLReader.getDateTimestamp(xmlFile.getContents()); - } catch (Exception e2) { - } - } - if (wikiTitle==null) { - // if no XML file exists we create the name from the filename - wikiTitle = Util.getReadableWikiName(files[i]); - } + wikiTitle = createWikiTitle(file, i); buffer.append(wikiTitle); map.put(wikiTitle, file); if (i != files.length - 1) { @@ -146,6 +126,37 @@ public class RefreshJob extends WorkspaceJob { return Status.OK_STATUS; } + /** + * @param file + * @param wikiTitle + * @param i + * @return + */ + 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); + + String fileXMLName = Util.getXMLFileName(file, binBasePath, srcBasePath); + IPath path = new Path(fileXMLName); + IFile xmlFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path); + if (xmlFile.exists()) { + try { + Page page = XStreamManager.fromXML(xmlFile.getContents()); + if (page != null) { + wikiTitle = page.getTitle(); + } + // timestamp = XMLReader.getDateTimestamp(xmlFile.getContents()); + } catch (Exception e2) { + } + } + if (wikiTitle==null) { + // if no XML file exists we create the name from the filename + wikiTitle = Util.getReadableWikiName(files[i]); + } + return wikiTitle; + } + public boolean isModal(Job job) { Boolean isModal = (Boolean) job.getProperty(IProgressConstants.PROPERTY_IN_DIALOG); if (isModal == null) { -- 1.7.1