| XText TextViewer instead of Editor [message #875558] |
Tue, 22 May 2012 20:40  |
|
Hi,
Have created a simple query language to use with a BIRT ODA driver.
Instead of using the XText generated Editor for my query language, I
will need to present the user with a TextViewer in the DataSet Wizard in
order to specify the query string.
I am still a novice when it comes to XText, but I did look but haven't
found any documentation, examples or newsgroup entries regarding a use
case like this.
Can anyone give me an example on how to go about doing this.
thanks,
John
|
|
|
|
| Re: XText TextViewer instead of Editor [message #875939 is a reply to message #875558] |
Wed, 23 May 2012 11:32   |
Sebastian Zarnekow Messages: 2793 Registered: July 2009 |
Senior Member |
|
|
John,
if you use Xtext 2.3, you may want to have a look at the
EmbeddedEditorFactory.
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 23.05.12 02:40, schrieb John E. Conlon:
> Hi,
>
> Have created a simple query language to use with a BIRT ODA driver.
>
> Instead of using the XText generated Editor for my query language, I
> will need to present the user with a TextViewer in the DataSet Wizard in
> order to specify the query string.
>
> I am still a novice when it comes to XText, but I did look but haven't
> found any documentation, examples or newsgroup entries regarding a use
> case like this.
>
> Can anyone give me an example on how to go about doing this.
>
> thanks,
> John
>
>
>
>
|
|
|
|
|
| Re: XText TextViewer instead of Editor [message #876548 is a reply to message #876268] |
Thu, 24 May 2012 16:25   |
Sebastian Zarnekow Messages: 2793 Registered: July 2009 |
Senior Member |
|
|
Hi Vlad,
I'd try something along these lines:
public class MultiPageEditor extends MultiPageEditorPart {
@Inject
private Provider<XtextEditor> editorProvider;
private XtextEditor editor;
@Override
protected void createPages() {
try {
editor = editorProvider.get();
int index = addPage(editor, getEditorInput());
setPageText(index, editor.getTitle());
} catch (PartInitException e) {
ErrorDialog.openError(
getSite().getShell(),
"Error creating nested text editor",
null,
e.getStatus());
}
}
@Override
public void doSave(IProgressMonitor monitor) {
editor.doSave(monitor);
}
@Override
public void doSaveAs() {
editor.doSaveAs();
setPageText(0, editor.getTitle());
setInput(editor.getEditorInput());
}
@Override
public boolean isSaveAsAllowed() {
return true;
}
}
The EmbeddedEditorFActory should be used to embed an editor in a
composite that is not an IEditorPart itself.
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 24.05.12 11:23, schrieb Vlad Dumitrescu:
> Sebastian Zarnekow wrote on Wed, 23 May 2012 17:32
>> John,
>> if you use Xtext 2.3, you may want to have a look at the
>> EmbeddedEditorFactory.
>
>
> Hi Sebastian,
>
> Would that be the recommended way to use a Xtext editor in a multi-page
> one too?
>
> regards,
> Vlad
>
|
|
|
|
|
| Re: XText TextViewer instead of Editor [message #906357 is a reply to message #905954] |
Sat, 01 September 2012 03:57   |
|
I made several steps ahead from yesterday.
Now I've got this doubt: in my part I have to insert a code like this:
StyledText styledText=new StyledText(parent, SWT.BORDER);
StyledTextXtextAdapter xtextAdapter=new StyledTextXtextAdapter(getInjector());
xtextAdapter.adapt(styledText);
what is "getInjector()"?
Basic Eclipse 4 injection or com.google.inject.Injector that use also in StyledTextXtextAdapter definition? How can I get it?
Thanks all.
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.28924 seconds