📄 projectstub.java
字号:
package org.python.pydev.navigator;
import java.io.File;
import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IProjectNature;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceProxy;
import org.eclipse.core.resources.IResourceProxyVisitor;
import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourceAttributes;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IPluginDescriptor;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.content.IContentTypeMatcher;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.python.pydev.core.IPythonNature;
import org.python.pydev.core.REF;
public class ProjectStub implements IProject, IWorkbenchAdapter{
private File projectRoot;
private Map<File, IResource> cache = new HashMap<File, IResource>();
private IPythonNature nature;
private IContainer parent;
public ProjectStub(File file, IPythonNature nature) {
Assert.isTrue(file.exists() && file.isDirectory());
this.projectRoot = file;
this.nature = nature;
}
public IResource getResource(File parentFile) {
if(parentFile.equals(projectRoot)){
return this;
}
IResource r = cache.get(parentFile);
if(r == null){
if(parentFile.isFile()){
r = new FileStub(this, parentFile);
}else{
r = new FolderStub(this, parentFile);
}
cache.put(parentFile, r);
}
return r;
}
public IContainer getFolder(File parentFile) {
return (IContainer) getResource(parentFile);
}
public void setParent(IContainer parent) {
this.parent = parent;
}
public IContainer getParent() {
return this.parent;
}
@Override
public String toString() {
return "ProjectStub:"+this.projectRoot;
}
public void build(int kind, IProgressMonitor monitor) throws CoreException {
throw new RuntimeException("Not impl");
}
public void build(int kind, String builderName, Map args, IProgressMonitor monitor) throws CoreException {
throw new RuntimeException("Not impl");
}
public void close(IProgressMonitor monitor) throws CoreException {
throw new RuntimeException("Not impl");
}
public void create(IProgressMonitor monitor) throws CoreException {
throw new RuntimeException("Not impl");
}
public void create(IProjectDescription description, IProgressMonitor monitor) throws CoreException {
throw new RuntimeException("Not impl");
}
public void delete(boolean deleteContent, boolean force, IProgressMonitor monitor) throws CoreException {
throw new RuntimeException("Not impl");
}
public IContentTypeMatcher getContentTypeMatcher() throws CoreException {
throw new RuntimeException("Not impl");
}
public IProjectDescription getDescription() throws CoreException {
throw new RuntimeException("Not impl");
}
public IFile getFile(String name) {
throw new RuntimeException("Not impl");
}
public IFolder getFolder(String name) {
throw new RuntimeException("Not impl");
}
public IProjectNature getNature(String natureId) throws CoreException {
if(nature == null){
throw new RuntimeException("not expected");
}
return nature;
}
public IPath getPluginWorkingLocation(IPluginDescriptor plugin) {
throw new RuntimeException("Not impl");
}
public IProject[] getReferencedProjects() throws CoreException {
throw new RuntimeException("Not impl");
}
public IProject[] getReferencingProjects() {
throw new RuntimeException("Not impl");
}
public IPath getWorkingLocation(String id) {
throw new RuntimeException("Not impl");
}
public boolean hasNature(String natureId) throws CoreException {
throw new RuntimeException("Not impl");
}
public boolean isNatureEnabled(String natureId) throws CoreException {
throw new RuntimeException("Not impl");
}
public boolean isOpen() {
return true;
}
public void move(IProjectDescription description, boolean force, IProgressMonitor monitor) throws CoreException {
throw new RuntimeException("Not impl");
}
public void open(IProgressMonitor monitor) throws CoreException {
throw new RuntimeException("Not impl");
}
public void open(int updateFlags, IProgressMonitor monitor) throws CoreException {
throw new RuntimeException("Not impl");
}
public void setDescription(IProjectDescription description, IProgressMonitor monitor) throws CoreException {
throw new RuntimeException("Not impl");
}
public void setDescription(IProjectDescription description, int updateFlags, IProgressMonitor monitor) throws CoreException {
throw new RuntimeException("Not impl");
}
public boolean exists(IPath path) {
throw new RuntimeException("Not impl");
}
public IFile[] findDeletedMembersWithHistory(int depth, IProgressMonitor monitor) throws CoreException {
throw new RuntimeException("Not impl");
}
public IResource findMember(String name) {
throw new RuntimeException("Not impl");
}
public IResource findMember(IPath path) {
throw new RuntimeException("Not impl");
}
public IResource findMember(String name, boolean includePhantoms) {
throw new RuntimeException("Not impl");
}
public IResource findMember(IPath path, boolean includePhantoms) {
throw new RuntimeException("Not impl");
}
public String getDefaultCharset() throws CoreException {
throw new RuntimeException("Not impl");
}
public String getDefaultCharset(boolean checkImplicit) throws CoreException {
throw new RuntimeException("Not impl");
}
public IFile getFile(IPath path) {
throw new RuntimeException("Not impl");
}
public IFolder getFolder(IPath path) {
throw new RuntimeException("Not impl");
}
public IResource[] members() throws CoreException {
throw new RuntimeException("Not impl");
}
public IResource[] members(boolean includePhantoms) throws CoreException {
throw new RuntimeException("Not impl");
}
public IResource[] members(int memberFlags) throws CoreException {
throw new RuntimeException("Not impl");
}
public void setDefaultCharset(String charset) throws CoreException {
throw new RuntimeException("Not impl");
}
public void setDefaultCharset(String charset, IProgressMonitor monitor) throws CoreException {
throw new RuntimeException("Not impl");
}
public void accept(IResourceVisitor visitor) throws CoreException {
throw new RuntimeException("Not impl");
}
public void accept(IResourceProxyVisitor visitor, int memberFlags) throws CoreException {
throw new RuntimeException("Not impl");
}
public void accept(IResourceVisitor visitor, int depth, boolean includePhantoms) throws CoreException {
throw new RuntimeException("Not impl");
}
public void accept(IResourceVisitor visitor, int depth, int memberFlags) throws CoreException {
throw new RuntimeException("Not impl");
}
public void clearHistory(IProgressMonitor monitor) throws CoreException {
throw new RuntimeException("Not impl");
}
public void copy(IPath destination, boolean force, IProgressMonitor monitor) throws CoreException {
throw new RuntimeException("Not impl");
}
public void copy(IPath destination, int updateFlags, IProgressMonitor monitor) throws CoreException {
throw new RuntimeException("Not impl");
}
public void copy(IProjectDescription description, boolean force, IProgressMonitor monitor) throws CoreException {
throw new RuntimeException("Not impl");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -