Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to modify text in DSL editor (from code)?
How to modify text in DSL editor (from code)? [message #913487] Sat, 15 September 2012 15:40 Go to next message
Andrew A is currently offline Andrew A
Messages: 9
Registered: June 2012
Junior Member
Hello all!

I need to modify text in my DSL editor (actually - inserting some constant string at the caret position) on a hotkey.

How to do this?

[Updated on: Sat, 15 September 2012 16:39]

Report message to a moderator

Re: How to modify text in DSL editor? [message #913710 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913720 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913731 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913743 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913755 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913767 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913779 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913791 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913804 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913816 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913830 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913844 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913858 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913872 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913886 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913900 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913914 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913928 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913943 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913963 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #913986 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #914009 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #914033 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #914058 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #914083 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #914108 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #914133 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #914158 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #914183 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #914208 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #914233 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #914258 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #914283 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #914308 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #914333 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #914358 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #914383 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #914408 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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 #914433 is a reply to message #913487] Sat, 15 September 2012 21:05 Go to previous message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
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
Previous Topic:Using generator for corresponding xmi file, not just the xtextual
Next Topic:semantic quick fixes and commens
Goto Forum:
  


Current Time: Fri Aug 22 04:05:43 EDT 2014

Powered by FUDForum. Page generated in 0.06375 seconds