Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Loosing SelectionProvider when opening file in editor
Loosing SelectionProvider when opening file in editor [message #644354] Fri, 10 December 2010 16:45 Go to next message
Thomas F is currently offline Thomas F
Messages: 7
Registered: December 2010
Junior Member
Hi all,

I've got the following problem while extending an example for selective (popup-)menucontribution in following scenario:
View A: ListViewer (Selection of Items)
View B: Editor (Edit of selected item)

I created a popup menu contribution with visibleWhen statement like this:
<menuContribution
allPopups="false"
locationURI="popup:de.franke.editortest.view">
<command
commandId="de.franke.editortest.openEditorPopup"
label="OpenEditorPopup"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="oneItemSelected">
</reference>
</visibleWhen>
</command>
</menuContribution>

The referenced expression follows the example of vogellas tutorial:
<extension
point="org.eclipse.core.expressions.definitions">
<definition
id="oneItemSelected">
<with
variable="selection">
<count
value="1">
</count>
</with>
</definition>
</extension>

View A is the selectionProvider as of tutorial. If view A has focus all works fine (invisible if nothing selected and visible if one item selected).
If I execute the command in popup menu the item is opened in editor which gets focus immediately - OK

If I move over the list now (while editor has focus) and press right mouse button - no popup appears. Seems logical because I lost my selectionprovider due to focus change - but how can I change the behaviour to those like in eclipse IDE. It focuses the ProjectExplorer View and current item automatically when right click and may change the selection as well - both does not happen in my application. Isn't that any standard behaviour - are there any hacks to do to get this?

Thanks

regards
Re: Loosing SelectionProvider when opening file in editor [message #644600 is a reply to message #644354] Mon, 13 December 2010 12:27 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Does your viewPart#setFocus() set focus on your viewer control?

PW

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


Re: Loosing SelectionProvider when opening file in editor [message #644692 is a reply to message #644600] Mon, 13 December 2010 19:27 Go to previous message
Thomas F is currently offline Thomas F
Messages: 7
Registered: December 2010
Junior Member
Yes Iset focus on viewer.

public class View extends ViewPart {
public void createPartControl(Composite parent) {
....
tviewer = new TreeViewer(parent);
tviewer.setContentProvider(new ITreeContentProvider() {
....
}
}

public void setFocus() {
tviewer.getControl().setFocus();
}
...
}

But the whole view tab in my application does not get focus at all.

The items get selected on right mouse click, but the view does not get focus - I don't know how it works. I searched for a focusListener in TreeViewer but there isn't any ...
Previous Topic:How to integrate own Viewer in RCP
Next Topic:RCP product deployment problem
Goto Forum:
  


Current Time: Thu Oct 23 06:51:36 GMT 2014

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

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