|
|
|
Re: [EMF Forms] Redraw custom control [message #1709116 is a reply to message #1709026] |
Thu, 24 September 2015 07:39 |
Jonas Helming Messages: 699 Registered: July 2009 |
Senior Member |
|
|
Hi Tobias,
I wonder how you bind the value to the label. I guess you just call
setText somewhere? This code will not be re-executed on a redraw of the
composite. I suggest you bind the label to the value using either
databinding (prefered) or another listener mechanism.
About the red cross: This is the standard Editor provided by ECP. If you
want to adapt this, you should implement your own editor.
To do that, have a look at the class MEEditor in
"org.eclipse.emf.ecp.editor.e3", it implements the editor itself and
internally it adds a "MEEditorPage", which adds the delete action.
After you have implemented your custom editor, you should implement an
ModelElementOpener to replace the existing one, see
http://eclipsesource.com/blogs/tutorials/tutorialshow-to-customize-the-emf-client-platform/#replaceeditor
As a template, have a look at the current ModelElementOpener:
"EditorModelElementOpener" in "org.eclipse.emf.ecp.explorereditorbridge"
Best regards
Jonas
Am 23.09.2015 um 13:49 schrieb Tobias Zangl:
> Hey Jonas,
>
> Thanks for your fast response (as always)! :)
>
> My code looks something like this:
>
> @Override
> public Control renderControl(SWTGridCell cell, Composite parent)
> throws NoRendererFoundException, NoPropertyDescriptorFoundExeption {
>
> Composite composite = new Composite(parent, SWT.NONE);
>
> final Composite finalParent = parent;
>
> Button refresh = new Button(composite, SWT.PUSH);
> refresh.setText("Refresh");
> refresh.addSelectionListener(new SelectionAdapter() {
> public void widgetSelected(SelectionEvent e) {
> ...
> /*composite.layout();
> finalParent.pack();
> finalParent.layout();*/
> }
> });
> ..
>
>
> I tried calling different methods on parent, finalParent and composite but it did not work. I had an instance integer variable which i incremented and rendered as a label but it did not get updated.
>
> Usecase:
> I have a rather complex custom control with an arbitrary amount of tables with input and depending on data which is calculated in the refresh method the amount of tables and their content changes thus i have to redraw the whole view. I know there might be better approaches with content provider but at the moment i just want to get it to work.. :?
>
>
> Red X:
> Have a look at the attached image. It looks a little bit like it closes the view but it removes the model element and in my case the removing should not be possible for some model elements.
>
> Greetings,
> Tobi
>
--
--
Jonas Helming
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
|
Powered by
FUDForum. Page generated in 0.03025 seconds