Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Is there something like a file selector in Sirius?(File Selector, Sirius)
Is there something like a file selector in Sirius? [message #1822877] Mon, 16 March 2020 09:52 Go to next message
Yufei Zhou is currently offline Yufei ZhouFriend
Messages: 44
Registered: March 2020
Member
Hi,
I'm trying to load a config file to my Java Service in the Viewpoint Specification Project. I hope to put a button in the Property View and once I click on it, a File Selector Dialog comes out so I can choose from where I will load the config file. But I didn't find something like a File Selector, does Sirius support such a widget?
Thanks very much for your help.
Re: Is there something like a file selector in Sirius? [message #1822882 is a reply to message #1822877] Mon, 16 March 2020 10:44 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
Hello,

Indeed, I do not think that we have a widget that prompts the File Browser. You will have to create a classic button, and in the model action of this button, call a java service that will open the File Browser. In this java service, you will need to have the following action to prompt the System file browser:
FileDialog fileDialog = new FileDialog(shell, SWT.OPEN);
fileDialog.setText("title");
String filePath = fileDialog.open();

Best regards,
Steve


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Is there something like a file selector in Sirius? [message #1822898 is a reply to message #1822882] Mon, 16 March 2020 13:34 Go to previous messageGo to next message
Yufei Zhou is currently offline Yufei ZhouFriend
Messages: 44
Registered: March 2020
Member
That's exactly what I need. Thanks for your help so much.
Re: Is there something like a file selector in Sirius? [message #1822903 is a reply to message #1822882] Mon, 16 March 2020 14:22 Go to previous messageGo to next message
Yufei Zhou is currently offline Yufei ZhouFriend
Messages: 44
Registered: March 2020
Member
Hi Steve,
I tried java swt in my project to invoke a FileDialog. However, there is an Error saying Invalid thread access. I searched for the internet and found that this is caused by java swt's display thread not created. I also found some examples telling me how to create FileDialog, but all the examples says that I have to change the Button's Listener method, which I have no idea how to configure them in Sirius. Would you please help me about how to use swt FileDialog in detail? Just an example is fine.
Thank you very much.
Re: Is there something like a file selector in Sirius? [message #1822906 is a reply to message #1822882] Mon, 16 March 2020 14:48 Go to previous messageGo to next message
Yufei Zhou is currently offline Yufei ZhouFriend
Messages: 44
Registered: March 2020
Member
Sorry for bothering but I've managed to solve it by myself. Anyway, thank you so much for your help.
Re: Is there something like a file selector in Sirius? [message #1822914 is a reply to message #1822906] Mon, 16 March 2020 16:32 Go to previous message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
Hello,

No problem, I am glad I could help.

Best regards,
Steve


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Issue when adding programmatically new diagrams to a representation
Next Topic:adaptViewNodeSizeWithLabel result over written
Goto Forum:
  


Current Time: Tue Apr 23 13:48:16 GMT 2024

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

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

Back to the top