简体   繁体   English

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

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

I am developing an eclipse plugin (not RCP) and I am using Jface and SWT to create it´s user interface. 我正在开发一个eclipse插件(不是RCP),并且正在使用Jface和SWT创建它的用户界面。 The fact is that I have downloaded the WindowBuilder plugin to make it easier to develop the user interface and I have created a custom TitleAreaDialog. 事实是,我已经下载了WindowBuilder插件以使其更易于开发用户界面,并且创建了自定义的TitleAreaDialog。

Up to this point everything goes ok and I can see the following TitleAreaDialog in the WindowBuilder (top image) and the problem comes when I try to run the eclipse plugin. 到目前为止,一切正常,我可以在WindowBuilder中看到以下TitleAreaDialog(上图),并且当我尝试运行eclipse插件时出现了问题。 The tree and it´s elements of the left side disappear: 该树及其左侧的元素消失了:

WindowBuilder (top) and Plugin executed (bottom) WindowBuilder(顶部)和已执行插件(底部)

Does anybody know what is happening? 有人知道发生了什么吗? Do I have to add something to plugin.xml or MANIFEST.MF? 我是否必须在plugin.xml或MANIFEST.MF中添加一些内容?

Thank you. 谢谢。

EDIT: In the zip you will find the plugin.xml, MANIFEST.XML, build.properties, Handler and the gui called PlugiGUI. 编辑:在zip中,您将找到plugin.xml,MANIFEST.XML,build.properties,Handler和名为PlugiGUI的gui。 If you have any questions ask me please. 如果您有任何问题,请问我。

Thank you. 谢谢。

You can download the code here. 您可以在此处下载代码。

EDIT 2: Part of the MANIFEST.MF code is the following 编辑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

Part of the TitleAreaDialog code is the following: 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;
}

Why does the WindowBuilder show the TitleDialog like I want and my plugin doesn´t? 为什么WindowBuilder会像我想要的那样显示TitleDialog而我的插件却不显示?

You have the layout for your left and right groups set as StackLayout . 您已将左右组的布局设置为StackLayout This layout requires that you tell it which control is currently the top control to show. 此布局要求您告诉它哪个控件当前是要显示的顶级控件。 So you would do: 所以你会做:

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

... create Tree

layout.topControl = tree;

However as it stands there is no reason to use StackLayout as you are only creating one top level control on each side. 但是,就目前情况而言,没有必要使用StackLayout因为您仅在每一侧都创建了一个顶级控件。 So you could just use FillLayout : 因此,您可以使用FillLayout

rightGroup.setLayout(new FillLayout());

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

相关问题 不创建插件就不能在eclipse中使用JFace和SWT - Can't use JFace and SWT in eclipse without creating plugin 在jface / swt-eclipse插件开发中的treeviewer中单击标签时,如何跳到编辑器中的特定行 - how can i jump to a specific line in an editor when click a label in the treeviewer in jface/swt-eclipse plugin development 为什么在“位置”标签中看不到任何更改 - Why can't I see any changes in my “Place” tab SWT / JFace还是Eclipse RCP? - SWT/JFace or Eclipse RCP? 为什么我看不到我的项目中的更改,但我在 fxml 文件中看到了它们? - Why can't I see the changes in my project but I see them in the fxml file? 我在Jface罐子和字段SWT.PaintItem中找不到类OwnerDrawLabelProvider - I can't find class OwnerDrawLabelProvider in Jface jars and field SWT.PaintItem 为什么我在Eclipse更新站点中看不到新功能? - Why can't I see new features in my Eclipse update site? 为什么我不能从Windows中的CD上删除文件到Eclipse / SWT Drop Target - Why can't I drop files on to Eclipse / SWT Drop Target from a CD in windows Eclipse JFace如何动态添加SWT视图 - Eclipse JFace how to dynamically add SWT view 如何在Eclipse中获取JavaDoc for SWT和JFace? - How to get JavaDoc for SWT and JFace in Eclipse?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM