Package org.locationtech.udig.project.internal

Examples of org.locationtech.udig.project.internal.Project


     *
     * @param title Title of Map to be created
     * @return new IMap
     */
    static private Map createMap( String title ) {
        Project project = ProjectPlugin.getPlugin().getProjectRegistry().getCurrentProject();
        if (project == null) {
            project = ProjectPlugin.getPlugin().getProjectRegistry().getDefaultProject();
        }
        return ProjectFactory.eINSTANCE.createMap(project, title, new ArrayList<Layer>());
    }
View Full Code Here


    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

    @Override
    public MapReference getMapReference( IMap map ) {
        MapReference ref = null;
        if (!mapReferences.containsKey(map.getID())) {
            // TODO fix this when IProject has a getID() method
            Project project = (Project) map.getProject();
            if (project != null) {
                URI projectURI = project.eResource().getURI();
                ref = new MapReference(map.getID(), projectURI, map.getName());
                mapReferences.put(map.getID(), ref);
            }
        } else {
            ref = mapReferences.get(map.getID());
View Full Code Here

            if( !element.getContents().contains(ProjectPlugin.getPlugin().getProjectRegistry()) )
                element.unload();
    }
   
    ResourceSet set=new ResourceSetImpl();
    Project project=(Project) set.getResource(URI.createURI("file://"+file.getAbsolutePath()), true).getAllContents().next(); //$NON-NLS-1$
    assertFalse(project.eIsProxy());
    assertNotNull(project);
    int maps=0;
    boolean foundFirstMap=false;
    boolean foundSecondMap=false;
   
    List resources=project.getElements();
    for (Iterator iter = resources.iterator(); iter.hasNext();) {
      Map map=(Map) iter.next();
 
      assertFalse(map.eIsProxy());
      assertEquals(1, map.getLayersInternal().size());
View Full Code Here

            map = new CurrentMapFinder().getCurrentMap();
        }
        if (map != null) {
            return map;
        }
        Project project=project2;
        if (project == null) {
            project = ProjectPlugin.getPlugin().getProjectRegistry().getCurrentProject();
        }
        if (project == null) {
            project = ProjectPlugin.getPlugin().getProjectRegistry().getDefaultProject();
View Full Code Here

        ViewerFilter[] filters = new ViewerFilter[1];
        filters[0] = new ViewerFilter(){
            public boolean select( Viewer viewer, Object parentElement, Object element ) {
                if (element instanceof ProjectElement && parentElement instanceof Project) {
                    ProjectElement mapElement = (ProjectElement) element;
                    Project projectElement = (Project) parentElement;

                    List<ProjectElement> elements = projectElement
                            .getElements(ProjectElement.class);
                    for( ProjectElement pElem : elements ) {
                        List<ProjectElement> projectElements = pElem
                                .getElements(ProjectElement.class);
                        for( ProjectElement projElem : projectElements ) {
View Full Code Here

                    }

                    public void run() throws Exception {

                        removeTemporaryLayers(store);
                        Project p = getMap().getProjectInternal();
                        if (p != null) {
                            if (p.eResource() != null && p.eResource().isModified()) {
                                p.eResource().save(ProjectPlugin.getPlugin().saveOptions);
                            }
                           
                            /*
                             * when closing a map the platform wants to save the map resource,
                             * but if you are removing the map, its no longer available.
                             */
                            final Map map = getMap();
                            final Resource resource = map.eResource();
                            if (resource != null)
                                resource.save(ProjectPlugin.getPlugin().saveOptions);

                            // need to kick the Project so viewers will update
                            p.eNotify(new ENotificationImpl((InternalEObject) p, Notification.SET,
                                    ProjectPackage.PROJECT__ELEMENTS_INTERNAL, null, null));

                        } else {
                            final Resource resource = getMap().eResource();
                            if (resource != null)
View Full Code Here

  }
 
  @SuppressWarnings("unchecked")
  @Test
    public void testWithProjectWithName() throws Exception {
    Project project = ProjectPlugin.getPlugin().getProjectRegistry()
      .getDefaultProject();
   
    CreateMapCommand cmCommand
      = new CreateMapCommand("MyMap", (List<IGeoResource>) service.resources(null), project); //$NON-NLS-1$
    project.sendSync(cmCommand);
   
    Map map = (Map) cmCommand.getCreatedMap();
    assertNotNull(map);
    assertEquals(map.getProject(),project);
    assertEquals(map.getName(), "MyMap"); //$NON-NLS-1$
View Full Code Here

  }
 
  @SuppressWarnings("unchecked")
  @Test
    public void testWithoutProjectWithoutName() throws Exception {
    Project project = ProjectPlugin.getPlugin().getProjectRegistry()
    .getDefaultProject();
 
    List<IGeoResource> members = (List<IGeoResource>) service.resources(null);
        CreateMapCommand cmCommand
      = new CreateMapCommand(null, members, null);
    project.sendSync(cmCommand);
 
    Map map = (Map) cmCommand.getCreatedMap();
    assertNotNull(map);
    assertNotNull(map.getProject());
   
View Full Code Here

        if (template == null) {
            return;
        }

        Map map = null;
        Project project = null;

        Map oldMap = (Map) ((MapEditorInput) input).getProjectElement();
        project = oldMap.getProjectInternal();
        try {
            map = (Map) EcoreUtil.copy(oldMap);  
        }
        catch( Throwable t ){
            // unable to copy map?
            t.printStackTrace();
            return;
        }

        project.getElementsInternal().add(map);

        //Point size = //mapEditor.getComposite().getSize();
        Point partSize;
        if( mapEditor instanceof MapEditorPart ){
            MapEditorPart part = (MapEditorPart) mapEditor;
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.internal.Project

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.