Open a properties Dialog from a custom widget [message #1806912] |
Fri, 17 May 2019 13:45 |
Michael C Messages: 53 Registered: April 2019 |
Member |
|
|
Hello, in my .odesign I found a way to show a properties dialog when I double click on an element of a list in a properties widget.
I have a custom widget table based on the example on the documentation.
I would like to get the same comportment with my custom widget as the one I have with the reference widget.
I guess I should define an advance custom widget and also define a custom operation.
Thanks
[Updated on: Fri, 17 May 2019 13:47] Report message to a moderator
|
|
|
|
Re: Open a properties Dialog from a custom widget [message #1807065 is a reply to message #1806983] |
Wed, 22 May 2019 06:40 |
Michael C Messages: 53 Registered: April 2019 |
Member |
|
|
Hello Pierre, thanks for you answer.
Well I would like to be able to double click on an element of the custom table widget and show the properties of that element in a Properties Dialog, same comportment as the reference widget that I have attached to my message.
I guess if I could find a way to start a "begin operation" in the odesign inside my custom widget I would be able to do the same thing.
I noticed that you can have a "custom operation" inside the custom widget and then a "begin operation", is that how I should do it ?
[Updated on: Wed, 22 May 2019 06:41] Report message to a moderator
|
|
|
|
|
|
|
|
Re: Open a properties Dialog from a custom widget [message #1807174 is a reply to message #1807143] |
Fri, 24 May 2019 06:36 |
Michael C Messages: 53 Registered: April 2019 |
Member |
|
|
Hello,
I tried to :
copy the begin block from the reference widget under the custom operation
I tried to only put an "Open dialogue" after the begin block
Use "Change context" after the begin block and call a Java Service that print the var
Every time, it does nothing.
So I tried to print the values of the handleClick method of TableController and they all return something.
For the line EvalFactory.of(this.interpreter, variables).call(onClickExpression);
the variables "variables" contains self, selection & input with valid self & selection. The variable input print org.eclipse.sirius.properties.core.api.SiriusInputDescriptor@5219c202
I don't have any errors, even if I put the instruction in a try catch block.
[Updated on: Fri, 24 May 2019 06:37] Report message to a moderator
|
|
|
|
Re: Open a properties Dialog from a custom widget [message #1807747 is a reply to message #1807263] |
Fri, 07 June 2019 09:27 |
Michael C Messages: 53 Registered: April 2019 |
Member |
|
|
Hello,
I tried again the example on a new project based on family example to be sure.
When I enter debug, after I click/double click on a element of the list I can see that consumer=null in the public void call(String expression, Consumer<TYPE> consumer) function.
I tried to fixe that by passing this.newValueConsumer in parameter but the list become blank. What does consumer represents ?
Thanks,
Michael.C
edit: added screenshot of .odesign
edit2: added screenshot of debug view, I clicked on Fiona in Persons diagram then double cliqued on Paul on the list.
valueExpression = aql:self.eContainer().eContents()
[Updated on: Tue, 11 June 2019 07:06] Report message to a moderator
|
|
|
|
|
Re: Open a properties Dialog from a custom widget [message #1807967 is a reply to message #1807924] |
Thu, 13 June 2019 12:23 |
Pierre Guilet Messages: 250 Registered: June 2017 |
Senior Member |
|
|
Hi,
The code you used is meant to handle only simple click.
I updated a working sample based on what we do for List widget (EEFListLifecycleManager, EEFListController ).
The modifications I have done are :
- added in TableLifecycleManager#aboutToBeShown():
this.tableSelectionListener = new EEFTableSelectionListener(this.controller);
this.tableViewer.getTable().addSelectionListener(tableSelectionListener);
- aboutToBeHidden():
if (this.tableViewer != null && this.tableViewer.getTable() != null && !this.tableViewer.getTable().isDisposed()) {
this.tableViewer.getTable().removeSelectionListener(this.tableSelectionListener);
}
- added in TableController:
@Override
public void onClick(Object element, String onClickEventKind) {
this.editingContextAdapter.performModelChange(() -> {
Map<String, Object> variables = new HashMap<String, Object>();
variables.putAll(this.variableManager.getVariables());
variables.put(EEFExpressionUtils.EEFList.SELECTION, element);
variables.put(EEFExpressionUtils.EEFList.ON_CLICK_EVENT_KIND, onClickEventKind);
EvalFactory.of(this.interpreter, variables).call(this.getCustomExpression(ON_CLICK_EXPRESSION_ID).get());
});
}
- Also add interface IEEFOnClickController
public class TableController extends AbstractEEFCustomWidgetController implements IEEFOnClickController{
Regards,
Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
[Updated on: Thu, 13 June 2019 12:32] Report message to a moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05557 seconds