简体   繁体   English

如何解决“导入org.eclipse.wb.swt.SWTResourceManager”

[英]How to resolve “import org.eclipse.wb.swt.SWTResourceManager”

I have a SWT application and it was working fine. 我有一个SWT应用程序,并且运行良好。 I was using Google WindowBuilder Pro to build the application windows. 我使用Google WindowBuilder Pro构建应用程序窗口。 Today I was trying to do some update on my application. 今天,我试图对我的应用程序进行一些更新。 So when I open it I found an error saying " import org.eclipse.wb.swt.SWTResourceManager the import cannot be resolved ". 因此,当我打开它时,发现一个错误,提示“ import org.eclipse.wb.swt.SWTResourceManager the import cannot be resolved ”。 But it was working previously. 但是它以前工作了。 Can anyone tell me what could be the problem? 谁能告诉我可能是什么问题?

I am using Eclipse Helios for the development. 我正在使用Eclipse Helios进行开发。

This helper class is generated inside your project by WindowBuilder as soon as you change for example the font of a label. 一旦更改(例如,标签的字体),WindowBuilder就会在项目内部生成此帮助器类。

The code for the class can also be found by googling for the name, for example here: https://github.com/vogellacompany/codeexamples-java/blob/master/de.vogella.databinding.windowbuilder.example/src/com/swtdesigner/SWTResourceManager.java 也可以通过谷歌搜索名称来找到该类的代码,例如在这里: https : //github.com/vogellacompany/codeexamples-java/blob/master/de.vogella.databinding.windowbuilder.example/src/com /swtdesigner/SWTResourceManager.java

I had the same problem. 我有同样的问题。 The workaround i used was to create a new class (of the same type, in my case SWT Application Window) and copy all the code from the faulty class to the new one. 我使用的解决方法是创建一个新类(在我的情况下为SWT应用程序窗口,类型相同),然后将所有代码从有问题的类复制到新类中。

download the window builder jar file and add it to your project. 下载窗口构建器jar文件并将其添加到您的项目中。 (right click the project, choose properties, and click add variable, then choose the jar file your downloaded) (右键单击该项目,选择属性,然后单击添加变量,然后选择您下载的jar文件)

I had some problem. 我有问题 I tried to find the jar and fix the problem. 我试图找到罐子并解决问题。 But I was not able to locate the jar. 但是我无法找到罐子。 Instead I found the source in this link downloaded and put in same package structure in my project. 相反,我发现此链接中的源代码已下载并放入我的项目中的相同程序包结构中。

It work for me, Download the source from below link : 它对我有用,请从下面的链接下载源:
http://grepcode.com/file_/repo1.maven.org/maven2/org.beanfabrics/beanfabrics-swt/1.4.0/com/swtdesigner/SWTResourceManager.java/?v=source&disposition=attachment http://grepcode.com/file_/repo1.maven.org/maven2/org.beanfabrics/beanfabrics-swt/1.4.0/com/swtdesigner/SWTResourceManager.java/?v=source&disposition=attachment

Hope it may be help full for other also. 希望对其他人也有帮助。

There is jar files in internet. 互联网上有jar文件。 But I having problem with those. 但是我对此有疑问。 What I did to solve this, 我为解决这个问题所做的事情

download the SWTResourceManager java file from the github- click this . github下载SWTResourceManager Java文件- 单击this Then I edit some lines, those are: 然后,我编辑一些行,它们是:

  1. In SWTResourceManager.java file, change package org.eclipse.wb.swt; SWTResourceManager.java文件中,更改package org.eclipse.wb.swt; ;。 to your package name. 您的包裹名称。
  2. And in whatever.java your java file you are going to use that library, remove import org.eclipse.wb.swt.SWTResourceManager; 而在whatever.java你的java文件,你要使用该库,取出import org.eclipse.wb.swt.SWTResourceManager; this line or change to your package. 此行或更改您的包裹。

Now you good to go.. 现在你可以走了..

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

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