Bug 240705 - [build path] SWT Library
Summary: [build path] SWT Library
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: All All
: P5 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 181741 (view as bug list)
Depends on: 236719
Blocks:
  Show dependency tree
 
Reported: 2008-07-14 13:51 EDT by Ralph Bergmann CLA
Modified: 2011-07-15 17:35 EDT (History)
8 users (show)

See Also:


Attachments
SWT library on Eclipse 3.2 (98.24 KB, image/png)
2008-08-14 20:25 EDT, Ralph Bergmann CLA
no flags Details
first shot (8.42 KB, patch)
2008-08-18 19:53 EDT, Benjamin Muskalla CLA
daniel_megert: review-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Bergmann CLA 2008-07-14 13:51:45 EDT
Build ID: I20080617-2000

Steps To Reproduce:
Pleas add a SWT-Library tu JDT.

With the old Visal Editor came a SWT Library. But now, without VisualEditor... Please add this Library so I can easy a the needed JAR to my projects.

Ralph

More information:
Comment 1 Jerome Lanneluc CLA 2008-08-14 06:37:50 EDT
This certainly doesn't belong to JDT/Core that doesn't know about SWT. This sounds more like an opportunity for a third-party plugin. 
Comment 2 Benjamin Muskalla CLA 2008-08-14 19:36:34 EDT
Jerome, please consider reopening this,
I think what Ralph meant was a classPathContainer for SWT as we already have one for JUnit.
With the SWT templates in place in JDT/UI it would make much sense to have a SWT container in place. It would also help new developers to easily add SWT as dependency to plain Java projects.
I just hacked something together and it works just fine.
Please consider moving this to JDT/UI and if there is interest I would be glad to contribute a clean implementation for this.
Comment 3 Ralph Bergmann CLA 2008-08-14 20:25:43 EDT
Created attachment 110056 [details]
SWT library on Eclipse 3.2
Comment 4 Ralph Bergmann CLA 2008-08-14 20:27:28 EDT
(In reply to comment #2)
> Jerome, please consider reopening this,
> I think what Ralph meant was a classPathContainer for SWT as we already have
> one for JUnit.

Sorry but I don't know how it is called :-(

With the old VisulaEditor came a Library "Standrad Widget Toolkit (SWT)" (see
atached pic) and with one click I can add SWT (and JFace support) to my
projects.

Now, without VE I must add this jar files manually.

But with this library I can add realy easy SWT and JFace support to my projects
withou knowing witch jar files I need. And I can upload this setting to cvs and
it works on all other machins no matter where the jar files are.
Comment 5 Jerome Lanneluc CLA 2008-08-18 04:51:41 EDT
Reopening to move to JDT/UI for consideration.
Comment 6 Jerome Lanneluc CLA 2008-08-18 04:54:10 EDT
Moving to JDT/UI
Comment 7 Dani Megert CLA 2008-08-18 05:34:09 EDT
Note that it's almost as easy:
1. import SWT bundle and fragment
2. either start to write SWT code and then use the quick fix to setup the Java 
   build path or manually att the SWT project (or library) to your own project
Comment 8 Benjamin Muskalla CLA 2008-08-18 05:42:45 EDT
Dani, personally I don't have a problem with the current situation.
But thinking of new users it's often hard for them to setup a simple SWT-based project as you need to know the tricks, where SWT lives, etc.
And for new users it's really easy to just hit the "Add Library" button and select SWT. I often need to help new developers to just create a simple project and select the right jars of SWT. I think this would be a great addition regarding usability because it's intuitive. And does not cost much effort to achieve this goal.
Comment 9 Dani Megert CLA 2008-08-18 06:12:41 EDT
>But thinking of new users it's often hard for them to setup 
You don't need my steps. You can just go to http://www.eclipse.org/swt/, get the library and then it is as simple as adding any library.

>And does not cost much effort to achieve this goal.
We need to make sure that attaching source works from release to release.
Comment 10 Dani Megert CLA 2008-08-18 07:09:48 EDT
>And does not cost much effort to achieve this goal.
Feel free to provide a patch but keep in mind that JDT does not depend on PDE and hence the patch must not internally apply corresponding logic. Also, it need to handle the SWT fragments correctly.

Regarding source attachment see bug 236719.
Comment 11 Benjamin Muskalla CLA 2008-08-18 07:14:38 EDT
Thanks for the hints Dani.
I'll try to provide a high quality patch when time permits.
Comment 12 Benjamin Muskalla CLA 2008-08-18 19:53:17 EDT
Created attachment 110303 [details]
first shot

Here is a real basic implementation of a SWT Classpath Container.

There are several important things missing like
* property page
* request handling for cp attribute changes
* multiple swt versions
* much more :)

