Powerbox for SWT?

Thomas Leonard <[email protected]>
Newsgroups gmane.comp.lang.e.general
Message-ID <[email protected]>
I had a go at integrating 0install with the new E loader stuff. This
turned out to be quite easy: a package's dependencies given in its
feed turn into loaders in its environment. The idea is that you do
e.g.

$ e-install Editor http://example.com/Editor

This creates a directory called 'Editor' with the program's
configuration, which can be run as:

$ ./Editor/AppRun

The program gets <file:Editor/data>.shallowReadOnly() as a place to
store configuration and state.

The (read-only) program code lives outside the directory, in the
0install cache, allowing it to be shared between programs, users, etc.
Selecting versions, choosing dependencies, checking for updates etc
all happens through 0install as normal.

Now, I'd like to run programs in a restricted environment by default.
I thought I could just reuse the caplet stuff (e.g.
powerboxControllerMakerAuthor), but it all seems to be Swing-based. As
I understand it, SWT is now the preferred toolkit for E:

"E will continue to support Swing, but we expect to increasingly
support and emphasize SWT as we increasingly deemphasize Swing. In
particular, due to its size, we don't expect to ever properly tame
Swing, and so locally untrusted code (including all caplets) can never
be given access to the Swing API."
(http://www.erights.org/download/swt/index.html)

Is there any useful existing code I can use? It's not obvious to me
what subset of privilegedScope I should give out. For example, stdout,
stderr and print are fine. I think interp is OK too. "makeCommand" and
"rune" probably not.

For SWT, it's even less clear. I guess I shouldn't be giving out
currentDisplay, as then the program can create as many windows as it
likes and with any title. I tried providing a powerbox that allows
creating a new shell and returns a proxy to it. But all kinds of
operations (e.g. listening for dispose, adding a menu bar, adding a
drop-down menu) require access to the shell, e.g.

def menuBar := <widget:makeMenu>(shell, SWT.getBAR())
def fileMenuHeader := <widget:makeMenuItem>(menuBar, SWT.getCASCADE())
fileMenuHeader.setText("&File");
shell.setMenuBar(menuBar)
def fileMenu := <widget:makeMenu>(shell, SWT.getDROP_DOWN())
fileMenuHeader.setMenu(fileMenu)

Do I need to provide my own version of all of these? Also, I need
something to provide Open and Save dialogs. How does copy-and-paste
work? Has someone solved this already?

Thanks,


-- 
Dr Thomas Leonard		ROX desktop / Zero Install
GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1
GPG: DA98 25AE CAD0 8975 7CDA  BD8E 0713 3F96 CA74 D8BA
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.