[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sapphire-dev] how to do a "richer" editor of a property

Thanks Konstantin that does help me sort out my next steps.  You bring up a good point with the project context.  I'll let you know if I get an embedded editor working as a proof-of-concept and then could discuss proper integration with you.

On Tue, Jan 31, 2012 at 4:46 AM, Konstantin Komissarchik <konstantin.komissarchik@xxxxxxxxxx> wrote:

Hi Greg,


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.


- Konstantin



From: sapphire-dev-bounces@xxxxxxxxxxx [mailto:sapphire-dev-bounces@xxxxxxxxxxx] On Behalf Of Greg Amerson
Sent: Monday, January 30, 2012 2:02 AM
To: Sapphire project
Subject: [sapphire-dev] how to do a "richer" editor of a property


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 :)


Some options:

- 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.



Greg Amerson

Liferay, Inc.

sapphire-dev mailing list

Greg Amerson
Liferay, Inc.