org.eclipse.core.expressions.propertyTesters [message #327263] |
Mon, 14 April 2008 20:12 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: bdm1.datatel.com
My development team has a multi-paged editor that we created for eclipse.
I created a command through the org.eclipse.ui.commands extension point.
I added it to a menu and gave it a handler through the
org.eclipse.ui.menus and org.eclipse.ui.handlers extension points. The
enablement of the command is dependent on the text selection on a couple
particular pages of our multi-page editor.
I created a new PropertyTester class through the
org.eclipse.core.expressions.propertyTesters extension point to test the
type org.eclipse.jface.text.ITextSelection. This works just fine for one
of our editor pages, which extends the
org.eclipse.ui.editors.text.TextEditor class and implements IFormPage.
Whenever a new selection is made on that editor page, the tester kicks off
just as expected.
However, it does not work on a second editor page of ours. This page
extends org.eclipse.ui.forms.editor.FormPage. It holds a
org.eclipse.swt.custom.CTabFolder with multiple CTabItem's, each of which
allows source code to be entered on it. A sourceViewer manages each of
the tabs and deals with the selection events, etc.
The problem is that my PropertyTester class does not kick off when text
selections are made on the nested tabs on the page. I debugged it quite a
bit and saw that the org.eclipse.ui.internal.services.ExpressionAuthority
class runs through it's normal business, but when it comes to the logic of
testing the selection to see if it passes my test criteria, it has a
StructuredSelection with nothing in it rather than a TextSelection. I
don't know what selection provider is being used to pass selections to the
expression evaluation classes, but can it be overriden or added as a
listener to my sourceViewer so that it will see my TextSelection's?
|
|
|
|
Re: org.eclipse.core.expressions.propertyTesters [message #327426 is a reply to message #327325] |
Fri, 18 April 2008 13:40 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: bdm1.datatel.com
I did a getSite().setSelectionProvider(provider) to set the selection
provider as my inner editor viewer. However, when I did a getSite() on
that page I got an instance of EditorSite, not MultiPageEditorSite, I
guess because the page is added as a regular form page instead of an
editor. I don't know if this matters though because even so, the
PropertyTester seems to get its selection from somewhere entirely
different. When I was debugging, it came up and did it's logic before my
editor viewer even sent its selection event.
|
|
|
|
Re: org.eclipse.core.expressions.propertyTesters [message #327472 is a reply to message #327427] |
Mon, 21 April 2008 19:59 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: bdm1.datatel.com
I did that at the EditorPart level, so it overrides the
MultiPageSelectionProvider. The PropertyTester class still does not see
the selections. Does it use a different selection provider than the one
the EditorSite uses?
|
|
|
Re: org.eclipse.core.expressions.propertyTesters [message #327502 is a reply to message #327427] |
Tue, 22 April 2008 15:02 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: bdm1.datatel.com
I figured out what my problem was. I was adding my page using the method
FormEditor.addPage(IFormPage page), which was causing my page's
init(IEditorSite site, IEditorInput input) method to be called with the
main editor's site and input. Also, I was not returning "true" from the
isEditor() method on my page.
I changed my page to return "true" from isEditor() and I added the page
using the method FormEditor.addPage(IEditorPart editor, IEditorInput
input). That caused my page to have a MultiPageEditorSite created for it.
Then, when I did a getSite() call I got the MultiPageEditorSite rather
than the main editor's EditorSite. Now I can override the
selectionProvider with no problem.
|
|
|
Powered by
FUDForum. Page generated in 0.03822 seconds