|Re: [sapphire-dev] how to do a "richer" editor of a property|
I’ve never tried to embed a full source editor in a form. If you’d like to explore feasibility of this from Eclipse API standpoint, let us know what you find out and we can discuss the best way to integrate the technique with Sapphire.
Regarding the approach of opening a separate editor based on a user action (like a button click), you can probably do this without creating a temporary file. Take a look at the editor input API. You should be able to write your own editor input that interacts directly with your property. If you get this part working, integrating it with the Sapphire form editor is as simple as implementing an action and defining an actuator at the location you want this accessible from. Prior to 0.5, actuators were called “action links” and you couldn’t use button presentation. There is more flexibility after recent work in the 0.5 release.
Of course, the biggest challenge in any of these approaches is that many of the source editors don’t work very well without context (project classpath, etc). You typically get syntax checking and that’s it…
Hope that helped.
Hi sapphire experts,
I've got a property on a model that I'm working with that represents a user defined java/groovy script. So I want to let the user edit this java/groovy script in a more "rich" way (code assist, validation, etc). Right now I'm just using the standard property editor for a long string (textarea). What I would really like to have is the full fledged groovy editor for Eclipse (lets assume that the groovy eclipse plugins are installed) that has all of those "rich" features. Are there any suggestions for how to pull this off ? I can throw out a few potential ideas but I don't know how feasible any of them would be, I would really love to hear some expert opinions :)
- inline java/groovy editor right in the master/details page (not sure if this is even possible with Eclipse 3.x API)
- dedicated "script" page and could be automatically focused when the user wants to "edit a script" (not sure how intuitive this would be)
- dynamically create a temp script file in workspace and open this temp file in a new stand-alone editor (new tab in eclipse) that would be full-fledged groovy/java editor whenever the user wants to "edit" that script. On save, this would close the editor and re-focus the original property editor in master/detail page (may be the simplest solution). Would then need to figure out what to put in the property editor for the script property, like a button or link to "edit" the property?
I appreciate any feedback on this.