Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » setSelectionProvider to an editor without Viewers(How to set SElectionProvider to an editor whsoe components are not in a viewer?)
setSelectionProvider to an editor without Viewers [message #657222] Wed, 02 March 2011 00:47 Go to next message
Dila  is currently offline Dila Friend
Messages: 6
Registered: March 2011
Junior Member
Hi,

I am trying to set(Selection provider) to my Editor through the
Handler class. But I am constantly failing.

I have a view class where I list down the various SWT widgets,
I drag and drop the widget from the view to my editor,
However, I am done with this part. But the problem occurs when I try
to relate the Properties View to the widgets in the editor which was
dropped.

As mentioned, please find below, the execute(..) method of the handler, which
is responsible in dropping the widget to my editor.

public Object execute(ExecutionEvent event) throws ExecutionException
{
final Composite composite =
MyDragnDropUtil.getDesignEditorComposite();
final Composite dspComp = (Composite) composite.getChildren()[0];//
[1];
final Button logger = new Button(dspComp, SWT.BORDER);
logger.setText("Button");
DroppedWidgetItem dwi = new DroppedWidgetItem(logger, "Button");
ndclist_static.add(dwi);
System.out.println("size:"+ndclist_static.getChildren().size());
return null;

}

I am unable to view the Properties View when I select the dropped
widget, since I am unable to set my SelectionProvider to the dropped
Widget composite.

I am aware of setting the Selection Provider through the Viewer.
However, I do not intend to use Viewer in the editor. As you can see
in the code above, I am using a composite.

Could you please suggest a workaround towards this issue? Or am I doing something wrong?

Thanks,
Re: setSelectionProvider to an editor without Viewers [message #657349 is a reply to message #657222] Wed, 02 March 2011 14:13 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

you must provide a selection provider in your editor. Do you?

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: setSelectionProvider to an editor without Viewers [message #657491 is a reply to message #657349] Thu, 03 March 2011 01:02 Go to previous messageGo to next message
Dila  is currently offline Dila Friend
Messages: 6
Registered: March 2011
Junior Member
Hi Paul,

For a better understanding of my problem please find the code snippets below...

I create the Composite of my MultipageEditor dynamically using a handler..

The composite creation of the editor prior to Handler execution is as follows in my Editor Class:

************************
private void createComposite(Composite composite) {
Composite comp = new Composite(composite, SWT.NONE);
comp.setLayout(new GridLayout());
comp.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
}
************************
In the above code, I am keeping a Initial composite space ready for the dynamic widget creation.

And once the handler is invoked(execute method), I drop my widgets to this composite as in the code below(in the Handler Class) :

*****************************

private NexdigmDroppedComponentList ndclist_static=new NexdigmDroppedComponentList();


public Object execute(ExecutionEvent event) throws ExecutionException
{
final Composite composite =MyDragnDropUtil.getDesignEditorComposite();
final Composite dspComp = (Composite) composite.getChildren()[0];

final Button logger = new Button(dspComp, SWT.BORDER);
logger.setText("Button");

//Passing the Button as an DroppedWidgetItem (extends IAdaptable)as an IAdaptable element
DroppedWidgetItem dwi = new DroppedWidgetItem(logger, "Button");

// Adding the IAdaptable widgets to the IAdaptable list to link to the Property View
ndclist_static.add(dwi);

return null;
}
*****************************

I am however unable to set Selection Provider for this issue since the Button Widget is not a Viewer.

I am now trying to set SelectionProvider to this Composite so as to display the related Properties in the Property View when I setFocus on the Widgets dropped in the editor composite.

I hope I am clear with my explaination..

Thanks,

Dila
Re: setSelectionProvider to an editor without Viewers [message #657615 is a reply to message #657491] Thu, 03 March 2011 13:39 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You must implement a selection provider
(org.eclipse.jface.viewers.ISelectionProvider) in your editor code
somewhere, and then register it with your editor site. You must tell it
when you create a new DroppedWidgetItem or when your editor selects a
new DroppedWidgetItem, and fire the appropriate events.

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


icon9.gif  Re: setSelectionProvider to an editor without Viewers [message #657779 is a reply to message #657615] Fri, 04 March 2011 01:29 Go to previous messageGo to next message
Dila  is currently offline Dila Friend
Messages: 6
Registered: March 2011
Junior Member
Dear Paul,

Could you please provide me with some examples for your explanation. Kind of confused with the overall flow.

http://www.eclipse.org/forums/images/message_icons/icon5.gif

Thanks,

Dila

[Updated on: Fri, 04 March 2011 01:31]

Report message to a moderator

Re: setSelectionProvider to an editor without Viewers [message #657873 is a reply to message #657779] Fri, 04 March 2011 12:17 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 03/03/2011 08:29 PM, Dila wrote:
> Dear Paul,
>
> Could you please provide me with some examples for your explanation.
> Kind of confused with the overall
> flow...http://www.eclipse.org/forums/images/message_icons/ic on9.gif

See http://www.eclipse.org/articles/Article-WorkbenchSelections/ article.html

You can also add your target platform to the Java Search, open
ISelectionProvider, and use F4 (Type Hierarchy) to find examples of
implementation/use in the SDK. See
http://wiki.eclipse.org/FAQ_How_do_I_find_a_particular_class _from_an_Eclipse_plug-in%3F


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: setSelectionProvider to an editor without Viewers [message #658562 is a reply to message #657873] Wed, 09 March 2011 01:08 Go to previous message
Dila  is currently offline Dila Friend
Messages: 6
Registered: March 2011
Junior Member
Thanks Paul!

I have moved on to another module. I still haven't found a workaround for this issue.

I shall update if I get the solution.

If anyone could give me a workaround towards this issue.. would be grateful.

Thanks,

Dila
Previous Topic:RCP Book Tools
Next Topic:org.eclipse.ui.handlers: Why is handler class optional?
Goto Forum:
  


Current Time: Fri Apr 26 08:18:43 GMT 2024

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

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

Back to the top