Standalone StyledTextArea [message #1469610] |
Tue, 11 November 2014 14:14  |
Eclipse User |
|
|
|
Hi!
So we are implementing a code editor which needs to feature inline completion (show with a different opacity the text next to the caret), placeholder editing (complete some syntax and leave some placeholders so the user can tab across them) and syntax highlighting.
I've cloned the efxclipse project and incorporated into the project the sources for StyledTextArea. The issue at the moment is with the content. There's a DefaultContent implementation of StyledTextContent but the main one is done by SWT text classes and an adapter.
I'd prefer not to include these as they have other SWT dependencies and we're using just JavaFX, not JFace neither other SWT components.
Ultimately we'd strip only the necessary classes but there's lots of features we'd not need, so we'd prefer to have a custom lightweight implementation.
What do you recommend us to implement an StyledTextContent given we'd need to implement on top of it the above features?
Thank you very much,
Guillermo
|
|
|
|
Re: Standalone StyledTextArea [message #1470905 is a reply to message #1470265] |
Wed, 12 November 2014 13:27   |
Eclipse User |
|
|
|
Hi Tom,
First of all thanks a lot for your prompt and extensive response, I appreciate it.
I've been digging into the eclipse text project and I've finally discarded it because it is quite complex, and it could take some time to grok everything and get up to speed.
Since we already have the parsing and tokenizing done with Antlr4, and although it's possible to glue everything together, it required much effort.
What I'm finally doing at the moment is stripping out to the bare bones your editor, since I only need one line, and implementing on top of it the other features.
It's served as a great source of inspiration, the only pity is that I won't be able to contribute back the code since it differs a lot.
Again, thanks you very much and keep up rocking eclipse with JavaFX goodies 
Regards,
Guillermo
|
|
|
Re: Standalone StyledTextArea [message #1471069 is a reply to message #1470905] |
Wed, 12 November 2014 16:31   |
Eclipse User |
|
|
|
Hi,
On 12.11.14 19:27, Guillermo Cifuentes wrote:
> Hi Tom,
>
> First of all thanks a lot for your prompt and extensive response, I
> appreciate it.
>
> I've been digging into the eclipse text project and I've finally
> discarded it because it is quite complex, and it could take some time to
> grok everything and get up to speed.
>
> Since we already have the parsing and tokenizing done with Antlr4, and
> although it's possible to glue everything together, it required much
> effort.
Sounds like an cool piece of source.
>
> What I'm finally doing at the moment is stripping out to the bare bones
> your editor, since I only need one line, and implementing on top of it
> the other features.
Maybe you can use the DefaultDocumentAdapter and the IDocument API so
that only the StyleRange stuff is left. Anyways I'm glad the code helps you!
>
> It's served as a great source of inspiration, the only pity is that I
> won't be able to contribute back the code since it differs a lot.
>
No worries - maybe you can contribute to the editor control itself -
e.g. selection is not 100% working.
If there are any interfaces we could add so that you can plug in your
stuff into compensator just file bugs!
Like I said the compensator is more of a cool research project I work on
when I need a break from real world projects ;-)
Tom
|
|
|
|
|
Re: Standalone StyledTextArea [message #1494462 is a reply to message #1494434] |
Mon, 01 December 2014 08:48   |
Eclipse User |
|
|
|
Hi,
I think your display problem is a problem of the StyledTextControl
itself who currently expects the full size of the text to be covered by
StyleRanges.
This works for me:
> BorderPane p = new BorderPane();
> StyledTextArea t = new StyledTextArea();
> t.getStylesheets().add(getClass().getResource("test.css").toExternalForm());
> t.getContent().setText("This is a styled text!");
> t.setStyleRanges(
> new StyleRange[] {
> new StyleRange("text-normal",0,10,null,null),
> new StyleRange("text-highlight",10,12,null,null)
> });
> p.setCenter(t);
>
> Scene scene = new Scene(p,800,600);
>
> primaryStage.setScene(scene);
> primaryStage.show();
test.css:
---------
> .text-normal {
>
> }
>
> .text-highlight {
> -styled-text-color: #ff0000;
> }
Tom
On 01.12.14 14:18, Tom Schindl wrote:
> Hi,
>
> Yes the DefaultContent is broken.
>
> Tom
>
> On 01.12.14 13:30, Rodolfo M. Raya wrote:
>> Hi,
>>
>> I'm also trying to use StyledTextArea in one of my projects and am fighting with the code.
>>
>> The implementation of DefaultContent nested in StyledTextArea is too complex and doesn't seem to work.
>>
>> The attached file is the simplest implementation of StyledTextContent interface that I could make.
>>
>> I have a very simple javaFX test application that displays a StyledTextArea on a StackedPane. The StyledTextArea component is not displaying the text at this moment but using the debugger I can see that my custom content provider is working.
>>
>> Any help in making StyledTextArea work would be appreciated.
>>
>> Regards,
>> Rodolfo M. Raya
>>
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.10705 seconds