Java 我的Eclipse4应用程序中没有显示自定义小部件

Java 我的Eclipse4应用程序中没有显示自定义小部件,java,eclipse,eclipse-plugin,swt,eclipse-rcp,Java,Eclipse,Eclipse Plugin,Swt,Eclipse Rcp,我正在尝试使用由提供的小部件。 我正在做以下工作: @PostConstruct public void createControls(Composite parent){ System.out.println("PROP3"); parent.setLayout(new GridLayout(1, false)); Composite propertyContainer = new Composite(parent, SWT.NONE);

我正在尝试使用由提供的小部件。
我正在做以下工作:

@PostConstruct  
public void createControls(Composite parent){  
   System.out.println("PROP3");  

   parent.setLayout(new GridLayout(1, false));        
   Composite propertyContainer = new Composite(parent, SWT.NONE);  
   propertyContainer.setLayout(new GridLayout(1, false));  

   GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true);  
   propertyContainer.setLayoutData(gd);  

   propertyTable = new PropertyTable(propertyContainer, SWT.NONE);  
   propertyTable.showButtons();  
   propertyTable.viewAsCategories();  

   propertyTable.addProperty(new PTProperty("id", "Identifier", "Description for identifier", "My id")).setCategory("General");  

   propertyTable.addProperty(new PTProperty("text", "Description", "Description for the description field", "blahblah...")).setCategory("General");         

}  

@Focus  
private boolean setFocus(){  
   return true;  
}  
代码与
部分关联,它运行并且与其他小部件没有问题,但是
属性表不显示。
创建
属性表
的代码来自它们的。

我在这里搞砸了什么,而
属性表
没有显示?

您(通常)需要使用
网格布局
在组合下的任何控件上设置布局数据
TabFolder
s使用自己的布局,不需要任何布局数据。

我不确定这是什么原因,但您没有在
属性表上设置任何布局数据。
@AlexeyRomanov:您说得对!这就解决了问题。把它作为一个答案,我会把它标记为已接受。顺便问一下,你知道为什么在他们的教程片段中使用
选项卡
他们不需要将数据设置为
属性表
,但它仍然有效吗?@Cratylus我要补充的是,如果适用,setFocus()应该将焦点放在适当的小部件中,否则,单击“零件”选项卡可能无法将键盘焦点置于视图中。@PaulWebster:谢谢您的提示!非常感谢!!!