繁体   English   中英

为什么在我的eclipse插件中看不到SWT / JFace TitleAreaDialog中的更改?

[英]Why can't I see Changes in SWT / JFace TitleAreaDialog in my eclipse plugin?

我正在开发一个eclipse插件(不是RCP),并且正在使用Jface和SWT创建它的用户界面。 事实是,我已经下载了WindowBuilder插件以使其更易于开发用户界面,并且创建了自定义的TitleAreaDialog。

到目前为止,一切正常,我可以在WindowBuilder中看到以下TitleAreaDialog(上图),并且当我尝试运行eclipse插件时出现了问题。 该树及其左侧的元素消失了:

WindowBuilder(顶部)和已执行插件(底部)

有人知道发生了什么吗? 我是否必须在plugin.xml或MANIFEST.MF中添加一些内容?

谢谢。

编辑:在zip中,您将找到plugin.xml,MANIFEST.XML,build.properties,Handler和名为PlugiGUI的gui。 如果您有任何问题,请问我。

谢谢。

您可以在此处下载代码。

编辑2:MANIFEST.MF代码的一部分如下

Bundle-SymbolicName: org.eclipse.plugin.arturito;singleton:=true
Require-Bundle: org.eclipse.ui,
 org.eclipse.core.runtime
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
 swing2swt.jar

TitleAreaDialog代码的一部分如下:

/**
* Create contents of the dialog.
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
    //TITLE AND IMAGE OF TitleDialog
                ...

    //Composite        
    Composite area = (Composite) super.createDialogArea(parent);
    Composite container = new Composite(area, SWT.NONE);
    container.setLayout(new FillLayout(SWT.HORIZONTAL));
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    //Creates the division
    SashForm sashForm = new SashForm(container, SWT.NONE);


    //Right division
    Group rightGroup = new Group(sashForm, SWT.NONE);
    rightGroup.setLayout(new StackLayout());

    //Create the tree
    Tree tree = new Tree(rightGroup, SWT.BORDER);
    tree.setLinesVisible(true);
    tree.setToolTipText("");
    tree.setHeaderVisible(true);

    //Create tree elements
    TreeItem pluginProperties = new TreeItem(tree, SWT.NONE);
    pluginProperties.setText("Plugin properties");
    pluginProperties.setImage(ResourceManager.getPluginImage("org.eclipse.plugin.arturito", "icons/arturitoProperties.png"));


    TreeItem createPluginProperties = new TreeItem(pluginProperties, SWT.NONE);
    createPluginProperties.setText("Create");
    createPluginProperties.setImage(ResourceManager.getPluginImage("org.eclipse.plugin.arturito", "icons/arturitoPlus.png"));
    TreeItem editPluginProperties = new TreeItem(pluginProperties, SWT.NONE);
    editPluginProperties.setText("Edit/Delete");
    editPluginProperties.setImage(ResourceManager.getPluginImage("org.eclipse.plugin.arturito", "icons/arturitoRemoveEdit.png"));
    pluginProperties.setExpanded(true);

    //MORE TREE ELEMENTS WITH SAME PATTERN
    ..............

    //Left division
    Group leftGroup = new Group(sashForm, SWT.NONE);
    leftGroup.setLayout(new StackLayout());

    Composite projectConfigDescriptor = new Composite(leftGroup, SWT.NONE);

   //Proportion of sashForm
    sashForm.setWeights(new int[] {220, 469});
    return area;
}

为什么WindowBuilder会像我想要的那样显示TitleDialog而我的插件却不显示?

您已将左右组的布局设置为StackLayout 此布局要求您告诉它哪个控件当前是要显示的顶级控件。 所以你会做:

StackLayout layout = new StackLayout();
rightGroup.setLayout(layout);

... create Tree

layout.topControl = tree;

但是,就目前情况而言,没有必要使用StackLayout因为您仅在每一侧都创建了一个顶级控件。 因此,您可以使用FillLayout

rightGroup.setLayout(new FillLayout());

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM