### Eclipse Workspace Patch 1.0 #P eclox.ui Index: src/eclox/ui/editor/Editor.java =================================================================== RCS file: /cvs/eclox/eclox.ui/src/eclox/ui/editor/Editor.java,v retrieving revision 1.3 diff -u -r1.3 Editor.java --- src/eclox/ui/editor/Editor.java 2 Mar 2007 14:04:04 -0000 1.3 +++ src/eclox/ui/editor/Editor.java 10 Jul 2007 19:08:22 -0000 @@ -30,6 +30,7 @@ import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IEditorSite; import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.IURIEditorInput; import org.eclipse.ui.PartInitException; import org.eclipse.ui.forms.editor.FormEditor; @@ -136,23 +137,47 @@ */ public void init( IEditorSite site, IEditorInput input ) throws PartInitException { try { - IFileEditorInput fileInput = (IFileEditorInput) input; - - // Attaches the resource change listener - resourceChangeListener = new ResourceChangeListener(this); - ResourcesPlugin.getWorkspace().addResourceChangeListener( resourceChangeListener ); - - // Parses the doxyfile and attaches to all settings. - this.doxyfile = new Doxyfile(fileInput.getFile()); - Iterator i = this.doxyfile.settingIterator(); - while( i.hasNext() == true ) { - Setting setting = (Setting) i.next(); - setting.addSettingListener( this ); - } - - // Continue initialization. - this.setPartName(input.getName()); - super.init(site, input); + if( input != null ) { + if( input instanceof IFileEditorInput) { + IFileEditorInput fileInput = (IFileEditorInput) input; + + // Attaches the resource change listener + resourceChangeListener = new ResourceChangeListener(this); + ResourcesPlugin.getWorkspace().addResourceChangeListener( resourceChangeListener ); + + // Parses the doxyfile and attaches to all settings. + this.doxyfile = new Doxyfile(fileInput.getFile()); + Iterator i = this.doxyfile.settingIterator(); + while( i.hasNext() == true ) { + Setting setting = (Setting) i.next(); + setting.addSettingListener( this ); + } + + // Continue initialization. + this.setPartName(input.getName()); + super.init(site, input); + } + else if( input instanceof IURIEditorInput ) { + IURIEditorInput fileInput = (IURIEditorInput) input; + + // Outside the workspace: no resource change listener + + // Parses the doxyfile and attaches to all settings. + this.doxyfile = new Doxyfile(fileInput.getURI()); + Iterator i = this.doxyfile.settingIterator(); + while( i.hasNext() == true ) { + Setting setting = (Setting) i.next(); + setting.addSettingListener( this ); + } + + // Continue initialization. + this.setPartName(input.getName()); + super.init(site, input); + } + } + else { + throw new PartInitException( "Non supported input:" + input ); + } } catch( PartInitException partInitException ) { throw partInitException; Index: src/eclox/ui/editor/editors/Convenience.java =================================================================== RCS file: /cvs/eclox/eclox.ui/src/eclox/ui/editor/editors/Convenience.java,v retrieving revision 1.1 diff -u -r1.1 Convenience.java --- src/eclox/ui/editor/editors/Convenience.java 15 Mar 2007 16:14:05 -0000 1.1 +++ src/eclox/ui/editor/editors/Convenience.java 10 Jul 2007 19:08:23 -0000 @@ -227,13 +227,13 @@ // Retrieves the initial path. IPath initialPath = new Path( path ); if( initialPath.isAbsolute() == false ) { - initialPath = doxyfile.getParentContainer().getLocation().append( initialPath ); + initialPath = doxyfile.getParentContainerLocation().append( initialPath ); } // If the initial path is not valid, use the doxyfile location as fall back. File file = new File( initialPath.toOSString() ); if( file.exists() == false ) { - initialPath = doxyfile.getParentContainer().getLocation(); + initialPath = doxyfile.getParentContainerLocation(); } // Displayes the directory dialog to the user Index: META-INF/MANIFEST.MF =================================================================== RCS file: /cvs/eclox/eclox.ui/META-INF/MANIFEST.MF,v retrieving revision 1.14 diff -u -r1.14 MANIFEST.MF --- META-INF/MANIFEST.MF 23 Apr 2007 13:43:15 -0000 1.14 +++ META-INF/MANIFEST.MF 10 Jul 2007 19:08:22 -0000 @@ -13,5 +13,6 @@ org.eclipse.core.resources, org.eclipse.ui.ide, org.eclipse.ui.forms, - org.eclipse.ui.editors + org.eclipse.ui.editors, + org.eclipse.core.filesystem Eclipse-AutoStart: true #P eclox.core Index: META-INF/MANIFEST.MF =================================================================== RCS file: /cvs/eclox/eclox.core/META-INF/MANIFEST.MF,v retrieving revision 1.13 diff -u -r1.13 MANIFEST.MF --- META-INF/MANIFEST.MF 23 Apr 2007 13:43:18 -0000 1.13 +++ META-INF/MANIFEST.MF 10 Jul 2007 19:08:24 -0000 @@ -7,7 +7,8 @@ Bundle-Localization: plugin Require-Bundle: org.eclipse.core.resources, org.eclipse.core.runtime, - org.eclipse.ui + org.eclipse.ui, + org.eclipse.core.filesystem Bundle-Activator: eclox.core.Plugin Export-Package: eclox.core, eclox.core.doxyfiles, Index: src/eclox/core/doxyfiles/Doxyfile.java =================================================================== RCS file: /cvs/eclox/eclox.core/src/eclox/core/doxyfiles/Doxyfile.java,v retrieving revision 1.2 diff -u -r1.2 Doxyfile.java --- src/eclox/core/doxyfiles/Doxyfile.java 22 Mar 2007 11:54:03 -0000 1.2 +++ src/eclox/core/doxyfiles/Doxyfile.java 10 Jul 2007 19:08:24 -0000 @@ -21,13 +21,16 @@ package eclox.core.doxyfiles; +import java.io.FileInputStream; import java.io.IOException; +import java.net.URI; import java.util.AbstractList; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; import java.util.Vector; +import org.eclipse.core.filesystem.URIUtil; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; @@ -50,7 +53,13 @@ * the file that holds the doxyfile content */ private IFile file; - + + /** + * path to the file that holds the doxyfile content, + * not necessariliy a workspace resource. + */ + private IPath fileLocation; + /** * a collection containing all doxyfile's chunks */ @@ -109,13 +118,32 @@ * @param file a file resource instance that is assumed to be a doxyfile */ public Doxyfile( IFile file ) throws IOException, CoreException { - this.file = file; + //this.file = file; + this.fileLocation = file.getLocation(); Parser parser = new Parser(file.getContents()); parser.read( this ); } /** + * Constructor + * + * @param file a file resource instance that is assumed to be a doxyfile + */ + public Doxyfile( URI uri ) throws IOException, CoreException { + fileLocation = URIUtil.toPath(uri); + file = null; + + if( fileLocation == null ) { + throw new IOException(); + } + + FileInputStream in = new FileInputStream(fileLocation.toFile()); + Parser parser = new Parser(in); + parser.read( this ); + } + + /** * Appends a new chunk to the doxyfile * * @param chunk a chunk to append to the doxyfile @@ -199,16 +227,40 @@ * @return a container instance */ public IContainer getParentContainer() { - return file.getParent(); + + if( file != null) + return file.getParent(); + + return null; } - + + /** + * Concatenates the given path to the container of + * the doxyfile. + * + * If the given path is already absolute, the + * same path is returned. + * + * @param relativePath path relative to the doxyfile + * + * @return the absolute path. + */ + public IPath getParentContainerLocation() + { + //if doxyfile is an IFile (i.e. is in workspace) + if( file != null) + return getParentContainer().getLocation(); + + return getResourceLocation().removeLastSegments(1); + } + /** * Retrieves the location of the doxyfile * * @return a path containing the doxyfile location */ public IPath getResourceLocation() { - return file.getLocation(); + return fileLocation; } /** @@ -217,7 +269,7 @@ * @return true or false */ public boolean isPathRelative( IPath path ) { - return file.getLocation().removeLastSegments(1).isPrefixOf( path ); + return fileLocation.removeLastSegments(1).isPrefixOf( path ); } /** @@ -229,7 +281,7 @@ */ public IPath makePathRelative( IPath path ) { if( isPathRelative(path) ) { - int matchingCount = file.getLocation().removeLastSegments(1).matchingFirstSegments( path ); + int matchingCount = fileLocation.removeLastSegments(1).matchingFirstSegments( path ); return path.removeFirstSegments( matchingCount ).setDevice( new String() ); } else {