Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Open a properties Dialog from a custom widget
Open a properties Dialog from a custom widget [message #1806912] Fri, 17 May 2019 13:45 Go to next message
Michael C is currently offline Michael CFriend
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 #1806983 is a reply to message #1806912] Mon, 20 May 2019 15:30 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Hi,

When you say you want the same comportment, do you mean the same widget integration in the odesign editor as other widget or the same behavior than the reference widget (it does the same thing)?

Regards,


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Open a properties Dialog from a custom widget [message #1807065 is a reply to message #1806983] Wed, 22 May 2019 06:40 Go to previous messageGo to next message
Michael C is currently offline Michael CFriend
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 #1807076 is a reply to message #1807065] Wed, 22 May 2019 08:49 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Hi,

Custom widget works like the other already existing widget.

If you did the basic approach you must use a custom widget in the odesign with the id that corresponds to the one of your custom widget. With the advanced approach, the widget is available with its own name.

After that you have the same operation language available whatever approach you chose. The only difference is the presence of Custom operation element before the begin with basic approach but then you can do the same as the reference widget.

Regards,


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Open a properties Dialog from a custom widget [message #1807091 is a reply to message #1807076] Wed, 22 May 2019 12:40 Go to previous messageGo to next message
Michael C is currently offline Michael CFriend
Messages: 53
Registered: April 2019
Member
Thanks you for your help,

I tried to place a Custom operation between my custom widget and the begin but it does nothing. I suspect I have to further modify my TableController ?
Here is the modifications I did in the TableController in case I broke or missed something. The table is showing the correct values and refresh well.
In the refresh operation I replaced these to get the table to populate since I don't have a VALUE_EXPRESSION_ID.
super.refresh();
if(this.getCustomExpression(VALUE_EXPRESSION_ID).isPresent()) {
        	this.newEval().call(this.getCustomExpression(VALUE_EXPRESSION_ID).get(), this.newValueConsumer);

with (where self.status return a list of eObject)
        super.refresh();
    	this.newEval().call("aql:self.status", this.newValueConsumer);


Also in the handleClick method, I removed this line since I don't have a ON_CLICK_EXPRESSION_ID
EvalFactory.of(this.interpreter, variables).call(onClickExpression);


I also tried to put the selected element in the variableManager but it did nothing more.


Re: Open a properties Dialog from a custom widget [message #1807122 is a reply to message #1807091] Thu, 23 May 2019 08:07 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Hi,

Each id variables corresponds to a custom operation with corresponding id.
So put back the on click java line with an id like "onClickExpressionId" and in your VSM use a custom operation with id "onClickExpressionId" doing the same stuff as the reference widget. Then this should work.

Regards,


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius

[Updated on: Thu, 23 May 2019 08:09]

Report message to a moderator

Re: Open a properties Dialog from a custom widget [message #1807141 is a reply to message #1807122] Thu, 23 May 2019 13:51 Go to previous messageGo to next message
Michael C is currently offline Michael CFriend
Messages: 53
Registered: April 2019
Member
Hello, thanks you for your time.

I now understand the use of custom operation & custom expression. I'm able to use the custom expression to populate the table now.

I still have issues with the custom expression. I tried different widgets after the custom operation but they do nothing.
I printed the result of
this.getCustomExpression(ON_CLICK_EXPRESSION_ID).get();
and got
aql:input.executeOperation(self, '#//@categories.0/@groups.1/@controls.1/@customOperations.0/@initialOperation')
.
The selection variable is correct. I'm now using the exact same code as the one on the wiki.
Re: Open a properties Dialog from a custom widget [message #1807143 is a reply to message #1807141] Thu, 23 May 2019 14:10 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
What have you tried?
Have you any error in the error log when trying to click?


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Open a properties Dialog from a custom widget [message #1807174 is a reply to message #1807143] Fri, 24 May 2019 06:36 Go to previous messageGo to next message
Michael C is currently offline Michael CFriend
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 #1807263 is a reply to message #1807174] Mon, 27 May 2019 08:37 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Hi,

I don't see what could be the problem.
It is normal that you will have no exceptions they are catch and logged.
Check what is the evaluation result in org.eclipse.eef.core.api.utils.EvalFactory.Eval.call(String, Consumer<TYPE>). You should have more info.

Regards


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Open a properties Dialog from a custom widget [message #1807747 is a reply to message #1807263] Fri, 07 June 2019 09:27 Go to previous messageGo to next message
Michael C is currently offline Michael CFriend
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 #1807914 is a reply to message #1807747] Wed, 12 June 2019 08:24 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Hi,

The expression seems to work since you have a raw value in the evaluation result.
Can you give us your complete example projects with family so we can have a look?

Regards,


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Open a properties Dialog from a custom widget [message #1807924 is a reply to message #1807914] Wed, 12 June 2019 12:20 Go to previous messageGo to next message
Michael C is currently offline Michael CFriend
Messages: 53
Registered: April 2019
Member
Hello,

Here is the project. I opened basic family sample example on the runtime instance.

Thank you very much.
Re: Open a properties Dialog from a custom widget [message #1807967 is a reply to message #1807924] Thu, 13 June 2019 12:23 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
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

Re: Open a properties Dialog from a custom widget [message #1807974 is a reply to message #1807967] Thu, 13 June 2019 14:33 Go to previous messageGo to next message
Michael C is currently offline Michael CFriend
Messages: 53
Registered: April 2019
Member
Thanks for the quick reply Pierre.

The added code is really insightful and solve one of my issue that I did not think of.

Still, I cannot execute the begin block after the custom operation one.
I tried many combinations like changing the context after the begin or calling a service instead of using an "Open Dialog widget" but I get nothing.

Thanks again for the help, really enjoying Sirius so far.
Re: Open a properties Dialog from a custom widget [message #1807977 is a reply to message #1807974] Thu, 13 June 2019 14:51 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Try using the same exact code that are in the projects I attached in my previous message.

This code works for your family sample. It opens well the dialog after double click on table item.
Should work for your original project too if using same code. Then see what differs.

Regards,


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Open a properties Dialog from a custom widget [message #1808029 is a reply to message #1807977] Fri, 14 June 2019 07:33 Go to previous messageGo to next message
Michael C is currently offline Michael CFriend
Messages: 53
Registered: April 2019
Member
Hello,

I tried importing the zip you send in a fresh Obeo designer community (11.1.1 & 11.1.0 m1 early access) installation.
I get nothing when clicking or double clicking on a element of the list. Are we talking about the same list (the one with yellow labels) ?
Should I try on a different Sirius version ?

Regards,

[Updated on: Fri, 14 June 2019 14:28]

Report message to a moderator

Re: Open a properties Dialog from a custom widget [message #1808050 is a reply to message #1808029] Fri, 14 June 2019 14:27 Go to previous messageGo to next message
Michael C is currently offline Michael CFriend
Messages: 53
Registered: April 2019
Member
I just tried with eclipse 2019-03 and then I installed Sirius from https://download.eclipse.org/sirius/updates/releases/6.2.0/oxygen/ and it worked.
It seems that there is an issue with the last version of Obeo designer. I'll try to investigate further and let you know what I find.

edit: I tried with eclipse 2019-03 and http://download.eclipse.org/sirius/updates/releases/6.1.0/oxygen/, it does not work.

Regards,

[Updated on: Mon, 17 June 2019 07:30]

Report message to a moderator

Re: Open a properties Dialog from a custom widget [message #1808079 is a reply to message #1808050] Mon, 17 June 2019 08:50 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Ok I have done my example on the last version.
Seems to be a bug on 6.1.x version. Can you open a ticket? https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Sirius

Regards,


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Open a properties Dialog from a custom widget [message #1808231 is a reply to message #1808079] Thu, 20 June 2019 06:28 Go to previous message
Michael C is currently offline Michael CFriend
Messages: 53
Registered: April 2019
Member
I opened a ticket here : https://bugs.eclipse.org/bugs/show_bug.cgi?id=548454

Regards,
Previous Topic:Execute custom code before Sirius Editor save
Next Topic:Template models or patterns
Goto Forum:
  


Current Time: Thu Mar 28 16:57:08 GMT 2024

Powered by FUDForum. Page generated in 0.06186 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top