org.eclipse.core.expressions.propertyTesters [message #327263] |
Mon, 14 April 2008 16:12  |
Eclipse User |
|
|
|
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 #327502 is a reply to message #327427] |
Tue, 22 April 2008 11:02  |
Eclipse User |
|
|
|
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.03412 seconds