Home » Modeling » TMF (Xtext) » How to modify text in DSL editor (from code)?
| Re: How to modify text in DSL editor? [message #914458 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
| Re: How to modify text in DSL editor? [message #914483 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
| Re: How to modify text in DSL editor? [message #914508 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
| Re: How to modify text in DSL editor? [message #914534 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
| Re: How to modify text in DSL editor? [message #914560 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
| Re: How to modify text in DSL editor? [message #914586 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
| Re: How to modify text in DSL editor? [message #914612 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
| Re: How to modify text in DSL editor? [message #914638 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
| Re: How to modify text in DSL editor? [message #914664 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
| Re: How to modify text in DSL editor? [message #914690 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
| Re: How to modify text in DSL editor? [message #914716 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
| Re: How to modify text in DSL editor? [message #914742 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
| Re: How to modify text in DSL editor? [message #914769 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
| Re: How to modify text in DSL editor? [message #914796 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
| Re: How to modify text in DSL editor? [message #914823 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
| Re: How to modify text in DSL editor? [message #914850 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
| Re: How to modify text in DSL editor? [message #914874 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
| Re: How to modify text in DSL editor? [message #914898 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
| Re: How to modify text in DSL editor? [message #914920 is a reply to message #913487] |
Sat, 15 September 2012 21:05  |
Henrik Lindberg Messages: 2429 Registered: July 2009 |
Senior Member |
|
|
On 2012-15-09 21:40, Andrew A wrote:
> I need to modify text in my DSL editor (actually - inserting some
> constant string) on a hotkey.
>
> How to do this?
You can look at an implementation of a command that is added to a menu
and provides debug output You find it at cloudsmith / geppetto @ github.
Look at this method:
org.cloudsmith.geppetto.pp.dsl.ui.commands.PPDevDebug.execute(ExecutionEvent)
(The rest of the that class is just various actions that I want to
execute from time to time from within the editor - to dump things out -
nothing there except the execute method is relevant for your case).
Also look at how the PPDevDebug is wired into a menu. (You may want some
other binding, using a hotkey, etc.) - there you are on your own - that
is regular Eclipse stuff.
In the execute method, you can figure out what you need from the event
context (i.e. navigate to the editor, the document etc).
Once you have the XtextDocument, you can call it's modify(...) method
which take an instance of an IUnitOfWork. Inside of that you can
manipulate the document - insert, replace, etc.
Hope that helps.
- henrik
|
|
|
Goto Forum:
Current Time: Sun May 26 03:10:44 EDT 2013
Powered by FUDForum. Page generated in 0.02372 seconds
|