patheditorinput.java
来自「mywork是rcp开发的很好的例子」· Java 代码 · 共 53 行
JAVA
53 行
/**
*
*/
package net.sf.freenote;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IPathEditorInput;
import org.eclipse.ui.IPersistableElement;
/**
* 基于文件路径的editorinput
* @author levin
* @since 2008-1-26 下午07:28:14
*/
public class PathEditorInput implements IPathEditorInput{
private IPath path;
public PathEditorInput(IPath path) {
super();
this.path = path;
}
public IPath getPath() {
return path;
}
public boolean exists() {
return path.toFile().exists();
}
public ImageDescriptor getImageDescriptor() {
return null;
}
public String getName() {
return path.toString();
}
public IPersistableElement getPersistable() {
return null;
}
public String getToolTipText() {
return path.toString();
}
public Object getAdapter(Class adapter) {
return null;
}
@Override
public boolean equals(Object obj) {
if(obj instanceof PathEditorInput && path != null){
return path.equals(((PathEditorInput)obj).getPath());
}
return super.equals(obj);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?