Java Code Examples for org.eclipse.core.resources.IResource.getFullPath()

The following are Jave code examples for showing how to use getFullPath() of the org.eclipse.core.resources.IResource class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: eclipse-batch-editor   File: BatchEditor.java   Source Code and License Vote up 6 votes
private boolean isMarkerChangeForThisEditor(IResourceChangeEvent event) {
	IResource resource = ResourceUtil.getResource(getEditorInput());
	if (resource == null) {
		return false;
	}
	IPath path = resource.getFullPath();
	if (path == null) {
		return false;
	}
	IResourceDelta eventDelta = event.getDelta();
	if (eventDelta == null) {
		return false;
	}
	IResourceDelta delta = eventDelta.findMember(path);
	if (delta == null) {
		return false;
	}
	boolean isMarkerChangeForThisResource = (delta.getFlags() & IResourceDelta.MARKERS) != 0;
	return isMarkerChangeForThisResource;
}
 
Example 2
Project: eclipse-bash-editor   File: BashEditor.java   Source Code and License Vote up 6 votes
private boolean isMarkerChangeForThisEditor(IResourceChangeEvent event) {
	IResource resource = ResourceUtil.getResource(getEditorInput());
	if (resource == null) {
		return false;
	}
	IPath path = resource.getFullPath();
	if (path == null) {
		return false;
	}
	IResourceDelta eventDelta = event.getDelta();
	if (eventDelta == null) {
		return false;
	}
	IResourceDelta delta = eventDelta.findMember(path);
	if (delta == null) {
		return false;
	}
	boolean isMarkerChangeForThisResource = (delta.getFlags() & IResourceDelta.MARKERS) != 0;
	return isMarkerChangeForThisResource;
}
 
Example 3
Project: gw4e.project   File: ResourceManager.java   Source Code and License Vote up 6 votes
/**
 * Return a path relative to its package fragment root
 * 
 * @param project
 * @param path
 * @return
 * @throws JavaModelException
 */
public static IPath getPathWithinPackageFragment(IResource ifile) throws JavaModelException {
	IProject project = ifile.getProject();
	IPath path = ifile.getFullPath();
	String[] segments = path.segments();
	IJavaProject jproject = JavaCore.create(project);
	IPackageFragment[] pkgs = jproject.getPackageFragments();
	IPath p = new Path("/");
	for (int i = 0; i < segments.length; i++) {
		for (int j = 0; j < pkgs.length; j++) {
			if (pkgs[j].getPath().equals(p)) {
				IPath ret = path.makeRelativeTo(pkgs[j].getPath());
				return ret;
			}
		}
		p = p.append(segments[i]);
	}
	return null;
}
 
Example 4
Project: n4js   File: N4JSEclipseModel.java   Source Code and License Vote up 5 votes
public Optional<? extends IN4JSSourceContainer> getN4JSSourceContainer(IResource resource) {
	N4JSEclipseProject project = getN4JSProject(resource.getProject());
	ImmutableList<? extends IN4JSEclipseSourceContainer> containers = project.getSourceContainers();
	IPath fullPath = resource.getFullPath();
	for (IN4JSEclipseSourceContainer container : containers) {
		if (matchPaths(fullPath, container)) {
			return Optional.of(container);
		}
	}
	return Optional.absent();
}