Just wanted to attach a patch to show what I mean as it makes it really easy for non-plugin devs to include swt in their project. Patch has also not yet high quality (missing externalized strings, etc). It's just a base to discuss.

I would really like to extend to patch to have a ready-to-commit version. Just wanted to know if this would be in the interest of the JDT team or if it's just a waste of time and effort.
Comment 13 Dani Megert CLA 2008-08-19 02:30:40 EDT
We are interested but as said the code not only needs to work in the simple case but also in more complex scenarios. For example there might be more than one version and/or OS drop installed. While this is easy to solve for JUnit where we have either have 3.8.3 or 4.4 (and manually update the container code if the version increments) it might be harder to solve for SWT. Other issues to solve are:
- should it update when restarting on a newer drop, e.g. if I first start with 3.4
  and then 3.5?
- do we really only need SWT or maybe also JFace? If so, do we eventually need a
  more generic container?
- sharing via repository needs to work
Comment 14 Dani Megert CLA 2008-08-25 02:50:39 EDT
*** Bug 181741 has been marked as a duplicate of this bug. ***
Comment 15 Sven Köhler CLA 2011-07-15 12:40:38 EDT
The following is about WindowBuilder, but it is cetainly related:

So Google kindly contributed WindowBuilder. When creating an SWT project, WindowBuilder creates a new Java Project, and adds many JARs from Eclipse's plugins dir to the build path. For that, it uses the absolute path which renders the project files unsharable between project members. Not sure, what happens when SWT is updated. Probably, the paths become invalid - or probably not since Eclipse never deleted any JAR files after an update.

While I understand your concerns, and while I understand that you'd like to see a solution better than a plain simple library container, the solution that windowbuilder implements is far worse then that.

Don't procrastinate: offer a simpliest most possible library container now, then later implement advanced features (like having the possibility to switch between SWT versions and stuff).
Comment 16 Markus Keller CLA 2011-07-15 16:47:33 EDT
The best solution that is already available today is to use PDE and create a "Plug-in Project" with org.eclipse.swt added as dependency.

That takes care of all sharing issues (since the target platform already contains the right SWT), and OSGi also helps managing more dependencies once the project grows.

Moreover, a special case just for SWT would not give a good example. By the same argument, we could also have special containers for JFace, Lucene, Jetty, ... .
Comment 17 Sven Köhler CLA 2011-07-15 17:35:46 EDT
(In reply to comment #16)
> The best solution that is already available today is to use PDE and create a
> "Plug-in Project" with org.eclipse.swt added as dependency.

IMHO this is an abuse of a plug-in project (which is for developing plug-ins, not standalone Java applications). But a library container that allows you to add plugins as a dependency to ordinary Java projects is probably a good idea. 

> Moreover, a special case just for SWT would not give a good example. By the
> same argument, we could also have special containers for JFace, Lucene, Jetty,
> ... .

I agree. You can probably add JUnit to the list. However, I don't want to be the one explaining why you have to create a plug-in project to develop a SWT application.

Bottom line is, that an improvement of the practice of WindowBuilder (and I hope you understand or probably even share my ciricism) is needed and depends on whatever you come up with to resolve this report.