Package org.eclipse.emf.common.util

Examples of org.eclipse.emf.common.util.URI$URICache


            if (name == null || name.equals("")) //$NON-NLS-1$
                continue;
            p.setValue(id, ""); //$NON-NLS-1$
            if (!monitor.isCanceled()) {
                monitor.setTaskName(Messages.StartupOpenMaps_loadingTask + name);
                URI mapResourceURI = URI.createURI(name);
                Resource resource = ProjectPlugin.getPlugin().getProjectRegistry().eResource()
                        .getResourceSet().getResource(mapResourceURI, true);

                monitor.worked(1);
                // kick the classloader so that the CRS plug-ins are loaded correctly.
View Full Code Here


     *             thrown if the file indicated by the URL is not a project
     *             element file.
     */
    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);
View Full Code Here

        memento.putString("mapId", map.getID().toString()); //$NON-NLS-1$
        memento.putString("projectId", map.getProject().getID().toString()); //$NON-NLS-1$
    }

    public void load( IMemento value ) {
        URI mapId = URI.createURI(value.getString("mapId")); //$NON-NLS-1$
        URI projectId = URI.createURI(value.getString("projectId")); //$NON-NLS-1$

        List< ? extends IProject> projects = ApplicationGIS.getProjects();

        for( IProject project : projects ) {
            if (project.getID().equals(projectId)) {
View Full Code Here

        this.target = target;
    }

     @Override
    protected void runImpl( IProgressMonitor monitor ) throws Exception {
         URI mapID = target.getMap().getMapID();
         IMap map = (IMap) (ProjectPlugin.getPlugin().getProjectRegistry().eResource()
                 .getResourceSet().getResource(mapID, true).getContents().get(0));
         ApplicationGIS.openMap(map);
         IViewportModel v = map.getViewportModel();
        
View Full Code Here

  @Ignore
  @Test
  public void testOperateProject() throws Exception {
   
    DeleteAccessor deleteAction=new DeleteAccessor();
    URI projecturi=project.eResource().getURI();
    Iterator iter=project.eResource().getResourceSet().getResources().iterator();
    while ( iter.hasNext() ){
      ((Resource) iter.next()).save(null);
    }
        //test cancel delete
    deleteAction.runDoDelete(project,false, Window.CANCEL);
    ProjectRegistry registry = ProjectPlugin.getPlugin().getProjectRegistry();
    assertEquals(1, registry.getProjects().size());
    assertTrue( registry.getProjects().contains(project) );
    assertNotNull(project.eResource());
    assertEquals(project, project.getElementsInternal().get(0).getProject());

        Resource resource = project.eResource();
        IProjectElement elem = project.getElements().get(0);
       
        // Test remove project but leave files
    deleteAction.runDoDelete(project,false, Window.OK);
    assertEquals(0, registry.getProjects().size());
    assertTrue( new File(projecturi.toFileString()).exists() );
        assertFalse(resource.isLoaded());
       
    Project project=registry.getProject(projecturi);
    assertEquals(1, project.getElementsInternal().size());
        assertNotSame(elem, project.getElements().get(0));
    assertEquals(project, project.getElementsInternal().get(0).getProject());
       
        // Test delete from file System
        deleteAction.runDoDelete(project,true, Window.OK);
        assertEquals(0, registry.getProjects().size());
        assertFalse( new File(projecturi.toFileString()).exists() );
  }
View Full Code Here

        IEclipsePreferences root = prefs.getRootNode();
        Preferences node = root.node(InstanceScope.SCOPE).node(
                getBundle().getSymbolicName() + ".bookmarks"); //$NON-NLS-1$

        for( String projectId : node.childrenNames() ) {
            URI projectURI = URI.createURI(URI.decode(projectId));
            Preferences projectNode = node.node(projectId);
            for( String mapId : projectNode.childrenNames() ) {
                URI mapURI = URI.createURI(URI.decode(mapId));
                Preferences mapNode = projectNode.node(mapId);
                String mapName = mapNode.get(KEY_NAME, null);
                for( String bmarkName : mapNode.childrenNames() ) {
                    Preferences bmarkNode = mapNode.node(bmarkName);
                    double minx = bmarkNode.getDouble(KEY_MINX, 0.0);
View Full Code Here

    public void load( Bookmark bookmark ) {
        if (bookmark.getName() == null || bookmark.getName() == "") { //$NON-NLS-1$
            bookmark.setName(Messages.BookmarkManager_bookmarkdefaultname + (++count));
        }
        MapReference map = bookmark.getMap();
        URI project = map.getProjectID();
        if (!projectsHash.containsKey(project)) {
            Vector<MapReference> projectMaps = new Vector<MapReference>();
            projectMaps.add(map);
            projectsHash.put(project, projectMaps);
        } else {
View Full Code Here

    @Override
    public void removeBookmark( Bookmark bookmark ) {
        MapReference map = bookmark.getMap();
        mapsHash.get(map.getMapID()).remove(bookmark);
        if (mapsHash.get(map.getMapID()).isEmpty()) {
            URI projectID = map.getProjectID();
            mapsHash.remove(map.getMapID());
            projectsHash.get(projectID).remove(map);
            if (projectsHash.get(projectID).isEmpty()) {
                projectsHash.remove(projectID);
            }
View Full Code Here

    }

    @Override
    public void removeMap( MapReference map ) {
        mapsHash.remove(map.getMapID());
        URI projectID = map.getProjectID();
        Vector<MapReference> maps = projectsHash.get(projectID);
        if (maps != null && maps.size() > 0) {
            maps.remove(map);
            if (maps.isEmpty()) {
                projectsHash.remove(projectID);
View Full Code Here

    @Override
    public void removeProjects( Collection<URI> elements ) {
        for( Object element : elements ) {
            if (element instanceof URI) {
                URI project = (URI) element;
                this.removeProject(project);
            }
        }
        notifyListeners(new BookmarkListener.Event(null));
    }
View Full Code Here

TOP

Related Classes of org.eclipse.emf.common.util.URI$URICache

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.