📄 personpropertysource.java
字号:
package propertypagetest.model;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
public class PersonPropertySource implements IPropertySource
{
private final static String ID_NAME = "NAME";
private final static String ID_IMAGEFILE = "IMAGEFILE";
private final static IPropertyDescriptor[] propDescs;
static
{
propDescs = new IPropertyDescriptor[] {
new TextPropertyDescriptor(ID_NAME, "姓名"),
new FilePropertyDescriptor(ID_IMAGEFILE, "照片") };
}
private Person person;
public PersonPropertySource(Person person)
{
super();
this.person = person;
}
public IPropertyDescriptor[] getPropertyDescriptors()
{
return propDescs;
}
public Object getEditableValue()
{
return null;
}
public Object getPropertyValue(Object id)
{
if (id == ID_NAME)
{
return person.getName();
}
if (id == ID_IMAGEFILE)
{
return person.getImageFile();
}
return null;
}
public boolean isPropertySet(Object id)
{
return false;
}
public void resetPropertyValue(Object id)
{
}
public void setPropertyValue(Object id, Object value)
{
if (id == ID_NAME)
{
person.setName((String) value);
}
if (id == ID_IMAGEFILE)
{
person.setImageFile((String) value);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -