【发布时间】:2017-02-07 18:40:10
【问题描述】:
我正在开发一个 Eclipse 插件(不是 RCP),我正在使用 Jface 和 SWT 创建它的用户界面。事实上,我已经下载了 WindowBuilder 插件,以便更轻松地开发用户界面,并且我已经创建了一个自定义 TitleAreaDialog。
到目前为止一切正常,我可以在 WindowBuilder(顶部图像)中看到以下 TitleAreaDialog,当我尝试运行 eclipse 插件时出现问题。树及其左侧的元素消失了:
WindowBuilder (top) and Plugin executed (bottom)
有人知道发生了什么吗?我是否必须在 plugin.xml 或 MANIFEST.MF 中添加一些内容?
谢谢。
编辑: 在 zip 中,您将找到 plugin.xml、MANIFEST.XML、build.properties、Handler 和名为 PlugiGUI 的 gui。有什么问题可以问我。
谢谢。
You can download the code here.
编辑 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 而我的插件却没有?
【问题讨论】:
-
你必须向我们展示代码。
-
已添加代码。我需要像运行配置一样创建一个 TitleAreaDialog,但正如您所见,我不知道什么不起作用。
-
代码必须在问题中。 Stack Overflow 上的问题旨在帮助其他人以及您,如果链接的代码在某个时候被删除,那么问题将变得毫无用处。给我们看一个minimal reproducible example(至少是TitleAreaDialog)。
-
好的,现在代码已经添加。你知道那会是什么吗?它发生在不止一个组件上,我很困惑。
标签: java eclipse plugins swt jface