I'm creating a plugin project that will have a menu and toolbar item, that when clicked, will open a dialog for user interaction (input, searching, etc.). Should I create the dialog using SWT or Swing?
-
it's for the integration of Code Barrel (www.codebarrel.com) into Eclipse. we've got the Visual Studio plugin created and the Eclipse one is next. i'm in the gathering info stage right now on how to best develop the plugin. – Rockie Jul 07 '10 at 16:55
4 Answers
One advantage of doing it in Swing is that you don't have to supply any other libraries, because Swing is part of JRE. With SWT you have to do it and you have to have separate dlls for specific platforms. UPDATE: Since you mentioned that you have to create Eclipse plugin, I think you have a clear choice here - SWT. It is what Eclipse is based on.

- 17,131
- 3
- 38
- 60
SWT.
Debate over the merits of Swing and SWT is irrelevant. Your plug-in will integrate with a platform built on SWT. Using the same user-interface toolkit will simplify your development and testing, and produce better results.
There are cases where it's useful to use Swing within Eclipse, such as when you have an existing codebase that would be impractical to port. There is an SWT/AWT bridge; I have not used it.

- 84,978
- 11
- 107
- 151
-
I have built an Eclipse plugin with Swing and regretted the decision due to the exceptions in SWT and Swing being different. Made it very hard to troubleshoot problems. – Mishax Apr 27 '15 at 14:47
-
@Mishax - A few years after writing this answer, I tried bringing in just a 2D visualization panel based on Swing. I used the SWT/AWT bridge, with an additional layer provided at http://www.eclipse.org/articles/article.php?file=Article-Swing-SWT-Integration/index.html . Interaction between the two UI toolkits still had some user-visible rough edges. Some rough edges were not visible on all operating systems. I ended up writing my own visualization in Eclipse Draw2D. For me, there would have to be a compelling reason to consider use of a Swing-based component in an SWT application. – Andy Thomas Apr 27 '15 at 15:09
Like @eugener, I prefer Swing to SWT, but both are rich, well-maintained frameworks that will serve the purpose. NetBeans and Eclipse are widely used exemplars. SWT binaries for popular platforms aren't too hard to integrate. The SWT FAQ may offer some perspective.
Since you're integrating Code Barrel into Eclipse, and SWT is part of the Eclipse project...
Actually, you should be looking at the Eclipse Plug-in Architecture and see how it works.

- 87,612
- 17
- 125
- 175
-
If this is a Eclipse plugin then you better use SWT. As an Eclipse user I absolutely deplore a plugin that uses Swing because it doesn't look like the rest of the app. Also you will want to look at other plugins (especially the ones that are part of the Eclipse platform) because you will find abstract dialog classes that do most of the work for you and will help your plugin look like it belongs in Eclipse. Deep integration is key to make sure your plugin is worth installing. – rancidfishbreath Jul 07 '10 at 18:21