zoukankan      html  css  js  c++  java
  • 自己订制gmf中属性编辑器

    在gmf中属性页的支持是由PropertyProvider完成的。自动生成的PropertyProvider只有三个方法:
    public boolean provides(IOperation operation) {
    ……
    }


    public ICompositePropertySource 
    ……
    }

    protected EObject getSemanticElement(Object object) {
    ……
    }

    第一个方法主要是判断这个provider是否可以处理某个operation.
    第二个方法返回一个PropertySource,和传统的eclipse PropertySource相似
    第三个方法返回View对应的semantic model
    要想定置自己的属性编辑器可以重载GenericEMFPropertiesProvider里面的
    protected ICompositePropertySource createPropertySource(Object object,
                IItemPropertySource itemPropertySource) 
    {
    ……
    }
    方法,这个方法返回一个你自己重载的EMFCompositePropertySource对象,在你的EMFCompositePropertySource对象中你需要重载方法:
    protected IPropertyDescriptor newPropertyDescriptor(
                        IItemPropertyDescriptor itemPropertyDescriptor) 
    {
    ……
    }
    这个方法中返回一个自己订制的EMFCompositeSourcePropertyDescriptor对象,在你的对象中,你需要重载其中的:
    protected CellEditor doCreateEditor(Composite composite) {
    ……
    }
    方法。在EMFCompositeSourcePropertyDescriptor类中有方法getFeature()可以获得这个PropertyDescriptor对应的属性值,可以通过判断这个属性值的类型来返回你自己的celleditor。
  • 相关阅读:
    JAVA中线程池启动定时任务
    JAVA线程池的创建
    JAVA多线程售票问题
    设计模式之一 ---单例模式
    JAVAWeb使用POI做导出Excel
    ThreadLocal实现线程范围内共享
    线程的互斥与同步通信
    Spring-task-timer定时器
    万年历---java版
    linux sed 批量替换字符串
  • 原文地址:https://www.cnblogs.com/youngerbaby/p/383465.html
Copyright © 2011-2022 走看看