Thank you so much Carolyn.
On Wed, Sep 3, 2008 at 4:52 PM, Carolyn MacLeod
<Carolyn_MacLeod@xxxxxxxxxx> wrote:
The only way to detect any and all events
within eclipse is to add a bunch of event filters to the display.
When your filter listener is called,
you can look at the event.widget to determine if it's the file menu (i.e.
look for SWT.Arm event on a MenuItem widget with getText() of "&File"),
etc, but this is a very low-level solution (which may be what you want
- not sure).
You will have better luck with eclipse
plug-in development related questions (like how to hook in to File menu
selection and keys typed in editors) on the platform newsgroup: news://news.eclipse.org/eclipse.platform
Good luck!
Carolyn
From:
| |
To:
| |
Date:
| 09/03/2008 04:06 PM |
Subject:
| Re: [platform-swt-dev] SWT Help Beginner |
Carolyn,
I am writing an eclipse plug-in. I have looked at the help stuff for about
a week now with much frustration.
//get the current display, eclipse display
Display currentDisplay = PlatformUI.getWorkbench().getDisplay();
>From here I would like to add event listeners to the currentDisplay to
detect any events that happen within eclipse. I am just looking for a little
direction, not the exact program. I mean if someone has the exact why I'd
love to take a look at it.
Thanks,
Jason
On Wed, Sep 3, 2008 at 3:58 PM, Carolyn MacLeod <Carolyn_MacLeod@xxxxxxxxxx>
wrote:
Yep. :)
Perhaps the best way to get started is to have a look at http://www.eclipse.org/swt/
There are lots of examples there - large and small - as well as lots of
documentation.
To know if a user clicked on a menu item, add a selection listener to the
menu item.
Here are some Menu snippets (aka "small standalone examples"):
http://www.eclipse.org/swt/snippets/#menu
To know if a user typed some text in a text widget, add a key listener
to it.
Here are some Text snippets: http://www.eclipse.org/swt/snippets/#text
Or perhaps you want a StyledText widget instead of a text widget (it would
be easier to implement an editor using a StyledText).
Here are some StyledText snippets: http://www.eclipse.org/swt/snippets/#styledtext
And here are some articles on using StyledText:
http://www.eclipse.org/articles/StyledText%201/article1.html
http://www.eclipse.org/articles/StyledText%202/article2.html
However... I notice that you mentioned THE file menu and THE editor, so
perhaps you are asking how to write an Eclipse plug-in and not a stand-alone
SWT program?
If that is the case, then it might be easier for you to start in the Eclipse
help system.
You can start with Help->Welcome and click on "Create an Eclipse
Plug-in", and after doing the tutorial, click on Help->Help Contents
and read through the "Platform Plug-in Developer Guide".
Have fun!
Carolyn
Carolyn,
Thank you so much. I really appreciate your help. I have another beginner
question. Is there a way to know that the user clicked on the File Menu
or say typed text in the editor?
Thanks again,
Jason
On Wed, Sep 3, 2008 at 2:38 PM, Carolyn MacLeod <Carolyn_MacLeod@xxxxxxxxxx>
wrote:
Try Display.addFilter(event, listener).
For example,
Display display = new
Display();
display.addFilter(SWT.KeyDown,
new
Listener() {
public
void
handleEvent(Event event) {
System.out.println("\nkey
press event=" + new
KeyEvent(event));
}
});
SWT's CCombo uses a filter to handle focus events on the drop-down list.
Caveat emptor: Only use filters where absolutely necessary. Keep filter
code to a minimum - if you try to do too much in your filter, your whole
UI can grind to a halt.
Carolyn
Hello,
I really hope this is the correct place to ask this question. I would like
to know is there any way to register listners with the SWT display instance
so that I may log a user's actions within the Eclipse IDE? I have looked
at the TPTP project, which has this functionality but couldn't wade my
way through all of their source code. Is there a simple way to do this.
Thanks,
--
Jason_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
--
Jason_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
--
Jason_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev