为什么我在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插件时,问题就出现了。 树的左侧元素消失了:
有人知道发生了什么吗? 我必须添加一些东西到plugin.xml或MANIFEST.MF吗?
谢谢。
编辑:在zip中你会发现plugin.xml,MANIFEST.XML,build.properties,Handler和gui,称为PlugiGUI。 如果您有任何问题请问我。
谢谢。
编辑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而我的插件不是?
I am developing an eclipse plugin (not RCP) and I am using Jface and SWT to create it´s user interface. 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.
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. The tree and it´s elements of the left side disappear:
WindowBuilder (top) and Plugin executed (bottom)
Does anybody know what is happening? Do I have to add something to plugin.xml or MANIFEST.MF?
Thank you.
EDIT: In the zip you will find the plugin.xml, MANIFEST.XML, build.properties, Handler and the gui called PlugiGUI. 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
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:
/** * 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?
原文:https://stackoverflow.com/questions/39770275
最满意答案
我认为问题在这里
p.PlayerGameRole = player.PlayerGameRole
尝试显式创建集合并添加元素:
p.PlayerGameRole = new List<PlayerGameRole>(); foreach(var role in player.PlayerGameRole) { p.PlayerGameRole.Add(role); }
I think problem is here
p.PlayerGameRole = player.PlayerGameRole
try to create collection explicitly and add elements:
p.PlayerGameRole = new List<PlayerGameRole>(); foreach(var role in player.PlayerGameRole) { p.PlayerGameRole.Add(role); }
相关问答
更多-
这里最终的问题不是使用哪种对象关系映射器(ORM) ,而是最终使用哪种映射器。 这个特定的层通常交织在数据访问层(DAL)中 。 您看到这里的函数本质上是一种在不兼容类型之间进行转换的技术。 本质上它创建了一个可以使用的虚拟对象数据库 。 此层的重要性在于将您的域逻辑/业务层链接到您的数据访问层或对象关系映射器 。 这基本上可以帮助解耦不需要访问数据结构的逻辑 - 这使得用户界面,域逻辑和数据访问层之间的解耦更加连贯。 接口不知道数据层如何与数据结构对话。 目前,由于相似性,我一直在混合数据访问层和对象关系 ...
-
查看SQL Management Objects(SMO),它是由microsoft开发的一个库,用于通过托管代码在SQL Server数据库上执行管理任务。 它包括脚本数据库及其中的对象的代码,这些代码应满足您的大部分应用程序需求 Take a look into SQL Management Objects (SMO), its a library developed by microsoft for performing management tasks on SQL server databases ...
-
如果CSV仅用于缓存结果,则可以使用Dictionary来存储搜索结果的内容。 将代码分成函数可能会有所帮助: private static object GetFirstValue(ResultPropertyCollection properties, string propertyName) { var propertyValues = properties[propertyName]; var resul ...
-
您可以使用它将货币符号的字符串转换为十进制: var num = decimal.Parse("$25,529.98", NumberStyles.Currency); 如果您需要/想要,您也可以传递文化: var cultureInfo = new System.Globalization.CultureInfo("en-US"); var num = decimal.Parse("$25,529.98", NumberStyles.Currency, cultureInfo); You can us ...
-
您不应为每个“导出任务”使用单独的会话/连接。 每次登录数据库都会导致非必要的操作(如写入数据库日志),这会降低整个应用程序的速度。 如果您期望连接问题 - 请使用try-catch并处理数据库异常,并在连接断开时重新连接。 You shall not use separate sessions/connections for each "export task". Each login to database will cause non-necessary operations (like writes ...
-
我认为问题在这里 p.PlayerGameRole = player.PlayerGameRole 尝试显式创建集合并添加元素: p.PlayerGameRole = new List
(); foreach(var role in player.PlayerGameRole) { p.PlayerGameRole.Add(role); } I think problem is here p.PlayerGameRole = player.PlayerGameRole t ... -
对象数据库和C#(Object Databases and C#)[2023-08-05]
尝试http://www.db4o.com/ 这是oo数据库列表以及比较图表 。 Try http://www.db4o.com/ Here's a list of oo databases and also a comparison chart. -
看看DateTime.Parse()方法。 编辑:我想您使用SqlCommand ,然后您只需将生成的c# DateTime对象添加到Parameters集合中。 Have a look at the DateTime.Parse() method. Edit: I suppose you use the SqlCommand, then you just add the resulting c# DateTime object to the Parameters collection.
-
听起来你在谈论ORM 。 您可能想要查看Castle ActiveRecord (它是基于nHibernate构建的)。 如果您使用的是.NET 3.5或4.0,则也可以使用.NET实体框架 。 就个人而言,我更喜欢ActiveRecord,因为我喜欢能够使用代码中的属性来定义映射。 实体框架使用映射XML文件(可以使用Visual Studio的GUI设计器进行修改),我发现它有点笨重(EF专家可能会在这里首先讨论代码。)此外,实体框架非常LINQ重,这是很棒,如果你喜欢LINQ。 ActiveRecor ...
-
如果您在连接字符串中使用AttachDbFileName=子句,那么您可能已成为一个众所周知的问题的受害者:在检查数据时,您可能只是在查看错误的数据库(文件) 。 在Visual Studio中运行应用程序时,它将复制.mdf文件(从您的App_Data目录到输出目录 - 通常是.\bin\debug - 您运行应用程序的位置),而且很可能您的INSERT工作正常 - 但你最后只是看错了.mdf文件 ! 如果你想坚持这种方法,那么尝试在connection.Close()调用上设置一个断点 - 然后用SQL ...