IProject尽管它没有实现,但我已经成功地将一个属性添加到现有的中IPropertySource(因此可以通过继承和覆盖getPropertyDescriptorsandgetPropertyValue方法来添加一些功能。
多亏了 greg-449,我才能够理解StandardPropertiesAdapterFactory由(that extends )组成ResourcePropertySource的功能IProjectIResource
因此,解决所有这些问题的一种方法是使用 的子类AdvancedPropertySection来显示IProject的属性...
这是kewd:
我将ProjectExplorer的视图 ID 与TabDescriptorProviderin链接plugin.xml:
<extension point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
      <propertyContributor
            contributorId="org.eclipse.ui.navigator.ProjectExplorer"
            tabDescriptorProvider="eb.tresos.bustools.connection.extraproperty.TabDescriptorProvider">
         <propertyCategory
               category="tabbedCategory">
         </propertyCategory>
      </propertyContributor>
   </extension>
之后,我们定义TabDescriptorProvider,并将其链接到我们的 custom AdvancedPropertySection:
public class TabDescriptorProvider implements ITabDescriptorProvider {
    @Override
    public ITabDescriptor[] getTabDescriptors( IWorkbenchPart part, ISelection selection ) {
        AbstractTabDescriptor[] tabs = new AbstractTabDescriptor[1];
        tabs[0] = new TabDescriptor("Aww shucks, TabDescriptorTitle");
        return tabs;
    }
    class TabDescriptor extends AbstractTabDescriptor {
        String label;
        /**
         * Constructor
         * 
         * @param label sets the label text of the tab
         */
        TabDescriptor( String label ) {
            this.label = label;
        }
        @SuppressWarnings("rawtypes")
        @Override
        public List getSectionDescriptors() {
            List<SectionDescriptor> sList = new ArrayList<SectionDescriptor>();
            sList.add( new SectionDescriptor( label ) );
            return sList;
        }
        @Override
        public String getCategory() {
            //Stub
            return "";
        }
        @Override
        public String getId() {
            //stub
            return "";
        }
        @Override
        public String getLabel() {
            return "Resource";
        }
    }
    class SectionDescriptor extends AbstractSectionDescriptor {
        String section;
        List<AbstractPropertySection> sectionTabs = new ArrayList<AbstractPropertySection>();
        public SectionDescriptor( String section ) {
            this.section = section;
        }
        /**
         * SectionId
         */
        @Override
        public String getId() {
            //stub
            return "";
        }
        /**
         * SectionClass
         */
        @Override
        public ISection getSectionClass() {
            return new AuxiliaryProjectSection();
        }
        /**
         * SectionTab
         */
        @Override
        public String getTargetTab() {
            //stub
            return "";
        }
    }
}
而它Section本身:
public class AuxiliaryProjectSection extends AdvancedPropertySection {
    @Override
    public void setInput(IWorkbenchPart part, ISelection selection) {
        if (selection instanceof StructuredSelection) {
            Object firstElement = ((StructuredSelection)selection).getFirstElement();
            if (firstElement instanceof IProject) {
                final IProject theProject = (IProject) firstElement;
                ISelection selection2 = new StructuredSelection(new ResourcePropertySource(theProject) {
                    @Override
                    public IPropertyDescriptor[] getPropertyDescriptors() {
                        ArrayList<IPropertyDescriptor>  arrayList = new ArrayList<IPropertyDescriptor>();
                        IPropertyDescriptor[] array = {new PropertyDescriptor("ID-ul", "Labelul")};
                        arrayList.addAll(Arrays.asList(super.getPropertyDescriptors()));
                        arrayList.addAll(Arrays.asList(array));
                        return arrayList.toArray(new IPropertyDescriptor[0]);
                    }
                    @Override
                    public Object getPropertyValue(Object id) {
                        if (id.equals("ID-ul"))
                            return "Silly Value";
                        else
                            return super.getPropertyValue(id);
                    }
                });
                super.setInput(part, selection2); 
            } else {
                super.setInput(part, selection);
            }
        }
    }
}
再次感谢,格雷格!