[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| [udig-devel] Storing/Showing other project elements | 
I did a post ages ago asking about how to add other types of elements to 
a project (other than maps). For example, I am creating analysis files 
which are associated with a project - they're not GIS-related at all. 
I'd like these to show in the project view under the project. I've been 
trying to get this to happen on and off over the past few weeks without 
success. The net.refractions.udig.project.projectElementFactories and 
net.refractions.udig.project.ui.editorInputs extension points look 
promising but I don't see how to set everything up to add 
IProjectElements to a project. The 
ApplicationGIS.loadProjectElement(url, project) method is the closest I 
could see - it looks like this...
public static IProjectElement loadProjectElement( URL url, IProject 
project )
           throws IOException, IllegalArgumentException {
       URI uri = URI.createURI(url.toString());
       Resource mapResource;
       try {
           mapResource = 
ProjectRegistryImpl.getProjectRegistry().eResource().getResourceSet()
                   .getResource(uri, true);
       } catch (Exception e) {
           throw new IOException(Messages.ApplicationGIS_loadError + uri);
       }
       Object obj;
       try {
           obj = mapResource.getContents().get(0);
       } catch (Exception e) {
           throw new IllegalArgumentException(
                   Messages.ApplicationGIS_illegalArgumentPart1 + uri + 
Messages.ApplicationGIS_illegalArgumentPart2); 
       }
       if (!(obj instanceof ProjectElement))
           throw new IllegalArgumentException(
                   Messages.ApplicationGIS_noProjectElement + 
obj.getClass().getSimpleName());
       ProjectElement elem = (ProjectElement) obj;
       ((Project) project).getElementsInternal().add(elem);
       return elem;
   }
...so, even if (somehow) uDig was able to find my file and recognise 
that there exists the means to interact with it, one of my classes would 
have to implement ProjectElement, which is an internal class with lots 
of strange EMF stuff going on!
Does anyone know the proper usage of the extension points I mentioned 
above? Or the proper method for adding IProjectElements to a project?
Thanks once again
Dave S-B
Lledr Solutions