Package org.locationtech.udig.project.internal

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


     * <!-- end-user-doc -->
     * @generated
     */
    public NotificationChain basicSetProjectInternal(Project newProjectInternal,
            NotificationChain msgs) {
        Project oldProjectInternal = projectInternal;
        projectInternal = newProjectInternal;
        if (eNotificationRequired()) {
            ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
                    ElementPackage.PROJECT_ELEMENT_ADAPTER__PROJECT_INTERNAL, oldProjectInternal,
                    newProjectInternal);
View Full Code Here


            projects = new EObjectResolvingEList(Project.class, this,
                    ProjectPackage.PROJECT_REGISTRY__PROJECTS);
        }

        for (Iterator<Project> iter = projects.iterator(); iter.hasNext();) {
            Project project = iter.next();
            if (project.eResource() == null) {
                iter.remove(); // delete this one its resource is missing
            }
        }
        return projects;
    }
View Full Code Here

    /**
     * @see org.locationtech.udig.project.internal.ProjectRegistry#getCurrentProject()
     * @uml.property name="currentProject"
     */
    public Project getCurrentProject() {
        Project p = getCurrentProjectGen();
        if (p == null && getProjects().size() > 0)
            p = getProjects().get(0);
        if (p == null)
            p = getDefaultProject();
        return p;
View Full Code Here

    /**
     * <!-- begin-user-doc --> <!-- end-user-doc -->
     * @generated
     */
    public void setCurrentProject(Project newCurrentProject) {
        Project oldCurrentProject = currentProject;
        currentProject = newCurrentProject;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET,
                    ProjectPackage.PROJECT_REGISTRY__CURRENT_PROJECT, oldCurrentProject,
                    currentProject));
View Full Code Here

                projectResource.load(null);
            } catch (IOException e1) {
                // resource doesn't exist. That is ok.
            }

            Project incomingProject = null;
            if (projectResource.getContents().isEmpty()) {
                // new file being created!
                if (projectURI.isFile()) {
                    // check to see if it exists; we don't like empty existing files
                    File file = new File(projectURI.toFileString());
                    if (file.exists()) {
                        if (!file.delete())
                            throw new NullPointerException("Unable to load " + uri
                                    + " file was empty");
                    }
                }
                // creating a new project from the new project wizard
                incomingProject = createProject(uri, projectResource);

            } else {
                // Go through list of resources
                EList<EObject> contents = projectResource.getContents();
                for (EObject eObject : contents) {
                    if (eObject instanceof Project) {
                        incomingProject = (Project) eObject;
                        break;
                    }
                }
                if (incomingProject == null) {
                    // this project was not saved with a project file?
                    // (does it represent an individial map? we are not sure)
                    throw new NullPointerException("Unable to load " + uri
                            + " - does not contain a project");
                }
                //                if (incomingProject == null) {
                //                    incomingProject = createProject(uri, resource);
                //                    List<ProjectElement> eContents = incomingProject.getElementsInternal();
                //                    for( EObject eObject : contents ) {
                //                        if (eObject instanceof MapImpl) {
                //                            MapImpl tmpMap = (MapImpl) eObject;
                //                            eContents.add(tmpMap);
                //                        }
                //                    }
                //                }
            }

            final Project newProject = incomingProject;
            PlatformGIS.syncInDisplayThread(new Runnable() {
                public void run() {
                    try {
                        setCurrentProject(newProject);
                        registry.getProjects().add(newProject);
View Full Code Here

        return buffer.toString();
    }

    @SuppressWarnings("unchecked")
    private Project createProject(URI uri, Resource resource) {
        Project tmpProject = ProjectFactory.eINSTANCE.createProject();
        String path = uri.toFileString();
        int start = path.indexOf(File.separator) != -1 ? path.lastIndexOf(File.separator) : 0;
        int end = path.indexOf('.') != -1 ? path.lastIndexOf('.') : path.length() - 1;
        tmpProject.setName(path.substring(start + 1, end));
        resource.getContents().add(tmpProject);
        resource.setModified(true);

        return tmpProject;
    }
View Full Code Here

        final String uriText = url.toExternalForm() + File.separatorChar
                + ProjectRegistry.PROJECT_FILE; //$NON-NLS-1$
        final URI uri = URI.createURI(uriText);

        Project project = getProject(uri);
        return project;
    }
View Full Code Here

    /**
     * This is the method that actually does the export (called by performFinish)
     */
    public void run( IProgressMonitor monitor ) throws InvocationTargetException,
    InterruptedException {
        Project project = selectionPage.getProject();
        ExportProjectUtils.exportProject(project, destinationDirectory, monitor);
    }
View Full Code Here

        try {
            getSite().getWorkbenchWindow().run(false, false, new IRunnableWithProgress(){

                public void run( IProgressMonitor monitor ) throws InvocationTargetException,
                        InterruptedException {
                    Project p = page.getProjectInternal();
                    try {
                        if (p != null) {
                            if (p.eResource() != null && p.eResource().isModified()) {
                                p.eResource().save(ProjectPlugin.getPlugin().saveOptions);
                            }
                            saveAndUnload();
                        } else {
                            saveAndUnload();
                        }
                    } catch (IOException e) {
                        ProjectPlugin.log("", e); //$NON-NLS-1$
                    }

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

                private void saveAndUnload() throws IOException {
                    final Resource resource = page.eResource();
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);
                            }

                            final Resource resource = getMap().eResource();
                            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

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.