WorkbenchLabelProvider [message #634076] |
Wed, 20 October 2010 13:11 |
|
Hi folks,
I'm currently doing my first steps in e4 application developement.
I associated the model part with my POJO class and everything
works quit well until now.
I want to use a JFace TreeViewer combined with a WorkbenchLabelProvider
that provides labels for adaptable objects.
The problem is that instanciating this LabelProvider fails with an
Exception:
....
Caused by: java.lang.IllegalStateException: Workbench has not been
created yet.
at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:92)
at
org.eclipse.ui.model.WorkbenchLabelProvider.<init>(WorkbenchLabelProvider.java:76)
My code:
@PostConstruct
public void buildUI() {
....
viewer = new TreeViewer(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
Platform.getAdapterManager().registerAdapters(adapterFactory ,MyNode.class);
viewer.setLabelProvider(new WorkbenchLabelProvider()); // fails
viewer.setContentProvider(new BaseWorkbenchContentProvider());
viewer.setInput(rootNode);
....
}
I will be happy about any suggestions, how to solve this issue the
e4-ish way. :-)
TIA,
Jens
|
|
|
|
Re: WorkbenchLabelProvider [message #634107 is a reply to message #634084] |
Wed, 20 October 2010 14:18 |
|
Hi Tom,
Thank you very much for your fast reply. Since I'm starting a new
project I would prefer to write a native e4 application rather than
using downward compatibility stuff.
Are there some rules of thumb which parts of the old RCP API should
be avoided?
To get the TreeViewer running do I have to use some kind of
adapter service? Is there a new LabelProvider that handles different
types of input objects?
Jens
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.46481 seconds