From: axelcl Date: Sun, 30 Jan 2005 21:29:46 +0000 (+0000) Subject: ''Open Wiki link'' and ''Create Files for Wiki link'' every new created file creates... X-Git-Url: http://git.phpeclipse.com?hp=b0670d1a8bb91761a423fb5a1ce65ec43efe5431 ''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) --- 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) {