Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » org.eclipse.core.expressions.propertyTesters
org.eclipse.core.expressions.propertyTesters [message #327263] Mon, 14 April 2008 20:12 Go to next message
Eclipse UserFriend
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 #327325 is a reply to message #327263] Tue, 15 April 2008 14:52 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

In theory your inner editor is calling
getSite().setSelectionProvider(viewer) as part of its
init(*)/createPartControl(*) ... the MultiPageEditorPart uses code in
org.eclipse.ui.part.MultiPageEditorSite.setSelectionProvider (ISelectionProvider)
and
org.eclipse.ui.part.MultiPageEditorSite.handleSelectionChang ed(SelectionChangedEvent)
to pass selection events from the inner selection provider to the global
workbench window selection provider.

Did you reset your MPEP selection provider somewhere?

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: org.eclipse.core.expressions.propertyTesters [message #327426 is a reply to message #327325] Fri, 18 April 2008 13:40 Go to previous messageGo to next message
Eclipse UserFriend
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 #327427 is a reply to message #327426] Fri, 18 April 2008 14:25 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Brandon wrote:
> 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.
>

Sorry, that's not clear ... you did a getSite().setSelectionProvider(*)
in your inner editor? or in your MultiPageEditorPart? Doing that in
the MPEP would override the
org.eclipse.ui.part.MultiPageSelectionProvider set in MPEP#init(*) method.

The MPEP uses MultiPageSelectionProvider to delegate selection events
to the active inner page (when the active inner page is an editor).

Later,
PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: org.eclipse.core.expressions.propertyTesters [message #327472 is a reply to message #327427] Mon, 21 April 2008 19:59 Go to previous messageGo to next message
Eclipse UserFriend
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
Eclipse UserFriend
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.
Previous Topic:SharedHeaderFormEditor with complex HeadClient and decorateFormHeading
Next Topic:Re: Databinding and EFeatureMap (Re: AdapterFactoryContentProvider and notificat
Goto Forum:
  


Current Time: Sun Jul 07 07:33:49 GMT 2024

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

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

Back to the top