[英]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.