Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Eclipse Events
Eclipse Events [message #33120] Sat, 15 November 2008 18:51 Go to next message
Jason Carter is currently offline Jason CarterFriend
Messages: 13
Registered: July 2009
Junior Member
Hello all,


I would like to create a plug-in that captures events within the Eclipse
IDE. For example, if a user opens a file, types text, or uses the
debugger. I am actually to capture the opening a file, and typing text
event. I can also capture the debugging event.

I would like to know if anyone has ever tried to do this? Also, is there a
way to capture all events?

Thanks in advance,

Jason
Re: Eclipse Events [message #33415 is a reply to message #33120] Mon, 17 November 2008 14:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

On 11/15/2008 1:51 PM, Jason Carter wrote:
> Hello all,
>
>
> I would like to create a plug-in that captures events within the Eclipse
> IDE. For example, if a user opens a file, types text, or uses the
> debugger. I am actually to capture the opening a file, and typing text
> event. I can also capture the debugging event.
>
> I would like to know if anyone has ever tried to do this? Also, is there
> a way to capture all events?

There is really no definition of "all events" - it is too broad a term.
As you've seen, there are various mechanisms and API to receive
different kinds of events.
You might want to look at the Usage Data Collector (UDC):
http://dev.eclipse.org/blogs/mike/2008/06/05/collecting-usag e-data/

Hope this helps,
Eric
Re: Eclipse Events [message #34110 is a reply to message #33415] Sat, 22 November 2008 05:11 Go to previous messageGo to next message
Jason Carter is currently offline Jason CarterFriend
Messages: 13
Registered: July 2009
Junior Member
Thanks so much for you reply Eric.


I am interested in getting the text the user is typing in an editor. I
have actually be able to get the text and store it in a log. What I would
like to do next is to take that text and programmatically enter it into an
editor.

This is the code I use to insert the text from the file. I use the
document.replace function.

while(e.hasMoreElements())
{
entry = e.nextElement();
int offset = Integer.parseInt(entry.getOffset());
int length = Integer.parseInt(entry.getLength());
String text = entry.getText();

try
{
document.replace(1,0,"some text");
}
catch(BadLocationException ex)
{
ex.printStackTrace();
}

The problem is every time I insert text I get a BadLocationException. I
noticed that this exception only occurs when the text file is empty or
when there is no text at the offset to replace.

Any help would be greatly appeciated.

Thanks,

Jason
Re: Eclipse Events [message #34144 is a reply to message #33415] Sat, 22 November 2008 05:15 Go to previous message
Jason Carter is currently offline Jason CarterFriend
Messages: 13
Registered: July 2009
Junior Member
Thanks Eric.


I am interested in getting the text that a user has typed. I am able to
get this text and store it in a XML file.

I would like to programmatically insert this text into an editor. I am
able to get the current active editor, but when I insert text using the

document.replace(offset,0,text) function I get a BadLocationException
exception. I noticed that this exception only occurs when the text file is
empty or when there is no text at the offset to replace.

Any help is greatly appreciated

Thanks,

Jason
Re: Eclipse Events [message #585396 is a reply to message #33120] Mon, 17 November 2008 14:43 Go to previous message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
On 11/15/2008 1:51 PM, Jason Carter wrote:
> Hello all,
>
>
> I would like to create a plug-in that captures events within the Eclipse
> IDE. For example, if a user opens a file, types text, or uses the
> debugger. I am actually to capture the opening a file, and typing text
> event. I can also capture the debugging event.
>
> I would like to know if anyone has ever tried to do this? Also, is there
> a way to capture all events?

There is really no definition of "all events" - it is too broad a term.
As you've seen, there are various mechanisms and API to receive
different kinds of events.
You might want to look at the Usage Data Collector (UDC):
http://dev.eclipse.org/blogs/mike/2008/06/05/collecting-usag e-data/

Hope this helps,
Eric
Re: Eclipse Events [message #585686 is a reply to message #33415] Sat, 22 November 2008 05:11 Go to previous message
Jason Carter is currently offline Jason CarterFriend
Messages: 13
Registered: July 2009
Junior Member
Thanks so much for you reply Eric.


I am interested in getting the text the user is typing in an editor. I
have actually be able to get the text and store it in a log. What I would
like to do next is to take that text and programmatically enter it into an
editor.

This is the code I use to insert the text from the file. I use the
document.replace function.

while(e.hasMoreElements())
{
entry = e.nextElement();
int offset = Integer.parseInt(entry.getOffset());
int length = Integer.parseInt(entry.getLength());
String text = entry.getText();

try
{
document.replace(1,0,"some text");
}
catch(BadLocationException ex)
{
ex.printStackTrace();
}

The problem is every time I insert text I get a BadLocationException. I
noticed that this exception only occurs when the text file is empty or
when there is no text at the offset to replace.

Any help would be greatly appeciated.

Thanks,

Jason
Re: Eclipse Events [message #585694 is a reply to message #33415] Sat, 22 November 2008 05:15 Go to previous message
Jason Carter is currently offline Jason CarterFriend
Messages: 13
Registered: July 2009
Junior Member
Thanks Eric.


I am interested in getting the text that a user has typed. I am able to
get this text and store it in a XML file.

I would like to programmatically insert this text into an editor. I am
able to get the current active editor, but when I insert text using the

document.replace(offset,0,text) function I get a BadLocationException
exception. I noticed that this exception only occurs when the text file is
empty or when there is no text at the offset to replace.

Any help is greatly appreciated

Thanks,

Jason
Previous Topic:PluginRegistry.getExternalModels ???
Next Topic:Custom icons for workbench content
Goto Forum:
  


Current Time: Fri Apr 19 22:55:11 GMT 2024

Powered by FUDForum. Page generated in 0.03548 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top