Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html /
 
 package org.eclipse.xtext.ui.util;
 
import  org.eclipse.core.resources.IProject;
import  org.eclipse.core.resources.IResource;
import  org.eclipse.jdt.core.IJavaProject;
import  org.eclipse.jdt.core.JavaCore;
TODO: implement JDT independent strategy, maybe ignoring JARs

Author(s):
Jan Kļæ½hnlein
    @Override
    public URI resolve(Object contextURI classpathUri) {
        if(!(context instanceof IResource)) {
            throw new IllegalArgumentException("Context must implement IResource");
        }
        IResource resource = (IResource) context;
        try {
            if (ClasspathUriUtil.isClasspathUri(classpathUri)) {
                IProject project = resource.getProject();
                IJavaProject javaProject = JavaCore.create(project);
                URI result = findResourceInWorkspace(javaProjectclasspathUri);
 				if (classpathUri.fragment() != null)
 					result = result.appendFragment(classpathUri.fragment());
 				return result;
            }
        } catch (Exception exc) {
            throw new ClasspathUriResolutionException(exc);
        }
        return classpathUri;
    }
New to GrepCode? Check out our FAQ X