Skip to main content



      Home
Home » Modeling » EMF Parsley » Loading Resource via Filechooser(Loading Resource via Filechooser)
Loading Resource via Filechooser [message #1783761] Fri, 16 March 2018 12:27 Go to next message
Eclipse UserFriend
Hi again
I am trying to add a Filechooser to my EMF Parsley Project
I've tried it like this
configurator {
		resourceURI {
			TreeformSaveableTreeFormView -> {
				val fc = new FileChooser(null, SWT.NONE);
				return URI.createFileURI(sd.open() as String);
			}
		}
	}

and hoped it would just open the dialog, but that's not the case.
So now I don't realy know how I should implement it.
Re: Loading Resource via Filechooser [message #1783845 is a reply to message #1783761] Mon, 19 March 2018 06:21 Go to previous messageGo to next message
Eclipse UserFriend
Hi

do you get any specific error?
you pass null as the shell to file chooser I guess, is that supposed to work in FileChooser?

Note that this use case hasn't been taken into consideration at the moment.
Re: Loading Resource via Filechooser [message #1784473 is a reply to message #1783845] Wed, 28 March 2018 07:17 Go to previous messageGo to next message
Eclipse UserFriend
I don't get any Error
null should work with the FileChooser, but even if i pass a new Shell i don't get any responses
Re: Loading Resource via Filechooser [message #1784784 is a reply to message #1784473] Wed, 04 April 2018 03:42 Go to previous messageGo to next message
Eclipse UserFriend
nothing in the "Error Log" view?
Re: Loading Resource via Filechooser [message #1784804 is a reply to message #1784784] Wed, 04 April 2018 06:10 Go to previous messageGo to next message
Eclipse UserFriend
By the way, where does FileChooser come from?
Note that you assign it to "fc" but then you call open on "sd"...
Re: Loading Resource via Filechooser [message #1784806 is a reply to message #1784804] Wed, 04 April 2018 06:14 Go to previous messageGo to next message
Eclipse UserFriend
I've just tried with org.eclipse.swt.widgets.FileDialog:

configurator {
		resourceURI {
			TreeformSaveableTreeFormView -> {
				val fc = new FileDialog(site.shell, SWT.OPEN);
				val result = fc.open();
				return URI.createFileURI(result);
			}
		}
...


and this works out of the box, as expected: the first time you open the view the dialog shows up
Re: Loading Resource via Filechooser [message #1785116 is a reply to message #1784806] Mon, 09 April 2018 12:34 Go to previous messageGo to next message
Eclipse UserFriend
That worked for me too
thanks

What does the site reference to?
Re: Loading Resource via Filechooser [message #1785329 is a reply to message #1785116] Thu, 12 April 2018 10:58 Go to previous message
Eclipse UserFriend
That is the syntactic sugar from Xbase (the Java-like expression language the Parsley DSL is based on): it stands for getSite().getShell() : the code block is passed a paremeter "it" of the same type of the type before the arrow (in this example, TreeformSaveableTreeFormView), that can be used in the block. "it" can always be used as an implicit receiver (like "this"). Summarizing, "site.shell" is the short form of "it.getSite().getShell()" (and getSite() comes from the fact that a View has such a method).
Previous Topic:Calling a method on Button Push
Next Topic:Can not change int attribute
Goto Forum:
  


Current Time: Sun Jul 06 12:23:28 EDT 2025

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

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

Back to the top