Package org.eclipse.emf.common.util

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


        // let us make the new file to write out
        File destFile = new File(dest);
        String absoluteDestPath = destFile.getAbsolutePath();

        URI destURI = URI.createFileURI(absoluteDestPath);
        Resource destResource = resourceSet.createResource(destURI);

        Collection<EObject> collection = new ArrayList<EObject>();
        for( Resource curResource : resources ) {
            collection.addAll(curResource.getContents());
View Full Code Here


            projects[index]=new String[]{ project.getName(), project.getID().toString()};
            index++;
        }
        if( getDialogSettings() != null){
            if( registery.getCurrentProject() != null ){
                URI uri = registery.getCurrentProject().getID();
                if( uri != null ){
                    String selected = uri.toFileString();
                    this.getDialogSettings().put("projectSelect", selected );
                }                       
            }
        }
View Full Code Here

            if (findProject(uri) != null) {
                // already available!
                return findProject(uri);
            }

            URI projectURI = URI.createURI(uri.toString());

            final ProjectRegistry registry = getProjectRegistry();
            Resource registryResource = registry.eResource();
            if (registryResource == null) {
                System.out.println("Registery was unable to load"); //$NON-NLS-1$
                throw new Error(Messages.ProjectRegistryImpl_load_error);
            }

            URI registryURI = registryResource.getURI();
            projectURI.deresolve(registryURI, true, true, true);

            ResourceSet registeryResourceSet = registryResource.getResourceSet();
            Resource projectResource = registeryResourceSet.createResource(projectURI);
            try {
View Full Code Here

            // projectPath = "file://" + projectPath; //$NON-NLS-1$
        }

        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

    private synchronized static ProjectRegistry load() {
        ProjectRegistry projectRegistry = null;
        try {

            IPath registrypath = Platform.getLocation().append(".projectRegistry"); //$NON-NLS-1$
            URI uri = URI.createURI("file://" + registrypath.toOSString()); //$NON-NLS-1$

            projectRegistry = backwardsCompatibility(projectRegistry, registrypath, uri);

            if (projectRegistry == null) {
View Full Code Here

     */
    private static ProjectRegistry backwardsCompatibility(ProjectRegistry projectRegistry,
            IPath registrypath, URI uri) {
        IPath oldregistrypath = ProjectPlugin.getPlugin().getStateLocation()
                .append("ProjectRegistry"); //$NON-NLS-1$
        URI olduri = URI.createURI("file://" + oldregistrypath.toOSString()); //$NON-NLS-1$

        if (oldregistrypath.toFile().exists()) {
            resourceSet = new ResourceSetImpl();
            Resource resource = resourceSet.getResource(olduri, true);
            resourceSet.eSetDeliver(false);
View Full Code Here

    private void createResourceAndAddElement(Project value, ProjectElement projectElement) {
        if (projectElement == null || projectElement.eIsProxy())
            return;
        Resource projectResource = eResource();
        if (projectResource != null) {
            URI projectURI = projectResource.getURI();
            String elementPath = null;
            elementPath = findElementResourcePath(projectElement, elementPath);

            String projectPath = findProjectResourcePath(projectURI);
View Full Code Here

    @SuppressWarnings("unchecked")
    private static void doCreation(ProjectElement projectElement, Resource projectResource,
            String elementPath, String projectPath) {
        Resource resource = null;

        URI uri = createNewResource(projectResource, projectPath, projectElement);
        resource = projectResource.getResourceSet().createResource(uri);
        resource.getContents().add(projectElement);
        resource.setTrackingModification(true);
        resource.setModified(true);
    }
View Full Code Here

    private static URI createNewResource(Resource projectResource, String projectPath,
            ProjectElement projectElement) {
        int i = 0;
        List<Resource> list = projectResource.getResourceSet().getResources();
        URIConverter uriConverter = projectResource.getResourceSet().getURIConverter();
        URI uri = null;
        boolean found = false;
        do {
            found = false;
            i++;
            //TODO Add file extension name to ProjectElement
            uri = generateResourceName(projectPath, projectElement, i);

            URI normalizedURI = uriConverter.normalize(uri);
            for (Resource resource2 : list) {
                if (uriConverter.normalize(resource2.getURI()).equals(normalizedURI)) {
                    found = true;
                    break;
                }
View Full Code Here

        uri.deresolve(projectResource.getURI(), true, true, true);
        return uri;
    }

    private static URI generateResourceName(String projectPath, ProjectElement projectElement, int i) {
        URI uri;
        String resourceName = (projectElement.getName() == null ? "element" : projectElement.getName()) + i; //$NON-NLS-1$
        resourceName = resourceName.replaceAll("[/\\\\]", ""); //$NON-NLS-1$ //$NON-NLS-2$
        resourceName = resourceName.replaceAll("\\s", "_"); //$NON-NLS-1$ //$NON-NLS-2$
        resourceName = resourceName.replaceAll("_+", "_"); //$NON-NLS-1$ //$NON-NLS-2$
        resourceName = resourceName.replaceAll(":", "_"); //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

TOP

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

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.